[PATCH] ppc64: Thermal control for SMU based machines

Nish Aravamudan nish.aravamudan at gmail.com
Wed Oct 5 02:44:10 EST 2005


On 10/3/05, Benjamin Herrenschmidt <benh at kernel.crashing.org> wrote:
> This is the actual thermal control support for PowerMac8,1, PowerMac8,2
> and PowerMac9,1 machines (SMU based), that is iMac G5 and single CPU desktop.
> It requires CPUFREQ to be enabled to properly deal with overtemp conditions.
> The new thermal control code implements a new framework (nicknamed "windfarm")
> to which I expect to port the old G5 thermal control, and possibly some of the
> powerbook thermal control drivers as well in the future.

<snip>

> --- /dev/null   1970-01-01 00:00:00.000000000 +0000
> +++ linux-work/drivers/macintosh/windfarm_core.c        2005-10-04 15:17:33.000000000 +1000

<snip>

> +static int wf_thread_func(void *data)
> +{
> +       unsigned long next, delay;
> +
> +       next = jiffies;
> +
> +       DBG("wf: thread started\n");
> +
> +       while(!kthread_should_stop()) {
> +               try_to_freeze();
> +
> +               if (time_after_eq(jiffies, next)) {
> +                       wf_notify(WF_EVENT_TICK, NULL);
> +                       if (wf_overtemp) {
> +                               wf_overtemp_counter++;
> +                               /* 10 seconds overtemp, notify userland */
> +                               if (wf_overtemp_counter > 10)
> +                                       wf_critical_overtemp();
> +                               /* 30 seconds, shutdown */
> +                               if (wf_overtemp_counter > 30) {
> +                                       printk(KERN_ERR "windfarm: Overtemp "
> +                                              "for more than 30"
> +                                              " seconds, shutting down\n");
> +                                       machine_power_off();
> +                               }
> +                       }
> +                       next += HZ;
> +               }
> +
> +               set_current_state(TASK_INTERRUPTIBLE);
> +               delay = next - jiffies;
> +               if (delay <= HZ)
> +                       schedule_timeout(delay);
> +               set_current_state(TASK_RUNNING);

This can be schedule_timeout_interruptible(delay); and then you can
get rid of the set_current_state(TASK_RUNNING);

Thanks,
NIsh



More information about the Linuxppc64-dev mailing list