aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
authorEric Huang <JinHuiEric.Huang@amd.com>2016-04-12 14:57:23 -0400
committerAlex Deucher <alexander.deucher@amd.com>2016-05-04 20:29:47 -0400
commit5632708f4452eb9afb985b245b98dac9a5feeac2 (patch)
treecd46c6074e2869548d735b77f17fe0d1be3953b6 /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
parent51224389543ebd7307e09f0f46e5c5cac417d940 (diff)
drm/amd/powerplay: add dpm force multiple levels on cz/tonga/fiji/polaris (v2)
Allows you to force multiple levels rather than just one via the new sysfs interrface. v2: squash in: drm/amd/powerplay: ensure clock level set by user is valid. From Rex. Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Eric Huang <JinHuiEric.Huang@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.c51
1 files changed, 36 insertions, 15 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 6d44d4a64698..589b36e8c5cf 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -362,16 +362,23 @@ static ssize_t amdgpu_set_pp_dpm_sclk(struct device *dev,
362 struct amdgpu_device *adev = ddev->dev_private; 362 struct amdgpu_device *adev = ddev->dev_private;
363 int ret; 363 int ret;
364 long level; 364 long level;
365 uint32_t i, mask = 0;
366 char sub_str[2];
365 367
366 ret = kstrtol(buf, 0, &level); 368 for (i = 0; i < strlen(buf) - 1; i++) {
369 sub_str[0] = *(buf + i);
370 sub_str[1] = '\0';
371 ret = kstrtol(sub_str, 0, &level);
367 372
368 if (ret) { 373 if (ret) {
369 count = -EINVAL; 374 count = -EINVAL;
370 goto fail; 375 goto fail;
376 }
377 mask |= 1 << level;
371 } 378 }
372 379
373 if (adev->pp_enabled) 380 if (adev->pp_enabled)
374 amdgpu_dpm_force_clock_level(adev, PP_SCLK, level); 381 amdgpu_dpm_force_clock_level(adev, PP_SCLK, mask);
375fail: 382fail:
376 return count; 383 return count;
377} 384}
@@ -399,16 +406,23 @@ static ssize_t amdgpu_set_pp_dpm_mclk(struct device *dev,
399 struct amdgpu_device *adev = ddev->dev_private; 406 struct amdgpu_device *adev = ddev->dev_private;
400 int ret; 407 int ret;
401 long level; 408 long level;
409 uint32_t i, mask = 0;
410 char sub_str[2];
402 411
403 ret = kstrtol(buf, 0, &level); 412 for (i = 0; i < strlen(buf) - 1; i++) {
413 sub_str[0] = *(buf + i);
414 sub_str[1] = '\0';
415 ret = kstrtol(sub_str, 0, &level);
404 416
405 if (ret) { 417 if (ret) {
406 count = -EINVAL; 418 count = -EINVAL;
407 goto fail; 419 goto fail;
420 }
421 mask |= 1 << level;
408 } 422 }
409 423
410 if (adev->pp_enabled) 424 if (adev->pp_enabled)
411 amdgpu_dpm_force_clock_level(adev, PP_MCLK, level); 425 amdgpu_dpm_force_clock_level(adev, PP_MCLK, mask);
412fail: 426fail:
413 return count; 427 return count;
414} 428}
@@ -436,16 +450,23 @@ static ssize_t amdgpu_set_pp_dpm_pcie(struct device *dev,
436 struct amdgpu_device *adev = ddev->dev_private; 450 struct amdgpu_device *adev = ddev->dev_private;
437 int ret; 451 int ret;
438 long level; 452 long level;
453 uint32_t i, mask = 0;
454 char sub_str[2];
439 455
440 ret = kstrtol(buf, 0, &level); 456 for (i = 0; i < strlen(buf) - 1; i++) {
457 sub_str[0] = *(buf + i);
458 sub_str[1] = '\0';
459 ret = kstrtol(sub_str, 0, &level);
441 460
442 if (ret) { 461 if (ret) {
443 count = -EINVAL; 462 count = -EINVAL;
444 goto fail; 463 goto fail;
464 }
465 mask |= 1 << level;
445 } 466 }
446 467
447 if (adev->pp_enabled) 468 if (adev->pp_enabled)
448 amdgpu_dpm_force_clock_level(adev, PP_PCIE, level); 469 amdgpu_dpm_force_clock_level(adev, PP_PCIE, mask);
449fail: 470fail:
450 return count; 471 return count;
451} 472}