From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751726AbdITT6A (ORCPT ); Wed, 20 Sep 2017 15:58:00 -0400 Received: from mail-pf0-f175.google.com ([209.85.192.175]:51957 "EHLO mail-pf0-f175.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751673AbdITT5i (ORCPT ); Wed, 20 Sep 2017 15:57:38 -0400 X-Google-Smtp-Source: AOwi7QDXzM/DlKScNCsj9CPfID6PRkmSXfYbNfacDSsYUlxX4P5IpiPnJIwro/NLqAIhUiIPt1Lf5w== From: John Stultz To: lkml Cc: John Stultz , Wei Xu , Guodong Xu , Amit Pundir , YongQin Liu , John Youn , Minas Harutyunyan , Douglas Anderson , Chen Yu , Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: [RESEND x2][PATCH 3/3] usb: dwc2: Fix UDC state tracking Date: Wed, 20 Sep 2017 12:57:28 -0700 Message-Id: <1505937448-13475-4-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1505937448-13475-1-git-send-email-john.stultz@linaro.org> References: <1505937448-13475-1-git-send-email-john.stultz@linaro.org> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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 Cc: linux-usb@vger.kernel.org Reported-by: Amit Pundir Signed-off-by: John Stultz --- 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 7fd0e38..603c216 100644 --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -3202,6 +3202,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); } /** -- 2.7.4