diff options
author | Egbert Eich <eich@suse.de> | 2012-10-30 12:42:26 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2012-11-01 10:34:32 -0400 |
commit | d038db86984977646815fff54c1be11bff6b9f5b (patch) | |
tree | 7ca7d1a56e6e02fc7419ac349ea16677947bd6f1 | |
parent | dfdcbebc548ff14fd1a7029c95d060e0dd466469 (diff) |
DRM/Radeon: Clean up code in TV DAC load detection.
Signed-off-by: Egbert Eich <eich@suse.de>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index 5fdc67bd25d9..85a7307e05f8 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -1425,7 +1425,8 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
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, tv_dac_cntl, dac_cntl2, dac_ext_cntl; |
1428 | uint32_t disp_hw_debug, disp_output_cntl, gpiopad_a, pixclks_cntl, tmp; | 1428 | uint32_t gpiopad_a = 0, pixclks_cntl, tmp; |
1429 | uint32_t disp_output_cntl = 0, disp_hw_debug = 0; | ||
1429 | enum drm_connector_status found = connector_status_disconnected; | 1430 | enum drm_connector_status found = connector_status_disconnected; |
1430 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); | 1431 | struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
1431 | struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; | 1432 | struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; |
@@ -1464,9 +1465,12 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1464 | 1465 | ||
1465 | /* save the regs we need */ | 1466 | /* save the regs we need */ |
1466 | pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL); | 1467 | pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL); |
1467 | gpiopad_a = ASIC_IS_R300(rdev) ? RREG32(RADEON_GPIOPAD_A) : 0; | 1468 | if (ASIC_IS_R300(rdev)) { |
1468 | disp_output_cntl = ASIC_IS_R300(rdev) ? RREG32(RADEON_DISP_OUTPUT_CNTL) : 0; | 1469 | gpiopad_a = RREG32(RADEON_GPIOPAD_A); |
1469 | disp_hw_debug = ASIC_IS_R300(rdev) ? 0 : RREG32(RADEON_DISP_HW_DEBUG); | 1470 | disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL); |
1471 | } else { | ||
1472 | disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG); | ||
1473 | } | ||
1470 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); | 1474 | crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL); |
1471 | tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL); | 1475 | tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL); |
1472 | dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL); | 1476 | dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL); |
@@ -1476,16 +1480,13 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1476 | | RADEON_PIX2CLK_DAC_ALWAYS_ONb); | 1480 | | RADEON_PIX2CLK_DAC_ALWAYS_ONb); |
1477 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); | 1481 | WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp); |
1478 | 1482 | ||
1479 | if (ASIC_IS_R300(rdev)) | ||
1480 | WREG32_P(RADEON_GPIOPAD_A, 1, ~1); | ||
1481 | |||
1482 | tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK; | 1483 | tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK; |
1483 | tmp |= RADEON_CRTC2_CRT2_ON | | 1484 | tmp |= RADEON_CRTC2_CRT2_ON | |
1484 | (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT); | 1485 | (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT); |
1485 | |||
1486 | WREG32(RADEON_CRTC2_GEN_CNTL, tmp); | 1486 | WREG32(RADEON_CRTC2_GEN_CNTL, tmp); |
1487 | 1487 | ||
1488 | if (ASIC_IS_R300(rdev)) { | 1488 | if (ASIC_IS_R300(rdev)) { |
1489 | WREG32_P(RADEON_GPIOPAD_A, 1, ~1); | ||
1489 | tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK; | 1490 | tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK; |
1490 | tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2; | 1491 | tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2; |
1491 | WREG32(RADEON_DISP_OUTPUT_CNTL, tmp); | 1492 | WREG32(RADEON_DISP_OUTPUT_CNTL, tmp); |
@@ -1541,6 +1542,7 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder | |||
1541 | } else { | 1542 | } else { |
1542 | WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug); | 1543 | WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug); |
1543 | } | 1544 | } |
1545 | |||
1544 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); | 1546 | WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl); |
1545 | 1547 | ||
1546 | return found; | 1548 | return found; |