aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
authorChengming Gui <Jack.Gui@amd.com>2019-01-25 03:21:27 -0500
committerAlex Deucher <alexander.deucher@amd.com>2019-03-19 16:04:01 -0400
commita76ff5af98bea45bd7303d83c593957dad0213ee (patch)
treefad694c80667d125d38385da384c7e6f6d086d34 /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
parent008a9524cf6860dcd16780f50f738f3754c8b68a (diff)
drm/amd/powerplay: implement pwm1_enable hwmon interface for SMU11 (v2)
1, set get_pwm1_enable and set_pwm1_enable functions to call smu_get_fan_control_mode and smu_set_fan_control_mode for SMU11 2, implement set_fan_control_mode function v2: add return value in set_fan_control_mode function 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.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 284d28acb8c1..b1e6e67d5c2f 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1382,11 +1382,14 @@ static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev,
1382{ 1382{
1383 struct amdgpu_device *adev = dev_get_drvdata(dev); 1383 struct amdgpu_device *adev = dev_get_drvdata(dev);
1384 u32 pwm_mode = 0; 1384 u32 pwm_mode = 0;
1385 if (is_support_sw_smu(adev)) {
1386 pwm_mode = smu_get_fan_control_mode(&adev->smu);
1387 } else {
1388 if (!adev->powerplay.pp_funcs->get_fan_control_mode)
1389 return -EINVAL;
1385 1390
1386 if (!adev->powerplay.pp_funcs->get_fan_control_mode) 1391 pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
1387 return -EINVAL; 1392 }
1388
1389 pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
1390 1393
1391 return sprintf(buf, "%i\n", pwm_mode); 1394 return sprintf(buf, "%i\n", pwm_mode);
1392} 1395}
@@ -1405,14 +1408,22 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
1405 (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON)) 1408 (adev->ddev->switch_power_state != DRM_SWITCH_POWER_ON))
1406 return -EINVAL; 1409 return -EINVAL;
1407 1410
1408 if (!adev->powerplay.pp_funcs->set_fan_control_mode) 1411 if (is_support_sw_smu(adev)) {
1409 return -EINVAL; 1412 err = kstrtoint(buf, 10, &value);
1413 if (err)
1414 return err;
1410 1415
1411 err = kstrtoint(buf, 10, &value); 1416 smu_set_fan_control_mode(&adev->smu, value);
1412 if (err) 1417 } else {
1413 return err; 1418 if (!adev->powerplay.pp_funcs->set_fan_control_mode)
1419 return -EINVAL;
1420
1421 err = kstrtoint(buf, 10, &value);
1422 if (err)
1423 return err;
1414 1424
1415 amdgpu_dpm_set_fan_control_mode(adev, value); 1425 amdgpu_dpm_set_fan_control_mode(adev, value);
1426 }
1416 1427
1417 return count; 1428 return count;
1418} 1429}