All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-clk@vger.kernel.org
Cc: Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Tero Kristo <t-kristo@ti.com>,
	linux-omap@vger.kernel.org
Subject: [PATCH 6/8] clk: ti: Add ti_dt_clk_name() helper to use clock-output-names
Date: Fri,  4 Feb 2022 09:14:47 +0200	[thread overview]
Message-ID: <20220204071449.16762-7-tony@atomide.com> (raw)
In-Reply-To: <20220204071449.16762-1-tony@atomide.com>

Let's create the clock alias based on the clock-output-names property if
available. Also the component clock drivers can use ti_dt_clk_name() in
the following patches.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 drivers/clk/ti/clk.c   | 20 +++++++++++++++++++-
 drivers/clk/ti/clock.h |  1 +
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/ti/clk.c b/drivers/clk/ti/clk.c
--- a/drivers/clk/ti/clk.c
+++ b/drivers/clk/ti/clk.c
@@ -447,6 +447,24 @@ static const struct of_device_id simple_clk_match_table[] __initconst = {
 	{ }
 };
 
+/**
+ * ti_dt_clk_name - init clock name from first output name or node name
+ * @np: device node
+ *
+ * Use the first clock-output-name for the clock name if found. Fall back
+ * to legacy naming based on node name.
+ */
+const char *ti_dt_clk_name(struct device_node *np)
+{
+	const char *name;
+
+	if (!of_property_read_string_index(np, "clock-output-names", 0,
+					   &name))
+		return name;
+
+	return np->name;
+}
+
 /**
  * ti_clk_add_aliases - setup clock aliases
  *
@@ -463,7 +481,7 @@ void __init ti_clk_add_aliases(void)
 		clkspec.np = np;
 		clk = of_clk_get_from_provider(&clkspec);
 
-		ti_clk_add_alias(NULL, clk, np->name);
+		ti_clk_add_alias(NULL, clk, ti_dt_clk_name(np));
 	}
 }
 
diff --git a/drivers/clk/ti/clock.h b/drivers/clk/ti/clock.h
--- a/drivers/clk/ti/clock.h
+++ b/drivers/clk/ti/clock.h
@@ -211,6 +211,7 @@ struct clk *ti_clk_register(struct device *dev, struct clk_hw *hw,
 			    const char *con);
 struct clk *ti_clk_register_omap_hw(struct device *dev, struct clk_hw *hw,
 				    const char *con);
+const char *ti_dt_clk_name(struct device_node *np);
 int ti_clk_add_alias(struct device *dev, struct clk *clk, const char *con);
 void ti_clk_add_aliases(void);
 
-- 
2.35.1

  parent reply	other threads:[~2022-02-04  7:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-04  7:14 [PATCH 0/8] Clock changes for TI dts reg and node name issues Tony Lindgren
2022-02-04  7:14 ` [PATCH 1/8] clk: ti: Constify clkctrl_name Tony Lindgren
2022-03-11  3:30   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 2/8] clk: ti: Preserve node in ti_dt_clocks_register() Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 3/8] clk: ti: Optionally parse IO address from parent clock node Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 4/8] clk: ti: Add ti_find_clock_provider() to use clock-output-names Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 5/8] clk: ti: Use clock-output-names for clkctrl Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` Tony Lindgren [this message]
2022-03-11  3:31   ` [PATCH 6/8] clk: ti: Add ti_dt_clk_name() helper to use clock-output-names Stephen Boyd
2022-02-04  7:14 ` [PATCH 7/8] clk: ti: Update pll and clockdomain clocks to use ti_dt_clk_name() Tony Lindgren
2022-03-11  3:31   ` Stephen Boyd
2022-02-04  7:14 ` [PATCH 8/8] clk: ti: Update component " Tony Lindgren
2022-03-11  3:32   ` Stephen Boyd

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=20220204071449.16762-7-tony@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@codeaurora.org \
    --cc=t-kristo@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.