aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/windfarm_pm121.c
diff options
context:
space:
mode:
authorAaro Koskinen <aaro.koskinen@iki.fi>2013-06-30 15:00:42 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-06-30 21:10:34 -0400
commit4bb297113433048169c30a32c1e58b6a1b61b621 (patch)
treee278a2fc4cea6f1151f0e11ee4dc4f492fdc7cfb /drivers/macintosh/windfarm_pm121.c
parent9bf41be6737327b7c06cd3f210a0cb599f4aa790 (diff)
powerpc/windfarm: Fix overtemperature clearing
With pm81/pm91/pm121, when the overtemperature state is entered, and when it remains on after skipped ticks, the driver will try to leave it too soon (immediately on the next tick). This is because the active FAILURE_OVERTEMP state is not visible in "new_failure" variable of the current tick. Furthermore, the driver will keep trying to clear condition in subsequent ticks as FAILURE_OVERTEMP remains set in the "last_failure" variable. These will start to trigger WARNINGS from windfarm core: [ 100.082735] windfarm: Clamping CPU frequency to minimum ! [ 100.108132] windfarm: Overtemp condition detected ! [ 101.952908] windfarm: Overtemp condition cleared ! [...] [ 102.980388] WARNING: at drivers/macintosh/windfarm_core.c:463 [...] [ 103.982227] WARNING: at drivers/macintosh/windfarm_core.c:463 [...] [ 105.030494] WARNING: at drivers/macintosh/windfarm_core.c:463 [...] [ 105.973666] WARNING: at drivers/macintosh/windfarm_core.c:463 [...] [ 106.977913] WARNING: at drivers/macintosh/windfarm_core.c:463 Fix by adding a helper global variable. We leave the overtemp state only after all failure bits have been cleared. I saw this error on iMac G5 iSight (pm121). Also pm81/pm91 are fixed based on the observation that these are almost identical/copy-pasted code. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/macintosh/windfarm_pm121.c')
-rw-r--r--drivers/macintosh/windfarm_pm121.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/macintosh/windfarm_pm121.c b/drivers/macintosh/windfarm_pm121.c
index af605e915d41..7fe58b0ae8b4 100644
--- a/drivers/macintosh/windfarm_pm121.c
+++ b/drivers/macintosh/windfarm_pm121.c
@@ -276,6 +276,7 @@ static const char *loop_names[N_LOOPS] = {
276 276
277static unsigned int pm121_failure_state; 277static unsigned int pm121_failure_state;
278static int pm121_readjust, pm121_skipping; 278static int pm121_readjust, pm121_skipping;
279static bool pm121_overtemp;
279static s32 average_power; 280static s32 average_power;
280 281
281struct pm121_correction { 282struct pm121_correction {
@@ -847,6 +848,7 @@ static void pm121_tick(void)
847 if (new_failure & FAILURE_OVERTEMP) { 848 if (new_failure & FAILURE_OVERTEMP) {
848 wf_set_overtemp(); 849 wf_set_overtemp();
849 pm121_skipping = 2; 850 pm121_skipping = 2;
851 pm121_overtemp = true;
850 } 852 }
851 853
852 /* We only clear the overtemp condition if overtemp is cleared 854 /* We only clear the overtemp condition if overtemp is cleared
@@ -855,8 +857,10 @@ static void pm121_tick(void)
855 * the control loop levels, but we don't want to keep it clear 857 * the control loop levels, but we don't want to keep it clear
856 * here in this case 858 * here in this case
857 */ 859 */
858 if (new_failure == 0 && last_failure & FAILURE_OVERTEMP) 860 if (!pm121_failure_state && pm121_overtemp) {
859 wf_clear_overtemp(); 861 wf_clear_overtemp();
862 pm121_overtemp = false;
863 }
860} 864}
861 865
862 866