[lkml]   [2017]   [Nov]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH AUTOSEL for 4.4 06/16] usb: dwc2: Fix UDC state tracking
From: John Stultz <>

[ 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 <>
Cc: Guodong Xu <>
Cc: Amit Pundir <>
Cc: YongQin Liu <>
Cc: John Youn <>
Cc: Minas Harutyunyan <>
Cc: Douglas Anderson <>
Cc: Chen Yu <>
Cc: Felipe Balbi <>
Cc: Greg Kroah-Hartman <>
Acked-by: Minas Harutyunyan <>
Tested-by: Minas Harutyunyan <>
Reported-by: Amit Pundir <>
Signed-off-by: John Stultz <>
Signed-off-by: Felipe Balbi <>
Signed-off-by: Sasha Levin <>
drivers/usb/dwc2/gadget.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 0abf73c91beb..9d791701b0f4 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -2206,6 +2206,8 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)

call_gadget(hsotg, disconnect);
hsotg->lx_state = DWC2_L3;
+ usb_gadget_set_state(&hsotg->gadget, USB_STATE_NOTATTACHED);

 \ /
  Last update: 2017-11-22 23:39    [W:0.124 / U:1.624 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site