Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 20934
b: refs/heads/master
c: b55fafc
h: refs/heads/master
v: v3
  • Loading branch information
Benjamin Herrenschmidt authored and Paul Mackerras committed Mar 3, 2006
1 parent 7742729 commit 59371ae
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 0c2aca88bdac4254a13466fb108733d243a118b6
refs/heads/master: b55fafc5a800f27beedfdcf8bd1b6baa47e769a9
7 changes: 7 additions & 0 deletions trunk/drivers/macintosh/windfarm_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
#include <linux/platform_device.h>
#include <linux/mutex.h>

#include <asm/prom.h>

#include "windfarm.h"

#define VERSION "0.2"
Expand Down Expand Up @@ -465,6 +467,11 @@ static int __init windfarm_core_init(void)
{
DBG("wf: core loaded\n");

/* Don't register on old machines that use therm_pm72 for now */
if (machine_is_compatible("PowerMac7,2") ||
machine_is_compatible("PowerMac7,3") ||
machine_is_compatible("RackMac3,1"))
return -ENODEV;
platform_device_register(&wf_platform_device);
return 0;
}
Expand Down
8 changes: 8 additions & 0 deletions trunk/drivers/macintosh/windfarm_cpufreq_clamp.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <linux/wait.h>
#include <linux/cpufreq.h>

#include <asm/prom.h>

#include "windfarm.h"

#define VERSION "0.3"
Expand Down Expand Up @@ -74,6 +76,12 @@ static int __init wf_cpufreq_clamp_init(void)
{
struct wf_control *clamp;

/* Don't register on old machines that use therm_pm72 for now */
if (machine_is_compatible("PowerMac7,2") ||
machine_is_compatible("PowerMac7,3") ||
machine_is_compatible("RackMac3,1"))
return -ENODEV;

clamp = kmalloc(sizeof(struct wf_control), GFP_KERNEL);
if (clamp == NULL)
return -ENOMEM;
Expand Down
32 changes: 23 additions & 9 deletions trunk/drivers/macintosh/windfarm_lm75_sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

#include "windfarm.h"

#define VERSION "0.1"
#define VERSION "0.2"

#undef DEBUG

Expand Down Expand Up @@ -113,6 +113,7 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
const char *loc)
{
struct wf_lm75_sensor *lm;
int rc;

DBG("wf_lm75: creating %s device at address 0x%02x\n",
ds1775 ? "ds1775" : "lm75", addr);
Expand All @@ -139,9 +140,11 @@ static struct wf_lm75_sensor *wf_lm75_create(struct i2c_adapter *adapter,
lm->i2c.driver = &wf_lm75_driver;
strncpy(lm->i2c.name, lm->sens.name, I2C_NAME_SIZE-1);

if (i2c_attach_client(&lm->i2c)) {
printk(KERN_ERR "windfarm: failed to attach %s %s to i2c\n",
ds1775 ? "ds1775" : "lm75", lm->i2c.name);
rc = i2c_attach_client(&lm->i2c);
if (rc) {
printk(KERN_ERR "windfarm: failed to attach %s %s to i2c,"
" err %d\n", ds1775 ? "ds1775" : "lm75",
lm->i2c.name, rc);
goto fail;
}

Expand Down Expand Up @@ -175,16 +178,22 @@ static int wf_lm75_attach(struct i2c_adapter *adapter)
(dev = of_get_next_child(busnode, dev)) != NULL;) {
const char *loc =
get_property(dev, "hwsensor-location", NULL);
u32 *reg = (u32 *)get_property(dev, "reg", NULL);
DBG(" dev: %s... (loc: %p, reg: %p)\n", dev->name, loc, reg);
if (loc == NULL || reg == NULL)
u8 addr;

/* We must re-match the adapter in order to properly check
* the channel on multibus setups
*/
if (!pmac_i2c_match_adapter(dev, adapter))
continue;
addr = pmac_i2c_get_dev_addr(dev);
if (loc == NULL || addr == 0)
continue;
/* real lm75 */
if (device_is_compatible(dev, "lm75"))
wf_lm75_create(adapter, *reg, 0, loc);
wf_lm75_create(adapter, addr, 0, loc);
/* ds1775 (compatible, better resolution */
else if (device_is_compatible(dev, "ds1775"))
wf_lm75_create(adapter, *reg, 1, loc);
wf_lm75_create(adapter, addr, 1, loc);
}
return 0;
}
Expand All @@ -206,6 +215,11 @@ static int wf_lm75_detach(struct i2c_client *client)

static int __init wf_lm75_sensor_init(void)
{
/* Don't register on old machines that use therm_pm72 for now */
if (machine_is_compatible("PowerMac7,2") ||
machine_is_compatible("PowerMac7,3") ||
machine_is_compatible("RackMac3,1"))
return -ENODEV;
return i2c_add_driver(&wf_lm75_driver);
}

Expand Down
25 changes: 18 additions & 7 deletions trunk/drivers/macintosh/windfarm_max6690_sensor.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

#include "windfarm.h"

#define VERSION "0.1"
#define VERSION "0.2"

/* This currently only exports the external temperature sensor,
since that's all the control loops need. */
Expand Down Expand Up @@ -81,7 +81,7 @@ static struct wf_sensor_ops wf_max6690_ops = {
static void wf_max6690_create(struct i2c_adapter *adapter, u8 addr)
{
struct wf_6690_sensor *max;
char *name = "u4-temp";
char *name = "backside-temp";

max = kzalloc(sizeof(struct wf_6690_sensor), GFP_KERNEL);
if (max == NULL) {
Expand Down Expand Up @@ -118,24 +118,30 @@ static int wf_max6690_attach(struct i2c_adapter *adapter)
struct device_node *busnode, *dev = NULL;
struct pmac_i2c_bus *bus;
const char *loc;
u32 *reg;

bus = pmac_i2c_adapter_to_bus(adapter);
if (bus == NULL)
return -ENODEV;
busnode = pmac_i2c_get_bus_node(bus);

while ((dev = of_get_next_child(busnode, dev)) != NULL) {
u8 addr;

/* We must re-match the adapter in order to properly check
* the channel on multibus setups
*/
if (!pmac_i2c_match_adapter(dev, adapter))
continue;
if (!device_is_compatible(dev, "max6690"))
continue;
addr = pmac_i2c_get_dev_addr(dev);
loc = get_property(dev, "hwsensor-location", NULL);
reg = (u32 *) get_property(dev, "reg", NULL);
if (!loc || !reg)
if (loc == NULL || addr == 0)
continue;
printk("found max6690, loc=%s reg=%x\n", loc, *reg);
printk("found max6690, loc=%s addr=0x%02x\n", loc, addr);
if (strcmp(loc, "BACKSIDE"))
continue;
wf_max6690_create(adapter, *reg);
wf_max6690_create(adapter, addr);
}

return 0;
Expand All @@ -153,6 +159,11 @@ static int wf_max6690_detach(struct i2c_client *client)

static int __init wf_max6690_sensor_init(void)
{
/* Don't register on old machines that use therm_pm72 for now */
if (machine_is_compatible("PowerMac7,2") ||
machine_is_compatible("PowerMac7,3") ||
machine_is_compatible("RackMac3,1"))
return -ENODEV;
return i2c_add_driver(&wf_max6690_driver);
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/macintosh/windfarm_pm112.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ static void pm112_new_sensor(struct wf_sensor *sr)
} else if (!strcmp(sr->name, "slots-power")) {
if (slots_power == NULL && wf_get_sensor(sr) == 0)
slots_power = sr;
} else if (!strcmp(sr->name, "u4-temp")) {
} else if (!strcmp(sr->name, "backside-temp")) {
if (u4_temp == NULL && wf_get_sensor(sr) == 0)
u4_temp = sr;
} else
Expand Down

0 comments on commit 59371ae

Please sign in to comment.