MLK-17089-7: ASoC: fsl_mqs: support suspend & resume for imx8
authorShengjiu Wang <shengjiu.wang@nxp.com>
Wed, 6 Dec 2017 03:30:02 +0000 (11:30 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:50:18 +0000 (14:50 -0500)
Base on latest power management design in MLK-17074, every driver
need to enter runtime suspend state in suspend, so the driver should
call the pm_runtime_force_suspend in suspend. with this implementation
the suspend function almost same as runtime suspend function. so remove
the suspend function, just use pm_runtime_force_suspend instead.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
sound/soc/codecs/fsl_mqs.c

index 09eb1d5..745dc13 100644 (file)
@@ -296,39 +296,16 @@ static int fsl_mqs_runtime_resume(struct device *dev)
        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)
-{
-       struct fsl_mqs *mqs_priv = dev_get_drvdata(dev);
-
        if (mqs_priv->use_gpr)
                regmap_write(mqs_priv->gpr, IOMUXC_GPR2,
                            mqs_priv->reg_iomuxc_gpr2);
        else
                regmap_write(mqs_priv->regmap, REG_MQS_CTRL,
                             mqs_priv->reg_mqs_ctrl);
-
        return 0;
 }
 
-static int fsl_mqs_suspend(struct device *dev)
+static int fsl_mqs_runtime_suspend(struct device *dev)
 {
        struct fsl_mqs *mqs_priv = dev_get_drvdata(dev);
 
@@ -339,6 +316,12 @@ static int fsl_mqs_suspend(struct device *dev)
                regmap_read(mqs_priv->regmap, REG_MQS_CTRL,
                            &mqs_priv->reg_mqs_ctrl);
 
+       if (mqs_priv->mclk)
+               clk_disable_unprepare(mqs_priv->mclk);
+
+       if (mqs_priv->ipg)
+               clk_disable_unprepare(mqs_priv->ipg);
+
        return 0;
 }
 #endif
@@ -347,7 +330,7 @@ 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)
+       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static const struct of_device_id fsl_mqs_dt_ids[] = {