[HACK] usb: force notification to start gadget
authorKisang Lee <kisang80.lee@samsung.com>
Thu, 17 May 2018 12:17:07 +0000 (21:17 +0900)
committerKisang Lee <kisang80.lee@samsung.com>
Thu, 17 May 2018 12:23:38 +0000 (21:23 +0900)
Change-Id: I7f9273087d5d956c09a9955822135a531232afb7
Signed-off-by: Kisang Lee <kisang80.lee@samsung.com>
drivers/muic/s2mu004-muic.c
drivers/usb/dwc3/otg.c

index 4ce270d10cc5754d04f9e7bff116c59bae13078b..8d1af9470663d34e35702bb4ecc6cb0bbcc9234a 100644 (file)
@@ -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;
 }
 
index aa21ba4b080202d45695c44eb8ee04f4a5a00e89..aa2c135ae92b198797e870c7fc545317cb2c2fb5 100644 (file)
@@ -520,6 +520,18 @@ dwc3_otg_show_b_sess(struct device *dev,
        return snprintf(buf, PAGE_SIZE, "%d\n", fsm->b_sess_vld);\r
 }\r
 \r
+struct dwc3 *g_dwc3;\r
+void b_sess_control(int val)\r
+{\r
+       struct dwc3     *dwc = g_dwc3;\r
+       struct otg_fsm  *fsm = &dwc->dotg->fsm;\r
+\r
+       fsm->b_sess_vld = !!val;\r
+\r
+       dwc3_otg_run_sm(fsm);\r
+}\r
+EXPORT_SYMBOL_GPL(b_sess_control);\r
+\r
 static ssize_t\r
 dwc3_otg_store_b_sess(struct device *dev,\r
                struct device_attribute *attr, const char *buf, size_t n)\r
@@ -662,6 +674,8 @@ int dwc3_otg_init(struct dwc3 *dwc)
        struct dwc3_ext_otg_ops *ops = NULL;\r
        int ret = 0;\r
 \r
+       g_dwc3 = dwc;\r
+\r
        dev_info(dwc->dev, "%s\n", __func__);\r
 \r
        /* EXYNOS SoCs don't have HW OTG, but support SW OTG. */\r