MLK-17089-8: ASoC: fsl_amix: support suspend & resume for imx8
authorViorel Suman <viorel.suman@nxp.com>
Thu, 7 Dec 2017 13:54:56 +0000 (15:54 +0200)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:50:34 +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: Viorel Suman <viorel.suman@nxp.com>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
sound/soc/fsl/fsl_amix.c

index 3adb621..934bc55 100644 (file)
@@ -631,45 +631,35 @@ static int fsl_amix_probe(struct platform_device *pdev)
 static int fsl_amix_runtime_resume(struct device *dev)
 {
        struct fsl_amix *priv = dev_get_drvdata(dev);
+       int ret;
 
-       return clk_prepare_enable(priv->ipg_clk);
-}
-
-static int fsl_amix_runtime_suspend(struct device *dev)
-{
-       struct fsl_amix *priv = dev_get_drvdata(dev);
+       ret = clk_prepare_enable(priv->ipg_clk);
+       if (ret) {
+               dev_err(dev, "Failed to enable IPG clock: %d\n", ret);
+               return ret;
+       }
 
-       clk_disable_unprepare(priv->ipg_clk);
+       regcache_cache_only(priv->regmap, false);
+       regcache_mark_dirty(priv->regmap);
 
-       return 0;
+       return regcache_sync(priv->regmap);
 }
-#endif /* CONFIG_PM */
 
-#ifdef CONFIG_PM_SLEEP
-static int fsl_amix_suspend(struct device *dev)
+static int fsl_amix_runtime_suspend(struct device *dev)
 {
        struct fsl_amix *priv = dev_get_drvdata(dev);
 
        regcache_cache_only(priv->regmap, true);
-       regcache_mark_dirty(priv->regmap);
-
-       return 0;
-}
 
-static int fsl_amix_resume(struct device *dev)
-{
-       struct fsl_amix *priv = dev_get_drvdata(dev);
-
-       regcache_cache_only(priv->regmap, false);
-       regcache_sync(priv->regmap);
+       clk_disable_unprepare(priv->ipg_clk);
 
        return 0;
 }
-#endif /* CONFIG_PM_SLEEP */
+#endif /* CONFIG_PM */
 
 static const struct dev_pm_ops fsl_amix_pm = {
        SET_RUNTIME_PM_OPS(fsl_amix_runtime_suspend, fsl_amix_runtime_resume, NULL)
-       SET_SYSTEM_SLEEP_PM_OPS(fsl_amix_suspend, fsl_amix_resume)
+       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
 };
 
 static const struct of_device_id fsl_amix_ids[] = {