[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230210044826.9834-9-orlandoch.dev@gmail.com>
Date: Fri, 10 Feb 2023 15:48:25 +1100
From: Orlando Chamberlain <orlandoch.dev@...il.com>
To: platform-driver-x86@...r.kernel.org, amd-gfx@...ts.freedesktop.org,
linux-kernel@...r.kernel.org, alsa-devel@...a-project.org
Cc: Alex Deucher <alexander.deucher@....com>,
Christian König <christian.koenig@....com>,
"Pan, Xinhui" <Xinhui.Pan@....com>,
David Airlie <airlied@...il.com>,
Daniel Vetter <daniel@...ll.ch>,
Hans de Goede <hdegoede@...hat.com>,
Mark Gross <markgross@...nel.org>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>,
Hawking Zhang <Hawking.Zhang@....com>,
Andrey Grodzovsky <andrey.grodzovsky@....com>,
Lijo Lazar <lijo.lazar@....com>,
YiPeng Chai <YiPeng.Chai@....com>,
Somalapuram Amaranath <Amaranath.Somalapuram@....com>,
Mario Limonciello <mario.limonciello@....com>,
Bokun Zhang <Bokun.Zhang@....com>,
Jack Xiao <Jack.Xiao@....com>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Rander Wang <rander.wang@...el.com>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Amadeusz Sławiński
<amadeuszx.slawinski@...ux.intel.com>,
Yong Zhi <yong.zhi@...el.com>, Evan Quan <evan.quan@....com>,
Kerem Karabay <kekrby@...il.com>,
Aditya Garg <gargaditya08@...e.com>,
Aun-Ali Zaidi <admin@...eit.net>,
Orlando Chamberlain <orlandoch.dev@...il.com>
Subject: [RFC PATCH 8/9] hda/hdmi: Register with vga_switcheroo on Dual GPU Macbooks
Commit 586bc4aab878 ("ALSA: hda/hdmi - fix vgaswitcheroo detection for
AMD") caused only AMD gpu's with PX to have their audio component register
with vga_switcheroo. This meant that Apple Macbooks with apple-gmux as the
gpu switcher no longer had the audio client registering, so when the gpu is
powered off by vga_switcheroo snd_hda_intel is unaware that it should have
suspended the device:
amdgpu: switched off
snd_hda_intel 0000:03:00.1:
Unable to change power state from D3hot to D0, device inaccessible
snd_hda_intel 0000:03:00.1: CORB reset timeout#2, CORBRP = 65535
Simialar to ATPX, we use the presence of an acpi method (PWRD in this
case) to ensure we only register with the correct devices.
Fixes: 586bc4aab878 ("ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD")
Signed-off-by: Orlando Chamberlain <orlandoch.dev@...il.com>
---
sound/pci/hda/hda_intel.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 87002670c0c9..c97bbe60e603 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1435,11 +1435,25 @@ static bool atpx_present(void)
}
return false;
}
+
+static bool pwrd_present(struct pci_dev *pci)
+{
+ acpi_handle pwrd_handle;
+ acpi_status status;
+
+ status = acpi_get_handle(ACPI_HANDLE(&pci->dev), "PWRD", &pwrd_handle);
+ return ACPI_FAILURE(status) ? false : true;
+}
#else
static bool atpx_present(void)
{
return false;
}
+
+static bool pwrd_present(struct pci_dev *pci)
+{
+ return false;
+}
#endif
/*
@@ -1461,9 +1475,12 @@ static struct pci_dev *get_bound_vga(struct pci_dev *pci)
* rather than the dGPU's namespace. However,
* the dGPU is the one who is involved in
* vgaswitcheroo.
+ *
+ * PWRD is in the dGPU's ACPI namespace on Apple
+ * Macbooks with dual gpu's.
*/
if (((p->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
- atpx_present())
+ (atpx_present() || pwrd_present(p)))
return p;
pci_dev_put(p);
}
--
2.39.1
Powered by blists - more mailing lists