• Wyes Karny's avatar
    amd-pstate: Fix amd_pstate mode switch · 4654e9f9
    Wyes Karny authored
    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: abd61c08 ("cpufreq: amd-pstate: add driver working mode switch support")
    Acked-by: default avatarHuang Rui <ray.huang@amd.com>
    Reviewed-by: default avatarAlexey Kardashevskiy <aik@amd.com>
    Signed-off-by: default avatarWyes Karny <wyes.karny@amd.com>
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    4654e9f9
amd-pstate.c 33.8 KB