From patchwork Thu Sep 12 14:15:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 11143165 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DAA7514ED for ; Thu, 12 Sep 2019 14:15:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B979C206A5 for ; Thu, 12 Sep 2019 14:15:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="PUmIQ5HD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732563AbfILOPn (ORCPT ); Thu, 12 Sep 2019 10:15:43 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37946 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732480AbfILOPn (ORCPT ); Thu, 12 Sep 2019 10:15:43 -0400 Received: by mail-wr1-f65.google.com with SMTP id l11so28624805wrx.5 for ; Thu, 12 Sep 2019 07:15:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z05c2SbQyHgmdiyuA9SdCH+TDRrblP4cUHUsGoERNgM=; b=PUmIQ5HDdUAHPqQqa2qkOdoCcTkoTOmHBainGMaiWInzyotClK6/EvL+Lr5NX2w2pn /51IqSxwmwlUB11nQJO51XWYrN1f8TZQrQSR+nsWJc0ru1KXHDZtduvWYvTLNImSiWba 7cylqwtEiPEzC/LQD+1vb9adi8MeFrOafQpA9S3CfQnT0t7TGUegUPHp6wPAMTNF7bZD ZUtzngU4q3yceUwhcFiPt9gur5UX4H86SzjybcQgVnzuwzmBElqZv9deF+wovJ22gHWO VjAx1hVSxrAkSivUMHqHJC1XKXjrUr7xm7sWTtPFJJg3KJAZZvqj+Vf5T2pWyEVVv3bX O/vA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z05c2SbQyHgmdiyuA9SdCH+TDRrblP4cUHUsGoERNgM=; b=a9orVlhK2R2DFyTCuYYTkiLHRZ69jI5Z/AELdxVRK0CMln3KRRFMBfidl4/Jxrsaxf AlffWCuNW/yQ/i4B2f3ZccWkdUBiHGqkFDTSK0ATHenstydJBgsxi8X7EmQ1kRs1snhL CZmALAyaSqXvwukaddoqLEwYA7KVkbeRs2UcoIFPINPP03/EZml/x+L1b/0ghrwnRhqL bquoPGrN4iP1cftHeCjrA7rd1WEkgkX/duuYCKcipi6Fgz9amOKFnDJyM2yAbT/CoY4A 0VryLdlP/C05mSdO+/lNEZXp/10NqnigzZsxkZhi2DMz42MwYf3vRkrPWKq8hGMdPkKC g9Ng== X-Gm-Message-State: APjAAAXKhv/1+jlilk8D5bk5zx5Tm/AhmqsdUrhvW+EHNCrSx2i/6/6b QAuehvkl50tL2qsPcpJRNKf2sw== X-Google-Smtp-Source: APXvYqyhMKOViR6GZTbCm1+FFBtUvh+7AEdHliZLV0+hczJUYYUBhFvGhSeEqdjd07H0xRiliAQpBg== X-Received: by 2002:a5d:650d:: with SMTP id x13mr2334646wru.37.1568297741707; Thu, 12 Sep 2019 07:15:41 -0700 (PDT) Received: from localhost.localdomain (69.red-83-35-113.dynamicip.rima-tde.net. [83.35.113.69]) by smtp.gmail.com with ESMTPSA id p23sm137599wma.18.2019.09.12.07.15.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Sep 2019 07:15:41 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, agross@kernel.org, mturquette@baylibre.com, bjorn.andersson@linaro.org Cc: niklas.cassel@linaro.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/5] clk: qcom: gcc: limit GPLL0_AO_OUT operating frequency Date: Thu, 12 Sep 2019 16:15:30 +0200 Message-Id: <20190912141534.28870-2-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> References: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Limit the GPLL0_AO_OUT_MAIN operating frequency as per its hardware specifications. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson Acked-by: Stephen Boyd --- drivers/clk/qcom/clk-alpha-pll.c | 8 ++++++++ drivers/clk/qcom/clk-alpha-pll.h | 1 + drivers/clk/qcom/gcc-qcs404.c | 2 +- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/clk-alpha-pll.c b/drivers/clk/qcom/clk-alpha-pll.c index 0ced4a5a9a17..ef51f302bdf0 100644 --- a/drivers/clk/qcom/clk-alpha-pll.c +++ b/drivers/clk/qcom/clk-alpha-pll.c @@ -730,6 +730,14 @@ static long alpha_pll_huayra_round_rate(struct clk_hw *hw, unsigned long rate, return alpha_huayra_pll_round_rate(rate, *prate, &l, &a); } +const struct clk_ops clk_alpha_pll_fixed_ops = { + .enable = clk_alpha_pll_enable, + .disable = clk_alpha_pll_disable, + .is_enabled = clk_alpha_pll_is_enabled, + .recalc_rate = clk_alpha_pll_recalc_rate, +}; +EXPORT_SYMBOL_GPL(clk_alpha_pll_fixed_ops); + const struct clk_ops clk_alpha_pll_ops = { .enable = clk_alpha_pll_enable, .disable = clk_alpha_pll_disable, diff --git a/drivers/clk/qcom/clk-alpha-pll.h b/drivers/clk/qcom/clk-alpha-pll.h index 66755f0f84fc..6b4eb74706b4 100644 --- a/drivers/clk/qcom/clk-alpha-pll.h +++ b/drivers/clk/qcom/clk-alpha-pll.h @@ -104,6 +104,7 @@ struct alpha_pll_config { }; extern const struct clk_ops clk_alpha_pll_ops; +extern const struct clk_ops clk_alpha_pll_fixed_ops; extern const struct clk_ops clk_alpha_pll_hwfsm_ops; extern const struct clk_ops clk_alpha_pll_postdiv_ops; extern const struct clk_ops clk_alpha_pll_huayra_ops; diff --git a/drivers/clk/qcom/gcc-qcs404.c b/drivers/clk/qcom/gcc-qcs404.c index 29cf464dd2c8..18c6563889f3 100644 --- a/drivers/clk/qcom/gcc-qcs404.c +++ b/drivers/clk/qcom/gcc-qcs404.c @@ -330,7 +330,7 @@ static struct clk_alpha_pll gpll0_ao_out_main = { .parent_names = (const char *[]){ "cxo" }, .num_parents = 1, .flags = CLK_IS_CRITICAL, - .ops = &clk_alpha_pll_ops, + .ops = &clk_alpha_pll_fixed_ops, }, }, }; From patchwork Thu Sep 12 14:15:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 11143185 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 377811395 for ; Thu, 12 Sep 2019 14:16:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 13E7F20CC7 for ; Thu, 12 Sep 2019 14:16:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="zeRGnx9J" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732123AbfILOP7 (ORCPT ); Thu, 12 Sep 2019 10:15:59 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:37949 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732561AbfILOPp (ORCPT ); Thu, 12 Sep 2019 10:15:45 -0400 Received: by mail-wr1-f65.google.com with SMTP id l11so28624877wrx.5 for ; Thu, 12 Sep 2019 07:15:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=MyCCet13LkijoDqtWJYtA/7gCLRctgr20CN4r0Zl6Mg=; b=zeRGnx9Jl5O3X7Jd4SHlQ0k/Z1HyWXgLVZ7K6qOsjBO4t7cEJY2Atb4S61Y5e3Mo6W iWDKSfGYbBtsw95T7xSReKUHHARk8fx+5BXT/9kojZfo59vSEZSPnc2wZ9aUNFXPeMP/ RINSZZ69wStZe3kzgVNrCS91tG3fuWI5h2eLczRUzzFwqMa07Gq61x0B+SrvNdSKcjfo SqRqCApVvCoEaKoQVY9nOuo8uF5McNy0JGG5JK3XWfuRBQD1ZyPeC0a87DJM9uPD1Pki qHGktZH0ZQNDu91OGL8XwkLY2jGn/6jD0LHwROdyPaApTNV3bmnJRIhst4z7rAZW5ZG3 l7Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=MyCCet13LkijoDqtWJYtA/7gCLRctgr20CN4r0Zl6Mg=; b=GeZBUaGePuAJIzdNAlME//vajVAovYYkReX85IPIwf5yce9zWgBbJbskxnUD57WaML cz5hBOQbfhgSPquOJyEBH2u2v6CgJ5BqJMoi4uyYs3YaOsbGlZXi7QVRRZPJZHhNq7FF jv9kfpDWpNrxzm8J8miHr6OQlqrvwIbIrssPrFnSLRsLyn/pCy94/QduUappM4VJMkb8 WkYRk51ELSSbCExH3wsxe6XLlbK1MrVfA0o/47nDEGO0TrTSetBAr/2hmmhE0WQc9cHO 091qvNUOoBr42GMuI/+HYB8l21rTMSgaqicDTAz+JQVMEj6n3zQs1evZyVkHWxUF7QZS MiVA== X-Gm-Message-State: APjAAAUwirm4rwKvQYmslS+3Z/Os8nJBfqhi7ZZ36snn1ylm2LzT4su1 zedjKkBI39wwsrHsSK3fzfkf9A== X-Google-Smtp-Source: APXvYqwwqholtaKN+KyTW+G3hH4nfqJZ2659cgwFzkvHppKcYvHrcYjQj1TbkApkjUg1z3nZ2ylJjw== X-Received: by 2002:a5d:4044:: with SMTP id w4mr36896685wrp.281.1568297742744; Thu, 12 Sep 2019 07:15:42 -0700 (PDT) Received: from localhost.localdomain (69.red-83-35-113.dynamicip.rima-tde.net. [83.35.113.69]) by smtp.gmail.com with ESMTPSA id p23sm137599wma.18.2019.09.12.07.15.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Sep 2019 07:15:42 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, agross@kernel.org, mturquette@baylibre.com, bjorn.andersson@linaro.org Cc: niklas.cassel@linaro.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/5] clk: qcom: hfpll: register as clock provider Date: Thu, 12 Sep 2019 16:15:31 +0200 Message-Id: <20190912141534.28870-3-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> References: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Make the output of the high frequency pll a clock provider. On the QCS404 this PLL controls cpu frequency scaling. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson Acked-by: Stephen Boyd --- drivers/clk/qcom/hfpll.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c index a6de7101430c..e64c0fd82fe4 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -57,6 +57,7 @@ static int qcom_hfpll_probe(struct platform_device *pdev) .num_parents = 1, .ops = &clk_ops_hfpll, }; + int ret; h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); if (!h) @@ -79,7 +80,14 @@ static int qcom_hfpll_probe(struct platform_device *pdev) h->clkr.hw.init = &init; spin_lock_init(&h->lock); - return devm_clk_register_regmap(&pdev->dev, &h->clkr); + ret = devm_clk_register_regmap(dev, &h->clkr); + if (ret) { + dev_err(dev, "failed to register regmap clock: %d\n", ret); + return ret; + } + + return devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, + &h->clkr.hw); } static struct platform_driver qcom_hfpll_driver = { From patchwork Thu Sep 12 14:15:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 11143181 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7A9BD14ED for ; Thu, 12 Sep 2019 14:15:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5653621479 for ; Thu, 12 Sep 2019 14:15:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P+ZBQtY8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732580AbfILOPq (ORCPT ); Thu, 12 Sep 2019 10:15:46 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:43521 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732571AbfILOPp (ORCPT ); Thu, 12 Sep 2019 10:15:45 -0400 Received: by mail-wr1-f67.google.com with SMTP id q17so23956721wrx.10 for ; Thu, 12 Sep 2019 07:15:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n4HuXOecJ8CldO3Qcv/+iPcaR05KtaOHoI08UvS2vkA=; b=P+ZBQtY8IAzNGPcyXB0igxUncNFGMCWwMBp9abZV+Jm5F+30LQOPBeppdSvnj0ygqm hrS8LCbc8eJXsTvZ1EDprLEJhHN8zQchzIrOTywH921iwg+b8Zd57BPryK42xPtGP1tD BSxXYfkq4yxzMb3SqyYpz0yimALHuxtr1ZWK+fR02j/xCqh0L5dI9qxGNH2ydy39OEEY SJbI7PaGH2wanzx8FloCIpgmk+wTxnzV1+aJm0I9huFHiwf6m1NeO2rU+24OcbRrS9Bl vp6Q/plLCc2O6pf3mQj/LdU+bb/kXx4srClG/b8ynaDNK4EFzAaGX0eNWeUUKEG7wLJF oWWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n4HuXOecJ8CldO3Qcv/+iPcaR05KtaOHoI08UvS2vkA=; b=peMzDe5nYF+vKMMAH1bbEM2VgqvfYrsHbQD6HLbb3siXe1F1ZJ2jtcsMz1q2A37ZyS mxyTUJ7ivKPhCnG7xaE7Gw6R6p2LGchcpN4fO1j60Ej3fgGh2BnIkhz0hXSZe/OJB8CF btbSbT757LCt3S6t5T58oSyah5Jih9z1I04n1vePIViiCxZYe2PdV7kPvujwmxoyc4al lDTBixGAZ8F+efj0+SxImycJaAU02FWJK6pDP2bNlFscLFAUZwEcFbgMCmRjg4CX67// aVLdWjHarq9DDWVNSQ/jpjlivZvez4Xgtve6HKXf+3GnN0olbSFjeydpDdnLzcGn+K4s d8AA== X-Gm-Message-State: APjAAAWC2iYXeaCuQ/tVmXfPAjIdg/iwC0dWB0W81toCNwNU2hRBsstT S8mfT+OqIFKwL2+ghntcRB4KBg== X-Google-Smtp-Source: APXvYqyih+Sy3DwbxhQMt84jV1sr/5rvW4oqW++DujL7wzkF2wJQBkpZxnK2AsrisCkUHIFZcHVIlQ== X-Received: by 2002:a05:6000:1101:: with SMTP id z1mr30889258wrw.332.1568297743762; Thu, 12 Sep 2019 07:15:43 -0700 (PDT) Received: from localhost.localdomain (69.red-83-35-113.dynamicip.rima-tde.net. [83.35.113.69]) by smtp.gmail.com with ESMTPSA id p23sm137599wma.18.2019.09.12.07.15.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Sep 2019 07:15:43 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, agross@kernel.org, mturquette@baylibre.com, bjorn.andersson@linaro.org Cc: niklas.cassel@linaro.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/5] clk: qcom: hfpll: CLK_IGNORE_UNUSED Date: Thu, 12 Sep 2019 16:15:32 +0200 Message-Id: <20190912141534.28870-4-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> References: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org When COMMON_CLK_DISABLED_UNUSED is set, in an effort to save power and to keep the software model of the clock in line with reality, the framework transverses the clock tree and disables those clocks that were enabled by the firmware but have not been enabled by any device driver. If CPUFREQ is enabled, early during the system boot, it might attempt to change the CPU frequency ("set_rate"). If the HFPLL is selected as a provider, it will then change the rate for this clock. As boot continues, clk_disable_unused_subtree will run. Since it wont find a valid counter (enable_count) for a clock that is actually enabled it will attempt to disable it which will cause the CPU to stop. Notice that in this driver, calls to check whether the clock is enabled are routed via the is_enabled callback which queries the hardware. The following commit, rather than marking the clock critical and forcing the clock to be always enabled, addresses the above scenario making sure the clock is not disabled but it continues to rely on the firmware to enable the clock. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson --- drivers/clk/qcom/hfpll.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c index e64c0fd82fe4..225c675f6779 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -56,6 +56,13 @@ static int qcom_hfpll_probe(struct platform_device *pdev) .parent_names = (const char *[]){ "xo" }, .num_parents = 1, .ops = &clk_ops_hfpll, + /* + * rather than marking the clock critical and forcing the clock + * to be always enabled, we make sure that the clock is not + * disabled: the firmware remains responsible of enabling this + * clock (for more info check the commit log) + */ + .flags = CLK_IGNORE_UNUSED, }; int ret; From patchwork Thu Sep 12 14:15:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 11143177 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id CB3DF1395 for ; Thu, 12 Sep 2019 14:15:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A9108206A5 for ; Thu, 12 Sep 2019 14:15:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="A2GJVGuR" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732512AbfILOP5 (ORCPT ); Thu, 12 Sep 2019 10:15:57 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33008 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732492AbfILOPq (ORCPT ); Thu, 12 Sep 2019 10:15:46 -0400 Received: by mail-wr1-f68.google.com with SMTP id u16so28693540wrr.0 for ; Thu, 12 Sep 2019 07:15:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kdN/u39fDQLfzd7rtHJ5JZYMbTkaxu/Gufv+LpTjgaQ=; b=A2GJVGuROuKBhePAYuM1kJnzZ+T14oTz0SyhSmH80VaUITfhegPebyeXbV6zE62Xfx +M2+4fBhZJiqH6grq1qnhtyv9iCXLAEJ3YvfzPvaucKSiPMCw3XxfbpdjR8Q2oGG7+mw 5R9RIDjiEly/GhYj2fbusH1rUkt5OJDOkzd7cCa6q2O/xAg7F6XKVlTumb8lyqTRP9E8 dJThiRkX/FmBDYymYDrK3hkiKYDhOB2nbqf0RTKWXmXRHZ6uoP2Ivhb3VTnRaeluPL5f KrgTDkK6zTN2LuuCR5cMrv5xKhvqmBhTWmW1kqolkHpJpTNakCw8x9uzqGVF6e7haIYV drdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kdN/u39fDQLfzd7rtHJ5JZYMbTkaxu/Gufv+LpTjgaQ=; b=gUW61VYN8nJ+oe98Xo20PHzC5LtHRotVIQG6Q+vuG2cjMBwgXVlcbAWe/b5mutg+aG MQ2/z3FqzGkZSOsanwtqvJ1a+coyib/d7CV3lrWT16HTtxWuoznBy3XxKkZdssWd/CM8 aN8FSrsq1Vt5C0sRREoVD5Fu5Bpd19/ZhWFCPZsUpYODjc9qLm5LedaJplIs90J+nugU pDVFbq1wVWosm8o70E4zpQ9cJdM9Ky+5pwhJM0YepYL4ZbJ65QSmLlY92cFvArdbBDeE EWVbyzLYUtvFrm6jbiRXjSSYyU6eIKsCFtCFEDLX6HFJ1q9pGzgxIDiqNJOiFFQiBpcl SVTg== X-Gm-Message-State: APjAAAWZd0dcNjFJ8mNGtTVHHHNscOhosBffq1wHbnz5XLUrImDc9Vr3 Rrmdo1SXvCdAVmzTPInoznqjqg== X-Google-Smtp-Source: APXvYqzIkZwKxEVHrRQ41dj/lt5Mk78L/Xym8U4DEVgQKBW37ME6sYuep4Kx7a8QwJJr4NDczBlSnA== X-Received: by 2002:a5d:4d81:: with SMTP id b1mr37475923wru.27.1568297744791; Thu, 12 Sep 2019 07:15:44 -0700 (PDT) Received: from localhost.localdomain (69.red-83-35-113.dynamicip.rima-tde.net. [83.35.113.69]) by smtp.gmail.com with ESMTPSA id p23sm137599wma.18.2019.09.12.07.15.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Sep 2019 07:15:44 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, agross@kernel.org, mturquette@baylibre.com, bjorn.andersson@linaro.org Cc: niklas.cassel@linaro.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/5] clk: qcom: hfpll: use clk_parent_data to specify the parent Date: Thu, 12 Sep 2019 16:15:33 +0200 Message-Id: <20190912141534.28870-5-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> References: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Extend support to platorms using different parents. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz --- drivers/clk/qcom/hfpll.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/clk/qcom/hfpll.c b/drivers/clk/qcom/hfpll.c index 225c675f6779..5ff7f5a60620 100644 --- a/drivers/clk/qcom/hfpll.c +++ b/drivers/clk/qcom/hfpll.c @@ -53,7 +53,6 @@ static int qcom_hfpll_probe(struct platform_device *pdev) struct regmap *regmap; struct clk_hfpll *h; struct clk_init_data init = { - .parent_names = (const char *[]){ "xo" }, .num_parents = 1, .ops = &clk_ops_hfpll, /* @@ -65,6 +64,7 @@ static int qcom_hfpll_probe(struct platform_device *pdev) .flags = CLK_IGNORE_UNUSED, }; int ret; + struct clk_parent_data pdata = { .index = 0 }; h = devm_kzalloc(dev, sizeof(*h), GFP_KERNEL); if (!h) @@ -83,6 +83,8 @@ static int qcom_hfpll_probe(struct platform_device *pdev) 0, &init.name)) return -ENODEV; + init.parent_data = &pdata; + h->d = &hdata; h->clkr.hw.init = &init; spin_lock_init(&h->lock); From patchwork Thu Sep 12 14:15:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jorge Ramirez-Ortiz X-Patchwork-Id: 11143175 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BCF041395 for ; Thu, 12 Sep 2019 14:15:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9875D20684 for ; Thu, 12 Sep 2019 14:15:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="c2LsHJ3t" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732573AbfILOPw (ORCPT ); Thu, 12 Sep 2019 10:15:52 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:34378 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732589AbfILOPs (ORCPT ); Thu, 12 Sep 2019 10:15:48 -0400 Received: by mail-wm1-f68.google.com with SMTP id y135so1856695wmc.1 for ; Thu, 12 Sep 2019 07:15:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=U94LXB0H1SLchTUsgjMZwjp3h0cafdMB0BynvaN+clQ=; b=c2LsHJ3tBEwEu++rxVvsn78g0L8UGdn7yiC4/N4WA91klnp22ccVAB1m6chQL/Onzq RhHrr9XFtyyqbHwCu1B1W+g94jvzJjkTfeDlIRm1O27WepyHaoth/Gs16hJe+L0Z9pbo njNWTGxQCTm1gyfrIhwhNHhqw+frkZfE4FpyYuoXtKj2XdpxVE/NV4Y4VvX/AakWvjys v8tipJcte9cSWKsE9GIJCbTR/X74OPRpl09XBDpkPW9vo/zKKDTtXStOUMoe4g4o6n9k xZxx0QvX8cFKWC00/Y1UN+WXaYKiXKNDC7V+qx0/JFXxnzziXfJBQM+gb9Y2DGDnJ1r+ tTMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=U94LXB0H1SLchTUsgjMZwjp3h0cafdMB0BynvaN+clQ=; b=YCS4uDyu8D1leSj5q2+X2GxQxzMDamr5GvQxCg3Vi53ScZaWiNpoKF0JD20VSDN4oz zZkKFDJlUL7JTMbmwA9HVdVqD1IO1TX/cpXrvrseSBmIPAB6xnlhYuf9xHch7mfWC47m zQnsPnOrF5+C+1aQJMlawH7eq0HcdnlZXou6ULx5s/GykX1Ot7T3gRR+KcdZZoHF+4JA CyeJBT8JXzJnj/ABpUnyU/yWewaHUb72Gr052vbkMBgUwthLxGsXi3mrdLBOAfONiv5F MSfWceaeeSQ+JpXsMeEhieQ4ymKCFicleTIecJ135cXpfS91xz+6np13hhd0Tm1T41nN umcw== X-Gm-Message-State: APjAAAU1qS9nXy8wEMbF/hNgft5Ky7SUGpuHbdJUbs+Aw0XpHpsqpkrg apL5ZOhUwfv2u++qBxW12/OEvA== X-Google-Smtp-Source: APXvYqy70e0LTKSHReHGBTwSYaCcOtPua5H4LToUok6GoIgFi9Fwo1Yl8Gyg5lX985HrVLB3xIj4Bw== X-Received: by 2002:a1c:7a14:: with SMTP id v20mr197811wmc.75.1568297745884; Thu, 12 Sep 2019 07:15:45 -0700 (PDT) Received: from localhost.localdomain (69.red-83-35-113.dynamicip.rima-tde.net. [83.35.113.69]) by smtp.gmail.com with ESMTPSA id p23sm137599wma.18.2019.09.12.07.15.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Sep 2019 07:15:45 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez-ortiz@linaro.org, sboyd@kernel.org, agross@kernel.org, mturquette@baylibre.com, bjorn.andersson@linaro.org Cc: niklas.cassel@linaro.org, linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/5] clk: qcom: apcs-msm8916: get parent clock names from DT Date: Thu, 12 Sep 2019 16:15:34 +0200 Message-Id: <20190912141534.28870-6-jorge.ramirez-ortiz@linaro.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> References: <20190912141534.28870-1-jorge.ramirez-ortiz@linaro.org> MIME-Version: 1.0 Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Allow accessing the parent clock names required for the driver operation by using the device tree node. This permits extending the driver to other platforms without having to modify its source code. For backwards compatibility leave previous values as default. Co-developed-by: Niklas Cassel Signed-off-by: Niklas Cassel Signed-off-by: Jorge Ramirez-Ortiz Reviewed-by: Bjorn Andersson --- drivers/clk/qcom/apcs-msm8916.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/clk/qcom/apcs-msm8916.c b/drivers/clk/qcom/apcs-msm8916.c index a6c89a310b18..099b028dbc20 100644 --- a/drivers/clk/qcom/apcs-msm8916.c +++ b/drivers/clk/qcom/apcs-msm8916.c @@ -19,7 +19,7 @@ static const u32 gpll0_a53cc_map[] = { 4, 5 }; -static const char * const gpll0_a53cc[] = { +static const char *gpll0_a53cc[] = { "gpll0_vote", "a53pll", }; @@ -50,6 +50,7 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) struct regmap *regmap; struct clk_init_data init = { }; int ret = -ENODEV; + const char *parents[2]; regmap = dev_get_regmap(parent, NULL); if (!regmap) { @@ -61,6 +62,9 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) if (!a53cc) return -ENOMEM; + if (of_clk_parent_fill(parent->of_node, parents, 2) == 2) + memcpy(gpll0_a53cc, parents, sizeof(parents)); + init.name = "a53mux"; init.parent_names = gpll0_a53cc; init.num_parents = ARRAY_SIZE(gpll0_a53cc); @@ -76,10 +80,11 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) a53cc->src_shift = 8; a53cc->parent_map = gpll0_a53cc_map; - a53cc->pclk = devm_clk_get(parent, NULL); + a53cc->pclk = of_clk_get(parent->of_node, 0); if (IS_ERR(a53cc->pclk)) { ret = PTR_ERR(a53cc->pclk); - dev_err(dev, "failed to get clk: %d\n", ret); + if (ret != -EPROBE_DEFER) + dev_err(dev, "failed to get clk: %d\n", ret); return ret; } @@ -87,6 +92,7 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) ret = clk_notifier_register(a53cc->pclk, &a53cc->clk_nb); if (ret) { dev_err(dev, "failed to register clock notifier: %d\n", ret); + clk_put(a53cc->pclk); return ret; } @@ -109,6 +115,8 @@ static int qcom_apcs_msm8916_clk_probe(struct platform_device *pdev) err: clk_notifier_unregister(a53cc->pclk, &a53cc->clk_nb); + clk_put(a53cc->pclk); + return ret; } @@ -117,6 +125,7 @@ static int qcom_apcs_msm8916_clk_remove(struct platform_device *pdev) struct clk_regmap_mux_div *a53cc = platform_get_drvdata(pdev); clk_notifier_unregister(a53cc->pclk, &a53cc->clk_nb); + clk_put(a53cc->pclk); return 0; }