summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
diff options
context:
space:
mode:
authorHuang Rui <ray.huang@amd.com>2019-03-31 15:53:42 +0800
committerAlex Deucher <alexander.deucher@amd.com>2019-06-21 18:59:26 -0500
commit8890fe5f435333c9f6ea7cd6b6de964c669602f4 (patch)
tree4cfa279d92514f677e3fbe33711ede3a6e0a28ab /drivers/gpu/drm/amd/powerplay/vega20_ppt.c
parent973849042e0101d6dea1a4c00fdb2007128f86a6 (diff)
drm/amd/powerplay: introduce smu power source type to handle AC/DC source for each asic
This patch introduces new smu power source type, it's to handle the different AC/DC source defines for each asic with the same smu ip. Signed-off-by: Huang Rui <ray.huang@amd.com> Reviewed-by: Kevin Wang <kevin1.wang@amd.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Hawking Zhang <Hawking.Zhang@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/amd/powerplay/vega20_ppt.c')
-rw-r--r--drivers/gpu/drm/amd/powerplay/vega20_ppt.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
index 07abb047bf6b..f11ff0335e49 100644
--- a/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/vega20_ppt.c
@@ -202,6 +202,11 @@ static int vega20_table_map[SMU_TABLE_COUNT] = {
TAB_MAP(OVERDRIVE),
};
+static int vega20_pwr_src_map[SMU_POWER_SOURCE_COUNT] = {
+ PWR_MAP(AC),
+ PWR_MAP(DC),
+};
+
static int vega20_get_smu_table_index(struct smu_context *smc, uint32_t index)
{
int val;
@@ -215,6 +220,19 @@ static int vega20_get_smu_table_index(struct smu_context *smc, uint32_t index)
return val;
}
+static int vega20_get_pwr_src_index(struct smu_context *smc, uint32_t index)
+{
+ int val;
+ if (index >= SMU_POWER_SOURCE_COUNT)
+ return -EINVAL;
+
+ val = vega20_pwr_src_map[index];
+ if (val >= POWER_SOURCE_COUNT)
+ return -EINVAL;
+
+ return val;
+}
+
static int vega20_get_smu_feature_index(struct smu_context *smc, uint32_t index)
{
int val;
@@ -3105,6 +3123,7 @@ static const struct pptable_funcs vega20_ppt_funcs = {
.get_smu_clk_index = vega20_get_smu_clk_index,
.get_smu_feature_index = vega20_get_smu_feature_index,
.get_smu_table_index = vega20_get_smu_table_index,
+ .get_smu_power_index = vega20_get_pwr_src_index,
.run_afll_btc = vega20_run_btc_afll,
.get_allowed_feature_mask = vega20_get_allowed_feature_mask,
.get_current_power_state = vega20_get_current_power_state,