All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: dri-devel@lists.freedesktop.org
Cc: alsa-devel@alsa-project.org, linux-pm@vger.kernel.org,
	nouveau@lists.freedesktop.org,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
	Hans de Goede <hdegoede@redhat.com>,
	Peter Wu <peter@lekensteyn.nl>,
	Bastien Nocera <hadess@hadess.net>,
	Alex Deucher <alexander.deucher@amd.com>,
	Dave Airlie <airlied@redhat.com>, Ben Skeggs <bskeggs@redhat.com>
Subject: [PATCH 6/7] vga_switcheroo: Let HDA autosuspend on mux change
Date: Sun, 18 Feb 2018 09:38:32 +0100	[thread overview]
Message-ID: <3c460a4c71db38ce2c99423c58f3bbcf412b089f.1518941073.git.lukas@wunner.de> (raw)
In-Reply-To: <cover.1518941072.git.lukas@wunner.de>

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(-)

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;
-- 
2.15.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2018-02-18  8:38 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-18  8:38 [PATCH 0/7] Modernize vga_switcheroo by using device link for HDA Lukas Wunner
2018-02-18  8:38 ` Lukas Wunner
2018-02-18  8:38 ` [PATCH 4/7] vga_switcheroo: Deduplicate power state tracking Lukas Wunner
2018-02-18  8:38 ` [PATCH 2/7] PCI: Make pci_wakeup_bus() & pci_bus_set_current_state() public Lukas Wunner
2018-02-22 17:45   ` Bjorn Helgaas
2018-02-22 17:45     ` Bjorn Helgaas
2018-02-18  8:38 ` Lukas Wunner [this message]
2018-02-18  8:38 ` [PATCH 3/7] vga_switcheroo: Update PCI current_state on power change Lukas Wunner
2018-02-18  8:38 ` [PATCH 1/7] PCI: Restore BARs on runtime resume despite being unbound Lukas Wunner
2018-02-18  8:38   ` Lukas Wunner
2018-02-19  9:49   ` Rafael J. Wysocki
2018-02-19  9:49     ` Rafael J. Wysocki
2018-02-20 21:29   ` Bjorn Helgaas
2018-02-20 21:29     ` Bjorn Helgaas
2018-02-21  9:57     ` Rafael J. Wysocki
2018-02-21  9:57       ` Rafael J. Wysocki
2018-02-21 12:39       ` Rafael J. Wysocki
2018-02-21 12:39         ` Rafael J. Wysocki
2018-02-25  8:59         ` Lukas Wunner
2018-02-25  8:59           ` Lukas Wunner
2018-02-25  9:31           ` Takashi Iwai
2018-02-25  9:31             ` Takashi Iwai
2018-02-24 16:26       ` Lukas Wunner
2018-02-18  8:38 ` [PATCH 5/7] vga_switcheroo: Use device link for HDA controller Lukas Wunner
2018-02-20 22:20   ` Bjorn Helgaas
2018-02-20 22:20     ` Bjorn Helgaas
2018-02-23  9:51     ` Lukas Wunner
2018-02-23  9:51       ` Lukas Wunner
2018-02-23 14:23       ` Bjorn Helgaas
2018-02-23 14:23         ` Bjorn Helgaas
2018-02-18  8:38 ` [PATCH 7/7] drm/nouveau: Runtime suspend despite HDA being unbound Lukas Wunner
2018-02-25 23:24 ` [PATCH 0/7] Modernize vga_switcheroo by using device link for HDA Mike Lothian
2018-02-25 23:24   ` Mike Lothian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3c460a4c71db38ce2c99423c58f3bbcf412b089f.1518941073.git.lukas@wunner.de \
    --to=lukas@wunner.de \
    --cc=airlied@redhat.com \
    --cc=alexander.deucher@amd.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=linux-pm@vger.kernel.org \
    --cc=nouveau@lists.freedesktop.org \
    --cc=perex@perex.cz \
    --cc=peter@lekensteyn.nl \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.