summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorShengjiu Wang <shengjiu.wang@nxp.com>2017-11-29 15:32:21 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commit8181c69fed3c4e435041f369dfab1d6a79c3b569 (patch)
treeaf4cff21d6d321543aab32d853185ee1e8181586 /sound
parent4a0fe43c64f7859975544cbcd8f74ddee26cbfa9 (diff)
MLK-17034-5: ASoC: fsl_mqs: Move clock operation to pm runtime function
In imx8 when systerm enter suspend state, the power of subsystem will be off, The clock enable state will be lost after resume, but the runtime resume function will be called after resume by pm, so need to move clock enablement to runtime resume and clock disablement to runtime suspend. Then after resume the clock enable state can be recovered. Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/fsl_mqs.c48
1 files changed, 35 insertions, 13 deletions
diff --git a/sound/soc/codecs/fsl_mqs.c b/sound/soc/codecs/fsl_mqs.c
index 4bc47ee9c424..09eb1d5defb4 100644
--- a/sound/soc/codecs/fsl_mqs.c
+++ b/sound/soc/codecs/fsl_mqs.c
@@ -144,12 +144,6 @@ static int fsl_mqs_startup(struct snd_pcm_substream *substream,
struct snd_soc_codec *codec = dai->codec;
struct fsl_mqs *mqs_priv = snd_soc_codec_get_drvdata(codec);
- if (mqs_priv->ipg)
- clk_prepare_enable(mqs_priv->ipg);
-
- if (mqs_priv->mclk)
- clk_prepare_enable(mqs_priv->mclk);
-
if (mqs_priv->use_gpr)
regmap_update_bits(mqs_priv->gpr, IOMUXC_GPR2, IMX6SX_GPR2_MQS_EN_MASK,
1 << IMX6SX_GPR2_MQS_EN_SHIFT);
@@ -172,16 +166,12 @@ static void fsl_mqs_shutdown(struct snd_pcm_substream *substream,
else
regmap_update_bits(mqs_priv->regmap, REG_MQS_CTRL,
MQS_EN_MASK, 0);
-
- if (mqs_priv->mclk)
- clk_disable_unprepare(mqs_priv->mclk);
-
- if (mqs_priv->ipg)
- clk_disable_unprepare(mqs_priv->ipg);
}
-static struct snd_soc_codec_driver soc_codec_fsl_mqs;
+static struct snd_soc_codec_driver soc_codec_fsl_mqs = {
+ .idle_bias_off = true,
+};
static const struct snd_soc_dai_ops fsl_mqs_dai_ops = {
.startup = fsl_mqs_startup,
@@ -291,9 +281,38 @@ out:
static int fsl_mqs_remove(struct platform_device *pdev)
{
snd_soc_unregister_codec(&pdev->dev);
+ pm_runtime_disable(&pdev->dev);
+ return 0;
+}
+
+#ifdef CONFIG_PM
+static int fsl_mqs_runtime_resume(struct device *dev)
+{
+ struct fsl_mqs *mqs_priv = dev_get_drvdata(dev);
+
+ if (mqs_priv->ipg)
+ clk_prepare_enable(mqs_priv->ipg);
+
+ if (mqs_priv->mclk)
+ clk_prepare_enable(mqs_priv->mclk);
+
return 0;
}
+static int fsl_mqs_runtime_suspend(struct device *dev)
+{
+ struct fsl_mqs *mqs_priv = dev_get_drvdata(dev);
+
+ if (mqs_priv->mclk)
+ clk_disable_unprepare(mqs_priv->mclk);
+
+ if (mqs_priv->ipg)
+ clk_disable_unprepare(mqs_priv->ipg);
+
+ return 0;
+}
+#endif
+
#ifdef CONFIG_PM_SLEEP
static int fsl_mqs_resume(struct device *dev)
{
@@ -325,6 +344,9 @@ static int fsl_mqs_suspend(struct device *dev)
#endif
static const struct dev_pm_ops fsl_mqs_pm_ops = {
+ SET_RUNTIME_PM_OPS(fsl_mqs_runtime_suspend,
+ fsl_mqs_runtime_resume,
+ NULL)
SET_SYSTEM_SLEEP_PM_OPS(fsl_mqs_suspend, fsl_mqs_resume)
};