aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/windfarm_pm91.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-04-18 18:16:51 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2012-04-30 01:37:20 -0400
commit33e6820b767a5bfa4a0d579da6ee4568a2b1e730 (patch)
tree341a29222e9fb18fe4ce6f9c9346bbc4190584e3 /drivers/macintosh/windfarm_pm91.c
parentea5c64b06743b505e0eb4e6caa1810fe685c9559 (diff)
powerpc/windfarm: Add useful accessors
Makes the code more readable Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/macintosh/windfarm_pm91.c')
-rw-r--r--drivers/macintosh/windfarm_pm91.c33
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/macintosh/windfarm_pm91.c b/drivers/macintosh/windfarm_pm91.c
index a9430ed4f36c..e18002bcc1c3 100644
--- a/drivers/macintosh/windfarm_pm91.c
+++ b/drivers/macintosh/windfarm_pm91.c
@@ -192,8 +192,8 @@ static void wf_smu_create_cpu_fans(void)
192 pid_param.ttarget = tmax - tdelta; 192 pid_param.ttarget = tmax - tdelta;
193 pid_param.pmaxadj = maxpow - powadj; 193 pid_param.pmaxadj = maxpow - powadj;
194 194
195 pid_param.min = fan_cpu_main->ops->get_min(fan_cpu_main); 195 pid_param.min = wf_control_get_min(fan_cpu_main);
196 pid_param.max = fan_cpu_main->ops->get_max(fan_cpu_main); 196 pid_param.max = wf_control_get_max(fan_cpu_main);
197 197
198 wf_cpu_pid_init(&wf_smu_cpu_fans->pid, &pid_param); 198 wf_cpu_pid_init(&wf_smu_cpu_fans->pid, &pid_param);
199 199
@@ -226,7 +226,7 @@ static void wf_smu_cpu_fans_tick(struct wf_smu_cpu_fans_state *st)
226 } 226 }
227 st->ticks = WF_SMU_CPU_FANS_INTERVAL; 227 st->ticks = WF_SMU_CPU_FANS_INTERVAL;
228 228
229 rc = sensor_cpu_temp->ops->get_value(sensor_cpu_temp, &temp); 229 rc = wf_sensor_get(sensor_cpu_temp, &temp);
230 if (rc) { 230 if (rc) {
231 printk(KERN_WARNING "windfarm: CPU temp sensor error %d\n", 231 printk(KERN_WARNING "windfarm: CPU temp sensor error %d\n",
232 rc); 232 rc);
@@ -234,7 +234,7 @@ static void wf_smu_cpu_fans_tick(struct wf_smu_cpu_fans_state *st)
234 return; 234 return;
235 } 235 }
236 236
237 rc = sensor_cpu_power->ops->get_value(sensor_cpu_power, &power); 237 rc = wf_sensor_get(&sensor_cpu_power, &power);
238 if (rc) { 238 if (rc) {
239 printk(KERN_WARNING "windfarm: CPU power sensor error %d\n", 239 printk(KERN_WARNING "windfarm: CPU power sensor error %d\n",
240 rc); 240 rc);
@@ -261,8 +261,7 @@ static void wf_smu_cpu_fans_tick(struct wf_smu_cpu_fans_state *st)
261 st->cpu_setpoint = new_setpoint; 261 st->cpu_setpoint = new_setpoint;
262 readjust: 262 readjust:
263 if (fan_cpu_main && wf_smu_failure_state == 0) { 263 if (fan_cpu_main && wf_smu_failure_state == 0) {
264 rc = fan_cpu_main->ops->set_value(fan_cpu_main, 264 rc = wf_control_set(fan_cpu_main, st->cpu_setpoint);
265 st->cpu_setpoint);
266 if (rc) { 265 if (rc) {
267 printk(KERN_WARNING "windfarm: CPU main fan" 266 printk(KERN_WARNING "windfarm: CPU main fan"
268 " error %d\n", rc); 267 " error %d\n", rc);
@@ -270,8 +269,7 @@ static void wf_smu_cpu_fans_tick(struct wf_smu_cpu_fans_state *st)
270 } 269 }
271 } 270 }
272 if (fan_cpu_second && wf_smu_failure_state == 0) { 271 if (fan_cpu_second && wf_smu_failure_state == 0) {
273 rc = fan_cpu_second->ops->set_value(fan_cpu_second, 272 rc = wf_control_set(fan_cpu_second, st->cpu_setpoint);
274 st->cpu_setpoint);
275 if (rc) { 273 if (rc) {
276 printk(KERN_WARNING "windfarm: CPU second fan" 274 printk(KERN_WARNING "windfarm: CPU second fan"
277 " error %d\n", rc); 275 " error %d\n", rc);
@@ -279,8 +277,7 @@ static void wf_smu_cpu_fans_tick(struct wf_smu_cpu_fans_state *st)
279 } 277 }
280 } 278 }
281 if (fan_cpu_third && wf_smu_failure_state == 0) { 279 if (fan_cpu_third && wf_smu_failure_state == 0) {
282 rc = fan_cpu_main->ops->set_value(fan_cpu_third, 280 rc = wf_control_set(fan_cpu_third, st->cpu_setpoint);
283 st->cpu_setpoint);
284 if (rc) { 281 if (rc) {
285 printk(KERN_WARNING "windfarm: CPU third fan" 282 printk(KERN_WARNING "windfarm: CPU third fan"
286 " error %d\n", rc); 283 " error %d\n", rc);
@@ -312,8 +309,8 @@ static void wf_smu_create_drive_fans(void)
312 309
313 /* Fill PID params */ 310 /* Fill PID params */
314 param.additive = (fan_hd->type == WF_CONTROL_RPM_FAN); 311 param.additive = (fan_hd->type == WF_CONTROL_RPM_FAN);
315 param.min = fan_hd->ops->get_min(fan_hd); 312 param.min = wf_control_get_min(fan_hd);
316 param.max = fan_hd->ops->get_max(fan_hd); 313 param.max = wf_control_get_max(fan_hd);
317 wf_pid_init(&wf_smu_drive_fans->pid, &param); 314 wf_pid_init(&wf_smu_drive_fans->pid, &param);
318 315
319 DBG("wf: Drive Fan control initialized.\n"); 316 DBG("wf: Drive Fan control initialized.\n");
@@ -338,7 +335,7 @@ static void wf_smu_drive_fans_tick(struct wf_smu_drive_fans_state *st)
338 } 335 }
339 st->ticks = st->pid.param.interval; 336 st->ticks = st->pid.param.interval;
340 337
341 rc = sensor_hd_temp->ops->get_value(sensor_hd_temp, &temp); 338 rc = wf_sensor_get(sensor_hd_temp, &temp);
342 if (rc) { 339 if (rc) {
343 printk(KERN_WARNING "windfarm: HD temp sensor error %d\n", 340 printk(KERN_WARNING "windfarm: HD temp sensor error %d\n",
344 rc); 341 rc);
@@ -361,7 +358,7 @@ static void wf_smu_drive_fans_tick(struct wf_smu_drive_fans_state *st)
361 st->setpoint = new_setpoint; 358 st->setpoint = new_setpoint;
362 readjust: 359 readjust:
363 if (fan_hd && wf_smu_failure_state == 0) { 360 if (fan_hd && wf_smu_failure_state == 0) {
364 rc = fan_hd->ops->set_value(fan_hd, st->setpoint); 361 rc = wf_control_set(fan_hd, st->setpoint);
365 if (rc) { 362 if (rc) {
366 printk(KERN_WARNING "windfarm: HD fan error %d\n", 363 printk(KERN_WARNING "windfarm: HD fan error %d\n",
367 rc); 364 rc);
@@ -393,8 +390,8 @@ static void wf_smu_create_slots_fans(void)
393 390
394 /* Fill PID params */ 391 /* Fill PID params */
395 param.additive = (fan_slots->type == WF_CONTROL_RPM_FAN); 392 param.additive = (fan_slots->type == WF_CONTROL_RPM_FAN);
396 param.min = fan_slots->ops->get_min(fan_slots); 393 param.min = wf_control_get_min(fan_slots);
397 param.max = fan_slots->ops->get_max(fan_slots); 394 param.max = wf_control_get_max(fan_slots);
398 wf_pid_init(&wf_smu_slots_fans->pid, &param); 395 wf_pid_init(&wf_smu_slots_fans->pid, &param);
399 396
400 DBG("wf: Slots Fan control initialized.\n"); 397 DBG("wf: Slots Fan control initialized.\n");
@@ -419,7 +416,7 @@ static void wf_smu_slots_fans_tick(struct wf_smu_slots_fans_state *st)
419 } 416 }
420 st->ticks = st->pid.param.interval; 417 st->ticks = st->pid.param.interval;
421 418
422 rc = sensor_slots_power->ops->get_value(sensor_slots_power, &power); 419 rc = wf_sensor_get(sensor_slots_power, &power);
423 if (rc) { 420 if (rc) {
424 printk(KERN_WARNING "windfarm: Slots power sensor error %d\n", 421 printk(KERN_WARNING "windfarm: Slots power sensor error %d\n",
425 rc); 422 rc);
@@ -444,7 +441,7 @@ static void wf_smu_slots_fans_tick(struct wf_smu_slots_fans_state *st)
444 st->setpoint = new_setpoint; 441 st->setpoint = new_setpoint;
445 readjust: 442 readjust:
446 if (fan_slots && wf_smu_failure_state == 0) { 443 if (fan_slots && wf_smu_failure_state == 0) {
447 rc = fan_slots->ops->set_value(fan_slots, st->setpoint); 444 rc = wf_control_set(fan_slots, st->setpoint);
448 if (rc) { 445 if (rc) {
449 printk(KERN_WARNING "windfarm: Slots fan error %d\n", 446 printk(KERN_WARNING "windfarm: Slots fan error %d\n",
450 rc); 447 rc);