[4/5] ASoC: amd: added pmops for pci driver
diff mbox series

Message ID 1569539290-756-4-git-send-email-Vishnuvardhanrao.Ravulapati@amd.com
State New
Headers show
Series
  • [1/5] ASoC: amd: Registering device endpoints using MFD framework
Related show

Commit Message

Ravulapati Vishnu vardhan rao Sept. 26, 2019, 11:07 p.m. UTC
Runtime powermanagement is added for PCI driver.
When there is no activity for at least 10 secs driver
suspends automatically.Runtime- Suspend and resume Stub functions
are added.

Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Reviewed-by: Vijendar Mukunda <vijendar.mukunda@amd.com>
---
 sound/soc/amd/raven/pci-acp3x.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Mark Brown Sept. 26, 2019, 6:24 p.m. UTC | #1
On Fri, Sep 27, 2019 at 04:37:38AM +0530, Ravulapati Vishnu vardhan rao wrote:

> +static int  snd_acp3x_suspend(struct device *dev)
> +{
> +	return 0;
> +}
> +
> +static int  snd_acp3x_resume(struct device *dev)
> +{
> +	return 0;
> +}
> +
> +static const struct dev_pm_ops acp3x_pm = {
> +	.runtime_suspend = snd_acp3x_suspend,
> +	.runtime_resume =  snd_acp3x_resume,
> +	.resume	=	snd_acp3x_resume,
> +
> +};

These operations are empty so they should just be removed.
vishnu Sept. 30, 2019, 11:30 a.m. UTC | #2
Hi Mark,

Thanks for your suggestions.
Please ignore all the patches.I will address all the inputs shared by 
you and resend them.

Thanks,
Vishnu

On 26/09/19 11:54 PM, Mark Brown wrote:
> On Fri, Sep 27, 2019 at 04:37:38AM +0530, Ravulapati Vishnu vardhan rao wrote:
> 
>> +static int  snd_acp3x_suspend(struct device *dev)
>> +{
>> +	return 0;
>> +}
>> +
>> +static int  snd_acp3x_resume(struct device *dev)
>> +{
>> +	return 0;
>> +}
>> +
>> +static const struct dev_pm_ops acp3x_pm = {
>> +	.runtime_suspend = snd_acp3x_suspend,
>> +	.runtime_resume =  snd_acp3x_resume,
>> +	.resume	=	snd_acp3x_resume,
>> +
>> +};
> 
> These operations are empty so they should just be removed.
>

Patch
diff mbox series

diff --git a/sound/soc/amd/raven/pci-acp3x.c b/sound/soc/amd/raven/pci-acp3x.c
index c0b8fad..6fbb720 100644
--- a/sound/soc/amd/raven/pci-acp3x.c
+++ b/sound/soc/amd/raven/pci-acp3x.c
@@ -170,6 +170,11 @@  static int snd_acp3x_probe(struct pci_dev *pci,
 		ret = -ENODEV;
 		goto unmap_mmio;
 	}
+	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:
@@ -189,6 +194,23 @@  static int snd_acp3x_probe(struct pci_dev *pci,
 	return -ENODEV;
 }
 
+static int  snd_acp3x_suspend(struct device *dev)
+{
+	return 0;
+}
+
+static int  snd_acp3x_resume(struct device *dev)
+{
+	return 0;
+}
+
+static const struct dev_pm_ops acp3x_pm = {
+	.runtime_suspend = snd_acp3x_suspend,
+	.runtime_resume =  snd_acp3x_resume,
+	.resume	=	snd_acp3x_resume,
+
+};
+
 static void snd_acp3x_remove(struct pci_dev *pci)
 {
 	struct acp3x_dev_data *adata = pci_get_drvdata(pci);
@@ -196,6 +218,8 @@  static void snd_acp3x_remove(struct pci_dev *pci)
 	kfree(adata->res);
 	kfree(adata->cell);
 	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);
@@ -214,6 +238,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);