From patchwork Mon Jul 17 15:19:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Konrad Dybcio X-Patchwork-Id: 121406 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c923:0:b0:3e4:2afc:c1 with SMTP id j3csp1182131vqt; Mon, 17 Jul 2023 08:29:40 -0700 (PDT) X-Google-Smtp-Source: APBJJlFZYrccWfiCm2fsuzRQ/KKwtrm+Bs//GI7UYKEnIXi7QIswqwPg60Dy3v5r5TCnJXfdTEei X-Received: by 2002:a17:906:5a98:b0:973:c070:1b5f with SMTP id l24-20020a1709065a9800b00973c0701b5fmr9568990ejq.44.1689607780330; Mon, 17 Jul 2023 08:29:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689607780; cv=none; d=google.com; s=arc-20160816; b=WoyPGipCF+nDxVD75VTTi1ayHkqFKHnQGs+yOyxBVZA31QVXkN8oT/u3PFJMoc39lj EQ2zoNh3Rx5bKK3I5vEJzrSE/CdMq3XPjwayxl6z83TB3u8T+HjmGhDcJYbnYmwpxr4D ft5Za75NwRhQQm64Gshi+8H0mSTbnOuuhFm7Y8V8Zzsd5yyNKwRp3ygKBqWrsaEtrPwQ dptPpgDbHTrERf2mym0sHsvoBpgKbMj2wWO3/811plEAuPmOYEy2bkq6N+n5G/+Q1UWe 6B0JgCn7emPnJRsilown4b1oi9FuKP110/BawThdr/etpShhsHDUNYB3Ko3Ctu6u5wVS 1k7g== 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=y2B8xuxpSnWhbwKMqhSwKujiuUg9pN0gk3aNyNEAwhE=; fh=E58dWdTK3D0DoIKuSZYoE/gJoipBIXlqiTk01lLVuRg=; b=h4xybcIsO9l0uUC7DIjVnq1M/FmnimFFNEOZZiIWAESypBi8SyhxBqDUicXl8NnMF5 YBVJVIz8kaD/RJXVdeBxHqYXewAKGqfeG9fC5nblHDr4gHMO1vmqlUP94qIzZTfdtZHk A4X4N20Xt13QD7jVwNvaRh0s7S/MMX5FiLc/4B2NaKvuiWpfKyMViETr6a6zo9Xt/TMN RZgRDUEGwqWQe8Wh1vU0JO2Kp9UTfi+pW1csyLgWy7jC/5JuYPM9Cv5nGpEoFey6ybFT NiZJT4JsWZlrRSu2Y7ZbTLx8Vfql4wNHsywpGhAeiU63fh5UdENDRCyQ7EGT3wFZlW06 0EGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eatRw8c4; 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=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dv21-20020a170906b81500b00992e14af9bbsi13122890ejb.555.2023.07.17.08.29.16; Mon, 17 Jul 2023 08:29:40 -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=@linaro.org header.s=google header.b=eatRw8c4; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231866AbjGQPUE (ORCPT + 99 others); Mon, 17 Jul 2023 11:20:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231550AbjGQPTk (ORCPT ); Mon, 17 Jul 2023 11:19:40 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 245A01736 for ; Mon, 17 Jul 2023 08:19:29 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-4f122ff663eso7332749e87.2 for ; Mon, 17 Jul 2023 08:19:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689607167; x=1692199167; 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=y2B8xuxpSnWhbwKMqhSwKujiuUg9pN0gk3aNyNEAwhE=; b=eatRw8c4boyIvPhRaLxD5x7GbLwPJJdKgtqcudBmKAdJt+3WsAZKB38G0s6JoxepuQ 1fiUEMRMTEFV1vib41dJVQP0cD0paZULlKEpDLB92OHcSDPBbuXp6WyAcETmaCcOagsP owYnk+Dx9Miu+jMEr8902UgaPz5k73GYoZ7pG9P2XWtQ/uS1Z38lCs3ouAqp9BRpyPry 3WArdvrA+wp9YrmQztsJFI973HztM90xTT9sVX5/1Vq8OCI4OTiV3gEJQ7H95spvY+ZY J0eNkvk4CvPPt4bwmw5o8Z1zy94t/zZe6iK4luYmY4UISQ8nD3X2eV1lqjxuzewQm2ry ayxA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689607167; x=1692199167; 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=y2B8xuxpSnWhbwKMqhSwKujiuUg9pN0gk3aNyNEAwhE=; b=ATd/9/TPJOV9k4Woz5o4AaluGKt+T+6QSImJAj2rMUMHrqFbuxooRE7aWm88uL4dWP LxJ5difUpH7dley4OhnRgQLZ586ZGvDd0RSUDkFyk8jRDribAhkka+iqqNJDym0dNiJz hAFR8gUo0ewOP11RlOL78WbkmaSJwIEqNnhxt3qMgtYccG5A9dPJsXuwT84SZ0bQgPBH ouE7h6yw1CHfHknXRiovzor3c21wwFMcoLd7GRHlZPpyEqx5jPxRqESKBuiAMMIk7jpy U+sqMkE9UDwyjghDUby2VHfj9GaBLNVv/zK5LUoj3Bk5Co+tFTcrQvEFDdXoWOE8nEbg jVmw== X-Gm-Message-State: ABy/qLaDYD42uewkKrJt+HFg/zdVdFsPk09/4OPLAOn8GYMRU2OQERzp M//8ZsVEcyTHw5jczUrpK2zVgQ== X-Received: by 2002:ac2:5f7a:0:b0:4f8:6ea5:104b with SMTP id c26-20020ac25f7a000000b004f86ea5104bmr6981516lfc.30.1689607166903; Mon, 17 Jul 2023 08:19:26 -0700 (PDT) Received: from [192.168.1.101] (abyj181.neoplus.adsl.tpnet.pl. [83.9.29.181]) by smtp.gmail.com with ESMTPSA id z7-20020ac24187000000b004f26d63f823sm2873949lfh.237.2023.07.17.08.19.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jul 2023 08:19:26 -0700 (PDT) From: Konrad Dybcio Date: Mon, 17 Jul 2023 17:19:18 +0200 Subject: [PATCH 11/15] clk: qcom: gcc-qcm2290: Add runtime PM MIME-Version: 1.0 Message-Id: <20230717-topic-branch_aon_cleanup-v1-11-27784d27a4f4@linaro.org> References: <20230717-topic-branch_aon_cleanup-v1-0-27784d27a4f4@linaro.org> In-Reply-To: <20230717-topic-branch_aon_cleanup-v1-0-27784d27a4f4@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=1689607149; l=1980; i=konrad.dybcio@linaro.org; s=20230215; h=from:subject:message-id; bh=SEE5Vf2kJq6CXu3dBwAauLybj1NpUkl0+Tc5/vKK29A=; b=xpHotqpRsd1M6m6fXXG+MlRWzVc91b4BPgGLqLB6PoDcJtO6t4WTluXgb8iW4mKZN3lEG/wW6 53LYl6aqR+mDtzTQEBZpmTgapcF2rbKk+1paoIbTctCdLj3Ur5Ddb2j 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_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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771682167669108168 X-GMAIL-MSGID: 1771682167669108168 The GCC block on QCM2290 is mostly powered by the VDD_CX rail. We need to ensure that it's enabled to prevent unwanted power collapse. Enable runtime PM to keep the power flowing only when necessary. Signed-off-by: Konrad Dybcio --- drivers/clk/qcom/gcc-qcm2290.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/gcc-qcm2290.c b/drivers/clk/qcom/gcc-qcm2290.c index 1a8acc2de921..573cb550d678 100644 --- a/drivers/clk/qcom/gcc-qcm2290.c +++ b/drivers/clk/qcom/gcc-qcm2290.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -2882,14 +2883,26 @@ static int gcc_qcm2290_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_qcm2290_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(&gpll10, regmap, &gpll10_config); clk_alpha_pll_configure(&gpll11, regmap, &gpll11_config); @@ -2912,7 +2925,10 @@ static int gcc_qcm2290_probe(struct platform_device *pdev) qcom_branch_set_clk_en(regmap, 0x36004); qcom_branch_set_clk_en(regmap, 0x2b06c); - return qcom_cc_really_probe(pdev, &gcc_qcm2290_desc, regmap); + ret = qcom_cc_really_probe(pdev, &gcc_qcm2290_desc, regmap); + pm_runtime_put(&pdev->dev); + + return ret; } static struct platform_driver gcc_qcm2290_driver = {