2 * Windfarm PowerMac thermal control. iMac G5 iSight
4 * (c) Copyright 2007 Étienne Bersac <bersace@gmail.com>
6 * Bits & pieces from windfarm_pm81.c by (c) Copyright 2005 Benjamin
7 * Herrenschmidt, IBM Corp. <benh@kernel.crashing.org>
9 * Released under the term of the GNU GPL v2.
17 * The algorithm used is the PID control algorithm, used the same way
18 * the published Darwin code does, using the same values that are
19 * present in the Darwin 8.10 snapshot property lists (note however
20 * that none of the code has been re-used, it's a complete
23 * There is two models using PowerMac12,1. Model 2 is iMac G5 iSight
24 * 17" while Model 3 is iMac G5 20". They do have both the same
25 * controls with a tiny difference. The control-ids of hard-drive-fan
26 * and cpu-fan is swapped.
31 * controls have a target correction calculated as :
33 * new_min = ((((average_power * slope) >> 16) + offset) >> 16) + min_value
34 * new_value = max(new_value, max(new_min, 0))
36 * OD Fan control correction.
46 * HD Fan control correction.
56 * CPU Fan control correction.
67 * Target rubber-banding :
69 * Some controls have a target correction which depends on another
70 * control value. The correction is computed in the following way :
72 * new_min = ref_value * slope + offset
74 * ref_value is the value of the reference control. If new_min is
75 * greater than 0, then we correct the target value using :
77 * new_target = max (new_target, new_min >> 16)
82 * ref : optical-drive-fan
87 * control : optical-drive-fan
88 * ref : hard-drive-fan
93 * In order to have the moste efficient correction with those
94 * dependencies, we must trigger HD loop before OD loop before CPU
98 * The various control loops found in Darwin config file are:
100 * HD Fan control loop.
103 * control : hard-drive-fan
104 * sensor : hard-drive-temp
105 * PID params : G_d = 0x00000000
108 * History = 2 entries
109 * Input target = 0x370000
113 * control : hard-drive-fan
114 * sensor : hard-drive-temp
115 * PID params : G_d = 0x00000000
118 * History = 2 entries
119 * Input target = 0x370000
122 * OD Fan control loop.
125 * control : optical-drive-fan
126 * sensor : optical-drive-temp
127 * PID params : G_d = 0x00000000
130 * History = 2 entries
131 * Input target = 0x320000
135 * control : optical-drive-fan
136 * sensor : optical-drive-temp
137 * PID params : G_d = 0x00000000
140 * History = 2 entries
141 * Input target = 0x320000
144 * GPU Fan control loop.
147 * control : hard-drive-fan
149 * PID params : G_d = 0x00000000
152 * History = 2 entries
153 * Input target = 0x5A0000
159 * PID params : G_d = 0x00000000
162 * History = 2 entries
163 * Input target = 0x500000
166 * KODIAK (aka northbridge) Fan control loop.
169 * control : optical-drive-fan
170 * sensor : north-bridge-temp
171 * PID params : G_d = 0x00000000
174 * History = 2 entries
175 * Input target = 0x550000
179 * control : hard-drive-fan
180 * sensor : north-bridge-temp
181 * PID params : G_d = 0x00000000
184 * History = 2 entries
185 * Input target = 0x550000
188 * CPU Fan control loop.
191 * sensors : cpu-temp, cpu-power
192 * PID params : from SDB partition
195 * CPU Slew control loop.
197 * control : cpufreq-clamp
204 #include <linux/types.h>
205 #include <linux/errno.h>
206 #include <linux/kernel.h>
207 #include <linux/delay.h>
208 #include <linux/slab.h>
209 #include <linux/init.h>
210 #include <linux/spinlock.h>
211 #include <linux/wait.h>
212 #include <linux/kmod.h>
213 #include <linux/device.h>
214 #include <linux/platform_device.h>
215 #include <asm/prom.h>
216 #include <asm/machdep.h>
218 #include <asm/sections.h>
221 #include "windfarm.h"
222 #include "windfarm_pid.h"
224 #define VERSION "0.3"
226 static int pm121_mach_model
; /* machine model id */
228 /* Controls & sensors */
229 static struct wf_sensor
*sensor_cpu_power
;
230 static struct wf_sensor
*sensor_cpu_temp
;
231 static struct wf_sensor
*sensor_cpu_voltage
;
232 static struct wf_sensor
*sensor_cpu_current
;
233 static struct wf_sensor
*sensor_gpu_temp
;
234 static struct wf_sensor
*sensor_north_bridge_temp
;
235 static struct wf_sensor
*sensor_hard_drive_temp
;
236 static struct wf_sensor
*sensor_optical_drive_temp
;
237 static struct wf_sensor
*sensor_incoming_air_temp
; /* unused ! */
246 static struct wf_control
*controls
[N_CONTROLS
] = {};
248 /* Set to kick the control loop into life */
249 static int pm121_all_controls_ok
, pm121_all_sensors_ok
;
250 static bool pm121_started
;
253 FAILURE_FAN
= 1 << 0,
254 FAILURE_SENSOR
= 1 << 1,
255 FAILURE_OVERTEMP
= 1 << 2
258 /* All sys loops. Note the HD before the OD loop in order to have it
261 LOOP_GPU
, /* control = hd or cpu, but luckily,
263 LOOP_HD
, /* control = hd */
264 LOOP_KODIAK
, /* control = hd or od */
265 LOOP_OD
, /* control = od */
269 static const char *loop_names
[N_LOOPS
] = {
276 #define PM121_NUM_CONFIGS 2
278 static unsigned int pm121_failure_state
;
279 static int pm121_readjust
, pm121_skipping
;
280 static bool pm121_overtemp
;
281 static s32 average_power
;
283 struct pm121_correction
{
288 static struct pm121_correction corrections
[N_CONTROLS
][PM121_NUM_CONFIGS
] = {
292 { .offset
= -19563152,
296 { .offset
= -15650652,
303 { .offset
= -15650652,
307 { .offset
= -19563152,
314 { .offset
= -25431900,
318 { .offset
= -15650652,
322 /* CPUFREQ has no correction (and is not implemented at all) */
325 struct pm121_connection
{
326 unsigned int control_id
;
328 struct pm121_correction correction
;
331 static struct pm121_connection pm121_connections
[] = {
333 { .control_id
= FAN_CPU
,
335 { .offset
= -32768000,
340 { .control_id
= FAN_OD
,
342 { .offset
= -32768000,
348 /* pointer to the current model connection */
349 static struct pm121_connection
*pm121_connection
;
352 * ****** System Fans Control Loop ******
356 /* Since each loop handles only one control and we want to avoid
357 * writing virtual control, we store the control correction with the
358 * loop params. Some data are not set, there are common to all loop
359 * and thus, hardcoded.
361 struct pm121_sys_param
{
362 /* purely informative since we use mach_model-2 as index */
364 struct wf_sensor
**sensor
; /* use sensor_id instead ? */
366 unsigned int control_id
;
369 static struct pm121_sys_param
370 pm121_sys_all_params
[N_LOOPS
][PM121_NUM_CONFIGS
] = {
371 /* GPU Fan control loop */
374 .sensor
= &sensor_gpu_temp
,
377 .control_id
= FAN_HD
,
380 .sensor
= &sensor_gpu_temp
,
383 .control_id
= FAN_CPU
,
386 /* HD Fan control loop */
389 .sensor
= &sensor_hard_drive_temp
,
392 .control_id
= FAN_HD
,
395 .sensor
= &sensor_hard_drive_temp
,
398 .control_id
= FAN_HD
,
401 /* KODIAK Fan control loop */
404 .sensor
= &sensor_north_bridge_temp
,
407 .control_id
= FAN_OD
,
410 .sensor
= &sensor_north_bridge_temp
,
413 .control_id
= FAN_HD
,
416 /* OD Fan control loop */
419 .sensor
= &sensor_optical_drive_temp
,
422 .control_id
= FAN_OD
,
425 .sensor
= &sensor_optical_drive_temp
,
428 .control_id
= FAN_OD
,
433 /* the hardcoded values */
434 #define PM121_SYS_GD 0x00000000
435 #define PM121_SYS_GR 0x00019999
436 #define PM121_SYS_HISTORY_SIZE 2
437 #define PM121_SYS_INTERVAL 5
439 /* State data used by the system fans control loop
441 struct pm121_sys_state
{
444 struct wf_pid_state pid
;
447 struct pm121_sys_state
*pm121_sys_state
[N_LOOPS
] = {};
450 * ****** CPU Fans Control Loop ******
454 #define PM121_CPU_INTERVAL 1
456 /* State data used by the cpu fans control loop
458 struct pm121_cpu_state
{
461 struct wf_cpu_pid_state pid
;
464 static struct pm121_cpu_state
*pm121_cpu_state
;
469 * ***** Implementation *****
473 /* correction the value using the output-low-bound correction algo */
474 static s32
pm121_correct(s32 new_setpoint
,
475 unsigned int control_id
,
479 struct pm121_correction
*correction
;
480 correction
= &corrections
[control_id
][pm121_mach_model
- 2];
482 new_min
= (average_power
* correction
->slope
) >> 16;
483 new_min
+= correction
->offset
;
484 new_min
= (new_min
>> 16) + min
;
486 return max3(new_setpoint
, new_min
, 0);
489 static s32
pm121_connect(unsigned int control_id
, s32 setpoint
)
491 s32 new_min
, value
, new_setpoint
;
493 if (pm121_connection
->control_id
== control_id
) {
494 controls
[control_id
]->ops
->get_value(controls
[control_id
],
496 new_min
= value
* pm121_connection
->correction
.slope
;
497 new_min
+= pm121_connection
->correction
.offset
;
499 new_setpoint
= max(setpoint
, (new_min
>> 16));
500 if (new_setpoint
!= setpoint
) {
501 pr_debug("pm121: %s depending on %s, "
502 "corrected from %d to %d RPM\n",
503 controls
[control_id
]->name
,
504 controls
[pm121_connection
->ref_id
]->name
,
505 (int) setpoint
, (int) new_setpoint
);
508 new_setpoint
= setpoint
;
512 new_setpoint
= setpoint
;
518 static void pm121_create_sys_fans(int loop_id
)
520 struct pm121_sys_param
*param
= NULL
;
521 struct wf_pid_param pid_param
;
522 struct wf_control
*control
= NULL
;
525 /* First, locate the params for this model */
526 for (i
= 0; i
< PM121_NUM_CONFIGS
; i
++) {
527 if (pm121_sys_all_params
[loop_id
][i
].model_id
== pm121_mach_model
) {
528 param
= &(pm121_sys_all_params
[loop_id
][i
]);
533 /* No params found, put fans to max */
535 printk(KERN_WARNING
"pm121: %s fan config not found "
536 " for this machine model\n",
537 loop_names
[loop_id
]);
541 control
= controls
[param
->control_id
];
543 /* Alloc & initialize state */
544 pm121_sys_state
[loop_id
] = kmalloc(sizeof(struct pm121_sys_state
),
546 if (pm121_sys_state
[loop_id
] == NULL
) {
547 printk(KERN_WARNING
"pm121: Memory allocation error\n");
550 pm121_sys_state
[loop_id
]->ticks
= 1;
552 /* Fill PID params */
553 pid_param
.gd
= PM121_SYS_GD
;
554 pid_param
.gp
= param
->gp
;
555 pid_param
.gr
= PM121_SYS_GR
;
556 pid_param
.interval
= PM121_SYS_INTERVAL
;
557 pid_param
.history_len
= PM121_SYS_HISTORY_SIZE
;
558 pid_param
.itarget
= param
->itarget
;
561 pid_param
.min
= control
->ops
->get_min(control
);
562 pid_param
.max
= control
->ops
->get_max(control
);
565 * This is probably not the right!?
566 * Perhaps goto fail if control == NULL above?
572 wf_pid_init(&pm121_sys_state
[loop_id
]->pid
, &pid_param
);
574 pr_debug("pm121: %s Fan control loop initialized.\n"
575 " itarged=%d.%03d, min=%d RPM, max=%d RPM\n",
576 loop_names
[loop_id
], FIX32TOPRINT(pid_param
.itarget
),
577 pid_param
.min
, pid_param
.max
);
581 /* note that this is not optimal since another loop may still
582 control the same control */
583 printk(KERN_WARNING
"pm121: failed to set up %s loop "
584 "setting \"%s\" to max speed.\n",
585 loop_names
[loop_id
], control
? control
->name
: "uninitialized value");
588 wf_control_set_max(control
);
591 static void pm121_sys_fans_tick(int loop_id
)
593 struct pm121_sys_param
*param
;
594 struct pm121_sys_state
*st
;
595 struct wf_sensor
*sensor
;
596 struct wf_control
*control
;
597 s32 temp
, new_setpoint
;
600 param
= &(pm121_sys_all_params
[loop_id
][pm121_mach_model
-2]);
601 st
= pm121_sys_state
[loop_id
];
602 sensor
= *(param
->sensor
);
603 control
= controls
[param
->control_id
];
605 if (--st
->ticks
!= 0) {
610 st
->ticks
= PM121_SYS_INTERVAL
;
612 rc
= sensor
->ops
->get_value(sensor
, &temp
);
614 printk(KERN_WARNING
"windfarm: %s sensor error %d\n",
616 pm121_failure_state
|= FAILURE_SENSOR
;
620 pr_debug("pm121: %s Fan tick ! %s: %d.%03d\n",
621 loop_names
[loop_id
], sensor
->name
,
624 new_setpoint
= wf_pid_run(&st
->pid
, temp
);
627 new_setpoint
= pm121_correct(new_setpoint
,
630 /* linked corretion */
631 new_setpoint
= pm121_connect(param
->control_id
, new_setpoint
);
633 if (new_setpoint
== st
->setpoint
)
635 st
->setpoint
= new_setpoint
;
636 pr_debug("pm121: %s corrected setpoint: %d RPM\n",
637 control
->name
, (int)new_setpoint
);
639 if (control
&& pm121_failure_state
== 0) {
640 rc
= control
->ops
->set_value(control
, st
->setpoint
);
642 printk(KERN_WARNING
"windfarm: %s fan error %d\n",
644 pm121_failure_state
|= FAILURE_FAN
;
651 static void pm121_create_cpu_fans(void)
653 struct wf_cpu_pid_param pid_param
;
654 const struct smu_sdbp_header
*hdr
;
655 struct smu_sdbp_cpupiddata
*piddata
;
656 struct smu_sdbp_fvt
*fvt
;
657 struct wf_control
*fan_cpu
;
658 s32 tmax
, tdelta
, maxpow
, powadj
;
660 fan_cpu
= controls
[FAN_CPU
];
662 /* First, locate the PID params in SMU SBD */
663 hdr
= smu_get_sdb_partition(SMU_SDB_CPUPIDDATA_ID
, NULL
);
665 printk(KERN_WARNING
"pm121: CPU PID fan config not found.\n");
668 piddata
= (struct smu_sdbp_cpupiddata
*)&hdr
[1];
670 /* Get the FVT params for operating point 0 (the only supported one
671 * for now) in order to get tmax
673 hdr
= smu_get_sdb_partition(SMU_SDB_FVT_ID
, NULL
);
675 fvt
= (struct smu_sdbp_fvt
*)&hdr
[1];
676 tmax
= ((s32
)fvt
->maxtemp
) << 16;
678 tmax
= 0x5e0000; /* 94 degree default */
680 /* Alloc & initialize state */
681 pm121_cpu_state
= kmalloc(sizeof(struct pm121_cpu_state
),
683 if (pm121_cpu_state
== NULL
)
685 pm121_cpu_state
->ticks
= 1;
687 /* Fill PID params */
688 pid_param
.interval
= PM121_CPU_INTERVAL
;
689 pid_param
.history_len
= piddata
->history_len
;
690 if (pid_param
.history_len
> WF_CPU_PID_MAX_HISTORY
) {
691 printk(KERN_WARNING
"pm121: History size overflow on "
692 "CPU control loop (%d)\n", piddata
->history_len
);
693 pid_param
.history_len
= WF_CPU_PID_MAX_HISTORY
;
695 pid_param
.gd
= piddata
->gd
;
696 pid_param
.gp
= piddata
->gp
;
697 pid_param
.gr
= piddata
->gr
/ pid_param
.history_len
;
699 tdelta
= ((s32
)piddata
->target_temp_delta
) << 16;
700 maxpow
= ((s32
)piddata
->max_power
) << 16;
701 powadj
= ((s32
)piddata
->power_adj
) << 16;
703 pid_param
.tmax
= tmax
;
704 pid_param
.ttarget
= tmax
- tdelta
;
705 pid_param
.pmaxadj
= maxpow
- powadj
;
707 pid_param
.min
= fan_cpu
->ops
->get_min(fan_cpu
);
708 pid_param
.max
= fan_cpu
->ops
->get_max(fan_cpu
);
710 wf_cpu_pid_init(&pm121_cpu_state
->pid
, &pid_param
);
712 pr_debug("pm121: CPU Fan control initialized.\n");
713 pr_debug(" ttarget=%d.%03d, tmax=%d.%03d, min=%d RPM, max=%d RPM,\n",
714 FIX32TOPRINT(pid_param
.ttarget
), FIX32TOPRINT(pid_param
.tmax
),
715 pid_param
.min
, pid_param
.max
);
720 printk(KERN_WARNING
"pm121: CPU fan config not found, max fan speed\n");
722 if (controls
[CPUFREQ
])
723 wf_control_set_max(controls
[CPUFREQ
]);
725 wf_control_set_max(fan_cpu
);
729 static void pm121_cpu_fans_tick(struct pm121_cpu_state
*st
)
731 s32 new_setpoint
, temp
, power
;
732 struct wf_control
*fan_cpu
= NULL
;
735 if (--st
->ticks
!= 0) {
740 st
->ticks
= PM121_CPU_INTERVAL
;
742 fan_cpu
= controls
[FAN_CPU
];
744 rc
= sensor_cpu_temp
->ops
->get_value(sensor_cpu_temp
, &temp
);
746 printk(KERN_WARNING
"pm121: CPU temp sensor error %d\n",
748 pm121_failure_state
|= FAILURE_SENSOR
;
752 rc
= sensor_cpu_power
->ops
->get_value(sensor_cpu_power
, &power
);
754 printk(KERN_WARNING
"pm121: CPU power sensor error %d\n",
756 pm121_failure_state
|= FAILURE_SENSOR
;
760 pr_debug("pm121: CPU Fans tick ! CPU temp: %d.%03d°C, power: %d.%03d\n",
761 FIX32TOPRINT(temp
), FIX32TOPRINT(power
));
763 if (temp
> st
->pid
.param
.tmax
)
764 pm121_failure_state
|= FAILURE_OVERTEMP
;
766 new_setpoint
= wf_cpu_pid_run(&st
->pid
, power
, temp
);
769 new_setpoint
= pm121_correct(new_setpoint
,
773 /* connected correction */
774 new_setpoint
= pm121_connect(FAN_CPU
, new_setpoint
);
776 if (st
->setpoint
== new_setpoint
)
778 st
->setpoint
= new_setpoint
;
779 pr_debug("pm121: CPU corrected setpoint: %d RPM\n", (int)new_setpoint
);
782 if (fan_cpu
&& pm121_failure_state
== 0) {
783 rc
= fan_cpu
->ops
->set_value(fan_cpu
, st
->setpoint
);
785 printk(KERN_WARNING
"pm121: %s fan error %d\n",
787 pm121_failure_state
|= FAILURE_FAN
;
793 * ****** Common ******
797 static void pm121_tick(void)
799 unsigned int last_failure
= pm121_failure_state
;
800 unsigned int new_failure
;
804 if (!pm121_started
) {
805 pr_debug("pm121: creating control loops !\n");
806 for (i
= 0; i
< N_LOOPS
; i
++)
807 pm121_create_sys_fans(i
);
809 pm121_create_cpu_fans();
810 pm121_started
= true;
814 if (pm121_skipping
&& --pm121_skipping
)
817 /* compute average power */
819 for (i
= 0; i
< pm121_cpu_state
->pid
.param
.history_len
; i
++)
820 total_power
+= pm121_cpu_state
->pid
.powers
[i
];
822 average_power
= total_power
/ pm121_cpu_state
->pid
.param
.history_len
;
825 pm121_failure_state
= 0;
826 for (i
= 0 ; i
< N_LOOPS
; i
++) {
827 if (pm121_sys_state
[i
])
828 pm121_sys_fans_tick(i
);
832 pm121_cpu_fans_tick(pm121_cpu_state
);
835 new_failure
= pm121_failure_state
& ~last_failure
;
837 /* If entering failure mode, clamp cpufreq and ramp all
838 * fans to full speed.
840 if (pm121_failure_state
&& !last_failure
) {
841 for (i
= 0; i
< N_CONTROLS
; i
++) {
843 wf_control_set_max(controls
[i
]);
847 /* If leaving failure mode, unclamp cpufreq and readjust
848 * all fans on next iteration
850 if (!pm121_failure_state
&& last_failure
) {
851 if (controls
[CPUFREQ
])
852 wf_control_set_min(controls
[CPUFREQ
]);
856 /* Overtemp condition detected, notify and start skipping a couple
857 * ticks to let the temperature go down
859 if (new_failure
& FAILURE_OVERTEMP
) {
862 pm121_overtemp
= true;
865 /* We only clear the overtemp condition if overtemp is cleared
866 * _and_ no other failure is present. Since a sensor error will
867 * clear the overtemp condition (can't measure temperature) at
868 * the control loop levels, but we don't want to keep it clear
871 if (!pm121_failure_state
&& pm121_overtemp
) {
873 pm121_overtemp
= false;
878 static struct wf_control
* pm121_register_control(struct wf_control
*ct
,
882 if (controls
[id
] == NULL
&& !strcmp(ct
->name
, match
)) {
883 if (wf_get_control(ct
) == 0)
889 static void pm121_new_control(struct wf_control
*ct
)
893 if (pm121_all_controls_ok
)
896 all
= pm121_register_control(ct
, "optical-drive-fan", FAN_OD
) && all
;
897 all
= pm121_register_control(ct
, "hard-drive-fan", FAN_HD
) && all
;
898 all
= pm121_register_control(ct
, "cpu-fan", FAN_CPU
) && all
;
899 all
= pm121_register_control(ct
, "cpufreq-clamp", CPUFREQ
) && all
;
902 pm121_all_controls_ok
= 1;
908 static struct wf_sensor
* pm121_register_sensor(struct wf_sensor
*sensor
,
910 struct wf_sensor
**var
)
912 if (*var
== NULL
&& !strcmp(sensor
->name
, match
)) {
913 if (wf_get_sensor(sensor
) == 0)
919 static void pm121_new_sensor(struct wf_sensor
*sr
)
923 if (pm121_all_sensors_ok
)
926 all
= pm121_register_sensor(sr
, "cpu-temp",
927 &sensor_cpu_temp
) && all
;
928 all
= pm121_register_sensor(sr
, "cpu-current",
929 &sensor_cpu_current
) && all
;
930 all
= pm121_register_sensor(sr
, "cpu-voltage",
931 &sensor_cpu_voltage
) && all
;
932 all
= pm121_register_sensor(sr
, "cpu-power",
933 &sensor_cpu_power
) && all
;
934 all
= pm121_register_sensor(sr
, "hard-drive-temp",
935 &sensor_hard_drive_temp
) && all
;
936 all
= pm121_register_sensor(sr
, "optical-drive-temp",
937 &sensor_optical_drive_temp
) && all
;
938 all
= pm121_register_sensor(sr
, "incoming-air-temp",
939 &sensor_incoming_air_temp
) && all
;
940 all
= pm121_register_sensor(sr
, "north-bridge-temp",
941 &sensor_north_bridge_temp
) && all
;
942 all
= pm121_register_sensor(sr
, "gpu-temp",
943 &sensor_gpu_temp
) && all
;
946 pm121_all_sensors_ok
= 1;
951 static int pm121_notify(struct notifier_block
*self
,
952 unsigned long event
, void *data
)
955 case WF_EVENT_NEW_CONTROL
:
956 pr_debug("pm121: new control %s detected\n",
957 ((struct wf_control
*)data
)->name
);
958 pm121_new_control(data
);
960 case WF_EVENT_NEW_SENSOR
:
961 pr_debug("pm121: new sensor %s detected\n",
962 ((struct wf_sensor
*)data
)->name
);
963 pm121_new_sensor(data
);
966 if (pm121_all_controls_ok
&& pm121_all_sensors_ok
)
974 static struct notifier_block pm121_events
= {
975 .notifier_call
= pm121_notify
,
978 static int pm121_init_pm(void)
980 const struct smu_sdbp_header
*hdr
;
982 hdr
= smu_get_sdb_partition(SMU_SDB_SENSORTREE_ID
, NULL
);
984 struct smu_sdbp_sensortree
*st
=
985 (struct smu_sdbp_sensortree
*)&hdr
[1];
986 pm121_mach_model
= st
->model_id
;
989 pm121_connection
= &pm121_connections
[pm121_mach_model
- 2];
991 printk(KERN_INFO
"pm121: Initializing for iMac G5 iSight model ID %d\n",
998 static int pm121_probe(struct platform_device
*ddev
)
1000 wf_register_client(&pm121_events
);
1005 static int pm121_remove(struct platform_device
*ddev
)
1007 wf_unregister_client(&pm121_events
);
1011 static struct platform_driver pm121_driver
= {
1012 .probe
= pm121_probe
,
1013 .remove
= pm121_remove
,
1016 .bus
= &platform_bus_type
,
1021 static int __init
pm121_init(void)
1025 if (of_machine_is_compatible("PowerMac12,1"))
1026 rc
= pm121_init_pm();
1029 request_module("windfarm_smu_controls");
1030 request_module("windfarm_smu_sensors");
1031 request_module("windfarm_smu_sat");
1032 request_module("windfarm_lm75_sensor");
1033 request_module("windfarm_max6690_sensor");
1034 request_module("windfarm_cpufreq_clamp");
1035 platform_driver_register(&pm121_driver
);
1041 static void __exit
pm121_exit(void)
1044 platform_driver_unregister(&pm121_driver
);
1048 module_init(pm121_init
);
1049 module_exit(pm121_exit
);
1051 MODULE_AUTHOR("Étienne Bersac <bersace@gmail.com>");
1052 MODULE_DESCRIPTION("Thermal control logic for iMac G5 (iSight)");
1053 MODULE_LICENSE("GPL");