All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Mukunda, Vijendar" <Vijendar.Mukunda@amd.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	Alex Deucher <alexdeucher@gmail.com>
Cc: Takashi Iwai <tiwai@suse.de>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>
Subject: RE: [PATCH v2 09/14] ASoC: amd: add Renoir ACP PCI driver PM ops
Date: Tue, 12 May 2020 19:54:34 +0000	[thread overview]
Message-ID: <BYAPR12MB2632FF6DE6FBA71764F40E1197BE0@BYAPR12MB2632.namprd12.prod.outlook.com> (raw)
In-Reply-To: <565ebd07-e515-c84c-f4c5-7997dbac308b@linux.intel.com>



> -----Original Message-----
> From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Sent: Tuesday, May 12, 2020 8:46 PM
> To: Alex Deucher <alexdeucher@gmail.com>
> Cc: Takashi Iwai <tiwai@suse.de>; Deucher, Alexander
> <Alexander.Deucher@amd.com>; alsa-devel@alsa-project.org; Mark Brown
> <broonie@kernel.org>; Mukunda, Vijendar <Vijendar.Mukunda@amd.com>
> Subject: Re: [PATCH v2 09/14] ASoC: amd: add Renoir ACP PCI driver PM ops
> 
> 
> 
> On 5/12/20 8:46 AM, Alex Deucher wrote:
> > On Mon, May 11, 2020 at 6:37 PM Pierre-Louis Bossart
> > <pierre-louis.bossart@linux.intel.com> wrote:
> >>
> >>
> >>> @@ -233,6 +234,11 @@ static int snd_rn_acp_probe(struct pci_dev *pci,
> >>>                ret = PTR_ERR(adata->pdev);
> >>>                goto unregister_devs;
> >>>        }
> >>> +     pm_runtime_set_autosuspend_delay(&pci->dev,
> ACP_SUSPEND_DELAY_MS);
> >>> +     pm_runtime_use_autosuspend(&pci->dev);
> >>> +     pm_runtime_allow(&pci->dev);
> >>> +     pm_runtime_mark_last_busy(&pci->dev);
> >>> +     pm_runtime_put_autosuspend(&pci->dev);
> >>
> >> usually there is a pm_runtime_put_noidle() here?
> >
> > I'm not sure.
> >
> >>
> >> [...]
> >>
> >>>    static void snd_rn_acp_remove(struct pci_dev *pci)
> >>>    {
> >>>        struct acp_dev_data *adata;
> >>> @@ -260,6 +302,9 @@ static void snd_rn_acp_remove(struct pci_dev
> *pci)
> >>>        ret = rn_acp_deinit(adata->acp_base);
> >>>        if (ret)
> >>>                dev_err(&pci->dev, "ACP de-init failed\n");
> >>> +     pm_runtime_put_noidle(&pci->dev);
> >>> +     pm_runtime_get_sync(&pci->dev);
> >>> +     pm_runtime_forbid(&pci->dev);
> >>
> >> doing a put_noidle() followed by a get_sync() and immediately forbid()
> >> is very odd at best.
> >> Isn't the recommendation to call get_noresume() here?
> >>
> >
> > I'm not sure here either.  Is there some definitive documentation on
> > what exact sequences are supposed to be used in drivers?  A quick
> > browse through drivers that implement runtime pm seems to show a lot
> > of variation.  This sequence works.  I'm not sure if it's optimal or
> > not.
> 
> We based our sequence on the comments in drivers/pci/pci-driver.c
> 
> /*
>   * Unbound PCI devices are always put in D0, regardless of
>   * runtime PM status.  During probe, the device is set to
>   * active and the usage count is incremented.  If the driver
>   * supports runtime PM, it should call pm_runtime_put_noidle(),
>   * or any other runtime PM helper function decrementing the usage
>   * count, in its probe routine and pm_runtime_get_noresume() in
>   * its remove routine.
>   */

If I understood correctly, below should be  the correct sequence rite ?

acp pci driver probe sequence:

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);	
	
acp pci driver remove sequence:

pm_runtime_get_noresume(&pci->dev);
pm_runtime_disable(&pci->dev);

I have still have a doubt. 
Do we need to call pm_runtime_disable() explicitly  in this case ?


  reply	other threads:[~2020-05-12 19:55 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 21:20 [PATCH v2 00/14] Add Renoir ACP driver Alex Deucher
2020-05-11 21:20 ` [PATCH v2 01/14] ASoC: amd: add Renoir ACP3x IP register header Alex Deucher
2020-05-11 21:20 ` [PATCH v2 02/14] ASoC: amd: add Renoir ACP PCI driver Alex Deucher
2020-05-11 21:20 ` [PATCH v2 03/14] ASoC: amd: add acp init/de-init functions Alex Deucher
2020-05-11 21:20 ` [PATCH v2 04/14] ASoC: amd: create acp3x pdm platform device Alex Deucher
2020-05-11 21:20 ` [PATCH v2 05/14] ASoC: amd: add ACP3x PDM platform driver Alex Deucher
2020-05-11 21:20 ` [PATCH v2 06/14] ASoC: amd: irq handler changes for ACP3x PDM dma driver Alex Deucher
2020-05-11 21:20 ` [PATCH v2 07/14] ASoC: amd: add acp3x pdm driver dma ops Alex Deucher
2020-05-11 21:20 ` [PATCH v2 08/14] ASoC: amd: add ACP PDM DMA driver dai ops Alex Deucher
2020-05-11 22:12   ` Pierre-Louis Bossart
2020-05-12 16:15     ` Mukunda, Vijendar
2020-05-11 21:20 ` [PATCH v2 09/14] ASoC: amd: add Renoir ACP PCI driver PM ops Alex Deucher
2020-05-11 22:28   ` Pierre-Louis Bossart
2020-05-12 13:46     ` Alex Deucher
2020-05-12 15:16       ` Pierre-Louis Bossart
2020-05-12 19:54         ` Mukunda, Vijendar [this message]
2020-05-12 20:36           ` Pierre-Louis Bossart
2020-05-13 17:44             ` Mukunda, Vijendar
2020-05-11 21:20 ` [PATCH v2 10/14] ASoC: amd: add ACP PDM DMA driver pm ops Alex Deucher
2020-05-11 21:20 ` [PATCH v2 11/14] ASoC: amd: enable Renoir acp3x drivers build Alex Deucher
2020-05-11 21:20 ` [PATCH v2 12/14] ASoC: amd: create platform devices for Renoir Alex Deucher
2020-05-11 21:20 ` [PATCH v2 13/14] ASoC: amd: RN machine driver using dmic Alex Deucher
2020-05-11 22:37   ` Pierre-Louis Bossart
2020-05-12 14:22     ` Mukunda, Vijendar
2020-05-11 21:20 ` [PATCH v2 14/14] ASoC: amd: enable build for RN machine driver Alex Deucher

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=BYAPR12MB2632FF6DE6FBA71764F40E1197BE0@BYAPR12MB2632.namprd12.prod.outlook.com \
    --to=vijendar.mukunda@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=alexdeucher@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.