ASoC: add symmetric_ prefix for dai->rate/channels/sample_bits

snd_soc_dai has rate/channels/sample_bits parameter, but it is only valid
if symmetry is being enforced by symmetric_xxx flag on driver.

It is very difficult to know about it from current naming, and easy to
misunderstand it. add symmetric_ prefix for it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://patch.msgid.link/87zfmd8bnf.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Kuninori Morimoto 2024-11-06 00:10:44 +00:00 committed by Mark Brown
parent 725570f963
commit 1bd775da9b
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
7 changed files with 26 additions and 25 deletions

View File

@ -449,9 +449,9 @@ struct snd_soc_dai {
struct snd_soc_dai_stream stream[SNDRV_PCM_STREAM_LAST + 1]; struct snd_soc_dai_stream stream[SNDRV_PCM_STREAM_LAST + 1];
/* Symmetry data - only valid if symmetry is being enforced */ /* Symmetry data - only valid if symmetry is being enforced */
unsigned int rate; unsigned int symmetric_rate;
unsigned int channels; unsigned int symmetric_channels;
unsigned int sample_bits; unsigned int symmetric_sample_bits;
/* parent platform/codec */ /* parent platform/codec */
struct snd_soc_component *component; struct snd_soc_component *component;

View File

@ -128,7 +128,7 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
unsigned int lrck_inv; unsigned int lrck_inv;
unsigned int bck_inv; unsigned int bck_inv;
unsigned int fmt; unsigned int fmt;
unsigned int bit_width = dai->sample_bits; unsigned int bit_width = dai->symmetric_sample_bits;
unsigned int val = 0; unsigned int val = 0;
unsigned int mask = 0; unsigned int mask = 0;
int fs = 0; int fs = 0;

View File

@ -127,7 +127,7 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
unsigned int lrck_inv; unsigned int lrck_inv;
unsigned int bck_inv; unsigned int bck_inv;
unsigned int fmt; unsigned int fmt;
unsigned int bit_width = dai->sample_bits; unsigned int bit_width = dai->symmetric_sample_bits;
unsigned int val = 0; unsigned int val = 0;
unsigned int mask = 0; unsigned int mask = 0;
int fs = 0; int fs = 0;

View File

@ -118,13 +118,13 @@ static int mt8365_dai_configure_dmic(struct mtk_base_afe *afe,
unsigned int clk_phase_sel_ch1 = dmic_data->clk_phase_sel_ch1; unsigned int clk_phase_sel_ch1 = dmic_data->clk_phase_sel_ch1;
unsigned int clk_phase_sel_ch2 = dmic_data->clk_phase_sel_ch2; unsigned int clk_phase_sel_ch2 = dmic_data->clk_phase_sel_ch2;
unsigned int val = 0; unsigned int val = 0;
unsigned int rate = dai->rate; unsigned int rate = dai->symmetric_rate;
int reg = get_chan_reg(dai->channels); int reg = get_chan_reg(dai->symmetric_channels);
if (reg < 0) if (reg < 0)
return -EINVAL; return -EINVAL;
dmic_data->dmic_channel = dai->channels; dmic_data->dmic_channel = dai->symmetric_channels;
val |= DMIC_TOP_CON_SDM3_LEVEL_MODE; val |= DMIC_TOP_CON_SDM3_LEVEL_MODE;

View File

@ -44,7 +44,7 @@ static int mt8365_dai_configure_pcm1(struct snd_pcm_substream *substream,
bool lrck_inv = pcm_priv->lrck_inv; bool lrck_inv = pcm_priv->lrck_inv;
bool bck_inv = pcm_priv->bck_inv; bool bck_inv = pcm_priv->bck_inv;
unsigned int fmt = pcm_priv->format; unsigned int fmt = pcm_priv->format;
unsigned int bit_width = dai->sample_bits; unsigned int bit_width = dai->symmetric_sample_bits;
unsigned int val = 0; unsigned int val = 0;
if (!slave_mode) { if (!slave_mode) {

View File

@ -69,10 +69,10 @@ static int soc_compr_clean(struct snd_compr_stream *cstream, int rollback)
snd_soc_dai_digital_mute(codec_dai, 1, stream); snd_soc_dai_digital_mute(codec_dai, 1, stream);
if (!snd_soc_dai_active(cpu_dai)) if (!snd_soc_dai_active(cpu_dai))
cpu_dai->rate = 0; cpu_dai->symmetric_rate = 0;
if (!snd_soc_dai_active(codec_dai)) if (!snd_soc_dai_active(codec_dai))
codec_dai->rate = 0; codec_dai->symmetric_rate = 0;
snd_soc_link_compr_shutdown(cstream, rollback); snd_soc_link_compr_shutdown(cstream, rollback);

View File

@ -447,13 +447,13 @@ static void soc_pcm_set_dai_params(struct snd_soc_dai *dai,
struct snd_pcm_hw_params *params) struct snd_pcm_hw_params *params)
{ {
if (params) { if (params) {
dai->rate = params_rate(params); dai->symmetric_rate = params_rate(params);
dai->channels = params_channels(params); dai->symmetric_channels = params_channels(params);
dai->sample_bits = snd_pcm_format_physical_width(params_format(params)); dai->symmetric_sample_bits = snd_pcm_format_physical_width(params_format(params));
} else { } else {
dai->rate = 0; dai->symmetric_rate = 0;
dai->channels = 0; dai->symmetric_channels = 0;
dai->sample_bits = 0; dai->symmetric_sample_bits = 0;
} }
} }
@ -467,14 +467,14 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
return 0; return 0;
#define __soc_pcm_apply_symmetry(name, NAME) \ #define __soc_pcm_apply_symmetry(name, NAME) \
if (soc_dai->name && (soc_dai->driver->symmetric_##name || \ if (soc_dai->symmetric_##name && \
rtd->dai_link->symmetric_##name)) { \ (soc_dai->driver->symmetric_##name || rtd->dai_link->symmetric_##name)) { \
dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %s to %d\n",\ dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %s to %d\n",\
#name, soc_dai->name); \ #name, soc_dai->symmetric_##name); \
\ \
ret = snd_pcm_hw_constraint_single(substream->runtime, \ ret = snd_pcm_hw_constraint_single(substream->runtime, \
SNDRV_PCM_HW_PARAM_##NAME,\ SNDRV_PCM_HW_PARAM_##NAME,\
soc_dai->name); \ soc_dai->symmetric_##name); \
if (ret < 0) { \ if (ret < 0) { \
dev_err(soc_dai->dev, \ dev_err(soc_dai->dev, \
"ASoC: Unable to apply %s constraint: %d\n",\ "ASoC: Unable to apply %s constraint: %d\n",\
@ -510,9 +510,11 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
if (symmetry) \ if (symmetry) \
for_each_rtd_cpu_dais(rtd, i, cpu_dai) \ for_each_rtd_cpu_dais(rtd, i, cpu_dai) \
if (!snd_soc_dai_is_dummy(cpu_dai) && \ if (!snd_soc_dai_is_dummy(cpu_dai) && \
cpu_dai->xxx && cpu_dai->xxx != d.xxx) { \ cpu_dai->symmetric_##xxx && \
cpu_dai->symmetric_##xxx != d.symmetric_##xxx) { \
dev_err(rtd->dev, "ASoC: unmatched %s symmetry: %s:%d - %s:%d\n", \ dev_err(rtd->dev, "ASoC: unmatched %s symmetry: %s:%d - %s:%d\n", \
#xxx, cpu_dai->name, cpu_dai->xxx, d.name, d.xxx); \ #xxx, cpu_dai->name, cpu_dai->symmetric_##xxx, \
d.name, d.symmetric_##xxx); \
return -EINVAL; \ return -EINVAL; \
} }
@ -783,8 +785,7 @@ static int soc_pcm_clean(struct snd_soc_pcm_runtime *rtd,
/* Make sure DAI parameters cleared if the DAI becomes inactive */ /* Make sure DAI parameters cleared if the DAI becomes inactive */
for_each_rtd_dais(rtd, i, dai) { for_each_rtd_dais(rtd, i, dai) {
if (snd_soc_dai_active(dai) == 0 && if (snd_soc_dai_active(dai) == 0)
(dai->rate || dai->channels || dai->sample_bits))
soc_pcm_set_dai_params(dai, NULL); soc_pcm_set_dai_params(dai, NULL);
} }
} }