From patchwork Wed Nov 29 18:59:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 171546 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp551520vqn; Wed, 29 Nov 2023 11:01:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IFFXj2U9sKLYBfDXv+xpvkAmR07Zui55MZHsq2O6w1ybL64mlG14yrf/U8GbUDcWbwIONfQ X-Received: by 2002:a05:6808:1b1e:b0:3b8:616b:2e96 with SMTP id bx30-20020a0568081b1e00b003b8616b2e96mr5855472oib.3.1701284459856; Wed, 29 Nov 2023 11:00:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701284459; cv=none; d=google.com; s=arc-20160816; b=kcNxSlKooZSZwM+7Nr2ogb8uoBEfUuj+AoBfKxknpE7jkqrwFHZ8wK2JxQ48CqnwWA GYzZGjir//s5s80NbwOVfpxGaC5IjxQpuaaAOoL1KREE35AjKR06tfa5v/BaMf7kvlYk uHB10ReC7CLyKXguIqzF9675TX1TnkH602B9RJisSV2scik9C8FwtuOH4BuHAqzp3twk 1u3rB/PLx95qHA/VrJ8x8hVRPsQ7NieOwn+fJJ8/U3Ue7VEPP65u9M8nPvAbha5LqR1s BNkYcABvQSY4aqXYAWZGUT3lces/BgAWEsMxIILZZivLHemRLr1V4DldcmIRLFGXiu3R TsaQ== 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=TfCS7EJc5WZz01BXUAh+J5+ayBuQvlNbLl5dADuNIr0=; fh=M4SmwWZ/7iHrjhlTFT5OMF7TTciupAxAdgRVURl8aUM=; b=y52NkaoDwD2efO1jsD0ifXzs03IiYXRIHf55nPx370e3kgiaxyYptM1ZkVF+cydb+e 4kJzvwjV07mIHyLiNlFJ1PtCpTi1LEcVT7Dn7hZ4KLqv1AuNszAXPN9cpgp0sQBRZXBB +/q0O6MclWIG5xJgKhRk9Py6p4GhXTsMpefgC3GDHmxqAuVYWrVFjK7YHejFP3rSMFJX UqISRzjtHJzH9cw5dDKJ0Lhg2XCMvQAhv0r00SaSSgFEKtqZgnqrbl8yqV2nAfgId9xi ros0MXjAJSQTOhew7hrNS62N6Y9b3xFOIyhMSEFqKs1yP9J9MrQ6nMDPPGiTi09666Ck +qhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eWXi+Fwk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id c20-20020a056808139400b003acb0db11b9si6094909oiw.38.2023.11.29.11.00.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 11:00:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eWXi+Fwk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id 985C38076D14; Wed, 29 Nov 2023 11:00:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234135AbjK2TAP (ORCPT + 99 others); Wed, 29 Nov 2023 14:00:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233783AbjK2S7n (ORCPT ); Wed, 29 Nov 2023 13:59:43 -0500 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3B6CA10E3 for ; Wed, 29 Nov 2023 10:59:45 -0800 (PST) Received: by mail-ej1-x62c.google.com with SMTP id a640c23a62f3a-a06e59384b6so14397166b.1 for ; Wed, 29 Nov 2023 10:59:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701284383; x=1701889183; 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=TfCS7EJc5WZz01BXUAh+J5+ayBuQvlNbLl5dADuNIr0=; b=eWXi+FwkEeykvAIkfTJ3q9XLTq63hkmWKRgBD2kWeTzJ1gEKVp39kyT86AKisFlVif Z2rPmSrEGWUQnN9qSskLJhN5BAAoF+fO2s05TE7jRSTKUfs1p87A1Y7m4ixGITWetqsj NsMmrvXY5oymfqYjOUQqR6VBPyAYB1JkP81tguNTk3JQFahzDiwTW11CcvWzXiEbB6RQ xoWijcsfq4OzotzSUIYaFSzzNDYX7TD2+TUpkf0xsFLYCBmsq/f9ghwWkr/RB3aLoufs LRJUxMuDjzbXNbvQSbH5zN9yUbTrGXosp20foAyoJ+U1VEvLUBok/pSriwD0/wskfs21 Q7ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701284383; x=1701889183; 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=TfCS7EJc5WZz01BXUAh+J5+ayBuQvlNbLl5dADuNIr0=; b=DOXOHEqAfGtZv3cHM4J18bV7BTRW/kOa89lx8RBg8y5JYMJf0G7nkMzn2nSRfYCAB/ GNHeekyHSRi7KmzqOwoAhrRsEZOhwW9M5NpqPZdQvrAkqo1j/9yVdy4F1bpmbV7V3Ot4 W5Im+I3EOegxWraBh1zzZW/PSnlpw19rpJBLnOIq471URdLji5QTYTlNT7+cMqtBdEoq WCUClYvfbXHUCfhfWT/tVRub38TxLRHGbhwyuDDaU3+BlTcazCZm0j9aEFNYky4blUnW QYxFlJiXpiusxM8v8Hx6L9Aj54JNw6zNjSYK/RWVWSnUgokQG1J9uaWD+n5oFnsUlIrr Y4PA== X-Gm-Message-State: AOJu0YxzKpohECqOwDIiw5iUfLw1m+XwxwqgPGicZFafwb00WIgzZm6G o/bssKZF2Je5zhcAefZd9zHE4g== X-Received: by 2002:a17:907:1687:b0:a12:7347:3b5d with SMTP id cx7-20020a170907168700b00a1273473b5dmr4777939ejd.16.1701284383644; Wed, 29 Nov 2023 10:59:43 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 10:59:43 -0800 (PST) From: Konrad Dybcio Date: Wed, 29 Nov 2023 19:59:28 +0100 Subject: [PATCH v2 09/15] clk: qcom: gcc-sm6115: Add runtime PM MIME-Version: 1.0 Message-Id: <20230717-topic-branch_aon_cleanup-v2-9-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=2112; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=qGB7J3P0DJtbWo81wrMojy7eEnHmPOy4px200OELZEk=; b=aIRs2rJlONz8naMSqsaqRWgFHG1nnH/4qxSnOHk2nrHC8tiATP5GenS/hkWEDZjLTjFjESVeT ii6pxDzgV4WBTZFi8rmYx+KpJrUry8oLFFbRFwabsdeDdzps/0fjRE4 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 pete.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 (pete.vger.email [0.0.0.0]); Wed, 29 Nov 2023 11:00:38 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783926053548149234 X-GMAIL-MSGID: 1783926053548149234 The GCC 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/gcc-sm6115.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/gcc-sm6115.c b/drivers/clk/qcom/gcc-sm6115.c index 87a2bfe222a3..3e0a3fd09718 100644 --- a/drivers/clk/qcom/gcc-sm6115.c +++ b/drivers/clk/qcom/gcc-sm6115.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -3384,14 +3385,26 @@ static int gcc_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, &gcc_sm6115_desc); - if (IS_ERR(regmap)) + if (IS_ERR(regmap)) { + pm_runtime_put(&pdev->dev); return PTR_ERR(regmap); + } ret = qcom_cc_register_rcg_dfs(regmap, gcc_dfs_clocks, ARRAY_SIZE(gcc_dfs_clocks)); - if (ret) + if (ret) { + pm_runtime_put(&pdev->dev); return ret; + } clk_alpha_pll_configure(&gpll8, regmap, &gpll8_config); clk_alpha_pll_configure(&gpll9, regmap, &gpll9_config); @@ -3406,7 +3419,10 @@ static int gcc_sm6115_probe(struct platform_device *pdev) qcom_branch_set_clk_en(regmap, 0x36004); /* GCC_GPU_CFG_AHB_CLK */ qcom_branch_set_clk_en(regmap, 0x2b06c); /* GCC_SYS_NOC_CPUSS_AHB_CLK */ - return qcom_cc_really_probe(pdev, &gcc_sm6115_desc, regmap); + ret = qcom_cc_really_probe(pdev, &gcc_sm6115_desc, regmap); + pm_runtime_put(&pdev->dev); + + return ret; } static struct platform_driver gcc_sm6115_driver = {