Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp4865339pxb; Wed, 20 Apr 2022 11:45:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvzU2rMNywTNYK9yfhbiFUF/eEKL0CjyeGrcEDQEm9SCSiry2hnQMpAd+wGqhbKySdei6H X-Received: by 2002:a17:90b:3909:b0:1c7:9bc:a735 with SMTP id ob9-20020a17090b390900b001c709bca735mr6010875pjb.151.1650480316654; Wed, 20 Apr 2022 11:45:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650480316; cv=none; d=google.com; s=arc-20160816; b=mFxZu5ja3PU39WtSofZiYFj5yshypySrbMdjzaOfCLKaQDVGvzkWxKP0IUVqvE3zZN TH0rtnCWAQ/85eANgacqYW6yN2TYW3S/PN6GpDt+fvw+tt2tfqkvgq1e8D8e9hvZt1qg SUfCSWxznsTi7zjBGUj1NCktsfSAfkULfcvro6+f4lJt42XaMAYFmgP8fBV4w4xbRp1G 9e2qLS9PETIWB6XfwXHDCxWCxL5tyUcIs24fCg3cyWNYly/buiIcvrVh+GlhHaoshcDN JO1nHkuqbU+DLxeKkj6QOcuRY7d/AvyxqsXyakkEiQr3nO94VXeJcIYZgzqdVcx3lbUj 0wLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=s0v6Gyo5kLgOVviPNlXp49QgLmJSYpZlu/oVssdeGgg=; b=C/m7TEoMXQ9QMOolMBKoiCP3qMCb0tzHAH9K8GV1bFWNz8nXtYIy031H1e9alx1Lof HhC4X2kg5kFA3o21+vMTJ8RREeil9MZ/4638Vg+C46e7r3RpGdKD5lOVHAlfwIFo9ZDd arSNBmHgQQ9qEJ/YWXF5XhYtIfaAq/NzJK9kklpZ/cB7NyXLRSKiZrKu01khI6qz2VMq RE4jtB4IH7JEHV9LQd/BI6NDUZOPi2h8r+9C6hrgdY4xti7Pzv7ifP25NYZ0ClGSMNI+ BD4bwm/ibAVPGEwtmVqNtCxm30lb5XKfhQTSP45PgqLaVZpXAkjGGY2VL/Q6Or9PvDyz tpEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=PwvXacKv; 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 lb18-20020a17090b4a5200b001d2abcdbe50si3344657pjb.162.2022.04.20.11.44.59; Wed, 20 Apr 2022 11:45:16 -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=PwvXacKv; 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 S1357511AbiDSTPG (ORCPT + 99 others); Tue, 19 Apr 2022 15:15:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357166AbiDSTPB (ORCPT ); Tue, 19 Apr 2022 15:15:01 -0400 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCABB3B3FF; Tue, 19 Apr 2022 12:12:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1650395536; x=1681931536; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=s0v6Gyo5kLgOVviPNlXp49QgLmJSYpZlu/oVssdeGgg=; b=PwvXacKvSZjW4B+KtSfEBt8kzhOi2IaLXVhwxcmhNB8/FjKW5f7YTNhv Efq34cqomlysu+c+6raWr9YmU43X7HI27egQu4vrgVFLZ77BKyp8PBmSC QHRotLrHMKhW3L5OW3aA/QgJsM/VvylmQAlESagDu+TFv3u7gJlstAEmk 0=; Received: from ironmsg08-lv.qualcomm.com ([10.47.202.152]) by alexa-out.qualcomm.com with ESMTP; 19 Apr 2022 12:12:16 -0700 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg08-lv.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Apr 2022 12:12:16 -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, 19 Apr 2022 12:12:15 -0700 Received: from c-sanm-linux.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, 19 Apr 2022 12:12:08 -0700 From: Sandeep Maheswaram To: Rob Herring , Andy Gross , "Bjorn Andersson" , Greg Kroah-Hartman , Felipe Balbi , Stephen Boyd , Doug Anderson , "Matthias Kaehlcke" , Mathias Nyman , Krzysztof Kozlowski , "Rafael J . Wysocki" , Len Brown , Pavel Machek CC: , , , , , , , , , Sandeep Maheswaram Subject: [PATCH v14 6/7] usb: dwc3: qcom: Keep power domain on to retain controller status Date: Wed, 20 Apr 2022 00:41:09 +0530 Message-ID: <1650395470-31333-7-git-send-email-quic_c_sanm@quicinc.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1650395470-31333-1-git-send-email-quic_c_sanm@quicinc.com> References: <1650395470-31333-1-git-send-email-quic_c_sanm@quicinc.com> MIME-Version: 1.0 Content-Type: text/plain 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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, 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 Keep the power domain always on during runtime suspend or if the controller supports wakeup in order to retain controller status and to support wakeup from devices. Signed-off-by: Sandeep Maheswaram --- v14: Removed the unwanted spaces between the type and the variable name in dwc3_qcom_probe. Avoiding device_may_wakeup condition check multiple times. v13: Added GENPD_FLAG_RPM_ALWAYS_ON irrespective of wakeup capability. Enable GENPD_FLAG_ALWAYS_ON only if device_may_wakeup is true. drivers/usb/dwc3/dwc3-qcom.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index 9804a19..1f9589a 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 @@ -718,12 +719,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) @@ -732,6 +734,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) { @@ -839,7 +843,12 @@ static int dwc3_qcom_probe(struct platform_device *pdev) if (ret) goto interconnect_exit; - device_init_wakeup(&pdev->dev, 1); + genpd->flags |= GENPD_FLAG_RPM_ALWAYS_ON; + + if (device_may_wakeup(&qcom->dwc3->dev)) { + genpd->flags |= GENPD_FLAG_ALWAYS_ON; + device_init_wakeup(&pdev->dev, true); + } qcom->is_suspended = false; pm_runtime_set_active(dev); pm_runtime_enable(dev); -- 2.7.4