Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4800979rdh; Wed, 29 Nov 2023 11:00:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IE//sHYvfOwPuoqa++vcjBw3w9DYSEoJ/GmkRKPk8P2w8DygmZQeAZVr4sisUqhz3J0+KcM X-Received: by 2002:a9d:4e85:0:b0:6d8:53c7:a142 with SMTP id v5-20020a9d4e85000000b006d853c7a142mr1823339otk.6.1701284458127; Wed, 29 Nov 2023 11:00:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701284458; cv=none; d=google.com; s=arc-20160816; b=Kot2wZDPb0ZZzFYlShKfbyIkWMTdluAxtJbbxQoEWH7EVCxWryVlhRBrYlPtvxbAQz B7XQqL524wsAPWZr9r8hKmQ2TSQJsRIAyXXKNrLWMNfLCN3N+3Jxj0houk9NUENxNedd kRgusJCxPjmVj5kguBAdpc5sS89hhVWTl6XQ2/AwQkyzdh/RFcKwDIN071QDr7MuH/DY W0jdL1r1ULfrxxJwpTkyieQdQOXKp7QPTsmQ0rfcT+G2nWOox7fHjZOowu27zP/SPIN+ t19L1jYeMeX/o+cSBwkDFUpJa/OV/ciBVwTirMV/bcWjnxKjLG/EhaUKRn57bhot9wj4 ySRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from :dkim-signature; bh=/EYvH2o2FDAOc1jBHzE94w2pt5/T4uUYkpgbUck9NPc=; fh=M4SmwWZ/7iHrjhlTFT5OMF7TTciupAxAdgRVURl8aUM=; b=yhCRPD0FFATntHtGXA0EWxC6dxBAmsLc9v9e+HZdaWPfovuNBJHDrYDR6H8aZlAWai mYWBydYWujBETEVRSeffmu/RGV+YgAtRIbuFVu4bjweNAFe9RqQHpDPin07oOTXC0hBP sXRp8AM3gJYr3IfMbOAQNiuG5m+uKN12hEcWZe05H2PTYUTPgNizbTZc/t9CTc3+KPqD mVmGVpJf8d5+tcU0UaNxectWzjr4PXaE3+2lgA4oEDtpWK2g6jBTUeh0A48twANmxmoH Az9qmGmL/IjNXryUuiuErF80wr/WyCXx7n5a06v6nKK+ca7f2vPsrO+m9P1Imuk2OrTJ luOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZAbQVSP9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id c25-20020a9d75d9000000b006d7e8a26d93si5631903otl.349.2023.11.29.11.00.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 11:00:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ZAbQVSP9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 357648093D4E; Wed, 29 Nov 2023 11:00:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233998AbjK2TAD (ORCPT + 99 others); Wed, 29 Nov 2023 14:00:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233626AbjK2S7k (ORCPT ); Wed, 29 Nov 2023 13:59:40 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4235E172D for ; Wed, 29 Nov 2023 10:59:42 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id a640c23a62f3a-a00f67f120aso12106266b.2 for ; Wed, 29 Nov 2023 10:59:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701284380; x=1701889180; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=/EYvH2o2FDAOc1jBHzE94w2pt5/T4uUYkpgbUck9NPc=; b=ZAbQVSP94l6zdgg71Dj8Pdt8xPJOp9nkse7UIdx+wZgoKLH5cF5kdHGoIPn78DD9/+ smvZxjzc3rI6oB0mZb2ESaNAN40b6ndetm/jCzNqNco74Yj5fwBGWEahZz1FyJFtbpk+ UL0mQWcU4j6ZIKBogG8tmPtQuNPcZOJReMxfWpG0xa3dgGJdgP/OkoKDxdWpJ7u69N20 pxj0P2SGZbiBMZ3hWBwSUvLMBNwcsUBQiP3nBC+qPMSQjWIFH/IpaSNWGfbZEPiFGpwg putAiPAx4Gs5q55BI3PneqFPBMGP0bXYVtm1fhVUHRavbiS4xcVbPnmjeEVbOeRsmjLx g7JQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701284380; x=1701889180; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/EYvH2o2FDAOc1jBHzE94w2pt5/T4uUYkpgbUck9NPc=; b=Zw+2oHp+OPzoxygd8JnZSUdrGhDfUqVTmu7qCZrpfTlhzq8LQZ2JcGVJgY//Q/NP1w ghn8o/OLUSKR4Rv2JFDywptsfjV7d2n4cEeFf1r02kWPh3+vO4jTq+6tdlBdyURWLrwn 8Oi8/Ee3Zu7ndZX5eEQY4eUYeuukoXbXLP0UGnfjQKoCLrFIpqT8M//epVEC+PJHRUoX IlZ5ol55gppcaf7UrpUsbcz+lMgyhw2RP+87KLgqPzT8iM4xiBQpJKQzzO5ued9dVl7Y FTX8yrtbtylSgzRK+jjf8blOxz1w1hDEZ6apd2MC/ZX3e2CjGIs3XKLZeuHc78vW/tlP 6EWQ== X-Gm-Message-State: AOJu0YzR5jz2qRROMVf2SRUzqYqryiN3olyit+qN2u8pRgjTAGIRF5GG wUrD1QBZAJ6jCXc5/CUuAQI8KQ== X-Received: by 2002:a17:906:2659:b0:9c6:9342:1459 with SMTP id i25-20020a170906265900b009c693421459mr14090995ejc.20.1701284380460; Wed, 29 Nov 2023 10:59:40 -0800 (PST) Received: from [10.167.154.1] (178235187166.dynamic-4-waw-k-2-3-0.vectranet.pl. [178.235.187.166]) by smtp.gmail.com with ESMTPSA id o11-20020a1709061d4b00b009faca59cf38sm8160232ejh.182.2023.11.29.10.59.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 10:59:40 -0800 (PST) From: Konrad Dybcio Date: Wed, 29 Nov 2023 19:59:26 +0100 Subject: [PATCH v2 07/15] clk: qcom: gpucc-sm6115: Add runtime PM MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230717-topic-branch_aon_cleanup-v2-7-2a583460ef26@linaro.org> References: <20230717-topic-branch_aon_cleanup-v2-0-2a583460ef26@linaro.org> In-Reply-To: <20230717-topic-branch_aon_cleanup-v2-0-2a583460ef26@linaro.org> To: Bjorn Andersson , Andy Gross , Michael Turquette , Stephen Boyd , Rob Herring , Krzysztof Kozlowski , Conor Dooley Cc: Marijn Suijten , linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, Konrad Dybcio X-Mailer: b4 0.12.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1701284367; l=2049; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=wo6RqwrpI+TvZGgUHlprTgAEXXwaEB8xXAWdfaiQ80I=; b=5sNZ4fs0hGm079Nd1/queDozn73YeqMcTog04Up3RSBebWyseWuWWiVed4cA+E+SBYqs2UAy+ p/OOqMgizeyCZBR8nfDyP/yh5VefKtJAt7THnWS8+fzIp3TK3aOGdm1 X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 29 Nov 2023 11:00:38 -0800 (PST) The GPU_CC block on SM6115 is powered by the VDD_CX rail. We need to ensure that CX is enabled to prevent unwanted power collapse and that the reference is dropped when unused so that the system can enter a firmware-managed lower power state. Enable runtime PM to keep the power flowing only when necessary. Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/gpucc-sm6115.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/clk/qcom/gpucc-sm6115.c b/drivers/clk/qcom/gpucc-sm6115.c index 93a50431aef8..b50979ce1cbe 100644 --- a/drivers/clk/qcom/gpucc-sm6115.c +++ b/drivers/clk/qcom/gpucc-sm6115.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -443,10 +444,21 @@ MODULE_DEVICE_TABLE(of, gpu_cc_sm6115_match_table); static int gpu_cc_sm6115_probe(struct platform_device *pdev) { struct regmap *regmap; + int ret; + + ret = devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; + + ret = pm_runtime_resume_and_get(&pdev->dev); + if (ret) + return ret; regmap = qcom_cc_map(pdev, &gpu_cc_sm6115_desc); - if (IS_ERR(regmap)) + if (IS_ERR(regmap)) { + pm_runtime_put(&pdev->dev); return PTR_ERR(regmap); + } clk_alpha_pll_configure(&gpu_cc_pll0, regmap, &gpu_cc_pll0_config); clk_alpha_pll_configure(&gpu_cc_pll1, regmap, &gpu_cc_pll1_config); @@ -461,7 +473,10 @@ static int gpu_cc_sm6115_probe(struct platform_device *pdev) qcom_branch_set_clk_en(regmap, 0x1078); /* GPU_CC_AHB_CLK */ qcom_branch_set_clk_en(regmap, 0x1060); /* GPU_CC_GX_CXO_CLK */ - return qcom_cc_really_probe(pdev, &gpu_cc_sm6115_desc, regmap); + ret = qcom_cc_really_probe(pdev, &gpu_cc_sm6115_desc, regmap); + pm_runtime_put(&pdev->dev); + + return ret; } static struct platform_driver gpu_cc_sm6115_driver = { -- 2.43.0