[PATCH 02/11] vga_switcheroo: Add support for reprobing connectors

Matthew Garrett matthew.garrett at nebula.com
Sun Jun 1 09:38:34 PDT 2014


If display MUXing is handled by an external driver, the handler may not
initialise until some time after the graphics drivers originally bound. If
the driver is unable to detect some drivers unless appropriately MUXed, this
will cause problems. This patch adds a callback to allow switcheroo to
retrigger the driver's output probing.

Signed-off-by: Matthew Garrett <matthew.garrett at nebula.com>
---
 drivers/gpu/vga/vga_switcheroo.c | 10 ++++++++++
 include/linux/vga_switcheroo.h   |  1 +
 2 files changed, 11 insertions(+)

diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
index dd1d587..c06ad5f 100644
--- a/drivers/gpu/vga/vga_switcheroo.c
+++ b/drivers/gpu/vga/vga_switcheroo.c
@@ -96,6 +96,16 @@ static void vga_switcheroo_enable(void)
 			return;
 
 		client->id = ret;
+
+		if (!client->active && client->ops->reprobe_connectors) {
+			int old_id = (client->id == VGA_SWITCHEROO_IGD) ?
+				VGA_SWITCHEROO_DIS : VGA_SWITCHEROO_IGD;
+			if (vgasr_priv.handler->switch_ddc)
+				vgasr_priv.handler->switch_ddc(client->id);
+			client->ops->reprobe_connectors(client->pdev);
+			if (vgasr_priv.handler->switch_ddc)
+				vgasr_priv.handler->switch_ddc(old_id);
+		}
 	}
 	vga_switcheroo_debugfs_init(&vgasr_priv);
 	vgasr_priv.active = true;
diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
index 37d6850..bae62fd 100644
--- a/include/linux/vga_switcheroo.h
+++ b/include/linux/vga_switcheroo.h
@@ -40,6 +40,7 @@ struct vga_switcheroo_handler {
 struct vga_switcheroo_client_ops {
 	void (*set_gpu_state)(struct pci_dev *dev, enum vga_switcheroo_state);
 	void (*reprobe)(struct pci_dev *dev);
+	void (*reprobe_connectors)(struct pci_dev *dev);
 	bool (*can_switch)(struct pci_dev *dev);
 };
 
-- 
1.8.5.3



More information about the dri-devel mailing list