Commit 678e7dfa authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

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: default avatarAlex Deucher <alexdeucher@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent c00f53be
...@@ -1442,29 +1442,29 @@ radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder) ...@@ -1442,29 +1442,29 @@ radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
static const char *thermal_controller_names[] = { static const char *thermal_controller_names[] = {
"NONE", "NONE",
"LM63", "lm63",
"ADM1032", "adm1032",
"ADM1030", "adm1030",
"MUA6649", "max6649",
"LM64", "lm64",
"F75375", "f75375",
"ASC7512", "asc7xxx",
}; };
static const char *pp_lib_thermal_controller_names[] = { static const char *pp_lib_thermal_controller_names[] = {
"NONE", "NONE",
"LM63", "lm63",
"ADM1032", "adm1032",
"ADM1030", "adm1030",
"MUA6649", "max6649",
"LM64", "lm64",
"F75375", "f75375",
"RV6xx", "RV6xx",
"RV770", "RV770",
"ADT7473", "adt7473",
"External GPIO", "External GPIO",
"Evergreen", "Evergreen",
"ADT7473 with internal", "adt7473 with internal",
}; };
...@@ -1502,6 +1502,14 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1502,6 +1502,14 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
power_info->info.ucOverdriveControllerAddress >> 1); power_info->info.ucOverdriveControllerAddress >> 1);
i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine); i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine);
rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal"); rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal");
if (rdev->pm.i2c_bus) {
struct i2c_board_info info = { };
const char *name = thermal_controller_names[power_info->info.
ucOverdriveThermalController];
info.addr = power_info->info.ucOverdriveControllerAddress >> 1;
strlcpy(info.type, name, sizeof(info.type));
i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
}
} }
num_modes = power_info->info.ucNumOfPowerModeEntries; num_modes = power_info->info.ucNumOfPowerModeEntries;
if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK) if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK)
...@@ -1726,26 +1734,35 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1726,26 +1734,35 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
} else { } else {
/* add the i2c bus for thermal/fan chip */ /* add the i2c bus for thermal/fan chip */
/* no support for internal controller yet */ /* no support for internal controller yet */
if (power_info->info_4.sThermalController.ucType > 0) { ATOM_PPLIB_THERMALCONTROLLER *controller = &power_info->info_4.sThermalController;
if ((power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) || if (controller->ucType > 0) {
(power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_RV770) || if ((controller->ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) ||
(power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_EVERGREEN)) { (controller->ucType == ATOM_PP_THERMALCONTROLLER_RV770) ||
(controller->ucType == ATOM_PP_THERMALCONTROLLER_EVERGREEN)) {
DRM_INFO("Internal thermal controller %s fan control\n", DRM_INFO("Internal thermal controller %s fan control\n",
(power_info->info_4.sThermalController.ucFanParameters & (controller->ucFanParameters &
ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
} else if ((power_info->info_4.sThermalController.ucType == } else if ((controller->ucType ==
ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) || ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) ||
(power_info->info_4.sThermalController.ucType == (controller->ucType ==
ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL)) { ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL)) {
DRM_INFO("Special thermal controller config\n"); DRM_INFO("Special thermal controller config\n");
} else { } else {
DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n",
pp_lib_thermal_controller_names[power_info->info_4.sThermalController.ucType], pp_lib_thermal_controller_names[controller->ucType],
power_info->info_4.sThermalController.ucI2cAddress >> 1, controller->ucI2cAddress >> 1,
(power_info->info_4.sThermalController.ucFanParameters & (controller->ucFanParameters &
ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info_4.sThermalController.ucI2cLine); i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine);
rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal"); rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal");
if (rdev->pm.i2c_bus) {
struct i2c_board_info info = { };
const char *name = pp_lib_thermal_controller_names[controller->ucType];
info.addr = controller->ucI2cAddress >> 1;
strlcpy(info.type, name, sizeof(info.type));
i2c_new_device(&rdev->pm.i2c_bus->adapter, &info);
}
} }
} }
/* first mode is usually default, followed by low to high */ /* first mode is usually default, followed by low to high */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment