Received: by 2002:ac0:e350:0:0:0:0:0 with SMTP id g16csp346268imn; Thu, 4 Aug 2022 08:12:38 -0700 (PDT) X-Google-Smtp-Source: AA6agR7E1QLkMSA4enuNOXvZBhQGcQ0zHWl1Su9e2Sbn4po+NF4YbWM6rc23Gro7mrhjy+0ov89N X-Received: by 2002:a17:907:2d94:b0:730:cad8:fe80 with SMTP id gt20-20020a1709072d9400b00730cad8fe80mr1780693ejc.232.1659625958397; Thu, 04 Aug 2022 08:12:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659625958; cv=none; d=google.com; s=arc-20160816; b=oezu6wXYcj40QLzo0m8YW0xXXAu7Gu6gk04x0O4RRU4HNE4Yus3bbbNoTZ9sgzR+wy YZxuzlvHmGsw4MfeVBp5IChG5bVz83tkuNQhu4X9y4rOmLXssJeSMY5yt5+gZTBFkjf/ m0tc0zxzpRxjLxdodvVUu5CJEJGyTCkZIYrz/zxMGHeTq9im2RFk2eSykeZ7CFEWMqmZ MvmTkTbOpVdU59q3mksf8YNkhesUWIP0PifgJULi/dPFkeAXuISWS1cen59oMCO+hsBH UNXDIYy1oD/iSCGNpYziq8cpU+w/n7vTlM+dLnflsr+lYFTUsbK74YL5AR+LzXwzAqZC 1w4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8V7FOPPZghm83D40iH/sinEM+c/DD+aTqi9oIku8NLk=; b=TIpbKyP3F/1oW42l8M3Gk4gB/QWo1qRL0UlEEh7K2oo/k1TxTcmyNUWjhVwUOn1gPW pphPRQJw2QQJ3+/M6JZzzkyZW4xOIH5U0Ycaclf9twp3Yy4s8DYKSn2zc4Bmklf2fU/3 GA9WxxUx4PcfHuULjjeHJbdOnUg6haR4e86+MNuIlvLjG6ZNccu0sqb659krkEy60zRZ AUj6SEhgh5JOjcO1jJRvTFjO/xX1GeAetqxONJ1p/cVcwqxxmZKYGp0uCUWH/BiNI371 Klpn6FUBSu41Iqya0h4DDiK2t4lRZ+9Lfy0aO5Yz5QIAojI6gIFteaIG8pFNbd7Wcdga 6dgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="M/dTJjrn"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o15-20020a170906974f00b00710e9e0a239si1024906ejy.919.2022.08.04.08.12.13; Thu, 04 Aug 2022 08:12:38 -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=@kernel.org header.s=k20201202 header.b="M/dTJjrn"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239843AbiHDPKX (ORCPT + 99 others); Thu, 4 Aug 2022 11:10:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239442AbiHDPKE (ORCPT ); Thu, 4 Aug 2022 11:10:04 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA2F01CFE0; Thu, 4 Aug 2022 08:09:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 6D5DAB82497; Thu, 4 Aug 2022 15:09:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 22423C43470; Thu, 4 Aug 2022 15:09:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1659625795; bh=Oc10iKL8iP3YYDdhgl1EaSJB79hlUqWQiGPijpdOAlg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M/dTJjrnZ7EHr13yxDEuywog5hxIlSiQ0Lvyi3jbZCkrWQAhhS56SXanqaBqgGDiW RKH9LvbPlKRwb4oLKyFIhUJOG2J3YlowoUHej6DjoKM3IGHVpI6Wy7jqpbAJKVjhEl pz+gDs1t6jWr4Y5+A2Bh+wWpKFXjFX2zu9XYC+gocvoYmORsEFZz76Z+950ylSktcA jF5fbPK3i05lG4XDPdeU9d0VsvjcsLEnYaHV06aH6c8JMRBcn85UapeHOJZbN8xFR6 L4y8h9JsEbN9Rs1a3IcTr6a5/gk9TplUYdZeg9flb91vppZTox79xuX56SbN+WC1Pb NhACaAYrdBgEA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1oJcUK-00069S-VJ; Thu, 04 Aug 2022 17:10:16 +0200 From: Johan Hovold To: Greg Kroah-Hartman , Felipe Balbi Cc: Rob Herring , Krzysztof Kozlowski , Andy Gross , Bjorn Andersson , Manivannan Sadhasivam , Konrad Dybcio , Krishna Kurapati , Stephen Boyd , Doug Anderson , "Matthias Kaehlcke" , Pavankumar Kondeti , quic_ppratap@quicinc.com, quic_vpulyala@quicinc.com, linux-arm-msm@vger.kernel.org, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH v2 2/9] Revert "usb: dwc3: qcom: Keep power domain on to retain controller status" Date: Thu, 4 Aug 2022 17:09:54 +0200 Message-Id: <20220804151001.23612-3-johan+linaro@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220804151001.23612-1-johan+linaro@kernel.org> References: <20220804151001.23612-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 This reverts commit d9be8d5c5b032e5383ff5c404ff4155e9c705429. Generic power-domain flags must be set before the power-domain is initialised and must specifically not be modified by drivers for devices that happen to be in the domain. To make sure that USB power-domains are left enabled during system suspend when a device in the domain is in the wakeup path, the GENPD_FLAG_ACTIVE_WAKEUP flag should instead be set for the domain unconditionally when it is registered. Note that this also avoids keeping power-domains on during suspend when wakeup has not been enabled (e.g. through sysfs). For the runtime PM case, making sure that the PHYs are not suspended and that they are in the same domain as the controller prevents the domain from being suspended. If there are cases where this is not possible or desirable, the genpd implementation may need to be extended. Fixes: d9be8d5c5b03 ("usb: dwc3: qcom: Keep power domain on to retain controller status") Signed-off-by: Johan Hovold --- drivers/usb/dwc3/dwc3-qcom.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-qcom.c b/drivers/usb/dwc3/dwc3-qcom.c index c5e482f53e9d..be2e3dd36440 100644 --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -17,7 +17,6 @@ #include #include #include -#include #include #include #include @@ -757,13 +756,12 @@ 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 generic_pm_domain *genpd; + 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; qcom = devm_kzalloc(&pdev->dev, sizeof(*qcom), GFP_KERNEL); if (!qcom) @@ -772,8 +770,6 @@ 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) { @@ -881,17 +877,7 @@ static int dwc3_qcom_probe(struct platform_device *pdev) if (ret) goto interconnect_exit; - 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; - } - + device_init_wakeup(&pdev->dev, 1); qcom->is_suspended = false; pm_runtime_set_active(dev); pm_runtime_enable(dev); -- 2.35.1