aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-04-22 14:17:56 -0400
committerDave Airlie <airlied@redhat.com>2010-05-18 04:21:02 -0400
commit678e7dfa9e1bb0d1ad31b7cddce58fc3b67cfb27 (patch)
tree81a975e6cf18f942ec904419bd5ff8136c5f0024
parentc00f53be5ec70038d7a34f64872df51dabfc5a5b (diff)
drm/radeon/kms/atom: load hwmon drivers
Hook the atom table parsing up to module loading, so we can automatically load the appropriate hwmon drivers. Based on initial patch for r6xx from Matthew Garrett Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c69
1 files changed, 43 insertions, 26 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index dbfb837d224c..a0a99b66af82 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -1442,29 +1442,29 @@ radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
1442 1442
1443static const char *thermal_controller_names[] = { 1443static const char *thermal_controller_names[] = {
1444 "NONE", 1444 "NONE",
1445 "LM63", 1445 "lm63",
1446 "ADM1032", 1446 "adm1032",
1447 "ADM1030", 1447 "adm1030",
1448 "MUA6649", 1448 "max6649",
1449 "LM64", 1449 "lm64",
1450 "F75375", 1450 "f75375",
1451 "ASC7512", 1451 "asc7xxx",
1452}; 1452};
1453 1453
1454static const char *pp_lib_thermal_controller_names[] = { 1454static const char *pp_lib_thermal_controller_names[] = {
1455 "NONE", 1455 "NONE",
1456 "LM63", 1456 "lm63",
1457 "ADM1032", 1457 "adm1032",
1458 "ADM1030", 1458 "adm1030",
1459 "MUA6649", 1459 "max6649",
1460 "LM64", 1460 "lm64",
1461 "F75375", 1461 "f75375",
1462 "RV6xx", 1462 "RV6xx",
1463 "RV770", 1463 "RV770",
1464 "ADT7473", 1464 "adt7473",
1465 "External GPIO", 1465 "External GPIO",
1466 "Evergreen", 1466 "Evergreen",
1467 "ADT7473 with internal", 1467 "adt7473 with internal",
1468 1468
1469}; 1469};
1470 1470
@@ -1502,6 +1502,14 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
1502 power_info->info.ucOverdriveControllerAddress >> 1); 1502 power_info->info.ucOverdriveControllerAddress >> 1);
1503 i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine); 1503 i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine);
1504 rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal"); 1504 rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal");
1505 if (rdev->pm.i2c_bus) {
1506 struct i2c_board_info info = { };
1507 const char *name = thermal_controller_names[power_info->info.
1508 ucOverdriveThermalController];
1509 info.addr = power_info->info.ucOverdriveControllerAddress >> 1;
1510 strlcpy(info.type, name, sizeof(info.type));
1511 i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
1512 }
1505 } 1513 }
1506 num_modes = power_info->info.ucNumOfPowerModeEntries; 1514 num_modes = power_info->info.ucNumOfPowerModeEntries;
1507 if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK) 1515 if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK)
@@ -1726,26 +1734,35 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
1726 } else { 1734 } else {
1727 /* add the i2c bus for thermal/fan chip */ 1735 /* add the i2c bus for thermal/fan chip */
1728 /* no support for internal controller yet */ 1736 /* no support for internal controller yet */
1729 if (power_info->info_4.sThermalController.ucType > 0) { 1737 ATOM_PPLIB_THERMALCONTROLLER *controller = &power_info->info_4.sThermalController;
1730 if ((power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) || 1738 if (controller->ucType > 0) {
1731 (power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_RV770) || 1739 if ((controller->ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) ||
1732 (power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_EVERGREEN)) { 1740 (controller->ucType == ATOM_PP_THERMALCONTROLLER_RV770) ||
1741 (controller->ucType == ATOM_PP_THERMALCONTROLLER_EVERGREEN)) {
1733 DRM_INFO("Internal thermal controller %s fan control\n", 1742 DRM_INFO("Internal thermal controller %s fan control\n",
1734 (power_info->info_4.sThermalController.ucFanParameters & 1743 (controller->ucFanParameters &
1735 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); 1744 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
1736 } else if ((power_info->info_4.sThermalController.ucType == 1745 } else if ((controller->ucType ==
1737 ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) || 1746 ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) ||
1738 (power_info->info_4.sThermalController.ucType == 1747 (controller->ucType ==
1739 ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL)) { 1748 ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL)) {
1740 DRM_INFO("Special thermal controller config\n"); 1749 DRM_INFO("Special thermal controller config\n");
1741 } else { 1750 } else {
1742 DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", 1751 DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n",
1743 pp_lib_thermal_controller_names[power_info->info_4.sThermalController.ucType], 1752 pp_lib_thermal_controller_names[controller->ucType],
1744 power_info->info_4.sThermalController.ucI2cAddress >> 1, 1753 controller->ucI2cAddress >> 1,
1745 (power_info->info_4.sThermalController.ucFanParameters & 1754 (controller->ucFanParameters &
1746 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); 1755 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
1747 i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info_4.sThermalController.ucI2cLine); 1756 i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine);
1748 rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal"); 1757 rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal");
1758 if (rdev->pm.i2c_bus) {
1759 struct i2c_board_info info = { };
1760 const char *name = pp_lib_thermal_controller_names[controller->ucType];
1761 info.addr = controller->ucI2cAddress >> 1;
1762 strlcpy(info.type, name, sizeof(info.type));
1763 i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
1764 }
1765
1749 } 1766 }
1750 } 1767 }
1751 /* first mode is usually default, followed by low to high */ 1768 /* first mode is usually default, followed by low to high */