Message ID | 20221013151442.3262951-3-xu.yang_2@nxp.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 450857c6058f092167f17bad97a2cc9c2a39b9a0 |
Headers | show |
Series | add power lost support during system suspend/resume | expand |
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 >
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);
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> --- Changes since v1: - No changes. --- drivers/usb/chipidea/ci.h | 4 ++++ drivers/usb/chipidea/core.c | 8 ++++++++ 2 files changed, 12 insertions(+)