[OpenWrt-Devel,v2] lantiq: use gpio_hog instead of gpio-export
diff mbox series

Message ID c970fc42-3dbc-c2f0-c13d-502aedf3d49f@birger-koblitz.de
State New
Headers show
Series
  • [OpenWrt-Devel,v2] lantiq: use gpio_hog instead of gpio-export
Related show

Commit Message

Birger Koblitz Aug. 19, 2019, 7:18 a.m. UTC
lantiq: 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 lantiq .dts(i) files which were
using export-gpio, not making use of the change-direction functionality
and not used from user-space to using gpio_hog instead

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

---

v2: - Not converting annexa/b export in DM200.dts
    - Not converting power_led_blink export in ASL56026.dts

Patch
diff mbox series

diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/ARV7519PW.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/ARV7519PW.dts
index e9c418e482..571a142fa7 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/ARV7519PW.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/ARV7519PW.dts
@@ -108,17 +108,16 @@ 
             gpios = <&gpio 29 GPIO_ACTIVE_LOW>;
         };
     };
+};
 
-    /* is there another way to "reserve" the GPIO? */
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio {
+    status = "okay";
 
-        switch {
-            gpio-export,name = "switch";
-            gpio-export,output = <1>;
-            gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
-        };
+    switch {
+        gpio-hog;
+        line-name = "switch";
+        gpios = <19 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };
 
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/GIGASX76X.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/GIGASX76X.dts
index a9a5cbae2f..6b4ab7f918 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/GIGASX76X.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/GIGASX76X.dts
@@ -28,17 +28,6 @@ 
         };
     };
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        switch {
-            gpio-export,name = "switch";
-            gpio-export,output = <1>;
-            gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;
-        };
-    };
-
     usb_vbus: regulator-usb-vbus {
         compatible = "regulator-fixed";
 
@@ -52,6 +41,17 @@ 
     };
 };
 
+&gpio {
+    status = "okay";
+
+    switch {
+        gpio-hog;
+        line-name = "switch";
+        gpios = <19 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+};
+
 &gpio {
     pinctrl-names = "default";
     pinctrl-0 = <&state_default>;
@@ -64,10 +64,6 @@ 
     };
 };
 
-&gpios {
-    status = "okay";
-};
-
 &gsw {
     phy-mode = "rmii";
 };
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/H201L.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/H201L.dts
index 9b640e0327..fe0e5af0c1 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/H201L.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/H201L.dts
@@ -84,27 +84,6 @@ 
         };
     };
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
-
-        switch {
-            gpio-export,name = "switch";
-            gpio-export,output = <1>;
-            gpios = <&gpio 38 GPIO_ACTIVE_HIGH>;
-        };
-        usb {
-            gpio-export,name = "usb";
-            gpio-export,output = <1>;
-            gpios = <&gpio 28 GPIO_ACTIVE_HIGH>;
-        };
-        wifi {
-            gpio-export,name = "wifi";
-            gpio-export,output = <1>;
-            gpios = <&gpio 7 GPIO_ACTIVE_HIGH>;
-        };
-    };
-
     usb_vbus: regulator-usb-vbus {
         compatible = "regulator-fixed";
 
@@ -118,6 +97,31 @@ 
     };
 };
 
+&gpio {
+    status = "okay";
+
+    switch {
+        gpio-hog;
+        line-name = "switch";
+        gpios = <38 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+
+    usb {
+        gpio-hog;
+        line-name = "usb";
+        gpios = <28 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+
+    wifi {
+        gpio-hog;
+        line-name = "wifi";
+        gpios = <7 GPIO_ACTIVE_HIGH>;
+        output-high;
+    };
+};
+
 &gpio {
     pinctrl-names = "default";
     pinctrl-0 = <&state_default>;
@@ -165,7 +169,6 @@ 
     status = "okay";
 };
 
-
 &usb0 {
     status = "okay";
     vbus-supply = <&usb_vbus>;
diff --git a/target/linux/lantiq/files/arch/mips/boot/dts/P2601HNFX.dts
b/target/linux/lantiq/files/arch/mips/boot/dts/P2601HNFX.dts
index 62e5e70169..9abc5745e4 100644
--- a/target/linux/lantiq/files/arch/mips/boot/dts/P2601HNFX.dts
+++ b/target/linux/lantiq/files/arch/mips/boot/dts/P2601HNFX.dts
@@ -85,16 +85,16 @@ 
             gpios = <&stp 10 GPIO_ACTIVE_LOW>;
         };
     };
+};
 
-    gpio_export {
-        compatible = "gpio-export";
-        #size-cells = <0>;
+&gpio {
+    status = "okay";
 
-        switch {
-            gpio-export,name = "switch";
-            gpio-export,output = <1>;
-            gpios = <&gpio 50 GPIO_ACTIVE_HIGH>;
-        };
+    switch {
+        gpio-hog;
+        line-name = "switch";
+        gpios = <50 GPIO_ACTIVE_HIGH>;
+        output-high;
     };
 };