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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87wnweolj6.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2021-01-15 13:52:54 +09:00 committed by Mark Brown
parent 80f454e283
commit f14654ddf2
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
6 changed files with 32 additions and 21 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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,

View File

@ -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)

View File

@ -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;
}

View File

@ -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;