<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Acked-by: Alex Deucher <alexander.deucher@amd.com><br>
</p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> amd-gfx <amd-gfx-bounces@lists.freedesktop.org> on behalf of Rex Zhu <Rex.Zhu@amd.com><br>
<b>Sent:</b> Wednesday, March 21, 2018 7:34:34 AM<br>
<b>To:</b> amd-gfx@lists.freedesktop.org<br>
<b>Cc:</b> Zhu, Rex<br>
<b>Subject:</b> [PATCH] drm/amd/pp: Add new asic(vega12) support in pp_psm.c</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">In new asics, no power state management in driver,<br>
no need to implement related callback functions.<br>
add some ps checks in pp_psm.c<br>
<br>
Revert "drm/amd/powerplay: add new pp_psm infrastructure for vega12 (v2)"<br>
This reverts commit 7d1a63f3aa331b853e41f92d0e7890ed31de8c13.<br>
<br>
Change-Id: Ic31d3f475f94399d3136bff8be454f290e3c1e50<br>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com><br>
---<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/Makefile       |   4 +-<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c       | 270 ++++++++++++++++++---<br>
 .../gpu/drm/amd/powerplay/hwmgr/pp_psm_legacy.c    | 262 --------------------<br>
 .../gpu/drm/amd/powerplay/hwmgr/pp_psm_legacy.h    |  40 ---<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_new.c   |  76 ------<br>
 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_new.h   |  40 ---<br>
 6 files changed, 239 insertions(+), 453 deletions(-)<br>
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_legacy.c<br>
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_legacy.h<br>
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_new.c<br>
 delete mode 100644 drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_new.h<br>
<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile b/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile<br>
index 9446dbc475..faf9c88 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/Makefile<br>
@@ -31,9 +31,9 @@ HARDWARE_MGR = hwmgr.o processpptables.o \<br>
                 smu7_clockpowergating.o \<br>
                 vega10_processpptables.o vega10_hwmgr.o vega10_powertune.o \<br>
                 vega10_thermal.o smu10_hwmgr.o pp_psm.o\<br>
-               pp_overdriver.o smu_helper.o pp_psm_legacy.o pp_psm_new.o \<br>
                 vega12_processpptables.o vega12_hwmgr.o \<br>
-               vega12_powertune.o vega12_thermal.o<br>
+               vega12_powertune.o vega12_thermal.o \<br>
+               pp_overdriver.o smu_helper.o<br>
 <br>
 AMD_PP_HWMGR = $(addprefix $(AMD_PP_PATH)/hwmgr/,$(HARDWARE_MGR))<br>
 <br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c<br>
index 295ab9f..0f2851b 100644<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c<br>
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm.c<br>
@@ -21,65 +21,269 @@<br>
  *<br>
  */<br>
 <br>
+#include <linux/types.h><br>
+#include <linux/kernel.h><br>
+#include <linux/slab.h><br>
 #include "pp_psm.h"<br>
-#include "pp_psm_legacy.h"<br>
-#include "pp_psm_new.h"<br>
 <br>
 int psm_init_power_state_table(struct pp_hwmgr *hwmgr)<br>
 {<br>
-       if (hwmgr->chip_id != CHIP_VEGA12)<br>
-               return psm_legacy_init_power_state_table(hwmgr);<br>
-       else<br>
-               return psm_new_init_power_state_table(hwmgr);<br>
+       int result;<br>
+       unsigned int i;<br>
+       unsigned int table_entries;<br>
+       struct pp_power_state *state;<br>
+       int size;<br>
+<br>
+       if (hwmgr->hwmgr_func->get_num_of_pp_table_entries == NULL)<br>
+               return 0;<br>
+<br>
+       if (hwmgr->hwmgr_func->get_power_state_size == NULL)<br>
+               return 0;<br>
+<br>
+       hwmgr->num_ps = table_entries = hwmgr->hwmgr_func->get_num_of_pp_table_entries(hwmgr);<br>
+<br>
+       hwmgr->ps_size = size = hwmgr->hwmgr_func->get_power_state_size(hwmgr) +<br>
+                                         sizeof(struct pp_power_state);<br>
+<br>
+       if (table_entries == 0 || size == 0) {<br>
+               pr_warn("Please check whether power state management is suppported on this asic\n");<br>
+               return 0;<br>
+       }<br>
+<br>
+       hwmgr->ps = kzalloc(size * table_entries, GFP_KERNEL);<br>
+       if (hwmgr->ps == NULL)<br>
+               return -ENOMEM;<br>
+<br>
+       hwmgr->request_ps = kzalloc(size, GFP_KERNEL);<br>
+       if (hwmgr->request_ps == NULL) {<br>
+               kfree(hwmgr->ps);<br>
+               hwmgr->ps = NULL;<br>
+               return -ENOMEM;<br>
+       }<br>
+<br>
+       hwmgr->current_ps = kzalloc(size, GFP_KERNEL);<br>
+       if (hwmgr->current_ps == NULL) {<br>
+               kfree(hwmgr->request_ps);<br>
+               kfree(hwmgr->ps);<br>
+               hwmgr->request_ps = NULL;<br>
+               hwmgr->ps = NULL;<br>
+               return -ENOMEM;<br>
+       }<br>
+<br>
+       state = hwmgr->ps;<br>
+<br>
+       for (i = 0; i < table_entries; i++) {<br>
+               result = hwmgr->hwmgr_func->get_pp_table_entry(hwmgr, i, state);<br>
+<br>
+               if (state->classification.flags & PP_StateClassificationFlag_Boot) {<br>
+                       hwmgr->boot_ps = state;<br>
+                       memcpy(hwmgr->current_ps, state, size);<br>
+                       memcpy(hwmgr->request_ps, state, size);<br>
+               }<br>
+<br>
+               state->id = i + 1; /* assigned unique num for every power state id */<br>
+<br>
+               if (state->classification.flags & PP_StateClassificationFlag_Uvd)<br>
+                       hwmgr->uvd_ps = state;<br>
+               state = (struct pp_power_state *)((unsigned long)state + size);<br>
+       }<br>
+<br>
+       return 0;<br>
 }<br>
 <br>
 int psm_fini_power_state_table(struct pp_hwmgr *hwmgr)<br>
 {<br>
-       if (hwmgr->chip_id != CHIP_VEGA12)<br>
-               return psm_legacy_fini_power_state_table(hwmgr);<br>
-       else<br>
-               return psm_new_fini_power_state_table(hwmgr);<br>
+       if (hwmgr == NULL)<br>
+               return -EINVAL;<br>
+<br>
+       if (!hwmgr->ps)<br>
+               return 0;<br>
+<br>
+       kfree(hwmgr->current_ps);<br>
+       kfree(hwmgr->request_ps);<br>
+       kfree(hwmgr->ps);<br>
+       hwmgr->request_ps = NULL;<br>
+       hwmgr->ps = NULL;<br>
+       hwmgr->current_ps = NULL;<br>
+       return 0;<br>
+}<br>
+<br>
+static int psm_get_ui_state(struct pp_hwmgr *hwmgr,<br>
+                               enum PP_StateUILabel ui_label,<br>
+                               unsigned long *state_id)<br>
+{<br>
+       struct pp_power_state *state;<br>
+       int table_entries;<br>
+       int i;<br>
+<br>
+       table_entries = hwmgr->num_ps;<br>
+       state = hwmgr->ps;<br>
+<br>
+       for (i = 0; i < table_entries; i++) {<br>
+               if (state->classification.ui_label & ui_label) {<br>
+                       *state_id = state->id;<br>
+                       return 0;<br>
+               }<br>
+               state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size);<br>
+       }<br>
+       return -EINVAL;<br>
+}<br>
+<br>
+static int psm_get_state_by_classification(struct pp_hwmgr *hwmgr,<br>
+                                       enum PP_StateClassificationFlag flag,<br>
+                                       unsigned long *state_id)<br>
+{<br>
+       struct pp_power_state *state;<br>
+       int table_entries;<br>
+       int i;<br>
+<br>
+       table_entries = hwmgr->num_ps;<br>
+       state = hwmgr->ps;<br>
+<br>
+       for (i = 0; i < table_entries; i++) {<br>
+               if (state->classification.flags & flag) {<br>
+                       *state_id = state->id;<br>
+                       return 0;<br>
+               }<br>
+               state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size);<br>
+       }<br>
+       return -EINVAL;<br>
+}<br>
+<br>
+static int psm_set_states(struct pp_hwmgr *hwmgr, unsigned long state_id)<br>
+{<br>
+       struct pp_power_state *state;<br>
+       int table_entries;<br>
+       int i;<br>
+<br>
+       table_entries = hwmgr->num_ps;<br>
+<br>
+       state = hwmgr->ps;<br>
+<br>
+       for (i = 0; i < table_entries; i++) {<br>
+               if (state->id == state_id) {<br>
+                       memcpy(hwmgr->request_ps, state, hwmgr->ps_size);<br>
+                       return 0;<br>
+               }<br>
+               state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size);<br>
+       }<br>
+       return -EINVAL;<br>
 }<br>
 <br>
 int psm_set_boot_states(struct pp_hwmgr *hwmgr)<br>
 {<br>
-       if (hwmgr->chip_id != CHIP_VEGA12)<br>
-               return psm_legacy_set_boot_states(hwmgr);<br>
-       else<br>
-               return psm_new_set_boot_states(hwmgr);<br>
+       unsigned long state_id;<br>
+       int ret = -EINVAL;<br>
+<br>
+       if (!hwmgr->ps)<br>
+               return 0;<br>
+<br>
+       if (!psm_get_state_by_classification(hwmgr, PP_StateClassificationFlag_Boot,<br>
+                                       &state_id))<br>
+               ret = psm_set_states(hwmgr, state_id);<br>
+<br>
+       return ret;<br>
 }<br>
 <br>
 int psm_set_performance_states(struct pp_hwmgr *hwmgr)<br>
 {<br>
-       if (hwmgr->chip_id != CHIP_VEGA12)<br>
-               return psm_legacy_set_performance_states(hwmgr);<br>
-       else<br>
-               return psm_new_set_performance_states(hwmgr);<br>
+       unsigned long state_id;<br>
+       int ret = -EINVAL;<br>
+<br>
+       if (!hwmgr->ps)<br>
+               return 0;<br>
+<br>
+       if (!psm_get_ui_state(hwmgr, PP_StateUILabel_Performance,<br>
+                                       &state_id))<br>
+               ret = psm_set_states(hwmgr, state_id);<br>
+<br>
+       return ret;<br>
 }<br>
 <br>
 int psm_set_user_performance_state(struct pp_hwmgr *hwmgr,<br>
                                         enum PP_StateUILabel label_id,<br>
                                         struct pp_power_state **state)<br>
 {<br>
-       if (hwmgr->chip_id != CHIP_VEGA12)<br>
-               return psm_legacy_set_user_performance_state(hwmgr,<br>
-                               label_id,<br>
-                               state);<br>
+       int table_entries;<br>
+       int i;<br>
+<br>
+       if (!hwmgr->ps)<br>
+               return 0;<br>
+<br>
+       table_entries = hwmgr->num_ps;<br>
+       *state = hwmgr->ps;<br>
+<br>
+restart_search:<br>
+       for (i = 0; i < table_entries; i++) {<br>
+               if ((*state)->classification.ui_label & label_id)<br>
+                       return 0;<br>
+               *state = (struct pp_power_state *)((uintptr_t)*state + hwmgr->ps_size);<br>
+       }<br>
+<br>
+       switch (label_id) {<br>
+       case PP_StateUILabel_Battery:<br>
+       case PP_StateUILabel_Balanced:<br>
+               label_id = PP_StateUILabel_Performance;<br>
+               goto restart_search;<br>
+       default:<br>
+               break;<br>
+       }<br>
+       return -EINVAL;<br>
+}<br>
+<br>
+static void power_state_management(struct pp_hwmgr *hwmgr,<br>
+                                               struct pp_power_state *new_ps)<br>
+{<br>
+       struct pp_power_state *pcurrent;<br>
+       struct pp_power_state *requested;<br>
+       bool equal;<br>
+<br>
+       if (new_ps != NULL)<br>
+               requested = new_ps;<br>
         else<br>
-               return psm_new_set_user_performance_state(hwmgr,<br>
-                               label_id,<br>
-                               state);<br>
+               requested = hwmgr->request_ps;<br>
+<br>
+       pcurrent = hwmgr->current_ps;<br>
+<br>
+       phm_apply_state_adjust_rules(hwmgr, requested, pcurrent);<br>
+       if (pcurrent == NULL || (0 != phm_check_states_equal(hwmgr,<br>
+                       &pcurrent->hardware, &requested->hardware, &equal)))<br>
+               equal = false;<br>
+<br>
+       if (!equal || phm_check_smc_update_required_for_display_configuration(hwmgr)) {<br>
+               phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware);<br>
+               memcpy(hwmgr->current_ps, hwmgr->request_ps, hwmgr->ps_size);<br>
+       }<br>
 }<br>
 <br>
 int psm_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip,<br>
                                                 struct pp_power_state *new_ps)<br>
 {<br>
-       if (hwmgr->chip_id != CHIP_VEGA12)<br>
-               return psm_legacy_adjust_power_state_dynamic(hwmgr,<br>
-                               skip,<br>
-                               new_ps);<br>
-       else<br>
-               return psm_new_adjust_power_state_dynamic(hwmgr,<br>
-                               skip,<br>
-                               new_ps);<br>
+       uint32_t index;<br>
+       long workload;<br>
+<br>
+       if (skip)<br>
+               return 0;<br>
+<br>
+       phm_display_configuration_changed(hwmgr);<br>
+<br>
+       if (hwmgr->ps)<br>
+               power_state_management(hwmgr, new_ps);<br>
+<br>
+       phm_notify_smc_display_config_after_ps_adjustment(hwmgr);<br>
+<br>
+       if (!phm_force_dpm_levels(hwmgr, hwmgr->request_dpm_level))<br>
+               hwmgr->dpm_level = hwmgr->request_dpm_level;<br>
+<br>
+       if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) {<br>
+               index = fls(hwmgr->workload_mask);<br>
+               index = index > 0 && index <= Workload_Policy_Max ? index - 1 : 0;<br>
+               workload = hwmgr->workload_setting[index];<br>
+<br>
+               if (hwmgr->power_profile_mode != workload && hwmgr->hwmgr_func->set_power_profile_mode)<br>
+                       hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, &workload, 0);<br>
+       }<br>
+<br>
+       return 0;<br>
 }<br>
+<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_legacy.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_legacy.c<br>
deleted file mode 100644<br>
index e3ac52820..0000000<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_legacy.c<br>
+++ /dev/null<br>
@@ -1,262 +0,0 @@<br>
-/*<br>
- * Copyright 2017 Advanced Micro Devices, Inc.<br>
- *<br>
- * Permission is hereby granted, free of charge, to any person obtaining a<br>
- * copy of this software and associated documentation files (the "Software"),<br>
- * to deal in the Software without restriction, including without limitation<br>
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
- * and/or sell copies of the Software, and to permit persons to whom the<br>
- * Software is furnished to do so, subject to the following conditions:<br>
- *<br>
- * The above copyright notice and this permission notice shall be included in<br>
- * all copies or substantial portions of the Software.<br>
- *<br>
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR<br>
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR<br>
- * OTHER DEALINGS IN THE SOFTWARE.<br>
- *<br>
- */<br>
-<br>
-#include <linux/types.h><br>
-#include <linux/kernel.h><br>
-#include <linux/slab.h><br>
-#include "pp_psm_legacy.h"<br>
-<br>
-int psm_legacy_init_power_state_table(struct pp_hwmgr *hwmgr)<br>
-{<br>
-       int result;<br>
-       unsigned int i;<br>
-       unsigned int table_entries;<br>
-       struct pp_power_state *state;<br>
-       int size;<br>
-<br>
-       if (hwmgr->hwmgr_func->get_num_of_pp_table_entries == NULL)<br>
-               return -EINVAL;<br>
-<br>
-       if (hwmgr->hwmgr_func->get_power_state_size == NULL)<br>
-               return -EINVAL;<br>
-<br>
-       hwmgr->num_ps = table_entries = hwmgr->hwmgr_func->get_num_of_pp_table_entries(hwmgr);<br>
-<br>
-       hwmgr->ps_size = size = hwmgr->hwmgr_func->get_power_state_size(hwmgr) +<br>
-                                         sizeof(struct pp_power_state);<br>
-<br>
-       hwmgr->ps = kzalloc(size * table_entries, GFP_KERNEL);<br>
-       if (hwmgr->ps == NULL)<br>
-               return -ENOMEM;<br>
-<br>
-       hwmgr->request_ps = kzalloc(size, GFP_KERNEL);<br>
-       if (hwmgr->request_ps == NULL) {<br>
-               kfree(hwmgr->ps);<br>
-               hwmgr->ps = NULL;<br>
-               return -ENOMEM;<br>
-       }<br>
-<br>
-       hwmgr->current_ps = kzalloc(size, GFP_KERNEL);<br>
-       if (hwmgr->current_ps == NULL) {<br>
-               kfree(hwmgr->request_ps);<br>
-               kfree(hwmgr->ps);<br>
-               hwmgr->request_ps = NULL;<br>
-               hwmgr->ps = NULL;<br>
-               return -ENOMEM;<br>
-       }<br>
-<br>
-       state = hwmgr->ps;<br>
-<br>
-       for (i = 0; i < table_entries; i++) {<br>
-               result = hwmgr->hwmgr_func->get_pp_table_entry(hwmgr, i, state);<br>
-<br>
-               if (state->classification.flags & PP_StateClassificationFlag_Boot) {<br>
-                       hwmgr->boot_ps = state;<br>
-                       memcpy(hwmgr->current_ps, state, size);<br>
-                       memcpy(hwmgr->request_ps, state, size);<br>
-               }<br>
-<br>
-               state->id = i + 1; /* assigned unique num for every power state id */<br>
-<br>
-               if (state->classification.flags & PP_StateClassificationFlag_Uvd)<br>
-                       hwmgr->uvd_ps = state;<br>
-               state = (struct pp_power_state *)((unsigned long)state + size);<br>
-       }<br>
-<br>
-       return 0;<br>
-}<br>
-<br>
-int psm_legacy_fini_power_state_table(struct pp_hwmgr *hwmgr)<br>
-{<br>
-       if (hwmgr == NULL)<br>
-               return -EINVAL;<br>
-<br>
-       kfree(hwmgr->current_ps);<br>
-       kfree(hwmgr->request_ps);<br>
-       kfree(hwmgr->ps);<br>
-       hwmgr->request_ps = NULL;<br>
-       hwmgr->ps = NULL;<br>
-       hwmgr->current_ps = NULL;<br>
-       return 0;<br>
-}<br>
-<br>
-static int get_ui_state(struct pp_hwmgr *hwmgr,<br>
-                               enum PP_StateUILabel ui_label,<br>
-                               unsigned long *state_id)<br>
-{<br>
-       struct pp_power_state *state;<br>
-       int table_entries;<br>
-       int i;<br>
-<br>
-       table_entries = hwmgr->num_ps;<br>
-       state = hwmgr->ps;<br>
-<br>
-       for (i = 0; i < table_entries; i++) {<br>
-               if (state->classification.ui_label & ui_label) {<br>
-                       *state_id = state->id;<br>
-                       return 0;<br>
-               }<br>
-               state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size);<br>
-       }<br>
-       return -EINVAL;<br>
-}<br>
-<br>
-static int get_state_by_classification(struct pp_hwmgr *hwmgr,<br>
-                                       enum PP_StateClassificationFlag flag,<br>
-                                       unsigned long *state_id)<br>
-{<br>
-       struct pp_power_state *state;<br>
-       int table_entries;<br>
-       int i;<br>
-<br>
-       table_entries = hwmgr->num_ps;<br>
-       state = hwmgr->ps;<br>
-<br>
-       for (i = 0; i < table_entries; i++) {<br>
-               if (state->classification.flags & flag) {<br>
-                       *state_id = state->id;<br>
-                       return 0;<br>
-               }<br>
-               state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size);<br>
-       }<br>
-       return -EINVAL;<br>
-}<br>
-<br>
-static int set_states(struct pp_hwmgr *hwmgr, unsigned long state_id)<br>
-{<br>
-       struct pp_power_state *state;<br>
-       int table_entries;<br>
-       int i;<br>
-<br>
-       table_entries = hwmgr->num_ps;<br>
-<br>
-       state = hwmgr->ps;<br>
-<br>
-       for (i = 0; i < table_entries; i++) {<br>
-               if (state->id == state_id) {<br>
-                       memcpy(hwmgr->request_ps, state, hwmgr->ps_size);<br>
-                       return 0;<br>
-               }<br>
-               state = (struct pp_power_state *)((unsigned long)state + hwmgr->ps_size);<br>
-       }<br>
-       return -EINVAL;<br>
-}<br>
-<br>
-int psm_legacy_set_boot_states(struct pp_hwmgr *hwmgr)<br>
-{<br>
-       unsigned long state_id;<br>
-       int ret = -EINVAL;<br>
-<br>
-       if (!get_state_by_classification(hwmgr, PP_StateClassificationFlag_Boot,<br>
-                                       &state_id))<br>
-               ret = set_states(hwmgr, state_id);<br>
-<br>
-       return ret;<br>
-}<br>
-<br>
-int psm_legacy_set_performance_states(struct pp_hwmgr *hwmgr)<br>
-{<br>
-       unsigned long state_id;<br>
-       int ret = -EINVAL;<br>
-<br>
-       if (!get_ui_state(hwmgr, PP_StateUILabel_Performance,<br>
-                                       &state_id))<br>
-               ret = set_states(hwmgr, state_id);<br>
-<br>
-       return ret;<br>
-}<br>
-<br>
-int psm_legacy_set_user_performance_state(struct pp_hwmgr *hwmgr,<br>
-                                       enum PP_StateUILabel label_id,<br>
-                                       struct pp_power_state **state)<br>
-{<br>
-       int table_entries;<br>
-       int i;<br>
-<br>
-       table_entries = hwmgr->num_ps;<br>
-       *state = hwmgr->ps;<br>
-<br>
-restart_search:<br>
-       for (i = 0; i < table_entries; i++) {<br>
-               if ((*state)->classification.ui_label & label_id)<br>
-                       return 0;<br>
-               *state = (struct pp_power_state *)((uintptr_t)*state + hwmgr->ps_size);<br>
-       }<br>
-<br>
-       switch (label_id) {<br>
-       case PP_StateUILabel_Battery:<br>
-       case PP_StateUILabel_Balanced:<br>
-               label_id = PP_StateUILabel_Performance;<br>
-               goto restart_search;<br>
-       default:<br>
-               break;<br>
-       }<br>
-       return -EINVAL;<br>
-}<br>
-<br>
-int psm_legacy_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr, bool skip,<br>
-                                               struct pp_power_state *new_ps)<br>
-{<br>
-       struct pp_power_state *pcurrent;<br>
-       struct pp_power_state *requested;<br>
-       bool equal;<br>
-       uint32_t index;<br>
-       long workload;<br>
-<br>
-       if (skip)<br>
-               return 0;<br>
-<br>
-       phm_display_configuration_changed(hwmgr);<br>
-<br>
-       if (new_ps != NULL)<br>
-               requested = new_ps;<br>
-       else<br>
-               requested = hwmgr->request_ps;<br>
-<br>
-       pcurrent = hwmgr->current_ps;<br>
-<br>
-       phm_apply_state_adjust_rules(hwmgr, requested, pcurrent);<br>
-       if (pcurrent == NULL || (0 != phm_check_states_equal(hwmgr,<br>
-                       &pcurrent->hardware, &requested->hardware, &equal)))<br>
-               equal = false;<br>
-<br>
-       if (!equal || phm_check_smc_update_required_for_display_configuration(hwmgr)) {<br>
-               phm_set_power_state(hwmgr, &pcurrent->hardware, &requested->hardware);<br>
-               memcpy(hwmgr->current_ps, hwmgr->request_ps, hwmgr->ps_size);<br>
-       }<br>
-<br>
-       phm_notify_smc_display_config_after_ps_adjustment(hwmgr);<br>
-       if (!phm_force_dpm_levels(hwmgr, hwmgr->request_dpm_level))<br>
-               hwmgr->dpm_level = hwmgr->request_dpm_level;<br>
-<br>
-       if (hwmgr->dpm_level != AMD_DPM_FORCED_LEVEL_MANUAL) {<br>
-               index = fls(hwmgr->workload_mask);<br>
-               index = index > 0 && index <= Workload_Policy_Max ? index - 1 : 0;<br>
-               workload = hwmgr->workload_setting[index];<br>
-<br>
-               if (hwmgr->power_profile_mode != workload && hwmgr->hwmgr_func->set_power_profile_mode)<br>
-                       hwmgr->hwmgr_func->set_power_profile_mode(hwmgr, &workload, 0);<br>
-       }<br>
-<br>
-       return 0;<br>
-}<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_legacy.h b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_legacy.h<br>
deleted file mode 100644<br>
index bc99411..0000000<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_legacy.h<br>
+++ /dev/null<br>
@@ -1,40 +0,0 @@<br>
-/*<br>
- * Copyright 2017 Advanced Micro Devices, Inc.<br>
- *<br>
- * Permission is hereby granted, free of charge, to any person obtaining a<br>
- * copy of this software and associated documentation files (the "Software"),<br>
- * to deal in the Software without restriction, including without limitation<br>
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
- * and/or sell copies of the Software, and to permit persons to whom the<br>
- * Software is furnished to do so, subject to the following conditions:<br>
- *<br>
- * The above copyright notice and this permission notice shall be included in<br>
- * all copies or substantial portions of the Software.<br>
- *<br>
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR<br>
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR<br>
- * OTHER DEALINGS IN THE SOFTWARE.<br>
- *<br>
- */<br>
-<br>
-#ifndef PP_PSM_LEGACY_H<br>
-#define PP_PSM_LEGACY_H<br>
-<br>
-#include "hwmgr.h"<br>
-<br>
-int psm_legacy_init_power_state_table(struct pp_hwmgr *hwmgr);<br>
-int psm_legacy_fini_power_state_table(struct pp_hwmgr *hwmgr);<br>
-int psm_legacy_set_boot_states(struct pp_hwmgr *hwmgr);<br>
-int psm_legacy_set_performance_states(struct pp_hwmgr *hwmgr);<br>
-int psm_legacy_set_user_performance_state(struct pp_hwmgr *hwmgr,<br>
-                                       enum PP_StateUILabel label_id,<br>
-                                       struct pp_power_state **state);<br>
-int psm_legacy_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr,<br>
-                               bool skip,<br>
-                               struct pp_power_state *new_ps);<br>
-<br>
-#endif<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_new.c b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_new.c<br>
deleted file mode 100644<br>
index 9eba8a1..0000000<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_new.c<br>
+++ /dev/null<br>
@@ -1,76 +0,0 @@<br>
-/*<br>
- * Copyright 2017 Advanced Micro Devices, Inc.<br>
- *<br>
- * Permission is hereby granted, free of charge, to any person obtaining a<br>
- * copy of this software and associated documentation files (the "Software"),<br>
- * to deal in the Software without restriction, including without limitation<br>
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
- * and/or sell copies of the Software, and to permit persons to whom the<br>
- * Software is furnished to do so, subject to the following conditions:<br>
- *<br>
- * The above copyright notice and this permission notice shall be included in<br>
- * all copies or substantial portions of the Software.<br>
- *<br>
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR<br>
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR<br>
- * OTHER DEALINGS IN THE SOFTWARE.<br>
- *<br>
- */<br>
-<br>
-#include <linux/types.h><br>
-#include <linux/kernel.h><br>
-#include <linux/slab.h><br>
-#include "pp_psm_new.h"<br>
-<br>
-int psm_new_init_power_state_table(struct pp_hwmgr *hwmgr)<br>
-{<br>
-       hwmgr->ps_size = 0;<br>
-       hwmgr->num_ps = 0;<br>
-       hwmgr->ps = NULL;<br>
-       hwmgr->request_ps = NULL;<br>
-       hwmgr->current_ps = NULL;<br>
-       hwmgr->boot_ps = NULL;<br>
-       hwmgr->uvd_ps = NULL;<br>
-<br>
-       return 0;<br>
-}<br>
-<br>
-int psm_new_fini_power_state_table(struct pp_hwmgr *hwmgr)<br>
-{<br>
-       return 0;<br>
-}<br>
-<br>
-int psm_new_set_boot_states(struct pp_hwmgr *hwmgr)<br>
-{<br>
-       return 0;<br>
-}<br>
-<br>
-int psm_new_set_performance_states(struct pp_hwmgr *hwmgr)<br>
-{<br>
-       return 0;<br>
-}<br>
-<br>
-int psm_new_set_user_performance_state(struct pp_hwmgr *hwmgr,<br>
-                                       enum PP_StateUILabel label_id,<br>
-                                       struct pp_power_state **state)<br>
-{<br>
-       return 0;<br>
-}<br>
-<br>
-int psm_new_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr,<br>
-                                       bool skip,<br>
-                                       struct pp_power_state *new_ps)<br>
-{<br>
-       if (skip)<br>
-               return 0;<br>
-<br>
-       phm_display_configuration_changed(hwmgr);<br>
-<br>
-       phm_notify_smc_display_config_after_ps_adjustment(hwmgr);<br>
-<br>
-       return 0;<br>
-}<br>
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_new.h b/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_new.h<br>
deleted file mode 100644<br>
index 5c4fabc..0000000<br>
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/pp_psm_new.h<br>
+++ /dev/null<br>
@@ -1,40 +0,0 @@<br>
-/*<br>
- * Copyright 2017 Advanced Micro Devices, Inc.<br>
- *<br>
- * Permission is hereby granted, free of charge, to any person obtaining a<br>
- * copy of this software and associated documentation files (the "Software"),<br>
- * to deal in the Software without restriction, including without limitation<br>
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
- * and/or sell copies of the Software, and to permit persons to whom the<br>
- * Software is furnished to do so, subject to the following conditions:<br>
- *<br>
- * The above copyright notice and this permission notice shall be included in<br>
- * all copies or substantial portions of the Software.<br>
- *<br>
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
- * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR<br>
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,<br>
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR<br>
- * OTHER DEALINGS IN THE SOFTWARE.<br>
- *<br>
- */<br>
-<br>
-#ifndef PP_PSM_NEW_H<br>
-#define PP_PSM_NEW_H<br>
-<br>
-#include "hwmgr.h"<br>
-<br>
-int psm_new_init_power_state_table(struct pp_hwmgr *hwmgr);<br>
-int psm_new_fini_power_state_table(struct pp_hwmgr *hwmgr);<br>
-int psm_new_set_boot_states(struct pp_hwmgr *hwmgr);<br>
-int psm_new_set_performance_states(struct pp_hwmgr *hwmgr);<br>
-int psm_new_set_user_performance_state(struct pp_hwmgr *hwmgr,<br>
-                                       enum PP_StateUILabel label_id,<br>
-                                       struct pp_power_state **state);<br>
-int psm_new_adjust_power_state_dynamic(struct pp_hwmgr *hwmgr,<br>
-                               bool skip,<br>
-                               struct pp_power_state *new_ps);<br>
-<br>
-#endif<br>
-- <br>
1.9.1<br>
<br>
_______________________________________________<br>
amd-gfx mailing list<br>
amd-gfx@lists.freedesktop.org<br>
<a href="https://lists.freedesktop.org/mailman/listinfo/amd-gfx">https://lists.freedesktop.org/mailman/listinfo/amd-gfx</a><br>
</div>
</span></font></div>
</body>
</html>