aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/windfarm_max6690_sensor.c
diff options
context:
space:
mode:
authorÉtienne Bersac <bersace@gmail.com>2008-04-29 01:39:55 -0400
committerPaul Mackerras <paulus@samba.org>2008-04-29 01:57:35 -0400
commit80ff974dba8cc432ab81676fc09d3c357cb11276 (patch)
treeb775a81b3ceca1a6df40fec751293d0398c7c36f /drivers/macintosh/windfarm_max6690_sensor.c
parent21e38dfee53a2159d14a24a3d2277ae757599efa (diff)
[POWERPC] windfarm: Add PowerMac 12,1 support
This implements a new driver named windfarm_pm121, which drives the fans on PowerMac 12,1 machines : iMac G5 iSight (rev C) 17" and 20". It's based on the windfarm_pm81 driver from Benjamin Herrenschmidt. This includes fixes from David Woodhouse correcting the names of some of the sensors. Signed-off-by: Étienne Bersac <bersace@gmail.com> Signed-off-by: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/macintosh/windfarm_max6690_sensor.c')
-rw-r--r--drivers/macintosh/windfarm_max6690_sensor.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c
index 5f03aab9fb5d..e207a90d6b27 100644
--- a/drivers/macintosh/windfarm_max6690_sensor.c
+++ b/drivers/macintosh/windfarm_max6690_sensor.c
@@ -77,18 +77,28 @@ static struct wf_sensor_ops wf_max6690_ops = {
77 .owner = THIS_MODULE, 77 .owner = THIS_MODULE,
78}; 78};
79 79
80static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr) 80static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr,
81 const char *loc)
81{ 82{
82 struct wf_6690_sensor *max; 83 struct wf_6690_sensor *max;
83 char *name = "backside-temp"; 84 char *name;
84 85
85 max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL); 86 max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL);
86 if (max == NULL) { 87 if (max == NULL) {
87 printk(KERN_ERR "windfarm: Couldn't create MAX6690 sensor %s: " 88 printk(KERN_ERR "windfarm: Couldn't create MAX6690 sensor %s: "
88 "no memory\n", name); 89 "no memory\n", loc);
89 return; 90 return;
90 } 91 }
91 92
93 if (!strcmp(loc, "BACKSIDE"))
94 name = "backside-temp";
95 else if (!strcmp(loc, "NB Ambient"))
96 name = "north-bridge-temp";
97 else if (!strcmp(loc, "GPU Ambient"))
98 name = "gpu-temp";
99 else
100 goto fail;
101
92 max->sens.ops = &wf_max6690_ops; 102 max->sens.ops = &wf_max6690_ops;
93 max->sens.name = name; 103 max->sens.name = name;
94 max->i2c.addr = addr >> 1; 104 max->i2c.addr = addr >> 1;
@@ -138,9 +148,7 @@ static int wf_max6690_attach(struct i2c_adapter *adapter)
138 if (loc == NULL || addr == 0) 148 if (loc == NULL || addr == 0)
139 continue; 149 continue;
140 printk("found max6690, loc=%s addr=0x%02x\n", loc, addr); 150 printk("found max6690, loc=%s addr=0x%02x\n", loc, addr);
141 if (strcmp(loc, "BACKSIDE")) 151 wf_max6690_create(adapter, addr, loc);
142 continue;
143 wf_max6690_create(adapter, addr);
144 } 152 }
145 153
146 return 0; 154 return 0;