diff options
Diffstat (limited to 'sound/soc/fsl/imx-mqs.c')
-rw-r--r-- | sound/soc/fsl/imx-mqs.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sound/soc/fsl/imx-mqs.c b/sound/soc/fsl/imx-mqs.c index af6248d09139..df291a45d43d 100644 --- a/sound/soc/fsl/imx-mqs.c +++ b/sound/soc/fsl/imx-mqs.c @@ -20,6 +20,7 @@ #define SUPPORT_RATE_NUM 10 struct imx_priv { + struct clk *codec_clk; unsigned int mclk_freq; struct platform_device *pdev; struct platform_device *asrc_pdev; @@ -38,7 +39,9 @@ static int imx_mqs_startup(struct snd_pcm_substream *substream) static u32 support_rates[SUPPORT_RATE_NUM]; int ret; - if (priv->mclk_freq == 24576000) { + priv->mclk_freq = clk_get_rate(priv->codec_clk); + + if (priv->mclk_freq % 24576000 == 0) { support_rates[0] = 48000; constraint_rates.list = support_rates; constraint_rates.count = 1; @@ -150,7 +153,6 @@ static int imx_mqs_probe(struct platform_device *pdev) { struct device_node *cpu_np, *codec_np; struct imx_priv *priv = &card_priv; - struct clk *codec_clk = NULL; struct platform_device *codec_dev; struct platform_device *asrc_pdev = NULL; struct platform_device *cpu_pdev; @@ -193,13 +195,12 @@ static int imx_mqs_probe(struct platform_device *pdev) goto fail; } - codec_clk = devm_clk_get(&codec_dev->dev, "mclk"); - if (IS_ERR(codec_clk)) { - ret = PTR_ERR(codec_clk); + priv->codec_clk = devm_clk_get(&codec_dev->dev, "mclk"); + if (IS_ERR(priv->codec_clk)) { + ret = PTR_ERR(priv->codec_clk); dev_err(&codec_dev->dev, "failed to get codec clk: %d\n", ret); goto fail; } - priv->mclk_freq = clk_get_rate(codec_clk); imx_mqs_dai[0].codec_dai_name = "fsl-mqs-dai"; |