summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorViorel Suman <viorel.suman@nxp.com>2018-06-27 15:05:58 +0300
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:32:34 +0800
commite0c705a85b3507d770b5f0f4aee6a65495006a84 (patch)
tree9cbd7d99b35004d6797a91134d3a3341e8964460 /sound
parente45b27d9f0ad8577efbeab2a9525cdf54152c103 (diff)
MLK-18682-6: ASoC: imx-ak4497: refine 1:1 bclk:mclk ratio support
Use a specific compatible string for 850D in order to limit DSD MCLK frequency for platforms newer than 850D. Signed-off-by: Viorel Suman <viorel.suman@nxp.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/imx-ak4497.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sound/soc/fsl/imx-ak4497.c b/sound/soc/fsl/imx-ak4497.c
index 2d098dc0cddf..9acfa84bf3d1 100644
--- a/sound/soc/fsl/imx-ak4497.c
+++ b/sound/soc/fsl/imx-ak4497.c
@@ -25,6 +25,7 @@
struct imx_ak4497_data {
struct snd_soc_card card;
+ bool one2one_ratio;
};
static struct snd_soc_dapm_widget imx_ak4497_dapm_widgets[] = {
@@ -88,6 +89,7 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *codec_dai = rtd->codec_dai;
struct snd_soc_card *card = rtd->card;
struct device *dev = card->dev;
+ struct imx_ak4497_data *priv = snd_soc_card_get_drvdata(card);
unsigned int channels = params_channels(params);
unsigned int fmt = SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
unsigned long freq = imx_ak4497_compute_freq(substream, params);
@@ -96,6 +98,9 @@ static int imx_aif_hw_params(struct snd_pcm_substream *substream,
fmt |= (is_dsd ? SND_SOC_DAIFMT_PDM : SND_SOC_DAIFMT_I2S);
+ if (is_dsd && freq > 22579200 && priv->one2one_ratio)
+ freq = 22579200;
+
ret = snd_soc_dai_set_sysclk(cpu_dai, FSL_SAI_CLK_MAST1, freq,
SND_SOC_CLOCK_OUT);
if (ret < 0) {
@@ -212,6 +217,8 @@ static int imx_ak4497_probe(struct platform_device *pdev)
priv->card.owner = THIS_MODULE;
priv->card.dapm_widgets = imx_ak4497_dapm_widgets;
priv->card.num_dapm_widgets = ARRAY_SIZE(imx_ak4497_dapm_widgets);
+ priv->one2one_ratio = !of_device_is_compatible(pdev->dev.of_node,
+ "fsl,imx-audio-ak4497-mq");
ret = snd_soc_of_parse_card_name(&priv->card, "model");
if (ret)
@@ -237,6 +244,7 @@ fail:
static const struct of_device_id imx_ak4497_dt_ids[] = {
{ .compatible = "fsl,imx-audio-ak4497", },
+ { .compatible = "fsl,imx-audio-ak4497-mq", },
{ },
};
MODULE_DEVICE_TABLE(of, imx_ak4497_dt_ids);