aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
diff options
context:
space:
mode:
authorEvan Quan <evan.quan@amd.com>2018-08-29 02:38:50 -0400
committerAlex Deucher <alexander.deucher@amd.com>2018-09-10 23:39:30 -0400
commitd5bf26539494d16dfabbbea0854a47d202ea15c0 (patch)
treea0a4af89da4fdbbdc1e585d07d6241e20bf4970e /drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
parent6abc0c8f8cf3e0c47707b01f027f9f9b9aa75646 (diff)
drm/amd/powerplay: added vega20 overdrive support V3
Added vega20 overdrive support based on existing OD sysfs APIs. However, the OD logics are simplified on vega20. So, the behavior will be a little different and works only on some limited levels. V2: fix typo fix commit description revise error logs add support for clock OD V3: separate clock from voltage OD settings Signed-off-by: Evan Quan <evan.quan@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.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index b7b16cb5ff0f..396c826100e6 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -474,6 +474,8 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,
474 * in each power level within a power state. The pp_od_clk_voltage is used for 474 * in each power level within a power state. The pp_od_clk_voltage is used for
475 * this. 475 * this.
476 * 476 *
477 * < For Vega10 and previous ASICs >
478 *
477 * Reading the file will display: 479 * Reading the file will display:
478 * 480 *
479 * - a list of engine clock levels and voltages labeled OD_SCLK 481 * - a list of engine clock levels and voltages labeled OD_SCLK
@@ -491,6 +493,44 @@ static ssize_t amdgpu_set_pp_table(struct device *dev,
491 * "c" (commit) to the file to commit your changes. If you want to reset to the 493 * "c" (commit) to the file to commit your changes. If you want to reset to the
492 * default power levels, write "r" (reset) to the file to reset them. 494 * default power levels, write "r" (reset) to the file to reset them.
493 * 495 *
496 *
497 * < For Vega20 >
498 *
499 * Reading the file will display:
500 *
501 * - minimum and maximum engine clock labeled OD_SCLK
502 *
503 * - maximum memory clock labeled OD_MCLK
504 *
505 * - three <frequency, voltage offset> points labeled OD_VDDC_CURVE.
506 * They can be used to calibrate the sclk voltage curve.
507 *
508 * - a list of valid ranges for sclk, mclk, and voltage curve points
509 * labeled OD_RANGE
510 *
511 * To manually adjust these settings:
512 *
513 * - First select manual using power_dpm_force_performance_level
514 *
515 * - For clock frequency setting, enter a new value by writing a
516 * string that contains "s/m index clock" to the file. The index
517 * should be 0 if to set minimum clock. And 1 if to set maximum
518 * clock. E.g., "s 0 500" will update minimum sclk to be 500 MHz.
519 * "m 1 800" will update maximum mclk to be 800Mhz.
520 *
521 * For sclk voltage curve, enter the new values by writing a
522 * string that contains "vc point clock voff" to the file. The
523 * points are indexed by 0, 1 and 2. E.g., "vc 0 300 10" will
524 * update point1 with clock set as 300Mhz and voltage increased
525 * by 10mV. "vc 2 1000 -10" will update point3 with clock set
526 * as 1000Mhz and voltage drop by 10mV.
527 *
528 * - When you have edited all of the states as needed, write "c" (commit)
529 * to the file to commit your changes
530 *
531 * - If you want to reset to the default power levels, write "r" (reset)
532 * to the file to reset them
533 *
494 */ 534 */
495 535
496static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev, 536static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
@@ -520,6 +560,8 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
520 type = PP_OD_RESTORE_DEFAULT_TABLE; 560 type = PP_OD_RESTORE_DEFAULT_TABLE;
521 else if (*buf == 'c') 561 else if (*buf == 'c')
522 type = PP_OD_COMMIT_DPM_TABLE; 562 type = PP_OD_COMMIT_DPM_TABLE;
563 else if (!strncmp(buf, "vc", 2))
564 type = PP_OD_EDIT_VDDC_CURVE;
523 else 565 else
524 return -EINVAL; 566 return -EINVAL;
525 567
@@ -527,6 +569,8 @@ static ssize_t amdgpu_set_pp_od_clk_voltage(struct device *dev,
527 569
528 tmp_str = buf_cpy; 570 tmp_str = buf_cpy;
529 571
572 if (type == PP_OD_EDIT_VDDC_CURVE)
573 tmp_str++;
530 while (isspace(*++tmp_str)); 574 while (isspace(*++tmp_str));
531 575
532 while (tmp_str[0]) { 576 while (tmp_str[0]) {
@@ -570,6 +614,7 @@ static ssize_t amdgpu_get_pp_od_clk_voltage(struct device *dev,
570 if (adev->powerplay.pp_funcs->print_clock_levels) { 614 if (adev->powerplay.pp_funcs->print_clock_levels) {
571 size = amdgpu_dpm_print_clock_levels(adev, OD_SCLK, buf); 615 size = amdgpu_dpm_print_clock_levels(adev, OD_SCLK, buf);
572 size += amdgpu_dpm_print_clock_levels(adev, OD_MCLK, buf+size); 616 size += amdgpu_dpm_print_clock_levels(adev, OD_MCLK, buf+size);
617 size += amdgpu_dpm_print_clock_levels(adev, OD_VDDC_CURVE, buf+size);
573 size += amdgpu_dpm_print_clock_levels(adev, OD_RANGE, buf+size); 618 size += amdgpu_dpm_print_clock_levels(adev, OD_RANGE, buf+size);
574 return size; 619 return size;
575 } else { 620 } else {