From patchwork Sun Feb 18 08:38:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 10226707 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1AEBB602DC for ; Sun, 18 Feb 2018 08:41:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C8BB28868 for ; Sun, 18 Feb 2018 08:41:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 015F6289A8; Sun, 18 Feb 2018 08:41:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4DD7528868 for ; Sun, 18 Feb 2018 08:41:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 00BF56E101; Sun, 18 Feb 2018 08:41:32 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout2.hostsharing.net (mailout2.hostsharing.net [83.223.90.233]) by gabe.freedesktop.org (Postfix) with ESMTPS id A3A3C6E0F6; Sun, 18 Feb 2018 08:41:29 +0000 (UTC) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by mailout2.hostsharing.net (Postfix) with ESMTPS id 245A21008C7C9; Sun, 18 Feb 2018 09:41:28 +0100 (CET) Received: from localhost (6-38-90-81.adsl.cmo.de [81.90.38.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id 4392D603E059; Sun, 18 Feb 2018 09:41:27 +0100 (CET) X-Mailbox-Line: From 3c460a4c71db38ce2c99423c58f3bbcf412b089f Mon Sep 17 00:00:00 2001 Message-Id: <3c460a4c71db38ce2c99423c58f3bbcf412b089f.1518941073.git.lukas@wunner.de> In-Reply-To: References: From: Lukas Wunner Date: Sun, 18 Feb 2018 09:38:32 +0100 Subject: [PATCH 6/7] vga_switcheroo: Let HDA autosuspend on mux change To: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, linux-pm@vger.kernel.org, nouveau@lists.freedesktop.org, "Rafael J. Wysocki" , Takashi Iwai , Jaroslav Kysela , Hans de Goede , Peter Wu , Bastien Nocera , Alex Deucher , Dave Airlie , Ben Skeggs MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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: Peter Wu Cc: Alex Deucher Signed-off-by: Lukas Wunner --- drivers/gpu/vga/vga_switcheroo.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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) 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;