diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-03-03 01:03:21 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-03-03 05:43:53 -0500 |
commit | b55fafc5a800f27beedfdcf8bd1b6baa47e769a9 (patch) | |
tree | dc651c5738f20b72cb17ef3fc33e2e27977e6372 /drivers/macintosh/windfarm_max6690_sensor.c | |
parent | 0c2aca88bdac4254a13466fb108733d243a118b6 (diff) |
[PATCH] powerpc: Fix old g5 issues with windfarm
Some of the windfarm sensor modules can initialize on old machines that
don't have full windfarm support like non-dual core desktop G5s.
Unfortunately, by doing so, they would trigger a bug in their matching
algorithm causing them to attach to the wrong bus, thus triggering
issues with the i2c core and breaking the thermal driver.
This patch fixes the probing issue (so that they will work when a
windfarm port is done to these machines) and also prevents for now
windfarm to load at all on these machines that still use therm_pm72 to
avoid wasting resources.
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.c | 25 |
1 files changed, 18 insertions, 7 deletions
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 = { | |||
81 | static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr) | 81 | static 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 | ||
154 | static int __init wf_max6690_sensor_init(void) | 160 | static 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 | ||