From: Kisang Lee Date: Thu, 17 May 2018 12:17:07 +0000 (+0900) Subject: [HACK] usb: force notification to start gadget X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=40e89a2be029b81cb5c6740ee355826e740e5baa;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git [HACK] usb: force notification to start gadget Change-Id: I7f9273087d5d956c09a9955822135a531232afb7 Signed-off-by: Kisang Lee --- diff --git a/drivers/muic/s2mu004-muic.c b/drivers/muic/s2mu004-muic.c index 4ce270d10cc5..8d1af9470663 100644 --- a/drivers/muic/s2mu004-muic.c +++ b/drivers/muic/s2mu004-muic.c @@ -1067,6 +1067,7 @@ int s2mu004_muic_refresh_adc(struct s2mu004_muic_data *muic_data) } #endif +extern void b_sess_control(int val); int s2mu004_muic_get_vbus_state(struct s2mu004_muic_data *muic_data) { struct i2c_client *i2c = muic_data->i2c; @@ -1077,6 +1078,11 @@ int s2mu004_muic_get_vbus_state(struct s2mu004_muic_data *muic_data) vbus = !!(reg_val & DEV_TYPE_APPLE_VBUS_WAKEUP); pr_info("%s vbus : (%d)\n", __func__, vbus); + if (vbus == 1) + b_sess_control(1); + else + b_sess_control(0); + return vbus; } diff --git a/drivers/usb/dwc3/otg.c b/drivers/usb/dwc3/otg.c index aa21ba4b0802..aa2c135ae92b 100644 --- a/drivers/usb/dwc3/otg.c +++ b/drivers/usb/dwc3/otg.c @@ -520,6 +520,18 @@ dwc3_otg_show_b_sess(struct device *dev, return snprintf(buf, PAGE_SIZE, "%d\n", fsm->b_sess_vld); } +struct dwc3 *g_dwc3; +void b_sess_control(int val) +{ + struct dwc3 *dwc = g_dwc3; + struct otg_fsm *fsm = &dwc->dotg->fsm; + + fsm->b_sess_vld = !!val; + + dwc3_otg_run_sm(fsm); +} +EXPORT_SYMBOL_GPL(b_sess_control); + static ssize_t dwc3_otg_store_b_sess(struct device *dev, struct device_attribute *attr, const char *buf, size_t n) @@ -662,6 +674,8 @@ int dwc3_otg_init(struct dwc3 *dwc) struct dwc3_ext_otg_ops *ops = NULL; int ret = 0; + g_dwc3 = dwc; + dev_info(dwc->dev, "%s\n", __func__); /* EXYNOS SoCs don't have HW OTG, but support SW OTG. */