4.14-stable review patch.  If anyone has any objections, please let me know.

------------------

From: John Stultz <john.stu...@linaro.org>


[ Upstream commit ce2b21a4e5ce042c0a42c9db8fa9e0f849427d5e ]

It has been noticed that the dwc2 udc state reporting doesn't
seem to work (at least on HiKey boards). Where after the initial
setup, the sysfs /sys/class/udc/f72c0000.usb/state file would
report "configured" no matter the state of the OTG port.

This patch adds a call so that we report to the UDC layer when
the gadget device is disconnected.

This patch does depend on the previous patch ("usb: dwc2:
Improve gadget state disconnection handling") in this patch set
in order to properly work.

Cc: Wei Xu <xuw...@hisilicon.com>
Cc: Guodong Xu <guodong...@linaro.org>
Cc: Amit Pundir <amit.pun...@linaro.org>
Cc: YongQin Liu <yongqin....@linaro.org>
Cc: John Youn <johny...@synopsys.com>
Cc: Minas Harutyunyan <minas.harutyun...@synopsys.com>
Cc: Douglas Anderson <diand...@chromium.org>
Cc: Chen Yu <cheny...@huawei.com>
Cc: Felipe Balbi <felipe.ba...@linux.intel.com>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: linux-usb@vger.kernel.org
Acked-by: Minas Harutyunyan <hmi...@synopsys.com>
Tested-by: Minas Harutyunyan <hmi...@synopsys.com>
Reported-by: Amit Pundir <amit.pun...@linaro.org>
Signed-off-by: John Stultz <john.stu...@linaro.org>
Signed-off-by: Felipe Balbi <felipe.ba...@linux.intel.com>
Signed-off-by: Sasha Levin <alexander.le...@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>
---
 drivers/usb/dwc2/gadget.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -3202,6 +3202,8 @@ void dwc2_hsotg_disconnect(struct dwc2_h
 
        call_gadget(hsotg, disconnect);
        hsotg->lx_state = DWC2_L3;
+
+       usb_gadget_set_state(&hsotg->gadget, USB_STATE_NOTATTACHED);
 }
 
 /**


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to