aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
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
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')
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c1
-rw-r--r--drivers/gpu/drm/radeon/r100.c1
-rw-r--r--drivers/gpu/drm/radeon/r300.c1
-rw-r--r--drivers/gpu/drm/radeon/r420.c1
-rw-r--r--drivers/gpu/drm/radeon/r600.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c51
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c6
-rw-r--r--drivers/gpu/drm/radeon/rs400.c1
-rw-r--r--drivers/gpu/drm/radeon/rs600.c1
-rw-r--r--drivers/gpu/drm/radeon/rs690.c1
-rw-r--r--drivers/gpu/drm/radeon/rv515.c1
-rw-r--r--drivers/gpu/drm/radeon/rv770.c1
13 files changed, 69 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 9d6283e26e8b..db78d93f7f20 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -747,6 +747,7 @@ int evergreen_init(struct radeon_device *rdev)
747 747
748void evergreen_fini(struct radeon_device *rdev) 748void evergreen_fini(struct radeon_device *rdev)
749{ 749{
750 radeon_pm_fini(rdev);
750 evergreen_suspend(rdev); 751 evergreen_suspend(rdev);
751#if 0 752#if 0
752 r600_blit_fini(rdev); 753 r600_blit_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index ea5ebfefd5e8..9d634c8a322a 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -3443,6 +3443,7 @@ int r100_suspend(struct radeon_device *rdev)
3443 3443
3444void r100_fini(struct radeon_device *rdev) 3444void r100_fini(struct radeon_device *rdev)
3445{ 3445{
3446 radeon_pm_fini(rdev);
3446 r100_cp_fini(rdev); 3447 r100_cp_fini(rdev);
3447 r100_wb_fini(rdev); 3448 r100_wb_fini(rdev);
3448 r100_ib_fini(rdev); 3449 r100_ib_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 1042cead4a6f..6d75f8117967 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -1335,6 +1335,7 @@ int r300_suspend(struct radeon_device *rdev)
1335 1335
1336void r300_fini(struct radeon_device *rdev) 1336void r300_fini(struct radeon_device *rdev)
1337{ 1337{
1338 radeon_pm_fini(rdev);
1338 r100_cp_fini(rdev); 1339 r100_cp_fini(rdev);
1339 r100_wb_fini(rdev); 1340 r100_wb_fini(rdev);
1340 r100_ib_fini(rdev); 1341 r100_ib_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/r420.c b/drivers/gpu/drm/radeon/r420.c
index 2ab35ff41eca..0b8603ca6974 100644
--- a/drivers/gpu/drm/radeon/r420.c
+++ b/drivers/gpu/drm/radeon/r420.c
@@ -267,6 +267,7 @@ int r420_suspend(struct radeon_device *rdev)
267 267
268void r420_fini(struct radeon_device *rdev) 268void r420_fini(struct radeon_device *rdev)
269{ 269{
270 radeon_pm_fini(rdev);
270 r100_cp_fini(rdev); 271 r100_cp_fini(rdev);
271 r100_wb_fini(rdev); 272 r100_wb_fini(rdev);
272 r100_ib_fini(rdev); 273 r100_ib_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 5b00d5e86b89..5aee7fe4717f 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2120,6 +2120,7 @@ int r600_init(struct radeon_device *rdev)
2120 2120
2121void r600_fini(struct radeon_device *rdev) 2121void r600_fini(struct radeon_device *rdev)
2122{ 2122{
2123 radeon_pm_fini(rdev);
2123 r600_audio_fini(rdev); 2124 r600_audio_fini(rdev);
2124 r600_blit_fini(rdev); 2125 r600_blit_fini(rdev);
2125 r600_cp_fini(rdev); 2126 r600_cp_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index bd63f5370702..46bfff932504 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -168,6 +168,7 @@ struct radeon_clock {
168 * Power management 168 * Power management
169 */ 169 */
170int radeon_pm_init(struct radeon_device *rdev); 170int radeon_pm_init(struct radeon_device *rdev);
171void radeon_pm_fini(struct radeon_device *rdev);
171void radeon_pm_compute_clocks(struct radeon_device *rdev); 172void radeon_pm_compute_clocks(struct radeon_device *rdev);
172void radeon_combios_get_power_modes(struct radeon_device *rdev); 173void radeon_combios_get_power_modes(struct radeon_device *rdev);
173void radeon_atombios_get_power_modes(struct radeon_device *rdev); 174void radeon_atombios_get_power_modes(struct radeon_device *rdev);
@@ -708,6 +709,7 @@ struct radeon_pm {
708 struct radeon_power_state *requested_power_state; 709 struct radeon_power_state *requested_power_state;
709 struct radeon_pm_clock_info *requested_clock_mode; 710 struct radeon_pm_clock_info *requested_clock_mode;
710 struct radeon_power_state *default_power_state; 711 struct radeon_power_state *default_power_state;
712 struct radeon_i2c_chan *i2c_bus;
711}; 713};
712 714
713 715
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 *)
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 4f37b524de7e..6458d52be4ee 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -257,6 +257,12 @@ int radeon_pm_init(struct radeon_device *rdev)
257 return 0; 257 return 0;
258} 258}
259 259
260void radeon_pm_fini(struct radeon_device *rdev)
261{
262 if (rdev->pm.i2c_bus)
263 radeon_i2c_destroy(rdev->pm.i2c_bus);
264}
265
260void radeon_pm_compute_clocks(struct radeon_device *rdev) 266void radeon_pm_compute_clocks(struct radeon_device *rdev)
261{ 267{
262 struct drm_device *ddev = rdev->ddev; 268 struct drm_device *ddev = rdev->ddev;
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
index 1240e7d9f771..850a90c6a13d 100644
--- a/drivers/gpu/drm/radeon/rs400.c
+++ b/drivers/gpu/drm/radeon/rs400.c
@@ -454,6 +454,7 @@ int rs400_suspend(struct radeon_device *rdev)
454 454
455void rs400_fini(struct radeon_device *rdev) 455void rs400_fini(struct radeon_device *rdev)
456{ 456{
457 radeon_pm_fini(rdev);
457 r100_cp_fini(rdev); 458 r100_cp_fini(rdev);
458 r100_wb_fini(rdev); 459 r100_wb_fini(rdev);
459 r100_ib_fini(rdev); 460 r100_ib_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index e3410c90bd33..3630c165d9c9 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -601,6 +601,7 @@ int rs600_suspend(struct radeon_device *rdev)
601 601
602void rs600_fini(struct radeon_device *rdev) 602void rs600_fini(struct radeon_device *rdev)
603{ 603{
604 radeon_pm_fini(rdev);
604 r100_cp_fini(rdev); 605 r100_cp_fini(rdev);
605 r100_wb_fini(rdev); 606 r100_wb_fini(rdev);
606 r100_ib_fini(rdev); 607 r100_ib_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/rs690.c b/drivers/gpu/drm/radeon/rs690.c
index c39cb50377f1..6c92ae3c184a 100644
--- a/drivers/gpu/drm/radeon/rs690.c
+++ b/drivers/gpu/drm/radeon/rs690.c
@@ -658,6 +658,7 @@ int rs690_suspend(struct radeon_device *rdev)
658 658
659void rs690_fini(struct radeon_device *rdev) 659void rs690_fini(struct radeon_device *rdev)
660{ 660{
661 radeon_pm_fini(rdev);
661 r100_cp_fini(rdev); 662 r100_cp_fini(rdev);
662 r100_wb_fini(rdev); 663 r100_wb_fini(rdev);
663 r100_ib_fini(rdev); 664 r100_ib_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/rv515.c b/drivers/gpu/drm/radeon/rv515.c
index 26108b49e982..f85499fa1968 100644
--- a/drivers/gpu/drm/radeon/rv515.c
+++ b/drivers/gpu/drm/radeon/rv515.c
@@ -540,6 +540,7 @@ void rv515_set_safe_registers(struct radeon_device *rdev)
540 540
541void rv515_fini(struct radeon_device *rdev) 541void rv515_fini(struct radeon_device *rdev)
542{ 542{
543 radeon_pm_fini(rdev);
543 r100_cp_fini(rdev); 544 r100_cp_fini(rdev);
544 r100_wb_fini(rdev); 545 r100_wb_fini(rdev);
545 r100_ib_fini(rdev); 546 r100_ib_fini(rdev);
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 1484d06aad6b..2f917db49f23 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -1165,6 +1165,7 @@ int rv770_init(struct radeon_device *rdev)
1165 1165
1166void rv770_fini(struct radeon_device *rdev) 1166void rv770_fini(struct radeon_device *rdev)
1167{ 1167{
1168 radeon_pm_fini(rdev);
1168 r600_blit_fini(rdev); 1169 r600_blit_fini(rdev);
1169 r600_cp_fini(rdev); 1170 r600_cp_fini(rdev);
1170 r600_wb_fini(rdev); 1171 r600_wb_fini(rdev);