aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_atombios.c
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-03-11 10:01:17 -0500
committerDave Airlie <airlied@redhat.com>2010-03-30 19:38:06 -0400
commit29fb52ca78b4e265ec6c626b0c7b2927953949cf (patch)
tree3b7d1741918d881ae904df3ea967390d4f122b5a /drivers/gpu/drm/radeon/radeon_atombios.c
parent2b497502b7cef167288a08737403a5a6cec697f0 (diff)
drm/radeon/kms: expose thermal/fan i2c buses
Look up i2c bus in the power table and expose it. You'll need to load a hwmon driver for any chips on the bus, this patch just exposes the bus. Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_atombios.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index e4540b2b859c..815116e38aa3 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -1461,6 +1461,30 @@ radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
1461 return tv_dac; 1461 return tv_dac;
1462} 1462}
1463 1463
1464static const char *thermal_controller_names[] = {
1465 "NONE",
1466 "LM63",
1467 "ADM1032",
1468 "ADM1030",
1469 "MUA6649",
1470 "LM64",
1471 "F75375",
1472 "ASC7512",
1473};
1474
1475static const char *pp_lib_thermal_controller_names[] = {
1476 "NONE",
1477 "LM63",
1478 "ADM1032",
1479 "ADM1030",
1480 "MUA6649",
1481 "LM64",
1482 "F75375",
1483 "RV6xx",
1484 "RV770",
1485 "ADT7473",
1486};
1487
1464union power_info { 1488union power_info {
1465 struct _ATOM_POWERPLAY_INFO info; 1489 struct _ATOM_POWERPLAY_INFO info;
1466 struct _ATOM_POWERPLAY_INFO_V2 info_2; 1490 struct _ATOM_POWERPLAY_INFO_V2 info_2;
@@ -1480,6 +1504,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
1480 struct _ATOM_PPLIB_STATE *power_state; 1504 struct _ATOM_PPLIB_STATE *power_state;
1481 int num_modes = 0, i, j; 1505 int num_modes = 0, i, j;
1482 int state_index = 0, mode_index = 0; 1506 int state_index = 0, mode_index = 0;
1507 struct radeon_i2c_bus_rec i2c_bus;
1483 1508
1484 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset); 1509 atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset);
1485 1510
@@ -1489,6 +1514,14 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
1489 1514
1490 if (power_info) { 1515 if (power_info) {
1491 if (frev < 4) { 1516 if (frev < 4) {
1517 /* add the i2c bus for thermal/fan chip */
1518 if (power_info->info.ucOverdriveThermalController > 0) {
1519 DRM_INFO("Possible %s thermal controller at 0x%02x\n",
1520 thermal_controller_names[power_info->info.ucOverdriveThermalController],
1521 power_info->info.ucOverdriveControllerAddress >> 1);
1522 i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine);
1523 rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal");
1524 }
1492 num_modes = power_info->info.ucNumOfPowerModeEntries; 1525 num_modes = power_info->info.ucNumOfPowerModeEntries;
1493 if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK) 1526 if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK)
1494 num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK; 1527 num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK;
@@ -1698,6 +1731,24 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
1698 } 1731 }
1699 } 1732 }
1700 } else if (frev == 4) { 1733 } else if (frev == 4) {
1734 /* add the i2c bus for thermal/fan chip */
1735 /* no support for internal controller yet */
1736 if (power_info->info_4.sThermalController.ucType > 0) {
1737 if ((power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) &&
1738 (power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_RV770)) {
1739 DRM_INFO("Internal thermal controller %s fan control\n",
1740 (power_info->info_4.sThermalController.ucFanParameters &
1741 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
1742 } else {
1743 DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n",
1744 pp_lib_thermal_controller_names[power_info->info_4.sThermalController.ucType],
1745 power_info->info_4.sThermalController.ucI2cAddress >> 1,
1746 (power_info->info_4.sThermalController.ucFanParameters &
1747 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
1748 i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info_4.sThermalController.ucI2cLine);
1749 rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal");
1750 }
1751 }
1701 for (i = 0; i < power_info->info_4.ucNumStates; i++) { 1752 for (i = 0; i < power_info->info_4.ucNumStates; i++) {
1702 mode_index = 0; 1753 mode_index = 0;
1703 power_state = (struct _ATOM_PPLIB_STATE *) 1754 power_state = (struct _ATOM_PPLIB_STATE *)