public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] hda/hdmi: Register with vga_switcheroo on Dual GPU Macbooks
@ 2023-02-16 10:34 Orlando Chamberlain
  2023-02-16 13:20 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Orlando Chamberlain @ 2023-02-16 10:34 UTC (permalink / raw)
  To: alsa-devel
  Cc: Jaroslav Kysela, Takashi Iwai, Evan Quan, Alex Deucher,
	linux-kernel, Aditya Garg, Aun-Ali Zaidi, Kerem Karabay,
	Orlando Chamberlain

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

To resolve this, we use apple_gmux_detect() and register a
vga_switcheroo audio client when apple-gmux is detected.

Fixes: 586bc4aab878 ("ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD")
Link: https://lore.kernel.org/all/20230210044826.9834-9-orlandoch.dev@gmail.com/
Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
---
v1->v2: Use apple_gmux_detect(), split this patch out of the patch
series
 sound/pci/hda/hda_intel.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 87002670c0c9..cfd2ddfde112 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -50,6 +50,7 @@
 #include <sound/intel-dsp-config.h>
 #include <linux/vgaarb.h>
 #include <linux/vga_switcheroo.h>
+#include <linux/apple-gmux.h>
 #include <linux/firmware.h>
 #include <sound/hda_codec.h>
 #include "hda_controller.h"
@@ -1463,7 +1464,7 @@ static struct pci_dev *get_bound_vga(struct pci_dev *pci)
 				 * vgaswitcheroo.
 				 */
 				if (((p->class >> 16) == PCI_BASE_CLASS_DISPLAY) &&
-				    atpx_present())
+				    (atpx_present() || apple_gmux_detect(NULL, NULL)))
 					return p;
 				pci_dev_put(p);
 			}
-- 
2.39.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCHv2] hda/hdmi: Register with vga_switcheroo on Dual GPU Macbooks
  2023-02-16 10:34 [PATCHv2] hda/hdmi: Register with vga_switcheroo on Dual GPU Macbooks Orlando Chamberlain
@ 2023-02-16 13:20 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2023-02-16 13:20 UTC (permalink / raw)
  To: Orlando Chamberlain
  Cc: alsa-devel, Jaroslav Kysela, Takashi Iwai, Evan Quan,
	Alex Deucher, linux-kernel, Aditya Garg, Aun-Ali Zaidi,
	Kerem Karabay

On Thu, 16 Feb 2023 11:34:51 +0100,
Orlando Chamberlain wrote:
> 
> 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
> 
> To resolve this, we use apple_gmux_detect() and register a
> vga_switcheroo audio client when apple-gmux is detected.
> 
> Fixes: 586bc4aab878 ("ALSA: hda/hdmi - fix vgaswitcheroo detection for AMD")
> Link: https://lore.kernel.org/all/20230210044826.9834-9-orlandoch.dev@gmail.com/
> Signed-off-by: Orlando Chamberlain <orlandoch.dev@gmail.com>
> ---
> v1->v2: Use apple_gmux_detect(), split this patch out of the patch
> series

Thanks, applied now.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-02-16 13:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-16 10:34 [PATCHv2] hda/hdmi: Register with vga_switcheroo on Dual GPU Macbooks Orlando Chamberlain
2023-02-16 13:20 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox