aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 235fae54724b..40ae30530a01 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -184,10 +184,10 @@ static ssize_t amdgpu_hwmon_show_temp(struct device *dev,
184 struct amdgpu_device *adev = dev_get_drvdata(dev); 184 struct amdgpu_device *adev = dev_get_drvdata(dev);
185 int temp; 185 int temp;
186 186
187 if (adev->pm.funcs->get_temperature) 187 if (!amdgpu_powerplay && !adev->pm.funcs->get_temperature)
188 temp = amdgpu_dpm_get_temperature(adev);
189 else
190 temp = 0; 188 temp = 0;
189 else
190 temp = amdgpu_dpm_get_temperature(adev);
191 191
192 return snprintf(buf, PAGE_SIZE, "%d\n", temp); 192 return snprintf(buf, PAGE_SIZE, "%d\n", temp);
193} 193}
@@ -215,8 +215,10 @@ static ssize_t amdgpu_hwmon_get_pwm1_enable(struct device *dev,
215 struct amdgpu_device *adev = dev_get_drvdata(dev); 215 struct amdgpu_device *adev = dev_get_drvdata(dev);
216 u32 pwm_mode = 0; 216 u32 pwm_mode = 0;
217 217
218 if (adev->pm.funcs->get_fan_control_mode) 218 if (!amdgpu_powerplay && !adev->pm.funcs->get_fan_control_mode)
219 pwm_mode = amdgpu_dpm_get_fan_control_mode(adev); 219 return -EINVAL;
220
221 pwm_mode = amdgpu_dpm_get_fan_control_mode(adev);
220 222
221 /* never 0 (full-speed), fuse or smc-controlled always */ 223 /* never 0 (full-speed), fuse or smc-controlled always */
222 return sprintf(buf, "%i\n", pwm_mode == FDO_PWM_MODE_STATIC ? 1 : 2); 224 return sprintf(buf, "%i\n", pwm_mode == FDO_PWM_MODE_STATIC ? 1 : 2);
@@ -231,7 +233,7 @@ static ssize_t amdgpu_hwmon_set_pwm1_enable(struct device *dev,
231 int err; 233 int err;
232 int value; 234 int value;
233 235
234 if (!adev->pm.funcs->set_fan_control_mode) 236 if (!amdgpu_powerplay && !adev->pm.funcs->set_fan_control_mode)
235 return -EINVAL; 237 return -EINVAL;
236 238
237 err = kstrtoint(buf, 10, &value); 239 err = kstrtoint(buf, 10, &value);
@@ -328,9 +330,6 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
328 struct amdgpu_device *adev = dev_get_drvdata(dev); 330 struct amdgpu_device *adev = dev_get_drvdata(dev);
329 umode_t effective_mode = attr->mode; 331 umode_t effective_mode = attr->mode;
330 332
331 if (amdgpu_powerplay)
332 return 0; /* to do */
333
334 /* Skip limit attributes if DPM is not enabled */ 333 /* Skip limit attributes if DPM is not enabled */
335 if (!adev->pm.dpm_enabled && 334 if (!adev->pm.dpm_enabled &&
336 (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr || 335 (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr ||
@@ -341,6 +340,9 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
341 attr == &sensor_dev_attr_pwm1_min.dev_attr.attr)) 340 attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
342 return 0; 341 return 0;
343 342
343 if (amdgpu_powerplay)
344 return effective_mode;
345
344 /* Skip fan attributes if fan is not present */ 346 /* Skip fan attributes if fan is not present */
345 if (adev->pm.no_fan && 347 if (adev->pm.no_fan &&
346 (attr == &sensor_dev_attr_pwm1.dev_attr.attr || 348 (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||