On 11/7/19 8:36 AM, Ravulapati Vishnu vardhan rao wrote:
When system wide suspend happens, ACP will be powered off
and when system resumes,for audio usecase to continue,
all the runtime configuration data needs to be programmed again.
Added resume pm call back to ACP pm ops and
also Added runtime PM operations for ACP3x PCM platform device.
Device will enter into D3 state when there is no activity
on audio I2S lines.
spaces after punctuation and use of capital letters at the start of a
sentence?
Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@xxxxxxx>
---
sound/soc/amd/raven/pci-acp3x.c | 47 ++++++++++++++++++++++++++++++++++++++++-
1 file changed, 46 insertions(+), 1 deletion(-)
diff --git a/sound/soc/amd/raven/pci-acp3x.c b/sound/soc/amd/raven/pci-acp3x.c
index 7727c9d..d567585 100644
--- a/sound/soc/amd/raven/pci-acp3x.c
+++ b/sound/soc/amd/raven/pci-acp3x.c
@@ -9,6 +9,9 @@
#include <linux/io.h>
#include <linux/platform_device.h>
#include <linux/interrupt.h>
+#include <linux/pm_runtime.h>
+#include <linux/delay.h>
+#include <sound/pcm.h>
#include "acp3x.h"
@@ -247,6 +250,11 @@ static int snd_acp3x_probe(struct pci_dev *pci,
}
break;
}
+ pm_runtime_set_autosuspend_delay(&pci->dev, 10000);
+ pm_runtime_use_autosuspend(&pci->dev);
+ pm_runtime_set_active(&pci->dev);
+ pm_runtime_put_noidle(&pci->dev);
+ pm_runtime_enable(&pci->dev);
return 0;
unmap_mmio:
@@ -268,6 +276,39 @@ static int snd_acp3x_probe(struct pci_dev *pci,
return ret;
}
+static int snd_acp3x_suspend(struct device *dev)
+{
+ int status;
+ struct acp3x_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");
+
+ return 0;
+}
+static int snd_acp3x_resume(struct device *dev)
+{
+ int status;
+ struct acp3x_dev_data *adata = dev_get_drvdata(dev);
+
+ status = acp3x_init(adata->acp3x_base);
+ if (status) {
+ dev_err(dev, "ACP init failed\n");
+ return status;
+ }
+
+ return 0;
+}
+
+static const struct dev_pm_ops acp3x_pm = {
+ .runtime_suspend = snd_acp3x_suspend,
+ .runtime_resume = snd_acp3x_resume,
+ .resume = snd_acp3x_resume,
+};
that should have been combined with the previous patch, you resume inits
in the platform device resume and only add it to the PCI level here.
+
static void snd_acp3x_remove(struct pci_dev *pci)
{
int i, ret;
@@ -283,7 +324,8 @@ static void snd_acp3x_remove(struct pci_dev *pci)
else
dev_info(&pci->dev, "ACP de-initialized\n");
iounmap(adata->acp3x_base);
-
+ pm_runtime_disable(&pci->dev);
+ pm_runtime_get_noresume(&pci->dev);
pci_disable_msi(pci);
pci_release_regions(pci);
pci_disable_device(pci);
@@ -302,6 +344,9 @@ static struct pci_driver acp3x_driver = {
.id_table = snd_acp3x_ids,
.probe = snd_acp3x_probe,
.remove = snd_acp3x_remove,
+ .driver = {
+ .pm = &acp3x_pm,
+ }
};
module_pci_driver(acp3x_driver);
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel