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

Mathias Kresin dev at kresin.me
Sun Aug 11 05:26:03 EDT 2019


02/08/2019 11:57, Birger Koblitz:
> 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 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/lantiq/files/arch/mips/boot/dts/DM200.dts
> b/target/linux/lantiq/files/arch/mips/boot/dts/DM200.dts
> index 4796123c20..0b21b67504 100644
> --- a/target/linux/lantiq/files/arch/mips/boot/dts/DM200.dts
> +++ b/target/linux/lantiq/files/arch/mips/boot/dts/DM200.dts
> @@ -37,22 +37,6 @@
>           };
>       };
>   
> -    gpio_export {
> -        compatible = "gpio-export";
> -        #size-cells = <0>;
> -
> -        annexa {
> -            gpio-export,name = "annexa";
> -            gpio-export,output = <0>;
> -            gpios = <&gpio 12 GPIO_ACTIVE_HIGH>;
> -        };
> -        annexb {
> -            gpio-export,name = "annexb";
> -            gpio-export,output = <0>;
> -            gpios = <&gpio 15 GPIO_ACTIVE_HIGH>;
> -        };
> -    };
> -
>       leds {
>           compatible = "gpio-leds";
>   
> @@ -85,6 +69,24 @@
>       };
>   };
>   
> +&gpio {
> +    status = "okay";
> +
> +    annexa {
> +        gpio-hog;
> +        line-name = "annexa";
> +        gpios = <12 GPIO_ACTIVE_HIGH>;
> +        output-low;
> +    };
> +
> +    annexb {
> +        gpio-hog;
> +        line-name = "annexb";
> +        gpios = <15 GPIO_ACTIVE_HIGH>;
> +        output-low;
> +    };
> +};
> +
>   &eth0 {
>       lantiq,phys = <&gphy1>;
>   

NAK on this change. Here w've an example where we can't hog gpios.

These gpios are used to switch the xDSL Frontend to either Annex A or 
Annex B mode. It's a configuration which has to be done from userspace, 
based on the user selectable ADSL mode. Have a look at commit 
08cd5b769deb4833b7a20208fa15674f52023fea for reference.

If we hog the gpios, they can't be controlled from userspace any more.

Before we drop these exports, we need to find another solution for this 
use case.

Regards
Mathias

_______________________________________________
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