diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_combios.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_combios.c | 77 |
1 files changed, 69 insertions, 8 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 5e1474cde4b4..18c84cf3eafa 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -479,6 +479,17 @@ radeon_combios_get_hardcoded_edid(struct radeon_device *rdev) | |||
479 | return NULL; | 479 | return NULL; |
480 | } | 480 | } |
481 | 481 | ||
482 | /* standard i2c gpio lines */ | ||
483 | #define RADEON_I2C_MONID_ID 0 | ||
484 | #define RADEON_I2C_DVI_ID 1 | ||
485 | #define RADEON_I2C_VGA_ID 2 | ||
486 | #define RADEON_I2C_CRT2_ID 3 | ||
487 | #define RADEON_I2C_MM_ID 4 | ||
488 | /* custom defined gpio lines */ | ||
489 | #define RADEON_I2C_LCD_ID 5 /* ddc for laptop panels */ | ||
490 | #define RADEON_I2C_GPIO_ID 6 /* rs4xx gpio ddc */ | ||
491 | #define RADEON_I2C_DVO_ID 7 /* i2c bus for dvo */ | ||
492 | |||
482 | static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rdev, | 493 | static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rdev, |
483 | int ddc_line) | 494 | int ddc_line) |
484 | { | 495 | { |
@@ -599,7 +610,24 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
599 | break; | 610 | break; |
600 | } | 611 | } |
601 | i2c.mm_i2c = false; | 612 | i2c.mm_i2c = false; |
602 | i2c.i2c_id = 0; | 613 | |
614 | switch (ddc_line) { | ||
615 | case RADEON_GPIO_MONID: | ||
616 | i2c.i2c_id = RADEON_I2C_MONID_ID; | ||
617 | break; | ||
618 | case RADEON_GPIO_DVI_DDC: | ||
619 | i2c.i2c_id = RADEON_I2C_DVI_ID; | ||
620 | break; | ||
621 | case RADEON_GPIO_VGA_DDC: | ||
622 | i2c.i2c_id = RADEON_I2C_VGA_ID; | ||
623 | break; | ||
624 | case RADEON_GPIO_CRT2_DDC: | ||
625 | i2c.i2c_id = RADEON_I2C_CRT2_ID; | ||
626 | break; | ||
627 | default: | ||
628 | i2c.i2c_id = 0xff; | ||
629 | break; | ||
630 | } | ||
603 | i2c.hpd = RADEON_HPD_NONE; | 631 | i2c.hpd = RADEON_HPD_NONE; |
604 | 632 | ||
605 | if (ddc_line) | 633 | if (ddc_line) |
@@ -610,6 +638,30 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde | |||
610 | return i2c; | 638 | return i2c; |
611 | } | 639 | } |
612 | 640 | ||
641 | void radeon_combios_i2c_init(struct radeon_device *rdev) | ||
642 | { | ||
643 | struct drm_device *dev = rdev->ddev; | ||
644 | struct radeon_i2c_bus_rec i2c; | ||
645 | |||
646 | i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); | ||
647 | rdev->i2c_bus[0] = radeon_i2c_create(dev, &i2c, "MONID"); | ||
648 | |||
649 | i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | ||
650 | rdev->i2c_bus[1] = radeon_i2c_create(dev, &i2c, "DVI_DDC"); | ||
651 | |||
652 | i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | ||
653 | rdev->i2c_bus[2] = radeon_i2c_create(dev, &i2c, "VGA_DDC"); | ||
654 | |||
655 | i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); | ||
656 | rdev->i2c_bus[3] = radeon_i2c_create(dev, &i2c, "CRT2_DDC"); | ||
657 | |||
658 | i2c.valid = true; | ||
659 | i2c.hw_capable = true; | ||
660 | i2c.mm_i2c = true; | ||
661 | i2c.i2c_id = RADEON_I2C_MM_ID; | ||
662 | rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "MM_I2C"); | ||
663 | } | ||
664 | |||
613 | bool radeon_combios_get_clock_info(struct drm_device *dev) | 665 | bool radeon_combios_get_clock_info(struct drm_device *dev) |
614 | { | 666 | { |
615 | struct radeon_device *rdev = dev->dev_private; | 667 | struct radeon_device *rdev = dev->dev_private; |
@@ -1248,7 +1300,7 @@ bool radeon_legacy_get_ext_tmds_info_from_table(struct radeon_encoder *encoder, | |||
1248 | 1300 | ||
1249 | /* default for macs */ | 1301 | /* default for macs */ |
1250 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); | 1302 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); |
1251 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1303 | tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
1252 | 1304 | ||
1253 | /* XXX some macs have duallink chips */ | 1305 | /* XXX some macs have duallink chips */ |
1254 | switch (rdev->mode_info.connector_table) { | 1306 | switch (rdev->mode_info.connector_table) { |
@@ -1303,7 +1355,9 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder | |||
1303 | i2c_bus.en_data_reg = RADEON_GPIOPAD_EN; | 1355 | i2c_bus.en_data_reg = RADEON_GPIOPAD_EN; |
1304 | i2c_bus.y_clk_reg = RADEON_GPIOPAD_Y; | 1356 | i2c_bus.y_clk_reg = RADEON_GPIOPAD_Y; |
1305 | i2c_bus.y_data_reg = RADEON_GPIOPAD_Y; | 1357 | i2c_bus.y_data_reg = RADEON_GPIOPAD_Y; |
1306 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1358 | i2c_bus.i2c_id = RADEON_I2C_DVO_ID; |
1359 | radeon_i2c_add(rdev, &i2c_bus, "DVO"); | ||
1360 | tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); | ||
1307 | tmds->dvo_chip = DVO_SIL164; | 1361 | tmds->dvo_chip = DVO_SIL164; |
1308 | tmds->slave_addr = 0x70 >> 1; /* 7 bit addressing */ | 1362 | tmds->slave_addr = 0x70 >> 1; /* 7 bit addressing */ |
1309 | break; | 1363 | break; |
@@ -1321,15 +1375,15 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder | |||
1321 | switch (gpio) { | 1375 | switch (gpio) { |
1322 | case DDC_MONID: | 1376 | case DDC_MONID: |
1323 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); | 1377 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); |
1324 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1378 | tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
1325 | break; | 1379 | break; |
1326 | case DDC_DVI: | 1380 | case DDC_DVI: |
1327 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); | 1381 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1328 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1382 | tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
1329 | break; | 1383 | break; |
1330 | case DDC_VGA: | 1384 | case DDC_VGA: |
1331 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); | 1385 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1332 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1386 | tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
1333 | break; | 1387 | break; |
1334 | case DDC_CRT2: | 1388 | case DDC_CRT2: |
1335 | /* R3xx+ chips don't have GPIO_CRT2_DDC gpio pad */ | 1389 | /* R3xx+ chips don't have GPIO_CRT2_DDC gpio pad */ |
@@ -1337,13 +1391,14 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder | |||
1337 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); | 1391 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); |
1338 | else | 1392 | else |
1339 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); | 1393 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); |
1340 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1394 | tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); |
1341 | break; | 1395 | break; |
1342 | case DDC_LCD: /* MM i2c */ | 1396 | case DDC_LCD: /* MM i2c */ |
1343 | i2c_bus.valid = true; | 1397 | i2c_bus.valid = true; |
1344 | i2c_bus.hw_capable = true; | 1398 | i2c_bus.hw_capable = true; |
1345 | i2c_bus.mm_i2c = true; | 1399 | i2c_bus.mm_i2c = true; |
1346 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1400 | i2c_bus.i2c_id = RADEON_I2C_MM_ID; |
1401 | tmds->i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); | ||
1347 | break; | 1402 | break; |
1348 | default: | 1403 | default: |
1349 | DRM_ERROR("Unsupported gpio %d\n", gpio); | 1404 | DRM_ERROR("Unsupported gpio %d\n", gpio); |
@@ -1926,6 +1981,8 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev, | |||
1926 | ddc_i2c->en_data_mask = 0x80; | 1981 | ddc_i2c->en_data_mask = 0x80; |
1927 | ddc_i2c->y_clk_mask = (0x20 << 8); | 1982 | ddc_i2c->y_clk_mask = (0x20 << 8); |
1928 | ddc_i2c->y_data_mask = 0x80; | 1983 | ddc_i2c->y_data_mask = 0x80; |
1984 | ddc_i2c->i2c_id = RADEON_I2C_GPIO_ID; | ||
1985 | radeon_i2c_add(rdev, ddc_i2c, "GPIO_DDC"); | ||
1929 | } | 1986 | } |
1930 | 1987 | ||
1931 | /* R3xx+ chips don't have GPIO_CRT2_DDC gpio pad */ | 1988 | /* R3xx+ chips don't have GPIO_CRT2_DDC gpio pad */ |
@@ -2318,6 +2375,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
2318 | RBIOS32(lcd_ddc_info + 3); | 2375 | RBIOS32(lcd_ddc_info + 3); |
2319 | ddc_i2c.y_data_mask = | 2376 | ddc_i2c.y_data_mask = |
2320 | RBIOS32(lcd_ddc_info + 7); | 2377 | RBIOS32(lcd_ddc_info + 7); |
2378 | ddc_i2c.i2c_id = RADEON_I2C_LCD_ID; | ||
2379 | radeon_i2c_add(rdev, &ddc_i2c, "LCD"); | ||
2321 | break; | 2380 | break; |
2322 | case DDC_GPIO: | 2381 | case DDC_GPIO: |
2323 | ddc_i2c = | 2382 | ddc_i2c = |
@@ -2339,6 +2398,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
2339 | RBIOS32(lcd_ddc_info + 3); | 2398 | RBIOS32(lcd_ddc_info + 3); |
2340 | ddc_i2c.y_data_mask = | 2399 | ddc_i2c.y_data_mask = |
2341 | RBIOS32(lcd_ddc_info + 7); | 2400 | RBIOS32(lcd_ddc_info + 7); |
2401 | ddc_i2c.i2c_id = RADEON_I2C_LCD_ID; | ||
2402 | radeon_i2c_add(rdev, &ddc_i2c, "LCD"); | ||
2342 | break; | 2403 | break; |
2343 | default: | 2404 | default: |
2344 | ddc_i2c.valid = false; | 2405 | ddc_i2c.valid = false; |