summaryrefslogtreecommitdiffstats
path: root/drivers/usb/chipidea/ci.h
diff options
context:
space:
mode:
authorJun Li <jun.li@nxp.com>2020-01-22 01:46:59 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-01-22 07:54:26 +0100
commit27bf5be8fbe0b60b1f1aa13083198dac64fc4249 (patch)
treeb594686380ef4cc7ce43751ec6e2653737e0f424 /drivers/usb/chipidea/ci.h
parent1e31d3caa262cffa728e007ad209fb8e72b276a8 (diff)
downloadlinux-27bf5be8fbe0b60b1f1aa13083198dac64fc4249.tar.bz2
usb: chipidea: handle single role for usb role class
If usb port is configed to be single role, but usb role class is trying to set unavailable role, don't try to do role change. Signed-off-by: Jun Li <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com> Link: https://lore.kernel.org/r/20200122014639.22667-2-peter.chen@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/chipidea/ci.h')
-rw-r--r--drivers/usb/chipidea/ci.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/ci.h b/drivers/usb/chipidea/ci.h
index 6911aef500e9..d49d5e1235d0 100644
--- a/drivers/usb/chipidea/ci.h
+++ b/drivers/usb/chipidea/ci.h
@@ -302,6 +302,16 @@ static inline enum usb_role ci_role_to_usb_role(struct ci_hdrc *ci)
return USB_ROLE_NONE;
}
+static inline enum ci_role usb_role_to_ci_role(enum usb_role role)
+{
+ if (role == USB_ROLE_HOST)
+ return CI_ROLE_HOST;
+ else if (role == USB_ROLE_DEVICE)
+ return CI_ROLE_GADGET;
+ else
+ return CI_ROLE_END;
+}
+
/**
* hw_read_id_reg: reads from a identification register
* @ci: the controller