mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2024-12-28 16:52:18 +00:00
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:
parent
725570f963
commit
1bd775da9b
@ -449,9 +449,9 @@ struct snd_soc_dai {
|
||||
struct snd_soc_dai_stream stream[SNDRV_PCM_STREAM_LAST + 1];
|
||||
|
||||
/* Symmetry data - only valid if symmetry is being enforced */
|
||||
unsigned int rate;
|
||||
unsigned int channels;
|
||||
unsigned int sample_bits;
|
||||
unsigned int symmetric_rate;
|
||||
unsigned int symmetric_channels;
|
||||
unsigned int symmetric_sample_bits;
|
||||
|
||||
/* parent platform/codec */
|
||||
struct snd_soc_component *component;
|
||||
|
@ -128,7 +128,7 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
|
||||
unsigned int lrck_inv;
|
||||
unsigned int bck_inv;
|
||||
unsigned int fmt;
|
||||
unsigned int bit_width = dai->sample_bits;
|
||||
unsigned int bit_width = dai->symmetric_sample_bits;
|
||||
unsigned int val = 0;
|
||||
unsigned int mask = 0;
|
||||
int fs = 0;
|
||||
|
@ -127,7 +127,7 @@ static int mtk_dai_pcm_configure(struct snd_pcm_substream *substream,
|
||||
unsigned int lrck_inv;
|
||||
unsigned int bck_inv;
|
||||
unsigned int fmt;
|
||||
unsigned int bit_width = dai->sample_bits;
|
||||
unsigned int bit_width = dai->symmetric_sample_bits;
|
||||
unsigned int val = 0;
|
||||
unsigned int mask = 0;
|
||||
int fs = 0;
|
||||
|
@ -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_ch2 = dmic_data->clk_phase_sel_ch2;
|
||||
unsigned int val = 0;
|
||||
unsigned int rate = dai->rate;
|
||||
int reg = get_chan_reg(dai->channels);
|
||||
unsigned int rate = dai->symmetric_rate;
|
||||
int reg = get_chan_reg(dai->symmetric_channels);
|
||||
|
||||
if (reg < 0)
|
||||
return -EINVAL;
|
||||
|
||||
dmic_data->dmic_channel = dai->channels;
|
||||
dmic_data->dmic_channel = dai->symmetric_channels;
|
||||
|
||||
val |= DMIC_TOP_CON_SDM3_LEVEL_MODE;
|
||||
|
||||
|
@ -44,7 +44,7 @@ static int mt8365_dai_configure_pcm1(struct snd_pcm_substream *substream,
|
||||
bool lrck_inv = pcm_priv->lrck_inv;
|
||||
bool bck_inv = pcm_priv->bck_inv;
|
||||
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;
|
||||
|
||||
if (!slave_mode) {
|
||||
|
@ -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);
|
||||
|
||||
if (!snd_soc_dai_active(cpu_dai))
|
||||
cpu_dai->rate = 0;
|
||||
cpu_dai->symmetric_rate = 0;
|
||||
|
||||
if (!snd_soc_dai_active(codec_dai))
|
||||
codec_dai->rate = 0;
|
||||
codec_dai->symmetric_rate = 0;
|
||||
|
||||
snd_soc_link_compr_shutdown(cstream, rollback);
|
||||
|
||||
|
@ -447,13 +447,13 @@ static void soc_pcm_set_dai_params(struct snd_soc_dai *dai,
|
||||
struct snd_pcm_hw_params *params)
|
||||
{
|
||||
if (params) {
|
||||
dai->rate = params_rate(params);
|
||||
dai->channels = params_channels(params);
|
||||
dai->sample_bits = snd_pcm_format_physical_width(params_format(params));
|
||||
dai->symmetric_rate = params_rate(params);
|
||||
dai->symmetric_channels = params_channels(params);
|
||||
dai->symmetric_sample_bits = snd_pcm_format_physical_width(params_format(params));
|
||||
} else {
|
||||
dai->rate = 0;
|
||||
dai->channels = 0;
|
||||
dai->sample_bits = 0;
|
||||
dai->symmetric_rate = 0;
|
||||
dai->symmetric_channels = 0;
|
||||
dai->symmetric_sample_bits = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -467,14 +467,14 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
|
||||
#define __soc_pcm_apply_symmetry(name, NAME) \
|
||||
if (soc_dai->name && (soc_dai->driver->symmetric_##name || \
|
||||
rtd->dai_link->symmetric_##name)) { \
|
||||
if (soc_dai->symmetric_##name && \
|
||||
(soc_dai->driver->symmetric_##name || rtd->dai_link->symmetric_##name)) { \
|
||||
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, \
|
||||
SNDRV_PCM_HW_PARAM_##NAME,\
|
||||
soc_dai->name); \
|
||||
soc_dai->symmetric_##name); \
|
||||
if (ret < 0) { \
|
||||
dev_err(soc_dai->dev, \
|
||||
"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) \
|
||||
for_each_rtd_cpu_dais(rtd, i, 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", \
|
||||
#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; \
|
||||
}
|
||||
|
||||
@ -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 */
|
||||
for_each_rtd_dais(rtd, i, dai) {
|
||||
if (snd_soc_dai_active(dai) == 0 &&
|
||||
(dai->rate || dai->channels || dai->sample_bits))
|
||||
if (snd_soc_dai_active(dai) == 0)
|
||||
soc_pcm_set_dai_params(dai, NULL);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user