Skip to contentSkip to conversation

drm/amd/powerplay: implement VCN power gating control interface

PATCH In review Liang, Prike 2 participants 2 messages Sep 17, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/powerplay: implement VCN power gating control interface

VCN Gat/Ungat by processing the SMU power up/down message, otherwise S3 will resume failed as JPEG always power off during start VCN stage.

---
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +27 -1
index 2c22ba4..9311b6a 100644
@@ -278,6 +278,32 @@ static enum amd_pm_state_type renoir_get_current_power_state(struct smu_context
 	return pm_type;
 }
 
+static int renoir_dpm_set_uvd_enable(struct smu_context *smu, bool enable)
+{
+	struct smu_power_context *smu_power = &smu->smu_power;
+	struct smu_power_gate *power_gate = &smu_power->power_gate;
+	int ret = 0;
+
+	if (enable) {
+		/* vcn dpm on is a prerequisite for vcn power gate messages */
+		if (smu_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT)) {
+			ret = smu_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 1);
+			if (ret)
+				return ret;
+		}
+		power_gate->vcn_gated = false;
+	} else {
+		if (smu_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT)) {
+			ret = smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn);
+			if (ret)
+				return ret;
+		}
+		power_gate->vcn_gated = true;
+	}
+
+	return ret;
+}
+
 static const struct pptable_funcs renoir_ppt_funcs = {
 	.get_smu_msg_index = renoir_get_smu_msg_index,
 	.get_smu_table_index = renoir_get_smu_table_index,
@@ -286,7 +312,7 @@ static const struct pptable_funcs renoir_ppt_funcs = {
 	.get_dpm_uclk_limited = renoir_get_dpm_uclk_limited,
 	.print_clk_levels = renoir_print_clk_levels,
 	.get_current_power_state = renoir_get_current_power_state,
-
+	.dpm_set_uvd_enable = renoir_dpm_set_uvd_enable,
 };
 
 void renoir_set_ppt_funcs(struct smu_context *smu)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1568688837-21350-1-git-send-email-Prike.Liang-5C7GfCeVMHo@public.gmane.org

Reviewed-by Evan Quan
#2 lore raw

-----Original Message-----
From: Liang, Prike <[email protected]>
Sent: Tuesday, September 17, 2019 10:54 AM
To: [email protected]
Cc: Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>; Huang, Ray <[email protected]>; Liu, Aaron <[email protected]>; Liang, Prike <[email protected]>
Subject: [PATCH] drm/amd/powerplay: implement VCN power gating control interface

VCN Gat/Ungat by processing the SMU power up/down message, otherwise S3 will resume failed as JPEG always power off during start VCN stage.

---
 drivers/gpu/drm/amd/powerplay/renoir_ppt.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/powerplay/renoir_ppt.c +27 -1
index 2c22ba4..9311b6a 100644
@@ -278,6 +278,32 @@ static enum amd_pm_state_type renoir_get_current_power_state(struct smu_context
 	return pm_type;
 }
 
+static int renoir_dpm_set_uvd_enable(struct smu_context *smu, bool enable)
+{
+	struct smu_power_context *smu_power = &smu->smu_power;
+	struct smu_power_gate *power_gate = &smu_power->power_gate;
+	int ret = 0;
+
+	if (enable) {
+		/* vcn dpm on is a prerequisite for vcn power gate messages */
+		if (smu_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT)) {
+			ret = smu_send_smc_msg_with_param(smu, SMU_MSG_PowerUpVcn, 1);
+			if (ret)
+				return ret;
+		}
+		power_gate->vcn_gated = false;
+	} else {
+		if (smu_feature_is_enabled(smu, SMU_FEATURE_VCN_PG_BIT)) {
+			ret = smu_send_smc_msg(smu, SMU_MSG_PowerDownVcn);
+			if (ret)
+				return ret;
+		}
+		power_gate->vcn_gated = true;
+	}
+
+	return ret;
+}
+
 static const struct pptable_funcs renoir_ppt_funcs = {
 	.get_smu_msg_index = renoir_get_smu_msg_index,
 	.get_smu_table_index = renoir_get_smu_table_index,
@@ -286,7 +312,7 @@ static const struct pptable_funcs renoir_ppt_funcs = {
 	.get_dpm_uclk_limited = renoir_get_dpm_uclk_limited,
 	.print_clk_levels = renoir_print_clk_levels,
 	.get_current_power_state = renoir_get_current_power_state,
-
+	.dpm_set_uvd_enable = renoir_dpm_set_uvd_enable,
 };
 
 void renoir_set_ppt_funcs(struct smu_context *smu)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx