~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to drivers/gpu/drm/radeon/radeon_combios.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
505
505
         * DDC_VGA           = RADEON_GPIO_VGA_DDC
506
506
         * DDC_LCD           = RADEON_GPIOPAD_MASK
507
507
         * DDC_GPIO          = RADEON_MDGPIO_MASK
508
 
         * r1xx/r2xx
 
508
         * r1xx
509
509
         * DDC_MONID         = RADEON_GPIO_MONID
510
510
         * DDC_CRT2          = RADEON_GPIO_CRT2_DDC
511
 
         * r3xx
512
 
         * DDC_MONID         = RADEON_GPIO_MONID
513
 
         * DDC_CRT2          = RADEON_GPIO_DVI_DDC
 
511
         * r200
 
512
         * DDC_MONID         = RADEON_GPIO_MONID
 
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
520
         * rs3xx/rs4xx
515
521
         * DDC_MONID         = RADEON_GPIOPAD_MASK
516
522
         * DDC_CRT2          = RADEON_GPIO_MONID
537
543
                    rdev->family == CHIP_RS400 ||
538
544
                    rdev->family == CHIP_RS480)
539
545
                        ddc_line = RADEON_GPIOPAD_MASK;
540
 
                else
 
546
                else if (rdev->family == CHIP_R300 ||
 
547
                         rdev->family == CHIP_R350) {
 
548
                        ddc_line = RADEON_GPIO_DVI_DDC;
 
549
                        ddc = DDC_DVI;
 
550
                } else
541
551
                        ddc_line = RADEON_GPIO_MONID;
542
552
                break;
543
553
        case DDC_CRT2:
544
 
                if (rdev->family == CHIP_RS300 ||
545
 
                    rdev->family == CHIP_RS400 ||
546
 
                    rdev->family == CHIP_RS480)
547
 
                        ddc_line = RADEON_GPIO_MONID;
548
 
                else if (rdev->family >= CHIP_R300) {
 
554
                if (rdev->family == CHIP_R200 ||
 
555
                    rdev->family == CHIP_R300 ||
 
556
                    rdev->family == CHIP_R350) {
549
557
                        ddc_line = RADEON_GPIO_DVI_DDC;
550
558
                        ddc = DDC_DVI;
 
559
                } else if (rdev->family == CHIP_RS300 ||
 
560
                           rdev->family == CHIP_RS400 ||
 
561
                           rdev->family == CHIP_RS480)
 
562
                        ddc_line = RADEON_GPIO_MONID;
 
563
                else if (rdev->family >= CHIP_RV350) {
 
564
                        ddc_line = RADEON_GPIO_MONID;
 
565
                        ddc = DDC_MONID;
551
566
                } else
552
567
                        ddc_line = RADEON_GPIO_CRT2_DDC;
553
568
                break;
709
724
        struct drm_device *dev = rdev->ddev;
710
725
        struct radeon_i2c_bus_rec i2c;
711
726
 
 
727
        /* actual hw pads
 
728
         * r1xx/rs2xx/rs3xx
 
729
         * 0x60, 0x64, 0x68, 0x6c, gpiopads, mm
 
730
         * r200
 
731
         * 0x60, 0x64, 0x68, mm
 
732
         * r300/r350
 
733
         * 0x60, 0x64, mm
 
734
         * rv2xx/rv3xx/rs4xx
 
735
         * 0x60, 0x64, 0x68, gpiopads, mm
 
736
         */
712
737
 
 
738
        /* 0x60 */
713
739
        i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0);
714
740
        rdev->i2c_bus[0] = radeon_i2c_create(dev, &i2c, "DVI_DDC");
715
 
 
 
741
        /* 0x64 */
716
742
        i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0);
717
743
        rdev->i2c_bus[1] = radeon_i2c_create(dev, &i2c, "VGA_DDC");
718
744
 
 
745
        /* mm i2c */
719
746
        i2c.valid = true;
720
747
        i2c.hw_capable = true;
721
748
        i2c.mm_i2c = true;
722
749
        i2c.i2c_id = 0xa0;
723
750
        rdev->i2c_bus[2] = radeon_i2c_create(dev, &i2c, "MM_I2C");
724
751
 
725
 
        if (rdev->family == CHIP_RS300 ||
726
 
            rdev->family == CHIP_RS400 ||
727
 
            rdev->family == CHIP_RS480) {
 
752
        if (rdev->family == CHIP_R300 ||
 
753
            rdev->family == CHIP_R350) {
 
754
                /* only 2 sw i2c pads */
 
755
        } else if (rdev->family == CHIP_RS300 ||
 
756
                   rdev->family == CHIP_RS400 ||
 
757
                   rdev->family == CHIP_RS480) {
728
758
                u16 offset;
729
759
                u8 id, blocks, clk, data;
730
760
                int i;
731
761
 
 
762
                /* 0x68 */
732
763
                i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0);
733
764
                rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID");
734
765
 
740
771
                                if (id == 136) {
741
772
                                        clk = RBIOS8(offset + 3 + (i * 5) + 3);
742
773
                                        data = RBIOS8(offset + 3 + (i * 5) + 4);
 
774
                                        /* gpiopad */
743
775
                                        i2c = combios_setup_i2c_bus(rdev, DDC_MONID,
744
776
                                                                    (1 << clk), (1 << data));
745
777
                                        rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK");
747
779
                                }
748
780
                        }
749
781
                }
750
 
 
751
 
        } else if (rdev->family >= CHIP_R300) {
 
782
        } else if ((rdev->family == CHIP_R200) ||
 
783
                   (rdev->family >= CHIP_R300)) {
 
784
                /* 0x68 */
752
785
                i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0);
753
786
                rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID");
754
787
        } else {
 
788
                /* 0x68 */
755
789
                i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 0, 0);
756
790
                rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "MONID");
757
 
 
 
791
                /* 0x6c */
758
792
                i2c = combios_setup_i2c_bus(rdev, DDC_CRT2, 0, 0);
759
793
                rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "CRT2_DDC");
760
794
        }
833
867
                rdev->clock.default_sclk = sclk;
834
868
                rdev->clock.default_mclk = mclk;
835
869
 
 
870
                if (RBIOS32(pll_info + 0x16))
 
871
                        rdev->clock.max_pixel_clock = RBIOS32(pll_info + 0x16);
 
872
                else
 
873
                        rdev->clock.max_pixel_clock = 35000; /* might need something asic specific */
 
874
 
836
875
                return true;
837
876
        }
838
877
        return false;
1515
1554
                           (rdev->pdev->subsystem_device == 0x4a48)) {
1516
1555
                        /* Mac X800 */
1517
1556
                        rdev->mode_info.connector_table = CT_MAC_X800;
1518
 
                } else if ((rdev->pdev->device == 0x4150) &&
 
1557
                } else if ((of_machine_is_compatible("PowerMac7,2") ||
 
1558
                            of_machine_is_compatible("PowerMac7,3")) &&
 
1559
                           (rdev->pdev->device == 0x4150) &&
1519
1560
                           (rdev->pdev->subsystem_vendor == 0x1002) &&
1520
1561
                           (rdev->pdev->subsystem_device == 0x4150)) {
1521
 
                        /* Mac G5 9600 */
 
1562
                        /* Mac G5 tower 9600 */
1522
1563
                        rdev->mode_info.connector_table = CT_MAC_G5_9600;
1523
1564
                } else
1524
1565
#endif /* CONFIG_PPC_PMAC */
2504
2545
        return true;
2505
2546
}
2506
2547
 
 
2548
static const char *thermal_controller_names[] = {
 
2549
        "NONE",
 
2550
        "lm63",
 
2551
        "adm1032",
 
2552
};
 
2553
 
2507
2554
void radeon_combios_get_power_modes(struct radeon_device *rdev)
2508
2555
{
2509
2556
        struct drm_device *dev = rdev->ddev;
2524
2571
                return;
2525
2572
        }
2526
2573
 
 
2574
        /* check for a thermal chip */
 
2575
        offset = combios_get_table_offset(dev, COMBIOS_OVERDRIVE_INFO_TABLE);
 
2576
        if (offset) {
 
2577
                u8 thermal_controller = 0, gpio = 0, i2c_addr = 0, clk_bit = 0, data_bit = 0;
 
2578
                struct radeon_i2c_bus_rec i2c_bus;
 
2579
 
 
2580
                rev = RBIOS8(offset);
 
2581
 
 
2582
                if (rev == 0) {
 
2583
                        thermal_controller = RBIOS8(offset + 3);
 
2584
                        gpio = RBIOS8(offset + 4) & 0x3f;
 
2585
                        i2c_addr = RBIOS8(offset + 5);
 
2586
                } else if (rev == 1) {
 
2587
                        thermal_controller = RBIOS8(offset + 4);
 
2588
                        gpio = RBIOS8(offset + 5) & 0x3f;
 
2589
                        i2c_addr = RBIOS8(offset + 6);
 
2590
                } else if (rev == 2) {
 
2591
                        thermal_controller = RBIOS8(offset + 4);
 
2592
                        gpio = RBIOS8(offset + 5) & 0x3f;
 
2593
                        i2c_addr = RBIOS8(offset + 6);
 
2594
                        clk_bit = RBIOS8(offset + 0xa);
 
2595
                        data_bit = RBIOS8(offset + 0xb);
 
2596
                }
 
2597
                if ((thermal_controller > 0) && (thermal_controller < 3)) {
 
2598
                        DRM_INFO("Possible %s thermal controller at 0x%02x\n",
 
2599
                                 thermal_controller_names[thermal_controller],
 
2600
                                 i2c_addr >> 1);
 
2601
                        if (gpio == DDC_LCD) {
 
2602
                                /* MM i2c */
 
2603
                                i2c_bus.valid = true;
 
2604
                                i2c_bus.hw_capable = true;
 
2605
                                i2c_bus.mm_i2c = true;
 
2606
                                i2c_bus.i2c_id = 0xa0;
 
2607
                        } else if (gpio == DDC_GPIO)
 
2608
                                i2c_bus = combios_setup_i2c_bus(rdev, gpio, 1 << clk_bit, 1 << data_bit);
 
2609
                        else
 
2610
                                i2c_bus = combios_setup_i2c_bus(rdev, gpio, 0, 0);
 
2611
                        rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus);
 
2612
                        if (rdev->pm.i2c_bus) {
 
2613
                                struct i2c_board_info info = { };
 
2614
                                const char *name = thermal_controller_names[thermal_controller];
 
2615
                                info.addr = i2c_addr >> 1;
 
2616
                                strlcpy(info.type, name, sizeof(info.type));
 
2617
                                i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
 
2618
                        }
 
2619
                }
 
2620
        }
 
2621
 
2527
2622
        if (rdev->flags & RADEON_IS_MOBILITY) {
2528
2623
                offset = combios_get_table_offset(dev, COMBIOS_POWERPLAY_INFO_TABLE);
2529
2624
                if (offset) {