From patchwork Thu Apr 24 15:09:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felipe Balbi X-Patchwork-Id: 28978 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2871F2036A for ; Thu, 24 Apr 2014 15:09:55 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id j17sf14582696oag.10 for ; Thu, 24 Apr 2014 08:09:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=WY4Ozwgl8kNE11/eq5pzEQ4QCF4g14pQI2yOaLnnltM=; b=kWMxbiDN2+5iDzfpSZ6CWaXMAaIOrU5iHStnttixoxTBdw2CWn/5Cb+b+6/3jid4jO 1J/JXO7BXuHs4F+gtsJsQNDXK5hMynooGtt36SrMx/dRZNG/jMAKrea+GUkIeYATmxFp 5QZEoxtml6Xk/DJcBTRg/bXp+kjzdzzOV9thf4+Rud3Pc1FnmDCDJshcpW5jzW2AHe4U UWC+tQs051IZ2jvZ69/L3edurSzEMfGxQ8VacnEfh4hATR3pELFdWT3ZK6VAHTUx4/4G W3jj3h1SnTae1tUUzEIrHjjsXT+4m+ClAs5kje8ysXjJMqzpgBmGKXzFuenuXkiW7xT8 Vx4w== X-Gm-Message-State: ALoCoQnfR7/2OZ0g1qq1YteUV1eSAy1FByBZewKFE8MK46mJc5pxH0NsTJSgsGJu2Ul+os7iYKiu X-Received: by 10.50.39.80 with SMTP id n16mr5367587igk.2.1398352195607; Thu, 24 Apr 2014 08:09:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.46.52 with SMTP id j49ls1155830qga.67.gmail; Thu, 24 Apr 2014 08:09:55 -0700 (PDT) X-Received: by 10.58.198.75 with SMTP id ja11mr37363vec.59.1398352195477; Thu, 24 Apr 2014 08:09:55 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id ys15si985867vcb.178.2014.04.24.08.09.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Apr 2014 08:09:55 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so3039806veb.14 for ; Thu, 24 Apr 2014 08:09:55 -0700 (PDT) X-Received: by 10.220.83.4 with SMTP id d4mr718669vcl.39.1398352195385; Thu, 24 Apr 2014 08:09:55 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp23757vcb; Thu, 24 Apr 2014 08:09:54 -0700 (PDT) X-Received: by 10.68.220.137 with SMTP id pw9mr4305187pbc.24.1398352194321; Thu, 24 Apr 2014 08:09:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id wg2si2864947pab.249.2014.04.24.08.09.53; Thu, 24 Apr 2014 08:09:53 -0700 (PDT) Received-SPF: none (google.com: linux-usb-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757662AbaDXPJv (ORCPT + 3 others); Thu, 24 Apr 2014 11:09:51 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:46160 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756799AbaDXPJv (ORCPT ); Thu, 24 Apr 2014 11:09:51 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s3OF9oYo019923 for ; Thu, 24 Apr 2014 10:09:50 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3OF9n72029079 for ; Thu, 24 Apr 2014 10:09:50 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.3.174.1; Thu, 24 Apr 2014 10:09:49 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s3OF9mdm012790; Thu, 24 Apr 2014 10:09:49 -0500 From: Felipe Balbi To: Linux USB Mailing List CC: Felipe Balbi Subject: [PATCH] usb: dwc3: gadget: pretty print link states Date: Thu, 24 Apr 2014 10:09:46 -0500 Message-ID: <1398352186-4686-1-git-send-email-balbi@ti.com> X-Mailer: git-send-email 1.9.2.459.g68773ac MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: balbi@ti.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , this makes it slightly easier to read link state change interrupt logs. Signed-off-by: Felipe Balbi --- drivers/usb/dwc3/gadget.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index f0dc0ee..a8cf87b 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -302,6 +302,42 @@ static const char *dwc3_gadget_ep_cmd_string(u8 cmd) } } +static const char *dwc3_gadget_link_string(enum dwc3_link_state link_state) +{ + switch (link_state) { + case DWC3_LINK_STATE_U0: + return "U0"; + case DWC3_LINK_STATE_U1: + return "U1"; + case DWC3_LINK_STATE_U2: + return "U2"; + case DWC3_LINK_STATE_U3: + return "U3"; + case DWC3_LINK_STATE_SS_DIS: + return "SS.Disabled"; + case DWC3_LINK_STATE_RX_DET: + return "RX.Detect"; + case DWC3_LINK_STATE_SS_INACT: + return "SS.Inactive"; + case DWC3_LINK_STATE_POLL: + return "Polling"; + case DWC3_LINK_STATE_RECOV: + return "Recovery"; + case DWC3_LINK_STATE_HRESET: + return "Hot Reset"; + case DWC3_LINK_STATE_CMPLY: + return "Compliance"; + case DWC3_LINK_STATE_LPBK: + return "Loopback"; + case DWC3_LINK_STATE_RESET: + return "Reset"; + case DWC3_LINK_STATE_RESUME: + return "Resume"; + default: + return "UNKNOWN link state\n"; + } +} + int dwc3_send_gadget_generic_command(struct dwc3 *dwc, int cmd, u32 param) { u32 timeout = 500; @@ -2468,7 +2504,8 @@ static void dwc3_gadget_linksts_change_interrupt(struct dwc3 *dwc, break; } - dev_vdbg(dwc->dev, "%s link %d\n", __func__, dwc->link_state); + dev_vdbg(dwc->dev, "%s link %s\n", __func__, + dwc3_gadget_link_string(dwc->link_state)); } static void dwc3_gadget_hibernation_interrupt(struct dwc3 *dwc,