dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] vga_switcheroo: add mux switched interface
@ 2013-01-08  4:53 Dave Airlie
  2013-01-08  4:53 ` [PATCH 2/2] radeon: add support for forcing off lvds when mux switched away Dave Airlie
  2013-01-08 14:18 ` [PATCH 1/2] vga_switcheroo: add mux switched interface Alex Deucher
  0 siblings, 2 replies; 6+ messages in thread
From: Dave Airlie @ 2013-01-08  4:53 UTC (permalink / raw)
  To: dri-devel

From: Dave Airlie <airlied@redhat.com>

this tells the drivers when the mux is switch to/from it, can be used
to report outputs as disconnected to userspace etc.

Signed-off-by: Dave Airlie <airlied@redhat.com>
---
 drivers/gpu/vga/vga_switcheroo.c | 19 +++++++++++++++++++
 include/linux/vga_switcheroo.h   |  1 +
 2 files changed, 20 insertions(+)

diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index fa60add..2362175 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -93,6 +93,9 @@ static void vga_switcheroo_enable(void)
 			return;
 
 		client->id = ret;
+
+		if (client->ops->mux_switched)
+			client->ops->mux_switched(client->pdev, client->active ? VGA_SWITCHEROO_ON : VGA_SWITCHEROO_OFF);
 	}
 	vga_switcheroo_debugfs_init(&vgasr_priv);
 	vgasr_priv.active = true;
@@ -345,6 +348,13 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
 	if (ret)
 		return ret;
 
+	/* call mux switched callbacks */
+	if (active->ops->mux_switched)
+		active->ops->mux_switched(active->pdev, VGA_SWITCHEROO_OFF);
+
+	if (new_client->ops->mux_switched)
+		new_client->ops->mux_switched(new_client->pdev, VGA_SWITCHEROO_ON);
+
 	if (new_client->ops->reprobe)
 		new_client->ops->reprobe(new_client->pdev);
 
@@ -452,7 +462,16 @@ vga_switcheroo_debugfs_write(struct file *filp, const char __user *ubuf,
 	vgasr_priv.delayed_switch_active = false;
 
 	if (just_mux) {
+		struct vga_switcheroo_client *active;
+		active = find_active_client(&vgasr_priv.clients);
+		if (!active)
+			return 0;
 		ret = vgasr_priv.handler->switchto(client_id);
+
+		if (active->ops->mux_switched)
+			active->ops->mux_switched(active->pdev, VGA_SWITCHEROO_OFF);
+		if (client->ops->mux_switched)
+			client->ops->mux_switched(client->pdev, VGA_SWITCHEROO_ON);
 		goto out;
 	}
 
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index ddb419c..6275719 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -40,6 +40,7 @@ struct vga_switcheroo_client_ops {
 	void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
 	void (*reprobe)(struct pci_dev *dev);
 	bool (*can_switch)(struct pci_dev *dev);
+	void (*mux_switched)(struct pci_dev *dev, enum vga_switcheroo_state);
 };
 
 #if defined(CONFIG_VGA_SWITCHEROO)
-- 
1.8.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-01-09 23:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-08  4:53 [PATCH 1/2] vga_switcheroo: add mux switched interface Dave Airlie
2013-01-08  4:53 ` [PATCH 2/2] radeon: add support for forcing off lvds when mux switched away Dave Airlie
2013-01-08 14:20   ` Alex Deucher
2013-01-09 14:16   ` Alex Deucher
2013-01-09 23:14     ` Dave Airlie
2013-01-08 14:18 ` [PATCH 1/2] vga_switcheroo: add mux switched interface Alex Deucher

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