[OpenWrt-Devel] [PATCH] ramips: use gpio_hog instead of gpio-export

Birger Koblitz mail at birger-koblitz.de
Fri Aug 2 05:58:50 EDT 2019


ramips: use gpio_hog instead of gpio-export

The `gpio-export` functionality is a hack for
missing kernel functionality, which was rejected in upstream kernel long
time
ago, for details see this email
http://lists.infradead.org/pipermail/openwrt-devel/2019-February/015772.html,
discussion in PR#1366 or
https://github.com/openwrt/openwrt/pull/1814#issuecomment-462942022.

This patch converts all remaining ramips .dts(i) files which were
using export-gpio and not making use of the change-direction functionality
to using gpio_hog instead

Signed-off-by: Birger Koblitz <mail at birger-koblitz.de>

---

diff --git a/target/linux/ramips/dts/mt7620a_alfa-network_tube-e4g.dts
b/target/linux/ramips/dts/mt7620a_alfa-network_tube-e4g.dts
index 4097dc6140..ea0d9801c1 100644
--- a/target/linux/ramips/dts/mt7620a_alfa-network_tube-e4g.dts
+++ b/target/linux/ramips/dts/mt7620a_alfa-network_tube-e4g.dts
@@ -21,39 +21,6 @@
         bootargs = "console=ttyS0,115200";
     };
 
-    gpio-export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        modem-enable {
-            gpio-export,name = "modem-enable";
-            gpio-export,output = <1>;
-            gpios = <&gpio1 12 GPIO_ACTIVE_HIGH>;
-        };
-
-        modem-rf-enable {
-            gpio-export,name = "modem-rf-enable";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-        };
-
-        sim-select {
-            gpio-export,name = "sim-select";
-            gpio-export,output = <0>;
-            gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
-        };
-
-        sim1-detect {
-            gpio-export,name = "sim1-detect";
-            gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
-        };
-
-        sim2-detect {
-            gpio-export,name = "sim2-detect";
-            gpios = <&gpio2 1 GPIO_ACTIVE_HIGH>;
-        };
-    };
-
     keys {
         compatible = "gpio-keys";
 
@@ -98,26 +65,61 @@
     };
 };
 
-&ehci {
+&gpio1 {
     status = "okay";
-};
 
-&ethernet {
-    mtd-mac-address = <&factory 0x28>;
+    modem-enable {
+        gpio-hog;
+        line-name = "modem-enable";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 };
 
 &gpio0 {
     status = "okay";
+
+    modem-rf-enable {
+        gpio-hog;
+        line-name = "modem-rf-enable";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+
+    sim-select {
+        gpio-hog;
+        line-name = "sim-select";
+        gpios = <13 GPIO_ACTIVE_HIGH>;
+        output-low;
+    };
+
+    sim1-detect {
+        gpio-hog;
+        line-name = "sim1-detect";
+        gpios = <9 GPIO_ACTIVE_HIGH>;
+        input;
+    };
 };
 
-&gpio1 {
+&gpio2 {
     status = "okay";
+
+    sim2-detect {
+        gpio-hog;
+        line-name = "sim2-detect";
+        gpios = <1 GPIO_ACTIVE_HIGH>;
+        input;
+    };
 };
 
-&gpio2 {
+&ehci {
     status = "okay";
 };
 
+&ethernet {
+    mtd-mac-address = <&factory 0x28>;
+};
+
 &gsw {
     mediatek,port4 = "ephy";
 };
diff --git a/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts
b/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts
index 3e54ffdad2..c573b38284 100644
--- a/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts
+++ b/target/linux/ramips/dts/mt7620a_asus_rt-ac51u.dts
@@ -53,16 +53,16 @@
             linux,code = <KEY_WPS_BUTTON>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        enable-leds {
-            gpio-export,name = "enable-leds";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
-        };
+    enable-leds {
+        gpio-hog;
+        line-name = "enable-leds";
+        gpios = <10 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts
b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts
index 707bc1c3d3..7af90c6908 100644
--- a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts
+++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a1.dts
@@ -63,21 +63,17 @@
             linux,default-trigger = "usbport";
         };
     };
-
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <0>;
-            gpios = <&gpio1 14 GPIO_ACTIVE_LOW>;
-        };
-    };
 };
 
 &gpio1 {
     status = "okay";
+
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <14 GPIO_ACTIVE_LOW>;
+        output-low;
+    };
 };
 
 &gpio2 {
diff --git a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts
b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts
index 26b23aa6d1..17ec47b9d5 100644
--- a/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts
+++ b/target/linux/ramips/dts/mt7620a_dlink_dwr-118-a2.dts
@@ -61,21 +61,17 @@
             linux,default-trigger = "usbport";
         };
     };
-
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio1 14 GPIO_ACTIVE_HIGH>;
-        };
-    };
 };
 
 &gpio1 {
     status = "okay";
+
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <14 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 };
 
 &gpio2 {
diff --git a/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts
b/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts
index e36af1dc7f..acb3524e3d 100644
--- a/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts
+++ b/target/linux/ramips/dts/mt7620a_dovado_tiny-ac.dts
@@ -39,16 +39,16 @@
             linux,code = <KEY_RESTART>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio2 {
+    status = "okay";
 
-        usbpower {
-            gpio-export,name = "usbpower";
-            gpio-export,output = <1>;
-            gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
-        };
+    usbpower {
+        gpio-hog;
+        line-name = "usbpower";
+        gpios = <5 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
@@ -56,10 +56,6 @@
     status = "okay";
 };
 
-&gpio2 {
-    status = "okay";
-};
-
 &gpio3 {
     status = "okay";
 };
diff --git a/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts
b/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts
index 5c90aa1549..d329c3380c 100644
--- a/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts
+++ b/target/linux/ramips/dts/mt7620a_edimax_br-6478ac-v2.dts
@@ -66,22 +66,17 @@
             linux,default-trigger = "usbport";
         };
     };
-
-
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-        usb-power {
-            gpio-export,name="usb-power";
-            gpio-export,output=<1>;
-            gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
-        };
-    };
 };
 
-
 &gpio2 {
     status = "okay";
+
+    usb-power {
+        gpio-hog;
+        line-name = "usb-power";
+        gpios = <5 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 };
 
 &spi0 {
diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts
b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts
index 73f1a4079a..b3af562e5d 100644
--- a/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts
+++ b/target/linux/ramips/dts/mt7620a_hiwifi_hc5861.dts
@@ -41,22 +41,23 @@
             gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usbpower {
-            gpio-export,name = "usbpower";
-            gpio-export,output = <0>;
-            gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
-        };
+    usbpower {
+        gpio-hog;
+        line-name = "usbpower";
+        gpios = <13 GPIO_ACTIVE_LOW>;
+        output-low;
+    };
 
-        sdpower {
-            gpio-export,name = "sdpower";
-            gpio-export,output = <0>;
-            gpios = <&gpio0 8 GPIO_ACTIVE_LOW>;
-        };
+    sdpower {
+        gpio-hog;
+        line-name = "sdpower";
+        gpios = <8 GPIO_ACTIVE_LOW>;
+        output-low;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi
b/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi
index 09b303fd33..85dc521722 100644
--- a/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi
+++ b/target/linux/ramips/dts/mt7620a_hiwifi_hc5x61.dtsi
@@ -20,16 +20,16 @@
             linux,code = <KEY_RESTART>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usbpower {
-            gpio-export,name = "usbpower";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
-        };
+    usbpower {
+        gpio-hog;
+        line-name = "usbpower";
+        gpios = <13 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
@@ -39,10 +39,6 @@
     ralink,wdtmux = <1>;
 };
 
-&gpio0 {
-    status = "okay";
-};
-
 &gpio2 {
     status = "okay";
 };
diff --git a/target/linux/ramips/dts/mt7620a_hnet_c108.dts
b/target/linux/ramips/dts/mt7620a_hnet_c108.dts
index 2d89d34ad5..3da128e8e8 100644
--- a/target/linux/ramips/dts/mt7620a_hnet_c108.dts
+++ b/target/linux/ramips/dts/mt7620a_hnet_c108.dts
@@ -53,17 +53,6 @@
         bootargs = "console=ttyS0,115200";
     };
 
-    gpio-export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        power_modem {
-            gpio-export,name = "power_modem";
-            gpio-export,output = <1>;
-            gpios = <&gpio2 2 GPIO_ACTIVE_HIGH>;
-        };
-    };
-
     leds {
         compatible = "gpio-leds";
 
@@ -105,11 +94,18 @@
     };
 };
 
-&gpio1 {
+&gpio2 {
     status = "okay";
+
+    power_modem {
+        gpio-hog;
+        line-name = "power_modem";
+        gpios = <2 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 };
 
-&gpio2 {
+&gpio1 {
     status = "okay";
 };
 
diff --git a/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts
b/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts
index 20974c93e2..261103d307 100644
--- a/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts
+++ b/target/linux/ramips/dts/mt7620a_lava_lr-25g001.dts
@@ -51,21 +51,17 @@
             gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
         };
     };
-
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        usbpower {
-            gpio-export,name = "usbpower";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-        };
-    };
 };
 
 &gpio0 {
     status = "okay";
+
+    usbpower {
+        gpio-hog;
+        line-name = "usbpower";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 };
 
 &spi0 {
diff --git a/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts
b/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts
index ccb0d18ead..20dcfcf8b0 100644
--- a/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts
+++ b/target/linux/ramips/dts/mt7620a_lenovo_newifi-y1s.dts
@@ -13,27 +13,6 @@
         led-upgrade = &led_power_blue;
     };
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        usb0 {
-            gpio-export,name = "usb0";
-            gpio-export,output = <1>;
-            gpios = <&gpio2 14 GPIO_ACTIVE_HIGH>;
-        };
-        usb1 {
-            gpio-export,name = "usb1";
-            gpio-export,output = <1>;
-            gpios = <&gpio2 15 GPIO_ACTIVE_HIGH>;
-        };
-        usb2 {
-            gpio-export,name = "usb2";
-            gpio-export,output = <1>;
-            gpios = <&gpio2 16 GPIO_ACTIVE_HIGH>;
-        };
-    };
-
     leds {
         compatible = "gpio-leds";
 
@@ -76,6 +55,31 @@
     };
 };
 
+&gpio2 {
+    status = "okay";
+
+    usb0 {
+        gpio-hog;
+        line-name = "usb0";
+        gpios = <14 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+
+    usb1 {
+        gpio-hog;
+        line-name = "usb1";
+        gpios = <15 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+
+    usb2 {
+        gpio-hog;
+        line-name = "usb2";
+        gpios = <16 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+};
+
 &ethernet {
     status = "okay";
     mtd-mac-address = <&factory 0x4>;
diff --git a/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts
b/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts
index 2110959ee8..1a45803b8e 100644
--- a/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts
+++ b/target/linux/ramips/dts/mt7620a_sanlinking_d240.dts
@@ -53,23 +53,6 @@
         bootargs = "console=ttyS0,115200";
     };
 
-    gpio-export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        power_mpcie2 {
-            gpio-export,name = "power_mpcie2";
-            gpio-export,output = <1>;
-            gpios = <&gpio2 5 GPIO_ACTIVE_HIGH>;
-        };
-
-        power_mpcie1 {
-            gpio-export,name = "power_mpcie1";
-            gpio-export,output = <1>;
-            gpios = <&gpio2 6 GPIO_ACTIVE_HIGH>;
-        };
-    };
-
     leds {
         compatible = "gpio-leds";
 
@@ -103,11 +86,25 @@
     };
 };
 
-&gpio1 {
+&gpio2 {
     status = "okay";
+
+    power_mpcie2 {
+        gpio-hog;
+        line-name = "power_mpcie2";
+        gpios = <5 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+
+    power_mpcie1 {
+        gpio-hog;
+        line-name = "power_mpcie1";
+        gpios = <6 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 };
 
-&gpio2 {
+&gpio1 {
     status = "okay";
 };
 
diff --git a/target/linux/ramips/dts/mt7620a_sercomm_na930.dts
b/target/linux/ramips/dts/mt7620a_sercomm_na930.dts
index 6d85914265..95f49c24a3 100644
--- a/target/linux/ramips/dts/mt7620a_sercomm_na930.dts
+++ b/target/linux/ramips/dts/mt7620a_sercomm_na930.dts
@@ -102,16 +102,16 @@
             gpios = <&gpio2 29 GPIO_ACTIVE_LOW>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        telit {
-            gpio-export,name = "telit";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
-        };
+    telit {
+        gpio-hog;
+        line-name = "telit";
+        gpios = <13 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts
b/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts
index 566b2431fc..6657def5fd 100644
--- a/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts
+++ b/target/linux/ramips/dts/mt7620a_tplink_archer-mr200.dts
@@ -89,16 +89,16 @@
             linux,code = <KEY_RFKILL>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        power_usb {
-            gpio-export,name = "power_usb1";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
-        };
+    power_usb1 {
+        gpio-hog;
+        line-name = "power_usb1";
+        gpios = <11 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7620a_yukai_bocco.dts
b/target/linux/ramips/dts/mt7620a_yukai_bocco.dts
index cc9c6688dc..0e8bc49688 100644
--- a/target/linux/ramips/dts/mt7620a_yukai_bocco.dts
+++ b/target/linux/ramips/dts/mt7620a_yukai_bocco.dts
@@ -20,20 +20,6 @@
         };
     };
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        s1 {
-            gpio-export,name = "rec";
-            gpios = <&gpio1 8 GPIO_ACTIVE_HIGH>;
-        };
-        s2 {
-            gpio-export,name = "play";
-            gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>;
-        };
-    };
-
     sound {
         compatible = "simple-audio-card";
         simple-audio-card,name = "Audio-I2S";
@@ -57,11 +43,25 @@
     };
 };
 
-&gpio0 {
+&gpio1 {
     status = "okay";
+
+    rec {
+        gpio-hog;
+        line-name = "rec";
+        gpios = <8 GPIO_ACTIVE_HIGH>;
+        input;
+    };
+
+    play {
+        gpio-hog;
+        line-name = "play";
+        gpios = <9 GPIO_ACTIVE_HIGH>;
+        input;
+    };
 };
 
-&gpio1 {
+&gpio0 {
     status = "okay";
 };
 
diff --git a/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts
b/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts
index 3d6d2c6f06..4a47cbade8 100644
--- a/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts
+++ b/target/linux/ramips/dts/mt7620a_zyxel_keenetic-viva.dts
@@ -70,17 +70,6 @@
         };
     };
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        usb_power {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-        };
-    };
-
     rtl8367rb {
         compatible = "realtek,rtl8367b";
         cpu_port = <7>;
@@ -89,6 +78,17 @@
     };
 };
 
+&gpio0 {
+    status = "okay";
+
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+};
+
 &spi0 {
     status = "okay";
 
diff --git a/target/linux/ramips/dts/mt7620n_dlink_dwr-921-c1.dts
b/target/linux/ramips/dts/mt7620n_dlink_dwr-921-c1.dts
index 92bcd54a42..3a96e51e70 100644
--- a/target/linux/ramips/dts/mt7620n_dlink_dwr-921-c1.dts
+++ b/target/linux/ramips/dts/mt7620n_dlink_dwr-921-c1.dts
@@ -69,16 +69,16 @@
             gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        lte_modem_enable {
-            gpio-export,name = "lte_modem_enable";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
-        };
+    lte_modem_enable {
+        gpio-hog;
+        line-name = "lte_modem_enable";
+        gpios = <0 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7620n_dlink_dwr-922-e2.dts
b/target/linux/ramips/dts/mt7620n_dlink_dwr-922-e2.dts
index c2dd26a09d..d17345d620 100644
--- a/target/linux/ramips/dts/mt7620n_dlink_dwr-922-e2.dts
+++ b/target/linux/ramips/dts/mt7620n_dlink_dwr-922-e2.dts
@@ -71,16 +71,16 @@
             gpios = <&gpio3 0 GPIO_ACTIVE_LOW>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        lte_modem_enable {
-            gpio-export,name = "lte_modem_enable";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
-        };
+    lte_modem_enable {
+        gpio-hog;
+        line-name = "lte_modem_enable";
+        gpios = <0 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts
b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts
index 765629548c..dc60d0ad18 100644
--- a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts
+++ b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni-ii.dts
@@ -64,16 +64,16 @@
             linux,code = <BTN_0>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb_power {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
-        };
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <21 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts
b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts
index 74396d1fc2..2ac47804d9 100644
--- a/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts
+++ b/target/linux/ramips/dts/mt7620n_zyxel_keenetic-omni.dts
@@ -64,16 +64,16 @@
             linux,code = <BTN_0>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb_power {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
-        };
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <21 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts
b/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts
index d51eb29600..95db962ae4 100644
--- a/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts
+++ b/target/linux/ramips/dts/mt7621_d-team_newifi-d2.dts
@@ -77,16 +77,16 @@
             linux,code = <KEY_WPS_BUTTON>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        power_usb3 {
-            gpio-export,name = "power_usb3";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
-        };
+    power_usb3 {
+        gpio-hog;
+        line-name = "power_usb3";
+        gpios = <11 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts
b/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts
index 3eb0fac46e..2c1b050240 100644
--- a/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts
+++ b/target/linux/ramips/dts/mt7621_d-team_pbr-m1.dts
@@ -73,32 +73,34 @@
         };
     };
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        power_usb2 {
-            gpio-export,name = "power_usb2";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
-        };
+    beeper: beeper {
+        compatible = "gpio-beeper";
+        gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
+    };
+};
 
-        power_usb3 {
-            gpio-export,name = "power_usb3";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
-        };
+&gpio0 {
+    status = "okay";
 
-        power_sata {
-            gpio-export,name = "power_sata";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
-        };
+    power_usb2 {
+        gpio-hog;
+        line-name = "power_usb2";
+        gpios = <22 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 
-    beeper: beeper {
-        compatible = "gpio-beeper";
-        gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
+    power_usb3 {
+        gpio-hog;
+        line-name = "power_usb3";
+        gpios = <25 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+
+    power_sata {
+        gpio-hog;
+        line-name = "power_sata";
+        gpios = <27 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts
b/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts
index e681e1a0c9..45963b7333 100644
--- a/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts
+++ b/target/linux/ramips/dts/mt7621_lenovo_newifi-d1.dts
@@ -50,22 +50,23 @@
             linux,code = <KEY_RESTART>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb2power {
-            gpio-export,name = "usb2power";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
-        };
+    usb2power {
+        gpio-hog;
+        line-name = "usb2power";
+        gpios = <9 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 
-        usb3power {
-            gpio-export,name = "usb3power";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
-        };
+    usb3power {
+        gpio-hog;
+        line-name = "usb3power";
+        gpios = <11 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7621_mikrotik_rb750gr3.dts
b/target/linux/ramips/dts/mt7621_mikrotik_rb750gr3.dts
index 0b39fa240a..80d3864205 100644
--- a/target/linux/ramips/dts/mt7621_mikrotik_rb750gr3.dts
+++ b/target/linux/ramips/dts/mt7621_mikrotik_rb750gr3.dts
@@ -57,16 +57,16 @@
         compatible = "gpio-beeper";
         gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb_power {
-            gpio-export,name = "usb_power";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-        };
+    usb_power {
+        gpio-hog;
+        line-name = "usb_power";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7621_netgear_r6350.dts
b/target/linux/ramips/dts/mt7621_netgear_r6350.dts
index 403fc91d54..8cfd161248 100644
--- a/target/linux/ramips/dts/mt7621_netgear_r6350.dts
+++ b/target/linux/ramips/dts/mt7621_netgear_r6350.dts
@@ -63,16 +63,16 @@
             linux,code = <KEY_RESTART>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usbpower {
-            gpio-export,name = "usbpower";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
-        };
+    usbpower {
+        gpio-hog;
+        line-name = "usbpower";
+        gpios = <10 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi
b/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi
index 301edfe680..02ba003dd3 100644
--- a/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi
+++ b/target/linux/ramips/dts/mt7621_unielec_u7621-06.dtsi
@@ -51,17 +51,6 @@
         bootargs = "console=ttyS0,115200";
     };
 
-    gpio-export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        modem_reset {
-            gpio-export,name = "modem_reset";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 16 GPIO_ACTIVE_LOW>;
-        };
-    };
-
     keys {
         compatible = "gpio-keys-polled";
         poll-interval = <20>;
@@ -95,6 +84,13 @@
 
 &gpio0 {
     status = "okay";
+
+    modem_reset {
+        gpio-hog;
+        line-name = "modem_reset";
+        gpios = <16 GPIO_ACTIVE_LOW>;
+        output-high;
+    };
 };
 
 &sdhci {
diff --git a/target/linux/ramips/dts/mt7621_xzwifi_creativebox-v1.dts
b/target/linux/ramips/dts/mt7621_xzwifi_creativebox-v1.dts
index 73bfd6a4f0..4b61f631c7 100644
--- a/target/linux/ramips/dts/mt7621_xzwifi_creativebox-v1.dts
+++ b/target/linux/ramips/dts/mt7621_xzwifi_creativebox-v1.dts
@@ -63,28 +63,30 @@
             linux,code = <KEY_RESTART>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        power_usb2 {
-            gpio-export,name = "power_usb2";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 22 GPIO_ACTIVE_HIGH>;
-        };
+    power_usb2 {
+        gpio-hog;
+        line-name = "power_usb2";
+        gpios = <22 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 
-        power_usb3 {
-            gpio-export,name = "power_usb3";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 25 GPIO_ACTIVE_HIGH>;
-        };
+    power_usb3 {
+        gpio-hog;
+        line-name = "power_usb3";
+        gpios = <25 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 
-        power_sata {
-            gpio-export,name = "power_sata";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 27 GPIO_ACTIVE_HIGH>;
-        };
+    power_sata {
+        gpio-hog;
+        line-name = "power_sata";
+        gpios = <27 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts
b/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts
index 6222cfe345..0944ee5221 100644
--- a/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts
+++ b/target/linux/ramips/dts/mt7628an_glinet_gl-mt300n-v2.dts
@@ -62,16 +62,16 @@
             linux,code = <BTN_1>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
-        };
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <11 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git
a/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts
b/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts
index 1d083ed8bb..2893466409 100644
--- a/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts
+++ b/target/linux/ramips/dts/mt7628an_zyxel_keenetic-extra-ii.dts
@@ -69,16 +69,16 @@
             linux,default-trigger = "usbport";
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usbpower {
-            gpio-export,name = "usbpower";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
-        };
+    usbpower {
+        gpio-hog;
+        line-name = "usbpower";
+        gpios = <6 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt3050_arcwireless_freestation5.dts
b/target/linux/ramips/dts/rt3050_arcwireless_freestation5.dts
index b924229a7e..6fb3a96991 100644
--- a/target/linux/ramips/dts/rt3050_arcwireless_freestation5.dts
+++ b/target/linux/ramips/dts/rt3050_arcwireless_freestation5.dts
@@ -49,20 +49,10 @@
             };
         };
     };
-
-    gpio-export {
-        compatible = "gpio-export";
-
         /*
          * Used to enable power-over-ethernet passthrough from port0 to
port1.
          * Disable passthrough by default to prevent accidental
equipment damage.
          */
-        poe {
-            gpio-export,name = "poe-passthrough";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
-        };
-    };
 
     leds {
         compatible = "gpio-leds";
@@ -88,6 +78,17 @@
     };
 };
 
+&gpio0 {
+    status = "okay";
+
+    poe-passthrough {
+        gpio-hog;
+        line-name = "poe-passthrough";
+        gpios = <11 GPIO_ACTIVE_LOW>;
+        output-high;
+    };
+};
+
 &pinctrl {
     state_default: pinctrl0 {
         gpio {
diff --git a/target/linux/ramips/dts/rt3052_accton_wr6202.dts
b/target/linux/ramips/dts/rt3052_accton_wr6202.dts
index 1caec41a4b..d30c028be9 100644
--- a/target/linux/ramips/dts/rt3052_accton_wr6202.dts
+++ b/target/linux/ramips/dts/rt3052_accton_wr6202.dts
@@ -80,16 +80,16 @@
             };
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <0>;
-            gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
-        };
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <11 GPIO_ACTIVE_LOW>;
+        output-low;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt3052_jcg_jhr-n926r.dts
b/target/linux/ramips/dts/rt3052_jcg_jhr-n926r.dts
index 9414828594..6512501c48 100644
--- a/target/linux/ramips/dts/rt3052_jcg_jhr-n926r.dts
+++ b/target/linux/ramips/dts/rt3052_jcg_jhr-n926r.dts
@@ -77,29 +77,6 @@
         };
     };
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        display_data {
-            gpio-export,name = "display_data";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
-        };
-
-        display_clock {
-            gpio-export,name = "display_clock";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 8 GPIO_ACTIVE_HIGH>;
-        };
-
-        display_blank {
-            gpio-export,name = "display_blank";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
-        };
-    };
-
     keys {
         compatible = "gpio-keys-polled";
         poll-interval = <20>;
@@ -118,6 +95,31 @@
     };
 };
 
+&gpio0 {
+    status = "okay";
+
+    display_data {
+        gpio-hog;
+        line-name = "display_data";
+        gpios = <7 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+
+    display_clock {
+        gpio-hog;
+        line-name = "display_clock";
+        gpios = <8 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+
+    display_blank {
+        gpio-hog;
+        line-name = "display_blank";
+        gpios = <11 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+};
+
 &pinctrl {
     state_default: pinctrl0 {
         gpio {
diff --git a/target/linux/ramips/dts/rt3052_planex_mzk-wdpr.dts
b/target/linux/ramips/dts/rt3052_planex_mzk-wdpr.dts
index 17591268b6..ed4ddd20db 100644
--- a/target/linux/ramips/dts/rt3052_planex_mzk-wdpr.dts
+++ b/target/linux/ramips/dts/rt3052_planex_mzk-wdpr.dts
@@ -55,15 +55,16 @@
             };
         };
     };
+};
 
-    gpio-export {
-        compatible = "gpio-export";
+&gpio0 {
+    status = "okay";
 
-        lcd_ctrl1 {
-            gpio-export,name = "lcd_ctrl1";
-            gpio-export,output = <0>;
-            gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
-        };
+    lcd_ctrl1 {
+        gpio-hog;
+        line-name = "lcd_ctrl1";
+        gpios = <1 GPIO_ACTIVE_HIGH>;
+        output-low;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt3883_dlink_dir-645.dts
b/target/linux/ramips/dts/rt3883_dlink_dir-645.dts
index 35d011ebba..7e5e079cd2 100644
--- a/target/linux/ramips/dts/rt3883_dlink_dir-645.dts
+++ b/target/linux/ramips/dts/rt3883_dlink_dir-645.dts
@@ -53,21 +53,17 @@
             gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
         };
     };
-
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
-        };
-    };
 };
 
 &gpio1 {
     status = "okay";
+
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <6 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 };
 
 &spi0 {
diff --git a/target/linux/ramips/dts/rt3883_edimax_br-6475nd.dts
b/target/linux/ramips/dts/rt3883_edimax_br-6475nd.dts
index f7fb8b5c40..6950535edd 100644
--- a/target/linux/ramips/dts/rt3883_edimax_br-6475nd.dts
+++ b/target/linux/ramips/dts/rt3883_edimax_br-6475nd.dts
@@ -108,19 +108,20 @@
      * and the headers are there.
      */
     /*
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        usb {
-            gpio-export,name="usb";
-            gpio-export,output=<0>;
-            gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;
-        };
-    };
     */
 };
 
+&gpio0 {
+    status = "okay";
+
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <19 GPIO_ACTIVE_LOW>;
+        output-low;
+    };
+};
+
 &pinctrl {
     state_default: pinctrl0 {
         gpio {
diff --git a/target/linux/ramips/dts/rt3883_omnima_hpm.dts
b/target/linux/ramips/dts/rt3883_omnima_hpm.dts
index 7ccd078144..bcc0b1ba82 100644
--- a/target/linux/ramips/dts/rt3883_omnima_hpm.dts
+++ b/target/linux/ramips/dts/rt3883_omnima_hpm.dts
@@ -66,23 +66,23 @@
             gpios = <&gpio0 19 GPIO_ACTIVE_LOW>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-        /* gpio 12 and 13 handle the OC input */
+&gpio0 {
+    status = "okay";
 
-        usb0 {
-            gpio-export,name = "usb0";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
-        };
+    usb0 {
+        gpio-hog;
+        line-name = "usb0";
+        gpios = <2 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 
-        usb1 {
-            gpio-export,name = "usb1";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
-        };
+    usb1 {
+        gpio-hog;
+        line-name = "usb1";
+        gpios = <1 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt3883_sitecom_wlr-6000.dts
b/target/linux/ramips/dts/rt3883_sitecom_wlr-6000.dts
index 2b1f707658..22634e8819 100644
--- a/target/linux/ramips/dts/rt3883_sitecom_wlr-6000.dts
+++ b/target/linux/ramips/dts/rt3883_sitecom_wlr-6000.dts
@@ -40,16 +40,16 @@
             gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
-        };
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <9 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt5350_dlink_dir-320-b1.dts
b/target/linux/ramips/dts/rt5350_dlink_dir-320-b1.dts
index 040a223986..abbcf6392d 100644
--- a/target/linux/ramips/dts/rt5350_dlink_dir-320-b1.dts
+++ b/target/linux/ramips/dts/rt5350_dlink_dir-320-b1.dts
@@ -51,22 +51,23 @@
             linux,code = <KEY_WPS_BUTTON>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
-        };
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <7 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 
-        root_hub {
-            gpio-export,name = "root_hub";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-        };
+    root_hub {
+        gpio-hog;
+        line-name = "root_hub";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts
b/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts
index a08ea5d03c..666219aca4 100644
--- a/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts
+++ b/target/linux/ramips/dts/rt5350_dlink_dwr-512-b.dts
@@ -61,20 +61,23 @@
             gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
         };
     };
+};
 
-    gpio-export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        slic_int {
-            gpio-export,name = "slic_int";
-            gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
-        };
-        modem3g_enable {
-            gpio-export,name = "modem3g_enable";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 18 GPIO_ACTIVE_HIGH>;
-        };
+    slic_int {
+        gpio-hog;
+        line-name = "slic_int";
+        gpios = <1 GPIO_ACTIVE_LOW>;
+        input;
+    };
+
+    modem3g_enable {
+        gpio-hog;
+        line-name = "modem3g_enable";
+        gpios = <18 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt5350_hame_mpr-a1.dts
b/target/linux/ramips/dts/rt5350_hame_mpr-a1.dts
index 328351a550..c15de48f5e 100644
--- a/target/linux/ramips/dts/rt5350_hame_mpr-a1.dts
+++ b/target/linux/ramips/dts/rt5350_hame_mpr-a1.dts
@@ -40,22 +40,23 @@
             linux,code = <KEY_RESTART>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
-        };
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <7 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 
-        root_hub {
-            gpio-export,name = "root_hub";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-        };
+    root_hub {
+        gpio-hog;
+        line-name = "root_hub";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt5350_hame_mpr-a2.dts
b/target/linux/ramips/dts/rt5350_hame_mpr-a2.dts
index fedb5b061e..5481d6d6ab 100644
--- a/target/linux/ramips/dts/rt5350_hame_mpr-a2.dts
+++ b/target/linux/ramips/dts/rt5350_hame_mpr-a2.dts
@@ -40,22 +40,23 @@
             linux,code = <KEY_RESTART>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
-        };
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <7 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 
-        root_hub {
-            gpio-export,name = "root_hub";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-        };
+    root_hub {
+        gpio-hog;
+        line-name = "root_hub";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git
a/target/linux/ramips/dts/rt5350_olimex_rt5350f-olinuxino-evb.dts
b/target/linux/ramips/dts/rt5350_olimex_rt5350f-olinuxino-evb.dts
index 57164ea8ac..a22c961773 100644
--- a/target/linux/ramips/dts/rt5350_olimex_rt5350f-olinuxino-evb.dts
+++ b/target/linux/ramips/dts/rt5350_olimex_rt5350f-olinuxino-evb.dts
@@ -7,26 +7,29 @@
 / {
     compatible = "olimex,rt5350f-olinuxino-evb", "ralink,rt5350-soc";
     model = "Olimex RT5350F-OLinuXino-EVB";
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        relay1 {
-            gpio-export,name = "relay1";
-            gpio-export,output = <0>;
-            gpios = <&gpio0 14 GPIO_ACTIVE_HIGH>;
-        };
+    relay1 {
+        gpio-hog;
+        line-name = "relay1";
+        gpios = <14 GPIO_ACTIVE_HIGH>;
+        output-low;
+    };
 
-        relay2 {
-            gpio-export,name = "relay2";
-            gpio-export,output = <0>;
-            gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-        };
+    relay2 {
+        gpio-hog;
+        line-name = "relay2";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        output-low;
+    };
 
-        button {
-            gpio-export,name = "button";
-            gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
-        };
+    button {
+        gpio-hog;
+        line-name = "button";
+        gpios = <0 GPIO_ACTIVE_LOW>;
+        input;
     };
 };
diff --git a/target/linux/ramips/dts/rt5350_poray_x5.dts
b/target/linux/ramips/dts/rt5350_poray_x5.dts
index 7e3d8b6f03..811a61534f 100644
--- a/target/linux/ramips/dts/rt5350_poray_x5.dts
+++ b/target/linux/ramips/dts/rt5350_poray_x5.dts
@@ -63,16 +63,16 @@
             linux,input-type = <EV_SW>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb-mode {
-            gpio-export,name = "usb-mode";
-            gpio-export,output = <0>;
-            gpios = <&gpio0 18 GPIO_ACTIVE_LOW>;
-        };
+    usb-mode {
+        gpio-hog;
+        line-name = "usb-mode";
+        gpios = <18 GPIO_ACTIVE_LOW>;
+        output-low;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt5350_tenda_3g150b.dts
b/target/linux/ramips/dts/rt5350_tenda_3g150b.dts
index 9d13625516..c924b7e5d1 100644
--- a/target/linux/ramips/dts/rt5350_tenda_3g150b.dts
+++ b/target/linux/ramips/dts/rt5350_tenda_3g150b.dts
@@ -42,16 +42,16 @@
             linux,code = <KEY_RESTART>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>;
-        };
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <13 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt5350_trendnet_tew-714tru.dts
b/target/linux/ramips/dts/rt5350_trendnet_tew-714tru.dts
index 00e3d2df12..56b2083feb 100644
--- a/target/linux/ramips/dts/rt5350_trendnet_tew-714tru.dts
+++ b/target/linux/ramips/dts/rt5350_trendnet_tew-714tru.dts
@@ -41,20 +41,23 @@
             linux,code = <KEY_WPS_BUTTON>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        repeater {
-            gpio-export,name = "repeater_switch";
-            gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
-        };
+    repeater_switch {
+        gpio-hog;
+        line-name = "repeater_switch";
+        gpios = <7 GPIO_ACTIVE_HIGH>;
+        input;
+    };
 
-        wisp {
-            gpio-export,name = "wisp_switch";
-            gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-        };
+    wisp_switch {
+        gpio-hog;
+        line-name = "wisp_switch";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        input;
     };
 };
 
diff --git a/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts
b/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts
index 707963d691..2192e7fba8 100644
--- a/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts
+++ b/target/linux/ramips/dts/rt5350_unbranded_a5-v11.dts
@@ -40,22 +40,23 @@
             linux,code = <KEY_RESTART>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio0 {
+    status = "okay";
 
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
-        };
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <7 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
 
-        root_hub {
-            gpio-export,name = "root_hub";
-            gpio-export,output = <1>;
-            gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>;
-        };
+    root_hub {
+        gpio-hog;
+        line-name = "root_hub";
+        gpios = <12 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list