diff options
author | Li Jun <jun.li@nxp.com> | 2019-08-26 18:25:12 +0800 |
---|---|---|
committer | Peter Chen <peter.chen@nxp.com> | 2019-08-28 10:39:53 +0800 |
commit | 05559f10ed797b79f7fa47313682c48919a2b111 (patch) | |
tree | ff421785ada548d4a18c2254a22665e539307680 /drivers/usb/chipidea/ci.h | |
parent | 71fcb8bdf5ab68e91c05b69e80c2d0ab4c51d78b (diff) | |
download | linux-stable-05559f10ed797b79f7fa47313682c48919a2b111.tar.gz linux-stable-05559f10ed797b79f7fa47313682c48919a2b111.tar.bz2 linux-stable-05559f10ed797b79f7fa47313682c48919a2b111.zip |
usb: chipidea: add role switch class support
USB role is fully controlled by usb role switch consumer(e.g. typec),
usb port can be at host mode(USB_ROLE_HOST), device mode connected to
host(USB_ROLE_DEVICE), or not connecting any partner(USB_ROLE_NONE).
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'drivers/usb/chipidea/ci.h')
-rw-r--r-- | drivers/usb/chipidea/ci.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h index 6a2cc5cd0281..6911aef500e9 100644 --- a/drivers/usb/chipidea/ci.h +++ b/drivers/usb/chipidea/ci.h @@ -16,6 +16,7 @@ #include <linux/usb/gadget.h> #include <linux/usb/otg-fsm.h> #include <linux/usb/otg.h> +#include <linux/usb/role.h> #include <linux/ulpi/interface.h> /****************************************************************************** @@ -217,6 +218,7 @@ struct ci_hdrc { ktime_t hr_timeouts[NUM_OTG_FSM_TIMERS]; unsigned enabled_otg_timer_bits; enum otg_fsm_timer next_otg_timer; + struct usb_role_switch *role_switch; struct work_struct work; struct workqueue_struct *wq; @@ -290,6 +292,16 @@ static inline void ci_role_stop(struct ci_hdrc *ci) ci->roles[role]->stop(ci); } +static inline enum usb_role ci_role_to_usb_role(struct ci_hdrc *ci) +{ + if (ci->role == CI_ROLE_HOST) + return USB_ROLE_HOST; + else if (ci->role == CI_ROLE_GADGET && ci->vbus_active) + return USB_ROLE_DEVICE; + else + return USB_ROLE_NONE; +} + /** * hw_read_id_reg: reads from a identification register * @ci: the controller |