diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2013-04-13 19:26:19 -0400 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2013-04-22 10:39:12 -0400 |
commit | d5169fc4ccfecbfdf3b882be0d2cdf8b057b2eae (patch) | |
tree | bb1aefdfe83d2dc5c4a40fcf9acc34a467c5fe6e /drivers/gpu/drm/radeon | |
parent | d7c605a20ee86a4e8f19ca7b33f7c4f7ba0468bc (diff) |
drm/radeon: add helpers for masking and setting bits in regs
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r-- | drivers/gpu/drm/radeon/r600_hdmi.c | 16 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 2 |
2 files changed, 8 insertions, 10 deletions
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c index 21ecc0e12dc4..91582a534f77 100644 --- a/drivers/gpu/drm/radeon/r600_hdmi.c +++ b/drivers/gpu/drm/radeon/r600_hdmi.c | |||
@@ -437,17 +437,15 @@ void r600_hdmi_enable(struct drm_encoder *encoder) | |||
437 | hdmi = HDMI0_ERROR_ACK | HDMI0_ENABLE; | 437 | hdmi = HDMI0_ERROR_ACK | HDMI0_ENABLE; |
438 | switch (radeon_encoder->encoder_id) { | 438 | switch (radeon_encoder->encoder_id) { |
439 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: | 439 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: |
440 | WREG32_P(AVIVO_TMDSA_CNTL, AVIVO_TMDSA_CNTL_HDMI_EN, | 440 | WREG32_OR(AVIVO_TMDSA_CNTL, AVIVO_TMDSA_CNTL_HDMI_EN); |
441 | ~AVIVO_TMDSA_CNTL_HDMI_EN); | ||
442 | hdmi |= HDMI0_STREAM(HDMI0_STREAM_TMDSA); | 441 | hdmi |= HDMI0_STREAM(HDMI0_STREAM_TMDSA); |
443 | break; | 442 | break; |
444 | case ENCODER_OBJECT_ID_INTERNAL_LVTM1: | 443 | case ENCODER_OBJECT_ID_INTERNAL_LVTM1: |
445 | WREG32_P(AVIVO_LVTMA_CNTL, AVIVO_LVTMA_CNTL_HDMI_EN, | 444 | WREG32_OR(AVIVO_LVTMA_CNTL, AVIVO_LVTMA_CNTL_HDMI_EN); |
446 | ~AVIVO_LVTMA_CNTL_HDMI_EN); | ||
447 | hdmi |= HDMI0_STREAM(HDMI0_STREAM_LVTMA); | 445 | hdmi |= HDMI0_STREAM(HDMI0_STREAM_LVTMA); |
448 | break; | 446 | break; |
449 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 447 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
450 | WREG32_P(DDIA_CNTL, DDIA_HDMI_EN, ~DDIA_HDMI_EN); | 448 | WREG32_OR(DDIA_CNTL, DDIA_HDMI_EN); |
451 | hdmi |= HDMI0_STREAM(HDMI0_STREAM_DDIA); | 449 | hdmi |= HDMI0_STREAM(HDMI0_STREAM_DDIA); |
452 | break; | 450 | break; |
453 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | 451 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: |
@@ -504,15 +502,13 @@ void r600_hdmi_disable(struct drm_encoder *encoder) | |||
504 | if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) { | 502 | if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) { |
505 | switch (radeon_encoder->encoder_id) { | 503 | switch (radeon_encoder->encoder_id) { |
506 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: | 504 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: |
507 | WREG32_P(AVIVO_TMDSA_CNTL, 0, | 505 | WREG32_AND(AVIVO_TMDSA_CNTL, ~AVIVO_TMDSA_CNTL_HDMI_EN); |
508 | ~AVIVO_TMDSA_CNTL_HDMI_EN); | ||
509 | break; | 506 | break; |
510 | case ENCODER_OBJECT_ID_INTERNAL_LVTM1: | 507 | case ENCODER_OBJECT_ID_INTERNAL_LVTM1: |
511 | WREG32_P(AVIVO_LVTMA_CNTL, 0, | 508 | WREG32_AND(AVIVO_LVTMA_CNTL, ~AVIVO_LVTMA_CNTL_HDMI_EN); |
512 | ~AVIVO_LVTMA_CNTL_HDMI_EN); | ||
513 | break; | 509 | break; |
514 | case ENCODER_OBJECT_ID_INTERNAL_DDI: | 510 | case ENCODER_OBJECT_ID_INTERNAL_DDI: |
515 | WREG32_P(DDIA_CNTL, 0, ~DDIA_HDMI_EN); | 511 | WREG32_AND(DDIA_CNTL, ~DDIA_HDMI_EN); |
516 | break; | 512 | break; |
517 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: | 513 | case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1: |
518 | break; | 514 | break; |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 18904fb83d3a..5020c7c9b7cb 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1741,6 +1741,8 @@ void r100_io_wreg(struct radeon_device *rdev, u32 reg, u32 v); | |||
1741 | tmp_ |= ((val) & ~(mask)); \ | 1741 | tmp_ |= ((val) & ~(mask)); \ |
1742 | WREG32(reg, tmp_); \ | 1742 | WREG32(reg, tmp_); \ |
1743 | } while (0) | 1743 | } while (0) |
1744 | #define WREG32_AND(reg, and) WREG32_P(reg, 0, and) | ||
1745 | #define WREG32_OR(reg, or) WREG32_P(reg, or, ~or) | ||
1744 | #define WREG32_PLL_P(reg, val, mask) \ | 1746 | #define WREG32_PLL_P(reg, val, mask) \ |
1745 | do { \ | 1747 | do { \ |
1746 | uint32_t tmp_ = RREG32_PLL(reg); \ | 1748 | uint32_t tmp_ = RREG32_PLL(reg); \ |