Commit 89efbdaa authored by Mark Brown's avatar Mark Brown

ASoC: fsl_ssi: Update to modern clocking terminology

As part of moving to remove the old style defines for the bus clocks update
the fsl_ssi 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-7-broonie@kernel.orgSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 361284a4
...@@ -350,16 +350,16 @@ static bool fsl_ssi_is_ac97(struct fsl_ssi *ssi) ...@@ -350,16 +350,16 @@ static bool fsl_ssi_is_ac97(struct fsl_ssi *ssi)
SND_SOC_DAIFMT_AC97; SND_SOC_DAIFMT_AC97;
} }
static bool fsl_ssi_is_i2s_master(struct fsl_ssi *ssi) static bool fsl_ssi_is_i2s_clock_provider(struct fsl_ssi *ssi)
{ {
return (ssi->dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == return (ssi->dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) ==
SND_SOC_DAIFMT_CBS_CFS; SND_SOC_DAIFMT_CBC_CFC;
} }
static bool fsl_ssi_is_i2s_cbm_cfs(struct fsl_ssi *ssi) static bool fsl_ssi_is_i2s_cbp_cfc(struct fsl_ssi *ssi)
{ {
return (ssi->dai_fmt & SND_SOC_DAIFMT_MASTER_MASK) == return (ssi->dai_fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) ==
SND_SOC_DAIFMT_CBM_CFS; SND_SOC_DAIFMT_CBP_CFC;
} }
/** /**
...@@ -808,7 +808,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream, ...@@ -808,7 +808,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
u32 wl = SSI_SxCCR_WL(sample_size); u32 wl = SSI_SxCCR_WL(sample_size);
int ret; int ret;
if (fsl_ssi_is_i2s_master(ssi)) { if (fsl_ssi_is_i2s_clock_provider(ssi)) {
ret = fsl_ssi_set_bclk(substream, dai, hw_params); ret = fsl_ssi_set_bclk(substream, dai, hw_params);
if (ret) if (ret)
return ret; return ret;
...@@ -841,7 +841,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream, ...@@ -841,7 +841,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_cbm_cfs(ssi) && sample_size == 16) if (fsl_ssi_is_i2s_cbp_cfc(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 */
...@@ -865,7 +865,7 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream, ...@@ -865,7 +865,7 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
if (fsl_ssi_is_i2s_master(ssi) && if (fsl_ssi_is_i2s_clock_provider(ssi) &&
ssi->baudclk_streams & BIT(substream->stream)) { ssi->baudclk_streams & BIT(substream->stream)) {
clk_disable_unprepare(ssi->baudclk); clk_disable_unprepare(ssi->baudclk);
ssi->baudclk_streams &= ~BIT(substream->stream); ssi->baudclk_streams &= ~BIT(substream->stream);
...@@ -891,18 +891,18 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt) ...@@ -891,18 +891,18 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt)
ssi->i2s_net = SSI_SCR_NET; ssi->i2s_net = SSI_SCR_NET;
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_MASTER_MASK) { switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) {
case SND_SOC_DAIFMT_CBS_CFS: case SND_SOC_DAIFMT_CBC_CFC:
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_CBM_CFS: case SND_SOC_DAIFMT_CBP_CFC:
ssi->i2s_net |= SSI_SCR_I2S_MODE_MASTER; ssi->i2s_net |= SSI_SCR_I2S_MODE_MASTER;
break; break;
case SND_SOC_DAIFMT_CBM_CFM: case SND_SOC_DAIFMT_CBP_CFP:
ssi->i2s_net |= SSI_SCR_I2S_MODE_SLAVE; ssi->i2s_net |= SSI_SCR_I2S_MODE_SLAVE;
break; break;
default: default:
...@@ -962,17 +962,17 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt) ...@@ -962,17 +962,17 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi *ssi, unsigned int fmt)
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:
/* 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_CBM_CFM: case SND_SOC_DAIFMT_CBP_CFP:
/* Input bit or frame sync clocks */ /* Input bit or frame sync clocks */
break; break;
case SND_SOC_DAIFMT_CBM_CFS: case SND_SOC_DAIFMT_CBP_CFC:
/* 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;
...@@ -1341,7 +1341,7 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev, ...@@ -1341,7 +1341,7 @@ static int fsl_ssi_imx_probe(struct platform_device *pdev,
} }
} }
/* Do not error out for slave cases that live without a baud clock */ /* Do not error out for consumer cases that live without a baud clock */
ssi->baudclk = devm_clk_get(dev, "baud"); ssi->baudclk = devm_clk_get(dev, "baud");
if (IS_ERR(ssi->baudclk)) if (IS_ERR(ssi->baudclk))
dev_dbg(dev, "failed to get baud clock: %ld\n", dev_dbg(dev, "failed to get baud clock: %ld\n",
......
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