aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/r600_hdmi.c
diff options
context:
space:
mode:
authorRafał Miłecki <zajec5@gmail.com>2012-04-30 09:44:53 -0400
committerDave Airlie <airlied@redhat.com>2012-05-13 09:19:13 -0400
commit64fb4fb0e4259feb6a23fc352f30926da71341bc (patch)
tree0de47d373b49cd140b201384d29cb5759bfaf918 /drivers/gpu/drm/radeon/r600_hdmi.c
parenta273a903bf3d480270803350d01b51b18bbbeb9d (diff)
drm/radeon/kms/hdmi: clean&improve handling HDMI mode
Signed-off-by: Rafał Miłecki <zajec5@gmail.com> Reviewed-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/r600_hdmi.c')
-rw-r--r--drivers/gpu/drm/radeon/r600_hdmi.c42
1 files changed, 27 insertions, 15 deletions
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index 69839df1c479..7d24753108fa 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -493,6 +493,7 @@ void r600_hdmi_enable(struct drm_encoder *encoder)
493 struct radeon_device *rdev = dev->dev_private; 493 struct radeon_device *rdev = dev->dev_private;
494 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 494 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
495 uint32_t offset; 495 uint32_t offset;
496 u32 hdmi;
496 497
497 if (ASIC_IS_DCE5(rdev)) 498 if (ASIC_IS_DCE5(rdev))
498 return; 499 return;
@@ -507,26 +508,34 @@ void r600_hdmi_enable(struct drm_encoder *encoder)
507 } 508 }
508 509
509 offset = radeon_encoder->hdmi_offset; 510 offset = radeon_encoder->hdmi_offset;
510 if (ASIC_IS_DCE5(rdev)) { 511
511 /* TODO */ 512 /* Older chipsets require setting HDMI and routing manually */
512 } else if (ASIC_IS_DCE3(rdev)) { 513 if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) {
513 /* TODO */ 514 hdmi = HDMI0_ERROR_ACK | HDMI0_ENABLE;
514 } else if (rdev->family >= CHIP_R600) {
515 switch (radeon_encoder->encoder_id) { 515 switch (radeon_encoder->encoder_id) {
516 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: 516 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
517 WREG32_P(AVIVO_TMDSA_CNTL, AVIVO_TMDSA_CNTL_HDMI_EN, 517 WREG32_P(AVIVO_TMDSA_CNTL, AVIVO_TMDSA_CNTL_HDMI_EN,
518 ~AVIVO_TMDSA_CNTL_HDMI_EN); 518 ~AVIVO_TMDSA_CNTL_HDMI_EN);
519 WREG32(HDMI0_CONTROL + offset, 0x101); 519 hdmi |= HDMI0_STREAM(HDMI0_STREAM_TMDSA);
520 break; 520 break;
521 case ENCODER_OBJECT_ID_INTERNAL_LVTM1: 521 case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
522 WREG32_P(AVIVO_LVTMA_CNTL, AVIVO_LVTMA_CNTL_HDMI_EN, 522 WREG32_P(AVIVO_LVTMA_CNTL, AVIVO_LVTMA_CNTL_HDMI_EN,
523 ~AVIVO_LVTMA_CNTL_HDMI_EN); 523 ~AVIVO_LVTMA_CNTL_HDMI_EN);
524 WREG32(HDMI0_CONTROL + offset, 0x105); 524 hdmi |= HDMI0_STREAM(HDMI0_STREAM_LVTMA);
525 break;
526 case ENCODER_OBJECT_ID_INTERNAL_DDI:
527 WREG32_P(DDIA_CNTL, DDIA_HDMI_EN, ~DDIA_HDMI_EN);
528 hdmi |= HDMI0_STREAM(HDMI0_STREAM_DDIA);
529 break;
530 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
531 hdmi |= HDMI0_STREAM(HDMI0_STREAM_DVOA);
525 break; 532 break;
526 default: 533 default:
527 dev_err(rdev->dev, "Unknown HDMI output type\n"); 534 dev_err(rdev->dev, "Invalid encoder for HDMI: 0x%X\n",
535 radeon_encoder->encoder_id);
528 break; 536 break;
529 } 537 }
538 WREG32(HDMI0_CONTROL + offset, hdmi);
530 } 539 }
531 540
532 if (rdev->irq.installed) { 541 if (rdev->irq.installed) {
@@ -565,25 +574,28 @@ void r600_hdmi_disable(struct drm_encoder *encoder)
565 rdev->irq.afmt[offset == 0 ? 0 : 1] = false; 574 rdev->irq.afmt[offset == 0 ? 0 : 1] = false;
566 radeon_irq_set(rdev); 575 radeon_irq_set(rdev);
567 576
568 577 /* Older chipsets not handled by AtomBIOS */
569 if (ASIC_IS_DCE5(rdev)) { 578 if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) {
570 /* TODO */
571 } else if (rdev->family >= CHIP_R600 && !ASIC_IS_DCE3(rdev)) {
572 switch (radeon_encoder->encoder_id) { 579 switch (radeon_encoder->encoder_id) {
573 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: 580 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
574 WREG32_P(AVIVO_TMDSA_CNTL, 0, 581 WREG32_P(AVIVO_TMDSA_CNTL, 0,
575 ~AVIVO_TMDSA_CNTL_HDMI_EN); 582 ~AVIVO_TMDSA_CNTL_HDMI_EN);
576 WREG32(HDMI0_CONTROL + offset, 0);
577 break; 583 break;
578 case ENCODER_OBJECT_ID_INTERNAL_LVTM1: 584 case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
579 WREG32_P(AVIVO_LVTMA_CNTL, 0, 585 WREG32_P(AVIVO_LVTMA_CNTL, 0,
580 ~AVIVO_LVTMA_CNTL_HDMI_EN); 586 ~AVIVO_LVTMA_CNTL_HDMI_EN);
581 WREG32(HDMI0_CONTROL + offset, 0); 587 break;
588 case ENCODER_OBJECT_ID_INTERNAL_DDI:
589 WREG32_P(DDIA_CNTL, 0, ~DDIA_HDMI_EN);
590 break;
591 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
582 break; 592 break;
583 default: 593 default:
584 dev_err(rdev->dev, "Unknown HDMI output type\n"); 594 dev_err(rdev->dev, "Invalid encoder for HDMI: 0x%X\n",
595 radeon_encoder->encoder_id);
585 break; 596 break;
586 } 597 }
598 WREG32(HDMI0_CONTROL + offset, HDMI0_ERROR_ACK);
587 } 599 }
588 600
589 radeon_encoder->hdmi_enabled = false; 601 radeon_encoder->hdmi_enabled = false;