From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D3E7CCA478 for ; Thu, 2 Jun 2022 13:08:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235119AbiFBNIC (ORCPT ); Thu, 2 Jun 2022 09:08:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234759AbiFBNIB (ORCPT ); Thu, 2 Jun 2022 09:08:01 -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 C396D13C1EF; Thu, 2 Jun 2022 06:07:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1654175279; x=1685711279; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=ORWITCGfFAduN35qAdzvpU36suO0XfC/5NY42ZhWZXY=; b=Amf5rrjlnLX9xtDaf7q+fw8WCMeFiqFDFAmxWMlYFjsrcvHAmoMw+9pD 7fiBFhuch9m7sRiv1kkQb0p40HEHOUDe81xkn81IVqLU5CqD7z/QctFqt dFK6FlsEcj1w4lyVU5paGMx3DyDTjrJqkR2x+cWo60Zipw0n2xSrZSmY7 Y=; Received: from unknown (HELO ironmsg04-sd.qualcomm.com) ([10.53.140.144]) by alexa-out-sd-02.qualcomm.com with ESMTP; 02 Jun 2022 06:07:59 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg04-sd.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2022 06:07:58 -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; Thu, 2 Jun 2022 06:07:58 -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; Thu, 2 Jun 2022 06:07:52 -0700 Date: Thu, 2 Jun 2022 18:37:47 +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 v20 5/5] usb: dwc3: qcom: Keep power domain on to retain controller status Message-ID: <20220602130747.GB2521@hu-pkondeti-hyd.qualcomm.com> References: <1654158277-12921-1-git-send-email-quic_kriskura@quicinc.com> <1654158277-12921-6-git-send-email-quic_kriskura@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1654158277-12921-6-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) Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Thu, Jun 02, 2022 at 01:54:37PM +0530, Krishna Kurapati wrote: > From: Sandeep Maheswaram > > If dwc3 is wakeup capable, keep the power domain always ON so that > wakeup from system suspend can be supported. Otherwise, keep the > power domain ON only during runtime suspend to support wakeup from > runtime suspend. > > Signed-off-by: Sandeep Maheswaram > Signed-off-by: Krishna Kurapati > --- > drivers/usb/dwc3/dwc3-qcom.c | 28 +++++++++++++++++++++------- > 1 file changed, 21 insertions(+), 7 deletions(-) > > diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c > index 9395d79..7b6eff5 100644 > --- a/drivers/usb/dwc3/dwc3-qcom.c > +++ b/drivers/usb/dwc3/dwc3-qcom.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -756,12 +757,13 @@ dwc3_qcom_create_urs_usb_platdev(struct device *dev) > > static int dwc3_qcom_probe(struct platform_device *pdev) > { > - struct device_node *np = pdev->dev.of_node; > - struct device *dev = &pdev->dev; > - struct dwc3_qcom *qcom; > - struct resource *res, *parent_res = NULL; > - int ret, i; > - bool ignore_pipe_clk; > + struct device_node *np = pdev->dev.of_node; > + struct device *dev = &pdev->dev; > + struct dwc3_qcom *qcom; > + struct resource *res, *parent_res = NULL; > + int ret, i; > + bool ignore_pipe_clk; > + struct generic_pm_domain *genpd; > > qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL); > if (!qcom) > @@ -770,6 +772,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, qcom); > qcom->dev = &pdev->dev; > > + genpd = pd_to_genpd(qcom->dev->pm_domain); > + > if (has_acpi_companion(dev)) { > qcom->acpi_pdata = acpi_device_get_match_data(dev); > if (!qcom->acpi_pdata) { > @@ -877,7 +881,17 @@ static int dwc3_qcom_probe(struct platform_device *pdev) > if (ret) > goto interconnect_exit; > > - device_init_wakeup(&pdev->dev, 1); > + if (device_can_wakeup(&qcom->dwc3->dev)) { > + /* > + * Setting GENPD_FLAG_ALWAYS_ON flag takes care of keeping > + * genpd on in both runtime suspend and system suspend cases. > + */ > + genpd->flags |= GENPD_FLAG_ALWAYS_ON; > + device_init_wakeup(&pdev->dev, true); > + } else { > + genpd->flags |= GENPD_FLAG_RPM_ALWAYS_ON; > + } > + > qcom->is_suspended = false; > pm_runtime_set_active(dev); > pm_runtime_enable(dev); Looks good to me. Reviewed-by: Pavankumar Kondeti