Message ID | 1548092497-5459-8-git-send-email-spujar@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Runtime PM support (hda/tegra) | expand |
On Mon, 21 Jan 2019 18:41:37 +0100, Sameer Pujar wrote: > > AZX_DCAPS_PM_RUNTIME flag is added to indicate support for runtime PM. > azx_has_pm_runtime() can be called to check if above is enabled. The > flag is put under CONFIG_PM check. > > Signed-off-by: Sameer Pujar <spujar@nvidia.com> > Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> > Reviewed-by: Mohan Kumar D <mkumard@nvidia.com> This can be more simply done in hda_controller.h. Namely, a change like: --- a/sound/pci/hda/hda_controller.h +++ b/sound/pci/hda/hda_controller.h @@ -49,7 +49,11 @@ #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */ /* 24 unused */ #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ +#ifdef CONFIG_PM #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ +#else +#define AZX_DCAPS_PM_RUNTIME 0 /* N/A */ +#endif /* 27 unused */ #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ thanks, Takashi
On 1/22/2019 3:01 AM, Takashi Iwai wrote: > On Mon, 21 Jan 2019 18:41:37 +0100, > Sameer Pujar wrote: >> AZX_DCAPS_PM_RUNTIME flag is added to indicate support for runtime PM. >> azx_has_pm_runtime() can be called to check if above is enabled. The >> flag is put under CONFIG_PM check. >> >> Signed-off-by: Sameer Pujar <spujar@nvidia.com> >> Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> >> Reviewed-by: Mohan Kumar D <mkumard@nvidia.com> > This can be more simply done in hda_controller.h. Namely, a change > like: > > --- a/sound/pci/hda/hda_controller.h > +++ b/sound/pci/hda/hda_controller.h > @@ -49,7 +49,11 @@ > #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */ > /* 24 unused */ > #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ > +#ifdef CONFIG_PM > #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ > +#else > +#define AZX_DCAPS_PM_RUNTIME 0 /* N/A */ > +#endif > /* 27 unused */ > #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ > #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ In one of the patches in the series, I am using azx_has_pm_runtime() to forbid runtime PM calls. I can use above as you suggested. Along with this, I would need to populate chip->driver_caps with above flag. Something like below, --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -521,7 +521,8 @@ MODULE_DEVICE_TABLE(of, hda_tegra_match); static int hda_tegra_probe(struct platform_device *pdev) { - unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR; + unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR | + AZX_DCAPS_PM_RUNTIME; struct snd_card *card; struct azx *chip; struct hda_tegra *hda; Thanks, Sameer. > > thanks, > > Takashi ----------------------------------------------------------------------------------- This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. -----------------------------------------------------------------------------------
On Tue, 22 Jan 2019 03:04:21 +0100, Sameer Pujar wrote: > > > On 1/22/2019 3:01 AM, Takashi Iwai wrote: > > On Mon, 21 Jan 2019 18:41:37 +0100, > > Sameer Pujar wrote: > >> AZX_DCAPS_PM_RUNTIME flag is added to indicate support for runtime PM. > >> azx_has_pm_runtime() can be called to check if above is enabled. The > >> flag is put under CONFIG_PM check. > >> > >> Signed-off-by: Sameer Pujar <spujar@nvidia.com> > >> Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> > >> Reviewed-by: Mohan Kumar D <mkumard@nvidia.com> > > This can be more simply done in hda_controller.h. Namely, a change > > like: > > > > --- a/sound/pci/hda/hda_controller.h > > +++ b/sound/pci/hda/hda_controller.h > > @@ -49,7 +49,11 @@ > > #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */ > > /* 24 unused */ > > #define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */ > > +#ifdef CONFIG_PM > > #define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ > > +#else > > +#define AZX_DCAPS_PM_RUNTIME 0 /* N/A */ > > +#endif > > /* 27 unused */ > > #define AZX_DCAPS_CORBRP_SELF_CLEAR (1 << 28) /* CORBRP clears itself after reset */ > > #define AZX_DCAPS_NO_MSI64 (1 << 29) /* Stick to 32-bit MSIs */ > > In one of the patches in the series, I am using azx_has_pm_runtime() > to forbid runtime PM calls. > I can use above as you suggested. Along with this, I would need to > populate chip->driver_caps with > above flag. Something like below, > > --- a/sound/pci/hda/hda_tegra.c > +++ b/sound/pci/hda/hda_tegra.c > @@ -521,7 +521,8 @@ MODULE_DEVICE_TABLE(of, hda_tegra_match); > > static int hda_tegra_probe(struct platform_device *pdev) > { > - unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR; > + unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR | > + AZX_DCAPS_PM_RUNTIME; > struct snd_card *card; > struct azx *chip; > struct hda_tegra *hda; I see. On the second thought, the ifdef CONFIG_PM is likely superfluous. The whole pm_runtime_*() calls become no-ops without CONFIG_PM, so the compiler would optimize in anyway. That said, I'd drop ugly ifdef but unconditionally add AZX_DCAPS_PM_RUNTIME in an oneliner above. thanks, Takashi
diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 80c4042..80b7a3b 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -521,12 +521,16 @@ MODULE_DEVICE_TABLE(of, hda_tegra_match); static int hda_tegra_probe(struct platform_device *pdev) { - const unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR; + unsigned int driver_flags = AZX_DCAPS_CORBRP_SELF_CLEAR; struct snd_card *card; struct azx *chip; struct hda_tegra *hda; int err; +#ifdef CONFIG_PM + driver_flags |= AZX_DCAPS_PM_RUNTIME; +#endif + hda = devm_kzalloc(&pdev->dev, sizeof(*hda), GFP_KERNEL); if (!hda) return -ENOMEM;