amd-pstate.c (ced3960aa0f09329675209c6004bfc4025cc1f26) amd-pstate.c (dd329e1e21b54c73f58a440b6164d04d8a7fc542)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * amd-pstate.c - AMD Processor P-state Frequency Driver
4 *
5 * Copyright (C) 2021 Advanced Micro Devices, Inc. All Rights Reserved.
6 *
7 * Author: Huang Rui <ray.huang@amd.com>
8 *

--- 817 unchanged lines hidden (view full) ---

826
827static void amd_pstate_driver_cleanup(void)
828{
829 current_pstate_driver = NULL;
830}
831
832static int amd_pstate_update_status(const char *buf, size_t size)
833{
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * amd-pstate.c - AMD Processor P-state Frequency Driver
4 *
5 * Copyright (C) 2021 Advanced Micro Devices, Inc. All Rights Reserved.
6 *
7 * Author: Huang Rui <ray.huang@amd.com>
8 *

--- 817 unchanged lines hidden (view full) ---

826
827static void amd_pstate_driver_cleanup(void)
828{
829 current_pstate_driver = NULL;
830}
831
832static int amd_pstate_update_status(const char *buf, size_t size)
833{
834 int ret;
834 int ret = 0;
835 int mode_idx;
836
837 if (size > 7 || size < 6)
838 return -EINVAL;
839 mode_idx = get_mode_idx_from_str(buf, size);
840
841 switch(mode_idx) {
842 case AMD_PSTATE_DISABLE:
843 if (!current_pstate_driver)
844 return -EINVAL;
845 if (cppc_state == AMD_PSTATE_ACTIVE)
846 return -EBUSY;
835 int mode_idx;
836
837 if (size > 7 || size < 6)
838 return -EINVAL;
839 mode_idx = get_mode_idx_from_str(buf, size);
840
841 switch(mode_idx) {
842 case AMD_PSTATE_DISABLE:
843 if (!current_pstate_driver)
844 return -EINVAL;
845 if (cppc_state == AMD_PSTATE_ACTIVE)
846 return -EBUSY;
847 ret = cpufreq_unregister_driver(current_pstate_driver);
847 cpufreq_unregister_driver(current_pstate_driver);
848 amd_pstate_driver_cleanup();
849 break;
850 case AMD_PSTATE_PASSIVE:
851 if (current_pstate_driver) {
852 if (current_pstate_driver == &amd_pstate_driver)
853 return 0;
854 cpufreq_unregister_driver(current_pstate_driver);
855 cppc_state = AMD_PSTATE_PASSIVE;

--- 501 unchanged lines hidden ---
848 amd_pstate_driver_cleanup();
849 break;
850 case AMD_PSTATE_PASSIVE:
851 if (current_pstate_driver) {
852 if (current_pstate_driver == &amd_pstate_driver)
853 return 0;
854 cpufreq_unregister_driver(current_pstate_driver);
855 cppc_state = AMD_PSTATE_PASSIVE;

--- 501 unchanged lines hidden ---