Skip to content

Commit 678e7df

Browse files
agd5fairlied
authored andcommitted
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>
1 parent c00f53b commit 678e7df

File tree

1 file changed

+43
-26
lines changed

1 file changed

+43
-26
lines changed

drivers/gpu/drm/radeon/radeon_atombios.c

Lines changed: 43 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1442,29 +1442,29 @@ radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder)
14421442

14431443
static const char *thermal_controller_names[] = {
14441444
"NONE",
1445-
"LM63",
1446-
"ADM1032",
1447-
"ADM1030",
1448-
"MUA6649",
1449-
"LM64",
1450-
"F75375",
1451-
"ASC7512",
1445+
"lm63",
1446+
"adm1032",
1447+
"adm1030",
1448+
"max6649",
1449+
"lm64",
1450+
"f75375",
1451+
"asc7xxx",
14521452
};
14531453

14541454
static const char *pp_lib_thermal_controller_names[] = {
14551455
"NONE",
1456-
"LM63",
1457-
"ADM1032",
1458-
"ADM1030",
1459-
"MUA6649",
1460-
"LM64",
1461-
"F75375",
1456+
"lm63",
1457+
"adm1032",
1458+
"adm1030",
1459+
"max6649",
1460+
"lm64",
1461+
"f75375",
14621462
"RV6xx",
14631463
"RV770",
1464-
"ADT7473",
1464+
"adt7473",
14651465
"External GPIO",
14661466
"Evergreen",
1467-
"ADT7473 with internal",
1467+
"adt7473 with internal",
14681468

14691469
};
14701470

@@ -1502,6 +1502,14 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
15021502
power_info->info.ucOverdriveControllerAddress >> 1);
15031503
i2c_bus = radeon_lookup_i2c_gpio(rdev, power_info->info.ucOverdriveI2cLine);
15041504
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+
}
15051513
}
15061514
num_modes = power_info->info.ucNumOfPowerModeEntries;
15071515
if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK)
@@ -1726,26 +1734,35 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
17261734
} else {
17271735
/* add the i2c bus for thermal/fan chip */
17281736
/* no support for internal controller yet */
1729-
if (power_info->info_4.sThermalController.ucType > 0) {
1730-
if ((power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) ||
1731-
(power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_RV770) ||
1732-
(power_info->info_4.sThermalController.ucType == ATOM_PP_THERMALCONTROLLER_EVERGREEN)) {
1737+
ATOM_PPLIB_THERMALCONTROLLER *controller = &power_info->info_4.sThermalController;
1738+
if (controller->ucType > 0) {
1739+
if ((controller->ucType == ATOM_PP_THERMALCONTROLLER_RV6xx) ||
1740+
(controller->ucType == ATOM_PP_THERMALCONTROLLER_RV770) ||
1741+
(controller->ucType == ATOM_PP_THERMALCONTROLLER_EVERGREEN)) {
17331742
DRM_INFO("Internal thermal controller %s fan control\n",
1734-
(power_info->info_4.sThermalController.ucFanParameters &
1743+
(controller->ucFanParameters &
17351744
ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
1736-
} else if ((power_info->info_4.sThermalController.ucType ==
1745+
} else if ((controller->ucType ==
17371746
ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) ||
1738-
(power_info->info_4.sThermalController.ucType ==
1747+
(controller->ucType ==
17391748
ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL)) {
17401749
DRM_INFO("Special thermal controller config\n");
17411750
} else {
17421751
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],
1744-
power_info->info_4.sThermalController.ucI2cAddress >> 1,
1745-
(power_info->info_4.sThermalController.ucFanParameters &
1752+
pp_lib_thermal_controller_names[controller->ucType],
1753+
controller->ucI2cAddress >> 1,
1754+
(controller->ucFanParameters &
17461755
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);
17481757
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+
17491766
}
17501767
}
17511768
/* first mode is usually default, followed by low to high */

0 commit comments

Comments
 (0)