aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/windfarm_core.c7
-rw-r--r--drivers/macintosh/windfarm_cpufreq_clamp.c8
-rw-r--r--drivers/macintosh/windfarm_lm75_sensor.c32
-rw-r--r--drivers/macintosh/windfarm_max6690_sensor.c25
-rw-r--r--drivers/macintosh/windfarm_pid.c4
-rw-r--r--drivers/macintosh/windfarm_pm112.c8
6 files changed, 65 insertions, 19 deletions
diff --git a/drivers/macintosh/windfarm_core.c b/drivers/macintosh/windfarm_core.c
index bb8d5efe19bf..6c0ba04bc57a 100644
--- a/drivers/macintosh/windfarm_core.c
+++ b/drivers/macintosh/windfarm_core.c
@@ -35,6 +35,8 @@
35#include <linux/platform_device.h> 35#include <linux/platform_device.h>
36#include <linux/mutex.h> 36#include <linux/mutex.h>
37 37
38#include <asm/prom.h>
39
38#include "windfarm.h" 40#include "windfarm.h"
39 41
40#define VERSION "0.2" 42#define VERSION "0.2"
@@ -465,6 +467,11 @@ static int __init windfarm_core_init(void)
465{ 467{
466 DBG("wf: core loaded\n"); 468 DBG("wf: core loaded\n");
467 469
470 /* Don't register on old machines that use therm_pm72 for now */
471 if (machine_is_compatible("PowerMac7,2") ||
472 machine_is_compatible("PowerMac7,3") ||
473 machine_is_compatible("RackMac3,1"))
474 return -ENODEV;
468 platform_device_register(&wf_platform_device); 475 platform_device_register(&wf_platform_device);
469 return 0; 476 return 0;
470} 477}
diff --git a/drivers/macintosh/windfarm_cpufreq_clamp.c b/drivers/macintosh/windfarm_cpufreq_clamp.c
index 607dbaca69c9..81337cd16e80 100644
--- a/drivers/macintosh/windfarm_cpufreq_clamp.c
+++ b/drivers/macintosh/windfarm_cpufreq_clamp.c
@@ -8,6 +8,8 @@
8#include <linux/wait.h> 8#include <linux/wait.h>
9#include <linux/cpufreq.h> 9#include <linux/cpufreq.h>
10 10
11#include <asm/prom.h>
12
11#include "windfarm.h" 13#include "windfarm.h"
12 14
13#define VERSION "0.3" 15#define VERSION "0.3"
@@ -74,6 +76,12 @@ static int __init wf_cpufreq_clamp_init(void)
74{ 76{
75 struct wf_control *clamp; 77 struct wf_control *clamp;
76 78
79 /* Don't register on old machines that use therm_pm72 for now */
80 if (machine_is_compatible("PowerMac7,2") ||
81 machine_is_compatible("PowerMac7,3") ||
82 machine_is_compatible("RackMac3,1"))
83 return -ENODEV;
84
77 clamp = kmalloc(sizeof(struct wf_control), GFP_KERNEL); 85 clamp = kmalloc(sizeof(struct wf_control), GFP_KERNEL);
78 if (clamp == NULL) 86 if (clamp == NULL)
79 return -ENOMEM; 87 return -ENOMEM;
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c
index 906d3ecae6e6..423bfa2432c0 100644
--- a/drivers/macintosh/windfarm_lm75_sensor.c
+++ b/drivers/macintosh/windfarm_lm75_sensor.c
@@ -25,7 +25,7 @@
25 25
26#include "windfarm.h" 26#include "windfarm.h"
27 27
28#define VERSION "0.1" 28#define VERSION "0.2"
29 29
30#undef DEBUG 30#undef DEBUG
31 31
@@ -113,6 +113,7 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
113 const char *loc) 113 const char *loc)
114{ 114{
115 struct wf_lm75_sensor *lm; 115 struct wf_lm75_sensor *lm;
116 int rc;
116 117
117 DBG("wf_lm75: creating %s device at address 0x%02x\n", 118 DBG("wf_lm75: creating %s device at address 0x%02x\n",
118 ds1775 ? "ds1775" : "lm75", addr); 119 ds1775 ? "ds1775" : "lm75", addr);
@@ -139,9 +140,11 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
139 lm->i2c.driver = &wf_lm75_driver; 140 lm->i2c.driver = &wf_lm75_driver;
140 strncpy(lm->i2c.name, lm->sens.name, I2C_NAME_SIZE-1); 141 strncpy(lm->i2c.name, lm->sens.name, I2C_NAME_SIZE-1);
141 142
142 if (i2c_attach_client(&lm->i2c)) { 143 rc = i2c_attach_client(&lm->i2c);
143 printk(KERN_ERR "windfarm: failed to attach %s %s to i2c\n", 144 if (rc) {
144 ds1775 ? "ds1775" : "lm75", lm->i2c.name); 145 printk(KERN_ERR "windfarm: failed to attach %s %s to i2c,"
146 " err %d\n", ds1775 ? "ds1775" : "lm75",
147 lm->i2c.name, rc);
145 goto fail; 148 goto fail;
146 } 149 }
147 150
@@ -175,16 +178,22 @@ static int wf_lm75_attach(struct i2c_adapter *adapter)
175 (dev = of_get_next_child(busnode, dev)) != NULL;) { 178 (dev = of_get_next_child(busnode, dev)) != NULL;) {
176 const char *loc = 179 const char *loc =
177 get_property(dev, "hwsensor-location", NULL); 180 get_property(dev, "hwsensor-location", NULL);
178 u32 *reg = (u32 *)get_property(dev, "reg", NULL); 181 u8 addr;
179 DBG(" dev: %s... (loc: %p, reg: %p)\n", dev->name, loc, reg); 182
180 if (loc == NULL || reg == NULL) 183 /* We must re-match the adapter in order to properly check
184 * the channel on multibus setups
185 */
186 if (!pmac_i2c_match_adapter(dev, adapter))
187 continue;
188 addr = pmac_i2c_get_dev_addr(dev);
189 if (loc == NULL || addr == 0)
181 continue; 190 continue;
182 /* real lm75 */ 191 /* real lm75 */
183 if (device_is_compatible(dev, "lm75")) 192 if (device_is_compatible(dev, "lm75"))
184 wf_lm75_create(adapter, *reg, 0, loc); 193 wf_lm75_create(adapter, addr, 0, loc);
185 /* ds1775 (compatible, better resolution */ 194 /* ds1775 (compatible, better resolution */
186 else if (device_is_compatible(dev, "ds1775")) 195 else if (device_is_compatible(dev, "ds1775"))
187 wf_lm75_create(adapter, *reg, 1, loc); 196 wf_lm75_create(adapter, addr, 1, loc);
188 } 197 }
189 return 0; 198 return 0;
190} 199}
@@ -206,6 +215,11 @@ static int wf_lm75_detach(struct i2c_client *client)
206 215
207static int __init wf_lm75_sensor_init(void) 216static int __init wf_lm75_sensor_init(void)
208{ 217{
218 /* Don't register on old machines that use therm_pm72 for now */
219 if (machine_is_compatible("PowerMac7,2") ||
220 machine_is_compatible("PowerMac7,3") ||
221 machine_is_compatible("RackMac3,1"))
222 return -ENODEV;
209 return i2c_add_driver(&wf_lm75_driver); 223 return i2c_add_driver(&wf_lm75_driver);
210} 224}
211 225
diff --git a/drivers/macintosh/windfarm_max6690_sensor.c b/drivers/macintosh/windfarm_max6690_sensor.c
index 5b9ad6ca7cba..8e99d408fddd 100644
--- a/drivers/macintosh/windfarm_max6690_sensor.c
+++ b/drivers/macintosh/windfarm_max6690_sensor.c
@@ -17,7 +17,7 @@
17 17
18#include "windfarm.h" 18#include "windfarm.h"
19 19
20#define VERSION "0.1" 20#define VERSION "0.2"
21 21
22/* This currently only exports the external temperature sensor, 22/* This currently only exports the external temperature sensor,
23 since that's all the control loops need. */ 23 since that's all the control loops need. */
@@ -81,7 +81,7 @@ static struct wf_sensor_ops wf_max6690_ops = {
81static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr) 81static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr)
82{ 82{
83 struct wf_6690_sensor *max; 83 struct wf_6690_sensor *max;
84 char *name = "u4-temp"; 84 char *name = "backside-temp";
85 85
86 max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL); 86 max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL);
87 if (max == NULL) { 87 if (max == NULL) {
@@ -118,7 +118,6 @@ static int wf_max6690_attach(struct i2c_adapter *adapter)
118 struct device_node *busnode, *dev = NULL; 118 struct device_node *busnode, *dev = NULL;
119 struct pmac_i2c_bus *bus; 119 struct pmac_i2c_bus *bus;
120 const char *loc; 120 const char *loc;
121 u32 *reg;
122 121
123 bus = pmac_i2c_adapter_to_bus(adapter); 122 bus = pmac_i2c_adapter_to_bus(adapter);
124 if (bus == NULL) 123 if (bus == NULL)
@@ -126,16 +125,23 @@ static int wf_max6690_attach(struct i2c_adapter *adapter)
126 busnode = pmac_i2c_get_bus_node(bus); 125 busnode = pmac_i2c_get_bus_node(bus);
127 126
128 while ((dev = of_get_next_child(busnode, dev)) != NULL) { 127 while ((dev = of_get_next_child(busnode, dev)) != NULL) {
128 u8 addr;
129
130 /* We must re-match the adapter in order to properly check
131 * the channel on multibus setups
132 */
133 if (!pmac_i2c_match_adapter(dev, adapter))
134 continue;
129 if (!device_is_compatible(dev, "max6690")) 135 if (!device_is_compatible(dev, "max6690"))
130 continue; 136 continue;
137 addr = pmac_i2c_get_dev_addr(dev);
131 loc = get_property(dev, "hwsensor-location", NULL); 138 loc = get_property(dev, "hwsensor-location", NULL);
132 reg = (u32 *) get_property(dev, "reg", NULL); 139 if (loc == NULL || addr == 0)
133 if (!loc || !reg)
134 continue; 140 continue;
135 printk("found max6690, loc=%s reg=%x\n", loc, *reg); 141 printk("found max6690, loc=%s addr=0x%02x\n", loc, addr);
136 if (strcmp(loc, "BACKSIDE")) 142 if (strcmp(loc, "BACKSIDE"))
137 continue; 143 continue;
138 wf_max6690_create(adapter, *reg); 144 wf_max6690_create(adapter, addr);
139 } 145 }
140 146
141 return 0; 147 return 0;
@@ -153,6 +159,11 @@ static int wf_max6690_detach(struct i2c_client *client)
153 159
154static int __init wf_max6690_sensor_init(void) 160static int __init wf_max6690_sensor_init(void)
155{ 161{
162 /* Don't register on old machines that use therm_pm72 for now */
163 if (machine_is_compatible("PowerMac7,2") ||
164 machine_is_compatible("PowerMac7,3") ||
165 machine_is_compatible("RackMac3,1"))
166 return -ENODEV;
156 return i2c_add_driver(&wf_max6690_driver); 167 return i2c_add_driver(&wf_max6690_driver);
157} 168}
158 169
diff --git a/drivers/macintosh/windfarm_pid.c b/drivers/macintosh/windfarm_pid.c
index 0842432e27ad..f10efb28cae4 100644
--- a/drivers/macintosh/windfarm_pid.c
+++ b/drivers/macintosh/windfarm_pid.c
@@ -143,3 +143,7 @@ s32 wf_cpu_pid_run(struct wf_cpu_pid_state *st, s32 new_power, s32 new_temp)
143 return st->target; 143 return st->target;
144} 144}
145EXPORT_SYMBOL_GPL(wf_cpu_pid_run); 145EXPORT_SYMBOL_GPL(wf_cpu_pid_run);
146
147MODULE_AUTHOR("Benjamin Herrenschmidt <benh@kernel.crashing.org>");
148MODULE_DESCRIPTION("PID algorithm for PowerMacs thermal control");
149MODULE_LICENSE("GPL");
diff --git a/drivers/macintosh/windfarm_pm112.c b/drivers/macintosh/windfarm_pm112.c
index c2a4e689c784..ef66bf2778ec 100644
--- a/drivers/macintosh/windfarm_pm112.c
+++ b/drivers/macintosh/windfarm_pm112.c
@@ -358,6 +358,7 @@ static void backside_fan_tick(void)
358 return; 358 return;
359 if (!backside_tick) { 359 if (!backside_tick) {
360 /* first time; initialize things */ 360 /* first time; initialize things */
361 printk(KERN_INFO "windfarm: Backside control loop started.\n");
361 backside_param.min = backside_fan->ops->get_min(backside_fan); 362 backside_param.min = backside_fan->ops->get_min(backside_fan);
362 backside_param.max = backside_fan->ops->get_max(backside_fan); 363 backside_param.max = backside_fan->ops->get_max(backside_fan);
363 wf_pid_init(&backside_pid, &backside_param); 364 wf_pid_init(&backside_pid, &backside_param);
@@ -407,6 +408,7 @@ static void drive_bay_fan_tick(void)
407 return; 408 return;
408 if (!drive_bay_tick) { 409 if (!drive_bay_tick) {
409 /* first time; initialize things */ 410 /* first time; initialize things */
411 printk(KERN_INFO "windfarm: Drive bay control loop started.\n");
410 drive_bay_prm.min = drive_bay_fan->ops->get_min(drive_bay_fan); 412 drive_bay_prm.min = drive_bay_fan->ops->get_min(drive_bay_fan);
411 drive_bay_prm.max = drive_bay_fan->ops->get_max(drive_bay_fan); 413 drive_bay_prm.max = drive_bay_fan->ops->get_max(drive_bay_fan);
412 wf_pid_init(&drive_bay_pid, &drive_bay_prm); 414 wf_pid_init(&drive_bay_pid, &drive_bay_prm);
@@ -458,6 +460,7 @@ static void slots_fan_tick(void)
458 return; 460 return;
459 if (!slots_started) { 461 if (!slots_started) {
460 /* first time; initialize things */ 462 /* first time; initialize things */
463 printk(KERN_INFO "windfarm: Slots control loop started.\n");
461 wf_pid_init(&slots_pid, &slots_param); 464 wf_pid_init(&slots_pid, &slots_param);
462 slots_started = 1; 465 slots_started = 1;
463 } 466 }
@@ -504,6 +507,7 @@ static void pm112_tick(void)
504 507
505 if (!started) { 508 if (!started) {
506 started = 1; 509 started = 1;
510 printk(KERN_INFO "windfarm: CPUs control loops started.\n");
507 for (i = 0; i < nr_cores; ++i) { 511 for (i = 0; i < nr_cores; ++i) {
508 if (create_cpu_loop(i) < 0) { 512 if (create_cpu_loop(i) < 0) {
509 failure_state = FAILURE_PERM; 513 failure_state = FAILURE_PERM;
@@ -594,8 +598,6 @@ static void pm112_new_sensor(struct wf_sensor *sr)
594{ 598{
595 unsigned int i; 599 unsigned int i;
596 600
597 if (have_all_sensors)
598 return;
599 if (!strncmp(sr->name, "cpu-temp-", 9)) { 601 if (!strncmp(sr->name, "cpu-temp-", 9)) {
600 i = sr->name[9] - '0'; 602 i = sr->name[9] - '0';
601 if (sr->name[10] == 0 && i < NR_CORES && 603 if (sr->name[10] == 0 && i < NR_CORES &&
@@ -613,7 +615,7 @@ static void pm112_new_sensor(struct wf_sensor *sr)
613 } else if (!strcmp(sr->name, "slots-power")) { 615 } else if (!strcmp(sr->name, "slots-power")) {
614 if (slots_power == NULL && wf_get_sensor(sr) == 0) 616 if (slots_power == NULL && wf_get_sensor(sr) == 0)
615 slots_power = sr; 617 slots_power = sr;
616 } else if (!strcmp(sr->name, "u4-temp")) { 618 } else if (!strcmp(sr->name, "backside-temp")) {
617 if (u4_temp == NULL && wf_get_sensor(sr) == 0) 619 if (u4_temp == NULL && wf_get_sensor(sr) == 0)
618 u4_temp = sr; 620 u4_temp = sr;
619 } else 621 } else