aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/windfarm_pid.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-02-08 00:42:51 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-08 01:05:14 -0500
commitac171c46667c1cb2ee9e22312291df6ed78e1b6e (patch)
tree86ca722abc1ddceb0887b3ed6a195d77bb200dc2 /drivers/macintosh/windfarm_pid.c
parent746f956beb534ddf73da4346de81f2941c8573f8 (diff)
[PATCH] powerpc: Thermal control for dual core G5s
This patch adds a windfarm module, windfarm_pm112, for the dual core G5s (both 2 and 4 core models), keeping the machine from getting into vacuum-cleaner mode ;) For proper credits, the patch was initially written by Paul Mackerras, and slightly reworked by me to add overtemp handling among others. The patch also removes the sysfs attributes from windfarm_pm81 and windfarm_pm91 and instead adds code to the windfarm core to automagically expose attributes for sensor & controls. Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/macintosh/windfarm_pid.c')
-rw-r--r--drivers/macintosh/windfarm_pid.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/macintosh/windfarm_pid.c b/drivers/macintosh/windfarm_pid.c
index 2e803b368757..0842432e27ad 100644
--- a/drivers/macintosh/windfarm_pid.c
+++ b/drivers/macintosh/windfarm_pid.c
@@ -88,8 +88,8 @@ EXPORT_SYMBOL_GPL(wf_cpu_pid_init);
88 88
89s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp) 89s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp)
90{ 90{
91 s64 error, integ, deriv, prop; 91 s64 integ, deriv, prop;
92 s32 target, sval, adj; 92 s32 error, target, sval, adj;
93 int i, hlen = st->param.history_len; 93 int i, hlen = st->param.history_len;
94 94
95 /* Calculate error term */ 95 /* Calculate error term */
@@ -117,7 +117,7 @@ s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp)
117 integ += st->errors[(st->index + hlen - i) % hlen]; 117 integ += st->errors[(st->index + hlen - i) % hlen];
118 integ *= st->param.interval; 118 integ *= st->param.interval;
119 integ *= st->param.gr; 119 integ *= st->param.gr;
120 sval = st->param.tmax - ((integ >> 20) & 0xffffffff); 120 sval = st->param.tmax - (s32)(integ >> 20);
121 adj = min(st->param.ttarget, sval); 121 adj = min(st->param.ttarget, sval);
122 122
123 DBG("integ: %lx, sval: %lx, adj: %lx\n", integ, sval, adj); 123 DBG("integ: %lx, sval: %lx, adj: %lx\n", integ, sval, adj);
@@ -129,7 +129,7 @@ s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp)
129 deriv *= st->param.gd; 129 deriv *= st->param.gd;
130 130
131 /* Calculate proportional term */ 131 /* Calculate proportional term */
132 prop = (new_temp - adj); 132 prop = st->last_delta = (new_temp - adj);
133 prop *= st->param.gp; 133 prop *= st->param.gp;
134 134
135 DBG("deriv: %lx, prop: %lx\n", deriv, prop); 135 DBG("deriv: %lx, prop: %lx\n", deriv, prop);