aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/macintosh')
-rw-r--r--drivers/macintosh/Kconfig10
-rw-r--r--drivers/macintosh/smu.c26
-rw-r--r--drivers/macintosh/windfarm_lm75_sensor.c50
3 files changed, 16 insertions, 70 deletions
diff --git a/drivers/macintosh/Kconfig b/drivers/macintosh/Kconfig
index a0ea44c3e8b1..7d4a0ac28c06 100644
--- a/drivers/macintosh/Kconfig
+++ b/drivers/macintosh/Kconfig
@@ -149,14 +149,14 @@ config MAC_EMUMOUSEBTN
149 149
150config THERM_WINDTUNNEL 150config THERM_WINDTUNNEL
151 tristate "Support for thermal management on Windtunnel G4s" 151 tristate "Support for thermal management on Windtunnel G4s"
152 depends on I2C && I2C_KEYWEST && PPC_PMAC && !PPC_PMAC64 152 depends on I2C && I2C_POWERMAC && PPC_PMAC && !PPC_PMAC64
153 help 153 help
154 This driver provides some thermostat and fan control for the desktop 154 This driver provides some thermostat and fan control for the desktop
155 G4 "Windtunnel" 155 G4 "Windtunnel"
156 156
157config THERM_ADT746X 157config THERM_ADT746X
158 tristate "Support for thermal mgmnt on laptops with ADT 746x chipset" 158 tristate "Support for thermal mgmnt on laptops with ADT 746x chipset"
159 depends on I2C && I2C_KEYWEST && PPC_PMAC && !PPC_PMAC64 159 depends on I2C && I2C_POWERMAC && PPC_PMAC && !PPC_PMAC64
160 help 160 help
161 This driver provides some thermostat and fan control for the 161 This driver provides some thermostat and fan control for the
162 iBook G4, and the ATI based aluminium PowerBooks, allowing slighlty 162 iBook G4, and the ATI based aluminium PowerBooks, allowing slighlty
@@ -164,7 +164,7 @@ config THERM_ADT746X
164 164
165config THERM_PM72 165config THERM_PM72
166 tristate "Support for thermal management on PowerMac G5" 166 tristate "Support for thermal management on PowerMac G5"
167 depends on I2C && I2C_KEYWEST && PPC_PMAC64 167 depends on I2C && I2C_POWERMAC && PPC_PMAC64
168 help 168 help
169 This driver provides thermostat and fan control for the desktop 169 This driver provides thermostat and fan control for the desktop
170 G5 machines. 170 G5 machines.
@@ -175,14 +175,14 @@ config WINDFARM
175config WINDFARM_PM81 175config WINDFARM_PM81
176 tristate "Support for thermal management on iMac G5" 176 tristate "Support for thermal management on iMac G5"
177 depends on WINDFARM && I2C && CPU_FREQ_PMAC64 && PMAC_SMU 177 depends on WINDFARM && I2C && CPU_FREQ_PMAC64 && PMAC_SMU
178 select I2C_PMAC_SMU 178 select I2C_POWERMAC
179 help 179 help
180 This driver provides thermal control for the iMacG5 180 This driver provides thermal control for the iMacG5
181 181
182config WINDFARM_PM91 182config WINDFARM_PM91
183 tristate "Support for thermal management on PowerMac9,1" 183 tristate "Support for thermal management on PowerMac9,1"
184 depends on WINDFARM && I2C && CPU_FREQ_PMAC64 && PMAC_SMU 184 depends on WINDFARM && I2C && CPU_FREQ_PMAC64 && PMAC_SMU
185 select I2C_PMAC_SMU 185 select I2C_POWERMAC
186 help 186 help
187 This driver provides thermal control for the PowerMac9,1 187 This driver provides thermal control for the PowerMac9,1
188 which is the recent (SMU based) single CPU desktop G5 188 which is the recent (SMU based) single CPU desktop G5
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index 9ecd76849e35..db2ae71d07ef 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -584,34 +584,14 @@ core_initcall(smu_late_init);
584 * sysfs visibility 584 * sysfs visibility
585 */ 585 */
586 586
587static void smu_create_i2c(struct device_node *np)
588{
589 char name[32];
590 u32 *reg = (u32 *)get_property(np, "reg", NULL);
591
592 if (reg != NULL) {
593 sprintf(name, "smu-i2c-%02x", *reg);
594 of_platform_device_create(np, name, &smu->of_dev->dev);
595 }
596}
597
598static void smu_expose_childs(void *unused) 587static void smu_expose_childs(void *unused)
599{ 588{
600 struct device_node *np, *gp; 589 struct device_node *np;
601 590
602 for (np = NULL; (np = of_get_next_child(smu->of_node, np)) != NULL;) { 591 for (np = NULL; (np = of_get_next_child(smu->of_node, np)) != NULL;)
603 if (device_is_compatible(np, "smu-i2c-control")) {
604 gp = NULL;
605 while ((gp = of_get_next_child(np, gp)) != NULL)
606 if (device_is_compatible(gp, "i2c-bus"))
607 smu_create_i2c(gp);
608 } else if (device_is_compatible(np, "smu-i2c"))
609 smu_create_i2c(np);
610 if (device_is_compatible(np, "smu-sensors")) 592 if (device_is_compatible(np, "smu-sensors"))
611 of_platform_device_create(np, "smu-sensors", 593 of_platform_device_create(np, "smu-sensors",
612 &smu->of_dev->dev); 594 &smu->of_dev->dev);
613 }
614
615} 595}
616 596
617static DECLARE_WORK(smu_expose_childs_work, smu_expose_childs, NULL); 597static DECLARE_WORK(smu_expose_childs_work, smu_expose_childs, NULL);
diff --git a/drivers/macintosh/windfarm_lm75_sensor.c b/drivers/macintosh/windfarm_lm75_sensor.c
index 57460e46c89f..906d3ecae6e6 100644
--- a/drivers/macintosh/windfarm_lm75_sensor.c
+++ b/drivers/macintosh/windfarm_lm75_sensor.c
@@ -21,6 +21,7 @@
21#include <asm/io.h> 21#include <asm/io.h>
22#include <asm/system.h> 22#include <asm/system.h>
23#include <asm/sections.h> 23#include <asm/sections.h>
24#include <asm/pmac_low_i2c.h>
24 25
25#include "windfarm.h" 26#include "windfarm.h"
26 27
@@ -157,53 +158,21 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
157 158
158static int wf_lm75_attach(struct i2c_adapter *adapter) 159static int wf_lm75_attach(struct i2c_adapter *adapter)
159{ 160{
160 u8 bus_id; 161 struct device_node *busnode, *dev;
161 struct device_node *smu, *bus, *dev; 162 struct pmac_i2c_bus *bus;
162
163 /* We currently only deal with LM75's hanging off the SMU
164 * i2c busses. If we extend that driver to other/older
165 * machines, we should split this function into SMU-i2c,
166 * keywest-i2c, PMU-i2c, ...
167 */
168 163
169 DBG("wf_lm75: adapter %s detected\n", adapter->name); 164 DBG("wf_lm75: adapter %s detected\n", adapter->name);
170 165
171 if (strncmp(adapter->name, "smu-i2c-", 8) != 0) 166 bus = pmac_i2c_adapter_to_bus(adapter);
172 return 0; 167 if (bus == NULL)
173 smu = of_find_node_by_type(NULL, "smu"); 168 return -ENODEV;
174 if (smu == NULL) 169 busnode = pmac_i2c_get_bus_node(bus);
175 return 0;
176
177 /* Look for the bus in the device-tree */
178 bus_id = (u8)simple_strtoul(adapter->name + 8, NULL, 16);
179
180 DBG("wf_lm75: bus ID is %x\n", bus_id);
181
182 /* Look for sensors subdir */
183 for (bus = NULL;
184 (bus = of_get_next_child(smu, bus)) != NULL;) {
185 u32 *reg;
186
187 if (strcmp(bus->name, "i2c"))
188 continue;
189 reg = (u32 *)get_property(bus, "reg", NULL);
190 if (reg == NULL)
191 continue;
192 if (bus_id == *reg)
193 break;
194 }
195 of_node_put(smu);
196 if (bus == NULL) {
197 printk(KERN_WARNING "windfarm: SMU i2c bus 0x%x not found"
198 " in device-tree !\n", bus_id);
199 return 0;
200 }
201 170
202 DBG("wf_lm75: bus found, looking for device...\n"); 171 DBG("wf_lm75: bus found, looking for device...\n");
203 172
204 /* Now look for lm75(s) in there */ 173 /* Now look for lm75(s) in there */
205 for (dev = NULL; 174 for (dev = NULL;
206 (dev = of_get_next_child(bus, dev)) != NULL;) { 175 (dev = of_get_next_child(busnode, dev)) != NULL;) {
207 const char *loc = 176 const char *loc =
208 get_property(dev, "hwsensor-location", NULL); 177 get_property(dev, "hwsensor-location", NULL);
209 u32 *reg = (u32 *)get_property(dev, "reg", NULL); 178 u32 *reg = (u32 *)get_property(dev, "reg", NULL);
@@ -217,9 +186,6 @@ static int wf_lm75_attach(struct i2c_adapter *adapter)
217 else if (device_is_compatible(dev, "ds1775")) 186 else if (device_is_compatible(dev, "ds1775"))
218 wf_lm75_create(adapter, *reg, 1, loc); 187 wf_lm75_create(adapter, *reg, 1, loc);
219 } 188 }
220
221 of_node_put(bus);
222
223 return 0; 189 return 0;
224} 190}
225 191