aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/hwmon/lm902
-rw-r--r--drivers/hwmon/lm90.c37
2 files changed, 34 insertions, 5 deletions
diff --git a/Documentation/hwmon/lm90 b/Documentation/hwmon/lm90
index e0d5206d1de3..0e8411710238 100644
--- a/Documentation/hwmon/lm90
+++ b/Documentation/hwmon/lm90
@@ -8,7 +8,7 @@ Supported chips:
8 Datasheet: Publicly available at the National Semiconductor website 8 Datasheet: Publicly available at the National Semiconductor website
9 http://www.national.com/pf/LM/LM90.html 9 http://www.national.com/pf/LM/LM90.html
10 * National Semiconductor LM89 10 * National Semiconductor LM89
11 Prefix: 'lm99' 11 Prefix: 'lm89' (no auto-detection)
12 Addresses scanned: I2C 0x4c and 0x4d 12 Addresses scanned: I2C 0x4c and 0x4d
13 Datasheet: Publicly available at the National Semiconductor website 13 Datasheet: Publicly available at the National Semiconductor website
14 http://www.national.com/mpf/LM/LM89.html 14 http://www.national.com/mpf/LM/LM89.html
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 6242e72a82c1..96a701866726 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -12,9 +12,9 @@
12 * made by National Semiconductor. Both have an increased remote 12 * made by National Semiconductor. Both have an increased remote
13 * temperature measurement accuracy (1 degree), and the LM99 13 * temperature measurement accuracy (1 degree), and the LM99
14 * additionally shifts remote temperatures (measured and limits) by 16 14 * additionally shifts remote temperatures (measured and limits) by 16
15 * degrees, which allows for higher temperatures measurement. The 15 * degrees, which allows for higher temperatures measurement.
16 * driver doesn't handle it since it can be done easily in user-space.
17 * Note that there is no way to differentiate between both chips. 16 * Note that there is no way to differentiate between both chips.
17 * When device is auto-detected, the driver will assume an LM99.
18 * 18 *
19 * This driver also supports the LM86, another sensor chip made by 19 * This driver also supports the LM86, another sensor chip made by
20 * National Semiconductor. It is exactly similar to the LM90 except it 20 * National Semiconductor. It is exactly similar to the LM90 except it
@@ -169,8 +169,8 @@ static const struct i2c_device_id lm90_id[] = {
169 { "adt7461", adt7461 }, 169 { "adt7461", adt7461 },
170 { "lm90", lm90 }, 170 { "lm90", lm90 },
171 { "lm86", lm86 }, 171 { "lm86", lm86 },
172 { "lm89", lm99 }, 172 { "lm89", lm86 },
173 { "lm99", lm99 }, /* Missing temperature offset */ 173 { "lm99", lm99 },
174 { "max6646", max6646 }, 174 { "max6646", max6646 },
175 { "max6647", max6646 }, 175 { "max6647", max6646 },
176 { "max6649", max6646 }, 176 { "max6649", max6646 },
@@ -366,6 +366,10 @@ static ssize_t show_temp8(struct device *dev, struct device_attribute *devattr,
366 else 366 else
367 temp = temp_from_s8(data->temp8[attr->index]); 367 temp = temp_from_s8(data->temp8[attr->index]);
368 368
369 /* +16 degrees offset for temp2 for the LM99 */
370 if (data->kind == lm99 && attr->index == 3)
371 temp += 16000;
372
369 return sprintf(buf, "%d\n", temp); 373 return sprintf(buf, "%d\n", temp);
370} 374}
371 375
@@ -385,6 +389,10 @@ static ssize_t set_temp8(struct device *dev, struct device_attribute *devattr,
385 long val = simple_strtol(buf, NULL, 10); 389 long val = simple_strtol(buf, NULL, 10);
386 int nr = attr->index; 390 int nr = attr->index;
387 391
392 /* +16 degrees offset for temp2 for the LM99 */
393 if (data->kind == lm99 && attr->index == 3)
394 val -= 16000;
395
388 mutex_lock(&data->update_lock); 396 mutex_lock(&data->update_lock);
389 if (data->kind == adt7461) 397 if (data->kind == adt7461)
390 data->temp8[nr] = temp_to_u8_adt7461(data, val); 398 data->temp8[nr] = temp_to_u8_adt7461(data, val);
@@ -411,6 +419,10 @@ static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr,
411 else 419 else
412 temp = temp_from_s16(data->temp11[attr->index]); 420 temp = temp_from_s16(data->temp11[attr->index]);
413 421
422 /* +16 degrees offset for temp2 for the LM99 */
423 if (data->kind == lm99 && attr->index <= 2)
424 temp += 16000;
425
414 return sprintf(buf, "%d\n", temp); 426 return sprintf(buf, "%d\n", temp);
415} 427}
416 428
@@ -432,6 +444,10 @@ static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr,
432 long val = simple_strtol(buf, NULL, 10); 444 long val = simple_strtol(buf, NULL, 10);
433 int nr = attr->index; 445 int nr = attr->index;
434 446
447 /* +16 degrees offset for temp2 for the LM99 */
448 if (data->kind == lm99 && attr->index <= 2)
449 val -= 16000;
450
435 mutex_lock(&data->update_lock); 451 mutex_lock(&data->update_lock);
436 if (data->kind == adt7461) 452 if (data->kind == adt7461)
437 data->temp11[nr] = temp_to_u16_adt7461(data, val); 453 data->temp11[nr] = temp_to_u16_adt7461(data, val);
@@ -466,6 +482,10 @@ static ssize_t show_temphyst(struct device *dev, struct device_attribute *devatt
466 else 482 else
467 temp = temp_from_s8(data->temp8[attr->index]); 483 temp = temp_from_s8(data->temp8[attr->index]);
468 484
485 /* +16 degrees offset for temp2 for the LM99 */
486 if (data->kind == lm99 && attr->index == 3)
487 temp += 16000;
488
469 return sprintf(buf, "%d\n", temp - temp_from_s8(data->temp_hyst)); 489 return sprintf(buf, "%d\n", temp - temp_from_s8(data->temp_hyst));
470} 490}
471 491
@@ -691,6 +711,15 @@ static int lm90_detect(struct i2c_client *new_client, int kind,
691 } else 711 } else
692 if ((chip_id & 0xF0) == 0x30) { /* LM89/LM99 */ 712 if ((chip_id & 0xF0) == 0x30) { /* LM89/LM99 */
693 kind = lm99; 713 kind = lm99;
714 dev_info(&adapter->dev,
715 "Assuming LM99 chip at "
716 "0x%02x\n", address);
717 dev_info(&adapter->dev,
718 "If it is an LM89, pass "
719 "force_lm86=%d,0x%02x when "
720 "loading the lm90 driver\n",
721 i2c_adapter_id(adapter),
722 address);
694 } else 723 } else
695 if (address == 0x4C 724 if (address == 0x4C
696 && (chip_id & 0xF0) == 0x10) { /* LM86 */ 725 && (chip_id & 0xF0) == 0x10) { /* LM86 */