From: Lukas Wunner Date: Sat, 3 Mar 2018 09:53:24 +0000 (+0100) Subject: vga_switcheroo: Let HDA autosuspend on mux change X-Git-Tag: v4.19~298^2~45^2~326 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b67ae78efae0d5be5d9c7a507e67cd02971b32e1;p=platform%2Fkernel%2Flinux-rpi.git vga_switcheroo: Let HDA autosuspend on mux change 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 Cc: Ben Skeggs Cc: Takashi Iwai Cc: Alex Deucher Reviewed-by: Peter Wu Signed-off-by: Lukas Wunner Link: https://patchwork.freedesktop.org/patch/msgid/098ed883460eb4976a899eac6f5192fefc877c0f.1520068884.git.lukas@wunner.de --- diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c index 4ee0ed6..fc4adf3 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) vga_switchoff(active); - 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;