All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Mark Brown <broonie@kernel.org>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>
Subject: [PATCH 08/15] ASoC: rsnd: rename clk to clkin
Date: Wed, 1 Feb 2023 02:00:22 +0000	[thread overview]
Message-ID: <87y1pi5emh.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87a61y6t8e.wl-kuninori.morimoto.gx@renesas.com>


From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Current adg.c is usig "clk" as clock IN, but is using "clkout" for
clock OUT. This patch arranges "clk" to "clkin".

This is prepare for R-Car Gen4 support.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 sound/soc/sh/rcar/adg.c | 39 ++++++++++++++++++++-------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 776dfff8016b..6392d20ad4a3 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -11,7 +11,7 @@
 #define CLKB	1
 #define CLKC	2
 #define CLKI	3
-#define CLKMAX	4
+#define CLKINMAX 4
 
 #define CLKOUT	0
 #define CLKOUT1	1
@@ -26,12 +26,12 @@ static struct rsnd_mod_ops adg_ops = {
 };
 
 struct rsnd_adg {
-	struct clk *clk[CLKMAX];
+	struct clk *clkin[CLKINMAX];
 	struct clk *clkout[CLKOUTMAX];
 	struct clk *null_clk;
 	struct clk_onecell_data onecell;
 	struct rsnd_mod mod;
-	int clk_rate[CLKMAX];
+	int clkin_rate[CLKINMAX];
 	u32 ckr;
 	u32 rbga;
 	u32 rbgb;
@@ -40,10 +40,10 @@ struct rsnd_adg {
 	int rbgb_rate_for_48khz;  /* RBGB */
 };
 
-#define for_each_rsnd_clk(pos, adg, i)		\
+#define for_each_rsnd_clkin(pos, adg, i)	\
 	for (i = 0;				\
-	     (i < CLKMAX) &&			\
-	     ((pos) = adg->clk[i]);		\
+	     (i < CLKINMAX) &&			\
+	     ((pos) = adg->clkin[i]);		\
 	     i++)
 #define for_each_rsnd_clkout(pos, adg, i)	\
 	for (i = 0;				\
@@ -52,7 +52,7 @@ struct rsnd_adg {
 	     i++)
 #define rsnd_priv_to_adg(priv) ((struct rsnd_adg *)(priv)->adg)
 
-static const char * const clk_name[] = {
+static const char * const clkin_name[] = {
 	[CLKA]	= "clk_a",
 	[CLKB]	= "clk_b",
 	[CLKC]	= "clk_c",
@@ -112,9 +112,9 @@ static void __rsnd_adg_get_timesel_ratio(struct rsnd_priv *priv,
 	unsigned int val, en;
 	unsigned int min, diff;
 	unsigned int sel_rate[] = {
-		adg->clk_rate[CLKA],	/* 0000: CLKA */
-		adg->clk_rate[CLKB],	/* 0001: CLKB */
-		adg->clk_rate[CLKC],	/* 0010: CLKC */
+		adg->clkin_rate[CLKA],	/* 0000: CLKA */
+		adg->clkin_rate[CLKB],	/* 0001: CLKB */
+		adg->clkin_rate[CLKC],	/* 0010: CLKC */
 		adg->rbga_rate_for_441khz,	/* 0011: RBGA */
 		adg->rbgb_rate_for_48khz,	/* 0100: RBGB */
 	};
@@ -287,6 +287,7 @@ static void rsnd_adg_set_ssi_clk(struct rsnd_mod *ssi_mod, u32 val)
 int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigned int rate)
 {
 	struct rsnd_adg *adg = rsnd_priv_to_adg(priv);
+	struct clk *clk;
 	int i;
 	int sel_table[] = {
 		[CLKA] = 0x1,
@@ -299,8 +300,8 @@ int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigned int rate)
 	 * find suitable clock from
 	 * AUDIO_CLKA/AUDIO_CLKB/AUDIO_CLKC/AUDIO_CLKI.
 	 */
-	for (i = 0; i < CLKMAX; i++)
-		if (rate == adg->clk_rate[i])
+	for_each_rsnd_clkin(clk, adg, i)
+		if (rate == adg->clkin_rate[i])
 			return sel_table[i];
 
 	/*
@@ -358,7 +359,7 @@ void rsnd_adg_clk_control(struct rsnd_priv *priv, int enable)
 	struct clk *clk;
 	int i;
 
-	for_each_rsnd_clk(clk, adg, i) {
+	for_each_rsnd_clkin(clk, adg, i) {
 		if (enable) {
 			clk_prepare_enable(clk);
 
@@ -367,7 +368,7 @@ void rsnd_adg_clk_control(struct rsnd_priv *priv, int enable)
 			 * atomic context. Let's keep it when
 			 * rsnd_adg_clk_enable() was called
 			 */
-			adg->clk_rate[i] = clk_get_rate(clk);
+			adg->clkin_rate[i] = clk_get_rate(clk);
 		} else {
 			clk_disable_unprepare(clk);
 		}
@@ -418,15 +419,15 @@ static int rsnd_adg_get_clkin(struct rsnd_priv *priv)
 	struct clk *clk;
 	int i;
 
-	for (i = 0; i < CLKMAX; i++) {
-		clk = devm_clk_get(dev, clk_name[i]);
+	for (i = 0; i < CLKINMAX; i++) {
+		clk = devm_clk_get(dev, clkin_name[i]);
 
 		if (IS_ERR_OR_NULL(clk))
 			clk = rsnd_adg_null_clk_get(priv);
 		if (IS_ERR_OR_NULL(clk))
 			goto err;
 
-		adg->clk[i] = clk;
+		adg->clkin[i] = clk;
 	}
 
 	return 0;
@@ -516,7 +517,7 @@ static int rsnd_adg_get_clkout(struct rsnd_priv *priv)
 	 */
 	adg->rbga_rate_for_441khz	= 0;
 	adg->rbgb_rate_for_48khz	= 0;
-	for_each_rsnd_clk(clk, adg, i) {
+	for_each_rsnd_clkin(clk, adg, i) {
 		rate = clk_get_rate(clk);
 
 		if (0 == rate) /* not used */
@@ -630,7 +631,7 @@ void rsnd_adg_clk_dbg_info(struct rsnd_priv *priv, struct seq_file *m)
 	struct clk *clk;
 	int i;
 
-	for_each_rsnd_clk(clk, adg, i)
+	for_each_rsnd_clkin(clk, adg, i)
 		dbg_msg(dev, m, "%-18s : %pa : %ld\n",
 			__clk_get_name(clk), clk, clk_get_rate(clk));
 
-- 
2.25.1


  parent reply	other threads:[~2023-02-01  2:02 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01  1:59 [PATCH 00/15] ASoC: rsnd: cleanup add R-Car Gen4 Sound support Kuninori Morimoto
2023-02-01  1:59 ` [PATCH 01/15] ASoC: rsnd: check whether playback/capture property exists Kuninori Morimoto
2023-02-01  1:59 ` [PATCH 02/15] ASoC: rsnd: fixup #endif position Kuninori Morimoto
2023-02-01  1:59 ` [PATCH 03/15] ASoC: rsnd: Remove unnecessary rsnd_dbg_dai_call() Kuninori Morimoto
2023-02-01  2:00 ` [PATCH 04/15] ASoC: rsnd: indicate necessary error when clock start failed Kuninori Morimoto
2023-02-01  2:00 ` [PATCH 05/15] ASoC: rsnd: indicate warning once if it can't handle requested rule Kuninori Morimoto
2023-02-01  2:00 ` [PATCH 06/15] ASoC: rsnd: use same debug message format on clkout Kuninori Morimoto
2023-02-01  2:00 ` [PATCH 07/15] ASoC: rsnd: remove unnecessary ADG flags Kuninori Morimoto
2023-02-01  2:00 ` Kuninori Morimoto [this message]
2023-02-01  2:00 ` [PATCH 09/15] ASoC: rsnd: moves clkout_name to top of the file Kuninori Morimoto
2023-02-01  2:00 ` [PATCH 10/15] ASoC: rsnd: use clkin/out_size Kuninori Morimoto
2023-02-01  2:00 ` [PATCH 11/15] ASoC: rsnd: use array for 44.1kHz/48kHz rate handling Kuninori Morimoto
2023-02-01  2:00 ` [PATCH 12/15] ASoC: rsnd: tidyup rsnd_dma_addr() Kuninori Morimoto
2023-02-01  2:00 ` [PATCH 13/15] ASoC: rsnd: dma.c: tidyup rsnd_dma_probe() Kuninori Morimoto
2023-02-01  2:02 ` [PATCH 14/15] ASoC: dt-bindings: renesas: add R8A779G0 V4H Kuninori Morimoto
2023-02-01  2:02   ` Kuninori Morimoto
2023-02-01  7:11   ` Krzysztof Kozlowski
2023-02-01  7:11     ` Krzysztof Kozlowski
2023-02-01 10:19     ` Mark Brown
2023-02-01 10:19       ` Mark Brown
2023-02-02  8:53   ` Geert Uytterhoeven
2023-02-02  8:53     ` Geert Uytterhoeven
2023-02-03  1:18     ` Kuninori Morimoto
2023-02-03  1:18       ` Kuninori Morimoto
2023-02-01  2:02 ` [PATCH 15/15] ASoC: rsnd: add R-Car Gen4 Sound support Kuninori Morimoto
2023-02-01 15:23 ` [PATCH 00/15] ASoC: rsnd: cleanup " Mark Brown

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=87y1pi5emh.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    /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.