Skip to content

Commit 1bd775d

Browse files
morimotobroonie
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent 725570f commit 1bd775d

File tree

7 files changed

+26
-25
lines changed

7 files changed

+26
-25
lines changed

include/sound/soc-dai.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,9 @@ struct snd_soc_dai {
449449
struct snd_soc_dai_stream stream[SNDRV_PCM_STREAM_LAST + 1];
450450

451451
/* Symmetry data - only valid if symmetry is being enforced */
452-
unsigned int rate;
453-
unsigned int channels;
454-
unsigned int sample_bits;
452+
unsigned int symmetric_rate;
453+
unsigned int symmetric_channels;
454+
unsigned int symmetric_sample_bits;
455455

456456
/* parent platform/codec */
457457
struct snd_soc_component *component;

sound/soc/mediatek/mt8188/mt8188-dai-pcm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
128128
unsigned int lrck_inv;
129129
unsigned int bck_inv;
130130
unsigned int fmt;
131-
unsigned int bit_width = dai->sample_bits;
131+
unsigned int bit_width = dai->symmetric_sample_bits;
132132
unsigned int val = 0;
133133
unsigned int mask = 0;
134134
int fs = 0;

sound/soc/mediatek/mt8195/mt8195-dai-pcm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
127127
unsigned int lrck_inv;
128128
unsigned int bck_inv;
129129
unsigned int fmt;
130-
unsigned int bit_width = dai->sample_bits;
130+
unsigned int bit_width = dai->symmetric_sample_bits;
131131
unsigned int val = 0;
132132
unsigned int mask = 0;
133133
int fs = 0;

sound/soc/mediatek/mt8365/mt8365-dai-dmic.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ static int mt8365_dai_configure_dmic(struct mtk_base_afe *afe,
118118
unsigned int clk_phase_sel_ch1 = dmic_data->clk_phase_sel_ch1;
119119
unsigned int clk_phase_sel_ch2 = dmic_data->clk_phase_sel_ch2;
120120
unsigned int val = 0;
121-
unsigned int rate = dai->rate;
122-
int reg = get_chan_reg(dai->channels);
121+
unsigned int rate = dai->symmetric_rate;
122+
int reg = get_chan_reg(dai->symmetric_channels);
123123

124124
if (reg < 0)
125125
return -EINVAL;
126126

127-
dmic_data->dmic_channel = dai->channels;
127+
dmic_data->dmic_channel = dai->symmetric_channels;
128128

129129
val |= DMIC_TOP_CON_SDM3_LEVEL_MODE;
130130

sound/soc/mediatek/mt8365/mt8365-dai-pcm.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static int mt8365_dai_configure_pcm1(struct snd_pcm_substream *substream,
4444
bool lrck_inv = pcm_priv->lrck_inv;
4545
bool bck_inv = pcm_priv->bck_inv;
4646
unsigned int fmt = pcm_priv->format;
47-
unsigned int bit_width = dai->sample_bits;
47+
unsigned int bit_width = dai->symmetric_sample_bits;
4848
unsigned int val = 0;
4949

5050
if (!slave_mode) {

sound/soc/soc-compress.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ static int soc_compr_clean(struct snd_compr_stream *cstream, int rollback)
6969
snd_soc_dai_digital_mute(codec_dai, 1, stream);
7070

7171
if (!snd_soc_dai_active(cpu_dai))
72-
cpu_dai->rate = 0;
72+
cpu_dai->symmetric_rate = 0;
7373

7474
if (!snd_soc_dai_active(codec_dai))
75-
codec_dai->rate = 0;
75+
codec_dai->symmetric_rate = 0;
7676

7777
snd_soc_link_compr_shutdown(cstream, rollback);
7878

sound/soc/soc-pcm.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -447,13 +447,13 @@ static void soc_pcm_set_dai_params(struct snd_soc_dai *dai,
447447
struct snd_pcm_hw_params *params)
448448
{
449449
if (params) {
450-
dai->rate = params_rate(params);
451-
dai->channels = params_channels(params);
452-
dai->sample_bits = snd_pcm_format_physical_width(params_format(params));
450+
dai->symmetric_rate = params_rate(params);
451+
dai->symmetric_channels = params_channels(params);
452+
dai->symmetric_sample_bits = snd_pcm_format_physical_width(params_format(params));
453453
} else {
454-
dai->rate = 0;
455-
dai->channels = 0;
456-
dai->sample_bits = 0;
454+
dai->symmetric_rate = 0;
455+
dai->symmetric_channels = 0;
456+
dai->symmetric_sample_bits = 0;
457457
}
458458
}
459459

@@ -467,14 +467,14 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
467467
return 0;
468468

469469
#define __soc_pcm_apply_symmetry(name, NAME) \
470-
if (soc_dai->name && (soc_dai->driver->symmetric_##name || \
471-
rtd->dai_link->symmetric_##name)) { \
470+
if (soc_dai->symmetric_##name && \
471+
(soc_dai->driver->symmetric_##name || rtd->dai_link->symmetric_##name)) { \
472472
dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %s to %d\n",\
473-
#name, soc_dai->name); \
473+
#name, soc_dai->symmetric_##name); \
474474
\
475475
ret = snd_pcm_hw_constraint_single(substream->runtime, \
476476
SNDRV_PCM_HW_PARAM_##NAME,\
477-
soc_dai->name); \
477+
soc_dai->symmetric_##name); \
478478
if (ret < 0) { \
479479
dev_err(soc_dai->dev, \
480480
"ASoC: Unable to apply %s constraint: %d\n",\
@@ -510,9 +510,11 @@ static int soc_pcm_params_symmetry(struct snd_pcm_substream *substream,
510510
if (symmetry) \
511511
for_each_rtd_cpu_dais(rtd, i, cpu_dai) \
512512
if (!snd_soc_dai_is_dummy(cpu_dai) && \
513-
cpu_dai->xxx && cpu_dai->xxx != d.xxx) { \
513+
cpu_dai->symmetric_##xxx && \
514+
cpu_dai->symmetric_##xxx != d.symmetric_##xxx) { \
514515
dev_err(rtd->dev, "ASoC: unmatched %s symmetry: %s:%d - %s:%d\n", \
515-
#xxx, cpu_dai->name, cpu_dai->xxx, d.name, d.xxx); \
516+
#xxx, cpu_dai->name, cpu_dai->symmetric_##xxx, \
517+
d.name, d.symmetric_##xxx); \
516518
return -EINVAL; \
517519
}
518520

@@ -783,8 +785,7 @@ static int soc_pcm_clean(struct snd_soc_pcm_runtime *rtd,
783785

784786
/* Make sure DAI parameters cleared if the DAI becomes inactive */
785787
for_each_rtd_dais(rtd, i, dai) {
786-
if (snd_soc_dai_active(dai) == 0 &&
787-
(dai->rate || dai->channels || dai->sample_bits))
788+
if (snd_soc_dai_active(dai) == 0)
788789
soc_pcm_set_dai_params(dai, NULL);
789790
}
790791
}

0 commit comments

Comments
 (0)