Re: [PATCH V2 2/6] usb: core: Add ability to skip phy exit on suspend and init on resume

From: Alan Cooper
Date: Thu Nov 08 2018 - 17:50:57 EST


On Wed, Nov 7, 2018 at 8:43 PM Chunfeng Yun <chunfeng.yun@xxxxxxxxxxxx> wrote:
>
> hi,
> On Tue, 2018-10-30 at 18:30 -0400, Alan Cooper wrote:
> > On 10/17/18 9:46 PM, Chunfeng Yun wrote:> hi,
> > >
> > > On Wed, 2018-10-17 at 18:29 -0400, Al Cooper wrote:
> > >> Add the ability to skip calling the PHY's exit routine on suspend
> > >> and the PHY's init routine on resume. This is to handle a USB PHY
> > >> that should have it's power_off function called on suspend but
> > cannot
> > >> have it's exit function called because on exit it will disable the
> > >> PHY to the point where register accesses to the Host Controllers
> > >> using the PHY will be disabled and the host drivers will crash.
> > >>
> > >> This is enabled with the HCD flag "suspend_without_phy_exit" which
> > >> can be set from any HCD driver.
> > >>
> > >> Signed-off-by: Al Cooper<alcooperx@xxxxxxxxx>
> > >> ---
> > >> drivers/usb/core/hcd.c | 8 ++++----
> > >> drivers/usb/core/phy.c | 18 ++++++++++++------
> > >> drivers/usb/core/phy.h | 9 ++++++---
> > >> include/linux/usb/hcd.h | 3 +++
> > >> 4 files changed, 25 insertions(+), 13 deletions(-)
> > >>
>
>
> > >> unsigned skip_phy_initialization:1;
> > >>
> > >> + /* Some phys don't want the phy's exit/init called on
> > suspend/resume */
> > >> + unsigned suspend_without_phy_exit:1;
> > > As suggested before, you can skip phy's exit/init during
> > suspend/resume
> > > by enabling wakeup of hcd, so needn't add a new variable for it.
> >
> > I still need to be able to enable and disable wakeup for this driver.
> Just use device_init_wakeup(dev, true) instead of
> device_wakeup_enable(dev) for your controller driver, you can try it.
>
> Sorry for the late replay

What about the case where sysfs is used to disable wakeup?

Al
> >
> > >
> > >> +
> > >> /* The next flag is a stopgap, to be removed when all the
> > HCDs
> > >> * support the new root-hub polling mechanism. */
> > >> unsigned uses_new_polling:1;
> > >
>
>