Message ID | 20230626135515.1252063-1-Syed.SabaKareem@amd.com |
---|---|
Headers | show |
Series | Refactor acp legacy driver and add | expand |
On 26.06.2023 16:55, Syed Saba Kareem wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe > > Add pm ops support for common acp pci driver. > > Signed-off-by: Syed Saba Kareem <Syed.SabaKareem@amd.com> > --- > sound/soc/amd/acp/acp-pci.c | 46 +++++++++++++++++++++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c > index 4fedad1b740e..a32c14a109b7 100644 > --- a/sound/soc/amd/acp/acp-pci.c > +++ b/sound/soc/amd/acp/acp-pci.c > @@ -16,6 +16,7 @@ > #include <linux/pci.h> > #include <linux/platform_device.h> > #include <linux/module.h> > +#include <linux/pm_runtime.h> > > #include "amd.h" > #include "../mach-config.h" > @@ -141,6 +142,11 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id > goto unregister_dmic_dev; > } > chip->chip_pdev = pdev; > + dev_set_drvdata(&pci->dev, chip); > + pm_runtime_set_autosuspend_delay(&pci->dev, 2000); > + pm_runtime_use_autosuspend(&pci->dev); > + pm_runtime_put_noidle(&pci->dev); > + pm_runtime_allow(&pci->dev); > return ret; > > unregister_dmic_dev: > @@ -153,12 +159,49 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id > return ret; > }; > > +static int __maybe_unused snd_acp_suspend(struct device *dev) You can get rid of __maybe_unused here if (see below) > +{ > + struct acp_chip_info *chip; > + int ret; > + > + chip = dev_get_drvdata(dev); > + ret = acp_deinit(chip->base); > + if (ret) > + dev_err(dev, "ACP de-init failed\n"); > + return ret; > +} > + > +static int __maybe_unused snd_acp_resume(struct device *dev) (same here) > +{ > + struct acp_chip_info *chip; > + struct acp_dev_data *adata; > + struct device child; > + int ret; > + > + chip = dev_get_drvdata(dev); > + ret = acp_init(chip); > + if (ret) > + dev_err(dev, "ACP init failed\n"); > + child = chip->chip_pdev->dev; > + adata = dev_get_drvdata(&child); > + if (adata) > + acp_enable_interrupts(adata); > + return ret; > +} > + > +static const struct dev_pm_ops acp_pm_ops = { > + SET_RUNTIME_PM_OPS(snd_acp_suspend, snd_acp_resume, NULL) you use RUNTIME_PM_OPS() > + SET_SYSTEM_SLEEP_PM_OPS(snd_acp_suspend, snd_acp_resume) and SYSTEM_SLEEP_PM_OPS() > +}; > + > static void acp_pci_remove(struct pci_dev *pci) > { > struct acp_chip_info *chip; > int ret; > > chip = pci_get_drvdata(pci); > + pm_runtime_forbid(&pci->dev); > + pm_runtime_get_noresume(&pci->dev); > if (dmic_dev) > platform_device_unregister(dmic_dev); > if (pdev) > @@ -181,6 +224,9 @@ static struct pci_driver snd_amd_acp_pci_driver = { > .id_table = acp_pci_ids, > .probe = acp_pci_probe, > .remove = acp_pci_remove, > + .driver = { > + .pm = &acp_pm_ops, You can use pm_ptr()/pm_sleep_ptr() > + }, > }; > module_pci_driver(snd_amd_acp_pci_driver); > > -- > 2.25.1 >
On 6/27/23 10:22, Claudiu.Beznea@microchip.com wrote: > On 26.06.2023 16:55, Syed Saba Kareem wrote: >> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe >> >> Add pm ops support for common acp pci driver. >> >> Signed-off-by: Syed Saba Kareem<Syed.SabaKareem@amd.com> >> --- >> sound/soc/amd/acp/acp-pci.c | 46 +++++++++++++++++++++++++++++++++++++ >> 1 file changed, 46 insertions(+) >> >> diff --git a/sound/soc/amd/acp/acp-pci.c b/sound/soc/amd/acp/acp-pci.c >> index 4fedad1b740e..a32c14a109b7 100644 >> --- a/sound/soc/amd/acp/acp-pci.c >> +++ b/sound/soc/amd/acp/acp-pci.c >> @@ -16,6 +16,7 @@ >> #include <linux/pci.h> >> #include <linux/platform_device.h> >> #include <linux/module.h> >> +#include <linux/pm_runtime.h> >> >> #include "amd.h" >> #include "../mach-config.h" >> @@ -141,6 +142,11 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id >> goto unregister_dmic_dev; >> } >> chip->chip_pdev = pdev; >> + dev_set_drvdata(&pci->dev, chip); >> + pm_runtime_set_autosuspend_delay(&pci->dev, 2000); >> + pm_runtime_use_autosuspend(&pci->dev); >> + pm_runtime_put_noidle(&pci->dev); >> + pm_runtime_allow(&pci->dev); >> return ret; >> >> unregister_dmic_dev: >> @@ -153,12 +159,49 @@ static int acp_pci_probe(struct pci_dev *pci, const struct pci_device_id *pci_id >> return ret; >> }; >> >> +static int __maybe_unused snd_acp_suspend(struct device *dev) > You can get rid of __maybe_unused here if (see below) > >> +{ >> + struct acp_chip_info *chip; >> + int ret; >> + >> + chip = dev_get_drvdata(dev); >> + ret = acp_deinit(chip->base); >> + if (ret) >> + dev_err(dev, "ACP de-init failed\n"); >> + return ret; >> +} >> + >> +static int __maybe_unused snd_acp_resume(struct device *dev) > (same here) > >> +{ >> + struct acp_chip_info *chip; >> + struct acp_dev_data *adata; >> + struct device child; >> + int ret; >> + >> + chip = dev_get_drvdata(dev); >> + ret = acp_init(chip); >> + if (ret) >> + dev_err(dev, "ACP init failed\n"); >> + child = chip->chip_pdev->dev; >> + adata = dev_get_drvdata(&child); >> + if (adata) >> + acp_enable_interrupts(adata); >> + return ret; >> +} >> + >> +static const struct dev_pm_ops acp_pm_ops = { >> + SET_RUNTIME_PM_OPS(snd_acp_suspend, snd_acp_resume, NULL) > you use RUNTIME_PM_OPS() > >> + SET_SYSTEM_SLEEP_PM_OPS(snd_acp_suspend, snd_acp_resume) > and SYSTEM_SLEEP_PM_OPS() > >> +}; >> + >> static void acp_pci_remove(struct pci_dev *pci) >> { >> struct acp_chip_info *chip; >> int ret; >> >> chip = pci_get_drvdata(pci); >> + pm_runtime_forbid(&pci->dev); >> + pm_runtime_get_noresume(&pci->dev); >> if (dmic_dev) >> platform_device_unregister(dmic_dev); >> if (pdev) >> @@ -181,6 +224,9 @@ static struct pci_driver snd_amd_acp_pci_driver = { >> .id_table = acp_pci_ids, >> .probe = acp_pci_probe, >> .remove = acp_pci_remove, >> + .driver = { >> + .pm = &acp_pm_ops, > You can use pm_ptr()/pm_sleep_ptr() > >> + }, >> }; >> module_pci_driver(snd_amd_acp_pci_driver); >> >> -- >> 2.25.1 >> > Could you please help me to point out is there any issue with the > current implementation.
On Mon, 26 Jun 2023 19:25:04 +0530, Syed Saba Kareem wrote: > This patch series to refactor acp leagacy driver and add pm ops > support for rembrandt platforms. > > Changes since V1 > - Fix below kernel test robot errors and warnings > > - ld.lld: error: undefined symbol: acp_enable_interrupts > - referenced by acp-renoir.c:191 (sound/soc/amd/acp/acp-renoir.c:191) > - ld.lld: error: undefined symbol: acp_disable_interrupts > - sound/soc/amd/acp/acp-renoir.o:(renoir_audio_remove) in archive vmlinux.a > > [...] Applied to https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next Thanks! [01/10] ASoC: amd: acp: refactor the acp init and de-init sequence commit: e61b415515d3db57dce3af3e4a0441f08d8d8f15 [02/10] ASoC: amd: acp: add acp i2s master clock generation for rembrandt platform commit: 7ad6fb9dd1ca63f9f36e413036f36f075cdaec4a [03/10] ASoC: amd: acp: remove the redundant acp enable/disable interrupts functions commit: fc11d3266dc7ed386efe91c20d09780bbded1f03 [04/10] ASoC: amd: acp: store platform device reference created in pci probe call commit: 7a83903022dc3bd5214f6bdde8132c66015ab538 [05/10] ASoC: amd: acp: add pm ops support for acp pci driver commit: 088a40980efbc2c449b72f0f2c7ebd82f71d08e2 [06/10] ASoC: amd: acp: store xfer_resolution of the stream commit: c8786ac7bb374276b1c2b545b4a6be3b230be7cb [07/10] ASoC: amd: acp: export config_acp_dma() and config_pte_for_stream() symbols commit: a8d1316a264f36c2ffe798e42d6b415dc377851e [08/10] ASoC: amd: acp: store the pdm stream channel mask commit: 7373e6bee60cdac36a134897164885b2257a02ac [09/10] ASoC: amd: acp: move pdm macros to common header file commit: e3a96e441e05bbf599ce70c2a03e7acd55b275ee [10/10] ASoC: amd: acp: add pm ops support for rembrandt platform commit: 5debf4ae138c81321832d41203483696cac1c580 All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark