Konstantin Demin
8cbaf1dea2
3rd patchs (in alphabetical order): - bbr3 - ntsync5 - openwrt - pf-kernel - xanmod - zen no configuration changes for now
82 lines
2.3 KiB
Diff
82 lines
2.3 KiB
Diff
From 7c658490b05f6ab4dd59e1c25e75ba1037f6cfeb Mon Sep 17 00:00:00 2001
|
|
From: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
|
|
Date: Thu, 17 Oct 2024 10:05:29 +0000
|
|
Subject: cpufreq/amd-pstate: Call amd_pstate_set_driver() in
|
|
amd_pstate_register_driver()
|
|
|
|
Replace a similar chunk of code in amd_pstate_register_driver() with
|
|
amd_pstate_set_driver() call.
|
|
|
|
Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
|
|
---
|
|
drivers/cpufreq/amd-pstate.c | 47 +++++++++++++++++-------------------
|
|
1 file changed, 22 insertions(+), 25 deletions(-)
|
|
|
|
--- a/drivers/cpufreq/amd-pstate.c
|
|
+++ b/drivers/cpufreq/amd-pstate.c
|
|
@@ -1221,16 +1221,32 @@ static void amd_pstate_driver_cleanup(vo
|
|
current_pstate_driver = NULL;
|
|
}
|
|
|
|
+static int amd_pstate_set_driver(int mode_idx)
|
|
+{
|
|
+ if (mode_idx >= AMD_PSTATE_DISABLE && mode_idx < AMD_PSTATE_MAX) {
|
|
+ cppc_state = mode_idx;
|
|
+ if (cppc_state == AMD_PSTATE_DISABLE)
|
|
+ pr_info("driver is explicitly disabled\n");
|
|
+
|
|
+ if (cppc_state == AMD_PSTATE_ACTIVE)
|
|
+ current_pstate_driver = &amd_pstate_epp_driver;
|
|
+
|
|
+ if (cppc_state == AMD_PSTATE_PASSIVE || cppc_state == AMD_PSTATE_GUIDED)
|
|
+ current_pstate_driver = &amd_pstate_driver;
|
|
+
|
|
+ return 0;
|
|
+ }
|
|
+
|
|
+ return -EINVAL;
|
|
+}
|
|
+
|
|
static int amd_pstate_register_driver(int mode)
|
|
{
|
|
int ret;
|
|
|
|
- if (mode == AMD_PSTATE_PASSIVE || mode == AMD_PSTATE_GUIDED)
|
|
- current_pstate_driver = &amd_pstate_driver;
|
|
- else if (mode == AMD_PSTATE_ACTIVE)
|
|
- current_pstate_driver = &amd_pstate_epp_driver;
|
|
- else
|
|
- return -EINVAL;
|
|
+ ret = amd_pstate_set_driver(mode);
|
|
+ if (ret)
|
|
+ return ret;
|
|
|
|
cppc_state = mode;
|
|
|
|
@@ -1756,25 +1772,6 @@ static struct cpufreq_driver amd_pstate_
|
|
.attr = amd_pstate_epp_attr,
|
|
};
|
|
|
|
-static int __init amd_pstate_set_driver(int mode_idx)
|
|
-{
|
|
- if (mode_idx >= AMD_PSTATE_DISABLE && mode_idx < AMD_PSTATE_MAX) {
|
|
- cppc_state = mode_idx;
|
|
- if (cppc_state == AMD_PSTATE_DISABLE)
|
|
- pr_info("driver is explicitly disabled\n");
|
|
-
|
|
- if (cppc_state == AMD_PSTATE_ACTIVE)
|
|
- current_pstate_driver = &amd_pstate_epp_driver;
|
|
-
|
|
- if (cppc_state == AMD_PSTATE_PASSIVE || cppc_state == AMD_PSTATE_GUIDED)
|
|
- current_pstate_driver = &amd_pstate_driver;
|
|
-
|
|
- return 0;
|
|
- }
|
|
-
|
|
- return -EINVAL;
|
|
-}
|
|
-
|
|
/*
|
|
* CPPC function is not supported for family ID 17H with model_ID ranging from 0x10 to 0x2F.
|
|
* show the debug message that helps to check if the CPU has CPPC support for loading issue.
|