diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-11-23 17:39:28 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-12-07 19:22:41 -0500 |
commit | 6a93cb250a60af1bb7b4070949f8546a2fdc52ef (patch) | |
tree | 2c734dcc0a4c39ec5c626b17912845eae1448828 /drivers/gpu/drm/radeon/radeon_combios.c | |
parent | 1a66c95a64c9ae0bc8382254f544b24b23f498ec (diff) |
drm/radeon/kms: i2c reorg
- keep the atom i2c id in the i2c rec
- fix gpio regs for GPIO and MDGPIO on pre-avivo chips
- track whether the i2c line is hw capable
- track whether the i2c line uses the multimedia i2c block
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_combios.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_combios.c | 158 |
1 files changed, 91 insertions, 67 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 14d3555e4afe..b6761cde1ecb 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -442,29 +442,39 @@ static uint16_t combios_get_table_offset(struct drm_device *dev, | |||
442 | 442 | ||
443 | } | 443 | } |
444 | 444 | ||
445 | struct radeon_i2c_bus_rec combios_setup_i2c_bus(int ddc_line) | 445 | static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rdev, |
446 | int ddc_line) | ||
446 | { | 447 | { |
447 | struct radeon_i2c_bus_rec i2c; | 448 | struct radeon_i2c_bus_rec i2c; |
448 | 449 | ||
449 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; | 450 | if (ddc_line == RADEON_GPIOPAD_MASK) { |
450 | i2c.mask_data_mask = RADEON_GPIO_EN_0; | 451 | i2c.mask_clk_reg = RADEON_GPIOPAD_MASK; |
451 | i2c.a_clk_mask = RADEON_GPIO_A_1; | 452 | i2c.mask_data_reg = RADEON_GPIOPAD_MASK; |
452 | i2c.a_data_mask = RADEON_GPIO_A_0; | 453 | i2c.a_clk_reg = RADEON_GPIOPAD_A; |
453 | i2c.en_clk_mask = RADEON_GPIO_EN_1; | 454 | i2c.a_data_reg = RADEON_GPIOPAD_A; |
454 | i2c.en_data_mask = RADEON_GPIO_EN_0; | 455 | i2c.en_clk_reg = RADEON_GPIOPAD_EN; |
455 | i2c.y_clk_mask = RADEON_GPIO_Y_1; | 456 | i2c.en_data_reg = RADEON_GPIOPAD_EN; |
456 | i2c.y_data_mask = RADEON_GPIO_Y_0; | 457 | i2c.y_clk_reg = RADEON_GPIOPAD_Y; |
457 | if ((ddc_line == RADEON_LCD_GPIO_MASK) || | 458 | i2c.y_data_reg = RADEON_GPIOPAD_Y; |
458 | (ddc_line == RADEON_MDGPIO_EN_REG)) { | 459 | } else if (ddc_line == RADEON_MDGPIO_MASK) { |
459 | i2c.mask_clk_reg = ddc_line; | 460 | i2c.mask_clk_reg = RADEON_MDGPIO_MASK; |
460 | i2c.mask_data_reg = ddc_line; | 461 | i2c.mask_data_reg = RADEON_MDGPIO_MASK; |
461 | i2c.a_clk_reg = ddc_line; | 462 | i2c.a_clk_reg = RADEON_MDGPIO_A; |
462 | i2c.a_data_reg = ddc_line; | 463 | i2c.a_data_reg = RADEON_MDGPIO_A; |
463 | i2c.en_clk_reg = ddc_line; | 464 | i2c.en_clk_reg = RADEON_MDGPIO_EN; |
464 | i2c.en_data_reg = ddc_line; | 465 | i2c.en_data_reg = RADEON_MDGPIO_EN; |
465 | i2c.y_clk_reg = ddc_line + 4; | 466 | i2c.y_clk_reg = RADEON_MDGPIO_Y; |
466 | i2c.y_data_reg = ddc_line + 4; | 467 | i2c.y_data_reg = RADEON_MDGPIO_Y; |
467 | } else { | 468 | } else { |
469 | i2c.mask_clk_mask = RADEON_GPIO_EN_1; | ||
470 | i2c.mask_data_mask = RADEON_GPIO_EN_0; | ||
471 | i2c.a_clk_mask = RADEON_GPIO_A_1; | ||
472 | i2c.a_data_mask = RADEON_GPIO_A_0; | ||
473 | i2c.en_clk_mask = RADEON_GPIO_EN_1; | ||
474 | i2c.en_data_mask = RADEON_GPIO_EN_0; | ||
475 | i2c.y_clk_mask = RADEON_GPIO_Y_1; | ||
476 | i2c.y_data_mask = RADEON_GPIO_Y_0; | ||
477 | |||
468 | i2c.mask_clk_reg = ddc_line; | 478 | i2c.mask_clk_reg = ddc_line; |
469 | i2c.mask_data_reg = ddc_line; | 479 | i2c.mask_data_reg = ddc_line; |
470 | i2c.a_clk_reg = ddc_line; | 480 | i2c.a_clk_reg = ddc_line; |
@@ -475,6 +485,28 @@ struct radeon_i2c_bus_rec combios_setup_i2c_bus(int ddc_line) | |||
475 | i2c.y_data_reg = ddc_line; | 485 | i2c.y_data_reg = ddc_line; |
476 | } | 486 | } |
477 | 487 | ||
488 | if (rdev->family < CHIP_R200) | ||
489 | i2c.hw_capable = false; | ||
490 | else { | ||
491 | switch (ddc_line) { | ||
492 | case RADEON_GPIO_VGA_DDC: | ||
493 | case RADEON_GPIO_DVI_DDC: | ||
494 | i2c.hw_capable = true; | ||
495 | break; | ||
496 | case RADEON_GPIO_MONID: | ||
497 | /* hw i2c on RADEON_GPIO_MONID doesn't seem to work | ||
498 | * reliably on some pre-r4xx hardware; not sure why. | ||
499 | */ | ||
500 | i2c.hw_capable = false; | ||
501 | break; | ||
502 | default: | ||
503 | i2c.hw_capable = false; | ||
504 | break; | ||
505 | } | ||
506 | } | ||
507 | i2c.mm_i2c = false; | ||
508 | i2c.i2c_id = 0; | ||
509 | |||
478 | if (ddc_line) | 510 | if (ddc_line) |
479 | i2c.valid = true; | 511 | i2c.valid = true; |
480 | else | 512 | else |
@@ -1077,7 +1109,7 @@ bool radeon_legacy_get_ext_tmds_info_from_table(struct radeon_encoder *encoder, | |||
1077 | struct radeon_i2c_bus_rec i2c_bus; | 1109 | struct radeon_i2c_bus_rec i2c_bus; |
1078 | 1110 | ||
1079 | /* default for macs */ | 1111 | /* default for macs */ |
1080 | i2c_bus = combios_setup_i2c_bus(RADEON_GPIO_MONID); | 1112 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); |
1081 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1113 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); |
1082 | 1114 | ||
1083 | /* XXX some macs have duallink chips */ | 1115 | /* XXX some macs have duallink chips */ |
@@ -1153,23 +1185,23 @@ bool radeon_legacy_get_ext_tmds_info_from_combios(struct radeon_encoder *encoder | |||
1153 | gpio = RBIOS8(offset + 4 + 3); | 1185 | gpio = RBIOS8(offset + 4 + 3); |
1154 | switch (gpio) { | 1186 | switch (gpio) { |
1155 | case DDC_MONID: | 1187 | case DDC_MONID: |
1156 | i2c_bus = combios_setup_i2c_bus(RADEON_GPIO_MONID); | 1188 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); |
1157 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1189 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); |
1158 | break; | 1190 | break; |
1159 | case DDC_DVI: | 1191 | case DDC_DVI: |
1160 | i2c_bus = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1192 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1161 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1193 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); |
1162 | break; | 1194 | break; |
1163 | case DDC_VGA: | 1195 | case DDC_VGA: |
1164 | i2c_bus = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1196 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1165 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1197 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); |
1166 | break; | 1198 | break; |
1167 | case DDC_CRT2: | 1199 | case DDC_CRT2: |
1168 | /* R3xx+ chips don't have GPIO_CRT2_DDC gpio pad */ | 1200 | /* R3xx+ chips don't have GPIO_CRT2_DDC gpio pad */ |
1169 | if (rdev->family >= CHIP_R300) | 1201 | if (rdev->family >= CHIP_R300) |
1170 | i2c_bus = combios_setup_i2c_bus(RADEON_GPIO_MONID); | 1202 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); |
1171 | else | 1203 | else |
1172 | i2c_bus = combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC); | 1204 | i2c_bus = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); |
1173 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); | 1205 | tmds->i2c_bus = radeon_i2c_create(dev, &i2c_bus, "DVO"); |
1174 | break; | 1206 | break; |
1175 | case DDC_LCD: /* MM i2c */ | 1207 | case DDC_LCD: /* MM i2c */ |
@@ -1254,7 +1286,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1254 | /* these are the most common settings */ | 1286 | /* these are the most common settings */ |
1255 | if (rdev->flags & RADEON_SINGLE_CRTC) { | 1287 | if (rdev->flags & RADEON_SINGLE_CRTC) { |
1256 | /* VGA - primary dac */ | 1288 | /* VGA - primary dac */ |
1257 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1289 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1258 | radeon_add_legacy_encoder(dev, | 1290 | radeon_add_legacy_encoder(dev, |
1259 | radeon_get_encoder_id(dev, | 1291 | radeon_get_encoder_id(dev, |
1260 | ATOM_DEVICE_CRT1_SUPPORT, | 1292 | ATOM_DEVICE_CRT1_SUPPORT, |
@@ -1267,7 +1299,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1267 | CONNECTOR_OBJECT_ID_VGA); | 1299 | CONNECTOR_OBJECT_ID_VGA); |
1268 | } else if (rdev->flags & RADEON_IS_MOBILITY) { | 1300 | } else if (rdev->flags & RADEON_IS_MOBILITY) { |
1269 | /* LVDS */ | 1301 | /* LVDS */ |
1270 | ddc_i2c = combios_setup_i2c_bus(RADEON_LCD_GPIO_MASK); | 1302 | ddc_i2c = combios_setup_i2c_bus(rdev, 0); |
1271 | radeon_add_legacy_encoder(dev, | 1303 | radeon_add_legacy_encoder(dev, |
1272 | radeon_get_encoder_id(dev, | 1304 | radeon_get_encoder_id(dev, |
1273 | ATOM_DEVICE_LCD1_SUPPORT, | 1305 | ATOM_DEVICE_LCD1_SUPPORT, |
@@ -1280,7 +1312,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1280 | CONNECTOR_OBJECT_ID_LVDS); | 1312 | CONNECTOR_OBJECT_ID_LVDS); |
1281 | 1313 | ||
1282 | /* VGA - primary dac */ | 1314 | /* VGA - primary dac */ |
1283 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1315 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1284 | radeon_add_legacy_encoder(dev, | 1316 | radeon_add_legacy_encoder(dev, |
1285 | radeon_get_encoder_id(dev, | 1317 | radeon_get_encoder_id(dev, |
1286 | ATOM_DEVICE_CRT1_SUPPORT, | 1318 | ATOM_DEVICE_CRT1_SUPPORT, |
@@ -1293,7 +1325,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1293 | CONNECTOR_OBJECT_ID_VGA); | 1325 | CONNECTOR_OBJECT_ID_VGA); |
1294 | } else { | 1326 | } else { |
1295 | /* DVI-I - tv dac, int tmds */ | 1327 | /* DVI-I - tv dac, int tmds */ |
1296 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1328 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1297 | radeon_add_legacy_encoder(dev, | 1329 | radeon_add_legacy_encoder(dev, |
1298 | radeon_get_encoder_id(dev, | 1330 | radeon_get_encoder_id(dev, |
1299 | ATOM_DEVICE_DFP1_SUPPORT, | 1331 | ATOM_DEVICE_DFP1_SUPPORT, |
@@ -1312,7 +1344,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1312 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); | 1344 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); |
1313 | 1345 | ||
1314 | /* VGA - primary dac */ | 1346 | /* VGA - primary dac */ |
1315 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1347 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1316 | radeon_add_legacy_encoder(dev, | 1348 | radeon_add_legacy_encoder(dev, |
1317 | radeon_get_encoder_id(dev, | 1349 | radeon_get_encoder_id(dev, |
1318 | ATOM_DEVICE_CRT1_SUPPORT, | 1350 | ATOM_DEVICE_CRT1_SUPPORT, |
@@ -1343,7 +1375,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1343 | DRM_INFO("Connector Table: %d (ibook)\n", | 1375 | DRM_INFO("Connector Table: %d (ibook)\n", |
1344 | rdev->mode_info.connector_table); | 1376 | rdev->mode_info.connector_table); |
1345 | /* LVDS */ | 1377 | /* LVDS */ |
1346 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1378 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1347 | radeon_add_legacy_encoder(dev, | 1379 | radeon_add_legacy_encoder(dev, |
1348 | radeon_get_encoder_id(dev, | 1380 | radeon_get_encoder_id(dev, |
1349 | ATOM_DEVICE_LCD1_SUPPORT, | 1381 | ATOM_DEVICE_LCD1_SUPPORT, |
@@ -1353,7 +1385,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1353 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, | 1385 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, |
1354 | CONNECTOR_OBJECT_ID_LVDS); | 1386 | CONNECTOR_OBJECT_ID_LVDS); |
1355 | /* VGA - TV DAC */ | 1387 | /* VGA - TV DAC */ |
1356 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1388 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1357 | radeon_add_legacy_encoder(dev, | 1389 | radeon_add_legacy_encoder(dev, |
1358 | radeon_get_encoder_id(dev, | 1390 | radeon_get_encoder_id(dev, |
1359 | ATOM_DEVICE_CRT2_SUPPORT, | 1391 | ATOM_DEVICE_CRT2_SUPPORT, |
@@ -1377,7 +1409,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1377 | DRM_INFO("Connector Table: %d (powerbook external tmds)\n", | 1409 | DRM_INFO("Connector Table: %d (powerbook external tmds)\n", |
1378 | rdev->mode_info.connector_table); | 1410 | rdev->mode_info.connector_table); |
1379 | /* LVDS */ | 1411 | /* LVDS */ |
1380 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1412 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1381 | radeon_add_legacy_encoder(dev, | 1413 | radeon_add_legacy_encoder(dev, |
1382 | radeon_get_encoder_id(dev, | 1414 | radeon_get_encoder_id(dev, |
1383 | ATOM_DEVICE_LCD1_SUPPORT, | 1415 | ATOM_DEVICE_LCD1_SUPPORT, |
@@ -1387,7 +1419,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1387 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, | 1419 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, |
1388 | CONNECTOR_OBJECT_ID_LVDS); | 1420 | CONNECTOR_OBJECT_ID_LVDS); |
1389 | /* DVI-I - primary dac, ext tmds */ | 1421 | /* DVI-I - primary dac, ext tmds */ |
1390 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1422 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1391 | radeon_add_legacy_encoder(dev, | 1423 | radeon_add_legacy_encoder(dev, |
1392 | radeon_get_encoder_id(dev, | 1424 | radeon_get_encoder_id(dev, |
1393 | ATOM_DEVICE_DFP2_SUPPORT, | 1425 | ATOM_DEVICE_DFP2_SUPPORT, |
@@ -1419,7 +1451,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1419 | DRM_INFO("Connector Table: %d (powerbook internal tmds)\n", | 1451 | DRM_INFO("Connector Table: %d (powerbook internal tmds)\n", |
1420 | rdev->mode_info.connector_table); | 1452 | rdev->mode_info.connector_table); |
1421 | /* LVDS */ | 1453 | /* LVDS */ |
1422 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1454 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1423 | radeon_add_legacy_encoder(dev, | 1455 | radeon_add_legacy_encoder(dev, |
1424 | radeon_get_encoder_id(dev, | 1456 | radeon_get_encoder_id(dev, |
1425 | ATOM_DEVICE_LCD1_SUPPORT, | 1457 | ATOM_DEVICE_LCD1_SUPPORT, |
@@ -1429,7 +1461,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1429 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, | 1461 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, |
1430 | CONNECTOR_OBJECT_ID_LVDS); | 1462 | CONNECTOR_OBJECT_ID_LVDS); |
1431 | /* DVI-I - primary dac, int tmds */ | 1463 | /* DVI-I - primary dac, int tmds */ |
1432 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1464 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1433 | radeon_add_legacy_encoder(dev, | 1465 | radeon_add_legacy_encoder(dev, |
1434 | radeon_get_encoder_id(dev, | 1466 | radeon_get_encoder_id(dev, |
1435 | ATOM_DEVICE_DFP1_SUPPORT, | 1467 | ATOM_DEVICE_DFP1_SUPPORT, |
@@ -1460,7 +1492,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1460 | DRM_INFO("Connector Table: %d (powerbook vga)\n", | 1492 | DRM_INFO("Connector Table: %d (powerbook vga)\n", |
1461 | rdev->mode_info.connector_table); | 1493 | rdev->mode_info.connector_table); |
1462 | /* LVDS */ | 1494 | /* LVDS */ |
1463 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1495 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1464 | radeon_add_legacy_encoder(dev, | 1496 | radeon_add_legacy_encoder(dev, |
1465 | radeon_get_encoder_id(dev, | 1497 | radeon_get_encoder_id(dev, |
1466 | ATOM_DEVICE_LCD1_SUPPORT, | 1498 | ATOM_DEVICE_LCD1_SUPPORT, |
@@ -1470,7 +1502,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1470 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, | 1502 | DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, |
1471 | CONNECTOR_OBJECT_ID_LVDS); | 1503 | CONNECTOR_OBJECT_ID_LVDS); |
1472 | /* VGA - primary dac */ | 1504 | /* VGA - primary dac */ |
1473 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1505 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1474 | radeon_add_legacy_encoder(dev, | 1506 | radeon_add_legacy_encoder(dev, |
1475 | radeon_get_encoder_id(dev, | 1507 | radeon_get_encoder_id(dev, |
1476 | ATOM_DEVICE_CRT1_SUPPORT, | 1508 | ATOM_DEVICE_CRT1_SUPPORT, |
@@ -1494,7 +1526,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1494 | DRM_INFO("Connector Table: %d (mini external tmds)\n", | 1526 | DRM_INFO("Connector Table: %d (mini external tmds)\n", |
1495 | rdev->mode_info.connector_table); | 1527 | rdev->mode_info.connector_table); |
1496 | /* DVI-I - tv dac, ext tmds */ | 1528 | /* DVI-I - tv dac, ext tmds */ |
1497 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC); | 1529 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); |
1498 | radeon_add_legacy_encoder(dev, | 1530 | radeon_add_legacy_encoder(dev, |
1499 | radeon_get_encoder_id(dev, | 1531 | radeon_get_encoder_id(dev, |
1500 | ATOM_DEVICE_DFP2_SUPPORT, | 1532 | ATOM_DEVICE_DFP2_SUPPORT, |
@@ -1526,7 +1558,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1526 | DRM_INFO("Connector Table: %d (mini internal tmds)\n", | 1558 | DRM_INFO("Connector Table: %d (mini internal tmds)\n", |
1527 | rdev->mode_info.connector_table); | 1559 | rdev->mode_info.connector_table); |
1528 | /* DVI-I - tv dac, int tmds */ | 1560 | /* DVI-I - tv dac, int tmds */ |
1529 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC); | 1561 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); |
1530 | radeon_add_legacy_encoder(dev, | 1562 | radeon_add_legacy_encoder(dev, |
1531 | radeon_get_encoder_id(dev, | 1563 | radeon_get_encoder_id(dev, |
1532 | ATOM_DEVICE_DFP1_SUPPORT, | 1564 | ATOM_DEVICE_DFP1_SUPPORT, |
@@ -1557,7 +1589,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1557 | DRM_INFO("Connector Table: %d (imac g5 isight)\n", | 1589 | DRM_INFO("Connector Table: %d (imac g5 isight)\n", |
1558 | rdev->mode_info.connector_table); | 1590 | rdev->mode_info.connector_table); |
1559 | /* DVI-D - int tmds */ | 1591 | /* DVI-D - int tmds */ |
1560 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_MONID); | 1592 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); |
1561 | radeon_add_legacy_encoder(dev, | 1593 | radeon_add_legacy_encoder(dev, |
1562 | radeon_get_encoder_id(dev, | 1594 | radeon_get_encoder_id(dev, |
1563 | ATOM_DEVICE_DFP1_SUPPORT, | 1595 | ATOM_DEVICE_DFP1_SUPPORT, |
@@ -1567,7 +1599,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1567 | DRM_MODE_CONNECTOR_DVID, &ddc_i2c, | 1599 | DRM_MODE_CONNECTOR_DVID, &ddc_i2c, |
1568 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D); | 1600 | CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D); |
1569 | /* VGA - tv dac */ | 1601 | /* VGA - tv dac */ |
1570 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1602 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1571 | radeon_add_legacy_encoder(dev, | 1603 | radeon_add_legacy_encoder(dev, |
1572 | radeon_get_encoder_id(dev, | 1604 | radeon_get_encoder_id(dev, |
1573 | ATOM_DEVICE_CRT2_SUPPORT, | 1605 | ATOM_DEVICE_CRT2_SUPPORT, |
@@ -1591,7 +1623,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1591 | DRM_INFO("Connector Table: %d (emac)\n", | 1623 | DRM_INFO("Connector Table: %d (emac)\n", |
1592 | rdev->mode_info.connector_table); | 1624 | rdev->mode_info.connector_table); |
1593 | /* VGA - primary dac */ | 1625 | /* VGA - primary dac */ |
1594 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1626 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1595 | radeon_add_legacy_encoder(dev, | 1627 | radeon_add_legacy_encoder(dev, |
1596 | radeon_get_encoder_id(dev, | 1628 | radeon_get_encoder_id(dev, |
1597 | ATOM_DEVICE_CRT1_SUPPORT, | 1629 | ATOM_DEVICE_CRT1_SUPPORT, |
@@ -1601,7 +1633,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev) | |||
1601 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c, | 1633 | DRM_MODE_CONNECTOR_VGA, &ddc_i2c, |
1602 | CONNECTOR_OBJECT_ID_VGA); | 1634 | CONNECTOR_OBJECT_ID_VGA); |
1603 | /* VGA - tv dac */ | 1635 | /* VGA - tv dac */ |
1604 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC); | 1636 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); |
1605 | radeon_add_legacy_encoder(dev, | 1637 | radeon_add_legacy_encoder(dev, |
1606 | radeon_get_encoder_id(dev, | 1638 | radeon_get_encoder_id(dev, |
1607 | ATOM_DEVICE_CRT2_SUPPORT, | 1639 | ATOM_DEVICE_CRT2_SUPPORT, |
@@ -1644,11 +1676,11 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev, | |||
1644 | if ((rdev->family == CHIP_RS400 || | 1676 | if ((rdev->family == CHIP_RS400 || |
1645 | rdev->family == CHIP_RS480) && | 1677 | rdev->family == CHIP_RS480) && |
1646 | ddc_i2c->mask_clk_reg == RADEON_GPIO_CRT2_DDC) | 1678 | ddc_i2c->mask_clk_reg == RADEON_GPIO_CRT2_DDC) |
1647 | *ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_MONID); | 1679 | *ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); |
1648 | else if ((rdev->family == CHIP_RS400 || | 1680 | else if ((rdev->family == CHIP_RS400 || |
1649 | rdev->family == CHIP_RS480) && | 1681 | rdev->family == CHIP_RS480) && |
1650 | ddc_i2c->mask_clk_reg == RADEON_GPIO_MONID) { | 1682 | ddc_i2c->mask_clk_reg == RADEON_GPIO_MONID) { |
1651 | ddc_i2c->valid = true; | 1683 | *ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIOPAD_MASK); |
1652 | ddc_i2c->mask_clk_mask = (0x20 << 8); | 1684 | ddc_i2c->mask_clk_mask = (0x20 << 8); |
1653 | ddc_i2c->mask_data_mask = 0x80; | 1685 | ddc_i2c->mask_data_mask = 0x80; |
1654 | ddc_i2c->a_clk_mask = (0x20 << 8); | 1686 | ddc_i2c->a_clk_mask = (0x20 << 8); |
@@ -1657,20 +1689,12 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev, | |||
1657 | ddc_i2c->en_data_mask = 0x80; | 1689 | ddc_i2c->en_data_mask = 0x80; |
1658 | ddc_i2c->y_clk_mask = (0x20 << 8); | 1690 | ddc_i2c->y_clk_mask = (0x20 << 8); |
1659 | ddc_i2c->y_data_mask = 0x80; | 1691 | ddc_i2c->y_data_mask = 0x80; |
1660 | ddc_i2c->mask_clk_reg = RADEON_GPIOPAD_MASK; | ||
1661 | ddc_i2c->mask_data_reg = RADEON_GPIOPAD_MASK; | ||
1662 | ddc_i2c->a_clk_reg = RADEON_GPIOPAD_A; | ||
1663 | ddc_i2c->a_data_reg = RADEON_GPIOPAD_A; | ||
1664 | ddc_i2c->en_clk_reg = RADEON_GPIOPAD_EN; | ||
1665 | ddc_i2c->en_data_reg = RADEON_GPIOPAD_EN; | ||
1666 | ddc_i2c->y_clk_reg = RADEON_GPIOPAD_Y; | ||
1667 | ddc_i2c->y_data_reg = RADEON_GPIOPAD_Y; | ||
1668 | } | 1692 | } |
1669 | 1693 | ||
1670 | /* R3xx+ chips don't have GPIO_CRT2_DDC gpio pad */ | 1694 | /* R3xx+ chips don't have GPIO_CRT2_DDC gpio pad */ |
1671 | if ((rdev->family >= CHIP_R300) && | 1695 | if ((rdev->family >= CHIP_R300) && |
1672 | ddc_i2c->mask_clk_reg == RADEON_GPIO_CRT2_DDC) | 1696 | ddc_i2c->mask_clk_reg == RADEON_GPIO_CRT2_DDC) |
1673 | *ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1697 | *ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1674 | 1698 | ||
1675 | /* Certain IBM chipset RN50s have a BIOS reporting two VGAs, | 1699 | /* Certain IBM chipset RN50s have a BIOS reporting two VGAs, |
1676 | one with VGA DDC and one with CRT2 DDC. - kill the CRT2 DDC one */ | 1700 | one with VGA DDC and one with CRT2 DDC. - kill the CRT2 DDC one */ |
@@ -1788,19 +1812,19 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
1788 | switch (ddc_type) { | 1812 | switch (ddc_type) { |
1789 | case DDC_MONID: | 1813 | case DDC_MONID: |
1790 | ddc_i2c = | 1814 | ddc_i2c = |
1791 | combios_setup_i2c_bus(RADEON_GPIO_MONID); | 1815 | combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); |
1792 | break; | 1816 | break; |
1793 | case DDC_DVI: | 1817 | case DDC_DVI: |
1794 | ddc_i2c = | 1818 | ddc_i2c = |
1795 | combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1819 | combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1796 | break; | 1820 | break; |
1797 | case DDC_VGA: | 1821 | case DDC_VGA: |
1798 | ddc_i2c = | 1822 | ddc_i2c = |
1799 | combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 1823 | combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1800 | break; | 1824 | break; |
1801 | case DDC_CRT2: | 1825 | case DDC_CRT2: |
1802 | ddc_i2c = | 1826 | ddc_i2c = |
1803 | combios_setup_i2c_bus(RADEON_GPIO_CRT2_DDC); | 1827 | combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); |
1804 | break; | 1828 | break; |
1805 | default: | 1829 | default: |
1806 | break; | 1830 | break; |
@@ -1955,7 +1979,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
1955 | 0), | 1979 | 0), |
1956 | ATOM_DEVICE_DFP1_SUPPORT); | 1980 | ATOM_DEVICE_DFP1_SUPPORT); |
1957 | 1981 | ||
1958 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_DVI_DDC); | 1982 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); |
1959 | radeon_add_legacy_connector(dev, | 1983 | radeon_add_legacy_connector(dev, |
1960 | 0, | 1984 | 0, |
1961 | ATOM_DEVICE_CRT1_SUPPORT | | 1985 | ATOM_DEVICE_CRT1_SUPPORT | |
@@ -1973,7 +1997,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
1973 | ATOM_DEVICE_CRT1_SUPPORT, | 1997 | ATOM_DEVICE_CRT1_SUPPORT, |
1974 | 1), | 1998 | 1), |
1975 | ATOM_DEVICE_CRT1_SUPPORT); | 1999 | ATOM_DEVICE_CRT1_SUPPORT); |
1976 | ddc_i2c = combios_setup_i2c_bus(RADEON_GPIO_VGA_DDC); | 2000 | ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); |
1977 | radeon_add_legacy_connector(dev, | 2001 | radeon_add_legacy_connector(dev, |
1978 | 0, | 2002 | 0, |
1979 | ATOM_DEVICE_CRT1_SUPPORT, | 2003 | ATOM_DEVICE_CRT1_SUPPORT, |
@@ -2007,27 +2031,27 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
2007 | case DDC_MONID: | 2031 | case DDC_MONID: |
2008 | ddc_i2c = | 2032 | ddc_i2c = |
2009 | combios_setup_i2c_bus | 2033 | combios_setup_i2c_bus |
2010 | (RADEON_GPIO_MONID); | 2034 | (rdev, RADEON_GPIO_MONID); |
2011 | break; | 2035 | break; |
2012 | case DDC_DVI: | 2036 | case DDC_DVI: |
2013 | ddc_i2c = | 2037 | ddc_i2c = |
2014 | combios_setup_i2c_bus | 2038 | combios_setup_i2c_bus |
2015 | (RADEON_GPIO_DVI_DDC); | 2039 | (rdev, RADEON_GPIO_DVI_DDC); |
2016 | break; | 2040 | break; |
2017 | case DDC_VGA: | 2041 | case DDC_VGA: |
2018 | ddc_i2c = | 2042 | ddc_i2c = |
2019 | combios_setup_i2c_bus | 2043 | combios_setup_i2c_bus |
2020 | (RADEON_GPIO_VGA_DDC); | 2044 | (rdev, RADEON_GPIO_VGA_DDC); |
2021 | break; | 2045 | break; |
2022 | case DDC_CRT2: | 2046 | case DDC_CRT2: |
2023 | ddc_i2c = | 2047 | ddc_i2c = |
2024 | combios_setup_i2c_bus | 2048 | combios_setup_i2c_bus |
2025 | (RADEON_GPIO_CRT2_DDC); | 2049 | (rdev, RADEON_GPIO_CRT2_DDC); |
2026 | break; | 2050 | break; |
2027 | case DDC_LCD: | 2051 | case DDC_LCD: |
2028 | ddc_i2c = | 2052 | ddc_i2c = |
2029 | combios_setup_i2c_bus | 2053 | combios_setup_i2c_bus |
2030 | (RADEON_LCD_GPIO_MASK); | 2054 | (rdev, RADEON_GPIOPAD_MASK); |
2031 | ddc_i2c.mask_clk_mask = | 2055 | ddc_i2c.mask_clk_mask = |
2032 | RBIOS32(lcd_ddc_info + 3); | 2056 | RBIOS32(lcd_ddc_info + 3); |
2033 | ddc_i2c.mask_data_mask = | 2057 | ddc_i2c.mask_data_mask = |
@@ -2048,7 +2072,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev) | |||
2048 | case DDC_GPIO: | 2072 | case DDC_GPIO: |
2049 | ddc_i2c = | 2073 | ddc_i2c = |
2050 | combios_setup_i2c_bus | 2074 | combios_setup_i2c_bus |
2051 | (RADEON_MDGPIO_EN_REG); | 2075 | (rdev, RADEON_MDGPIO_MASK); |
2052 | ddc_i2c.mask_clk_mask = | 2076 | ddc_i2c.mask_clk_mask = |
2053 | RBIOS32(lcd_ddc_info + 3); | 2077 | RBIOS32(lcd_ddc_info + 3); |
2054 | ddc_i2c.mask_data_mask = | 2078 | ddc_i2c.mask_data_mask = |