Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f25158d authored by Kevin Wang's avatar Kevin Wang Committed by Alex Deucher
Browse files

drm/amd/powerplay: implement feature get&set functions



add smu feature operation function helper to deal with smu feature
bitmap.

Signed-off-by: default avatarKevin Wang <Kevin1.Wang@amd.com>
Reviewed-by: default avatarHuang Rui <ray.huang@amd.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6b816d73
Loading
Loading
Loading
Loading
+37 −0
Original line number Original line Diff line number Diff line
@@ -49,6 +49,43 @@ int smu_feature_init_dpm(struct smu_context *smu)
	return ret;
	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)
static int smu_set_funcs(struct amdgpu_device *adev)
{
{
	struct smu_context *smu = &adev->smu;
	struct smu_context *smu = &adev->smu;
+5 −0
Original line number Original line Diff line number Diff line
@@ -327,4 +327,9 @@ extern const struct amd_ip_funcs smu_ip_funcs;
extern const struct amdgpu_ip_block_version smu_v11_0_ip_block;
extern const struct amdgpu_ip_block_version smu_v11_0_ip_block;
extern int smu_feature_init_dpm(struct smu_context *smu);
extern int smu_feature_init_dpm(struct smu_context *smu);


extern int smu_feature_is_enabled(struct smu_context *smu, int feature_id);
extern int smu_feature_set_enabled(struct smu_context *smu, int feature_id, bool enable);
extern int smu_feature_is_supported(struct smu_context *smu, int feature_id);
extern int smu_feature_set_supported(struct smu_context *smu, int feature_id, bool enable);

#endif
#endif