lkml.org 
[lkml]   [2005]   [Mar]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] Make therm_adt746x handle latest powerbooks
Hi,

This patch lets therm_adt746x handle the latest powerbooks. In these
ones, Apple doesn't put the i2c bus number in the "reg" property of
the fan node. Instead, we can get the bus number from the fan node
path, which looks like "/proc/device-tree/.../i2c-bus@1/.../fan".
Here's a patch that handles both old and new form.

Please apply :)

Signed-off-by: Colin Leroy <colin@colino.net>
--- a/drivers/macintosh/therm_adt746x.c 2005-03-07
09:03:58.000000000 +0100
+++ b/drivers/macintosh/therm_adt746x.c 2005-03-07
09:04:35.000000000 +0100
@@ -548,7 +548,15 @@
prop = (u32 *)get_property(np, "reg", NULL);
if (!prop)
return -ENODEV;
- therm_bus = ((*prop) >> 8) & 0x0f;
+
+ /* look for bus either by path or using "reg" */
+ if (strstr(np->full_name, "/i2c-bus@") != NULL) {
+ const char *tmp_bus = (strstr(np->full_name, "/i2c-bus@") + 9);
+ therm_bus = tmp_bus[0]-'0';
+ } else {
+ therm_bus = ((*prop) >> 8) & 0x0f;
+ }
+
therm_address = ((*prop) & 0xff) >> 1;

printk(KERN_INFO "adt746x: Thermostat bus: %d, address: 0x%02x, "
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:10    [W:0.573 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site