[v2,6/7] vga_switcheroo: Let HDA autosuspend on mux change

Submitted by Lukas Wunner on March 3, 2018, 9:53 a.m.


Message ID 098ed883460eb4976a899eac6f5192fefc877c0f.1520068884.git.lukas@wunner.de
State New
Headers show
Series "Modernize vga_switcheroo by using device link for HDA" ( rev: 2 ) in Nouveau

Not browsing as part of any series.

Commit Message

Lukas Wunner March 3, 2018, 9:53 a.m.
When switching the display on muxed machines, we currently force the HDA
controller into runtime suspend on the previously used GPU and into
runtime active state on the newly used GPU.

That's unnecessary if the GPU uses driver power control, we can just let
the audio device autosuspend or autoresume as it sees fit.

Cc: Dave Airlie <airlied@redhat.com>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Peter Wu <peter@lekensteyn.nl>
Cc: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Lukas Wunner <lukas@wunner.de>
 drivers/gpu/vga/vga_switcheroo.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index 4ee0ed642386..fc4adf3d34e8 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -686,7 +686,9 @@  static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
 	active->active = false;
-	set_audio_state(active->id, VGA_SWITCHEROO_OFF);
+	/* let HDA controller autosuspend if GPU uses driver power control */
+	if (!active->driver_power_control)
+		set_audio_state(active->id, VGA_SWITCHEROO_OFF);
 	if (new_client->fb_info) {
 		struct fb_event event;
@@ -709,7 +711,9 @@  static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
 	if (vga_switcheroo_pwr_state(active) == VGA_SWITCHEROO_ON)
-	set_audio_state(new_client->id, VGA_SWITCHEROO_ON);
+	/* let HDA controller autoresume if GPU uses driver power control */
+	if (!new_client->driver_power_control)
+		set_audio_state(new_client->id, VGA_SWITCHEROO_ON);
 	new_client->active = true;
 	return 0;