aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd
diff options
context:
space:
mode:
authorhersen wu <hersenxs.wu@amd.com>2019-05-30 00:30:32 -0400
committerAlex Deucher <alexander.deucher@amd.com>2019-06-21 19:59:31 -0400
commit2e13c7551ca03dac449c0d55a08a0459d876ea11 (patch)
tree22507e100053dd3219f2135632bef7806534a318 /drivers/gpu/drm/amd
parent382fb77891b6f9b067fc801cc63503d0d1d07dfb (diff)
drm/amd/powerplay: notify smu with active display count
when dc update clocks via smu, smu needs to know how many displays active. this interface is for dc notify number of active displays to smu. Signed-off-by: hersen wu <hersenxs.wu@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>
Diffstat (limited to 'drivers/gpu/drm/amd')
-rw-r--r--drivers/gpu/drm/amd/powerplay/amdgpu_smu.c13
-rw-r--r--drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h8
-rw-r--r--drivers/gpu/drm/amd/powerplay/smu_v11_0.c6
3 files changed, 20 insertions, 7 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 4d7aeee91bc8..41e9a7ed8680 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -802,7 +802,7 @@ static int smu_smc_table_hw_init(struct smu_context *smu,
802 return 0; 802 return 0;
803 } 803 }
804 804
805 ret = smu_init_display(smu); 805 ret = smu_init_display_count(smu, 0);
806 if (ret) 806 if (ret)
807 return ret; 807 return ret;
808 808
@@ -1470,6 +1470,17 @@ int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_lev
1470 return ret; 1470 return ret;
1471} 1471}
1472 1472
1473int smu_set_display_count(struct smu_context *smu, uint32_t count)
1474{
1475 int ret = 0;
1476
1477 mutex_lock(&smu->mutex);
1478 ret = smu_init_display_count(smu, count);
1479 mutex_unlock(&smu->mutex);
1480
1481 return ret;
1482}
1483
1473const struct amd_ip_funcs smu_ip_funcs = { 1484const struct amd_ip_funcs smu_ip_funcs = {
1474 .name = "smu", 1485 .name = "smu",
1475 .early_init = smu_early_init, 1486 .early_init = smu_early_init,
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index 58861c0340b9..267c4f6eb317 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -638,7 +638,7 @@ struct smu_funcs
638 int (*send_smc_msg)(struct smu_context *smu, uint16_t msg); 638 int (*send_smc_msg)(struct smu_context *smu, uint16_t msg);
639 int (*send_smc_msg_with_param)(struct smu_context *smu, uint16_t msg, uint32_t param); 639 int (*send_smc_msg_with_param)(struct smu_context *smu, uint16_t msg, uint32_t param);
640 int (*read_smc_arg)(struct smu_context *smu, uint32_t *arg); 640 int (*read_smc_arg)(struct smu_context *smu, uint32_t *arg);
641 int (*init_display)(struct smu_context *smu); 641 int (*init_display_count)(struct smu_context *smu, uint32_t count);
642 int (*set_allowed_mask)(struct smu_context *smu); 642 int (*set_allowed_mask)(struct smu_context *smu);
643 int (*get_enabled_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num); 643 int (*get_enabled_mask)(struct smu_context *smu, uint32_t *feature_mask, uint32_t num);
644 int (*update_feature_enable_state)(struct smu_context *smu, uint32_t feature_id, bool enabled); 644 int (*update_feature_enable_state)(struct smu_context *smu, uint32_t feature_id, bool enabled);
@@ -752,8 +752,8 @@ struct smu_funcs
752 ((smu)->funcs->read_smc_arg? (smu)->funcs->read_smc_arg((smu), (arg)) : 0) 752 ((smu)->funcs->read_smc_arg? (smu)->funcs->read_smc_arg((smu), (arg)) : 0)
753#define smu_alloc_dpm_context(smu) \ 753#define smu_alloc_dpm_context(smu) \
754 ((smu)->ppt_funcs->alloc_dpm_context ? (smu)->ppt_funcs->alloc_dpm_context((smu)) : 0) 754 ((smu)->ppt_funcs->alloc_dpm_context ? (smu)->ppt_funcs->alloc_dpm_context((smu)) : 0)
755#define smu_init_display(smu) \ 755#define smu_init_display_count(smu, count) \
756 ((smu)->funcs->init_display ? (smu)->funcs->init_display((smu)) : 0) 756 ((smu)->funcs->init_display_count ? (smu)->funcs->init_display_count((smu), (count)) : 0)
757#define smu_feature_set_allowed_mask(smu) \ 757#define smu_feature_set_allowed_mask(smu) \
758 ((smu)->funcs->set_allowed_mask? (smu)->funcs->set_allowed_mask((smu)) : 0) 758 ((smu)->funcs->set_allowed_mask? (smu)->funcs->set_allowed_mask((smu)) : 0)
759#define smu_feature_get_enabled_mask(smu, mask, num) \ 759#define smu_feature_get_enabled_mask(smu, mask, num) \
@@ -947,4 +947,6 @@ int smu_set_hard_freq_range(struct smu_context *smu, enum smu_clk_type clk_type,
947 uint32_t min, uint32_t max); 947 uint32_t min, uint32_t max);
948enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu); 948enum amd_dpm_forced_level smu_get_performance_level(struct smu_context *smu);
949int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level); 949int smu_force_performance_level(struct smu_context *smu, enum amd_dpm_forced_level level);
950int smu_set_display_count(struct smu_context *smu, uint32_t count);
951
950#endif 952#endif
diff --git a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
index bab61fe46b46..82e6076bbdb0 100644
--- a/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
+++ b/drivers/gpu/drm/amd/powerplay/smu_v11_0.c
@@ -765,13 +765,13 @@ static int smu_v11_0_set_tool_table_location(struct smu_context *smu)
765 return ret; 765 return ret;
766} 766}
767 767
768static int smu_v11_0_init_display(struct smu_context *smu) 768static int smu_v11_0_init_display_count(struct smu_context *smu, uint32_t count)
769{ 769{
770 int ret = 0; 770 int ret = 0;
771 771
772 if (!smu->pm_enabled) 772 if (!smu->pm_enabled)
773 return ret; 773 return ret;
774 ret = smu_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays, 0); 774 ret = smu_send_smc_msg_with_param(smu, SMU_MSG_NumOfDisplays, count);
775 return ret; 775 return ret;
776} 776}
777 777
@@ -1686,7 +1686,7 @@ static const struct smu_funcs smu_v11_0_funcs = {
1686 .write_watermarks_table = smu_v11_0_write_watermarks_table, 1686 .write_watermarks_table = smu_v11_0_write_watermarks_table,
1687 .set_min_dcef_deep_sleep = smu_v11_0_set_min_dcef_deep_sleep, 1687 .set_min_dcef_deep_sleep = smu_v11_0_set_min_dcef_deep_sleep,
1688 .set_tool_table_location = smu_v11_0_set_tool_table_location, 1688 .set_tool_table_location = smu_v11_0_set_tool_table_location,
1689 .init_display = smu_v11_0_init_display, 1689 .init_display_count = smu_v11_0_init_display_count,
1690 .set_allowed_mask = smu_v11_0_set_allowed_mask, 1690 .set_allowed_mask = smu_v11_0_set_allowed_mask,
1691 .get_enabled_mask = smu_v11_0_get_enabled_mask, 1691 .get_enabled_mask = smu_v11_0_get_enabled_mask,
1692 .system_features_control = smu_v11_0_system_features_control, 1692 .system_features_control = smu_v11_0_system_features_control,