Commit 4a8cf938 authored by Mark Brown's avatar Mark Brown

ASoC: atmel: Convert to new style DAI format definitions

Convert the Atmel drivers to use the new style defines for clocking in DAI
formats.
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Reviewed-by: default avatarCodrin Ciubotariu <codrin.ciubotariu@microchip.com>
Acked-by: default avatarPeter Rosin <peda@axentia.se>
parent 6116df7f
...@@ -342,8 +342,8 @@ static int atmel_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -342,8 +342,8 @@ static int atmel_i2s_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (dev->fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_CBC_CFC:
/* codec is slave, so cpu is master */ /* codec is slave, so cpu is master */
mr |= ATMEL_I2SC_MR_MODE_MASTER; mr |= ATMEL_I2SC_MR_MODE_MASTER;
ret = atmel_i2s_get_gck_param(dev, params_rate(params)); ret = atmel_i2s_get_gck_param(dev, params_rate(params));
...@@ -351,7 +351,7 @@ static int atmel_i2s_hw_params(struct snd_pcm_substream *substream, ...@@ -351,7 +351,7 @@ static int atmel_i2s_hw_params(struct snd_pcm_substream *substream,
return ret; return ret;
break; break;
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBP_CFP:
/* codec is master, so cpu is slave */ /* codec is master, so cpu is slave */
mr |= ATMEL_I2SC_MR_MODE_SLAVE; mr |= ATMEL_I2SC_MR_MODE_SLAVE;
dev->gck_param = NULL; dev->gck_param = NULL;
......
...@@ -209,8 +209,8 @@ static int atmel_ssc_hw_rule_rate(struct snd_pcm_hw_params *params, ...@@ -209,8 +209,8 @@ static int atmel_ssc_hw_rule_rate(struct snd_pcm_hw_params *params,
if (frame_size < 0) if (frame_size < 0)
return frame_size; return frame_size;
switch (ssc_p->daifmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (ssc_p->daifmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
case SND_SOC_DAIFMT_CBM_CFS: case SND_SOC_DAIFMT_CBP_CFC:
if ((ssc_p->dir_mask & SSC_DIR_MASK_CAPTURE) if ((ssc_p->dir_mask & SSC_DIR_MASK_CAPTURE)
&& ssc->clk_from_rk_pin) && ssc->clk_from_rk_pin)
/* Receiver Frame Synchro (i.e. capture) /* Receiver Frame Synchro (i.e. capture)
...@@ -220,7 +220,7 @@ static int atmel_ssc_hw_rule_rate(struct snd_pcm_hw_params *params, ...@@ -220,7 +220,7 @@ static int atmel_ssc_hw_rule_rate(struct snd_pcm_hw_params *params,
mck_div = 3; mck_div = 3;
break; break;
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBP_CFP:
if ((ssc_p->dir_mask & SSC_DIR_MASK_PLAYBACK) if ((ssc_p->dir_mask & SSC_DIR_MASK_PLAYBACK)
&& !ssc->clk_from_rk_pin) && !ssc->clk_from_rk_pin)
/* Transmit Frame Synchro (i.e. playback) /* Transmit Frame Synchro (i.e. playback)
...@@ -232,8 +232,8 @@ static int atmel_ssc_hw_rule_rate(struct snd_pcm_hw_params *params, ...@@ -232,8 +232,8 @@ static int atmel_ssc_hw_rule_rate(struct snd_pcm_hw_params *params,
break; break;
} }
switch (ssc_p->daifmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (ssc_p->daifmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_CBC_CFC:
r.num = ssc_p->mck_rate / mck_div / frame_size; r.num = ssc_p->mck_rate / mck_div / frame_size;
ret = snd_interval_ratnum(i, 1, &r, &num, &den); ret = snd_interval_ratnum(i, 1, &r, &num, &den);
...@@ -243,8 +243,8 @@ static int atmel_ssc_hw_rule_rate(struct snd_pcm_hw_params *params, ...@@ -243,8 +243,8 @@ static int atmel_ssc_hw_rule_rate(struct snd_pcm_hw_params *params,
} }
break; break;
case SND_SOC_DAIFMT_CBM_CFS: case SND_SOC_DAIFMT_CBP_CFC:
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBP_CFP:
t.min = 8000; t.min = 8000;
t.max = ssc_p->mck_rate / mck_div / frame_size; t.max = ssc_p->mck_rate / mck_div / frame_size;
t.openmin = t.openmax = 0; t.openmin = t.openmax = 0;
...@@ -429,9 +429,9 @@ static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai, ...@@ -429,9 +429,9 @@ static int atmel_ssc_set_dai_clkdiv(struct snd_soc_dai *cpu_dai,
/* Is the cpu-dai master of the frame clock? */ /* Is the cpu-dai master of the frame clock? */
static int atmel_ssc_cfs(struct atmel_ssc_info *ssc_p) static int atmel_ssc_cfs(struct atmel_ssc_info *ssc_p)
{ {
switch (ssc_p->daifmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (ssc_p->daifmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
case SND_SOC_DAIFMT_CBM_CFS: case SND_SOC_DAIFMT_CBP_CFC:
case SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_CBC_CFC:
return 1; return 1;
} }
return 0; return 0;
...@@ -440,9 +440,9 @@ static int atmel_ssc_cfs(struct atmel_ssc_info *ssc_p) ...@@ -440,9 +440,9 @@ static int atmel_ssc_cfs(struct atmel_ssc_info *ssc_p)
/* Is the cpu-dai master of the bit clock? */ /* Is the cpu-dai master of the bit clock? */
static int atmel_ssc_cbs(struct atmel_ssc_info *ssc_p) static int atmel_ssc_cbs(struct atmel_ssc_info *ssc_p)
{ {
switch (ssc_p->daifmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (ssc_p->daifmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
case SND_SOC_DAIFMT_CBS_CFM: case SND_SOC_DAIFMT_CBC_CFP:
case SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_CBC_CFC:
return 1; return 1;
} }
return 0; return 0;
......
...@@ -66,7 +66,7 @@ static struct snd_soc_dai_link atmel_asoc_wm8904_dailink = { ...@@ -66,7 +66,7 @@ static struct snd_soc_dai_link atmel_asoc_wm8904_dailink = {
.stream_name = "WM8904 PCM", .stream_name = "WM8904 PCM",
.dai_fmt = SND_SOC_DAIFMT_I2S .dai_fmt = SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM, | SND_SOC_DAIFMT_CBP_CFP,
.ops = &atmel_asoc_wm8904_ops, .ops = &atmel_asoc_wm8904_ops,
SND_SOC_DAILINK_REG(pcm), SND_SOC_DAILINK_REG(pcm),
}; };
......
...@@ -350,7 +350,7 @@ static int mchp_i2s_mcc_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) ...@@ -350,7 +350,7 @@ static int mchp_i2s_mcc_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
return -EINVAL; return -EINVAL;
/* We can't generate only FSYNC */ /* We can't generate only FSYNC */
if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) == SND_SOC_DAIFMT_CBM_CFS) if ((fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) == SND_SOC_DAIFMT_CBP_CFC)
return -EINVAL; return -EINVAL;
/* We can only reconfigure the IP when it's stopped */ /* We can only reconfigure the IP when it's stopped */
...@@ -546,20 +546,20 @@ static int mchp_i2s_mcc_hw_params(struct snd_pcm_substream *substream, ...@@ -546,20 +546,20 @@ static int mchp_i2s_mcc_hw_params(struct snd_pcm_substream *substream,
return -EINVAL; return -EINVAL;
} }
switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (dev->fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_CBC_CFC:
/* cpu is BCLK and LRC master */ /* cpu is BCLK and LRC master */
mra |= MCHP_I2SMCC_MRA_MODE_MASTER; mra |= MCHP_I2SMCC_MRA_MODE_MASTER;
if (dev->sysclk) if (dev->sysclk)
mra |= MCHP_I2SMCC_MRA_IMCKMODE_GEN; mra |= MCHP_I2SMCC_MRA_IMCKMODE_GEN;
set_divs = 1; set_divs = 1;
break; break;
case SND_SOC_DAIFMT_CBS_CFM: case SND_SOC_DAIFMT_CBC_CFP:
/* cpu is BCLK master */ /* cpu is BCLK master */
mrb |= MCHP_I2SMCC_MRB_CLKSEL_INT; mrb |= MCHP_I2SMCC_MRB_CLKSEL_INT;
set_divs = 1; set_divs = 1;
fallthrough; fallthrough;
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBP_CFP:
/* cpu is slave */ /* cpu is slave */
mra |= MCHP_I2SMCC_MRA_MODE_SLAVE; mra |= MCHP_I2SMCC_MRA_MODE_SLAVE;
if (dev->sysclk) if (dev->sysclk)
......
...@@ -129,9 +129,9 @@ static int snd_proto_probe(struct platform_device *pdev) ...@@ -129,9 +129,9 @@ static int snd_proto_probe(struct platform_device *pdev)
} }
if (bitclkmaster) { if (bitclkmaster) {
if (codec_np == bitclkmaster) if (codec_np == bitclkmaster)
dai_fmt |= SND_SOC_DAIFMT_CBM_CFM; dai_fmt |= SND_SOC_DAIFMT_CBP_CFP;
else else
dai_fmt |= SND_SOC_DAIFMT_CBS_CFS; dai_fmt |= SND_SOC_DAIFMT_CBC_CFC;
} else { } else {
dai_fmt |= snd_soc_daifmt_parse_clock_provider_as_flag(np, NULL); dai_fmt |= snd_soc_daifmt_parse_clock_provider_as_flag(np, NULL);
} }
......
...@@ -126,7 +126,7 @@ static struct snd_soc_dai_link at91sam9g20ek_dai = { ...@@ -126,7 +126,7 @@ static struct snd_soc_dai_link at91sam9g20ek_dai = {
.stream_name = "WM8731 PCM", .stream_name = "WM8731 PCM",
.init = at91sam9g20ek_wm8731_init, .init = at91sam9g20ek_wm8731_init,
.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
SND_SOC_DAIFMT_CBM_CFM, SND_SOC_DAIFMT_CBP_CFP,
SND_SOC_DAILINK_REG(pcm), SND_SOC_DAILINK_REG(pcm),
}; };
......
...@@ -115,7 +115,7 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev) ...@@ -115,7 +115,7 @@ static int sam9x5_wm8731_driver_probe(struct platform_device *pdev)
dai->codecs->dai_name = "wm8731-hifi"; dai->codecs->dai_name = "wm8731-hifi";
dai->init = sam9x5_wm8731_init; dai->init = sam9x5_wm8731_init;
dai->dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF dai->dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFM; | SND_SOC_DAIFMT_CBP_CFP;
ret = snd_soc_of_parse_card_name(card, "atmel,model"); ret = snd_soc_of_parse_card_name(card, "atmel,model");
if (ret) { if (ret) {
......
...@@ -304,7 +304,7 @@ static struct snd_soc_dai_link tse850_dailink = { ...@@ -304,7 +304,7 @@ static struct snd_soc_dai_link tse850_dailink = {
.stream_name = "TSE-850-PCM", .stream_name = "TSE-850-PCM",
.dai_fmt = SND_SOC_DAIFMT_I2S .dai_fmt = SND_SOC_DAIFMT_I2S
| SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_NB_NF
| SND_SOC_DAIFMT_CBM_CFS, | SND_SOC_DAIFMT_CBP_CFC,
SND_SOC_DAILINK_REG(pcm), SND_SOC_DAILINK_REG(pcm),
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment