diff options
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 37 | ||||
-rw-r--r-- | drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 5 |
2 files changed, 42 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c index f9b254c8dad9..aba3fb1a6bdb 100644 --- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | |||
@@ -49,6 +49,43 @@ int smu_feature_init_dpm(struct smu_context *smu) | |||
49 | return ret; | 49 | return ret; |
50 | } | 50 | } |
51 | 51 | ||
52 | int smu_feature_is_enabled(struct smu_context *smu, int feature_id) | ||
53 | { | ||
54 | struct smu_feature *feature = &smu->smu_feature; | ||
55 | WARN_ON(feature_id > feature->feature_num); | ||
56 | return test_bit(feature_id, feature->enabled); | ||
57 | } | ||
58 | |||
59 | int smu_feature_set_enabled(struct smu_context *smu, int feature_id, bool enable) | ||
60 | { | ||
61 | struct smu_feature *feature = &smu->smu_feature; | ||
62 | WARN_ON(feature_id > feature->feature_num); | ||
63 | if (enable) | ||
64 | test_and_set_bit(feature_id, feature->enabled); | ||
65 | else | ||
66 | test_and_clear_bit(feature_id, feature->enabled); | ||
67 | return 0; | ||
68 | } | ||
69 | |||
70 | int smu_feature_is_supported(struct smu_context *smu, int feature_id) | ||
71 | { | ||
72 | struct smu_feature *feature = &smu->smu_feature; | ||
73 | WARN_ON(feature_id > feature->feature_num); | ||
74 | return test_bit(feature_id, feature->supported); | ||
75 | } | ||
76 | |||
77 | int smu_feature_set_supported(struct smu_context *smu, int feature_id, | ||
78 | bool enable) | ||
79 | { | ||
80 | struct smu_feature *feature = &smu->smu_feature; | ||
81 | WARN_ON(feature_id > feature->feature_num); | ||
82 | if (enable) | ||
83 | test_and_set_bit(feature_id, feature->supported); | ||
84 | else | ||
85 | test_and_clear_bit(feature_id, feature->supported); | ||
86 | return 0; | ||
87 | } | ||
88 | |||
52 | static int smu_set_funcs(struct amdgpu_device *adev) | 89 | static int smu_set_funcs(struct amdgpu_device *adev) |
53 | { | 90 | { |
54 | struct smu_context *smu = &adev->smu; | 91 | struct smu_context *smu = &adev->smu; |
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h index 740dae2d6221..dfabd73fedaf 100644 --- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h +++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h | |||
@@ -327,4 +327,9 @@ extern const struct amd_ip_funcs smu_ip_funcs; | |||
327 | extern const struct amdgpu_ip_block_version smu_v11_0_ip_block; | 327 | extern const struct amdgpu_ip_block_version smu_v11_0_ip_block; |
328 | extern int smu_feature_init_dpm(struct smu_context *smu); | 328 | extern int smu_feature_init_dpm(struct smu_context *smu); |
329 | 329 | ||
330 | extern int smu_feature_is_enabled(struct smu_context *smu, int feature_id); | ||
331 | extern int smu_feature_set_enabled(struct smu_context *smu, int feature_id, bool enable); | ||
332 | extern int smu_feature_is_supported(struct smu_context *smu, int feature_id); | ||
333 | extern int smu_feature_set_supported(struct smu_context *smu, int feature_id, bool enable); | ||
334 | |||
330 | #endif | 335 | #endif |