usb: chipidea: core: handle usb role switch in a common way
authorXu Yang <xu.yang_2@nxp.com>
Sun, 9 Oct 2022 15:53:36 +0000 (23:53 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 23 Oct 2022 12:34:52 +0000 (14:34 +0200)
commite1b5d2bed67c60c30d01a89df32152d74cfc8e63
treed84d80fbaf13f52b69c19ae318c3aebc278696d3
parent32c6fefb291bf84c5a4dbc7d52b56a1605ed9aae
usb: chipidea: core: handle usb role switch in a common way

Currently, ci_usb_role_switch_set() may be called before system resume
stage when suspended. Worse yet, ci_hdrc device may stay at RPM_ACTIVE
state which will cause pm_runtime_get_sync() fail to resume the device.
In this case, role-switch may unable to complete transition process due
to not exit from lpm state or due to lack some means after system resume.

Same as ci_cable_notifier(), usb_role_switch could handle its events based
on ci_hdrc_cable mechanism.

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
Link: https://lore.kernel.org/r/20221009155336.766960-1-xu.yang_2@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/chipidea/core.c