aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
authorChengming Gui <Jack.Gui@amd.com>2019-01-24 05:39:04 -0500
committerAlex Deucher <alexander.deucher@amd.com>2019-03-19 16:04:01 -0400
commit008a9524cf6860dcd16780f50f738f3754c8b68a (patch)
treedb2d085476eda473dacb03857e985ecd99bbbb98 /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
parent46814f51527b7bb0aae2d8582ac7a9da2941f1d2 (diff)
drm/amd/powerplay: implement pwm1 hwmon interface for SMU11 (v2)
added main functions: get_fan_speed_percent set_fan_speed_percent. added dependent functions: smc_fan_control set_fan_static_mode get_fan_speed_percent v2: fix coding style issue Signed-off-by: Chengming Gui <Jack.Gui@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index c3508a7c8bfd..284d28acb8c1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1444,8 +1444,10 @@ static ssize_t amdgpu_hwmon_set_pwm1(struct device *dev,
1444 if ((adev->flags & AMD_IS_PX) && 1444 if ((adev->flags & AMD_IS_PX) &&
1445 (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON)) 1445 (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON))
1446 return -EINVAL; 1446 return -EINVAL;
1447 1447 if (is_support_sw_smu(adev))
1448 pwm_mode = amdgpu_dpm_get_fan_control_mode(adev); 1448 pwm_mode = smu_get_fan_control_mode(&adev->smu);
1449 else
1450 pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
1449 if (pwm_mode != AMD_FAN_CTRL_MANUAL) { 1451 if (pwm_mode != AMD_FAN_CTRL_MANUAL) {
1450 pr_info("manual fan speed control should be enabled first\n"); 1452 pr_info("manual fan speed control should be enabled first\n");
1451 return -EINVAL; 1453 return -EINVAL;
@@ -1457,7 +1459,11 @@ static ssize_t amdgpu_hwmon_set_pwm1(struct device *dev,
1457 1459
1458 value = (value * 100) / 255; 1460 value = (value * 100) / 255;
1459 1461
1460 if (adev->powerplay.pp_funcs->set_fan_speed_percent) { 1462 if (is_support_sw_smu(adev)) {
1463 err = smu_set_fan_speed_percent(&adev->smu, value);
1464 if (err)
1465 return err;
1466 } else if (adev->powerplay.pp_funcs->set_fan_speed_percent) {
1461 err = amdgpu_dpm_set_fan_speed_percent(adev, value); 1467 err = amdgpu_dpm_set_fan_speed_percent(adev, value);
1462 if (err) 1468 if (err)
1463 return err; 1469 return err;
@@ -1479,7 +1485,11 @@ static ssize_t amdgpu_hwmon_get_pwm1(struct device *dev,
1479 (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON)) 1485 (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON))
1480 return -EINVAL; 1486 return -EINVAL;
1481 1487
1482 if (adev->powerplay.pp_funcs->get_fan_speed_percent) { 1488 if (is_support_sw_smu(adev)) {
1489 err = smu_get_fan_speed_percent(&adev->smu, &speed);
1490 if (err)
1491 return err;
1492 } else if (adev->powerplay.pp_funcs->get_fan_speed_percent) {
1483 err = amdgpu_dpm_get_fan_speed_percent(adev, &speed); 1493 err = amdgpu_dpm_get_fan_speed_percent(adev, &speed);
1484 if (err) 1494 if (err)
1485 return err; 1495 return err;