Re: [PATCH] usb: phy: phy-generic: No need to call gpiod_direction_output() twice

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 30, 2015 at 07:27:16PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
> 
> Commit 9eb0797722895f4309b4 ("sb: phy: generic: fix the gpios to be optional")
> calls gpiod_direction_output() in the probe function, so there is no need to 
> call it again, as we can simply call gpiod_set_value() directly.
> 
> Also, in usb_gen_phy_shutdown() we call 'nop_reset_set(nop, 1)' and in this
> case we should put the GPIO directly in its active level state, so skip
> the GPIO toggle and delay.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
> ---
>  drivers/usb/phy/phy-generic.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
> index 54697a0..ceb8ac9 100644
> --- a/drivers/usb/phy/phy-generic.c
> +++ b/drivers/usb/phy/phy-generic.c
> @@ -66,8 +66,11 @@ static void nop_reset_set(struct usb_phy_generic *nop, int asserted)
>  	if (!nop->gpiod_reset)
>  		return;
>  
> -	gpiod_direction_output(nop->gpiod_reset, !asserted);
> +	if (asserted)
> +		goto skip_delay;

why skip it ?

> +	gpiod_set_value(nop->gpiod_reset, !asserted);
>  	usleep_range(10000, 20000);
> +skip_delay:
>  	gpiod_set_value(nop->gpiod_reset, asserted);
>  }
>  
> -- 
> 1.9.1
> 

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux