[PATCH v2 22/22 EXPERIMENTAL] drm/nouveau: Use vga_switcheroo active client as proxy when probing DDC on LVDS

Lukas Wunner lukas at wunner.de
Wed Aug 12 04:34:01 PDT 2015


The pre-retina MacBook Pro uses an LVDS panel and a gmux controller
to switch the panel between its two GPUs. While the gmux is able to
switch the DDC lines, we can also emulate DDC switching in software
by using the active client as a proxy to talk to the panel. This
gives us two ways to switch, one requiring the apple-gmux driver
and the other requiring the active client's driver.

To that end, when probing DDC, if we're unable to talk to the panel
ourselves and the connector in question is of type LVDS, try proxying
via the vga_switcheroo active client.

Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=88861
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=61115
Tested-by: Paul Hordiienko <pvt.gord at gmail.com>
    [MBP  6,2 2010  intel ILK + nvidia GT216  pre-retina]
Tested-by: William Brown <william at blackhats.net.au>
    [MBP  8,2 2011  intel SNB + amd turks     pre-retina]
Tested-by: Lukas Wunner <lukas at wunner.de>
    [MBP  9,1 2012  intel IVB + nvidia GK107  pre-retina]
Tested-by: Bruno Bierbaumer <bruno at bierbaumer.net>
    [MBP 11,3 2013  intel HSW + nvidia GK107  retina -- work in progress]

Signed-off-by: Lukas Wunner <lukas at wunner.de>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c
index 159df7f..d1a6982 100644
--- a/drivers/gpu/drm/nouveau/nouveau_connector.c
+++ b/drivers/gpu/drm/nouveau/nouveau_connector.c
@@ -149,12 +149,18 @@ nouveau_connector_ddc_detect(struct drm_connector *connector)
 				break;
 		} else
 		if (nv_encoder->i2c) {
+			struct i2c_adapter *proxy_ddc;
 			int ret;
 			vga_switcheroo_lock_ddc(dev->pdev);
 			ret = nv_probe_i2c(nv_encoder->i2c, 0x50);
 			vga_switcheroo_unlock_ddc(dev->pdev);
 			if (ret)
 				break;
+			proxy_ddc = vga_switcheroo_get_ddc(dev->pdev);
+			if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS &&
+			    nv_connector->type == DCB_CONNECTOR_LVDS &&
+			    proxy_ddc && drm_probe_ddc(proxy_ddc))
+				break;
 		}
 	}
 
-- 
1.8.5.2 (Apple Git-48)



More information about the dri-devel mailing list