Re: Re: [PATCH] pinctrl: intel: Implements gpio free function

From: Mika Westerberg
Date: Thu Mar 21 2019 - 09:57:04 EST


On Thu, Mar 21, 2019 at 09:35:26PM +0800, zhuchangchun@xxxxxxxx wrote:
> --> I know your meaning, even though I've did following actions
> instead of unexport,
>
> # echo 0 > /sys/class/gpio/gpioXX/value
> # echo in > /sys/class/gpio/gpioXX/direction
>
> the padcfg0 value still can not roll back,because after export the
> gpio,the following
>
> action as padcfg0 settings was done.
>
> Exactly TX and RX register have been set as below in GPIO request:
>
> /* Disable TX buffer and enable RX (this will be input) */
>
> value &= ~PADCFG0_GPIORXDIS;
>
> value |= PADCFG0_GPIOTXDIS;
>
> this will infruence next reboot gpio signal.
>
> And could you pls see my ->free function implementation?

I checked it and you do this:

+ value |= PADCFG0_GPIORXDIS;
+ value &= ~PADCFG0_GPIOTXDIS;

which pretty much turns the pin GPIO output unconditionally. I don't
really think it is good idea. May work in your case but may cause
problems with others.

If you want to keep it as output and leave the value 1 (high) before you
issue reboot, I don't think you need to do anything via sysfs (as the
pin is already in that state and issuing reboot command should not
change anything because the driver does not have ->shutdown callback.

In other words, your peripheral expects reset GPIO to be asserted (high)
during reboot so unless the boot firmware resets the pin I don't see why
leaving it as is does not work for you.