[alsa-devel] [PATCH 0/4] add runtime pm support for AMD display audio
These patches were originally part of a larger set of patches to enabled runtime pm support on the GPU side[1]. However, the patches are useful on their own there are really no dependencies, other than the fact that you need both for runtime pm to kick in on the GPU side. The GPU side will be landing for 5.6; I'd like to land the audio side as well.
Thanks,
Alex
[1]: https://patchwork.freedesktop.org/series/67885/
Alex Deucher (4): ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD ALSA: hda/hdmi - Add new pci ids for AMD GPU display audio ALSA: hda/hdmi - enable runtime pm for newer AMD display audio ALSA: hda/hdmi - enable automatic runtime pm for AMD HDMI codecs by default
sound/pci/hda/hda_intel.c | 80 +++++++++++++++++++++++++++++++++++--- sound/pci/hda/patch_hdmi.c | 1 + 2 files changed, 76 insertions(+), 5 deletions(-)
Only enable the vga_switcheroo logic on systems with the ATPX ACPI method. This logic is not needed for asics that are not part of a PX (PowerXpress)/HG (Hybrid Graphics) platform.
Reviewed-by: Takashi Iwai tiwai@suse.de Acked-by: Evan Quan evan.quan@amd.com Signed-off-by: Alex Deucher alexander.deucher@amd.com --- sound/pci/hda/hda_intel.c | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 240f4ca76391..3ebc7b2a897f 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -35,6 +35,7 @@ #include <linux/clocksource.h> #include <linux/time.h> #include <linux/completion.h> +#include <linux/acpi.h>
#ifdef CONFIG_X86 /* for snoop control */ @@ -1393,6 +1394,34 @@ static int azx_dev_free(struct snd_device *device) }
#ifdef SUPPORT_VGA_SWITCHEROO +#ifdef CONFIG_ACPI +/* ATPX is in the integrated GPU's namespace */ +static bool atpx_present(void) +{ + struct pci_dev *pdev = NULL; + acpi_handle dhandle, atpx_handle; + acpi_status status; + + while ((pdev = pci_get_class(PCI_BASE_CLASS_DISPLAY << 16, pdev)) != NULL) { + dhandle = ACPI_HANDLE(&pdev->dev); + if (dhandle) { + status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); + if (!ACPI_FAILURE(status)) { + pci_dev_put(pdev); + return true; + } + } + pci_dev_put(pdev); + } + return false; +} +#else +static bool atpx_present(void) +{ + return false; +} +#endif + /* * Check of disabled HDMI controller by vga_switcheroo */ @@ -1404,6 +1433,22 @@ static struct pci_dev *get_bound_vga(struct pci_dev *pci) switch (pci->vendor) { case PCI_VENDOR_ID_ATI: case PCI_VENDOR_ID_AMD: + if (pci->devfn == 1) { + p = pci_get_domain_bus_and_slot(pci_domain_nr(pci->bus), + pci->bus->number, 0); + if (p) { + /* ATPX is in the integrated GPU's ACPI namespace + * rather than the dGPU's namespace. However, + * the dGPU is the one who is involved in + * vgaswitcheroo. + */ + if (((p->class >> 16) == PCI_BASE_CLASS_DISPLAY) && + atpx_present()) + return p; + pci_dev_put(p); + } + } + break; case PCI_VENDOR_ID_NVIDIA: if (pci->devfn == 1) { p = pci_get_domain_bus_and_slot(pci_domain_nr(pci->bus),
These are needed so we can enable runtime pm in a subsequent patch.
Reviewed-by: Takashi Iwai tiwai@suse.de Signed-off-by: Alex Deucher alexander.deucher@amd.com --- sound/pci/hda/hda_intel.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 3ebc7b2a897f..79ca97d6c811 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2606,6 +2606,20 @@ static const struct pci_device_id azx_ids[] = { .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, { PCI_DEVICE(0x1002, 0xaaf0), .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + { PCI_DEVICE(0x1002, 0xaaf8), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + { PCI_DEVICE(0x1002, 0xab00), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + { PCI_DEVICE(0x1002, 0xab08), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + { PCI_DEVICE(0x1002, 0xab10), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + { PCI_DEVICE(0x1002, 0xab18), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + { PCI_DEVICE(0x1002, 0xab20), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + { PCI_DEVICE(0x1002, 0xab38), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, /* VIA VT8251/VT8237A */ { PCI_DEVICE(0x1106, 0x3288), .driver_data = AZX_DRIVER_VIA }, /* VIA GFX VT7122/VX900 */
We are able to power down the GPU and audio via the GPU driver so flag these asics as supporting runtime pm.
Reviewed-by: Takashi Iwai tiwai@suse.de Acked-by: Evan Quan evan.quan@amd.com Signed-off-by: Alex Deucher alexander.deucher@amd.com --- sound/pci/hda/hda_intel.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 79ca97d6c811..111b9a869162 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2599,27 +2599,38 @@ static const struct pci_device_id azx_ids[] = { { PCI_DEVICE(0x1002, 0xaac8), .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, { PCI_DEVICE(0x1002, 0xaad8), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, - { PCI_DEVICE(0x1002, 0xaae8), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, { PCI_DEVICE(0x1002, 0xaae0), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, + { PCI_DEVICE(0x1002, 0xaae8), + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, { PCI_DEVICE(0x1002, 0xaaf0), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, { PCI_DEVICE(0x1002, 0xaaf8), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, { PCI_DEVICE(0x1002, 0xab00), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, { PCI_DEVICE(0x1002, 0xab08), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, { PCI_DEVICE(0x1002, 0xab10), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, { PCI_DEVICE(0x1002, 0xab18), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, { PCI_DEVICE(0x1002, 0xab20), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, { PCI_DEVICE(0x1002, 0xab38), - .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS }, + .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS | + AZX_DCAPS_PM_RUNTIME }, /* VIA VT8251/VT8237A */ { PCI_DEVICE(0x1106, 0x3288), .driver_data = AZX_DRIVER_VIA }, /* VIA GFX VT7122/VX900 */
So that we can power down the GPU and audio to save power.
Reviewed-by: Takashi Iwai tiwai@suse.de Acked-by: Evan Quan evan.quan@amd.com Signed-off-by: Alex Deucher alexander.deucher@amd.com --- sound/pci/hda/patch_hdmi.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c index 795cbda32cbb..8785fcc850b9 100644 --- a/sound/pci/hda/patch_hdmi.c +++ b/sound/pci/hda/patch_hdmi.c @@ -3961,6 +3961,7 @@ static int atihdmi_init(struct hda_codec *codec) ATI_VERB_SET_MULTICHANNEL_MODE, ATI_MULTICHANNEL_MODE_SINGLE); } + codec->auto_runtime_pm = 1;
return 0; }
On Fri, 22 Nov 2019 22:43:49 +0100, Alex Deucher wrote:
These patches were originally part of a larger set of patches to enabled runtime pm support on the GPU side[1]. However, the patches are useful on their own there are really no dependencies, other than the fact that you need both for runtime pm to kick in on the GPU side. The GPU side will be landing for 5.6; I'd like to land the audio side as well.
Do you mean that these can go into 5.5-rc1, or they need waiting until 5.5-rc1 release? I guess these won't break things even without the runtime PM support in GPU side, as the ELD notification is done via audio component, so I'm fine to apply them at any time.
thanks,
Takashi
Thanks,
Alex
Alex Deucher (4): ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD ALSA: hda/hdmi - Add new pci ids for AMD GPU display audio ALSA: hda/hdmi - enable runtime pm for newer AMD display audio ALSA: hda/hdmi - enable automatic runtime pm for AMD HDMI codecs by default
sound/pci/hda/hda_intel.c | 80 +++++++++++++++++++++++++++++++++++--- sound/pci/hda/patch_hdmi.c | 1 + 2 files changed, 76 insertions(+), 5 deletions(-)
-- 2.23.0
On Sat, Nov 23, 2019 at 3:57 AM Takashi Iwai tiwai@suse.de wrote:
On Fri, 22 Nov 2019 22:43:49 +0100, Alex Deucher wrote:
These patches were originally part of a larger set of patches to enabled runtime pm support on the GPU side[1]. However, the patches are useful on their own there are really no dependencies, other than the fact that you need both for runtime pm to kick in on the GPU side. The GPU side will be landing for 5.6; I'd like to land the audio side as well.
Do you mean that these can go into 5.5-rc1, or they need waiting until 5.5-rc1 release? I guess these won't break things even without the runtime PM support in GPU side, as the ELD notification is done via audio component, so I'm fine to apply them at any time.
Up to you. I'm ok to wait for the next merge window if you'd prefer.
Alex
thanks,
Takashi
Thanks,
Alex
Alex Deucher (4): ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD ALSA: hda/hdmi - Add new pci ids for AMD GPU display audio ALSA: hda/hdmi - enable runtime pm for newer AMD display audio ALSA: hda/hdmi - enable automatic runtime pm for AMD HDMI codecs by default
sound/pci/hda/hda_intel.c | 80 +++++++++++++++++++++++++++++++++++--- sound/pci/hda/patch_hdmi.c | 1 + 2 files changed, 76 insertions(+), 5 deletions(-)
-- 2.23.0
On Mon, 25 Nov 2019 15:40:43 +0100, Alex Deucher wrote:
On Sat, Nov 23, 2019 at 3:57 AM Takashi Iwai tiwai@suse.de wrote:
On Fri, 22 Nov 2019 22:43:49 +0100, Alex Deucher wrote:
These patches were originally part of a larger set of patches to enabled runtime pm support on the GPU side[1]. However, the patches are useful on their own there are really no dependencies, other than the fact that you need both for runtime pm to kick in on the GPU side. The GPU side will be landing for 5.6; I'd like to land the audio side as well.
Do you mean that these can go into 5.5-rc1, or they need waiting until 5.5-rc1 release? I guess these won't break things even without the runtime PM support in GPU side, as the ELD notification is done via audio component, so I'm fine to apply them at any time.
Up to you. I'm ok to wait for the next merge window if you'd prefer.
OK, I'm going to apply them for 5.5-rc1 inclusion.
BTW, should I apply these patches with your gmail address as author (while sign-off is AMD address)? Or should I align both to your AMD address?
It's nothing wrong to have different addresses in the commit, but if unintended, it's better to align both.
thanks,
Takashi
On Tue, Nov 26, 2019 at 9:53 AM Takashi Iwai tiwai@suse.de wrote:
On Mon, 25 Nov 2019 15:40:43 +0100, Alex Deucher wrote:
On Sat, Nov 23, 2019 at 3:57 AM Takashi Iwai tiwai@suse.de wrote:
On Fri, 22 Nov 2019 22:43:49 +0100, Alex Deucher wrote:
These patches were originally part of a larger set of patches to enabled runtime pm support on the GPU side[1]. However, the patches are useful on their own there are really no dependencies, other than the fact that you need both for runtime pm to kick in on the GPU side. The GPU side will be landing for 5.6; I'd like to land the audio side as well.
Do you mean that these can go into 5.5-rc1, or they need waiting until 5.5-rc1 release? I guess these won't break things even without the runtime PM support in GPU side, as the ELD notification is done via audio component, so I'm fine to apply them at any time.
Up to you. I'm ok to wait for the next merge window if you'd prefer.
OK, I'm going to apply them for 5.5-rc1 inclusion.
BTW, should I apply these patches with your gmail address as author (while sign-off is AMD address)? Or should I align both to your AMD address?
It's nothing wrong to have different addresses in the commit, but if unintended, it's better to align both.
I guess my AMD address. I usually use my gmail address for sending patches out of laziness.
Alex
On Tue, 26 Nov 2019 16:31:37 +0100, Alex Deucher wrote:
On Tue, Nov 26, 2019 at 9:53 AM Takashi Iwai tiwai@suse.de wrote:
On Mon, 25 Nov 2019 15:40:43 +0100, Alex Deucher wrote:
On Sat, Nov 23, 2019 at 3:57 AM Takashi Iwai tiwai@suse.de wrote:
On Fri, 22 Nov 2019 22:43:49 +0100, Alex Deucher wrote:
These patches were originally part of a larger set of patches to enabled runtime pm support on the GPU side[1]. However, the patches are useful on their own there are really no dependencies, other than the fact that you need both for runtime pm to kick in on the GPU side. The GPU side will be landing for 5.6; I'd like to land the audio side as well.
Do you mean that these can go into 5.5-rc1, or they need waiting until 5.5-rc1 release? I guess these won't break things even without the runtime PM support in GPU side, as the ELD notification is done via audio component, so I'm fine to apply them at any time.
Up to you. I'm ok to wait for the next merge window if you'd prefer.
OK, I'm going to apply them for 5.5-rc1 inclusion.
BTW, should I apply these patches with your gmail address as author (while sign-off is AMD address)? Or should I align both to your AMD address?
It's nothing wrong to have different addresses in the commit, but if unintended, it's better to align both.
I guess my AMD address. I usually use my gmail address for sending patches out of laziness.
OK, now merged all four patches.
thanks,
Takashi
On Tue, Nov 26, 2019 at 10:58 AM Takashi Iwai tiwai@suse.de wrote:
On Tue, 26 Nov 2019 16:31:37 +0100, Alex Deucher wrote:
On Tue, Nov 26, 2019 at 9:53 AM Takashi Iwai tiwai@suse.de wrote:
On Mon, 25 Nov 2019 15:40:43 +0100, Alex Deucher wrote:
On Sat, Nov 23, 2019 at 3:57 AM Takashi Iwai tiwai@suse.de wrote:
On Fri, 22 Nov 2019 22:43:49 +0100, Alex Deucher wrote:
These patches were originally part of a larger set of patches to enabled runtime pm support on the GPU side[1]. However, the patches are useful on their own there are really no dependencies, other than the fact that you need both for runtime pm to kick in on the GPU side. The GPU side will be landing for 5.6; I'd like to land the audio side as well.
Do you mean that these can go into 5.5-rc1, or they need waiting until 5.5-rc1 release? I guess these won't break things even without the runtime PM support in GPU side, as the ELD notification is done via audio component, so I'm fine to apply them at any time.
Up to you. I'm ok to wait for the next merge window if you'd prefer.
OK, I'm going to apply them for 5.5-rc1 inclusion.
BTW, should I apply these patches with your gmail address as author (while sign-off is AMD address)? Or should I align both to your AMD address?
It's nothing wrong to have different addresses in the commit, but if unintended, it's better to align both.
I guess my AMD address. I usually use my gmail address for sending patches out of laziness.
OK, now merged all four patches.
Thanks!
Alex
thanks,
Takashi
participants (2)
-
Alex Deucher
-
Takashi Iwai