mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: <Claudiu.Beznea@microchip.com>
To: <Syed.SabaKareem@amd.com>, <broonie@kernel.org>,
	<alsa-devel@alsa-project.org>
Cc: <Vijendar.Mukunda@amd.com>, <Basavaraj.Hiregoudar@amd.com>,
	<Sunil-kumar.Dommati@amd.com>, <lgirdwood@gmail.com>,
	<perex@perex.cz>, <tiwai@suse.com>, <yangyingliang@huawei.com>,
	<venkataprasad.potturu@amd.com>, <ye.xingchen@zte.com.cn>,
	<Vsujithkumar.Reddy@amd.com>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 05/10] ASoC: amd: acp: add pm ops support for acp pci driver
Date: Tue, 27 Jun 2023 04:52:24 +0000	[thread overview]
Message-ID: <d7f6c2e7-8c22-c33f-b354-30da6519c4d1@microchip.com> (raw)
In-Reply-To: <20230626135515.1252063-6-Syed.SabaKareem@amd.com>

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
> 


  reply	other threads:[~2023-06-27  4:52 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20230626135515.1252063-1-Syed.SabaKareem@amd.com>
2023-06-26 13:55 ` [PATCH v2 01/10] ASoC: amd: acp: refactor the acp init and de-init sequence Syed Saba Kareem
2023-06-26 13:55 ` [PATCH v2 02/10] ASoC: amd: acp: add acp i2s master clock generation for rembrandt platform Syed Saba Kareem
2023-06-26 13:55 ` [PATCH v2 03/10] ASoC: amd: acp: remove the redundant acp enable/disable interrupts functions Syed Saba Kareem
2023-06-26 13:55 ` [PATCH v2 04/10] ASoC: amd: acp: store platform device reference created in pci probe call Syed Saba Kareem
2023-06-26 13:55 ` [PATCH v2 05/10] ASoC: amd: acp: add pm ops support for acp pci driver Syed Saba Kareem
2023-06-27  4:52   ` Claudiu.Beznea [this message]
2023-06-26 13:55 ` [PATCH v2 06/10] ASoC: amd: acp: store xfer_resolution of the stream Syed Saba Kareem
2023-06-26 13:55 ` [PATCH v2 07/10] ASoC: amd: acp: export config_acp_dma() and config_pte_for_stream() symbols Syed Saba Kareem
2023-06-26 13:55 ` [PATCH v2 08/10] ASoC: amd: acp: store the pdm stream channel mask Syed Saba Kareem
2023-06-26 13:55 ` [PATCH v2 09/10] ASoC: amd: acp: move pdm macros to common header file Syed Saba Kareem
2023-06-26 13:55 ` [PATCH v2 10/10] ASoC: amd: acp: add pm ops support for rembrandt platform Syed Saba Kareem

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7f6c2e7-8c22-c33f-b354-30da6519c4d1@microchip.com \
    --to=claudiu.beznea@microchip.com \
    --cc=Basavaraj.Hiregoudar@amd.com \
    --cc=Sunil-kumar.Dommati@amd.com \
    --cc=Syed.SabaKareem@amd.com \
    --cc=Vijendar.Mukunda@amd.com \
    --cc=Vsujithkumar.Reddy@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=venkataprasad.potturu@amd.com \
    --cc=yangyingliang@huawei.com \
    --cc=ye.xingchen@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®