Skip to contentSkip to conversation

drm/amd/pm: support power source switch on Sienna Cichlid

PATCH In review Evan Quan 2 participants 3 messages Dec 7, 2020

Subsystems (3)
lore
Share & tools
lore

Evan Quan

author
#0 lore raw

PATCH 1/2 drm/amd/pm: support power source switch on Sienna Cichlid

Enable power source switch on Sienna Cichlid.

Change-Id Ic48821c61f3f1f65f7f5d78bac28e11ce400b4b2
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/pm/swsmu/smu11/sienna_cichlid_ppt.c +4 -0
index 84251f4826e6..822ddfc42360 100644
@@ -354,6 +354,9 @@ static int sienna_cichlid_check_powerplay_table(struct smu_context *smu)
 	struct smu_11_0_7_overdrive_table *overdrive_table;
 	int i, min_power_mode, max_power_mode;
 
+	if (powerplay_table->platform_caps & SMU_11_0_7_PP_PLATFORM_CAP_HARDWAREDC)
+		smu->dc_controlled_by_gpio = true;
+
 	if (powerplay_table->platform_caps & SMU_11_0_7_PP_PLATFORM_CAP_BACO ||
 	    powerplay_table->platform_caps & SMU_11_0_7_PP_PLATFORM_CAP_MACO)
 		smu_baco->platform_support = true;
@@ -3296,6 +3299,7 @@ static const struct pptable_funcs sienna_cichlid_ppt_funcs = {
 	.set_default_od_settings = sienna_cichlid_set_default_od_settings,
 	.od_edit_dpm_table = sienna_cichlid_od_edit_dpm_table,
 	.run_btc = sienna_cichlid_run_btc,
+	.set_power_source = smu_v11_0_set_power_source,
 	.get_pp_feature_mask = smu_cmn_get_pp_feature_mask,
 	.set_pp_feature_mask = smu_cmn_set_pp_feature_mask,
 	.get_gpu_metrics = sienna_cichlid_get_gpu_metrics,
Signature · 6 lines
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
author
#1 lore raw

PATCH 2/2 drm/amd/pm: correct power limit setting for SMU V11

Correct the power limit setting for SMU V11 asics.

Change-Id Idedc590c35934397bd77b7ac825b063cd319dbbf
---
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 23 ++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +22 -1
index 624065d3c079..3288760a5431 100644
@@ -929,9 +929,13 @@ int smu_v11_0_get_current_power_limit(struct smu_context *smu,
 	if (power_src < 0)
 		return -EINVAL;
 
+	/*
+	 * BIT 24-31: ControllerId (hardcoded as PPT0)
+	 * BIT 16-23: PowerSource
+	 */
 	ret = smu_cmn_send_smc_msg_with_param(smu,
 					  SMU_MSG_GetPptLimit,
-					  power_src << 16,
+					  (0 << 24) | (power_src << 16),
 					  power_limit);
 	if (ret)
 		dev_err(smu->adev->dev, "[%s] get PPT limit failed!", __func__);
@@ -941,6 +945,7 @@ int smu_v11_0_get_current_power_limit(struct smu_context *smu,
 
 int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n)
 {
+	int power_src;
 	int ret = 0;
 
 	if (!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_PPT_BIT)) {
@@ -948,6 +953,22 @@ int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n)
 		return -EOPNOTSUPP;
 	}
 
+	power_src = smu_cmn_to_asic_specific_index(smu,
+					CMN2ASIC_MAPPING_PWR,
+					smu->adev->pm.ac_power ?
+					SMU_POWER_SOURCE_AC :
+					SMU_POWER_SOURCE_DC);
+	if (power_src < 0)
+		return -EINVAL;
+
+	/*
+	 * BIT 24-31: ControllerId (hardcoded as PPT0)
+	 * BIT 16-23: PowerSource
+	 * BIT 0-15: PowerLimit
+	 */
+	n &= 0xFFFF;
+	n |= 0 << 24;
+	n |= (power_src) << 16;
 	ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetPptLimit, n, NULL);
 	if (ret) {
 		dev_err(smu->adev->dev, "[%s] Set power limit Failed!\n", __func__);
Signature · 6 lines
2.29.0

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

RE: [PATCH 2/2] drm/amd/pm: correct power limit setting for SMU V11

[AMD Public Use]

Quoted 1 line

* BIT 24-31: ControllerId (hardcoded as PPT0)

May be reworded as 'only PPT0 is supported'. Apart from that

Series is Reviewed-by: Lijo Lazar <[email protected]>

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Evan Quan
Sent: Monday, December 7, 2020 2:53 PM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>; Quan, Evan <[email protected]>
Subject: [PATCH 2/2] drm/amd/pm: correct power limit setting for SMU V11

[CAUTION: External Email]

Correct the power limit setting for SMU V11 asics.

Change-Id Idedc590c35934397bd77b7ac825b063cd319dbbf
---
 .../gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c    | 23 ++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -1
index 624065d3c079..3288760a5431 100644
@@ -929,9 +929,13 @@ int smu_v11_0_get_current_power_limit(struct smu_context *smu,
        if (power_src < 0)
                return -EINVAL;
 
+       /*
+        * BIT 24-31: ControllerId (hardcoded as PPT0)
+        * BIT 16-23: PowerSource
+        */
        ret = smu_cmn_send_smc_msg_with_param(smu,
                                          SMU_MSG_GetPptLimit,
-                                         power_src << 16,
+                                         (0 << 24) | (power_src << 16),
                                          power_limit);
        if (ret)
                dev_err(smu->adev->dev, "[%s] get PPT limit failed!", __func__); @@ -941,6 +945,7 @@ int smu_v11_0_get_current_power_limit(struct smu_context *smu,

int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n) {

+       int power_src;
        int ret = 0;

        if (!smu_cmn_feature_is_enabled(smu, SMU_FEATURE_PPT_BIT)) { @@ -948,6 +953,22 @@ int smu_v11_0_set_power_limit(struct smu_context *smu, uint32_t n)
                return -EOPNOTSUPP;
        }

+ power_src = smu_cmn_to_asic_specific_index(smu,

+                                       CMN2ASIC_MAPPING_PWR,
+                                       smu->adev->pm.ac_power ?
+                                       SMU_POWER_SOURCE_AC :
+                                       SMU_POWER_SOURCE_DC);

+ if (power_src < 0)
+ return -EINVAL;
+
+ /*

+        * BIT 24-31: ControllerId (hardcoded as PPT0)
+        * BIT 16-23: PowerSource
+        * BIT 0-15: PowerLimit
+        */
+       n &= 0xFFFF;
+       n |= 0 << 24;
+       n |= (power_src) << 16;
        ret = smu_cmn_send_smc_msg_with_param(smu, SMU_MSG_SetPptLimit, n, NULL);
        if (ret) {
                dev_err(smu->adev->dev, "[%s] Set power limit Failed!\n", __func__);

--
2.29.0

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Clijo.lazar%40amd.com%7C8e117d60de0c4c12bb9b08d89a91b045%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637429297804635030%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Hymngc63wUytPWZCrmmrKl%2FCdqF067sTlQCbfBNrndA%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx