From: Florian Eckert <fe@dev.tdt.de>
To: mturquette@baylibre.com, sboyd@kernel.org, yzhu@maxlinear.com,
rtanwar@maxlinear.com, robh+dt@kernel.org,
krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org
Cc: linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org,
devicetree@vger.kernel.org, Eckert.Florian@googlemail.com
Subject: [PATCH 1/2] clk: mxl: add mxl,control-gate dts property
Date: Mon, 31 Jul 2023 12:03:48 +0200 [thread overview]
Message-ID: <20230731100349.184553-2-fe@dev.tdt.de> (raw)
In-Reply-To: <20230731100349.184553-1-fe@dev.tdt.de>
Gate clocks can be controlled either from this cgu clk driver or directly
from power management driver/daemon. It is dependent on the power
policy/profile requirements of the end product. To take control of gate
clks from this driver.
Until now, the source code had to be changed for this purpose by adding
the flag 'GATE_CLK_HW' to the LGM_GATE macro in the source file
'drivers/clk/x86/clk-lgm.c'.
This can be better handled via the device tree, so that the source no
longer needs to be changed. For this purpose, a new option
'mxl,control-gate' is added, which specifies that the gate is controlled
by this driver.
Signed-off-by: Florian Eckert <fe@dev.tdt.de>
---
drivers/clk/x86/clk-cgu.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/drivers/clk/x86/clk-cgu.c b/drivers/clk/x86/clk-cgu.c
index 89b53f280aee..cb4e92ea54bf 100644
--- a/drivers/clk/x86/clk-cgu.c
+++ b/drivers/clk/x86/clk-cgu.c
@@ -339,6 +339,8 @@ int lgm_clk_register_branches(struct lgm_clk_provider *ctx,
{
struct clk_hw *hw;
unsigned int idx;
+ const char *name;
+ unsigned int count, i;
for (idx = 0; idx < nr_clk; idx++, list++) {
switch (list->type) {
@@ -355,19 +357,21 @@ int lgm_clk_register_branches(struct lgm_clk_provider *ctx,
hw = lgm_clk_register_fixed_factor(ctx, list);
break;
case CLK_TYPE_GATE:
- if (list->gate_flags & GATE_CLK_HW) {
- hw = lgm_clk_register_gate(ctx, list);
- } else {
- /*
- * GATE_CLKs can be controlled either from
- * CGU clk driver i.e. this driver or directly
- * from power management driver/daemon. It is
- * dependent on the power policy/profile requirements
- * of the end product. To override control of gate
- * clks from this driver, provide NULL for this index
- * of gate clk provider.
- */
- hw = NULL;
+ /* Check if cgu should control the gate clock */
+ hw = NULL;
+ count = of_property_count_strings(ctx->np,
+ "mxl,control-gate");
+ if (count <= 0)
+ break;
+ for (i = 0; i < count; i++) {
+ of_property_read_string_index(ctx->np,
+ "mxl,control-gate",
+ i, &name);
+ if (!strncmp(list->name, name, strlen(list->name))) {
+ dev_err(ctx->dev, "enable gate control for %s\n",
+ list->name);
+ hw = lgm_clk_register_gate(ctx, list);
+ }
}
break;
--
2.30.2
next prev parent reply other threads:[~2023-07-31 10:24 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-31 10:03 [PATCH 0/2] clk: mxl: add mxl,control-gate dts property Florian Eckert
2023-07-31 10:03 ` Florian Eckert [this message]
2023-07-31 10:03 ` [PATCH 2/2] dt-bindings: clock: intel,cgu-lgm: add mxl,control-gate option Florian Eckert
2023-07-31 11:11 ` Rob Herring
2023-07-31 12:03 ` Krzysztof Kozlowski
2023-07-31 12:59 ` Florian Eckert
2023-07-31 13:01 ` Krzysztof Kozlowski
2023-08-01 8:09 ` Florian Eckert
2023-08-05 19:09 ` Krzysztof Kozlowski
2023-08-08 7:53 ` Yi xin Zhu
2023-08-09 8:56 ` Florian Eckert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230731100349.184553-2-fe@dev.tdt.de \
--to=fe@dev.tdt.de \
--cc=Eckert.Florian@googlemail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mturquette@baylibre.com \
--cc=robh+dt@kernel.org \
--cc=rtanwar@maxlinear.com \
--cc=sboyd@kernel.org \
--cc=yzhu@maxlinear.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).