drm/amd/powerplay: add smu display configuration change function
authorHuang Rui <ray.huang@amd.com>
Fri, 11 Jan 2019 08:23:36 +0000 (16:23 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Mar 2019 20:03:58 +0000 (15:03 -0500)
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>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h

index 25cd8a12884685e4ddd4a389e5b8b6c9b22b3c87..fa3eabc1595fd26fffeab66e58ed8720044cca6f 100644 (file)
@@ -33,6 +33,7 @@
 #include "amdgpu_dm_irq.h"
 #include "amdgpu_pm.h"
 #include "dm_pp_smu.h"
+#include "amdgpu_smu.h"
 
 
 bool dm_pp_apply_display_requirements(
@@ -40,6 +41,7 @@ bool dm_pp_apply_display_requirements(
                const struct dm_pp_display_configuration *pp_display_cfg)
 {
        struct amdgpu_device *adev = ctx->driver_context;
+       struct smu_context *smu = &adev->smu;
        int i;
 
        if (adev->pm.dpm_enabled) {
@@ -105,6 +107,9 @@ bool dm_pp_apply_display_requirements(
                        adev->powerplay.pp_funcs->display_configuration_change(
                                adev->powerplay.pp_handle,
                                &adev->pm.pm_display_cfg);
+               else
+                       smu_display_configuration_change(smu,
+                                                        &adev->pm.pm_display_cfg);
 
                amdgpu_pm_compute_clocks(adev);
        }
index dc431f2eebe1bf94d49e276c17a65df5c97971ba..cf8739f262c8e25d1bb1cdeeb3892ef61e1c2eea 100644 (file)
@@ -780,6 +780,40 @@ failed:
        return ret;
 }
 
+int smu_display_configuration_change(struct smu_context *smu,
+                                    const struct amd_pp_display_configuration *display_config)
+{
+       int index = 0;
+       int num_of_active_display = 0;
+
+       if (!is_support_sw_smu(smu->adev))
+               return -EINVAL;
+
+       if (!display_config)
+               return -EINVAL;
+
+       mutex_lock(&smu->mutex);
+
+       smu_set_deep_sleep_dcefclk(smu,
+                                  display_config->min_dcef_deep_sleep_set_clk / 100);
+
+       for (index = 0; index < display_config->num_path_including_non_display; index++) {
+               if (display_config->displays[index].controller_id != 0)
+                       num_of_active_display++;
+       }
+
+       smu_set_active_display_count(smu, num_of_active_display);
+
+       smu_store_cc6_data(smu, display_config->cpu_pstate_separation_time,
+                          display_config->cpu_cc6_disable,
+                          display_config->cpu_pstate_disable,
+                          display_config->nb_pstate_switch_disable);
+
+       mutex_unlock(&smu->mutex);
+
+       return 0;
+}
+
 static int smu_set_clockgating_state(void *handle,
                                     enum amd_clockgating_state state)
 {
index 7d8f15c89d6ca583bd17764476b349e97a88fb47..144f7065b12993e84e5d3a7d74c1b1d7111eadcb 100644 (file)
@@ -24,6 +24,7 @@
 
 #include "amdgpu.h"
 #include "kgd_pp_interface.h"
+#include "dm_pp_interface.h"
 
 enum smu_message_type
 {
@@ -395,4 +396,9 @@ int smu_sys_set_pp_table(struct smu_context *smu,  void *buf, size_t size);
 int smu_get_power_num_states(struct smu_context *smu, struct pp_states_info *state_info);
 enum amd_pm_state_type smu_get_current_power_state(struct smu_context *smu);
 
+/* smu to display interface */
+extern int smu_display_configuration_change(struct smu_context *smu, const
+                                           struct amd_pp_display_configuration
+                                           *display_config);
+
 #endif