From patchwork Wed Nov 29 18:59:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 171542 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a5a7:0:b0:403:3b70:6f57 with SMTP id d7csp550794vqn; Wed, 29 Nov 2023 11:00:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcBBILKx6/64ruWu6WiKZtlpwmpNLdCGh9HkhqrIpTtkB+VqGlXQlNhyeh4sJRxmN4S/sm X-Received: by 2002:a17:90b:3946:b0:285:be73:45ae with SMTP id oe6-20020a17090b394600b00285be7345aemr10464042pjb.49.1701284405801; Wed, 29 Nov 2023 11:00:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701284405; cv=none; d=google.com; s=arc-20160816; b=SvO/mCFrNfv/w/b7xsfGv5mpMrTLj5NB22Kab0JzJnpBjyxBrYW3SXPjCZEdug0tsy pDxaWxmXBZP/d0AQkxAtbv8kN/hgFWCrQAyaWeoW/Z+H71oV6V/kFKqm7i38UmdydtaE BG7jY56nwM5qRrx757l+UK9Sc579pDUMFXFcrIghfWcuQzWNLC64Zi9FokFz+Cgqk1/f WHq0vTfstkOCCa9tmAnsN/bCCUM7t361C3noayWGtVWqIGQhcWT7+2DpQHy9+rDrJrNA f8LYWpD2/8IDMmnFWC2iAwNmj7+XSiPnZRAnDBoYmY5pbV6HQPCH5mEdKTaFP8X4xutE +G/w== 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=kZCCtT/OTbXXTOf1M5ryIfFg6M3ApzkRvP5MkQZ2MxU=; fh=M4SmwWZ/7iHrjhlTFT5OMF7TTciupAxAdgRVURl8aUM=; b=VIDVWqRjBgZP0bupgVuqPIbDkkgbnnORzElcS41hbTy9bpTpJKBwEyUEUX3ukbEgB5 bNIdSwiwNa7HEuuowK8T1Cx8AhRYphA7N7oatPGjyk/flfbw5/0p1B3UggHUETwVSA0R JtTWJow5LZccHPZE160KSKoWnEgUvOL4wu8STutlfWmmItlktIOjTGDyd255DwU48o1k wIUrefA6sdl3C+J+HZ3n95lMyJPhIhQUd9QTqR9fu9fReGz2lO1rmZVbxjYGQqVDpmyU d7c8fUnJpANkMs7ABHjTglusZ89qJghsxhQOgmjAG7HeH86AH9EzATQ0GXKywKEwbPCB nxWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BljyBqmW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id fw6-20020a17090b128600b002800879f482si1837272pjb.87.2023.11.29.11.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 11:00:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BljyBqmW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 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 snail.vger.email (Postfix) with ESMTP id 7559380C9CA7; Wed, 29 Nov 2023 11:00:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233062AbjK2S7l (ORCPT + 99 others); Wed, 29 Nov 2023 13:59:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233109AbjK2S7e (ORCPT ); Wed, 29 Nov 2023 13:59:34 -0500 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 940C310D9 for ; Wed, 29 Nov 2023 10:59:36 -0800 (PST) Received: by mail-ej1-x629.google.com with SMTP id a640c23a62f3a-a04196fc957so12674566b.2 for ; Wed, 29 Nov 2023 10:59:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1701284375; x=1701889175; 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=kZCCtT/OTbXXTOf1M5ryIfFg6M3ApzkRvP5MkQZ2MxU=; b=BljyBqmWJQVgeCQSjZ9cNhjEpK2MydOOc5vZwNADGSXU5tqrVji2LhzjcN+lKHJX9H LPNy+C5xcidn5NG7m1G8XIq7aAmycRdVlbIKINQ1K9fHWcqAX2bANRZbZgCW6mRJoFDq OqtDkuFP57lqK45rW0opVI13mE1NNQX0rK6tqeGrOsxsHP3h7ao717KNaswBn0Tuu9qN YvAlRiWqiXYUUe29NtQ3gbWznNgwrk3ISRqpTWR7RIeP2hNP8Z4Dk3T+MPh7wQ0i3IJq AqyERlTVHUPqWdVfHSPq5T4ozMU+uvdjgNzKzCkInfVnzFZh36LAXCrApZmhTMGJtD98 lGJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701284375; x=1701889175; 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=kZCCtT/OTbXXTOf1M5ryIfFg6M3ApzkRvP5MkQZ2MxU=; b=v4/x8eV7k2kjZvMUgyrzQ2HPt0UFg2iv/qBek+IeEtVfnrF8gnccnA3q1av8esTcu0 EPOjjZMxewUsUqAhdKPCjfN1u0RCmTG/ocVgPrX8TYy3pnYat9Pz06ubZIoMO7uH9R3H PZuBcIP7xKze8Fey6BQ/etMB//6+wYxCm+2dajhum9D9cj43mUHsP9mKhBCZgPM37tG1 Bbhc3Ohu9so/khSaUl7Ywa8nkb/GE/crJz1fis8bpkuQ1Or88lO1f0oE7zAdStxrYUO1 3L3gY525JDXBZTMUylM/MlSr4iwj4GnKmN1K2FBf4JBKZ14iPSmG5j7CPVJrgsvG2Aeb JQeg== X-Gm-Message-State: AOJu0YybZvLrkq0C3W9GOgvIp4TNYterUuREZZVcdTIZLo9YpF8h4wRi 9fqmRseEQpR5e7UFgffbYR3Wfw== X-Received: by 2002:a17:906:104e:b0:a16:904f:2ee with SMTP id j14-20020a170906104e00b00a16904f02eemr3556464ejj.51.1701284375091; Wed, 29 Nov 2023 10:59:35 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 10:59:34 -0800 (PST) From: Konrad Dybcio Date: Wed, 29 Nov 2023 19:59:23 +0100 Subject: [PATCH v2 04/15] clk: qcom: gcc-sm6375: Add runtime PM MIME-Version: 1.0 Message-Id: <20230717-topic-branch_aon_cleanup-v2-4-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=2103; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=+PZmRZ3IclWULU0g4Z+4xO7TS8Y3iYSTcMPv7YVV2GY=; b=r/oGLogrHlF2iWi+EL8SNyymKGnjvNbU9vn5sUS5y1Jm3eieGEUX00Gd74OLNtix41F9EfYG7 /lMABFt1GF5Ch03RVYseoXDc8d3BbzLS361LWP43Xknv3ZCBzJ1iHBY X-Developer-Key: i=konrad.dybcio@linaro.org; a=ed25519; pk=iclgkYvtl2w05SSXO5EjjSYlhFKsJ+5OSZBjOkQuEms= 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_BLOCKED, 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 lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 29 Nov 2023 11:00:04 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783925997547448445 X-GMAIL-MSGID: 1783925997547448445 The GCC block on SM6375 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-sm6375.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/gcc-sm6375.c b/drivers/clk/qcom/gcc-sm6375.c index 7d55e10373ef..86ed8c255c94 100644 --- a/drivers/clk/qcom/gcc-sm6375.c +++ b/drivers/clk/qcom/gcc-sm6375.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -3785,13 +3786,25 @@ static int gcc_sm6375_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_sm6375_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; + } qcom_branch_set_clk_en(regmap, 0x17028); /* GCC_CAMERA_XO_CLK */ qcom_branch_set_clk_en(regmap, 0x2b004); /* GCC_CPUSS_GNOC_CLK */ @@ -3807,7 +3820,10 @@ static int gcc_sm6375_probe(struct platform_device *pdev) clk_lucid_pll_configure(&gpll8, regmap, &gpll8_config); clk_zonda_pll_configure(&gpll9, regmap, &gpll9_config); - return qcom_cc_really_probe(pdev, &gcc_sm6375_desc, regmap); + ret = qcom_cc_really_probe(pdev, &gcc_sm6375_desc, regmap); + pm_runtime_put(&pdev->dev); + + return ret; } static struct platform_driver gcc_sm6375_driver = {