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 02/44] ASoC: sync parameter naming : rate / sample_bits
Date: 15 Jan 2021 13:52:54 +0900	[thread overview]
Message-ID: <87wnweolj6.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <87zh1aolkt.wl-kuninori.morimoto.gx@renesas.com>


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

snd_pcm_runtime / snd_soc_dai / snd_soc_dai_driver / snd_soc_dai_link
have related parameter which is similar but not same naming.

	struct snd_pcm_runtime {
		...
(A)		unsigned int rate;
		...
(B)		unsigned int sample_bits;
		...
	};

	struct snd_soc_dai {
		...
(A)		unsigned int rate;
(B)		unsigned int sample_bits;
		...
	};

	struct snd_soc_dai_driver {
		...
(A)		unsigned int symmetric_rates:1;
(B)		unsigned int symmetric_samplebits:1;
		...
	};

	struct snd_soc_dai_link {
		...
(A)		unsigned int symmetric_rates:1;
(B)		unsigned int symmetric_samplebits:1;
		...
	};

Because it is similar but not same naming rule,
code can be verbose / can't share macro.

This patch sync naming rule for framework.
	- xxx_rates;
	+ xxx_rate;

	- xxx_samplebits;
	+ xxx_sample_bits;

old name will be removed if all drivers were switched
to new naming rule.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 include/sound/soc-dai.h           |  6 ++++--
 include/sound/soc.h               |  4 ++--
 sound/soc/rockchip/rockchip_i2s.c |  2 +-
 sound/soc/soc-core.c              |  9 +++++++++
 sound/soc/soc-pcm.c               | 24 ++++++++++++------------
 sound/soc/soc-topology.c          |  8 ++++----
 6 files changed, 32 insertions(+), 21 deletions(-)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 34d0dbf73ca9..ee3c6deb5719 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -353,9 +353,11 @@ struct snd_soc_dai_driver {
 	/* DAI capabilities */
 	struct snd_soc_pcm_stream capture;
 	struct snd_soc_pcm_stream playback;
-	unsigned int symmetric_rates:1;
+	unsigned int symmetric_rates:1; /* will be removed */
+	unsigned int symmetric_rate:1;
 	unsigned int symmetric_channels:1;
-	unsigned int symmetric_samplebits:1;
+	unsigned int symmetric_samplebits:1; /* will be removed */
+	unsigned int symmetric_sample_bits:1;
 
 	/* probe ordering - for components with runtime dependencies */
 	int probe_order;
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 3fa6c40a63b7..bd38015d6c6d 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -685,9 +685,9 @@ struct snd_soc_dai_link {
 	unsigned int ignore_suspend:1;
 
 	/* Symmetry requirements */
-	unsigned int symmetric_rates:1;
+	unsigned int symmetric_rate:1;
 	unsigned int symmetric_channels:1;
-	unsigned int symmetric_samplebits:1;
+	unsigned int symmetric_sample_bits:1;
 
 	/* Do not create a PCM for this DAI link (Backend link) */
 	unsigned int no_pcm:1;
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index eae287d905eb..662de86eca11 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -373,7 +373,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
 			   I2S_DMACR_RDL(16));
 
 	val = I2S_CKR_TRCM_TXRX;
-	if (dai->driver->symmetric_rates && rtd->dai_link->symmetric_rates)
+	if (dai->driver->symmetric_rate && rtd->dai_link->symmetric_rate)
 		val = I2S_CKR_TRCM_TXONLY;
 
 	regmap_update_bits(i2s->regmap, I2S_CKR,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f6d4e99b590c..bb8323cad51a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2509,6 +2509,15 @@ int snd_soc_register_component(struct device *dev,
 {
 	struct snd_soc_component *component;
 	int ret;
+	int i;
+
+	/* Remove ME */
+	for (i = 0; i < num_dai; i++) {
+		if (dai_drv[i].symmetric_rates)
+			dai_drv[i].symmetric_rate = dai_drv[i].symmetric_rates;
+		if (dai_drv[i].symmetric_samplebits)
+			dai_drv[i].symmetric_sample_bits = dai_drv[i].symmetric_samplebits;
+	}
 
 	component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL);
 	if (!component)
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 6e9f14d482ab..1a5d0cb3dc69 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -349,8 +349,8 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
 	struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
 	int ret;
 
-	if (soc_dai->rate && (soc_dai->driver->symmetric_rates ||
-				rtd->dai_link->symmetric_rates)) {
+	if (soc_dai->rate && (soc_dai->driver->symmetric_rate ||
+				rtd->dai_link->symmetric_rate)) {
 		dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %dHz rate\n",
 				soc_dai->rate);
 
@@ -381,8 +381,8 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
 		}
 	}
 
-	if (soc_dai->sample_bits && (soc_dai->driver->symmetric_samplebits ||
-				rtd->dai_link->symmetric_samplebits)) {
+	if (soc_dai->sample_bits && (soc_dai->driver->symmetric_sample_bits ||
+				rtd->dai_link->symmetric_sample_bits)) {
 		dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %d sample bits\n",
 				soc_dai->sample_bits);
 
@@ -412,10 +412,10 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
 	soc_pcm_set_dai_params(&d, params);
 
 	/* reject unmatched parameters when applying symmetry */
-	symmetry = rtd->dai_link->symmetric_rates;
+	symmetry = rtd->dai_link->symmetric_rate;
 
 	for_each_rtd_cpu_dais(rtd, i, dai)
-		symmetry |= dai->driver->symmetric_rates;
+		symmetry |= dai->driver->symmetric_rate;
 
 	if (symmetry) {
 		for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
@@ -443,10 +443,10 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
 		}
 	}
 
-	symmetry = rtd->dai_link->symmetric_samplebits;
+	symmetry = rtd->dai_link->symmetric_sample_bits;
 
 	for_each_rtd_dais(rtd, i, dai)
-		symmetry |= dai->driver->symmetric_samplebits;
+		symmetry |= dai->driver->symmetric_sample_bits;
 
 	if (symmetry) {
 		for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
@@ -469,15 +469,15 @@ static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream)
 	struct snd_soc_dai *dai;
 	unsigned int symmetry, i;
 
-	symmetry = link->symmetric_rates ||
+	symmetry = link->symmetric_rate ||
 		link->symmetric_channels ||
-		link->symmetric_samplebits;
+		link->symmetric_sample_bits;
 
 	for_each_rtd_dais(rtd, i, dai)
 		symmetry = symmetry ||
-			dai->driver->symmetric_rates ||
+			dai->driver->symmetric_rate ||
 			dai->driver->symmetric_channels ||
-			dai->driver->symmetric_samplebits;
+			dai->driver->symmetric_sample_bits;
 
 	return symmetry;
 }
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index 950c45008e24..27f7dd8fb7f6 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1672,7 +1672,7 @@ static void set_dai_flags(struct snd_soc_dai_driver *dai_drv,
 			  unsigned int flag_mask, unsigned int flags)
 {
 	if (flag_mask & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES)
-		dai_drv->symmetric_rates =
+		dai_drv->symmetric_rate =
 			flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES ? 1 : 0;
 
 	if (flag_mask & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS)
@@ -1681,7 +1681,7 @@ static void set_dai_flags(struct snd_soc_dai_driver *dai_drv,
 			1 : 0;
 
 	if (flag_mask & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS)
-		dai_drv->symmetric_samplebits =
+		dai_drv->symmetric_sample_bits =
 			flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS ?
 			1 : 0;
 }
@@ -1763,7 +1763,7 @@ static void set_link_flags(struct snd_soc_dai_link *link,
 		unsigned int flag_mask, unsigned int flags)
 {
 	if (flag_mask & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES)
-		link->symmetric_rates =
+		link->symmetric_rate =
 			flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES ? 1 : 0;
 
 	if (flag_mask & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS)
@@ -1772,7 +1772,7 @@ static void set_link_flags(struct snd_soc_dai_link *link,
 			1 : 0;
 
 	if (flag_mask & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS)
-		link->symmetric_samplebits =
+		link->symmetric_sample_bits =
 			flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS ?
 			1 : 0;
 
-- 
2.25.1


  parent reply	other threads:[~2021-01-15  4:54 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-15  4:51 [PATCH 00/44] ASoC: sync parameter naming : rate / sample_bits Kuninori Morimoto
2021-01-15  4:52 ` [PATCH 01/44] ASoC: soc-pcm: revert soc_pcm_apply_symmetry() Kuninori Morimoto
2021-01-15  4:52 ` Kuninori Morimoto [this message]
2021-01-15  4:53 ` [PATCH 03/44] ASoC: adi: sync parameter naming (rate/sample_bits) Kuninori Morimoto
2021-01-15  4:53 ` [PATCH 04/44] ASoC: atmel: " Kuninori Morimoto
2021-01-15  4:53 ` [PATCH 05/44] ASoC: au1x: " Kuninori Morimoto
2021-01-15  4:53 ` [PATCH 06/44] ASoC: bcm: " Kuninori Morimoto
2021-01-15  4:53 ` [PATCH 07/44] ASoC: cirrus: " Kuninori Morimoto
2021-01-15  4:53 ` [PATCH 08/44] ASoC: tegra: " Kuninori Morimoto
2021-01-15  4:53 ` [PATCH 09/44] ASoC: rockchip: " Kuninori Morimoto
2021-01-15  4:53 ` [PATCH 10/44] ASoC: samsung: " Kuninori Morimoto
2021-01-15  4:53 ` [PATCH 11/44] ASoC: sh: " Kuninori Morimoto
2021-01-15  4:53 ` [PATCH 12/44] ASoC: ti: " Kuninori Morimoto
2021-01-15  4:53 ` [PATCH 13/44] ASoC: pxa: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 14/44] ASoC: mediatek: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 15/44] ASoC: fsl: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 16/44] ASoC: wm*: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 17/44] ASoC: tlv*: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 18/44] ASoC: rt*: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 19/44] ASoC: nau*: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 20/44] ASoC: tas*: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 21/44] ASoC: da*: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 22/44] ASoC: es*: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 23/44] ASoC: max*: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 24/44] ASoC: cs*: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 25/44] ASoC: tscs*: " Kuninori Morimoto
2021-01-15  4:54 ` [PATCH 26/44] ASoC: ak*: " Kuninori Morimoto
2021-01-15  4:55 ` [PATCH 27/44] ASoC: adau*: " Kuninori Morimoto
2021-01-15  4:55 ` [PATCH 28/44] ASoC: jz4740: " Kuninori Morimoto
2021-01-15  4:55 ` [PATCH 29/44] ASoC: sunxi: " Kuninori Morimoto
2021-01-15  4:55 ` [PATCH 30/44] ASoC: zl38060: " Kuninori Morimoto
2021-01-15  4:55 ` [PATCH 31/44] ASoC: ssm2602: " Kuninori Morimoto
2021-01-15  4:55 ` [PATCH 32/44] ASoC: sgtl5000: " Kuninori Morimoto
2021-01-15  4:55 ` [PATCH 33/44] ASoC: mc13783: " Kuninori Morimoto
2021-01-15  4:55 ` [PATCH 34/44] ASoC: mt6660: " Kuninori Morimoto
2021-01-15  4:55 ` [PATCH 35/44] ASoC: lochnagar-sc: " Kuninori Morimoto
2021-01-15  4:56 ` [PATCH 36/44] ASoC: ab8500: " Kuninori Morimoto
2021-01-15  4:56 ` [PATCH 37/44] ASoC: alc5632: " Kuninori Morimoto
2021-01-15  4:56 ` [PATCH 38/44] ASoC: cx2072x: " Kuninori Morimoto
2021-01-15  4:56 ` [PATCH 39/44] ASoC: inno_rk3036: " Kuninori Morimoto
2021-01-15  4:56 ` [PATCH 40/44] ASoC: lm49453: " Kuninori Morimoto
2021-01-15  4:56 ` [PATCH 41/44] ASoC: ml26124: " Kuninori Morimoto
2021-01-15  4:56 ` [PATCH 42/44] ASoC: soc-dai.h: remove symmetric_rates/samplebits Kuninori Morimoto
2021-01-15  4:56 ` [PATCH 43/44] ASoC: soc-pcm: cleanup soc_pcm_apply_symmetry() Kuninori Morimoto
2021-01-15  4:56 ` [PATCH 44/44] ASoC: soc-pcm: cleanup soc_pcm_params_symmetry() Kuninori Morimoto
2021-01-21 19:39 ` [PATCH 00/44] ASoC: sync parameter naming : rate / sample_bits 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=87wnweolj6.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.