mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
ASoC: fsl: Update to use set_fmt_new callback
As part of updating the core to directly tell drivers if they are clock provider or consumer update these CPU side drivers to use the new direct callback. Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> Link: https://lore.kernel.org/r/20220519154318.2153729-9-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
ca0444f1f7
commit
3b14c15a33
@ -259,8 +259,8 @@ static int fsl_audmix_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
|||||||
|
|
||||||
/* For playback the AUDMIX is consumer, and for record is provider */
|
/* For playback the AUDMIX is consumer, and for record is provider */
|
||||||
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
||||||
case SND_SOC_DAIFMT_CBP_CFP:
|
case SND_SOC_DAIFMT_BC_FC:
|
||||||
case SND_SOC_DAIFMT_CBC_CFC:
|
case SND_SOC_DAIFMT_BP_FP:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -317,7 +317,7 @@ static int fsl_audmix_dai_trigger(struct snd_pcm_substream *substream, int cmd,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct snd_soc_dai_ops fsl_audmix_dai_ops = {
|
static const struct snd_soc_dai_ops fsl_audmix_dai_ops = {
|
||||||
.set_fmt = fsl_audmix_dai_set_fmt,
|
.set_fmt_new = fsl_audmix_dai_set_fmt,
|
||||||
.trigger = fsl_audmix_dai_trigger,
|
.trigger = fsl_audmix_dai_trigger,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -480,16 +480,16 @@ static int fsl_esai_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
|||||||
|
|
||||||
/* DAI clock provider masks */
|
/* DAI clock provider masks */
|
||||||
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
||||||
case SND_SOC_DAIFMT_CBP_CFP:
|
case SND_SOC_DAIFMT_BC_FC:
|
||||||
esai_priv->consumer_mode = true;
|
esai_priv->consumer_mode = true;
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAIFMT_CBC_CFP:
|
case SND_SOC_DAIFMT_BP_FC:
|
||||||
xccr |= ESAI_xCCR_xCKD;
|
xccr |= ESAI_xCCR_xCKD;
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAIFMT_CBP_CFC:
|
case SND_SOC_DAIFMT_BC_FP:
|
||||||
xccr |= ESAI_xCCR_xFSD;
|
xccr |= ESAI_xCCR_xFSD;
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAIFMT_CBC_CFC:
|
case SND_SOC_DAIFMT_BP_FP:
|
||||||
xccr |= ESAI_xCCR_xFSD | ESAI_xCCR_xCKD;
|
xccr |= ESAI_xCCR_xFSD | ESAI_xCCR_xCKD;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -790,7 +790,7 @@ static const struct snd_soc_dai_ops fsl_esai_dai_ops = {
|
|||||||
.trigger = fsl_esai_trigger,
|
.trigger = fsl_esai_trigger,
|
||||||
.hw_params = fsl_esai_hw_params,
|
.hw_params = fsl_esai_hw_params,
|
||||||
.set_sysclk = fsl_esai_set_dai_sysclk,
|
.set_sysclk = fsl_esai_set_dai_sysclk,
|
||||||
.set_fmt = fsl_esai_set_dai_fmt,
|
.set_fmt_new = fsl_esai_set_dai_fmt,
|
||||||
.set_tdm_slot = fsl_esai_set_dai_tdm_slot,
|
.set_tdm_slot = fsl_esai_set_dai_tdm_slot,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ static int fsl_mqs_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
||||||
case SND_SOC_DAIFMT_CBC_CFC:
|
case SND_SOC_DAIFMT_BP_FP:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
@ -152,7 +152,7 @@ static const struct snd_soc_dai_ops fsl_mqs_dai_ops = {
|
|||||||
.startup = fsl_mqs_startup,
|
.startup = fsl_mqs_startup,
|
||||||
.shutdown = fsl_mqs_shutdown,
|
.shutdown = fsl_mqs_shutdown,
|
||||||
.hw_params = fsl_mqs_hw_params,
|
.hw_params = fsl_mqs_hw_params,
|
||||||
.set_fmt = fsl_mqs_set_dai_fmt,
|
.set_fmt_new = fsl_mqs_set_dai_fmt,
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct snd_soc_dai_driver fsl_mqs_dai = {
|
static struct snd_soc_dai_driver fsl_mqs_dai = {
|
||||||
|
@ -292,19 +292,19 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
|
|||||||
|
|
||||||
/* DAI clock provider masks */
|
/* DAI clock provider masks */
|
||||||
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
||||||
case SND_SOC_DAIFMT_CBC_CFC:
|
case SND_SOC_DAIFMT_BP_FP:
|
||||||
val_cr2 |= FSL_SAI_CR2_BCD_MSTR;
|
val_cr2 |= FSL_SAI_CR2_BCD_MSTR;
|
||||||
val_cr4 |= FSL_SAI_CR4_FSD_MSTR;
|
val_cr4 |= FSL_SAI_CR4_FSD_MSTR;
|
||||||
sai->is_consumer_mode = false;
|
sai->is_consumer_mode = false;
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAIFMT_CBP_CFP:
|
case SND_SOC_DAIFMT_BC_FC:
|
||||||
sai->is_consumer_mode = true;
|
sai->is_consumer_mode = true;
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAIFMT_CBC_CFP:
|
case SND_SOC_DAIFMT_BP_FC:
|
||||||
val_cr2 |= FSL_SAI_CR2_BCD_MSTR;
|
val_cr2 |= FSL_SAI_CR2_BCD_MSTR;
|
||||||
sai->is_consumer_mode = false;
|
sai->is_consumer_mode = false;
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAIFMT_CBP_CFC:
|
case SND_SOC_DAIFMT_BC_FP:
|
||||||
val_cr4 |= FSL_SAI_CR4_FSD_MSTR;
|
val_cr4 |= FSL_SAI_CR4_FSD_MSTR;
|
||||||
sai->is_consumer_mode = true;
|
sai->is_consumer_mode = true;
|
||||||
break;
|
break;
|
||||||
@ -704,7 +704,7 @@ static int fsl_sai_startup(struct snd_pcm_substream *substream,
|
|||||||
static const struct snd_soc_dai_ops fsl_sai_pcm_dai_ops = {
|
static const struct snd_soc_dai_ops fsl_sai_pcm_dai_ops = {
|
||||||
.set_bclk_ratio = fsl_sai_set_dai_bclk_ratio,
|
.set_bclk_ratio = fsl_sai_set_dai_bclk_ratio,
|
||||||
.set_sysclk = fsl_sai_set_dai_sysclk,
|
.set_sysclk = fsl_sai_set_dai_sysclk,
|
||||||
.set_fmt = fsl_sai_set_dai_fmt,
|
.set_fmt_new = fsl_sai_set_dai_fmt,
|
||||||
.set_tdm_slot = fsl_sai_set_dai_tdm_slot,
|
.set_tdm_slot = fsl_sai_set_dai_tdm_slot,
|
||||||
.hw_params = fsl_sai_hw_params,
|
.hw_params = fsl_sai_hw_params,
|
||||||
.hw_free = fsl_sai_hw_free,
|
.hw_free = fsl_sai_hw_free,
|
||||||
|
@ -93,7 +93,7 @@
|
|||||||
*/
|
*/
|
||||||
#define FSLSSI_AC97_DAIFMT \
|
#define FSLSSI_AC97_DAIFMT \
|
||||||
(SND_SOC_DAIFMT_AC97 | \
|
(SND_SOC_DAIFMT_AC97 | \
|
||||||
SND_SOC_DAIFMT_CBM_CFS | \
|
SND_SOC_DAIFMT_BC_FP | \
|
||||||
SND_SOC_DAIFMT_NB_NF)
|
SND_SOC_DAIFMT_NB_NF)
|
||||||
|
|
||||||
#define FSLSSI_SIER_DBG_RX_FLAGS \
|
#define FSLSSI_SIER_DBG_RX_FLAGS \
|
||||||
@ -358,13 +358,13 @@ static bool fsl_ssi_is_ac97(struct fsl_ssi *ssi)
|
|||||||
static bool fsl_ssi_is_i2s_clock_provider(struct fsl_ssi *ssi)
|
static bool fsl_ssi_is_i2s_clock_provider(struct fsl_ssi *ssi)
|
||||||
{
|
{
|
||||||
return (ssi->dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) ==
|
return (ssi->dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) ==
|
||||||
SND_SOC_DAIFMT_CBC_CFC;
|
SND_SOC_DAIFMT_BP_FP;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool fsl_ssi_is_i2s_cbp_cfc(struct fsl_ssi *ssi)
|
static bool fsl_ssi_is_i2s_bc_fp(struct fsl_ssi *ssi)
|
||||||
{
|
{
|
||||||
return (ssi->dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) ==
|
return (ssi->dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) ==
|
||||||
SND_SOC_DAIFMT_CBP_CFC;
|
SND_SOC_DAIFMT_BC_FP;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -847,7 +847,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
|
|||||||
u8 i2s_net = ssi->i2s_net;
|
u8 i2s_net = ssi->i2s_net;
|
||||||
|
|
||||||
/* Normal + Network mode to send 16-bit data in 32-bit frames */
|
/* Normal + Network mode to send 16-bit data in 32-bit frames */
|
||||||
if (fsl_ssi_is_i2s_cbp_cfc(ssi) && sample_size == 16)
|
if (fsl_ssi_is_i2s_bc_fp(ssi) && sample_size == 16)
|
||||||
i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET;
|
i2s_net = SSI_SCR_I2S_MODE_NORMAL | SSI_SCR_NET;
|
||||||
|
|
||||||
/* Use Normal mode to send mono data at 1st slot of 2 slots */
|
/* Use Normal mode to send mono data at 1st slot of 2 slots */
|
||||||
@ -920,17 +920,17 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt)
|
|||||||
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
|
||||||
case SND_SOC_DAIFMT_I2S:
|
case SND_SOC_DAIFMT_I2S:
|
||||||
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
||||||
case SND_SOC_DAIFMT_CBC_CFC:
|
case SND_SOC_DAIFMT_BP_FP:
|
||||||
if (IS_ERR(ssi->baudclk)) {
|
if (IS_ERR(ssi->baudclk)) {
|
||||||
dev_err(ssi->dev,
|
dev_err(ssi->dev,
|
||||||
"missing baudclk for master mode\n");
|
"missing baudclk for master mode\n");
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
fallthrough;
|
fallthrough;
|
||||||
case SND_SOC_DAIFMT_CBP_CFC:
|
case SND_SOC_DAIFMT_BC_FP:
|
||||||
ssi->i2s_net |= SSI_SCR_I2S_MODE_MASTER;
|
ssi->i2s_net |= SSI_SCR_I2S_MODE_MASTER;
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAIFMT_CBP_CFP:
|
case SND_SOC_DAIFMT_BC_FC:
|
||||||
ssi->i2s_net |= SSI_SCR_I2S_MODE_SLAVE;
|
ssi->i2s_net |= SSI_SCR_I2S_MODE_SLAVE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -992,15 +992,15 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt)
|
|||||||
|
|
||||||
/* DAI clock provider masks */
|
/* DAI clock provider masks */
|
||||||
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
|
||||||
case SND_SOC_DAIFMT_CBC_CFC:
|
case SND_SOC_DAIFMT_BP_FP:
|
||||||
/* Output bit and frame sync clocks */
|
/* Output bit and frame sync clocks */
|
||||||
strcr |= SSI_STCR_TFDIR | SSI_STCR_TXDIR;
|
strcr |= SSI_STCR_TFDIR | SSI_STCR_TXDIR;
|
||||||
scr |= SSI_SCR_SYS_CLK_EN;
|
scr |= SSI_SCR_SYS_CLK_EN;
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAIFMT_CBP_CFP:
|
case SND_SOC_DAIFMT_BC_FC:
|
||||||
/* Input bit or frame sync clocks */
|
/* Input bit or frame sync clocks */
|
||||||
break;
|
break;
|
||||||
case SND_SOC_DAIFMT_CBP_CFC:
|
case SND_SOC_DAIFMT_BC_FP:
|
||||||
/* Input bit clock but output frame sync clock */
|
/* Input bit clock but output frame sync clock */
|
||||||
strcr |= SSI_STCR_TFDIR;
|
strcr |= SSI_STCR_TFDIR;
|
||||||
break;
|
break;
|
||||||
@ -1156,7 +1156,7 @@ static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
|
|||||||
.shutdown = fsl_ssi_shutdown,
|
.shutdown = fsl_ssi_shutdown,
|
||||||
.hw_params = fsl_ssi_hw_params,
|
.hw_params = fsl_ssi_hw_params,
|
||||||
.hw_free = fsl_ssi_hw_free,
|
.hw_free = fsl_ssi_hw_free,
|
||||||
.set_fmt = fsl_ssi_set_dai_fmt,
|
.set_fmt_new = fsl_ssi_set_dai_fmt,
|
||||||
.set_tdm_slot = fsl_ssi_set_dai_tdm_slot,
|
.set_tdm_slot = fsl_ssi_set_dai_tdm_slot,
|
||||||
.trigger = fsl_ssi_trigger,
|
.trigger = fsl_ssi_trigger,
|
||||||
};
|
};
|
||||||
|
@ -81,7 +81,7 @@ static int imx_audmix_fe_hw_params(struct snd_pcm_substream *substream,
|
|||||||
int ret, dir;
|
int ret, dir;
|
||||||
|
|
||||||
/* For playback the AUDMIX is consumer, and for record is provider */
|
/* For playback the AUDMIX is consumer, and for record is provider */
|
||||||
fmt |= tx ? SND_SOC_DAIFMT_CBC_CFC : SND_SOC_DAIFMT_CBP_CFP;
|
fmt |= tx ? SND_SOC_DAIFMT_BP_FP : SND_SOC_DAIFMT_BC_FC;
|
||||||
dir = tx ? SND_SOC_CLOCK_OUT : SND_SOC_CLOCK_IN;
|
dir = tx ? SND_SOC_CLOCK_OUT : SND_SOC_CLOCK_IN;
|
||||||
|
|
||||||
/* set DAI configuration */
|
/* set DAI configuration */
|
||||||
@ -122,7 +122,7 @@ static int imx_audmix_be_hw_params(struct snd_pcm_substream *substream,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* For playback the AUDMIX is consumer */
|
/* For playback the AUDMIX is consumer */
|
||||||
fmt |= SND_SOC_DAIFMT_CBP_CFP;
|
fmt |= SND_SOC_DAIFMT_BC_FC;
|
||||||
|
|
||||||
/* set AUDMIX DAI configuration */
|
/* set AUDMIX DAI configuration */
|
||||||
ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0), fmt);
|
ret = snd_soc_dai_set_fmt(asoc_rtd_to_cpu(rtd, 0), fmt);
|
||||||
|
@ -317,7 +317,7 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
|
ret = snd_soc_dai_set_fmt(cpu_dai, snd_soc_daifmt_clock_provider_flipped(fmt));
|
||||||
if (ret && ret != -ENOTSUPP) {
|
if (ret && ret != -ENOTSUPP) {
|
||||||
dev_err(dev, "failed to set cpu dai fmt: %d\n", ret);
|
dev_err(dev, "failed to set cpu dai fmt: %d\n", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user