summaryrefslogtreecommitdiff
path: root/sound/soc/fsl/imx-mqs.c
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@freescale.com>2017-09-01 13:45:13 +0800
committerDong Aisheng <aisheng.dong@nxp.com>2019-11-25 15:50:15 +0800
commit4b5fcca4a15c86e485b61fcd01bab21c5c53cad5 (patch)
tree02589dce6d4524fe137b3651c84723278ff4e780 /sound/soc/fsl/imx-mqs.c
parentefc41bef7f264213e252a6b3ddd9223e77d649c3 (diff)
MLK-16350-4: ASoC: imx_mqs: fix the clock rate issue
The rate returned by clk_get_rate in probe function is not correct, for the power domain in that time may be closed, kernel get 0 rate from scfw, so move the clk_get_rate to hw_params, in that time, the power domain should be enabled Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Diffstat (limited to 'sound/soc/fsl/imx-mqs.c')
-rw-r--r--sound/soc/fsl/imx-mqs.c13
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";