platform/kernel/linux-rpi.git
5 years agodrm/amd/powerplay: add smu_late_init for SMU11.
Chengming Gui [Wed, 30 Jan 2019 03:38:55 +0000 (11:38 +0800)]
drm/amd/powerplay: add smu_late_init for SMU11.

add smu_late_init to complete smu init sequence for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: set dpm table of vclk/dclk/eclk for smu11 (v2)
Likun Gao [Mon, 28 Jan 2019 04:19:57 +0000 (12:19 +0800)]
drm/amd/powerplay: set dpm table of vclk/dclk/eclk for smu11 (v2)

Set default dpm table fo vclk, dclk and eclk.
Open clk adjust rules for vclk, dclk.

v2: Open clk adjust rules for eclk.

Signed-off-by: Likun Gao <Likun.Gao@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>
5 years agodrm/amd/powerplay: get eclk/vclk/dclk for smu11
Likun Gao [Mon, 28 Jan 2019 04:04:46 +0000 (12:04 +0800)]
drm/amd/powerplay: get eclk/vclk/dclk for smu11

Get eclk, vclk and dclk info from vbios when hw init for smu11.

Signed-off-by: Likun Gao <Likun.Gao@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>
5 years agodrm/amd/powerplay: set fan target interface for hwmon
Likun Gao [Fri, 25 Jan 2019 09:45:24 +0000 (17:45 +0800)]
drm/amd/powerplay: set fan target interface for hwmon

Add fan1_target set interface to set fan speed for hwmon.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@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>
5 years agodrm/amd/powerplay: implement fan1_enable hwmon interface for SMU11 (v2)
Chengming Gui [Fri, 25 Jan 2019 10:57:34 +0000 (18:57 +0800)]
drm/amd/powerplay: implement fan1_enable hwmon interface for SMU11 (v2)

set the fan1_enable hwmon interface to call
smu_get_fan_control_mode and smu_set_fan_control_mode.

v2: fix print value.

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>
5 years agodrm/amd/powerplay: implement pwm1_enable hwmon interface for SMU11 (v2)
Chengming Gui [Fri, 25 Jan 2019 08:21:27 +0000 (16:21 +0800)]
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>
5 years agodrm/amd/powerplay: implement pwm1 hwmon interface for SMU11 (v2)
Chengming Gui [Thu, 24 Jan 2019 10:39:04 +0000 (18:39 +0800)]
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>
5 years agodrm/amd/powerplay: add STABLE_PSTATE_SCLK and STABLE_PSTATE_MCLK when read sensor...
Chengming Gui [Thu, 24 Jan 2019 09:50:57 +0000 (17:50 +0800)]
drm/amd/powerplay: add STABLE_PSTATE_SCLK and STABLE_PSTATE_MCLK when read sensor for SMU11

add AMDGPU_PP_SENSOR_STABLE_PSTATE_SCLK and
AMDGPU_PP_SENSOR_STABLE_PSTATE_MCLK to support
read sensor for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Kevin Wang <kevink1.wang@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>
5 years agodrm/amd/powerplay: implement power1_cap and power1_cap_max interface for SMU11 (v2)
Chengming Gui [Tue, 22 Jan 2019 09:56:16 +0000 (17:56 +0800)]
drm/amd/powerplay: implement power1_cap and power1_cap_max interface for SMU11 (v2)

add get_power_limit and set_power_limit functions
to support hwmon for SMU11.

v2: fix the code style issue.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add fan input interface for hwmon
Likun Gao [Fri, 25 Jan 2019 09:45:24 +0000 (17:45 +0800)]
drm/amd/powerplay: add fan input interface for hwmon

Add fan1_input and fan1_target interface to get fan speed info for hwmon.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@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>
5 years agodrm/amd/powerplay: add fan rpm limit interface for hwmon
Likun Gao [Fri, 25 Jan 2019 10:29:31 +0000 (18:29 +0800)]
drm/amd/powerplay: add fan rpm limit interface for hwmon

Add fan1_min and fan2_max function for hwmon.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@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>
5 years agodrm/amd/powerplay: debugfs don't check powerplay when SW SMU is enabled.
Kevin Wang [Mon, 28 Jan 2019 07:14:47 +0000 (15:14 +0800)]
drm/amd/powerplay: debugfs don't check powerplay when SW SMU is enabled.

when sw smu is enabled, the powerplay interface isn't implemented.

Signed-off-by: Kevin Wang <kevin1.wang@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>
5 years agodrm/amd/powerplay: enable amdgpu dpm for smu
Kevin Wang [Fri, 25 Jan 2019 09:33:40 +0000 (17:33 +0800)]
drm/amd/powerplay: enable amdgpu dpm for smu

enable amdgpu dpm global flag

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to get sclk and mclk
Likun Gao [Mon, 28 Jan 2019 11:12:10 +0000 (19:12 +0800)]
drm/amd/powerplay: add function to get sclk and mclk

Add function to get sclk and mclk for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: Unify smu handle task function (v2)
Likun Gao [Thu, 24 Jan 2019 11:53:40 +0000 (19:53 +0800)]
drm/amd/powerplay: Unify smu handle task function (v2)

Unify power stade adjust function into smu_handle_task by the judgment
of task_id.
Move functions which have no relationship with smu version into the file
of amdgpu_smu.
Modified the function of smu_display_config_changed into two part.
Unify some similiar function.

v2: Correct the operation of upload dpm level when force dpm limit value.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement dpm enable functions of uvd & vce for smu
Kevin Wang [Fri, 25 Jan 2019 07:10:13 +0000 (15:10 +0800)]
drm/amd/powerplay: implement dpm enable functions of uvd & vce for smu

add function of dpm enable uvd & vce for extern module use.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sensor of uvd & vce power state for smu11
Kevin Wang [Fri, 25 Jan 2019 08:22:20 +0000 (16:22 +0800)]
drm/amd/powerplay: implement sensor of uvd & vce power state for smu11

add functions of uvd & vce for hwmon.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement uvd & vce dpm enable functions
Kevin Wang [Thu, 24 Jan 2019 11:58:11 +0000 (19:58 +0800)]
drm/amd/powerplay: implement uvd & vce dpm enable functions

add dpm enable functions for vce,uvd.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: hwmon don't check powerplay when sw smu is enabled
Kevin Wang [Thu, 24 Jan 2019 11:14:22 +0000 (19:14 +0800)]
drm/amd/powerplay: hwmon don't check powerplay when sw smu is enabled

when sw-smu is enabled, the driver won't init powerplay structure.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement update enabled feature state to smc for smu11
Kevin Wang [Thu, 24 Jan 2019 07:27:02 +0000 (15:27 +0800)]
drm/amd/powerplay: implement update enabled feature state to smc for smu11

change:
1.when enable smu feature, the feature id will store sw-bitmap and smu
controller.
2.add feature mutex lock to protect feature bitmap changed when update
feature enabled state.

Signed-off-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: dpm clk can be set only when performance level is manual
Likun Gao [Wed, 23 Jan 2019 05:37:39 +0000 (13:37 +0800)]
drm/amd/powerplay: dpm clk can be set only when performance level is manual

Add condition to make dpm clk can not be set when perfomance level isn't
equal to manual.
Add mutex lock to smu when set dpm clk.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: adjust power state when set od_clk
Likun Gao [Wed, 23 Jan 2019 03:10:59 +0000 (11:10 +0800)]
drm/amd/powerplay: adjust power state when set od_clk

Expose the function of adjust_power_state_dynamic to make it common to
other functions.
Add the operate of adjust powet state when set od percentage or
overdrive commit dpm table.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add sys interface to set pp_od_clk_voltage for smu
Likun Gao [Mon, 21 Jan 2019 06:58:38 +0000 (14:58 +0800)]
drm/amd/powerplay: add sys interface to set pp_od_clk_voltage for smu

Add sys interface to set pp_od_clk_voltage for smu.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add sys interface for set sclk_od/mclk_od for smu
Likun Gao [Fri, 18 Jan 2019 08:15:14 +0000 (16:15 +0800)]
drm/amd/powerplay: add sys interface for set sclk_od/mclk_od for smu

Add sys interface for set pp_sclk_od and pp_mclk_od for smu.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to update overdrive settings
Likun Gao [Fri, 18 Jan 2019 07:00:15 +0000 (15:00 +0800)]
drm/amd/powerplay: add function to update overdrive settings

Add function of smu_update_specified_od8_value to modify specified
overdrive value.
Add fucntion of smu_update_od8_settings to update overdrive table.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add sys interface for pcie for smu
Likun Gao [Fri, 18 Jan 2019 04:53:27 +0000 (12:53 +0800)]
drm/amd/powerplay: add sys interface for pcie for smu

Add sys interface for set/get PCIE info for SMU.
The related operate will do nothing as vega20 do not support it now.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement power_dpm_force_performance_level for SMU11
Chengming Gui [Fri, 18 Jan 2019 03:27:25 +0000 (11:27 +0800)]
drm/amd/powerplay: implement power_dpm_force_performance_level for SMU11

add get_performance_level and force_performance_level
to implement the sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add vega20_unforce_dpm_levels for SMU11.
Chengming Gui [Fri, 18 Jan 2019 02:15:22 +0000 (10:15 +0800)]
drm/amd/powerplay: add vega20_unforce_dpm_levels for SMU11.

add vega20_unforce_dpm_levels to support sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add vega20_find/force_higest/lowest_dpm for SMU11 (v2)
Chengming Gui [Fri, 18 Jan 2019 02:09:46 +0000 (10:09 +0800)]
drm/amd/powerplay: add vega20_find/force_higest/lowest_dpm for SMU11 (v2)

add vega20_find_highest_dpm_level, vega20_find_lowest_dpm_level,
    vega20_force_highest_dpm and vega20_force_lowest_dpm functions
    to support sys interface for SMU11.

v2: fix highest/lowest implementation changes error.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add vega20_notify_smc_display_config functions for SMU11
Chengming Gui [Fri, 18 Jan 2019 02:01:10 +0000 (10:01 +0800)]
drm/amd/powerplay: add vega20_notify_smc_display_config functions for SMU11

add vega20_notify_smc_display_config functions to
support sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add apply_clock_adjust_rules for SMU11.
Chengming Gui [Fri, 18 Jan 2019 01:47:23 +0000 (09:47 +0800)]
drm/amd/powerplay: add apply_clock_adjust_rules for SMU11.

add apply_clock_adjust_rules to support sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add display_config_changed for SMU11.
Chengming Gui [Thu, 17 Jan 2019 10:45:16 +0000 (18:45 +0800)]
drm/amd/powerplay: add display_config_changed for SMU11.

add display_config_changed to support sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add set_uclk_to_highest_level for SMU11
Chengming Gui [Thu, 17 Jan 2019 10:40:15 +0000 (18:40 +0800)]
drm/amd/powerplay: add set_uclk_to_highest_level for SMU11

add set_uclk_to_highest_level to support sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add get_profiling_clk_mask functions for SMU11
Chengming Gui [Thu, 17 Jan 2019 10:10:52 +0000 (18:10 +0800)]
drm/amd/powerplay: add get_profiling_clk_mask functions for SMU11

add get_profiling_clk_masking_clk_mask
to support sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add enable_umd_pstate functions for SMU11
Chengming Gui [Thu, 17 Jan 2019 09:57:18 +0000 (17:57 +0800)]
drm/amd/powerplay: add enable_umd_pstate functions for SMU11

add enable_umd_pstate to support sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add mclk_latency_table struct and smu_clocks struct for SMU11
Chengming Gui [Thu, 17 Jan 2019 09:35:58 +0000 (17:35 +0800)]
drm/amd/powerplay: add mclk_latency_table struct and smu_clocks struct for SMU11

add mclk_latency_table struct and smu_clocks structi
to support sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add display_config to handle display config for SMU11.
Chengming Gui [Thu, 17 Jan 2019 08:58:57 +0000 (16:58 +0800)]
drm/amd/powerplay: add display_config to handle display config for SMU11.

add display_config to support sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement pp_power_profile_mode sys inerface for SMU11
Chengming Gui [Mon, 14 Jan 2019 06:37:31 +0000 (14:37 +0800)]
drm/amd/powerplay: implement pp_power_profile_mode sys inerface for SMU11

Add set/get power profile mode functions.
Added dependency interfaces:
1) vega20_set_activity_monitor_coeff
2) vega20_get_activity_monitor_coeff
3) conv_power_profile_to_pplib_workload

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add watermarks related data structs and function for SMU11.
Chengming Gui [Thu, 17 Jan 2019 05:45:06 +0000 (13:45 +0800)]
drm/amd/powerplay: add watermarks related data structs and function for SMU11.

add write watermark table function and watermark flags
to support sys interface for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement power_dpm_state sys interface for SMU11
Chengming Gui [Fri, 4 Jan 2019 09:42:09 +0000 (17:42 +0800)]
drm/amd/powerplay: implement power_dpm_state sys interface for SMU11

Add functions to get/set dpm state for SMU11.

Signed-off-by: Chengming Gui <Jack.Gui@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Acked-by: Kevin Wang <kevin.wang@amd.com>
Reviewd-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: don't check hwmgr while using the sw smu
Huang Rui [Wed, 23 Jan 2019 11:09:08 +0000 (19:09 +0800)]
drm/amd/powerplay: don't check hwmgr while using the sw smu

While using the sw smu path, driver won't init hwmgr structure.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: remove unnecessary checking in smu_hw_fini
Huang Rui [Tue, 22 Jan 2019 08:26:39 +0000 (16:26 +0800)]
drm/amd/powerplay: remove unnecessary checking in smu_hw_fini

This patch removes unnecessary NULL pointer checking in smu_hw_fini, because
kfree is able to handle NULL pointer case.

Suggested-by: Hawking Zhang <Hawking.Zhang@amd.com>
Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: get overdrive clock and voltage information
Likun Gao [Mon, 14 Jan 2019 09:22:09 +0000 (17:22 +0800)]
drm/amd/powerplay: get overdrive clock and voltage information

Add sys interface to get overdrive clock and voltage information for
smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: print overdrive percentage information for smu11
Likun Gao [Fri, 11 Jan 2019 10:47:14 +0000 (18:47 +0800)]
drm/amd/powerplay: print overdrive percentage information for smu11

Add function to get sclk or mclk overdrive percentage information for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add golden dpm table to backup default DPM table (v2)
Likun Gao [Fri, 11 Jan 2019 09:42:47 +0000 (17:42 +0800)]
drm/amd/powerplay: add golden dpm table to backup default DPM table (v2)

Backup default DPM table into golden dpm table.

v2: fix dpm_context and golden_dpm_context kfree two times issue.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to set default overdrive settings
Likun Gao [Wed, 9 Jan 2019 11:11:58 +0000 (19:11 +0800)]
drm/amd/powerplay: add function to set default overdrive settings

Add function of vega20_set_default_od8_setttings for vega20 with smu11
arch to setup default overdrive value.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to store overdrive information for smu11
Likun Gao [Tue, 8 Jan 2019 06:18:02 +0000 (14:18 +0800)]
drm/amd/powerplay: add function to store overdrive information for smu11

Add vega20_setup_od8_information function to store overdrive information
from powerplay_table to smu_table which will used when setting od8.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement interface to set watermarks for clock ranges
Huang Rui [Thu, 17 Jan 2019 07:25:37 +0000 (15:25 +0800)]
drm/amd/powerplay: implement interface to set watermarks for clock ranges

This patch implements inteferface to set watermarks table for clock ranges on
smu 11. It fills watermark table before it is written to SMC.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to notify smu enable pme restore register
Huang Rui [Wed, 16 Jan 2019 10:55:33 +0000 (18:55 +0800)]
drm/amd/powerplay: add interface to notify smu enable pme restore register

This patch adds interface to notify smu enable pme restore register for display
and in smu v11 didn't have this implementation.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to get current clocks for display
Huang Rui [Wed, 16 Jan 2019 06:43:29 +0000 (14:43 +0800)]
drm/amd/powerplay: add interface to get current clocks for display

This patch fills the amd_pp_clock_info data for display, it will get the current
info in that structure.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to get current shallow sleep clocks
Huang Rui [Wed, 16 Jan 2019 06:30:11 +0000 (14:30 +0800)]
drm/amd/powerplay: add interface to get current shallow sleep clocks

This patch adds interface to get current shallow sleep clocks for display and in
smu v11 didn't have this implementation.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to get performance level
Huang Rui [Wed, 16 Jan 2019 06:22:16 +0000 (14:22 +0800)]
drm/amd/powerplay: add interface to get performance level

This patch adds interface to get performance level for display and in smu v11
didn't have this implementation.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to get dal power level
Huang Rui [Wed, 16 Jan 2019 06:10:59 +0000 (14:10 +0800)]
drm/amd/powerplay: add interface to get dal power level

This patch adds interface to get dal power level for display and in smu v11
didn't have this implementation.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to request display clock voltage
Huang Rui [Mon, 14 Jan 2019 07:24:59 +0000 (15:24 +0800)]
drm/amd/powerplay: add interface to request display clock voltage

This patch adds interface to request display clock voltage, display will use it
to request current display clock voltage.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to get clock by type with voltage for display
Huang Rui [Mon, 14 Jan 2019 06:08:18 +0000 (14:08 +0800)]
drm/amd/powerplay: add interface to get clock by type with voltage for display

This patch adds inteface to get clock by type with voltage, display will use it
to get current clocks with voltage.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to get clock by type with latency for display (v2)
Huang Rui [Mon, 14 Jan 2019 03:55:45 +0000 (11:55 +0800)]
drm/amd/powerplay: add interface to get clock by type with latency for display (v2)

This patch adds get clock by type with latency, display will use it to get
current clocks with latency.

v2: fix the missed mutex lock before return.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add interface to get max high clocks for display
Huang Rui [Fri, 11 Jan 2019 09:33:41 +0000 (17:33 +0800)]
drm/amd/powerplay: add interface to get max high clocks for display

This patch adds interface to get max high clocks for display and in smu v11
didn't have this implementation.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add get_clock_by_type interface for display
Huang Rui [Fri, 11 Jan 2019 09:12:04 +0000 (17:12 +0800)]
drm/amd/powerplay: add get_clock_by_type interface for display

This patch adds get_clock_by_type interface for display, in smu v11 didn't have
the implementation.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add smu display configuration change function
Huang Rui [Fri, 11 Jan 2019 08:23:36 +0000 (16:23 +0800)]
drm/amd/powerplay: add smu display configuration change function

This patch adds display configuration change function that creates the new path
with sw smu driver instead of powerplay.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add two interfaces to set_active_display_count and store_cc6_data
Huang Rui [Fri, 11 Jan 2019 08:12:03 +0000 (16:12 +0800)]
drm/amd/powerplay: add two interfaces to set_active_display_count and store_cc6_data

This patch adds two interfaces to set_active_display_count and store_cc6_data,
they won't be used for smu11, and just be the placeholders for future asic on
display to smu interface.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add the function to set deep sleep dcefclk
Huang Rui [Fri, 11 Jan 2019 07:51:16 +0000 (15:51 +0800)]
drm/amd/powerplay: add the function to set deep sleep dcefclk

This patch adds the function to set deep sleep dcefclk. It will be used on
display part.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sysfs of pp_force_state for sw-smu
Kevin Wang [Thu, 17 Jan 2019 05:46:08 +0000 (13:46 +0800)]
drm/amd/powerplay: implement sysfs of pp_force_state for sw-smu

the SMU v11 doesn’t support pp_force_state so far, so we didn’t implement
it.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sysfs of pp_cur_state function
Kevin Wang [Thu, 17 Jan 2019 05:29:06 +0000 (13:29 +0800)]
drm/amd/powerplay: implement sysfs of pp_cur_state function

add function of smu_get_currente_state for sw-smu.

v2: fix code typo error if (ret);

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sysfs of get num states function
Kevin Wang [Thu, 17 Jan 2019 05:15:48 +0000 (13:15 +0800)]
drm/amd/powerplay: implement sysfs of get num states function

add function smu_get_power_num_state function for sw-smu.
it's only for sysfs interface, the power state feature is not ready for sw-smu.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sensor of get feature mask
Kevin Wang [Wed, 16 Jan 2019 01:55:03 +0000 (09:55 +0800)]
drm/amd/powerplay: implement sensor of get feature mask

add sensor interface of feature mask for debugfs.
this interface is not ip related function, so need move high level
file to implement (amdgpu_smu)

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sensor of get_gfx_vdd for smu11
Kevin Wang [Wed, 16 Jan 2019 05:31:12 +0000 (13:31 +0800)]
drm/amd/powerplay: implement sensor of get_gfx_vdd for smu11

add sensor interface of gfx vdd for hwmon

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sensor of get_gpu_power for smu11
Kevin Wang [Wed, 16 Jan 2019 05:27:52 +0000 (13:27 +0800)]
drm/amd/powerplay: implement sensor of get_gpu_power for smu11

add sensor interface of get gpu power for debugfs and hwmon.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sensor of thermal_get_temperature for smu11
Kevin Wang [Tue, 15 Jan 2019 04:37:35 +0000 (12:37 +0800)]
drm/amd/powerplay: implement sensor of thermal_get_temperature for smu11

add sensor interface of thermal temperature for debugfs and hwmon.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sensor of SCLK and MCLK for smu11
Kevin Wang [Tue, 15 Jan 2019 04:25:59 +0000 (12:25 +0800)]
drm/amd/powerplay: implement sensor of SCLK and MCLK for smu11

add sensor interface of SCLK and MCKL for sys interface and hwmon.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: force clock levels for smu11
Likun Gao [Mon, 7 Jan 2019 07:59:56 +0000 (15:59 +0800)]
drm/amd/powerplay: force clock levels for smu11

Add function to set sclk or mclk level for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: upload dpm level for smu11
Likun Gao [Mon, 7 Jan 2019 06:56:07 +0000 (14:56 +0800)]
drm/amd/powerplay: upload dpm level for smu11

Add function to support gfx_clk and mem_clk upload min and max dpm level for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Evan Quan <evan.quan@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sysfs of pp_table for smu11 (v2)
Kevin Wang [Fri, 11 Jan 2019 07:07:52 +0000 (15:07 +0800)]
drm/amd/powerplay: implement sysfs of pp_table for smu11 (v2)

add pp_table sysfs interface for new sw-smu.
get: return pptable raw data
set: write pptable raw data to pptable, then reset smu (hw_fini -> hw_init)

v2: fix mutex lock issue

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement sysfs of amdgpu_get_busy_percent for smu11
Kevin Wang [Fri, 11 Jan 2019 06:51:24 +0000 (14:51 +0800)]
drm/amd/powerplay: implement sysfs of amdgpu_get_busy_percent for smu11

add interface amdgpu_get_busy_percent for smu11

v2: convert data pointer type to uint32_t *.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement is_support_sw_smu function for new smu
Kevin Wang [Thu, 10 Jan 2019 04:33:23 +0000 (12:33 +0800)]
drm/amd/powerplay: implement is_support_sw_smu function for new smu

add this helper to check new sw-smu support.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu update table function
Kevin Wang [Mon, 7 Jan 2019 07:34:09 +0000 (15:34 +0800)]
drm/amd/powerplay: implement smu update table function

sometime, the driver need changed table data between driver and smu.
this function can help update table data

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to start thermal control
Likun Gao [Fri, 4 Jan 2019 08:00:48 +0000 (16:00 +0800)]
drm/amd/powerplay: add function to start thermal control

Add function to start thermal control for smu11 when smu hw_init.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to set fan table to control thermal
Likun Gao [Fri, 4 Jan 2019 07:40:53 +0000 (15:40 +0800)]
drm/amd/powerplay: add function to set fan table to control thermal

Add function of smu_v11_0_set_thermal_fan_table to set fan table for
smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to enable thermal alert
Likun Gao [Fri, 4 Jan 2019 06:36:35 +0000 (14:36 +0800)]
drm/amd/powerplay: add function to enable thermal alert

Add function to enable thermal alerts on thermal control for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to set thermal range
Likun Gao [Fri, 4 Jan 2019 06:13:09 +0000 (14:13 +0800)]
drm/amd/powerplay: add function to set thermal range

Add the function to set the correct min and max thermal value for smu11

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to get thermal range
Likun Gao [Fri, 4 Jan 2019 08:23:23 +0000 (16:23 +0800)]
drm/amd/powerplay: add function to get thermal range

Add the function to get the min and max thermal value for vega20 with
smu11 architecture.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add get_max_sustainable_clock function
Huang Rui [Tue, 25 Dec 2018 08:34:39 +0000 (16:34 +0800)]
drm/amd/powerplay: add get_max_sustainable_clock function

This patch adds get_max_sustainable_clock function for smu11.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: print clock levels for smu11 (v2)
Likun Gao [Tue, 15 Jan 2019 02:56:55 +0000 (10:56 +0800)]
drm/amd/powerplay: print clock levels for smu11 (v2)

Add function to print current levels for smu11.

v2: expose get_current_clk_freq for smu v11. (Kevin)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement get_current_clk_freq for smu11
Kevin Wang [Tue, 15 Jan 2019 02:54:45 +0000 (10:54 +0800)]
drm/amd/powerplay: implement get_current_clk_freq for smu11

This patch implements get_current_clk_freq for smu11 future use.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to get power limit for smu11 (v2)
Likun Gao [Tue, 25 Dec 2018 06:44:25 +0000 (14:44 +0800)]
drm/amd/powerplay: add function to get power limit for smu11 (v2)

Add smu_v11_0_get_power_limit function to get power limit vaule.

v2: update "set" to "get", it only implements "get" behavior. (Alex)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to populate umd state clk.
Likun Gao [Mon, 24 Dec 2018 11:49:38 +0000 (19:49 +0800)]
drm/amd/powerplay: add function to populate umd state clk.

Add vega20_populate_umd_state_clk function to set pstate_sclk and pstate_mclk.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: set defalut dpm table for smu
Likun Gao [Thu, 20 Dec 2018 12:31:55 +0000 (20:31 +0800)]
drm/amd/powerplay: set defalut dpm table for smu

Add smu_set_default_dpm_table function to set dpm table for smu11.
Modified the sequence to populate smc pptable, as it should be done after
related dpm feature is enabled.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu_notify_display_change function for smu11
Kevin Wang [Wed, 26 Dec 2018 08:14:55 +0000 (16:14 +0800)]
drm/amd/powerplay: implement smu_notify_display_change function for smu11

add smu_notify_display_change function to send msg to smc to notify
display is changed.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement feature get&set functions
Kevin Wang [Wed, 26 Dec 2018 08:13:09 +0000 (16:13 +0800)]
drm/amd/powerplay: implement feature get&set functions

add smu feature operation function helper to deal with smu feature
bitmap.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu feature functions
Kevin Wang [Wed, 26 Dec 2018 09:36:25 +0000 (17:36 +0800)]
drm/amd/powerplay: implement smu feature functions

each ip will support different smu feature,
the driver use bitmap to management this feature.

bitmap:
-allowed: sw driver to enable & disable some feature when driver init.
-suppored: the feature is supproed.
-enabled: the feature is enabled.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <Ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu_run_afll_btc function
Kevin Wang [Mon, 24 Dec 2018 10:17:15 +0000 (18:17 +0800)]
drm/amd/powerplay: implement smu_run_afll_btc function

Add smu_run_afll_btc function to send msg to smc to start run afll btc.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu_init_display for smu11
Kevin Wang [Mon, 24 Dec 2018 07:02:50 +0000 (15:02 +0800)]
drm/amd/powerplay: implement smu_init_display for smu11

Add smu_init_display function to send msg to smc to init display.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: Change the allocate method of dpm context for smu11.
Likun Gao [Wed, 26 Dec 2018 03:07:57 +0000 (11:07 +0800)]
drm/amd/powerplay: Change the allocate method of dpm context for smu11.

Change the allocate method of dpm context as dpm_table is different bewteen
vega20 and smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: expose the function of smu read argument
Likun Gao [Thu, 20 Dec 2018 12:09:00 +0000 (20:09 +0800)]
drm/amd/powerplay: expose the function of smu read argument

Expose the function of smu_read_smc_arg to get argument value from SMU11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add append_powerplay_table function
Huang Rui [Thu, 20 Dec 2018 15:06:08 +0000 (23:06 +0800)]
drm/amd/powerplay: add append_powerplay_table function

It needs to add append_powerplay_table function to program the smc_dpm_table for
PPTable_t.

Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: replace SMU_MSG_XXX with PPSMC_MSG_XXX message index for smu11...
Kevin Wang [Wed, 19 Dec 2018 08:27:55 +0000 (16:27 +0800)]
drm/amd/powerplay: replace SMU_MSG_XXX with PPSMC_MSG_XXX message index for smu11 (v2)

This patch is to setup a common SMU_MSGs for smu11. We can support common MSG
definitions for each asics under smu11.

v2: move smu_v11_0_ppsmc.h to xxx_ppt.c level, because it depends on specific
asic.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: use virtual msg index to replace asic-related msg index
Kevin Wang [Wed, 19 Dec 2018 08:23:23 +0000 (16:23 +0800)]
drm/amd/powerplay: use virtual msg index to replace asic-related msg index

Using virtual msg index is able to support all ASIC specific message values on
one smu upper layer.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: implement smu vega20_message_map for vega20
Kevin Wang [Wed, 19 Dec 2018 07:46:24 +0000 (15:46 +0800)]
drm/amd/powerplay: implement smu vega20_message_map for vega20

This patch implements smu vega20_message_map to map the PPSMC messages from
smu11 to specific asic.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add enum smu_msg_type to header
Kevin Wang [Wed, 19 Dec 2018 07:12:10 +0000 (15:12 +0800)]
drm/amd/powerplay: add enum smu_msg_type to header

each asic with different message index,
add this header to help top level smu code to send message.

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to set tool table location for smu11 (v2)
Likun Gao [Wed, 12 Dec 2018 11:42:53 +0000 (19:42 +0800)]
drm/amd/powerplay: add function to set tool table location for smu11 (v2)

Add smu_v11_0_set_tool_table_location function for smu11.

v2: fix the missed TABLE_PMSTATUSLOG bo creation which caused AGM hung. (Ray)

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
5 years agodrm/amd/powerplay: add function to set min dcef deep sleep for smu11 (v2)
Likun Gao [Wed, 12 Dec 2018 11:31:31 +0000 (19:31 +0800)]
drm/amd/powerplay: add function to set min dcef deep sleep for smu11 (v2)

Add smu_v11_0_set_min_dcef_deep_sleep function for smu11.

v2: fix coding error about set_min_dcef_deep_sleep (Kevin)

Signed-off-by: Kevin Wang <Kevin1.Wang@amd.com>
Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Kevin Wang <Kevin1.Wang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>