From: Peter Chen <peter.chen@nxp.com>
To: Chunfeng Yun <chunfeng.yun@mediatek.com>
Cc: "balbi@kernel.org" <balbi@kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
dl-linux-imx <linux-imx@nxp.com>,
"pawell@cadence.com" <pawell@cadence.com>,
"rogerq@ti.com" <rogerq@ti.com>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
Jun Li <jun.li@nxp.com>
Subject: Re: [PATCH v6 2/3] usb: cdns3: add runtime PM support
Date: Fri, 21 Aug 2020 07:46:56 +0000 [thread overview]
Message-ID: <20200821074551.GP24960@b29397-desktop> (raw)
In-Reply-To: <1597990555.21253.9.camel@mhfsdcap03>
On 20-08-21 14:15:55, Chunfeng Yun wrote:
> On Fri, 2020-08-21 at 10:48 +0800, Peter Chen wrote:
> > Introduce runtime PM and wakeup interrupt handler for cdns3,
> > the runtime PM is default off since other cdns3 may not
> > implement glue layer support for runtime PM.
> >
> > One typical wakeup event use case is xHCI runtime suspend will clear
> > USBCMD.RS bit, after that the xHCI will not trigger any interrupts,
> > so its parent (cdns core device) needs to resume xHCI device when
> > any (wakeup) events occurs at host port.
> >
> > When the controller is in low power mode, the lpm flag will be set.
> > The interrupt triggered later than lpm flag is set considers as
> > wakeup interrupt and handled at cdns_wakeup_irq. Once the wakeup
> > occurs, it first disables interrupt to avoid later interrupt
> > occurrence since the controller is in low power mode at that
> > time, and access registers may be invalid at that time. At wakeup
> > handler, it will call pm_request_resume to wakeup xHCI device, and
> > at runtime resume handler, it will enable interrupt again.
> >
> > The API platform_suspend is introduced for glue layer to implement
> > platform specific PM sequence.
> >
> > Reviewed-by: Pawel Laszczak <pawell@cadence.com>
> > Signed-off-by: Peter Chen <peter.chen@nxp.com>
> > ---
> > drivers/usb/cdns3/core.c | 153 ++++++++++++++++++++++++++++++++-----
> > drivers/usb/cdns3/core.h | 16 ++++
> > drivers/usb/cdns3/drd.c | 3 +
> > drivers/usb/cdns3/gadget.c | 4 +
> > drivers/usb/cdns3/host.c | 7 ++
> > 5 files changed, 166 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/usb/cdns3/core.c b/drivers/usb/cdns3/core.c
> > index e56dbb6a898c..8e588eef38df 100644
> > --- a/drivers/usb/cdns3/core.c
> > +++ b/drivers/usb/cdns3/core.c
> > @@ -392,6 +392,30 @@ static void set_phy_power_off(struct cdns3 *cdns)
> > phy_power_off(cdns->usb2_phy);
> > }
> >
> > +/**
> > + * cdns3_wakeup_irq - interrupt handler for wakeup events
> > + *
> remove blank line?
> "Do not leave a blank line between the function description and the
> arguments, nor between the arguments"
> see kernel-doc.rst, Function parameters
Thanks, will change.
> > /*
> > * The controller needs less time between bus and controller suspend,
> > @@ -559,52 +608,122 @@ static int cdns3_remove(struct platform_device *pdev)
> > return 0;
> > }
> >
> > -#ifdef CONFIG_PM_SLEEP
> > +#ifdef CONFIG_PM
> What about using __maybe_unused instead of #ifdef ?
It may be suitable for the number of function in power management scope
is less, say 4 functions for both runtime pm and system pm.
But for cdns3, it includes more functions at pm scope (will be more in
future after supporting more features), it may needs to add __maybe_unused
for all these functions if using your suggestion, so I prefer using MACRO.
--
Thanks,
Peter Chen
next prev parent reply other threads:[~2020-08-21 7:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-21 2:48 [PATCH v6 0/3] usb: cdns3: add runtime pm support Peter Chen
2020-08-21 2:48 ` [PATCH v6 1/3] usb: cdns3: introduce set_phy_power_on{off} APIs Peter Chen
2020-08-21 2:48 ` [PATCH v6 2/3] usb: cdns3: add runtime PM support Peter Chen
2020-08-21 6:15 ` Chunfeng Yun
2020-08-21 7:46 ` Peter Chen [this message]
2020-08-21 2:48 ` [PATCH v6 3/3] usb: cdns3: imx: add glue layer runtime pm implementation Peter Chen
2020-08-24 14:24 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200821074551.GP24960@b29397-desktop \
--to=peter.chen@nxp.com \
--cc=balbi@kernel.org \
--cc=chunfeng.yun@mediatek.com \
--cc=gregkh@linuxfoundation.org \
--cc=jun.li@nxp.com \
--cc=linux-imx@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=pawell@cadence.com \
--cc=rogerq@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).