Skip to contentSkip to conversation

drm/amd/pm: workaround for the wrong ac power detection on smu 13.0.0

PATCH In review Kenneth Feng 5 participants 5 messages Aug 25, 2023

Subsystems (3)
lore
Share & tools
lore

Kenneth Feng

author maintainer
#0 lore raw

PATCH 1/1 drm/amd/pm: workaround for the wrong ac power detection on smu 13.0.0

workaround for the wrong ac power detection on smu 13.0.0

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c       | 3 +--
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -2
index 0232adb95df3..fd1798fd716e 100644
@@ -1021,8 +1021,7 @@ static int smu_v13_0_process_pending_interrupt(struct smu_context *smu)
 {
 	int ret = 0;
 
-	if (smu->dc_controlled_by_gpio &&
-	    smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
 		ret = smu_v13_0_allow_ih_interrupt(smu);
 
 	return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -1
index 3903a47669e4..128468355375 100644
@@ -2664,7 +2664,6 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
 	.enable_mgpu_fan_boost = smu_v13_0_0_enable_mgpu_fan_boost,
 	.get_power_limit = smu_v13_0_0_get_power_limit,
 	.set_power_limit = smu_v13_0_set_power_limit,
-	.set_power_source = smu_v13_0_set_power_source,
 	.get_power_profile_mode = smu_v13_0_0_get_power_profile_mode,
 	.set_power_profile_mode = smu_v13_0_0_set_power_profile_mode,
 	.run_btc = smu_v13_0_run_btc,
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw

[AMD Official Use Only - General]

Regards,
Hawking
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Kenneth Feng
Sent: Friday, August 25, 2023 11:19
To: [email protected]
Cc: Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>
Subject: [PATCH] drm/amd/pm: workaround for the wrong ac power detection on smu 13.0.0

workaround for the wrong ac power detection on smu 13.0.0

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c       | 3 +--
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -2
index 0232adb95df3..fd1798fd716e 100644
@@ -1021,8 +1021,7 @@ static int smu_v13_0_process_pending_interrupt(struct smu_context *smu)  {
        int ret = 0;
 
-       if (smu->dc_controlled_by_gpio &&
-           smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
+       if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
                ret = smu_v13_0_allow_ih_interrupt(smu);
 
        return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -1
index 3903a47669e4..128468355375 100644
@@ -2664,7 +2664,6 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
        .enable_mgpu_fan_boost = smu_v13_0_0_enable_mgpu_fan_boost,
        .get_power_limit = smu_v13_0_0_get_power_limit,
        .set_power_limit = smu_v13_0_set_power_limit,
-       .set_power_source = smu_v13_0_set_power_source,
        .get_power_profile_mode = smu_v13_0_0_get_power_profile_mode,
        .set_power_profile_mode = smu_v13_0_0_set_power_profile_mode,
        .run_btc = smu_v13_0_run_btc,

--
2.34.1

#2 lore raw
In reply to Kenneth Feng

[AMD Official Use Only - General]

As discussed offline, better to document something like "this is a temporary solution and will be dropped in the future". Either way, the patch is reviewed-by: Evan Quan <[email protected]>

Evan

Quoted 49 lines

-----Original Message-----
From: Kenneth Feng <[email protected]>
Sent: Friday, August 25, 2023 11:19 AM
To: [email protected]
Cc: Quan, Evan <[email protected]>; Feng, Kenneth <[email protected]>
Subject: [PATCH] drm/amd/pm: workaround for the wrong ac power detection on smu 13.0.0

workaround for the wrong ac power detection on smu 13.0.0

---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c       | 3 +--
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -2
index 0232adb95df3..fd1798fd716e 100644
@@ -1021,8 +1021,7 @@ static int
 smu_v13_0_process_pending_interrupt(struct smu_context *smu)
 {
      int ret = 0;
 
-     if (smu->dc_controlled_by_gpio &&
-         smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
+     if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
              ret = smu_v13_0_allow_ih_interrupt(smu);
 
      return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -1
index 3903a47669e4..128468355375 100644
@@ -2664,7 +2664,6 @@ static const struct pptable_funcs
 smu_v13_0_0_ppt_funcs = {
      .enable_mgpu_fan_boost = smu_v13_0_0_enable_mgpu_fan_boost,
      .get_power_limit = smu_v13_0_0_get_power_limit,
      .set_power_limit = smu_v13_0_set_power_limit,
-     .set_power_source = smu_v13_0_set_power_source,
      .get_power_profile_mode = smu_v13_0_0_get_power_profile_mode,
      .set_power_profile_mode = smu_v13_0_0_set_power_profile_mode,
      .run_btc = smu_v13_0_run_btc,

--
2.34.1

#3 lore raw
In reply to Kenneth Feng
Quoted 2 lines · Kenneth Feng

workaround for the wrong ac power detection on smu 13.0.0

Is this to work around the bug in the power supply code for USB controllers or something else? If so that was already fixed upstream so this is really more of a candidate for stable rather than -next.

Alex

Quoted 36 lines
---
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c       | 3 +--
 drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -2
index 0232adb95df3..fd1798fd716e 100644
@@ -1021,8 +1021,7 @@ static int smu_v13_0_process_pending_interrupt(struct smu_context *smu)
 {
        int ret = 0;
 
-       if (smu->dc_controlled_by_gpio &&
-           smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
+       if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
                ret = smu_v13_0_allow_ih_interrupt(smu);
 
        return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -2
index 3903a47669e4..128468355375 100644
@@ -2664,7 +2664,6 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
        .enable_mgpu_fan_boost = smu_v13_0_0_enable_mgpu_fan_boost,
        .get_power_limit = smu_v13_0_0_get_power_limit,
        .set_power_limit = smu_v13_0_set_power_limit,
-       .set_power_source = smu_v13_0_set_power_source,
        .get_power_profile_mode = smu_v13_0_0_get_power_profile_mode,
        .set_power_profile_mode = smu_v13_0_0_set_power_profile_mode,
        .run_btc = smu_v13_0_run_btc,
--

2.34.1

#4 lore raw
In reply to Kenneth Feng
Quoted 3 lines · Kenneth Feng

workaround for the wrong ac power detection on smu 13.0.0

This workaround appears to be only necessary if you're missing these commits.

a7fbfd44c020 ("usb: typec: ucsi: Mark dGPUs as DEVICE scope") 95339f40a8b6 ("power: supply: Fix logic checking if system is running from battery")

If this is run on a kernel with those commits then it's going to be broken in reverse.

I suspect the reason that you want to do this workaround is because you're trying to run on a kernel without them and which you can't add them.

If that's the case I think a better/safer temporary workaround is to add a module parameter or a debugfs entry to use.

Quoted 31 lines
---
  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c       | 3 +--
  drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 1 -
  2 files changed, 1 insertion(+), 3 deletions(-)
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +1 -2
index 0232adb95df3..fd1798fd716e 100644
@@ -1021,8 +1021,7 @@ static int smu_v13_0_process_pending_interrupt(struct smu_context *smu)
  {
  	int ret = 0;
 
-	if (smu->dc_controlled_by_gpio &&
-	    smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
+	if (smu_cmn_feature_is_enabled(smu, SMU_FEATURE_ACDC_BIT))
  		ret = smu_v13_0_allow_ih_interrupt(smu);
 
  	return ret;
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +0 -1
index 3903a47669e4..128468355375 100644
@@ -2664,7 +2664,6 @@ static const struct pptable_funcs smu_v13_0_0_ppt_funcs = {
  	.enable_mgpu_fan_boost = smu_v13_0_0_enable_mgpu_fan_boost,
  	.get_power_limit = smu_v13_0_0_get_power_limit,
  	.set_power_limit = smu_v13_0_set_power_limit,
-	.set_power_source = smu_v13_0_set_power_source,
  	.get_power_profile_mode = smu_v13_0_0_get_power_profile_mode,
  	.set_power_profile_mode = smu_v13_0_0_set_power_profile_mode,
  	.run_btc = smu_v13_0_run_btc,