aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-12-29 12:09:17 -0500
committerDave Airlie <airlied@redhat.com>2010-01-05 20:31:55 -0500
commit246263ccc31e4ba2886cca17000bf09ea683eac5 (patch)
treece76a7dc9f515b23308df3a7580d0ce852a8bf14 /drivers/gpu/drm/radeon
parentb9597a1c6fa6cbc938f14ab6a7fe09047b3a346b (diff)
drm/radeon/kms: add primary dac adj values table
Look up primary dac adj values from the table if there is no bios or bios dac table to reference. The lookup table may need to be adjusted for certain families. Should fix kernel bug 14945. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c50
1 files changed, 41 insertions, 9 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index fd94dbca33ac..58f342659cc7 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -595,6 +595,34 @@ bool radeon_combios_get_clock_info(struct drm_device *dev)
595 return false; 595 return false;
596} 596}
597 597
598static const uint32_t default_primarydac_adj[CHIP_LAST] = {
599 0x00000808, /* r100 */
600 0x00000808, /* rv100 */
601 0x00000808, /* rs100 */
602 0x00000808, /* rv200 */
603 0x00000808, /* rs200 */
604 0x00000808, /* r200 */
605 0x00000808, /* rv250 */
606 0x00000000, /* rs300 */
607 0x00000808, /* rv280 */
608 0x00000808, /* r300 */
609 0x00000808, /* r350 */
610 0x00000808, /* rv350 */
611 0x00000808, /* rv380 */
612 0x00000808, /* r420 */
613 0x00000808, /* r423 */
614 0x00000808, /* rv410 */
615 0x00000000, /* rs400 */
616 0x00000000, /* rs480 */
617};
618
619static void radeon_legacy_get_primary_dac_info_from_table(struct radeon_device *rdev,
620 struct radeon_encoder_primary_dac *p_dac)
621{
622 p_dac->ps2_pdac_adj = default_primarydac_adj[rdev->family];
623 return;
624}
625
598struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct 626struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
599 radeon_encoder 627 radeon_encoder
600 *encoder) 628 *encoder)
@@ -604,20 +632,20 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
604 uint16_t dac_info; 632 uint16_t dac_info;
605 uint8_t rev, bg, dac; 633 uint8_t rev, bg, dac;
606 struct radeon_encoder_primary_dac *p_dac = NULL; 634 struct radeon_encoder_primary_dac *p_dac = NULL;
635 int found = 0;
607 636
608 if (rdev->bios == NULL) 637 p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac),
638 GFP_KERNEL);
639
640 if (!p_dac)
609 return NULL; 641 return NULL;
610 642
643 if (rdev->bios == NULL)
644 goto out;
645
611 /* check CRT table */ 646 /* check CRT table */
612 dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); 647 dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE);
613 if (dac_info) { 648 if (dac_info) {
614 p_dac =
615 kzalloc(sizeof(struct radeon_encoder_primary_dac),
616 GFP_KERNEL);
617
618 if (!p_dac)
619 return NULL;
620
621 rev = RBIOS8(dac_info) & 0x3; 649 rev = RBIOS8(dac_info) & 0x3;
622 if (rev < 2) { 650 if (rev < 2) {
623 bg = RBIOS8(dac_info + 0x2) & 0xf; 651 bg = RBIOS8(dac_info + 0x2) & 0xf;
@@ -628,9 +656,13 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
628 dac = RBIOS8(dac_info + 0x3) & 0xf; 656 dac = RBIOS8(dac_info + 0x3) & 0xf;
629 p_dac->ps2_pdac_adj = (bg << 8) | (dac); 657 p_dac->ps2_pdac_adj = (bg << 8) | (dac);
630 } 658 }
631 659 found = 1;
632 } 660 }
633 661
662out:
663 if (!found) /* fallback to defaults */
664 radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac);
665
634 return p_dac; 666 return p_dac;
635} 667}
636 668