scripts: kconfig: add function to determine if GPIO hogs are enabled

Existence of enabled GPIO hog nodes cannot be determined using any of the
existing kconfig functions. Add custom kconfig helper function to determine
whether any GPIO hogs nodes are enabled.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py
index 86f3517..ebec7f5 100644
--- a/scripts/kconfig/kconfigfunctions.py
+++ b/scripts/kconfig/kconfigfunctions.py
@@ -708,6 +708,19 @@
 
     return node.parent.path if node.parent else ""
 
+def dt_gpio_hogs_enabled(kconf, _):
+    """
+    Return "y" if any GPIO hog node is enabled. Otherwise, return "n".
+    """
+    if doc_mode or edt is None:
+        return "n"
+
+    for node in edt.nodes:
+        if node.gpio_hogs and node.status == "okay":
+            return "y"
+
+    return "n"
+
 def shields_list_contains(kconf, _, shield):
     """
     Return "n" if cmake environment variable 'SHIELD_AS_LIST' doesn't exist.
@@ -766,5 +779,6 @@
         "dt_nodelabel_path": (dt_nodelabel_path, 1, 1),
         "dt_node_parent": (dt_node_parent, 1, 1),
         "dt_nodelabel_array_prop_has_val": (dt_nodelabel_array_prop_has_val, 3, 3),
+        "dt_gpio_hogs_enabled": (dt_gpio_hogs_enabled, 0, 0),
         "shields_list_contains": (shields_list_contains, 1, 1),
 }