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

2015-03-10 Thread Felipe Balbi
On Tue, Mar 10, 2015 at 06:22:17PM -0300, Fabio Estevam wrote:
> On Tue, Mar 10, 2015 at 6:20 PM, Felipe Balbi  wrote:
> > On Tue, Feb 03, 2015 at 07:18:17PM -0200, Fabio Estevam wrote:
> >> From: Fabio Estevam 
> >>
> >> Commit 9eb0797722895f4309b4 ("usb: 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 can simply put the GPIO directly in its
> >> active level state and this allows us to simplify the nop_reset function to
> >> treat only the reset case.
> >>
> >> Signed-off-by: Fabio Estevam 
> >
> > Is this for v4.1 or v4.0-rc ?
> 
> For 4.1, thanks

in my testing/next now, thanks

-- 
balbi


signature.asc
Description: Digital signature


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

2015-03-10 Thread Fabio Estevam
On Tue, Mar 10, 2015 at 6:20 PM, Felipe Balbi  wrote:
> On Tue, Feb 03, 2015 at 07:18:17PM -0200, Fabio Estevam wrote:
>> From: Fabio Estevam 
>>
>> Commit 9eb0797722895f4309b4 ("usb: 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 can simply put the GPIO directly in its
>> active level state and this allows us to simplify the nop_reset function to
>> treat only the reset case.
>>
>> Signed-off-by: Fabio Estevam 
>
> Is this for v4.1 or v4.0-rc ?

For 4.1, thanks
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2015-03-10 Thread Felipe Balbi
On Tue, Feb 03, 2015 at 07:18:17PM -0200, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> Commit 9eb0797722895f4309b4 ("usb: 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 can simply put the GPIO directly in its 
> active level state and this allows us to simplify the nop_reset function to 
> treat only the reset case.
> 
> Signed-off-by: Fabio Estevam 

Is this for v4.1 or v4.0-rc ?

-- 
balbi


signature.asc
Description: Digital signature


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

2015-02-03 Thread Fabio Estevam
From: Fabio Estevam 

Commit 9eb0797722895f4309b4 ("usb: 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 can simply put the GPIO directly in its 
active level state and this allows us to simplify the nop_reset function to 
treat only the reset case.

Signed-off-by: Fabio Estevam 
---
Changes since v2:
- No need to do a NULL check prior to gpiod_set_value()

 drivers/usb/phy/phy-generic.c | 12 +---
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c
index 70be50b..deee68e 100644
--- a/drivers/usb/phy/phy-generic.c
+++ b/drivers/usb/phy/phy-generic.c
@@ -62,14 +62,14 @@ static int nop_set_suspend(struct usb_phy *x, int suspend)
return 0;
 }
 
-static void nop_reset_set(struct usb_phy_generic *nop, int asserted)
+static void nop_reset(struct usb_phy_generic *nop)
 {
if (!nop->gpiod_reset)
return;
 
-   gpiod_direction_output(nop->gpiod_reset, !asserted);
+   gpiod_set_value(nop->gpiod_reset, 1);
usleep_range(1, 2);
-   gpiod_set_value(nop->gpiod_reset, asserted);
+   gpiod_set_value(nop->gpiod_reset, 0);
 }
 
 /* interface to regulator framework */
@@ -151,8 +151,7 @@ int usb_gen_phy_init(struct usb_phy *phy)
if (!IS_ERR(nop->clk))
clk_prepare_enable(nop->clk);
 
-   /* De-assert RESET */
-   nop_reset_set(nop, 0);
+   nop_reset(nop);
 
return 0;
 }
@@ -162,8 +161,7 @@ void usb_gen_phy_shutdown(struct usb_phy *phy)
 {
struct usb_phy_generic *nop = dev_get_drvdata(phy->dev);
 
-   /* Assert RESET */
-   nop_reset_set(nop, 1);
+   gpiod_set_value(nop->gpiod_reset, 1);
 
if (!IS_ERR(nop->clk))
clk_disable_unprepare(nop->clk);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html