linux-stable/drivers/cpufreq
Wyes Karny 4654e9f9f4 amd-pstate: Fix amd_pstate mode switch
amd_pstate mode can be changed by writing the mode name to the `status`
sysfs. But some combinations are not working. Fix this issue by taking
care of the edge cases.

Before the fix the mode change combination test fails:

 #./pst_test.sh
Test passed: from: disable, to
Test passed: from: disable, to disable
Test failed: 1, From mode: disable, to mode: passive
Test failed: 1, From mode: disable, to mode: active
Test failed: 1, From mode: passive, to mode: active
Test passed: from: passive, to disable
Test failed: 1, From mode: passive, to mode: passive
Test failed: 1, From mode: passive, to mode: active
Test failed: 1, From mode: active, to mode: active
Test passed: from: active, to disable
Test failed: 1, From mode: active, to mode: passive
Test failed: 1, From mode: active, to mode: active

After the fix test passes:

 #./pst_test.sh
Test passed: from: disable, to
Test passed: from: disable, to disable
Test passed: from: disable, to passive
Test passed: from: disable, to active
Test passed: from: passive, to active
Test passed: from: passive, to disable
Test passed: from: passive, to passive
Test passed: from: passive, to active
Test passed: from: active, to active
Test passed: from: active, to disable
Test passed: from: active, to passive
Test passed: from: active, to active

Fixes: abd61c08ef ("cpufreq: amd-pstate: add driver working mode switch support")
Acked-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alexey Kardashevskiy <aik@amd.com>
Signed-off-by: Wyes Karny <wyes.karny@amd.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2023-04-11 20:44:25 +02:00
..
Kconfig Power management updates for 6.3-rc1 2023-02-21 12:13:58 -08:00
Kconfig.arm cpufreq: remove s3c24xx drivers 2023-01-16 09:26:06 +01:00
Kconfig.powerpc
Kconfig.x86 cpufreq: amd-pstate: change amd-pstate driver to be built-in type 2022-11-22 19:57:15 +01:00
Makefile Power management updates for 6.3-rc1 2023-02-21 12:13:58 -08:00
acpi-cpufreq.c cpufreq: ACPI: Only set boost MSRs on supported CPUs 2022-12-06 12:12:40 +01:00
amd-pstate-trace.c cpufreq: amd-pstate: Add trace for AMD P-State module 2021-12-30 18:51:39 +01:00
amd-pstate-trace.h cpufreq: amd-pstate: Add more tracepoint for AMD P-State module 2022-03-09 19:53:01 +01:00
amd-pstate-ut.c cpufreq: amd-pstate: fix spdxcheck warnings for amd-pstate-ut.c 2022-11-16 08:38:19 -07:00
amd-pstate.c amd-pstate: Fix amd_pstate mode switch 2023-04-11 20:44:25 +02:00
amd_freq_sensitivity.c cpufreq: amd_freq_sensitivity: Add missing pci_dev_put() 2022-11-30 19:50:04 +01:00
apple-soc-cpufreq.c cpufreq: apple-soc: Fix an IS_ERR() vs NULL check 2023-03-01 19:34:54 +01:00
armada-8k-cpufreq.c cpufreq: ap806: Add missing MODULE_DEVICE_TABLE 2020-12-07 13:02:37 +05:30
armada-37xx-cpufreq.c cpufreq: armada-37xx: stop using 0 as NULL pointer 2023-01-10 09:32:03 +05:30
bmips-cpufreq.c cpufreq: bmips-cpufreq: Use module_init and add module_exit 2022-08-30 13:49:23 +05:30
brcmstb-avs-cpufreq.c cpufreq: Make cpufreq_unregister_driver() return void 2023-02-09 20:19:18 +01:00
cppc_cpufreq.c cpufreq: CPPC: Add u64 casts to avoid overflowing 2022-12-27 08:27:14 +05:30
cpufreq-dt-platdev.c cpufreq: Add SM6375 to cpufreq-dt-platdev blocklist 2023-01-04 12:05:06 +05:30
cpufreq-dt.c cpufreq: dt: Switch to use dev_err_probe() helper 2022-10-18 16:22:25 +05:30
cpufreq-dt.h
cpufreq-nforce2.c
cpufreq.c cpufreq: Make kobj_type structure constant 2023-02-09 20:29:32 +01:00
cpufreq_conservative.c cpufreq: unify show() and store() naming and use __ATTR_XX 2022-03-10 19:55:05 +01:00
cpufreq_governor.c cpufreq: governor: Use kobject release() method to free dbs_data 2022-04-13 15:22:41 +02:00
cpufreq_governor.h cpufreq: governor: Use kobject release() method to free dbs_data 2022-04-13 15:22:41 +02:00
cpufreq_governor_attr_set.c cpufreq: Move to_gov_attr_set() to cpufreq.h 2022-02-04 19:22:34 +01:00
cpufreq_ondemand.c cpufreq: ondemand: Use cpumask_var_t for on-stack cpu mask 2022-07-25 20:38:01 +02:00
cpufreq_ondemand.h
cpufreq_performance.c cpufreq: Introduce CPUFREQ_GOV_STRICT_TARGET 2020-11-10 18:31:17 +01:00
cpufreq_powersave.c cpufreq: Introduce CPUFREQ_GOV_STRICT_TARGET 2020-11-10 18:31:17 +01:00
cpufreq_stats.c cpufreq: stats: Convert to use sysfs_emit_at() API 2022-12-06 12:20:07 +01:00
cpufreq_userspace.c cpufreq: Register governors at core_initcall 2020-07-02 13:03:30 +02:00
davinci-cpufreq.c cpufreq: davinci: Fix clk use after free 2023-02-09 20:26:42 +01:00
e_powersaver.c cpufreq: e_powersaver: remove unreachable break 2020-10-27 18:42:54 +01:00
elanfreq.c
freq_table.c cpufreq: Fix scaling_{available,boost}_frequencies_show() comments 2021-03-26 17:43:48 +01:00
gx-suspmod.c
highbank-cpufreq.c cpufreq: Add __init annotation to module init funcs 2022-09-26 11:15:04 +05:30
ia64-acpi-cpufreq.c ia64: fix format string for ia64-acpi-cpu-freq 2021-03-19 17:26:20 +01:00
imx-cpufreq-dt.c OPP: Migrate set-supported-hw API to use set-config helpers 2022-07-08 11:27:48 +05:30
imx6q-cpufreq.c cpufreq: imx6q: Switch to use dev_err_probe() helper 2022-10-18 16:22:25 +05:30
intel_pstate.c More power management updates for 6.3-rc1 2023-03-03 10:30:58 -08:00
kirkwood-cpufreq.c
longhaul.c cpufreq: longhaul: Make array speeds static const 2022-11-03 19:13:34 +01:00
longhaul.h
longrun.c
loongson2_cpufreq.c cpufreq: loongson2: Remove unused linux/sched.h headers 2021-06-07 17:43:52 +02:00
maple-cpufreq.c
mediatek-cpufreq-hw.c Cpufreq arm updates for 6.3 2023-02-14 15:25:07 +01:00
mediatek-cpufreq.c cpufreq: mediatek: fix error return code in mtk_cpu_dvfs_info_init() 2022-07-13 16:53:00 +05:30
mvebu-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_56.RULE (part 2) 2022-06-10 14:51:35 +02:00
omap-cpufreq.c cpufreq: Make cpufreq_unregister_driver() return void 2023-02-09 20:19:18 +01:00
p4-clockmod.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00
pasemi-cpufreq.c cpufreq: Prepare cleanup of powerpc's asm/prom.h 2022-04-13 17:18:45 +02:00
pcc-cpufreq.c cpufreq: pcc-cpufreq: Mark sometimes used ID structs as __maybe_unused 2020-07-15 15:17:06 +02:00
pmac32-cpufreq.c cpufreq: pmac32-cpufreq: Fix refcount leak bug 2022-06-28 13:34:51 +05:30
pmac64-cpufreq.c cpufreq: Prepare cleanup of powerpc's asm/prom.h 2022-04-13 17:18:45 +02:00
powernow-k6.c
powernow-k7.c
powernow-k7.h
powernow-k8.c cpufreq: powernow-k8: Re-order the init checks 2022-03-17 14:54:11 +01:00
powernow-k8.h
powernv-cpufreq.c cpufreq: Introducing CPUFREQ_RELATION_E 2021-10-05 16:33:05 +02:00
ppc_cbe_cpufreq.c cpufreq: Prepare cleanup of powerpc's asm/prom.h 2022-04-13 17:18:45 +02:00
ppc_cbe_cpufreq.h
ppc_cbe_cpufreq_pervasive.c
ppc_cbe_cpufreq_pmi.c cpufreq: Prepare cleanup of powerpc's asm/prom.h 2022-04-13 17:18:45 +02:00
pxa2xx-cpufreq.c cpufreq: pxa3: move clk register access to clk driver 2022-05-07 22:55:49 +02:00
pxa3xx-cpufreq.c cpufreq: pxa3: move clk register access to clk driver 2022-05-07 22:55:49 +02:00
qcom-cpufreq-hw.c Merge back cpufreq material for 6.3-rc1. 2023-02-14 15:22:31 +01:00
qcom-cpufreq-nvmem.c cpufreq: qcom-nvmem: Switch to use dev_err_probe() helper 2022-10-18 16:22:26 +05:30
qoriq-cpufreq.c drivers: cpufreq: Add missing of_node_put() in qoriq-cpufreq.c 2022-06-28 13:34:45 +05:30
raspberrypi-cpufreq.c
s3c64xx-cpufreq.c
s5pv210-cpufreq.c cpufreq: Introducing CPUFREQ_RELATION_E 2021-10-05 16:33:05 +02:00
sa1110-cpufreq.c ARM: sa1100: remove unused board files 2023-01-12 10:53:12 +01:00
sc520_freq.c cpufreq: sc520_freq: add 'fallthrough' to one case 2021-05-21 18:52:13 +02:00
scmi-cpufreq.c cpufreq: scmi: Support the power scale in micro-Watts in SCMI v3.1 2022-07-15 19:17:30 +02:00
scpi-cpufreq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_320.RULE 2022-06-10 14:51:36 +02:00
sh-cpufreq.c cpufreq: sh: Remove sh_cpufreq_cpu_ready() 2021-09-02 18:04:17 +02:00
sparc-us2e-cpufreq.c
sparc-us3-cpufreq.c
spear-cpufreq.c cpufreq: SPEAr: Make read-only array sys_clk_src static 2022-11-03 19:15:45 +01:00
speedstep-centrino.c
speedstep-ich.c
speedstep-lib.c cpufreq: speedstep: remove unneeded semicolon 2020-10-28 18:04:07 +01:00
speedstep-lib.h
speedstep-smi.c
sti-cpufreq.c cpufreq: Add __init annotation to module init funcs 2022-09-26 11:15:04 +05:30
sun50i-cpufreq-nvmem.c cpufreq: sun50i: Switch to use dev_err_probe() helper 2022-10-18 16:22:26 +05:30
tegra20-cpufreq.c OPP: Migrate set-supported-hw API to use set-config helpers 2022-07-08 11:27:48 +05:30
tegra124-cpufreq.c
tegra186-cpufreq.c cpufreq: tegra186: Use flexible array to simplify memory allocation 2022-12-01 14:49:50 +05:30
tegra194-cpufreq.c cpufreq: tegra194: Enable CPUFREQ thermal cooling 2023-02-06 09:31:38 +05:30
ti-cpufreq.c cpufreq: ti-cpufreq: Add support for AM625 2022-11-07 15:30:11 +05:30
vexpress-spc-cpufreq.c cpufreq: vexpress: Drop unused variable 2021-10-04 11:25:21 +05:30