From: Peter Chen <peter.chen@kernel.org>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: jun.li@nxp.com, gregkh@linuxfoundation.org,
linux-usb@vger.kernel.org, linux-imx@nxp.com
Subject: Re: [PATCH v2 2/8] usb: chipidea: core: handle suspend/resume for each role
Date: Mon, 17 Oct 2022 08:57:39 +0800 [thread overview]
Message-ID: <20221017005739.GE12701@nchen-desktop> (raw)
In-Reply-To: <20221013151442.3262951-3-xu.yang_2@nxp.com>
On 22-10-13 23:14:36, Xu Yang wrote:
> There may be a need to handle suspend/resume per role. This patch
> will add this support.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
>
Acked-by: Peter Chen <peter.chen@kernel.org>
Peter
> ---
> Changes since v1:
> - No changes.
> ---
> drivers/usb/chipidea/ci.h | 4 ++++
> drivers/usb/chipidea/core.c | 8 ++++++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
> index a4a3be049910..005c67cb3afb 100644
> --- a/drivers/usb/chipidea/ci.h
> +++ b/drivers/usb/chipidea/ci.h
> @@ -127,12 +127,16 @@ enum ci_revision {
> * struct ci_role_driver - host/gadget role driver
> * @start: start this role
> * @stop: stop this role
> + * @suspend: system suspend handler for this role
> + * @resume: system resume handler for this role
> * @irq: irq handler for this role
> * @name: role name string (host/gadget)
> */
> struct ci_role_driver {
> int (*start)(struct ci_hdrc *);
> void (*stop)(struct ci_hdrc *);
> + void (*suspend)(struct ci_hdrc *ci);
> + void (*resume)(struct ci_hdrc *ci, bool power_lost);
> irqreturn_t (*irq)(struct ci_hdrc *);
> const char *name;
> };
> diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
> index 80267b973c26..2b170b434d01 100644
> --- a/drivers/usb/chipidea/core.c
> +++ b/drivers/usb/chipidea/core.c
> @@ -1383,6 +1383,10 @@ static int ci_suspend(struct device *dev)
> return 0;
> }
>
> + /* Extra routine per role before system suspend */
> + if (ci->role != CI_ROLE_END && ci_role(ci)->suspend)
> + ci_role(ci)->suspend(ci);
> +
> if (device_may_wakeup(dev)) {
> if (ci_otg_is_fsm_mode(ci))
> ci_otg_fsm_suspend_for_srp(ci);
> @@ -1422,6 +1426,10 @@ static int ci_resume(struct device *dev)
> ci_usb_phy_init(ci);
> }
>
> + /* Extra routine per role after system resume */
> + if (ci->role != CI_ROLE_END && ci_role(ci)->resume)
> + ci_role(ci)->resume(ci, power_lost);
> +
> if (power_lost)
> ci_handle_power_lost(ci);
>
> --
> 2.34.1
>
--
Thanks,
Peter Chen
next prev parent reply other threads:[~2022-10-17 0:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 15:14 [PATCH v2 0/8] add power lost support during system suspend/resume Xu Yang
2022-10-13 15:14 ` [PATCH v2 1/8] usb: chipidea: core: add controller resume support when controller is powered off Xu Yang
2022-10-17 0:56 ` Peter Chen
2022-10-25 13:47 ` Conor Dooley
2022-10-26 2:50 ` [EXT] " Xu Yang
2022-10-13 15:14 ` [PATCH v2 2/8] usb: chipidea: core: handle suspend/resume for each role Xu Yang
2022-10-17 0:57 ` Peter Chen [this message]
2022-10-13 15:14 ` [PATCH v2 3/8] usb: chipidea: host: add suspend/resume support for host controller Xu Yang
2022-10-17 1:06 ` Peter Chen
2022-10-13 15:14 ` [PATCH v2 4/8] usb: chipidea: udc: add suspend/resume support for device controller Xu Yang
2022-10-17 1:07 ` Peter Chen
2022-10-13 15:14 ` [PATCH v2 5/8] usb: chipidea: usbmisc: group usbmisc operations for PM Xu Yang
2022-10-13 15:14 ` [PATCH v2 6/8] usb: chipidea: usbmisc: add power lost check for imx6sx Xu Yang
2022-10-13 15:14 ` [PATCH v2 7/8] usb: chipidea: usbmisc: add power lost check for imx7d Xu Yang
2022-10-13 15:14 ` [PATCH v2 8/8] usb: chipidea: usbmisc: add power lost check for imx7ulp Xu Yang
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=20221017005739.GE12701@nchen-desktop \
--to=peter.chen@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=jun.li@nxp.com \
--cc=linux-imx@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=xu.yang_2@nxp.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).