drm/radeon/kms: add workaround for rn50/rv100 servers
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 5 Feb 2010 08:34:16 +0000 (03:34 -0500)
committerDave Airlie <airlied@redhat.com>
Mon, 8 Feb 2010 23:31:19 +0000 (09:31 +1000)
Some servers have two VGA ports but only report
one in the bios connector tables.  On these systems
always set up the TV DAC so that it displays properly
even if the bios is wrong.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/r100.c
drivers/gpu/drm/radeon/radeon_legacy_crtc.c

index c0d4650cdb794103a3fa7fe79d0a43c4806713c9..38209a61e515cd2e9cbbfda9b5eb0da42b768cd2 100644 (file)
@@ -1800,6 +1800,9 @@ int r100_gpu_reset(struct radeon_device *rdev)
 
 void r100_set_common_regs(struct radeon_device *rdev)
 {
+       struct drm_device *dev = rdev->ddev;
+       bool force_dac2 = false;
+
        /* set these so they don't interfere with anything */
        WREG32(RADEON_OV0_SCALE_CNTL, 0);
        WREG32(RADEON_SUBPIC_CNTL, 0);
@@ -1808,6 +1811,68 @@ void r100_set_common_regs(struct radeon_device *rdev)
        WREG32(RADEON_DVI_I2C_CNTL_1, 0);
        WREG32(RADEON_CAP0_TRIG_CNTL, 0);
        WREG32(RADEON_CAP1_TRIG_CNTL, 0);
+
+       /* always set up dac2 on rn50 and some rv100 as lots
+        * of servers seem to wire it up to a VGA port but
+        * don't report it in the bios connector
+        * table.
+        */
+       switch (dev->pdev->device) {
+               /* RN50 */
+       case 0x515e:
+       case 0x5969:
+               force_dac2 = true;
+               break;
+               /* RV100*/
+       case 0x5159:
+       case 0x515a:
+               /* DELL triple head servers */
+               if ((dev->pdev->subsystem_vendor == 0x1028 /* DELL */) &&
+                   ((dev->pdev->subsystem_device == 0x016c) ||
+                    (dev->pdev->subsystem_device == 0x016d) ||
+                    (dev->pdev->subsystem_device == 0x016e) ||
+                    (dev->pdev->subsystem_device == 0x016f) ||
+                    (dev->pdev->subsystem_device == 0x0170) ||
+                    (dev->pdev->subsystem_device == 0x017d) ||
+                    (dev->pdev->subsystem_device == 0x017e) ||
+                    (dev->pdev->subsystem_device == 0x0183) ||
+                    (dev->pdev->subsystem_device == 0x018a) ||
+                    (dev->pdev->subsystem_device == 0x019a)))
+                       force_dac2 = true;
+               break;
+       }
+
+       if (force_dac2) {
+               u32 disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG);
+               u32 tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL);
+               u32 dac2_cntl = RREG32(RADEON_DAC_CNTL2);
+
+               /* For CRT on DAC2, don't turn it on if BIOS didn't
+                  enable it, even it's detected.
+               */
+
+               /* force it to crtc0 */
+               dac2_cntl &= ~RADEON_DAC2_DAC_CLK_SEL;
+               dac2_cntl |= RADEON_DAC2_DAC2_CLK_SEL;
+               disp_hw_debug |= RADEON_CRT2_DISP1_SEL;
+
+               /* set up the TV DAC */
+               tv_dac_cntl &= ~(RADEON_TV_DAC_PEDESTAL |
+                                RADEON_TV_DAC_STD_MASK |
+                                RADEON_TV_DAC_RDACPD |
+                                RADEON_TV_DAC_GDACPD |
+                                RADEON_TV_DAC_BDACPD |
+                                RADEON_TV_DAC_BGADJ_MASK |
+                                RADEON_TV_DAC_DACADJ_MASK);
+               tv_dac_cntl |= (RADEON_TV_DAC_NBLANK |
+                               RADEON_TV_DAC_NHOLD |
+                               RADEON_TV_DAC_STD_PS2 |
+                               (0x58 << 16));
+
+               WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl);
+               WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug);
+               WREG32(RADEON_DAC_CNTL2, dac2_cntl);
+       }
 }
 
 /*
index b6d8081e124675842c7614cea33d35f5d8357912..d6d69bb2eceaa56903ef62eb5cc91b3bc151a36a 100644 (file)
@@ -582,29 +582,6 @@ static bool radeon_set_crtc_timing(struct drm_crtc *crtc, struct drm_display_mod
                                   ? RADEON_CRTC_V_SYNC_POL
                                   : 0));
 
-       /* TODO -> Dell Server */
-       if (0) {
-               uint32_t disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG);
-               uint32_t tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL);
-               uint32_t dac2_cntl = RREG32(RADEON_DAC_CNTL2);
-               uint32_t crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
-
-               dac2_cntl &= ~RADEON_DAC2_DAC_CLK_SEL;
-               dac2_cntl |= RADEON_DAC2_DAC2_CLK_SEL;
-
-               /* For CRT on DAC2, don't turn it on if BIOS didn't
-                  enable it, even it's detected.
-               */
-               disp_hw_debug |= RADEON_CRT2_DISP1_SEL;
-               tv_dac_cntl &= ~((1<<2) | (3<<8) | (7<<24) | (0xff<<16));
-               tv_dac_cntl |= (0x03 | (2<<8) | (0x58<<16));
-
-               WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl);
-               WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug);
-               WREG32(RADEON_DAC_CNTL2, dac2_cntl);
-               WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
-       }
-
        if (radeon_crtc->crtc_id) {
                uint32_t crtc2_gen_cntl;
                uint32_t disp2_merge_cntl;