aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2011-05-03 19:47:44 -0400
committerDave Airlie <airlied@redhat.com>2011-05-03 23:21:26 -0400
commit508c8d60bd08640db39146edbbfdbf01a802163d (patch)
tree0c2f8ee25c510b98a9461f83685a4ecaa426800f /drivers/gpu
parent87d7a1f9e6487bb4cc8d04bd0e27e11a97b5a7b3 (diff)
drm/radeon/kms: fix up r1xx-rs4xx i2c buses
Fix the vbios mapping and only add the actual buses that the cards have. The existing code was mostly correct. Just clean up a few cases on r2xx/r3xx and document that buses the hw actually has. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c59
1 files changed, 43 insertions, 16 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 089ab92ad084..0e350b74ea2e 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -505,12 +505,18 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
505 * DDC_VGA = RADEON_GPIO_VGA_DDC 505 * DDC_VGA = RADEON_GPIO_VGA_DDC
506 * DDC_LCD = RADEON_GPIOPAD_MASK 506 * DDC_LCD = RADEON_GPIOPAD_MASK
507 * DDC_GPIO = RADEON_MDGPIO_MASK 507 * DDC_GPIO = RADEON_MDGPIO_MASK
508 * r1xx/r2xx 508 * r1xx
509 * DDC_MONID = RADEON_GPIO_MONID 509 * DDC_MONID = RADEON_GPIO_MONID
510 * DDC_CRT2 = RADEON_GPIO_CRT2_DDC 510 * DDC_CRT2 = RADEON_GPIO_CRT2_DDC
511 * r3xx 511 * r200
512 * DDC_MONID = RADEON_GPIO_MONID 512 * DDC_MONID = RADEON_GPIO_MONID
513 * DDC_CRT2 = RADEON_GPIO_DVI_DDC 513 * DDC_CRT2 = RADEON_GPIO_DVI_DDC
514 * r300/r350
515 * DDC_MONID = RADEON_GPIO_DVI_DDC
516 * DDC_CRT2 = RADEON_GPIO_DVI_DDC
517 * rv2xx/rv3xx
518 * DDC_MONID = RADEON_GPIO_MONID
519 * DDC_CRT2 = RADEON_GPIO_MONID
514 * rs3xx/rs4xx 520 * rs3xx/rs4xx
515 * DDC_MONID = RADEON_GPIOPAD_MASK 521 * DDC_MONID = RADEON_GPIOPAD_MASK
516 * DDC_CRT2 = RADEON_GPIO_MONID 522 * DDC_CRT2 = RADEON_GPIO_MONID
@@ -537,18 +543,21 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
537 rdev->family == CHIP_RS400 || 543 rdev->family == CHIP_RS400 ||
538 rdev->family == CHIP_RS480) 544 rdev->family == CHIP_RS480)
539 ddc_line = RADEON_GPIOPAD_MASK; 545 ddc_line = RADEON_GPIOPAD_MASK;
546 else if (rdev->family == CHIP_R300 ||
547 rdev->family == CHIP_R350)
548 ddc_line = RADEON_GPIO_DVI_DDC;
540 else 549 else
541 ddc_line = RADEON_GPIO_MONID; 550 ddc_line = RADEON_GPIO_MONID;
542 break; 551 break;
543 case DDC_CRT2: 552 case DDC_CRT2:
544 if (rdev->family == CHIP_RS300 || 553 if (rdev->family == CHIP_R200 ||
545 rdev->family == CHIP_RS400 || 554 rdev->family == CHIP_R300 ||
546 rdev->family == CHIP_RS480) 555 rdev->family == CHIP_R350)
547 ddc_line = RADEON_GPIO_MONID;
548 else if (rdev->family >= CHIP_R300) {
549 ddc_line = RADEON_GPIO_DVI_DDC; 556 ddc_line = RADEON_GPIO_DVI_DDC;
550 ddc = DDC_DVI; 557 else if (rdev->family == CHIP_RS300 ||
551 } else 558 rdev->family >= CHIP_RV350)
559 ddc_line = RADEON_GPIO_MONID;
560 else
552 ddc_line = RADEON_GPIO_CRT2_DDC; 561 ddc_line = RADEON_GPIO_CRT2_DDC;
553 break; 562 break;
554 } 563 }
@@ -709,26 +718,42 @@ void radeon_combios_i2c_init(struct radeon_device *rdev)
709 struct drm_device *dev = rdev->ddev; 718 struct drm_device *dev = rdev->ddev;
710 struct radeon_i2c_bus_rec i2c; 719 struct radeon_i2c_bus_rec i2c;
711 720
721 /* actual hw pads
722 * r1xx/rs2xx/rs3xx
723 * 0x60, 0x64, 0x68, 0x6c, gpiopads, mm
724 * r200
725 * 0x60, 0x64, 0x68, mm
726 * r300/r350
727 * 0x60, 0x64, mm
728 * rv2xx/rv3xx/rs4xx
729 * 0x60, 0x64, 0x68, gpiopads, mm
730 */
712 731
732 /* 0x60 */
713 i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0); 733 i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0);
714 rdev->i2c_bus[0] = radeon_i2c_create(dev, &i2c, "DVI_DDC"); 734 rdev->i2c_bus[0] = radeon_i2c_create(dev, &i2c, "DVI_DDC");
715 735 /* 0x64 */
716 i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0); 736 i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0);
717 rdev->i2c_bus[1] = radeon_i2c_create(dev, &i2c, "VGA_DDC"); 737 rdev->i2c_bus[1] = radeon_i2c_create(dev, &i2c, "VGA_DDC");
718 738
739 /* mm i2c */
719 i2c.valid = true; 740 i2c.valid = true;
720 i2c.hw_capable = true; 741 i2c.hw_capable = true;
721 i2c.mm_i2c = true; 742 i2c.mm_i2c = true;
722 i2c.i2c_id = 0xa0; 743 i2c.i2c_id = 0xa0;
723 rdev->i2c_bus[2] = radeon_i2c_create(dev, &i2c, "MM_I2C"); 744 rdev->i2c_bus[2] = radeon_i2c_create(dev, &i2c, "MM_I2C");
724 745
725 if (rdev->family == CHIP_RS300 || 746 if (rdev->family == CHIP_R300 ||
726 rdev->family == CHIP_RS400 || 747 rdev->family == CHIP_R350) {
727 rdev->family == CHIP_RS480) { 748 /* only 2 sw i2c pads */
749 } else if (rdev->family == CHIP_RS300 ||
750 rdev->family == CHIP_RS400 ||
751 rdev->family == CHIP_RS480) {
728 u16 offset; 752 u16 offset;
729 u8 id, blocks, clk, data; 753 u8 id, blocks, clk, data;
730 int i; 754 int i;
731 755
756 /* 0x68 */
732 i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); 757 i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0);
733 rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID"); 758 rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID");
734 759
@@ -740,6 +765,7 @@ void radeon_combios_i2c_init(struct radeon_device *rdev)
740 if (id == 136) { 765 if (id == 136) {
741 clk = RBIOS8(offset + 3 + (i * 5) + 3); 766 clk = RBIOS8(offset + 3 + (i * 5) + 3);
742 data = RBIOS8(offset + 3 + (i * 5) + 4); 767 data = RBIOS8(offset + 3 + (i * 5) + 4);
768 /* gpiopad */
743 i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 769 i2c = combios_setup_i2c_bus(rdev, DDC_MONID,
744 (1 << clk), (1 << data)); 770 (1 << clk), (1 << data));
745 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK"); 771 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK");
@@ -747,14 +773,15 @@ void radeon_combios_i2c_init(struct radeon_device *rdev)
747 } 773 }
748 } 774 }
749 } 775 }
750 776 } else if (rdev->family >= CHIP_R200) {
751 } else if (rdev->family >= CHIP_R300) { 777 /* 0x68 */
752 i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); 778 i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0);
753 rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID"); 779 rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID");
754 } else { 780 } else {
781 /* 0x68 */
755 i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0); 782 i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0);
756 rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID"); 783 rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID");
757 784 /* 0x6c */
758 i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0); 785 i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0);
759 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "CRT2_DDC"); 786 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "CRT2_DDC");
760 } 787 }