summaryrefslogtreecommitdiff
path: root/drivers/usb/chipidea/core.c
diff options
context:
space:
mode:
authorXu Yang <xu.yang_2@nxp.com>2022-10-13 23:14:36 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-10-23 14:34:53 +0200
commit450857c6058f092167f17bad97a2cc9c2a39b9a0 (patch)
tree56da313c74b40b0af9ee4de784d1c1c8ed6d288b /drivers/usb/chipidea/core.c
parent74494b33211d067427db25824cd8b53fa0eab1ef (diff)
usb: chipidea: core: handle suspend/resume for each role
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> Link: https://lore.kernel.org/r/20221013151442.3262951-3-xu.yang_2@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea/core.c')
-rw-r--r--drivers/usb/chipidea/core.c8
1 files changed, 8 insertions, 0 deletions
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);