diff options
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_pm.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_pm.c | 52 |
1 files changed, 33 insertions, 19 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index ee738a524639..f30b8426eee2 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -603,7 +603,6 @@ static const struct attribute_group *hwmon_groups[] = { | |||
603 | static int radeon_hwmon_init(struct radeon_device *rdev) | 603 | static int radeon_hwmon_init(struct radeon_device *rdev) |
604 | { | 604 | { |
605 | int err = 0; | 605 | int err = 0; |
606 | struct device *hwmon_dev; | ||
607 | 606 | ||
608 | switch (rdev->pm.int_thermal_type) { | 607 | switch (rdev->pm.int_thermal_type) { |
609 | case THERMAL_TYPE_RV6XX: | 608 | case THERMAL_TYPE_RV6XX: |
@@ -616,11 +615,11 @@ static int radeon_hwmon_init(struct radeon_device *rdev) | |||
616 | case THERMAL_TYPE_KV: | 615 | case THERMAL_TYPE_KV: |
617 | if (rdev->asic->pm.get_temperature == NULL) | 616 | if (rdev->asic->pm.get_temperature == NULL) |
618 | return err; | 617 | return err; |
619 | hwmon_dev = hwmon_device_register_with_groups(rdev->dev, | 618 | rdev->pm.int_hwmon_dev = hwmon_device_register_with_groups(rdev->dev, |
620 | "radeon", rdev, | 619 | "radeon", rdev, |
621 | hwmon_groups); | 620 | hwmon_groups); |
622 | if (IS_ERR(hwmon_dev)) { | 621 | if (IS_ERR(rdev->pm.int_hwmon_dev)) { |
623 | err = PTR_ERR(hwmon_dev); | 622 | err = PTR_ERR(rdev->pm.int_hwmon_dev); |
624 | dev_err(rdev->dev, | 623 | dev_err(rdev->dev, |
625 | "Unable to register hwmon device: %d\n", err); | 624 | "Unable to register hwmon device: %d\n", err); |
626 | } | 625 | } |
@@ -632,6 +631,12 @@ static int radeon_hwmon_init(struct radeon_device *rdev) | |||
632 | return err; | 631 | return err; |
633 | } | 632 | } |
634 | 633 | ||
634 | static void radeon_hwmon_fini(struct radeon_device *rdev) | ||
635 | { | ||
636 | if (rdev->pm.int_hwmon_dev) | ||
637 | hwmon_device_unregister(rdev->pm.int_hwmon_dev); | ||
638 | } | ||
639 | |||
635 | static void radeon_dpm_thermal_work_handler(struct work_struct *work) | 640 | static void radeon_dpm_thermal_work_handler(struct work_struct *work) |
636 | { | 641 | { |
637 | struct radeon_device *rdev = | 642 | struct radeon_device *rdev = |
@@ -1257,6 +1262,7 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
1257 | case CHIP_RV670: | 1262 | case CHIP_RV670: |
1258 | case CHIP_RS780: | 1263 | case CHIP_RS780: |
1259 | case CHIP_RS880: | 1264 | case CHIP_RS880: |
1265 | case CHIP_RV770: | ||
1260 | case CHIP_BARTS: | 1266 | case CHIP_BARTS: |
1261 | case CHIP_TURKS: | 1267 | case CHIP_TURKS: |
1262 | case CHIP_CAICOS: | 1268 | case CHIP_CAICOS: |
@@ -1273,7 +1279,6 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
1273 | else | 1279 | else |
1274 | rdev->pm.pm_method = PM_METHOD_PROFILE; | 1280 | rdev->pm.pm_method = PM_METHOD_PROFILE; |
1275 | break; | 1281 | break; |
1276 | case CHIP_RV770: | ||
1277 | case CHIP_RV730: | 1282 | case CHIP_RV730: |
1278 | case CHIP_RV710: | 1283 | case CHIP_RV710: |
1279 | case CHIP_RV740: | 1284 | case CHIP_RV740: |
@@ -1295,6 +1300,7 @@ int radeon_pm_init(struct radeon_device *rdev) | |||
1295 | case CHIP_KABINI: | 1300 | case CHIP_KABINI: |
1296 | case CHIP_KAVERI: | 1301 | case CHIP_KAVERI: |
1297 | case CHIP_HAWAII: | 1302 | case CHIP_HAWAII: |
1303 | case CHIP_MULLINS: | ||
1298 | /* DPM requires the RLC, RV770+ dGPU requires SMC */ | 1304 | /* DPM requires the RLC, RV770+ dGPU requires SMC */ |
1299 | if (!rdev->rlc_fw) | 1305 | if (!rdev->rlc_fw) |
1300 | rdev->pm.pm_method = PM_METHOD_PROFILE; | 1306 | rdev->pm.pm_method = PM_METHOD_PROFILE; |
@@ -1353,6 +1359,8 @@ static void radeon_pm_fini_old(struct radeon_device *rdev) | |||
1353 | device_remove_file(rdev->dev, &dev_attr_power_method); | 1359 | device_remove_file(rdev->dev, &dev_attr_power_method); |
1354 | } | 1360 | } |
1355 | 1361 | ||
1362 | radeon_hwmon_fini(rdev); | ||
1363 | |||
1356 | if (rdev->pm.power_state) | 1364 | if (rdev->pm.power_state) |
1357 | kfree(rdev->pm.power_state); | 1365 | kfree(rdev->pm.power_state); |
1358 | } | 1366 | } |
@@ -1372,6 +1380,8 @@ static void radeon_pm_fini_dpm(struct radeon_device *rdev) | |||
1372 | } | 1380 | } |
1373 | radeon_dpm_fini(rdev); | 1381 | radeon_dpm_fini(rdev); |
1374 | 1382 | ||
1383 | radeon_hwmon_fini(rdev); | ||
1384 | |||
1375 | if (rdev->pm.power_state) | 1385 | if (rdev->pm.power_state) |
1376 | kfree(rdev->pm.power_state); | 1386 | kfree(rdev->pm.power_state); |
1377 | } | 1387 | } |
@@ -1397,12 +1407,14 @@ static void radeon_pm_compute_clocks_old(struct radeon_device *rdev) | |||
1397 | 1407 | ||
1398 | rdev->pm.active_crtcs = 0; | 1408 | rdev->pm.active_crtcs = 0; |
1399 | rdev->pm.active_crtc_count = 0; | 1409 | rdev->pm.active_crtc_count = 0; |
1400 | list_for_each_entry(crtc, | 1410 | if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
1401 | &ddev->mode_config.crtc_list, head) { | 1411 | list_for_each_entry(crtc, |
1402 | radeon_crtc = to_radeon_crtc(crtc); | 1412 | &ddev->mode_config.crtc_list, head) { |
1403 | if (radeon_crtc->enabled) { | 1413 | radeon_crtc = to_radeon_crtc(crtc); |
1404 | rdev->pm.active_crtcs |= (1 << radeon_crtc->crtc_id); | 1414 | if (radeon_crtc->enabled) { |
1405 | rdev->pm.active_crtc_count++; | 1415 | rdev->pm.active_crtcs |= (1 << radeon_crtc->crtc_id); |
1416 | rdev->pm.active_crtc_count++; | ||
1417 | } | ||
1406 | } | 1418 | } |
1407 | } | 1419 | } |
1408 | 1420 | ||
@@ -1469,12 +1481,14 @@ static void radeon_pm_compute_clocks_dpm(struct radeon_device *rdev) | |||
1469 | /* update active crtc counts */ | 1481 | /* update active crtc counts */ |
1470 | rdev->pm.dpm.new_active_crtcs = 0; | 1482 | rdev->pm.dpm.new_active_crtcs = 0; |
1471 | rdev->pm.dpm.new_active_crtc_count = 0; | 1483 | rdev->pm.dpm.new_active_crtc_count = 0; |
1472 | list_for_each_entry(crtc, | 1484 | if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) { |
1473 | &ddev->mode_config.crtc_list, head) { | 1485 | list_for_each_entry(crtc, |
1474 | radeon_crtc = to_radeon_crtc(crtc); | 1486 | &ddev->mode_config.crtc_list, head) { |
1475 | if (crtc->enabled) { | 1487 | radeon_crtc = to_radeon_crtc(crtc); |
1476 | rdev->pm.dpm.new_active_crtcs |= (1 << radeon_crtc->crtc_id); | 1488 | if (crtc->enabled) { |
1477 | rdev->pm.dpm.new_active_crtc_count++; | 1489 | rdev->pm.dpm.new_active_crtcs |= (1 << radeon_crtc->crtc_id); |
1490 | rdev->pm.dpm.new_active_crtc_count++; | ||
1491 | } | ||
1478 | } | 1492 | } |
1479 | } | 1493 | } |
1480 | 1494 | ||