[PATCH 25/56] ASoC: ti: Update to use set_fmt_new callback
Péter Ujfalusi
peter.ujfalusi at gmail.com
Sat May 28 02:18:51 PDT 2022
On 19/05/2022 18:42, Charles Keepax wrote:
> 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.
looks good, thanks Charles,
Acked-by: Peter Ujfalusi <peter.ujfalusi at gmail.com>
>
> Signed-off-by: Charles Keepax <ckeepax at opensource.cirrus.com>
> ---
> sound/soc/ti/davinci-i2s.c | 34 +++++++++++++++++-----------------
> sound/soc/ti/davinci-mcasp.c | 12 ++++++------
> sound/soc/ti/omap-mcbsp.c | 14 +++++++-------
> 3 files changed, 30 insertions(+), 30 deletions(-)
>
> diff --git a/sound/soc/ti/davinci-i2s.c b/sound/soc/ti/davinci-i2s.c
> index 0363a088d2e00..c7368d5296688 100644
> --- a/sound/soc/ti/davinci-i2s.c
> +++ b/sound/soc/ti/davinci-i2s.c
> @@ -230,15 +230,15 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
>
> dev->fmt = fmt;
> /* set master/slave audio interface */
> - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> - case SND_SOC_DAIFMT_CBS_CFS:
> + switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
> + case SND_SOC_DAIFMT_BP_FP:
> /* cpu is master */
> pcr = DAVINCI_MCBSP_PCR_FSXM |
> DAVINCI_MCBSP_PCR_FSRM |
> DAVINCI_MCBSP_PCR_CLKXM |
> DAVINCI_MCBSP_PCR_CLKRM;
> break;
> - case SND_SOC_DAIFMT_CBM_CFS:
> + case SND_SOC_DAIFMT_BC_FP:
> pcr = DAVINCI_MCBSP_PCR_FSRM | DAVINCI_MCBSP_PCR_FSXM;
> /*
> * Selection of the clock input pin that is the
> @@ -260,7 +260,7 @@ static int davinci_i2s_set_dai_fmt(struct snd_soc_dai *cpu_dai,
> }
>
> break;
> - case SND_SOC_DAIFMT_CBM_CFM:
> + case SND_SOC_DAIFMT_BC_FC:
> /* codec is master */
> pcr = 0;
> break;
> @@ -395,12 +395,12 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
> davinci_mcbsp_write_reg(dev, DAVINCI_MCBSP_SPCR_REG, spcr);
> }
>
> - master = dev->fmt & SND_SOC_DAIFMT_MASTER_MASK;
> + master = dev->fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK;
> fmt = params_format(params);
> mcbsp_word_length = asp_word_length[fmt];
>
> switch (master) {
> - case SND_SOC_DAIFMT_CBS_CFS:
> + case SND_SOC_DAIFMT_BP_FP:
> freq = clk_get_rate(dev->clk);
> srgr = DAVINCI_MCBSP_SRGR_FSGM |
> DAVINCI_MCBSP_SRGR_CLKSM;
> @@ -426,7 +426,7 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
> clk_div &= 0xFF;
> srgr |= clk_div;
> break;
> - case SND_SOC_DAIFMT_CBM_CFS:
> + case SND_SOC_DAIFMT_BC_FP:
> srgr = DAVINCI_MCBSP_SRGR_FSGM;
> clk_div = dev->clk_div - 1;
> srgr |= DAVINCI_MCBSP_SRGR_FWID(mcbsp_word_length * 8 - 1);
> @@ -434,7 +434,7 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
> clk_div &= 0xFF;
> srgr |= clk_div;
> break;
> - case SND_SOC_DAIFMT_CBM_CFM:
> + case SND_SOC_DAIFMT_BC_FC:
> /* Clock and frame sync given from external sources */
> i = hw_param_interval(params, SNDRV_PCM_HW_PARAM_SAMPLE_BITS);
> srgr = DAVINCI_MCBSP_SRGR_FSGM;
> @@ -473,15 +473,15 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
> fmt = double_fmt[fmt];
> }
> switch (master) {
> - case SND_SOC_DAIFMT_CBS_CFS:
> - case SND_SOC_DAIFMT_CBS_CFM:
> + case SND_SOC_DAIFMT_BP_FP:
> + case SND_SOC_DAIFMT_BP_FC:
> rcr |= DAVINCI_MCBSP_RCR_RFRLEN2(0);
> xcr |= DAVINCI_MCBSP_XCR_XFRLEN2(0);
> rcr |= DAVINCI_MCBSP_RCR_RPHASE;
> xcr |= DAVINCI_MCBSP_XCR_XPHASE;
> break;
> - case SND_SOC_DAIFMT_CBM_CFM:
> - case SND_SOC_DAIFMT_CBM_CFS:
> + case SND_SOC_DAIFMT_BC_FC:
> + case SND_SOC_DAIFMT_BC_FP:
> rcr |= DAVINCI_MCBSP_RCR_RFRLEN2(element_cnt - 1);
> xcr |= DAVINCI_MCBSP_XCR_XFRLEN2(element_cnt - 1);
> break;
> @@ -492,13 +492,13 @@ static int davinci_i2s_hw_params(struct snd_pcm_substream *substream,
> mcbsp_word_length = asp_word_length[fmt];
>
> switch (master) {
> - case SND_SOC_DAIFMT_CBS_CFS:
> - case SND_SOC_DAIFMT_CBS_CFM:
> + case SND_SOC_DAIFMT_BP_FP:
> + case SND_SOC_DAIFMT_BP_FC:
> rcr |= DAVINCI_MCBSP_RCR_RFRLEN1(0);
> xcr |= DAVINCI_MCBSP_XCR_XFRLEN1(0);
> break;
> - case SND_SOC_DAIFMT_CBM_CFM:
> - case SND_SOC_DAIFMT_CBM_CFS:
> + case SND_SOC_DAIFMT_BC_FC:
> + case SND_SOC_DAIFMT_BC_FP:
> rcr |= DAVINCI_MCBSP_RCR_RFRLEN1(element_cnt - 1);
> xcr |= DAVINCI_MCBSP_XCR_XFRLEN1(element_cnt - 1);
> break;
> @@ -606,7 +606,7 @@ static const struct snd_soc_dai_ops davinci_i2s_dai_ops = {
> .prepare = davinci_i2s_prepare,
> .trigger = davinci_i2s_trigger,
> .hw_params = davinci_i2s_hw_params,
> - .set_fmt = davinci_i2s_set_dai_fmt,
> + .set_fmt_new = davinci_i2s_set_dai_fmt,
> .set_clkdiv = davinci_i2s_dai_set_clkdiv,
>
> };
> diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c
> index 377be2e2b6ee7..961bac6963652 100644
> --- a/sound/soc/ti/davinci-mcasp.c
> +++ b/sound/soc/ti/davinci-mcasp.c
> @@ -492,8 +492,8 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
> mcasp_mod_bits(mcasp, DAVINCI_MCASP_RXFMT_REG, FSRDLY(data_delay),
> FSRDLY(3));
>
> - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> - case SND_SOC_DAIFMT_CBS_CFS:
> + switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
> + case SND_SOC_DAIFMT_BP_FP:
> /* codec is clock and frame slave */
> mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
> mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
> @@ -510,7 +510,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
>
> mcasp->bclk_master = 1;
> break;
> - case SND_SOC_DAIFMT_CBS_CFM:
> + case SND_SOC_DAIFMT_BP_FC:
> /* codec is clock slave and frame master */
> mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
> mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
> @@ -527,7 +527,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
>
> mcasp->bclk_master = 1;
> break;
> - case SND_SOC_DAIFMT_CBM_CFS:
> + case SND_SOC_DAIFMT_BC_FP:
> /* codec is clock master and frame slave */
> mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
> mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
> @@ -544,7 +544,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
>
> mcasp->bclk_master = 0;
> break;
> - case SND_SOC_DAIFMT_CBM_CFM:
> + case SND_SOC_DAIFMT_BC_FC:
> /* codec is clock and frame master */
> mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXE);
> mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, AFSXE);
> @@ -1620,7 +1620,7 @@ static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
> .trigger = davinci_mcasp_trigger,
> .delay = davinci_mcasp_delay,
> .hw_params = davinci_mcasp_hw_params,
> - .set_fmt = davinci_mcasp_set_dai_fmt,
> + .set_fmt_new = davinci_mcasp_set_dai_fmt,
> .set_clkdiv = davinci_mcasp_set_clkdiv,
> .set_sysclk = davinci_mcasp_set_sysclk,
> .set_tdm_slot = davinci_mcasp_set_tdm_slot,
> diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c
> index 4479d74f0a458..5bfb56d4ff844 100644
> --- a/sound/soc/ti/omap-mcbsp.c
> +++ b/sound/soc/ti/omap-mcbsp.c
> @@ -1036,8 +1036,8 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
>
> /* In McBSP master modes, FRAME (i.e. sample rate) is generated
> * by _counting_ BCLKs. Calculate frame size in BCLKs */
> - master = mcbsp->fmt & SND_SOC_DAIFMT_MASTER_MASK;
> - if (master == SND_SOC_DAIFMT_CBS_CFS) {
> + master = mcbsp->fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK;
> + if (master == SND_SOC_DAIFMT_BP_FP) {
> div = mcbsp->clk_div ? mcbsp->clk_div : 1;
> framesize = (mcbsp->in_freq / div) / params_rate(params);
>
> @@ -1136,20 +1136,20 @@ static int omap_mcbsp_dai_set_dai_fmt(struct snd_soc_dai *cpu_dai,
> return -EINVAL;
> }
>
> - switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
> - case SND_SOC_DAIFMT_CBS_CFS:
> + switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
> + case SND_SOC_DAIFMT_BP_FP:
> /* McBSP master. Set FS and bit clocks as outputs */
> regs->pcr0 |= FSXM | FSRM |
> CLKXM | CLKRM;
> /* Sample rate generator drives the FS */
> regs->srgr2 |= FSGM;
> break;
> - case SND_SOC_DAIFMT_CBM_CFS:
> + case SND_SOC_DAIFMT_BC_FP:
> /* McBSP slave. FS clock as output */
> regs->srgr2 |= FSGM;
> regs->pcr0 |= FSXM | FSRM;
> break;
> - case SND_SOC_DAIFMT_CBM_CFM:
> + case SND_SOC_DAIFMT_BC_FC:
> /* McBSP slave */
> break;
> default:
> @@ -1271,7 +1271,7 @@ static const struct snd_soc_dai_ops mcbsp_dai_ops = {
> .trigger = omap_mcbsp_dai_trigger,
> .delay = omap_mcbsp_dai_delay,
> .hw_params = omap_mcbsp_dai_hw_params,
> - .set_fmt = omap_mcbsp_dai_set_dai_fmt,
> + .set_fmt_new = omap_mcbsp_dai_set_dai_fmt,
> .set_clkdiv = omap_mcbsp_dai_set_clkdiv,
> .set_sysclk = omap_mcbsp_dai_set_dai_sysclk,
> };
--
Péter
More information about the linux-amlogic
mailing list