aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorEgbert Eich <eich@suse.de>2012-10-30 12:42:27 -0400
committerAlex Deucher <alexander.deucher@amd.com>2012-11-01 10:34:33 -0400
commit701337dc2711096e5288430599dcf07aac5876ab (patch)
tree0b4bf9eca1d10239231ec77f997605518c81ec79 /drivers/gpu
parentd038db86984977646815fff54c1be11bff6b9f5b (diff)
DRM/Radeon: Fix TV DAC Load Detection for single CRTC chips.
The RN50 has a TV DAC but only a single CRTC. For load detection this DAC is controlled by the primary CRTC. Signed-off-by: Egbert Eich <eich@suse.de> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c62
1 files changed, 38 insertions, 24 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 85a7307e05f8..3afed70306df 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -1424,9 +1424,9 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder
1424{ 1424{
1425 struct drm_device *dev = encoder->dev; 1425 struct drm_device *dev = encoder->dev;
1426 struct radeon_device *rdev = dev->dev_private; 1426 struct radeon_device *rdev = dev->dev_private;
1427 uint32_t crtc2_gen_cntl, tv_dac_cntl, dac_cntl2, dac_ext_cntl; 1427 uint32_t crtc2_gen_cntl = 0, tv_dac_cntl, dac_cntl2, dac_ext_cntl;
1428 uint32_t gpiopad_a = 0, pixclks_cntl, tmp; 1428 uint32_t gpiopad_a = 0, pixclks_cntl, tmp;
1429 uint32_t disp_output_cntl = 0, disp_hw_debug = 0; 1429 uint32_t disp_output_cntl = 0, disp_hw_debug = 0, crtc_ext_cntl = 0;
1430 enum drm_connector_status found = connector_status_disconnected; 1430 enum drm_connector_status found = connector_status_disconnected;
1431 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 1431 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1432 struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; 1432 struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv;
@@ -1465,13 +1465,18 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder
1465 1465
1466 /* save the regs we need */ 1466 /* save the regs we need */
1467 pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL); 1467 pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL);
1468 if (ASIC_IS_R300(rdev)) { 1468
1469 gpiopad_a = RREG32(RADEON_GPIOPAD_A); 1469 if (rdev->flags & RADEON_SINGLE_CRTC) {
1470 disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL); 1470 crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);
1471 } else { 1471 } else {
1472 disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG); 1472 if (ASIC_IS_R300(rdev)) {
1473 gpiopad_a = RREG32(RADEON_GPIOPAD_A);
1474 disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL);
1475 } else {
1476 disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG);
1477 }
1478 crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
1473 } 1479 }
1474 crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
1475 tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL); 1480 tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL);
1476 dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL); 1481 dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL);
1477 dac_cntl2 = RREG32(RADEON_DAC_CNTL2); 1482 dac_cntl2 = RREG32(RADEON_DAC_CNTL2);
@@ -1480,19 +1485,24 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder
1480 | RADEON_PIX2CLK_DAC_ALWAYS_ONb); 1485 | RADEON_PIX2CLK_DAC_ALWAYS_ONb);
1481 WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); 1486 WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp);
1482 1487
1483 tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK; 1488 if (rdev->flags & RADEON_SINGLE_CRTC) {
1484 tmp |= RADEON_CRTC2_CRT2_ON | 1489 tmp = crtc_ext_cntl | RADEON_CRTC_CRT_ON;
1485 (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT); 1490 WREG32(RADEON_CRTC_EXT_CNTL, tmp);
1486 WREG32(RADEON_CRTC2_GEN_CNTL, tmp);
1487
1488 if (ASIC_IS_R300(rdev)) {
1489 WREG32_P(RADEON_GPIOPAD_A, 1, ~1);
1490 tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK;
1491 tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2;
1492 WREG32(RADEON_DISP_OUTPUT_CNTL, tmp);
1493 } else { 1491 } else {
1494 tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL; 1492 tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK;
1495 WREG32(RADEON_DISP_HW_DEBUG, tmp); 1493 tmp |= RADEON_CRTC2_CRT2_ON |
1494 (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT);
1495 WREG32(RADEON_CRTC2_GEN_CNTL, tmp);
1496
1497 if (ASIC_IS_R300(rdev)) {
1498 WREG32_P(RADEON_GPIOPAD_A, 1, ~1);
1499 tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK;
1500 tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2;
1501 WREG32(RADEON_DISP_OUTPUT_CNTL, tmp);
1502 } else {
1503 tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL;
1504 WREG32(RADEON_DISP_HW_DEBUG, tmp);
1505 }
1496 } 1506 }
1497 1507
1498 tmp = RADEON_TV_DAC_NBLANK | 1508 tmp = RADEON_TV_DAC_NBLANK |
@@ -1534,13 +1544,17 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder
1534 WREG32(RADEON_DAC_CNTL2, dac_cntl2); 1544 WREG32(RADEON_DAC_CNTL2, dac_cntl2);
1535 WREG32(RADEON_DAC_EXT_CNTL, dac_ext_cntl); 1545 WREG32(RADEON_DAC_EXT_CNTL, dac_ext_cntl);
1536 WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl); 1546 WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl);
1537 WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
1538 1547
1539 if (ASIC_IS_R300(rdev)) { 1548 if (rdev->flags & RADEON_SINGLE_CRTC) {
1540 WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl); 1549 WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
1541 WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1);
1542 } else { 1550 } else {
1543 WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug); 1551 WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
1552 if (ASIC_IS_R300(rdev)) {
1553 WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl);
1554 WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1);
1555 } else {
1556 WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug);
1557 }
1544 } 1558 }
1545 1559
1546 WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); 1560 WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl);