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

Birger Koblitz mail at birger-koblitz.de
Sun Aug 11 06:59:50 EDT 2019


Dear Mathias and Piotr,

thank you for your comments. I had incorrectly assumed that a gpio_hog
could still be switched on/off from user space and that the only thing
not possible was changing the direction.

I'll go through the patches and remove anything that sounds like it
might need user space configuration (i.e. not power the USB bus or the
like).

Is anyone working on converting the use-cases which require user space
switching to libgpiod or any other solution?

Cheers,

  Birger


On 11.08.19 12:06, Piotr Dymacz wrote:
> Hi Mathias, Birger,
>
> On 11.08.2019 11:36, Mathias Kresin wrote:
>> 02/08/2019 11:58, Birger Koblitz:
>>> 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>;
>>> -        };
>>> -    };
>>> -
>>
>> Hey Birger,
>>
>> similar to my comment for the lantiq version, this doesn't work as well.
>>
>> AFAIR, the Tube e4g has two sim card slots and the "sim-select" gpio is
>> supposed to be used from the userspace, to select which sim card slot
>> should be used.
>>
>> If we hog the gpio, it can't be manipulated from the userspace anymore.
>>
>> I haven't had a closer look at the patch. There might be similar issues
>> for other boards.
>>
>> @Piotr can confirm what I might to remember?
>
> Yes, you're correct.
>
> Also, the "modem-enable" should be available in user space as in case
> of some modems (without "SIM power down" feature support), only this
> approach works when changing SIM cards/slots:
>
> put the modem in reset -> switch SIM slot -> enable modem
>
> (still, there is a way to perform modem reset using AT command but
> IMHO it's not as convenient as toggling PERST# pin)
>
_______________________________________________
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