summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
diff options
context:
space:
mode:
authorKevin Wang2018-12-26 09:13:09 +0100
committerAlex Deucher2019-03-19 21:03:57 +0100
commit2f25158d7db8a435a65f22ca194fc461cb26db82 (patch)
treec9abad2a935c2bacc06cc232e7b3f13b88534690 /drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
parentdrm/amd/powerplay: implement smu feature functions (diff)
downloadkernel-qcow2-linux-2f25158d7db8a435a65f22ca194fc461cb26db82.tar.gz
kernel-qcow2-linux-2f25158d7db8a435a65f22ca194fc461cb26db82.tar.xz
kernel-qcow2-linux-2f25158d7db8a435a65f22ca194fc461cb26db82.zip
drm/amd/powerplay: implement feature get&set functions
add smu feature operation function helper to deal with smu feature bitmap. 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/amd/powerplay/amdgpu_smu.c')
-rw-r--r--drivers/gpu/drm/amd/powerplay/amdgpu_smu.c37
1 files changed, 37 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)
return ret;
}
+int smu_feature_is_enabled(struct smu_context *smu, int feature_id)
+{
+ struct smu_feature *feature = &smu->smu_feature;
+ WARN_ON(feature_id > feature->feature_num);
+ return test_bit(feature_id, feature->enabled);
+}
+
+int smu_feature_set_enabled(struct smu_context *smu, int feature_id, bool enable)
+{
+ struct smu_feature *feature = &smu->smu_feature;
+ WARN_ON(feature_id > feature->feature_num);
+ if (enable)
+ test_and_set_bit(feature_id, feature->enabled);
+ else
+ test_and_clear_bit(feature_id, feature->enabled);
+ return 0;
+}
+
+int smu_feature_is_supported(struct smu_context *smu, int feature_id)
+{
+ struct smu_feature *feature = &smu->smu_feature;
+ WARN_ON(feature_id > feature->feature_num);
+ return test_bit(feature_id, feature->supported);
+}
+
+int smu_feature_set_supported(struct smu_context *smu, int feature_id,
+ bool enable)
+{
+ struct smu_feature *feature = &smu->smu_feature;
+ WARN_ON(feature_id > feature->feature_num);
+ if (enable)
+ test_and_set_bit(feature_id, feature->supported);
+ else
+ test_and_clear_bit(feature_id, feature->supported);
+ return 0;
+}
+
static int smu_set_funcs(struct amdgpu_device *adev)
{
struct smu_context *smu = &adev->smu;