aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1107-ASoC-AMD-Add-ACP3x-runtime-pm-ops.patch
diff options
context:
space:
mode:
Diffstat (limited to 'common/recipes-kernel/linux/linux-yocto-4.14.71/1107-ASoC-AMD-Add-ACP3x-runtime-pm-ops.patch')
-rw-r--r--common/recipes-kernel/linux/linux-yocto-4.14.71/1107-ASoC-AMD-Add-ACP3x-runtime-pm-ops.patch89
1 files changed, 89 insertions, 0 deletions
diff --git a/common/recipes-kernel/linux/linux-yocto-4.14.71/1107-ASoC-AMD-Add-ACP3x-runtime-pm-ops.patch b/common/recipes-kernel/linux/linux-yocto-4.14.71/1107-ASoC-AMD-Add-ACP3x-runtime-pm-ops.patch
new file mode 100644
index 00000000..ea5b15a4
--- /dev/null
+++ b/common/recipes-kernel/linux/linux-yocto-4.14.71/1107-ASoC-AMD-Add-ACP3x-runtime-pm-ops.patch
@@ -0,0 +1,89 @@
+From f4623d41bb204382ecacb7ca35975a48a9d81784 Mon Sep 17 00:00:00 2001
+From: Maruthi Srinivas Bayyavarapu <Maruthi.Bayyavarapu@amd.com>
+Date: Thu, 30 Mar 2017 15:28:15 +0530
+Subject: [PATCH 1107/4131] ASoC: AMD: Add ACP3x runtime pm ops
+
+Added runtime PM operations for ACP3x PCM platform device. Device will
+be powered on/off based on device is in use or not.
+
+Signed-off-by: Maruthi Bayyavarapu <maruthi.bayyavarapu@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ sound/soc/amd/raven/acp3x-pcm-dma.c | 39 +++++++++++++++++++++++++++++++++++++
+ 1 file changed, 39 insertions(+)
+
+diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
+index f62bb7f..a5d3807 100644
+--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
++++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
+@@ -16,6 +16,7 @@
+ #include <linux/platform_device.h>
+ #include <linux/module.h>
+ #include <linux/err.h>
++#include <linux/pm_runtime.h>
+
+ #include <sound/pcm.h>
+ #include <sound/pcm_params.h>
+@@ -676,6 +677,9 @@ static int acp3x_audio_probe(struct platform_device *pdev)
+ goto dev_err;
+ }
+
++ pm_runtime_set_autosuspend_delay(&pdev->dev, 10000);
++ pm_runtime_use_autosuspend(&pdev->dev);
++ pm_runtime_enable(&pdev->dev);
+ return 0;
+ dev_err:
+ status = acp3x_deinit(adata->acp3x_base);
+@@ -701,14 +705,49 @@ static int acp3x_audio_remove(struct platform_device *pdev)
+ else
+ dev_info(&pdev->dev, "ACP de-initialized\n");
+
++ pm_runtime_disable(&pdev->dev);
+ return 0;
+ }
+
++static int acp3x_pcm_runtime_suspend(struct device *dev)
++{
++ int status;
++ struct i2s_dev_data *adata = dev_get_drvdata(dev);
++
++ status = acp3x_deinit(adata->acp3x_base);
++ if (status)
++ dev_err(dev, "ACP de-init failed\n");
++ else
++ dev_info(dev, "ACP de-initialized\n");
++
++ rv_writel(0, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
++
++ return 0;
++}
++
++static int acp3x_pcm_runtime_resume(struct device *dev)
++{
++ int status;
++ struct i2s_dev_data *adata = dev_get_drvdata(dev);
++
++ status = acp3x_init(adata->acp3x_base);
++ if (status)
++ return -ENODEV;
++ rv_writel(1, adata->acp3x_base + mmACP_EXTERNAL_INTR_ENB);
++ return 0;
++}
++
++static const struct dev_pm_ops acp3x_pm_ops = {
++ .runtime_suspend = acp3x_pcm_runtime_suspend,
++ .runtime_resume = acp3x_pcm_runtime_resume,
++};
++
+ static struct platform_driver acp3x_dma_driver = {
+ .probe = acp3x_audio_probe,
+ .remove = acp3x_audio_remove,
+ .driver = {
+ .name = "acp3x_rv_i2s",
++ .pm = &acp3x_pm_ops,
+ },
+ };
+
+--
+2.7.4
+