Commit 361284a4 authored by Mark Brown's avatar Mark Brown

ASoC: fsl_sai: Update to modern clocking terminology

As part of moving to remove the old style defines for the bus clocks update
the fsl_sai driver to use more modern terminology for clocking.
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Reviewed-by: default avatarFabio Estevam <festevam@gmail.com>
Link: https://lore.kernel.org/r/20210921213542.31688-6-broonie@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent a51da9dc
...@@ -297,23 +297,23 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai, ...@@ -297,23 +297,23 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
return -EINVAL; return -EINVAL;
} }
/* DAI clock master masks */ /* DAI clock provider masks */
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_CBC_CFC:
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_slave_mode = false; sai->is_consumer_mode = false;
break; break;
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBP_CFP:
sai->is_slave_mode = true; sai->is_consumer_mode = true;
break; break;
case SND_SOC_DAIFMT_CBS_CFM: case SND_SOC_DAIFMT_CBC_CFP:
val_cr2 |= FSL_SAI_CR2_BCD_MSTR; val_cr2 |= FSL_SAI_CR2_BCD_MSTR;
sai->is_slave_mode = false; sai->is_consumer_mode = false;
break; break;
case SND_SOC_DAIFMT_CBM_CFS: case SND_SOC_DAIFMT_CBP_CFC:
val_cr4 |= FSL_SAI_CR4_FSD_MSTR; val_cr4 |= FSL_SAI_CR4_FSD_MSTR;
sai->is_slave_mode = true; sai->is_consumer_mode = true;
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -356,8 +356,8 @@ static int fsl_sai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq) ...@@ -356,8 +356,8 @@ static int fsl_sai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq)
u32 id; u32 id;
int ret = 0; int ret = 0;
/* Don't apply to slave mode */ /* Don't apply to consumer mode */
if (sai->is_slave_mode) if (sai->is_consumer_mode)
return 0; return 0;
/* /*
...@@ -462,7 +462,7 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, ...@@ -462,7 +462,7 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
pins = DIV_ROUND_UP(channels, slots); pins = DIV_ROUND_UP(channels, slots);
if (!sai->is_slave_mode) { if (!sai->is_consumer_mode) {
if (sai->bclk_ratio) if (sai->bclk_ratio)
ret = fsl_sai_set_bclk(cpu_dai, tx, ret = fsl_sai_set_bclk(cpu_dai, tx,
sai->bclk_ratio * sai->bclk_ratio *
...@@ -502,12 +502,12 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, ...@@ -502,12 +502,12 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
val_cr4 |= FSL_SAI_CR4_CHMOD; val_cr4 |= FSL_SAI_CR4_CHMOD;
/* /*
* For SAI master mode, when Tx(Rx) sync with Rx(Tx) clock, Rx(Tx) will * For SAI provider mode, when Tx(Rx) sync with Rx(Tx) clock, Rx(Tx) will
* generate bclk and frame clock for Tx(Rx), we should set RCR4(TCR4), * generate bclk and frame clock for Tx(Rx), we should set RCR4(TCR4),
* RCR5(TCR5) for playback(capture), or there will be sync error. * RCR5(TCR5) for playback(capture), or there will be sync error.
*/ */
if (!sai->is_slave_mode && fsl_sai_dir_is_synced(sai, adir)) { if (!sai->is_consumer_mode && fsl_sai_dir_is_synced(sai, adir)) {
regmap_update_bits(sai->regmap, FSL_SAI_xCR4(!tx, ofs), regmap_update_bits(sai->regmap, FSL_SAI_xCR4(!tx, ofs),
FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK | FSL_SAI_CR4_SYWD_MASK | FSL_SAI_CR4_FRSZ_MASK |
FSL_SAI_CR4_CHMOD_MASK, FSL_SAI_CR4_CHMOD_MASK,
...@@ -543,7 +543,7 @@ static int fsl_sai_hw_free(struct snd_pcm_substream *substream, ...@@ -543,7 +543,7 @@ static int fsl_sai_hw_free(struct snd_pcm_substream *substream,
regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, ofs), regmap_update_bits(sai->regmap, FSL_SAI_xCR3(tx, ofs),
FSL_SAI_CR3_TRCE_MASK, 0); FSL_SAI_CR3_TRCE_MASK, 0);
if (!sai->is_slave_mode && if (!sai->is_consumer_mode &&
sai->mclk_streams & BIT(substream->stream)) { sai->mclk_streams & BIT(substream->stream)) {
clk_disable_unprepare(sai->mclk_clk[sai->mclk_id[tx]]); clk_disable_unprepare(sai->mclk_clk[sai->mclk_id[tx]]);
sai->mclk_streams &= ~BIT(substream->stream); sai->mclk_streams &= ~BIT(substream->stream);
...@@ -577,7 +577,7 @@ static void fsl_sai_config_disable(struct fsl_sai *sai, int dir) ...@@ -577,7 +577,7 @@ static void fsl_sai_config_disable(struct fsl_sai *sai, int dir)
* This is a hardware bug, and will be fix in the * This is a hardware bug, and will be fix in the
* next sai version. * next sai version.
*/ */
if (!sai->is_slave_mode) { if (!sai->is_consumer_mode) {
/* Software Reset */ /* Software Reset */
regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), FSL_SAI_CSR_SR); regmap_write(sai->regmap, FSL_SAI_xCSR(tx, ofs), FSL_SAI_CSR_SR);
/* Clear SR bit to finish the reset */ /* Clear SR bit to finish the reset */
......
...@@ -259,7 +259,7 @@ struct fsl_sai { ...@@ -259,7 +259,7 @@ struct fsl_sai {
struct clk *bus_clk; struct clk *bus_clk;
struct clk *mclk_clk[FSL_SAI_MCLK_MAX]; struct clk *mclk_clk[FSL_SAI_MCLK_MAX];
bool is_slave_mode; bool is_consumer_mode;
bool is_lsb_first; bool is_lsb_first;
bool is_dsp_mode; bool is_dsp_mode;
bool synchronous[2]; bool synchronous[2];
......
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