Skip to content

Commit

Permalink
drm/amd/powerplay: add smu display configuration change function
Browse files Browse the repository at this point in the history
This patch adds display configuration change function that creates the new path
with sw smu driver instead of powerplay.

Signed-off-by: Huang Rui <[email protected]>
Reviewed-by: Evan Quan <[email protected]>
Reviewed-by: Kevin Wang <[email protected]>
Acked-by: Alex Deucher <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
  • Loading branch information
huangrui authored and alexdeucher committed Mar 19, 2019
1 parent 44dd54e commit 94ed6d0
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,15 @@
#include "amdgpu_dm_irq.h"
#include "amdgpu_pm.h"
#include "dm_pp_smu.h"
#include "amdgpu_smu.h"


bool dm_pp_apply_display_requirements(
const struct dc_context *ctx,
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) {
Expand Down Expand Up @@ -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);
}
Expand Down
34 changes: 34 additions & 0 deletions drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,40 @@ static int smu_resume(void *handle)
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)
{
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

#include "amdgpu.h"
#include "kgd_pp_interface.h"
#include "dm_pp_interface.h"

enum smu_message_type
{
Expand Down Expand Up @@ -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

0 comments on commit 94ed6d0

Please sign in to comment.