Skip to contentSkip to conversation

platform/x86/amd/pmf: Added a module parameter to disable the Smart PC function

PATCH In review Alexey Zagorodnikov 2 participants 2 messages Jan 19

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

PATCH 1/1 platform/x86/amd/pmf: Added a module parameter to disable the Smart PC function

Addresses a low power limits issue on HP ZBook Ultra G1a
https://gitlab.freedesktop.org/drm/amd/-/issues/4868

If vendor firmware capped APU power limits with 3rd-party AC adapters, the user can disable the Smart PC function via the module parameter

---
 drivers/platform/x86/amd/pmf/core.c | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)
drivers/platform/x86/amd/pmf/core.c +14 -5
index 8fc293c9c5380..00a4fc899c727 100644
@@ -53,6 +53,11 @@ static bool force_load;
 module_param(force_load, bool, 0444);
 MODULE_PARM_DESC(force_load, "Force load this driver on supported older platforms (experimental)");
 
+/* Force to disable Smart PC Solution */
+static bool disable_smart_pc;
+module_param(disable_smart_pc, bool, 0444);
+MODULE_PARM_DESC(disable_smart_pc, "Disable Smart PC Solution");
+
 static int amd_pmf_pwr_src_notify_call(struct notifier_block *nb, unsigned long event, void *data)
 {
 	struct amd_pmf_dev *pmf = container_of(nb, struct amd_pmf_dev, pwr_src_notifier);
@@ -362,11 +367,15 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)
 		dev_dbg(dev->dev, "SPS enabled and Platform Profiles registered\n");
 	}
 
-	amd_pmf_init_smart_pc(dev);
-	if (dev->smart_pc_enabled) {
-		dev_dbg(dev->dev, "Smart PC Solution Enabled\n");
-		/* If Smart PC is enabled, no need to check for other features */
-		return;
+	if (disable_smart_pc) {
+		dev->smart_pc_enabled = false;
+	} else {
+		amd_pmf_init_smart_pc(dev);
+		if (dev->smart_pc_enabled) {
+			dev_dbg(dev->dev, "Smart PC Solution Enabled\n");
+			/* If Smart PC is enabled, no need to check for other features */
+			return;
+		}
 	}
 
 	if (is_apmf_func_supported(dev, APMF_FUNC_AUTO_MODE)) {
Signature · 1 line
2.52.0
#1 lore raw
Quoted 7 lines · Alexey Zagorodnikov

Addresses a low power limits issue on HP ZBook Ultra G1a
https://gitlab.freedesktop.org/drm/amd/-/issues/4868

If vendor firmware capped APU power limits with 3rd-party AC adapters, the user can disable the Smart PC function via the module parameter

You should use a tag instead for "Link:". It would look like this (assuming rest of commit text was OK):

Addresses a low power limits issue on HP ZBook Ultra G1a [1]. .
.
.

Quoted 9 lines
---
  drivers/platform/x86/amd/pmf/core.c | 19 ++++++++++++++-----
  1 file changed, 14 insertions(+), 5 deletions(-)
drivers/platform/x86/amd/pmf/core.c +0 -0
index 8fc293c9c5380..00a4fc899c727 100644

drivers/platform/x86/amd/pmf/core.c static bool force_load; · line 59

Quoted 7 lines
drivers/platform/x86/amd/pmf/core.c +4 -0
@@ -53,6 +53,11 @@ static bool force_load;
  module_param(force_load, bool, 0444);
  MODULE_PARM_DESC(force_load, "Force load this driver on supported older platforms (experimental)");
 
+/* Force to disable Smart PC Solution */
+static bool disable_smart_pc;
+module_param(disable_smart_pc, bool, 0444);
+MODULE_PARM_DESC(disable_smart_pc, "Disable Smart PC Solution");

Totally a nit/preference thing but I would think this is more logical:

static bool smart_pc = 1; module_param(disable_smart_pc, bool, 0444); MODULE_PARM_DESC(disable_smart_pc, "Smart PC Support");

Then the code reads the common flow more directly

if (smart_pc)

	//probe
else
	dev->smart_pc = false;
Quoted 25 lines
drivers/platform/x86/amd/pmf/core.c +10 -5
+
  static int amd_pmf_pwr_src_notify_call(struct notifier_block *nb, unsigned long event, void *data)
  {
  	struct amd_pmf_dev *pmf = container_of(nb, struct amd_pmf_dev, pwr_src_notifier);
@@ -362,11 +367,15 @@ static void amd_pmf_init_features(struct amd_pmf_dev *dev)
  		dev_dbg(dev->dev, "SPS enabled and Platform Profiles registered\n");
  	}
 
-	amd_pmf_init_smart_pc(dev);
-	if (dev->smart_pc_enabled) {
-		dev_dbg(dev->dev, "Smart PC Solution Enabled\n");
-		/* If Smart PC is enabled, no need to check for other features */
-		return;
+	if (disable_smart_pc) {
+		dev->smart_pc_enabled = false;
+	} else {
+		amd_pmf_init_smart_pc(dev);
+		if (dev->smart_pc_enabled) {
+			dev_dbg(dev->dev, "Smart PC Solution Enabled\n");
+			/* If Smart PC is enabled, no need to check for other features */
+			return;
+		}
  	}
 
  	if (is_apmf_func_supported(dev, APMF_FUNC_AUTO_MODE)) {