mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 12:52:29 -04:00
ASoC: use .auto_selectable_formats
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> says: This is v3 of "ASoC: use .auto_selectable_formats", but separated into small blocks. It is Step1, and it will be Step4 in total. x: this patch-set [x] Step1: ASoC: a to b [ ] Step2: ASoC: codec: ... [ ] Step3: ASoC: d to r [ ] Step4: ASoC: r to x Current ASoC supports snd_soc_daifmt_parse_format() which can specify DAI format by "dai-format" property from DT. But strictly speaking, it is SW settings, so doesn't match to DT's policy. Current ASoC is supporting auto format select via snd_soc_dai_ops :: .auto_selectable_formats. But the user is very few today. DT doesn't need to specify the DAI format via "dai-format", if both CPU and Codec drivers were supporting .auto_selectable_formats. It will be automatically selected from .auto_selectable_formats. One note is that auto select might not find best format on some CPU/Codec combination. So "dai-format" is necessary anyway. Link: https://lore.kernel.org/r/8733zfj5jj.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/87pl0r20qo.wl-kuninori.morimoto.gx@renesas.com Link: https://patch.msgid.link/87zezljgxy.wl-kuninori.morimoto.gx@renesas.com
This commit is contained in:
@@ -739,6 +739,19 @@ static int mca_fe_hw_params(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const u64 mca_fe_selectable_formats[] =
|
||||
{
|
||||
/* pattern 1 */
|
||||
SND_SOC_POSSIBLE_DAIFMT_I2S |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_IF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_IB_IF,
|
||||
|
||||
/* pattern 2 */
|
||||
SND_SOC_POSSIBLE_DAIFMT_LEFT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_NF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_IB_NF
|
||||
};
|
||||
|
||||
static const struct snd_soc_dai_ops mca_fe_ops = {
|
||||
.startup = mca_fe_startup,
|
||||
.set_fmt = mca_fe_set_fmt,
|
||||
@@ -748,6 +761,8 @@ static const struct snd_soc_dai_ops mca_fe_ops = {
|
||||
.trigger = mca_fe_trigger,
|
||||
.prepare = mca_fe_prepare,
|
||||
.hw_free = mca_fe_hw_free,
|
||||
.auto_selectable_formats = mca_fe_selectable_formats,
|
||||
.num_auto_selectable_formats = ARRAY_SIZE(mca_fe_selectable_formats),
|
||||
};
|
||||
|
||||
/*
|
||||
|
||||
@@ -540,12 +540,16 @@ static int atmel_i2s_dai_probe(struct snd_soc_dai *dai)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const u64 atmel_i2s_selectable_formats = SND_SOC_POSSIBLE_DAIFMT_I2S;
|
||||
|
||||
static const struct snd_soc_dai_ops atmel_i2s_dai_ops = {
|
||||
.probe = atmel_i2s_dai_probe,
|
||||
.prepare = atmel_i2s_prepare,
|
||||
.trigger = atmel_i2s_trigger,
|
||||
.hw_params = atmel_i2s_hw_params,
|
||||
.set_fmt = atmel_i2s_set_dai_fmt,
|
||||
.auto_selectable_formats = &atmel_i2s_selectable_formats,
|
||||
.num_auto_selectable_formats = 1,
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_driver atmel_i2s_dai = {
|
||||
|
||||
@@ -825,6 +825,11 @@ static int atmel_ssc_resume(struct snd_soc_component *component)
|
||||
#define ATMEL_SSC_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |\
|
||||
SNDRV_PCM_FMTBIT_S32_LE)
|
||||
|
||||
static const u64 atmel_ssc_selectable_formats =
|
||||
SND_SOC_POSSIBLE_DAIFMT_I2S |
|
||||
SND_SOC_POSSIBLE_DAIFMT_LEFT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_DSP_A;
|
||||
|
||||
static const struct snd_soc_dai_ops atmel_ssc_dai_ops = {
|
||||
.startup = atmel_ssc_startup,
|
||||
.shutdown = atmel_ssc_shutdown,
|
||||
@@ -833,6 +838,8 @@ static const struct snd_soc_dai_ops atmel_ssc_dai_ops = {
|
||||
.hw_params = atmel_ssc_hw_params,
|
||||
.set_fmt = atmel_ssc_set_dai_fmt,
|
||||
.set_clkdiv = atmel_ssc_set_dai_clkdiv,
|
||||
.auto_selectable_formats = &atmel_ssc_selectable_formats,
|
||||
.num_auto_selectable_formats = 1,
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_driver atmel_ssc_dai = {
|
||||
|
||||
@@ -912,6 +912,13 @@ static int mchp_i2s_mcc_dai_probe(struct snd_soc_dai *dai)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const u64 mchp_i2s_selectable_formats =
|
||||
SND_SOC_POSSIBLE_DAIFMT_I2S |
|
||||
SND_SOC_POSSIBLE_DAIFMT_LEFT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_DSP_A |
|
||||
SND_SOC_POSSIBLE_DAIFMT_GATED |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_NF;
|
||||
|
||||
static const struct snd_soc_dai_ops mchp_i2s_mcc_dai_ops = {
|
||||
.probe = mchp_i2s_mcc_dai_probe,
|
||||
.set_sysclk = mchp_i2s_mcc_set_sysclk,
|
||||
@@ -922,6 +929,8 @@ static const struct snd_soc_dai_ops mchp_i2s_mcc_dai_ops = {
|
||||
.hw_free = mchp_i2s_mcc_hw_free,
|
||||
.set_fmt = mchp_i2s_mcc_set_dai_fmt,
|
||||
.set_tdm_slot = mchp_i2s_mcc_set_dai_tdm_slot,
|
||||
.auto_selectable_formats = &mchp_i2s_selectable_formats,
|
||||
.num_auto_selectable_formats = 1,
|
||||
};
|
||||
|
||||
#define MCHP_I2SMCC_RATES SNDRV_PCM_RATE_8000_192000
|
||||
|
||||
@@ -741,6 +741,8 @@ static int mchp_pdmc_pcm_new(struct snd_soc_pcm_runtime *rtd,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const u64 mchp_selectable_formats = SND_SOC_POSSIBLE_DAIFMT_PDM;
|
||||
|
||||
static const struct snd_soc_dai_ops mchp_pdmc_dai_ops = {
|
||||
.probe = mchp_pdmc_dai_probe,
|
||||
.set_fmt = mchp_pdmc_set_fmt,
|
||||
@@ -748,6 +750,8 @@ static const struct snd_soc_dai_ops mchp_pdmc_dai_ops = {
|
||||
.hw_params = mchp_pdmc_hw_params,
|
||||
.trigger = mchp_pdmc_trigger,
|
||||
.pcm_new = &mchp_pdmc_pcm_new,
|
||||
.auto_selectable_formats = &mchp_selectable_formats,
|
||||
.num_auto_selectable_formats = 1,
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_driver mchp_pdmc_dai = {
|
||||
|
||||
@@ -202,11 +202,22 @@ static int au1xi2s_startup(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const u64 au1xi2s_selectable_formats =
|
||||
SND_SOC_POSSIBLE_DAIFMT_I2S |
|
||||
SND_SOC_POSSIBLE_DAIFMT_RIGHT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_LEFT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_NF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_IF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_IB_NF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_IB_IF;
|
||||
|
||||
static const struct snd_soc_dai_ops au1xi2s_dai_ops = {
|
||||
.startup = au1xi2s_startup,
|
||||
.trigger = au1xi2s_trigger,
|
||||
.hw_params = au1xi2s_hw_params,
|
||||
.set_fmt = au1xi2s_set_fmt,
|
||||
.auto_selectable_formats = &au1xi2s_selectable_formats,
|
||||
.num_auto_selectable_formats = 1,
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_driver au1xi2s_dai_driver = {
|
||||
|
||||
@@ -262,11 +262,22 @@ static int au1xpsc_i2s_startup(struct snd_pcm_substream *substream,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const u64 au1xpsc_selectable_formats =
|
||||
SND_SOC_POSSIBLE_DAIFMT_I2S |
|
||||
SND_SOC_POSSIBLE_DAIFMT_RIGHT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_LEFT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_NF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_IF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_IB_NF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_IB_IF;
|
||||
|
||||
static const struct snd_soc_dai_ops au1xpsc_i2s_dai_ops = {
|
||||
.startup = au1xpsc_i2s_startup,
|
||||
.trigger = au1xpsc_i2s_trigger,
|
||||
.hw_params = au1xpsc_i2s_hw_params,
|
||||
.set_fmt = au1xpsc_i2s_set_fmt,
|
||||
.auto_selectable_formats = &au1xpsc_selectable_formats,
|
||||
.num_auto_selectable_formats = 1,
|
||||
};
|
||||
|
||||
static const struct snd_soc_dai_driver au1xpsc_i2s_dai_template = {
|
||||
|
||||
@@ -748,6 +748,17 @@ static int bcm2835_i2s_dai_probe(struct snd_soc_dai *dai)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const u64 bcm2835_selectable_formats =
|
||||
SND_SOC_POSSIBLE_DAIFMT_I2S |
|
||||
SND_SOC_POSSIBLE_DAIFMT_RIGHT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_LEFT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_DSP_A |
|
||||
SND_SOC_POSSIBLE_DAIFMT_DSP_B |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_NF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_IF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_IB_NF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_IB_IF;
|
||||
|
||||
static const struct snd_soc_dai_ops bcm2835_i2s_dai_ops = {
|
||||
.probe = bcm2835_i2s_dai_probe,
|
||||
.startup = bcm2835_i2s_startup,
|
||||
@@ -758,6 +769,8 @@ static const struct snd_soc_dai_ops bcm2835_i2s_dai_ops = {
|
||||
.set_fmt = bcm2835_i2s_set_dai_fmt,
|
||||
.set_bclk_ratio = bcm2835_i2s_set_dai_bclk_ratio,
|
||||
.set_tdm_slot = bcm2835_i2s_set_dai_tdm_slot,
|
||||
.auto_selectable_formats = &bcm2835_selectable_formats,
|
||||
.num_auto_selectable_formats = 1,
|
||||
};
|
||||
|
||||
static struct snd_soc_dai_driver bcm2835_i2s_dai = {
|
||||
|
||||
@@ -1133,6 +1133,11 @@ static int cygnus_ssp_resume(struct snd_soc_component *component)
|
||||
#define cygnus_ssp_resume NULL
|
||||
#endif
|
||||
|
||||
static const u64 cygnus_selectable_formats =
|
||||
SND_SOC_POSSIBLE_DAIFMT_I2S |
|
||||
SND_SOC_POSSIBLE_DAIFMT_DSP_A |
|
||||
SND_SOC_POSSIBLE_DAIFMT_DSP_B;
|
||||
|
||||
static const struct snd_soc_dai_ops cygnus_ssp_dai_ops = {
|
||||
.startup = cygnus_ssp_startup,
|
||||
.shutdown = cygnus_ssp_shutdown,
|
||||
@@ -1141,6 +1146,8 @@ static const struct snd_soc_dai_ops cygnus_ssp_dai_ops = {
|
||||
.set_fmt = cygnus_ssp_set_fmt,
|
||||
.set_sysclk = cygnus_ssp_set_sysclk,
|
||||
.set_tdm_slot = cygnus_set_dai_tdm_slot,
|
||||
.auto_selectable_formats = &cygnus_selectable_formats,
|
||||
.num_auto_selectable_formats = 1,
|
||||
};
|
||||
|
||||
static const struct snd_soc_dai_ops cygnus_spdif_dai_ops = {
|
||||
|
||||
@@ -401,6 +401,15 @@ static int ep93xx_i2s_resume(struct snd_soc_component *component)
|
||||
#define ep93xx_i2s_resume NULL
|
||||
#endif
|
||||
|
||||
static const u64 ep93xx_selectable_formats =
|
||||
SND_SOC_POSSIBLE_DAIFMT_I2S |
|
||||
SND_SOC_POSSIBLE_DAIFMT_RIGHT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_LEFT_J |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_NF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_NB_IF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_IB_NF |
|
||||
SND_SOC_POSSIBLE_DAIFMT_IB_IF;
|
||||
|
||||
static const struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
|
||||
.probe = ep93xx_i2s_dai_probe,
|
||||
.startup = ep93xx_i2s_startup,
|
||||
@@ -408,6 +417,8 @@ static const struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
|
||||
.hw_params = ep93xx_i2s_hw_params,
|
||||
.set_sysclk = ep93xx_i2s_set_sysclk,
|
||||
.set_fmt = ep93xx_i2s_set_dai_fmt,
|
||||
.auto_selectable_formats = &ep93xx_selectable_formats,
|
||||
.num_auto_selectable_formats = 1,
|
||||
};
|
||||
|
||||
#define EP93XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S32_LE)
|
||||
|
||||
Reference in New Issue
Block a user