summaryrefslogtreecommitdiff
path: root/drivers/hwmon/lm87.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-10-17 17:51:12 +0200
committerJean Delvare <khali@mahadeva.delvare>2008-10-17 17:51:12 +0200
commit47064d645bc55863c7887a7c96cde39c9a37ee5f (patch)
tree812e5badc94040e6001d3ca76bce97a3906caa60 /drivers/hwmon/lm87.c
parentd2cac802feae6f0c246a9251eefc482bf5ec0f0f (diff)
downloadkernel-common-47064d645bc55863c7887a7c96cde39c9a37ee5f.tar.gz
kernel-common-47064d645bc55863c7887a7c96cde39c9a37ee5f.tar.bz2
kernel-common-47064d645bc55863c7887a7c96cde39c9a37ee5f.zip
hwmon: (lm87) Add support for configuration through platform_data
The lm87 driver normally assumes that firmware configured the chip correctly. Since this is not always the case, alllow platform code to set the channel register value via platform_data. All other configuration registers can be changed after driver initialisation. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/hwmon/lm87.c')
-rw-r--r--drivers/hwmon/lm87.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/hwmon/lm87.c b/drivers/hwmon/lm87.c
index fa0e3794d9a4..2e4a3cea95f7 100644
--- a/drivers/hwmon/lm87.c
+++ b/drivers/hwmon/lm87.c
@@ -21,11 +21,10 @@
* http://www.national.com/pf/LM/LM87.html
*
* Some functions share pins, so not all functions are available at the same
- * time. Which are depends on the hardware setup. This driver assumes that
- * the BIOS configured the chip correctly. In that respect, it differs from
- * the original driver (from lm_sensors for Linux 2.4), which would force the
- * LM87 to an arbitrary, compile-time chosen mode, regardless of the actual
- * chipset wiring.
+ * time. Which are depends on the hardware setup. This driver normally
+ * assumes that firmware configured the chip correctly. Where this is not
+ * the case, platform code must set the I2C client's platform_data to point
+ * to a u8 value to be written to the channel register.
* For reference, here is the list of exclusive functions:
* - in0+in5 (default) or temp3
* - fan1 (default) or in6
@@ -843,7 +842,13 @@ static void lm87_init_client(struct i2c_client *client)
{
struct lm87_data *data = i2c_get_clientdata(client);
- data->channel = lm87_read_value(client, LM87_REG_CHANNEL_MODE);
+ if (client->dev.platform_data) {
+ data->channel = *(u8 *)client->dev.platform_data;
+ lm87_write_value(client,
+ LM87_REG_CHANNEL_MODE, data->channel);
+ } else {
+ data->channel = lm87_read_value(client, LM87_REG_CHANNEL_MODE);
+ }
data->config = lm87_read_value(client, LM87_REG_CONFIG) & 0x6F;
if (!(data->config & 0x01)) {