<html><head></head><body>Thanks Adrian for taking this up again!<br><br>Birger<br><br><div class="gmail_quote">On 5 November 2019 16:12:02 CET, Adrian Schmutzler <freifunk@adrianschmutzler.de> wrote:<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">From: Birger Koblitz <mail@birger-koblitz.de><br><br>The gpio-export functionality is a hack for missing kernel<br>functionality, which was rejected in upstream kernel long time ago,<br>for details see this email<br><a href="http://lists.infradead.org/pipermail/openwrt-devel/2019-February/015772.html,">http://lists.infradead.org/pipermail/openwrt-devel/2019-February/015772.html,</a><br>discussion in PR#1366 or<br><a href="https://github.com/openwrt/openwrt/pull/1814#issuecomment-462942022.">https://github.com/openwrt/openwrt/pull/1814#issuecomment-462942022.</a><br><br>This patch converts all DTS files with settings that normally do<br>not need user interaction, e.g. power for external USB ports, to<br>gpio_hog. The only remaining gpio-export will be in<br>qca9558_openmesh_om5p-ac-v2.dts<br><br>Signed-off-by: Birger Koblitz <mail@birger-koblitz.de><br>[rebased, renamed nodes, do not change openmesh, removed redundant<br>status=okay, updated commit message]<br>Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de><hr>This is a resubmission of the patch initially created by Birger<br>Koblitz. It should be limited to conversion that do not require<br>the user setting the value.<hr> .../dts/ar7161_buffalo_wzr-hp-ag300h.dts | 19 ++++++------<br> .../ath79/dts/ar7241_tplink_tl-mr3x20.dtsi | 15 +++++-----<br> .../ath79/dts/ar7241_tplink_tl-wr842n-v1.dts | 19 +++++-------<br> .../ath79/dts/ar7242_buffalo_wzr-bhr.dtsi | 20 ++++++-------<br> .../dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts | 20 ++++++-------<br> .../ath79/dts/ar9341_tplink_tl-wr842n-v2.dts | 19 ++++++------<br> .../ath79/dts/qca9558_devolo_dvl1750e.dts | 15 +++++-----<br> .../ath79/dts/qca9558_tplink_archer-c7.dtsi | 30 +++++++++----------<br> .../dts/qca9558_tplink_tl-wdr4900-v2.dts | 28 +++++++++--------<br> .../ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi | 20 +++++--------<br> .../ath79/dts/qca9561_tplink_archer-c5x.dtsi | 30 +++++++++----------<br> .../ath79/dts/qca9563_dlink_dir-859-a1.dts | 20 +++++--------<br> .../ath79/dts/qca9563_tplink_archer-c7-v4.dts | 30 +++++++++----------<br> .../dts/qca9563_tplink_archer-x7-v5.dtsi | 17 +++++------<br> .../dts/qca9563_tplink_tl-wr1043nd-v4.dts | 16 +++++-----<br> 15 files changed, 145 insertions(+), 173 deletions(-)<br><br>diff --git a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts<br>index f51bc0f771..23f1845876 100644<br>--- a/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts<br>+++ b/target/linux/ath79/dts/ar7161_buffalo_wzr-hp-ag300h.dts<br>@@ -120,16 +120,6 @@<br> };<br> };<br> <br>- gpio-export {<br>- compatible = "gpio-export";<br>-<br>- gpio_usb_power {<br>- gpio-export,name = "buffalo:power:usb";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;<br>- };<br>- };<br>-<br> flash {<br> compatible = "mtd-concat";<br> <br>@@ -172,6 +162,15 @@<br> };<br> };<br> <br>+&gpio {<br>+ usb_power {<br>+ gpio-hog;<br>+ line-name = "buffalo:power:usb";<br>+ gpios = <2 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br>+ };<br>+};<br>+<br> &usb_phy {<br> status = "okay";<br> };<br>diff --git a/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi b/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi<br>index 04403637b6..333ee17ceb 100644<br>--- a/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi<br>+++ b/target/linux/ath79/dts/ar7241_tplink_tl-mr3x20.dtsi<br>@@ -3,15 +3,14 @@<br> #include "ar7241_tplink.dtsi"<br> <br> / {<br>- gpio-export {<br>- compatible = "gpio-export";<br>- #size-cells = <0>;<br>+};<br> <br>- gpio_usb_power {<br>- gpio-export,name = "tp-link:power:usb";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;<br>- };<br>+&gpio {<br>+ usb_power {<br>+ gpio-hog;<br>+ line-name = "tp-link:power:usb";<br>+ gpios = <6 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br> };<br> };<br> <br>diff --git a/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts b/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts<br>index 162b5f2838..ee468df244 100644<br>--- a/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts<br>+++ b/target/linux/ath79/dts/ar7241_tplink_tl-wr842n-v1.dts<br>@@ -66,15 +66,16 @@<br> linux,default-trigger = "phy0tpt";<br> };<br> };<br>+};<br> <br>- gpio-export {<br>- compatible = "gpio-export";<br>+&gpio {<br>+ status = "okay";<br> <br>- gpio_usb_power {<br>- gpio-export,name = "tp-link:power:usb";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 6 GPIO_ACTIVE_HIGH>;<br>- };<br>+ usb_power {<br>+ gpio-hog;<br>+ line-name = "tp-link:power:usb";<br>+ gpios = <6 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br> };<br> };<br> <br>@@ -155,10 +156,6 @@<br> mtd-mac-address-increment = <1>;<br> };<br> <br>-&gpio {<br>- status = "okay";<br>-};<br>-<br> &uart {<br> status = "okay";<br> };<br>diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi b/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi<br>index 3b5a4dd13d..d7632faf5c 100644<br>--- a/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi<br>+++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-bhr.dtsi<br>@@ -57,17 +57,6 @@<br> };<br> };<br> <br>- gpio-export {<br>- compatible = "gpio-export";<br>- #size-cells = <0>;<br>-<br>- gpio_usb_power {<br>- gpio-export,name = "buffalo:usb-power";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;<br>- };<br>- };<br>-<br> virtual_flash {<br> compatible = "mtd-concat";<br> devices = <&flash0 &flash1>;<br>@@ -109,6 +98,15 @@<br> };<br> };<br> <br>+&gpio {<br>+ usb_power {<br>+ gpio-hog;<br>+ line-name = "buffalo:usb-power";<br>+ gpios = <16 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br>+ };<br>+};<br>+<br> &spi {<br> status = "okay";<br> cs-gpios = <0>, <0>;<br>diff --git a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts<br>index 8ac4df2194..2b30b7830b 100644<br>--- a/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts<br>+++ b/target/linux/ath79/dts/ar7242_buffalo_wzr-hp-g302h-a1a0.dts<br>@@ -109,17 +109,6 @@<br> };<br> };<br> <br>- gpio-export {<br>- compatible = "gpio-export";<br>- #size-cells = <0>;<br>-<br>- gpio_usb_power {<br>- gpio-export,name = "buffalo:usb-power";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 13 GPIO_ACTIVE_HIGH>;<br>- };<br>- };<br>-<br> virtual_flash {<br> compatible = "mtd-concat";<br> devices = <&flash0 &flash1>;<br>@@ -161,6 +150,15 @@<br> };<br> };<br> <br>+&gpio {<br>+ usb_power {<br>+ gpio-hog;<br>+ line-name = "buffalo:usb-power";<br>+ gpios = <13 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br>+ };<br>+};<br>+<br> &spi {<br> status = "okay";<br> cs-gpios = <0>, <0>;<br>diff --git a/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts b/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts<br>index 86a316b518..1df0e27cb2 100644<br>--- a/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts<br>+++ b/target/linux/ath79/dts/ar9341_tplink_tl-wr842n-v2.dts<br>@@ -6,16 +6,6 @@<br> / {<br> model = "TP-Link TL-WR842N/ND v2";<br> compatible = "tplink,tl-wr842n-v2", "qca,ar9341";<br>-<br>- gpio-export {<br>- compatible = "gpio-export";<br>-<br>- gpio_usb_power {<br>- gpio-export,name = "tp-link:power:usb";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;<br>- };<br>- };<br> };<br> <br> &keys {<br>@@ -36,6 +26,15 @@<br> };<br> };<br> <br>+&gpio {<br>+ usb_power {<br>+ gpio-hog;<br>+ line-name = "tp-link:power:usb";<br>+ gpios = <4 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br>+ };<br>+};<br>+<br> &spi {<br> num-cs = <1>;<br> <br>diff --git a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts<br>index 3d25004c40..e790cf0df4 100644<br>--- a/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts<br>+++ b/target/linux/ath79/dts/qca9558_devolo_dvl1750e.dts<br>@@ -53,15 +53,14 @@<br> compatible = "gpio-beeper";<br> gpios = <&gpio 4 GPIO_ACTIVE_HIGH>;<br> };<br>+};<br> <br>- gpio_export {<br>- compatible = "gpio-export";<br>-<br>- gpio_usb_power {<br>- gpio-export,name = "devolo:power:usb";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;<br>- };<br>+&gpio {<br>+ usb_power {<br>+ gpio-hog;<br>+ line-name = "devolo:power:usb";<br>+ gpios = <11 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br> };<br> };<br> <br>diff --git a/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi b/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi<br>index c77613dad6..fb38f35dc1 100644<br>--- a/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi<br>+++ b/target/linux/ath79/dts/qca9558_tplink_archer-c7.dtsi<br>@@ -64,22 +64,6 @@<br> debounce-interval = <60>;<br> };<br> };<br>-<br>- gpio-export {<br>- compatible = "gpio-export";<br>-<br>- gpio_usb1_power {<br>- gpio-export,name = "tp-link:power:usb1";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;<br>- };<br>-<br>- gpio_usb2_power {<br>- gpio-export,name = "tp-link:power:usb2";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;<br>- };<br>- };<br> };<br> <br> &pcie1 {<br>@@ -92,6 +76,20 @@<br> <br> &gpio {<br> status = "okay";<br>+<br>+ usb1_power {<br>+ gpio-hog;<br>+ line-name = "tp-link:power:usb1";<br>+ gpios = <21 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br>+ };<br>+<br>+ usb2_power {<br>+ gpio-hog;<br>+ line-name = "tp-link:power:usb2";<br>+ gpios = <22 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br>+ };<br> };<br> <br> &usb_phy0 {<br>diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts<br>index 77166b8bfe..470b742578 100644<br>--- a/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts<br>+++ b/target/linux/ath79/dts/qca9558_tplink_tl-wdr4900-v2.dts<br>@@ -57,7 +57,7 @@<br> };<br> };<br> <br>- ath9k-leds {<br>+ ath9k-leds {<br> compatible = "gpio-leds";<br> <br> wlan5g {<br>@@ -77,21 +77,23 @@<br> debounce-interval = <60>;<br> };<br> };<br>+};<br> <br>- gpio-export {<br>- compatible = "gpio-export";<br>+&gpio {<br>+ status = "okay";<br> <br>- gpio_usb1_power {<br>- gpio-export,name = "tp-link:power:usb1";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;<br>- };<br>+ usb1_power {<br>+ gpio-hog;<br>+ line-name = "tp-link:power:usb1";<br>+ gpios = <21 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br>+ };<br> <br>- gpio_usb2_power {<br>- gpio-export,name = "tp-link:power:usb2";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 22 GPIO_ACTIVE_HIGH>;<br>- };<br>+ usb2_power {<br>+ gpio-hog;<br>+ line-name = "tp-link:power:usb2";<br>+ gpios = <22 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br> };<br> };<br> <br>diff --git a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi<br>index 1092250f02..f6d34ab3ff 100644<br>--- a/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi<br>+++ b/target/linux/ath79/dts/qca9558_tplink_tl-wr1043nd.dtsi<br>@@ -64,16 +64,16 @@<br> debounce-interval = <60>;<br> };<br> };<br>+};<br> <br>- gpio-export {<br>- compatible = "gpio-export";<br>- #size-cells = <0>;<br>+&gpio {<br>+ status = "okay";<br> <br>- gpio_usb_power {<br>- gpio-export,name = "tp-link:power:usb";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 21 GPIO_ACTIVE_HIGH>;<br>- };<br>+ usb_power {<br>+ gpio-hog;<br>+ line-name = "tp-link:power:usb";<br>+ gpios = <21 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br> };<br> };<br> <br>@@ -81,10 +81,6 @@<br> status = "okay";<br> };<br> <br>-&gpio {<br>- status = "okay";<br>-};<br>-<br> &usb_phy0 {<br> status = "okay";<br> };<br>diff --git a/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi b/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi<br>index ddf92108b5..53329f2268 100644<br>--- a/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi<br>+++ b/target/linux/ath79/dts/qca9561_tplink_archer-c5x.dtsi<br>@@ -103,22 +103,6 @@<br> gpios = <&gpio 21 GPIO_ACTIVE_LOW>;<br> };<br> };<br>-<br>- gpio-export {<br>- compatible = "gpio-export";<br>-<br>- gpio_shift_register_oe {<br>- gpio-export,name = "tp-link:oe:sr";<br>- gpio-export,output = <0>;<br>- gpios = <&gpio 16 GPIO_ACTIVE_HIGH>;<br>- };<br>-<br>- gpio_shift_register_reset {<br>- gpio-export,name = "tp-link:reset:sr";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;<br>- };<br>- };<br> };<br> <br> &uart {<br>@@ -127,6 +111,20 @@<br> <br> &gpio {<br> status = "okay";<br>+<br>+ shift_register_oe {<br>+ gpio-hog;<br>+ line-name = "tp-link:oe:sr";<br>+ gpios = <16 GPIO_ACTIVE_HIGH>;<br>+ output-low;<br>+ };<br>+<br>+ shift_register_reset {<br>+ gpio-hog;<br>+ line-name = "tp-link:reset:sr";<br>+ gpios = <19 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br>+ };<br> };<br> <br> &pcie {<br>diff --git a/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts b/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts<br>index a17d9f263a..63baa376c6 100644<br>--- a/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts<br>+++ b/target/linux/ath79/dts/qca9563_dlink_dir-859-a1.dts<br>@@ -61,16 +61,16 @@<br> debounce-interval = <60>;<br> };<br> };<br>+};<br> <br>- gpio-export {<br>- compatible = "gpio-export";<br>- #size-cells = <0>;<br>+&gpio {<br>+ status = "okay";<br> <br>- gpio_switch_reset {<br>- gpio-export,name = "dir-859-a1:reset:switch";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 11 GPIO_ACTIVE_HIGH>;<br>- };<br>+ switch_reset {<br>+ gpio-hog;<br>+ line-name = "dir-859-a1:reset:switch";<br>+ gpios = <11 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br> };<br> };<br> <br>@@ -78,10 +78,6 @@<br> status = "okay";<br> };<br> <br>-&gpio {<br>- status = "okay";<br>-};<br>-<br> &pcie {<br> status = "okay";<br> };<br>diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts b/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts<br>index 470a8e6bf9..66083aa7f9 100644<br>--- a/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts<br>+++ b/target/linux/ath79/dts/qca9563_tplink_archer-c7-v4.dts<br>@@ -42,22 +42,6 @@<br> };<br> };<br> <br>- gpio-export {<br>- compatible = "gpio-export";<br>-<br>- gpio_shift_register_oe {<br>- gpio-export,name = "tp-link:oe:sr";<br>- gpio-export,output = <0>;<br>- gpios = <&gpio 1 GPIO_ACTIVE_LOW>; // 74HC595 /OE (Output Enable)<br>- };<br>-<br>- gpio_shift_register_reset {<br>- gpio-export,name = "tp-link:reset:sr";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 21 GPIO_ACTIVE_LOW>; // 74HC595 /SRCLR (Serial Clear)<br>- };<br>- };<br>-<br> leds {<br> compatible = "gpio-leds";<br> <br>@@ -158,6 +142,20 @@<br> <br> &gpio {<br> status = "okay";<br>+<br>+ shift_register_oe { // 74HC595 /OE<br>+ gpio-hog;<br>+ line-name = "tp-link:oe:sr";<br>+ gpios = <1 GPIO_ACTIVE_LOW>;<br>+ output-low;<br>+ };<br>+<br>+ shift_register_reset { // 74HC595 /SRCLR<br>+ gpio-hog;<br>+ line-name = "tp-link:reset:sr";<br>+ gpios = <21 GPIO_ACTIVE_LOW>;<br>+ output-high;<br>+ };<br> };<br> <br> &usb_phy0 {<br>diff --git a/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi b/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi<br>index 2e66e0f03e..64115c4248 100644<br>--- a/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi<br>+++ b/target/linux/ath79/dts/qca9563_tplink_archer-x7-v5.dtsi<br>@@ -93,16 +93,6 @@<br> debounce-interval = <60>;<br> };<br> };<br>-<br>- gpio-export {<br>- compatible = "gpio-export";<br>-<br>- gpio_usb_power {<br>- gpio-export,name = "tp-link:power:usb";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 19 GPIO_ACTIVE_HIGH>;<br>- };<br>- };<br> };<br> <br> &pcie {<br>@@ -115,6 +105,13 @@<br> <br> &gpio {<br> status = "okay";<br>+<br>+ usb_power {<br>+ gpio-hog;<br>+ line-name = "tp-link:power:usb";<br>+ gpios = <19 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br>+ };<br> };<br> <br> &usb_phy0 {<br>diff --git a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts<br>index 07a7409886..45ee0c21c7 100644<br>--- a/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts<br>+++ b/target/linux/ath79/dts/qca9563_tplink_tl-wr1043nd-v4.dts<br>@@ -6,16 +6,14 @@<br> / {<br> compatible = "tplink,tl-wr1043nd-v4", "qca,qca9563";<br> model = "TP-Link TL-WR1043ND v4";<br>+};<br> <br>- gpio-export {<br>- compatible = "gpio-export";<br>- #size-cells = <0>;<br>-<br>- gpio_usb_power {<br>- gpio-export,name = "tp-link:power:usb";<br>- gpio-export,output = <1>;<br>- gpios = <&gpio 8 GPIO_ACTIVE_HIGH>;<br>- };<br>+&gpio {<br>+ usb_power {<br>+ gpio-hog;<br>+ line-name = "tp-link:power:usb";<br>+ gpios = <8 GPIO_ACTIVE_HIGH>;<br>+ output-high;<br> };<br> };<br> </pre></blockquote></div></body></html>