Skip to contentSkip to conversation

usb: chipiea: add flags for id and vbus from external block

PATCH New Jun Li 1 participant 1 message Feb 25, 2019

Subsystems (2)
lore
Share & tools
lore

Jun Li

author
#0 lore raw

PATCH 1/2 usb: chipiea: add flags for id and vbus from external block

Add 2 flags for id and vbus if the state is from external blocks instead of OTG block inside of USB controller.

---
 drivers/usb/chipidea/core.c  | 2 ++
 include/linux/usb/chipidea.h | 4 ++++
 2 files changed, 6 insertions(+)
drivers/usb/chipidea/core.c +2 -0
index 7bfcbb2..0bfa850 100644
@@ -706,6 +706,7 @@ static int ci_get_platdata(struct device *dev,
 	cable->edev = ext_vbus;
 
 	if (!IS_ERR(ext_vbus)) {
+		platdata->ext_vbus = true;
 		ret = extcon_get_state(cable->edev, EXTCON_USB);
 		if (ret)
 			cable->connected = true;
@@ -718,6 +719,7 @@ static int ci_get_platdata(struct device *dev,
 	cable->edev = ext_id;
 
 	if (!IS_ERR(ext_id)) {
+		platdata->ext_id = true;
 		ret = extcon_get_state(cable->edev, EXTCON_USB_HOST);
 		if (ret)
 			cable->connected = true;
include/linux/usb/chipidea.h +4 -0
index 911e05a..cd72d82 100644
@@ -70,6 +70,10 @@ struct ci_hdrc_platform_data {
 	struct regulator	*reg_vbus;
 	struct usb_otg_caps	ci_otg_caps;
 	bool			tpl_support;
+	/* ID state is from external event out side of USB */
+	bool			ext_id;
+	/* VBUS state is from external event out side of USB */
+	bool			ext_vbus;
 	/* interrupt threshold setting */
 	u32			itc_setting;
 	u32			ahb_burst_config;