Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp3321016ioo; Tue, 24 May 2022 20:10:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ5fi5ry1X7oaEZhegTJAMIgyUdGBEbeIkZtZR5i/2UF0tC/QTM5FdyNZbhBfP+l1uoxkk X-Received: by 2002:aa7:dbc9:0:b0:42a:ecf2:4740 with SMTP id v9-20020aa7dbc9000000b0042aecf24740mr32037113edt.149.1653448254125; Tue, 24 May 2022 20:10:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653448254; cv=none; d=google.com; s=arc-20160816; b=PN8BkIYTHJIEWHesLtW+ErDrWfuUrbUvKAFi2XuL5/3Qf7L6cHrU3kf2S1RRvkiyWV ux+BwRsVAUP2+HI+t6YGGXvrizFFt4Y6mBCh8LtJLk+2Rm+gi2uBYP5mkp0ku2sgwA1u XuXjXbrcw0HtVGTgNijiyF356EpJ3px96RaGmXY0JISnE4V0FqMIFkBdX8iNq0/eHCLK pHEIdCUy/0mDrkiXyplZQ22RlgkEU1pl94Ez/oL9hGBIeL7oaqOYJmMsP0XmH6eCa4+L r7wcvQqwHr6q1LskS3C1qP1HbzeKPyVIB2KPxoUmIWb5xdttnxljQEMsK6tq/iIyYghj AUaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=WP7UfQlRRM2hZQWTC9qjGGZLJ4w9O9vJ0V4T/yEara8=; b=pnS3qwjefH5eJpeQtNT5LDzWg54iNFt9lExJPGvcyIG+O6yjLNjRuY1JcrSZ4XHhiC yKEn4ymF1nRkd1XlfFt/W8pSF7KSzLnC+Dbn0lmWS8gaHCUmo+F98FqePKCEncozDqk0 jzt4nKi3AhHKg6udMvCqrG6CuWXRn5gB4CIHq3Tm5erWxgBWFaN+IgE2IU1jy7ufKeG2 k7tKsTBiNxwCG2coLy1k6I89kiEHQhHo8Fohb/FaKZgWeymk9JzCl+isAHi/WJ0QuAk7 JyhkN9pT+BMw32h9yeTHylUoBuJ8Z3WGJ//BC/k1rFpkD6h5JCxSMfdLuur9SzP+pwan JPAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b="vLtU/wMO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l25-20020a056402231900b0042abe1808d1si429082eda.434.2022.05.24.20.10.28; Tue, 24 May 2022 20:10:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b="vLtU/wMO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234221AbiEXKbo (ORCPT + 99 others); Tue, 24 May 2022 06:31:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232964AbiEXKbk (ORCPT ); Tue, 24 May 2022 06:31:40 -0400 Received: from alexa-out-sd-02.qualcomm.com (alexa-out-sd-02.qualcomm.com [199.106.114.39]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 215F6BF47; Tue, 24 May 2022 03:31:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1653388300; x=1684924300; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=WP7UfQlRRM2hZQWTC9qjGGZLJ4w9O9vJ0V4T/yEara8=; b=vLtU/wMOgyuf3K1eN9o6K7Y37YoelLrt0M3v5wumzrSIeSI3hVgQ6t11 q7yrCx5G/rwCjyxPqoH1HCjeZ+R3g/ALZmWud0rdjUIG0GBknHFvAm7nM i9vrv5qCUaHz46AlNzor972MRd+6s7qBfVLn8K4O8q+gUa6OAZxm2PvAt 4=; Received: from unknown (HELO ironmsg02-sd.qualcomm.com) ([10.53.140.142]) by alexa-out-sd-02.qualcomm.com with ESMTP; 24 May 2022 03:31:38 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg02-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2022 03:31:37 -0700 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 24 May 2022 03:31:36 -0700 Received: from hu-pkondeti-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.22; Tue, 24 May 2022 03:31:30 -0700 Date: Tue, 24 May 2022 16:01:26 +0530 From: Pavan Kondeti To: Krishna Kurapati CC: Krzysztof Kozlowski , Rob Herring , Andy Gross , Bjorn Andersson , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , "Matthias Kaehlcke" , Mathias Nyman , , , , , , , , , Sandeep Maheswaram Subject: Re: [PATCH v17 4/5] usb: dwc3: qcom: Configure wakeup interrupts during suspend Message-ID: <20220524103126.GJ15121@hu-pkondeti-hyd.qualcomm.com> References: <1653387228-28110-1-git-send-email-quic_kriskura@quicinc.com> <1653387228-28110-5-git-send-email-quic_kriskura@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1653387228-28110-5-git-send-email-quic_kriskura@quicinc.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Krishna, On Tue, May 24, 2022 at 03:43:47PM +0530, Krishna Kurapati wrote: > From: Sandeep Maheswaram > > Configure DP/DM line interrupts based on the USB2 device attached to > the root hub port. When HS/FS device is connected, configure the DP line > as falling edge to detect both disconnect and remote wakeup scenarios. When > LS device is connected, configure DM line as falling edge to detect both > disconnect and remote wakeup. When no device is connected, configure both > DP and DM lines as rising edge to detect HS/HS/LS device connect scenario. > > Signed-off-by: Sandeep Maheswaram > Reviewed-by: Matthias Kaehlcke > Signed-off-by: Krishna Kurapati > --- > drivers/usb/dwc3/dwc3-qcom.c | 74 ++++++++++++++++++++++++++++++++++++++------ > 1 file changed, 65 insertions(+), 9 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > index 7352124..5d5db62 100644 > --- a/drivers/usb/dwc3/dwc3-qcom.c > +++ b/drivers/usb/dwc3/dwc3-qcom.c > @@ -20,7 +20,8 @@ > #include > #include > #include > - > +#include > +#include > #include "core.h" > > /* USB QSCRATCH Hardware registers */ > @@ -296,11 +297,37 @@ static void dwc3_qcom_interconnect_exit(struct dwc3_qcom *qcom) > icc_put(qcom->icc_path_apps); > } > > -static void dwc3_qcom_enable_wakeup_irq(int irq) > +enum usb_device_speed dwc3_qcom_update_usb2_speed(struct dwc3_qcom *qcom) > +{ > + struct dwc3 *dwc = platform_get_drvdata(qcom->dwc3); > + struct usb_hcd *hcd = platform_get_drvdata(dwc->xhci); > + struct usb_device *udev; > + enum usb_device_speed usb2_speed; > + > + /* > + * It is possible to query the speed of all children of > + * USB2.0 root hub via usb_hub_for_each_child(). DWC3 code > + * currently supports only 1 port per controller. So > + * this is sufficient. > + */ > + udev = usb_hub_find_child(hcd->self.root_hub, 1); > + > + if (udev) > + usb2_speed = udev->speed; > + else > + usb2_speed = USB_SPEED_UNKNOWN; > + > + return usb2_speed; > +} > + Can you rename this function since we are not updating anything here. %s/dwc3_qcom_update_usb2_speed/dwc3_qcom_get_usb2_speed > +static void dwc3_qcom_enable_wakeup_irq(int irq, unsigned int polarity) > { > if (!irq) > return; > > + if (polarity) > + irq_set_irq_type(irq, polarity); > + > enable_irq(irq); > enable_irq_wake(irq); > } > @@ -316,24 +343,53 @@ static void dwc3_qcom_disable_wakeup_irq(int irq) > > static void dwc3_qcom_disable_interrupts(struct dwc3_qcom *qcom) > { > - dwc3_qcom_disable_wakeup_irq(qcom->hs_phy_irq); > + enum usb_device_speed usb2_speed = dwc3_qcom_update_usb2_speed(qcom); I am sorry for misleading you on this. Looks like caching usb2_speed in suspend routine dwc3_qcom struct has a benefit. Can we please change to your previous patch-set style? Thanks, Pavan