aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorKevin Wang <Kevin1.Wang@amd.com>2019-01-07 02:34:09 -0500
committerAlex Deucher <alexander.deucher@amd.com>2019-03-19 16:03:57 -0400
commitdbe6a97024a6eeadf7912383e05118ff98883d2d (patch)
tree0e14b1c45dfa5cd8107386c4be21350c9a3d57e0 /drivers/gpu/drm
parent74ba3553b2bb26adb36dd7d0b13b85bca64f3ef2 (diff)
drm/amd/powerplay: implement smu update table function
sometime, the driver need changed table data between driver and smu. this function can help update table data Signed-off-by: Kevin Wang <Kevin1.Wang@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')
-rw-r--r--drivers/gpu/drm/amd/powerplay/amdgpu_smu.c36
-rw-r--r--drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h3
2 files changed, 39 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index 172b84480d6c..56095a400731 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -29,6 +29,42 @@
29#include "smu_v11_0.h" 29#include "smu_v11_0.h"
30#include "atom.h" 30#include "atom.h"
31 31
32int smu_update_table(struct smu_context *smu, uint32_t table_id,
33 void *table_data, bool drv2smu)
34{
35 struct smu_table_context *smu_table = &smu->smu_table;
36 struct smu_table *table = NULL;
37 int ret = 0;
38
39 if (!table_data || table_id >= smu_table->table_count)
40 return -EINVAL;
41
42 table = &smu_table->tables[table_id];
43
44 if (drv2smu)
45 memcpy(table->cpu_addr, table_data, table->size);
46
47 ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetDriverDramAddrHigh,
48 upper_32_bits(table->mc_address));
49 if (ret)
50 return ret;
51 ret = smu_send_smc_msg_with_param(smu, SMU_MSG_SetDriverDramAddrLow,
52 lower_32_bits(table->mc_address));
53 if (ret)
54 return ret;
55 ret = smu_send_smc_msg_with_param(smu, drv2smu ?
56 SMU_MSG_TransferTableDram2Smu :
57 SMU_MSG_TransferTableSmu2Dram,
58 table_id);
59 if (ret)
60 return ret;
61
62 if (!drv2smu)
63 memcpy(table_data, table->cpu_addr, table->size);
64
65 return ret;
66}
67
32int smu_feature_init_dpm(struct smu_context *smu) 68int smu_feature_init_dpm(struct smu_context *smu)
33{ 69{
34 struct smu_feature *feature = &smu->smu_feature; 70 struct smu_feature *feature = &smu->smu_feature;
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index fe86a7fdfebf..c159e4d731fe 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -364,4 +364,7 @@ extern int smu_feature_set_enabled(struct smu_context *smu, int feature_id, bool
364extern int smu_feature_is_supported(struct smu_context *smu, int feature_id); 364extern int smu_feature_is_supported(struct smu_context *smu, int feature_id);
365extern int smu_feature_set_supported(struct smu_context *smu, int feature_id, bool enable); 365extern int smu_feature_set_supported(struct smu_context *smu, int feature_id, bool enable);
366 366
367int smu_update_table(struct smu_context *smu, uint32_t table_id,
368 void *table_data, bool drv2smu);
369
367#endif 370#endif