drm/nvd0/disp: dac load detect
authorBen Skeggs <bskeggs@redhat.com>
Fri, 8 Jul 2011 01:14:50 +0000 (11:14 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Tue, 20 Sep 2011 06:07:22 +0000 (16:07 +1000)
VBIOS does more than this, as does nv50/nvc0 driver in nouveau.  Traces
of the NVIDIA binary driver however, show pretty much just this being
done...  Seems to work for me, it'll be fine for the moment.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvd0_display.c

index 6720d63cfccca5aabf1679c177fb8376921f21d9..f4788d819ed68f1952fe10c6f19b62aaa71c6379 100644 (file)
@@ -685,7 +685,22 @@ nvd0_dac_disconnect(struct drm_encoder *encoder)
 static enum drm_connector_status
 nvd0_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector)
 {
-       return connector_status_disconnected;
+       enum drm_connector_status status = connector_status_disconnected;
+       struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
+       struct drm_device *dev = encoder->dev;
+       int or = nv_encoder->or;
+       u32 load;
+
+       nv_wr32(dev, 0x61a00c + (or * 0x800), 0x00100000);
+       udelay(9500);
+       nv_wr32(dev, 0x61a00c + (or * 0x800), 0x80000000);
+
+       load = nv_rd32(dev, 0x61a00c + (or * 0x800));
+       if ((load & 0x38000000) == 0x38000000)
+               status = connector_status_connected;
+
+       nv_wr32(dev, 0x61a00c + (or * 0x800), 0x00000000);
+       return status;
 }
 
 static void