Commit f14654dd authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: sync parameter naming : rate / sample_bits

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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wnweolj6.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 80f454e2
...@@ -353,9 +353,11 @@ struct snd_soc_dai_driver { ...@@ -353,9 +353,11 @@ struct snd_soc_dai_driver {
/* DAI capabilities */ /* DAI capabilities */
struct snd_soc_pcm_stream capture; struct snd_soc_pcm_stream capture;
struct snd_soc_pcm_stream playback; 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_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 */ /* probe ordering - for components with runtime dependencies */
int probe_order; int probe_order;
......
...@@ -685,9 +685,9 @@ struct snd_soc_dai_link { ...@@ -685,9 +685,9 @@ struct snd_soc_dai_link {
unsigned int ignore_suspend:1; unsigned int ignore_suspend:1;
/* Symmetry requirements */ /* Symmetry requirements */
unsigned int symmetric_rates:1; unsigned int symmetric_rate:1;
unsigned int symmetric_channels: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) */ /* Do not create a PCM for this DAI link (Backend link) */
unsigned int no_pcm:1; unsigned int no_pcm:1;
......
...@@ -373,7 +373,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -373,7 +373,7 @@ static int rockchip_i2s_hw_params(struct snd_pcm_substream *substream,
I2S_DMACR_RDL(16)); I2S_DMACR_RDL(16));
val = I2S_CKR_TRCM_TXRX; 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; val = I2S_CKR_TRCM_TXONLY;
regmap_update_bits(i2s->regmap, I2S_CKR, regmap_update_bits(i2s->regmap, I2S_CKR,
......
...@@ -2509,6 +2509,15 @@ int snd_soc_register_component(struct device *dev, ...@@ -2509,6 +2509,15 @@ int snd_soc_register_component(struct device *dev,
{ {
struct snd_soc_component *component; struct snd_soc_component *component;
int ret; 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); component = devm_kzalloc(dev, sizeof(*component), GFP_KERNEL);
if (!component) if (!component)
......
...@@ -349,8 +349,8 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream, ...@@ -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); struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
int ret; int ret;
if (soc_dai->rate && (soc_dai->driver->symmetric_rates || if (soc_dai->rate && (soc_dai->driver->symmetric_rate ||
rtd->dai_link->symmetric_rates)) { rtd->dai_link->symmetric_rate)) {
dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %dHz rate\n", dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %dHz rate\n",
soc_dai->rate); soc_dai->rate);
...@@ -381,8 +381,8 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream, ...@@ -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 || if (soc_dai->sample_bits && (soc_dai->driver->symmetric_sample_bits ||
rtd->dai_link->symmetric_samplebits)) { rtd->dai_link->symmetric_sample_bits)) {
dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %d sample bits\n", dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %d sample bits\n",
soc_dai->sample_bits); soc_dai->sample_bits);
...@@ -412,10 +412,10 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream, ...@@ -412,10 +412,10 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
soc_pcm_set_dai_params(&d, params); soc_pcm_set_dai_params(&d, params);
/* reject unmatched parameters when applying symmetry */ /* 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) for_each_rtd_cpu_dais(rtd, i, dai)
symmetry |= dai->driver->symmetric_rates; symmetry |= dai->driver->symmetric_rate;
if (symmetry) { if (symmetry) {
for_each_rtd_cpu_dais(rtd, i, cpu_dai) { for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
...@@ -443,10 +443,10 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream, ...@@ -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) for_each_rtd_dais(rtd, i, dai)
symmetry |= dai->driver->symmetric_samplebits; symmetry |= dai->driver->symmetric_sample_bits;
if (symmetry) { if (symmetry) {
for_each_rtd_cpu_dais(rtd, i, cpu_dai) { for_each_rtd_cpu_dais(rtd, i, cpu_dai) {
...@@ -469,15 +469,15 @@ static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream) ...@@ -469,15 +469,15 @@ static bool soc_pcm_has_symmetry(struct snd_pcm_substream *substream)
struct snd_soc_dai *dai; struct snd_soc_dai *dai;
unsigned int symmetry, i; unsigned int symmetry, i;
symmetry = link->symmetric_rates || symmetry = link->symmetric_rate ||
link->symmetric_channels || link->symmetric_channels ||
link->symmetric_samplebits; link->symmetric_sample_bits;
for_each_rtd_dais(rtd, i, dai) for_each_rtd_dais(rtd, i, dai)
symmetry = symmetry || symmetry = symmetry ||
dai->driver->symmetric_rates || dai->driver->symmetric_rate ||
dai->driver->symmetric_channels || dai->driver->symmetric_channels ||
dai->driver->symmetric_samplebits; dai->driver->symmetric_sample_bits;
return symmetry; return symmetry;
} }
......
...@@ -1672,7 +1672,7 @@ static void set_dai_flags(struct snd_soc_dai_driver *dai_drv, ...@@ -1672,7 +1672,7 @@ static void set_dai_flags(struct snd_soc_dai_driver *dai_drv,
unsigned int flag_mask, unsigned int flags) unsigned int flag_mask, unsigned int flags)
{ {
if (flag_mask & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES) 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; flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_RATES ? 1 : 0;
if (flag_mask & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_CHANNELS) 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, ...@@ -1681,7 +1681,7 @@ static void set_dai_flags(struct snd_soc_dai_driver *dai_drv,
1 : 0; 1 : 0;
if (flag_mask & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS) 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 ? flags & SND_SOC_TPLG_DAI_FLGBIT_SYMMETRIC_SAMPLEBITS ?
1 : 0; 1 : 0;
} }
...@@ -1763,7 +1763,7 @@ static void set_link_flags(struct snd_soc_dai_link *link, ...@@ -1763,7 +1763,7 @@ static void set_link_flags(struct snd_soc_dai_link *link,
unsigned int flag_mask, unsigned int flags) unsigned int flag_mask, unsigned int flags)
{ {
if (flag_mask & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES) 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; flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_RATES ? 1 : 0;
if (flag_mask & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_CHANNELS) 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, ...@@ -1772,7 +1772,7 @@ static void set_link_flags(struct snd_soc_dai_link *link,
1 : 0; 1 : 0;
if (flag_mask & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS) 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 ? flags & SND_SOC_TPLG_LNK_FLGBIT_SYMMETRIC_SAMPLEBITS ?
1 : 0; 1 : 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment