Source
x
show_case_temperature( struct device *dev, struct device_attribute *attr, char *buf )
/*
* Creation Date: <2003/03/14 20:54:13 samuel>
* Time-stamp: <2004/03/20 14:20:59 samuel>
*
* <therm_windtunnel.c>
*
* The G4 "windtunnel" has a single fan controlled by an
* ADM1030 fan controller and a DS1775 thermostat.
*
* The fan controller is equipped with a temperature sensor
* which measures the case temperature. The DS1775 sensor
* measures the CPU temperature. This driver tunes the
* behavior of the fan. It is based upon empirical observations
* of the 'AppleFan' driver under Mac OS X.
*
* WARNING: This driver has only been testen on Apple's
* 1.25 MHz Dual G4 (March 03). It is tuned for a CPU
* temperature around 57 C.
*
* Copyright (C) 2003, 2004 Samuel Rydh (samuel@ibrium.se)
*
* Loosely based upon 'thermostat.c' written by Benjamin Herrenschmidt
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation
*
*/
/* continuously log temperature */
static struct {
volatile int running;
struct task_struct *poll_task;
struct mutex lock;
struct platform_device *of_dev;
struct i2c_client *thermostat;
struct i2c_client *fan;
int overheat_temp; /* 100% fan at this temp */
int overheat_hyst;
int temp;
int casetemp;
int fan_level; /* active fan_table setting */
int downind;
int upind;
int r0, r1, r20, r23, r25; /* saved register */
} x;
static struct {
int fan_down_setting;
int temp;
int fan_up_setting;
} fan_table[] = {
{ 11, T(0,0), 11 }, /* min fan */
{ 11, T(55,0), 11 },
{ 6, T(55,3), 11 },
{ 7, T(56,0), 11 },
{ 8, T(57,0), 8 },
{ 7, T(58,3), 7 },
{ 6, T(58,8), 6 },
{ 5, T(59,2), 5 },
{ 4, T(59,6), 4 },
{ 3, T(59,9), 3 },
{ 2, T(60,1), 2 },
{ 1, 0xfffff, 1 } /* on fire */
};
static void