mirror of
https://github.com/torvalds/linux.git
synced 2024-12-29 14:21:47 +00:00
ASoC: amd: add Renoir ACP PCI driver PM ops
Add Renoir ACP Pci driver pm ops. Signed-off-by: Vijendar Mukunda <Vijendar.Mukunda@amd.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20200518171704.24999-10-Vijendar.Mukunda@amd.com Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
370e7dde5b
commit
c346e768f9
@ -10,6 +10,7 @@
|
|||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
#include <linux/pm_runtime.h>
|
||||||
|
|
||||||
#include "rn_acp3x.h"
|
#include "rn_acp3x.h"
|
||||||
|
|
||||||
@ -233,6 +234,10 @@ static int snd_rn_acp_probe(struct pci_dev *pci,
|
|||||||
ret = PTR_ERR(adata->pdev);
|
ret = PTR_ERR(adata->pdev);
|
||||||
goto unregister_devs;
|
goto unregister_devs;
|
||||||
}
|
}
|
||||||
|
pm_runtime_set_autosuspend_delay(&pci->dev, ACP_SUSPEND_DELAY_MS);
|
||||||
|
pm_runtime_use_autosuspend(&pci->dev);
|
||||||
|
pm_runtime_put_noidle(&pci->dev);
|
||||||
|
pm_runtime_allow(&pci->dev);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
unregister_devs:
|
unregister_devs:
|
||||||
@ -250,6 +255,42 @@ disable_pci:
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int snd_rn_acp_suspend(struct device *dev)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct acp_dev_data *adata;
|
||||||
|
|
||||||
|
adata = dev_get_drvdata(dev);
|
||||||
|
ret = rn_acp_deinit(adata->acp_base);
|
||||||
|
if (ret)
|
||||||
|
dev_err(dev, "ACP de-init failed\n");
|
||||||
|
else
|
||||||
|
dev_dbg(dev, "ACP de-initialized\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int snd_rn_acp_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
struct acp_dev_data *adata;
|
||||||
|
|
||||||
|
adata = dev_get_drvdata(dev);
|
||||||
|
ret = rn_acp_init(adata->acp_base);
|
||||||
|
if (ret) {
|
||||||
|
dev_err(dev, "ACP init failed\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct dev_pm_ops rn_acp_pm = {
|
||||||
|
.runtime_suspend = snd_rn_acp_suspend,
|
||||||
|
.runtime_resume = snd_rn_acp_resume,
|
||||||
|
.suspend = snd_rn_acp_suspend,
|
||||||
|
.resume = snd_rn_acp_resume,
|
||||||
|
};
|
||||||
|
|
||||||
static void snd_rn_acp_remove(struct pci_dev *pci)
|
static void snd_rn_acp_remove(struct pci_dev *pci)
|
||||||
{
|
{
|
||||||
struct acp_dev_data *adata;
|
struct acp_dev_data *adata;
|
||||||
@ -260,6 +301,8 @@ static void snd_rn_acp_remove(struct pci_dev *pci)
|
|||||||
ret = rn_acp_deinit(adata->acp_base);
|
ret = rn_acp_deinit(adata->acp_base);
|
||||||
if (ret)
|
if (ret)
|
||||||
dev_err(&pci->dev, "ACP de-init failed\n");
|
dev_err(&pci->dev, "ACP de-init failed\n");
|
||||||
|
pm_runtime_forbid(&pci->dev);
|
||||||
|
pm_runtime_get_noresume(&pci->dev);
|
||||||
pci_disable_msi(pci);
|
pci_disable_msi(pci);
|
||||||
pci_release_regions(pci);
|
pci_release_regions(pci);
|
||||||
pci_disable_device(pci);
|
pci_disable_device(pci);
|
||||||
@ -278,6 +321,9 @@ static struct pci_driver rn_acp_driver = {
|
|||||||
.id_table = snd_rn_acp_ids,
|
.id_table = snd_rn_acp_ids,
|
||||||
.probe = snd_rn_acp_probe,
|
.probe = snd_rn_acp_probe,
|
||||||
.remove = snd_rn_acp_remove,
|
.remove = snd_rn_acp_remove,
|
||||||
|
.driver = {
|
||||||
|
.pm = &rn_acp_pm,
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
module_pci_driver(rn_acp_driver);
|
module_pci_driver(rn_acp_driver);
|
||||||
|
@ -40,6 +40,8 @@
|
|||||||
#define TWO_CH 0x02
|
#define TWO_CH 0x02
|
||||||
#define DELAY_US 5
|
#define DELAY_US 5
|
||||||
#define ACP_COUNTER 20000
|
#define ACP_COUNTER 20000
|
||||||
|
/* time in ms for runtime suspend delay */
|
||||||
|
#define ACP_SUSPEND_DELAY_MS 2000
|
||||||
|
|
||||||
#define ACP_SRAM_PTE_OFFSET 0x02050000
|
#define ACP_SRAM_PTE_OFFSET 0x02050000
|
||||||
#define PAGE_SIZE_4K_ENABLE 0x2
|
#define PAGE_SIZE_4K_ENABLE 0x2
|
||||||
|
Loading…
Reference in New Issue
Block a user