linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Seth Forshee <seth.forshee@canonical.com>
To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: David Airlie <airlied@linux.ie>, Matthew Garrett <mjg@redhat.com>,
	Daniel Vetter <daniel.vetter@ffwll.ch>,
	Andreas Heider <andreas@meetr.de>,
	Seth Forshee <seth.forshee@canonical.com>
Subject: [PATCH 2/7] vga_switcheroo: Add helper function to get the active client
Date: Fri,  7 Sep 2012 10:22:05 -0500	[thread overview]
Message-ID: <1347031330-19657-3-git-send-email-seth.forshee@canonical.com> (raw)
In-Reply-To: <1347031330-19657-1-git-send-email-seth.forshee@canonical.com>

Add vga_switcheroo_get_active_client() to allow drivers to get the
active video client. This will be used by drivers wishing to temporarily
mux only the DDC to the inactive client.

Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
---
 drivers/gpu/vga/vga_switcheroo.c |   14 ++++++++++++++
 include/linux/vga_switcheroo.h   |    2 ++
 2 files changed, 16 insertions(+)

diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index ea6bcc2..e53f67d 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -205,6 +205,20 @@ find_active_client(struct list_head *head)
 	return NULL;
 }
 
+struct pci_dev *vga_switcheroo_get_active_client(void)
+{
+	struct vga_switcheroo_client *client;
+	struct pci_dev *pdev = NULL;
+
+	mutex_lock(&vgasr_mutex);
+	client = find_active_client(&vgasr_priv.clients);
+	if (client)
+		pdev = client->pdev;
+	mutex_unlock(&vgasr_mutex);
+	return pdev;
+}
+EXPORT_SYMBOL(vga_switcheroo_get_active_client);
+
 int vga_switcheroo_get_client_state(struct pci_dev *pdev)
 {
 	struct vga_switcheroo_client *client;
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index b0d0839..e361858 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -61,6 +61,7 @@ void vga_switcheroo_unregister_handler(void);
 
 int vga_switcheroo_process_delayed_switch(void);
 
+struct pci_dev *vga_switcheroo_get_active_client(void);
 int vga_switcheroo_get_client_state(struct pci_dev *dev);
 
 #else
@@ -76,6 +77,7 @@ static inline int vga_switcheroo_register_audio_client(struct pci_dev *pdev,
 	int id, bool active) { return 0; }
 static inline void vga_switcheroo_unregister_handler(void) {}
 static inline int vga_switcheroo_process_delayed_switch(void) { return 0; }
+static inline struct pci_dev *vga_switcheroo_get_active_client(void) { return NULL; }
 static inline int vga_switcheroo_get_client_state(struct pci_dev *dev) { return VGA_SWITCHEROO_ON; }
 
 
-- 
1.7.9.5


  parent reply	other threads:[~2012-09-07 15:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-07 15:22 [PATCH 0/7] Fixes for hybrid graphics Apple machines Seth Forshee
2012-09-07 15:22 ` [PATCH 1/7] vga_switcheroo: Add support for switching only the DDC Seth Forshee
2012-09-07 15:22 ` Seth Forshee [this message]
2012-09-07 15:22 ` [PATCH 3/7] vga_switcheroo: Add notifier call chain for switcheroo events Seth Forshee
2012-09-07 15:22 ` [PATCH 4/7] apple-gmux: Add switch_ddc support Seth Forshee
2012-09-07 15:22 ` [PATCH 5/7] drm/edid: Switch DDC when reading the EDID Seth Forshee
2012-09-07 15:22 ` [PATCH 6/7] drm/pci: Add drm_put_pci_dev() Seth Forshee
2012-09-07 15:22 ` [PATCH 7/7] drm/pci: Defer initialization of secondary graphics devices until switcheroo is ready Seth Forshee
2012-09-07 21:35 ` [PATCH 0/7] Fixes for hybrid graphics Apple machines Dave Airlie
2012-09-08  5:07   ` Seth Forshee

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=1347031330-19657-3-git-send-email-seth.forshee@canonical.com \
    --to=seth.forshee@canonical.com \
    --cc=airlied@linux.ie \
    --cc=andreas@meetr.de \
    --cc=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).