linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: chipidea: support generic phy in PM code path
@ 2016-08-19 12:10 Jisheng Zhang
  2016-08-22  5:33 ` Peter Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Jisheng Zhang @ 2016-08-19 12:10 UTC (permalink / raw)
  To: Peter.Chen, gregkh
  Cc: linux-usb, linux-kernel, linux-arm-kernel, Jisheng Zhang

Support generic phy in PM code path: call phy_power_off/phy_power_on
in ci_controller_suspend/ci_controller_resume.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
---
 drivers/usb/chipidea/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index ae12595..ef9fb0b 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -1116,6 +1116,7 @@ static void ci_controller_suspend(struct ci_hdrc *ci)
 		usleep_range(ci->platdata->phy_clkgate_delay_us,
 			     ci->platdata->phy_clkgate_delay_us + 50);
 	usb_phy_set_suspend(ci->usb_phy, 1);
+	phy_power_off(ci->phy);
 	ci->in_lpm = true;
 	enable_irq(ci->irq);
 }
@@ -1132,9 +1133,10 @@ static int ci_controller_resume(struct device *dev)
 	}
 
 	ci_hdrc_enter_lpm(ci, false);
-	if (ci->usb_phy) {
+	if (ci->usb_phy || ci->phy) {
 		usb_phy_set_suspend(ci->usb_phy, 0);
 		usb_phy_set_wakeup(ci->usb_phy, false);
+		phy_power_on(ci->phy);
 		hw_wait_phy_stable();
 	}
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: chipidea: support generic phy in PM code path
  2016-08-19 12:10 [PATCH] usb: chipidea: support generic phy in PM code path Jisheng Zhang
@ 2016-08-22  5:33 ` Peter Chen
  2016-08-22  6:39   ` Jisheng Zhang
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Chen @ 2016-08-22  5:33 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Peter.Chen, gregkh, linux-usb, linux-kernel, linux-arm-kernel

On Fri, Aug 19, 2016 at 08:10:13PM +0800, Jisheng Zhang wrote:
> Support generic phy in PM code path: call phy_power_off/phy_power_on
> in ci_controller_suspend/ci_controller_resume.
> 
> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> ---
>  drivers/usb/chipidea/core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index ae12595..ef9fb0b 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -1116,6 +1116,7 @@ static void ci_controller_suspend(struct ci_hdrc *ci)
>  		usleep_range(ci->platdata->phy_clkgate_delay_us,
>  			     ci->platdata->phy_clkgate_delay_us + 50);
>  	usb_phy_set_suspend(ci->usb_phy, 1);
> +	phy_power_off(ci->phy);

How could you support USB wakeup after PHY is powered off?

Peter

>  	ci->in_lpm = true;
>  	enable_irq(ci->irq);
>  }
> @@ -1132,9 +1133,10 @@ static int ci_controller_resume(struct device *dev)
>  	}
>  
>  	ci_hdrc_enter_lpm(ci, false);
> -	if (ci->usb_phy) {
> +	if (ci->usb_phy || ci->phy) {
>  		usb_phy_set_suspend(ci->usb_phy, 0);
>  		usb_phy_set_wakeup(ci->usb_phy, false);
> +		phy_power_on(ci->phy);
>  		hw_wait_phy_stable();
>  	}
>  
> -- 
> 2.9.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 

Best Regards,
Peter Chen

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: chipidea: support generic phy in PM code path
  2016-08-22  5:33 ` Peter Chen
@ 2016-08-22  6:39   ` Jisheng Zhang
  2016-08-22  7:29     ` Peter Chen
  0 siblings, 1 reply; 7+ messages in thread
From: Jisheng Zhang @ 2016-08-22  6:39 UTC (permalink / raw)
  To: Peter Chen; +Cc: Peter.Chen, gregkh, linux-usb, linux-kernel, linux-arm-kernel

Hi Peter,

On Mon, 22 Aug 2016 13:33:08 +0800 Peter Chen wrote:

> On Fri, Aug 19, 2016 at 08:10:13PM +0800, Jisheng Zhang wrote:
> > Support generic phy in PM code path: call phy_power_off/phy_power_on
> > in ci_controller_suspend/ci_controller_resume.
> > 
> > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > ---
> >  drivers/usb/chipidea/core.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > index ae12595..ef9fb0b 100644
> > --- a/drivers/usb/chipidea/core.c
> > +++ b/drivers/usb/chipidea/core.c
> > @@ -1116,6 +1116,7 @@ static void ci_controller_suspend(struct ci_hdrc *ci)
> >  		usleep_range(ci->platdata->phy_clkgate_delay_us,
> >  			     ci->platdata->phy_clkgate_delay_us + 50);
> >  	usb_phy_set_suspend(ci->usb_phy, 1);
> > +	phy_power_off(ci->phy);  
> 
> How could you support USB wakeup after PHY is powered off?

Per my understanding, the PHY's power off just power off data communication part
but leaves the circuits involved in wakeup detection active.

Thanks,
Jisheng

> 
> Peter
> 
> >  	ci->in_lpm = true;
> >  	enable_irq(ci->irq);
> >  }
> > @@ -1132,9 +1133,10 @@ static int ci_controller_resume(struct device *dev)
> >  	}
> >  
> >  	ci_hdrc_enter_lpm(ci, false);
> > -	if (ci->usb_phy) {
> > +	if (ci->usb_phy || ci->phy) {
> >  		usb_phy_set_suspend(ci->usb_phy, 0);
> >  		usb_phy_set_wakeup(ci->usb_phy, false);
> > +		phy_power_on(ci->phy);
> >  		hw_wait_phy_stable();
> >  	}
> >  
> > -- 
> > 2.9.3
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html  
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: chipidea: support generic phy in PM code path
  2016-08-22  6:39   ` Jisheng Zhang
@ 2016-08-22  7:29     ` Peter Chen
  2016-08-22  8:14       ` Jisheng Zhang
  0 siblings, 1 reply; 7+ messages in thread
From: Peter Chen @ 2016-08-22  7:29 UTC (permalink / raw)
  To: Jisheng Zhang
  Cc: Peter.Chen, gregkh, linux-usb, linux-kernel, linux-arm-kernel

On Mon, Aug 22, 2016 at 02:39:21PM +0800, Jisheng Zhang wrote:
> Hi Peter,
> 
> On Mon, 22 Aug 2016 13:33:08 +0800 Peter Chen wrote:
> 
> > On Fri, Aug 19, 2016 at 08:10:13PM +0800, Jisheng Zhang wrote:
> > > Support generic phy in PM code path: call phy_power_off/phy_power_on
> > > in ci_controller_suspend/ci_controller_resume.
> > > 
> > > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > > ---
> > >  drivers/usb/chipidea/core.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > > index ae12595..ef9fb0b 100644
> > > --- a/drivers/usb/chipidea/core.c
> > > +++ b/drivers/usb/chipidea/core.c
> > > @@ -1116,6 +1116,7 @@ static void ci_controller_suspend(struct ci_hdrc *ci)
> > >  		usleep_range(ci->platdata->phy_clkgate_delay_us,
> > >  			     ci->platdata->phy_clkgate_delay_us + 50);
> > >  	usb_phy_set_suspend(ci->usb_phy, 1);
> > > +	phy_power_off(ci->phy);  
> > 
> > How could you support USB wakeup after PHY is powered off?
> 
> Per my understanding, the PHY's power off just power off data communication part
> but leaves the circuits involved in wakeup detection active.
> 

Ok, I hope so.

Peter
> 
> > 
> > Peter
> > 
> > >  	ci->in_lpm = true;
> > >  	enable_irq(ci->irq);
> > >  }
> > > @@ -1132,9 +1133,10 @@ static int ci_controller_resume(struct device *dev)
> > >  	}
> > >  
> > >  	ci_hdrc_enter_lpm(ci, false);
> > > -	if (ci->usb_phy) {
> > > +	if (ci->usb_phy || ci->phy) {
> > >  		usb_phy_set_suspend(ci->usb_phy, 0);
> > >  		usb_phy_set_wakeup(ci->usb_phy, false);
> > > +		phy_power_on(ci->phy);
> > >  		hw_wait_phy_stable();
> > >  	}
> > >  
> > > -- 
> > > 2.9.3
> > > 
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe linux-usb" in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html  
> > 
> 

-- 

Best Regards,
Peter Chen

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: chipidea: support generic phy in PM code path
  2016-08-22  7:29     ` Peter Chen
@ 2016-08-22  8:14       ` Jisheng Zhang
  2016-08-22  8:23         ` Kishon Vijay Abraham I
  0 siblings, 1 reply; 7+ messages in thread
From: Jisheng Zhang @ 2016-08-22  8:14 UTC (permalink / raw)
  To: Peter Chen, kishon
  Cc: Peter.Chen, gregkh, linux-usb, linux-kernel, linux-arm-kernel

+ Kishon

Hi Peter, Kishon,

On Mon, 22 Aug 2016 15:29:07 +0800 Peter Chen wrote:

> On Mon, Aug 22, 2016 at 02:39:21PM +0800, Jisheng Zhang wrote:
> > Hi Peter,
> > 
> > On Mon, 22 Aug 2016 13:33:08 +0800 Peter Chen wrote:
> >   
> > > On Fri, Aug 19, 2016 at 08:10:13PM +0800, Jisheng Zhang wrote:  
> > > > Support generic phy in PM code path: call phy_power_off/phy_power_on
> > > > in ci_controller_suspend/ci_controller_resume.
> > > > 
> > > > Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> > > > ---
> > > >  drivers/usb/chipidea/core.c | 4 +++-
> > > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> > > > index ae12595..ef9fb0b 100644
> > > > --- a/drivers/usb/chipidea/core.c
> > > > +++ b/drivers/usb/chipidea/core.c
> > > > @@ -1116,6 +1116,7 @@ static void ci_controller_suspend(struct ci_hdrc *ci)
> > > >  		usleep_range(ci->platdata->phy_clkgate_delay_us,
> > > >  			     ci->platdata->phy_clkgate_delay_us + 50);
> > > >  	usb_phy_set_suspend(ci->usb_phy, 1);
> > > > +	phy_power_off(ci->phy);    
> > > 
> > > How could you support USB wakeup after PHY is powered off?  
> > 
> > Per my understanding, the PHY's power off just power off data communication part
> > but leaves the circuits involved in wakeup detection active.
> >   
> 
> Ok, I hope so.

If most parts of the phy can be powered off during runtime suspend to save
power, or phy HW support suspend mode, with usb phy, usb_phy_set_suspend() could
be used, but with the generic phy, it seems there's no corresponding API for
this purpose. I'm not sure whether using phy_power_off() is correct here. Is it
acceptable to extend the generic phy? such as, phy_suspend()/phy_resume()?

Thanks,
Jisheng

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: chipidea: support generic phy in PM code path
  2016-08-22  8:14       ` Jisheng Zhang
@ 2016-08-22  8:23         ` Kishon Vijay Abraham I
  2016-08-22  8:29           ` Jisheng Zhang
  0 siblings, 1 reply; 7+ messages in thread
From: Kishon Vijay Abraham I @ 2016-08-22  8:23 UTC (permalink / raw)
  To: Jisheng Zhang, Peter Chen
  Cc: Peter.Chen, gregkh, linux-usb, linux-kernel, linux-arm-kernel

Hi,

On Monday 22 August 2016 01:44 PM, Jisheng Zhang wrote:
> + Kishon
> 
> Hi Peter, Kishon,
> 
> On Mon, 22 Aug 2016 15:29:07 +0800 Peter Chen wrote:
> 
>> On Mon, Aug 22, 2016 at 02:39:21PM +0800, Jisheng Zhang wrote:
>>> Hi Peter,
>>>
>>> On Mon, 22 Aug 2016 13:33:08 +0800 Peter Chen wrote:
>>>   
>>>> On Fri, Aug 19, 2016 at 08:10:13PM +0800, Jisheng Zhang wrote:  
>>>>> Support generic phy in PM code path: call phy_power_off/phy_power_on
>>>>> in ci_controller_suspend/ci_controller_resume.
>>>>>
>>>>> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
>>>>> ---
>>>>>  drivers/usb/chipidea/core.c | 4 +++-
>>>>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>>>>
>>>>> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
>>>>> index ae12595..ef9fb0b 100644
>>>>> --- a/drivers/usb/chipidea/core.c
>>>>> +++ b/drivers/usb/chipidea/core.c
>>>>> @@ -1116,6 +1116,7 @@ static void ci_controller_suspend(struct ci_hdrc *ci)
>>>>>  		usleep_range(ci->platdata->phy_clkgate_delay_us,
>>>>>  			     ci->platdata->phy_clkgate_delay_us + 50);
>>>>>  	usb_phy_set_suspend(ci->usb_phy, 1);
>>>>> +	phy_power_off(ci->phy);    
>>>>
>>>> How could you support USB wakeup after PHY is powered off?  
>>>
>>> Per my understanding, the PHY's power off just power off data communication part
>>> but leaves the circuits involved in wakeup detection active.
>>>   
>>
>> Ok, I hope so.
> 
> If most parts of the phy can be powered off during runtime suspend to save
> power, or phy HW support suspend mode, with usb phy, usb_phy_set_suspend() could
> be used, but with the generic phy, it seems there's no corresponding API for
> this purpose. I'm not sure whether using phy_power_off() is correct here. Is it
> acceptable to extend the generic phy? such as, phy_suspend()/phy_resume()?

phy_pm_runtime_put() could be used right?

Thanks
Kishon

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] usb: chipidea: support generic phy in PM code path
  2016-08-22  8:23         ` Kishon Vijay Abraham I
@ 2016-08-22  8:29           ` Jisheng Zhang
  0 siblings, 0 replies; 7+ messages in thread
From: Jisheng Zhang @ 2016-08-22  8:29 UTC (permalink / raw)
  To: Kishon Vijay Abraham I
  Cc: Peter Chen, Peter.Chen, gregkh, linux-usb, linux-kernel,
	linux-arm-kernel



On Mon, 22 Aug 2016 13:53:37 +0530 Kishon Vijay Abraham I wrote:

> Hi,
> 
> On Monday 22 August 2016 01:44 PM, Jisheng Zhang wrote:
> > + Kishon
> > 
> > Hi Peter, Kishon,
> > 
> > On Mon, 22 Aug 2016 15:29:07 +0800 Peter Chen wrote:
> >   
> >> On Mon, Aug 22, 2016 at 02:39:21PM +0800, Jisheng Zhang wrote:  
> >>> Hi Peter,
> >>>
> >>> On Mon, 22 Aug 2016 13:33:08 +0800 Peter Chen wrote:
> >>>     
> >>>> On Fri, Aug 19, 2016 at 08:10:13PM +0800, Jisheng Zhang wrote:    
> >>>>> Support generic phy in PM code path: call phy_power_off/phy_power_on
> >>>>> in ci_controller_suspend/ci_controller_resume.
> >>>>>
> >>>>> Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
> >>>>> ---
> >>>>>  drivers/usb/chipidea/core.c | 4 +++-
> >>>>>  1 file changed, 3 insertions(+), 1 deletion(-)
> >>>>>
> >>>>> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> >>>>> index ae12595..ef9fb0b 100644
> >>>>> --- a/drivers/usb/chipidea/core.c
> >>>>> +++ b/drivers/usb/chipidea/core.c
> >>>>> @@ -1116,6 +1116,7 @@ static void ci_controller_suspend(struct ci_hdrc *ci)
> >>>>>  		usleep_range(ci->platdata->phy_clkgate_delay_us,
> >>>>>  			     ci->platdata->phy_clkgate_delay_us + 50);
> >>>>>  	usb_phy_set_suspend(ci->usb_phy, 1);
> >>>>> +	phy_power_off(ci->phy);      
> >>>>
> >>>> How could you support USB wakeup after PHY is powered off?    
> >>>
> >>> Per my understanding, the PHY's power off just power off data communication part
> >>> but leaves the circuits involved in wakeup detection active.
> >>>     
> >>
> >> Ok, I hope so.  
> > 
> > If most parts of the phy can be powered off during runtime suspend to save
> > power, or phy HW support suspend mode, with usb phy, usb_phy_set_suspend() could
> > be used, but with the generic phy, it seems there's no corresponding API for
> > this purpose. I'm not sure whether using phy_power_off() is correct here. Is it
> > acceptable to extend the generic phy? such as, phy_suspend()/phy_resume()?  
> 
> phy_pm_runtime_put() could be used right?
> 

oh yeah, Great!!! Thanks for the inspiration. Now, I know what should I do for my
platform and the chipidea core driver ;)

Will cook a v2 patch

Thank you so much,
Jisheng

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-08-22  8:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-19 12:10 [PATCH] usb: chipidea: support generic phy in PM code path Jisheng Zhang
2016-08-22  5:33 ` Peter Chen
2016-08-22  6:39   ` Jisheng Zhang
2016-08-22  7:29     ` Peter Chen
2016-08-22  8:14       ` Jisheng Zhang
2016-08-22  8:23         ` Kishon Vijay Abraham I
2016-08-22  8:29           ` Jisheng Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).