Re: [PATCH 4.4 13/49] usb: dwc2: Fix UDC state tracking

From: Ben Hutchings
Date: Thu Dec 07 2017 - 22:37:30 EST


On Thu, 2017-12-07 at 14:07 +0100, Greg Kroah-Hartman wrote:
> 4.4-stable review patch.ÂÂIf anyone has any objections, please let me
> know.
>
> ------------------
>
> From: John Stultz <john.stultz@xxxxxxxxxx>
>
>
> [ 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.

Then you should add that (commit d2471d4a24df).

Ben.

> Cc: Wei Xu <xuwei5@xxxxxxxxxxxxx>
> Cc: Guodong Xu <guodong.xu@xxxxxxxxxx>
> Cc: Amit Pundir <amit.pundir@xxxxxxxxxx>
> Cc: YongQin Liu <yongqin.liu@xxxxxxxxxx>
> Cc: John Youn <johnyoun@xxxxxxxxxxxx>
> Cc: Minas Harutyunyan <Minas.Harutyunyan@xxxxxxxxxxxx>
> Cc: Douglas Anderson <dianders@xxxxxxxxxxxx>
> Cc: Chen Yu <chenyu56@xxxxxxxxxx>
> Cc: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> Cc: linux-usb@xxxxxxxxxxxxxxx
> Acked-by: Minas Harutyunyan <hminas@xxxxxxxxxxxx>
> Tested-by: Minas Harutyunyan <hminas@xxxxxxxxxxxx>
> Reported-by: Amit Pundir <amit.pundir@xxxxxxxxxx>
> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
> Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
> Signed-off-by: Sasha Levin <alexander.levin@xxxxxxxxxxx>
> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
> ---
> Âdrivers/usb/dwc2/gadget.c |ÂÂÂÂ2 ++
> Â1 file changed, 2 insertions(+)
>
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -2206,6 +2206,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);
> Â}
> Â
> Â/**
>
>
>
--
Ben Hutchings
Software Developer, Codethink Ltd.