Skip to content

Commit 88a3518

Browse files
johnstultz-workwuliangfeng
authored andcommitted
UPSTREAM: usb: dwc2: Fix UDC state tracking
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. Change-Id: I3915e6c0d15a811e49d4a7ab9d1d879c09d0e9e1 Cc: Wei Xu <xuwei5@hisilicon.com> Cc: Guodong Xu <guodong.xu@linaro.org> Cc: Amit Pundir <amit.pundir@linaro.org> Cc: YongQin Liu <yongqin.liu@linaro.org> Cc: John Youn <johnyoun@synopsys.com> Cc: Minas Harutyunyan <Minas.Harutyunyan@synopsys.com> Cc: Douglas Anderson <dianders@chromium.org> Cc: Chen Yu <chenyu56@huawei.com> Cc: Felipe Balbi <felipe.balbi@linux.intel.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-usb@vger.kernel.org Acked-by: Minas Harutyunyan <hminas@synopsys.com> Tested-by: Minas Harutyunyan <hminas@synopsys.com> Reported-by: Amit Pundir <amit.pundir@linaro.org> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: William Wu <william.wu@rock-chips.com> (cherry picked from commit ce2b21a4e5ce042c0a42c9db8fa9e0f849427d5e)
1 parent 70644c1 commit 88a3518

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/usb/dwc2/gadget.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,6 +2478,8 @@ void dwc2_hsotg_disconnect(struct dwc2_hsotg *hsotg)
24782478

24792479
call_gadget(hsotg, disconnect);
24802480
hsotg->lx_state = DWC2_L3;
2481+
2482+
usb_gadget_set_state(&hsotg->gadget, USB_STATE_NOTATTACHED);
24812483
}
24822484

24832485
/**

0 commit comments

Comments
 (0)