Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117823
b: refs/heads/master
c: 97ae60b
h: refs/heads/master
i:
  117821: de06f90
  117819: 9cfe047
  117815: 0d6fec9
  117807: 518869d
  117791: 1b5bf9f
  117759: 4a083c3
v: v3
  • Loading branch information
Jean Delvare committed Oct 26, 2008
1 parent a8fb565 commit deea774
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 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: ec38fa2b35f13e7fa1d676a5bc997d0df1b02574
refs/heads/master: 97ae60bb38279e1941c738b1037a57e6b14efeaf
2 changes: 1 addition & 1 deletion trunk/Documentation/hwmon/lm90
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Supported chips:
Datasheet: Publicly available at the National Semiconductor website
http://www.national.com/pf/LM/LM90.html
* National Semiconductor LM89
Prefix: 'lm99'
Prefix: 'lm89' (no auto-detection)
Addresses scanned: I2C 0x4c and 0x4d
Datasheet: Publicly available at the National Semiconductor website
http://www.national.com/mpf/LM/LM89.html
Expand Down
37 changes: 33 additions & 4 deletions trunk/drivers/hwmon/lm90.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
* made by National Semiconductor. Both have an increased remote
* temperature measurement accuracy (1 degree), and the LM99
* additionally shifts remote temperatures (measured and limits) by 16
* degrees, which allows for higher temperatures measurement. The
* driver doesn't handle it since it can be done easily in user-space.
* degrees, which allows for higher temperatures measurement.
* Note that there is no way to differentiate between both chips.
* When device is auto-detected, the driver will assume an LM99.
*
* This driver also supports the LM86, another sensor chip made by
* National Semiconductor. It is exactly similar to the LM90 except it
Expand Down Expand Up @@ -169,8 +169,8 @@ static const struct i2c_device_id lm90_id[] = {
{ "adt7461", adt7461 },
{ "lm90", lm90 },
{ "lm86", lm86 },
{ "lm89", lm99 },
{ "lm99", lm99 }, /* Missing temperature offset */
{ "lm89", lm86 },
{ "lm99", lm99 },
{ "max6646", max6646 },
{ "max6647", max6646 },
{ "max6649", max6646 },
Expand Down Expand Up @@ -366,6 +366,10 @@ static ssize_t show_temp8(struct device *dev, struct device_attribute *devattr,
else
temp = temp_from_s8(data->temp8[attr->index]);

/* +16 degrees offset for temp2 for the LM99 */
if (data->kind == lm99 && attr->index == 3)
temp += 16000;

return sprintf(buf, "%d\n", temp);
}

Expand All @@ -385,6 +389,10 @@ static ssize_t set_temp8(struct device *dev, struct device_attribute *devattr,
long val = simple_strtol(buf, NULL, 10);
int nr = attr->index;

/* +16 degrees offset for temp2 for the LM99 */
if (data->kind == lm99 && attr->index == 3)
val -= 16000;

mutex_lock(&data->update_lock);
if (data->kind == adt7461)
data->temp8[nr] = temp_to_u8_adt7461(data, val);
Expand All @@ -411,6 +419,10 @@ static ssize_t show_temp11(struct device *dev, struct device_attribute *devattr,
else
temp = temp_from_s16(data->temp11[attr->index]);

/* +16 degrees offset for temp2 for the LM99 */
if (data->kind == lm99 && attr->index <= 2)
temp += 16000;

return sprintf(buf, "%d\n", temp);
}

Expand All @@ -432,6 +444,10 @@ static ssize_t set_temp11(struct device *dev, struct device_attribute *devattr,
long val = simple_strtol(buf, NULL, 10);
int nr = attr->index;

/* +16 degrees offset for temp2 for the LM99 */
if (data->kind == lm99 && attr->index <= 2)
val -= 16000;

mutex_lock(&data->update_lock);
if (data->kind == adt7461)
data->temp11[nr] = temp_to_u16_adt7461(data, val);
Expand Down Expand Up @@ -466,6 +482,10 @@ static ssize_t show_temphyst(struct device *dev, struct device_attribute *devatt
else
temp = temp_from_s8(data->temp8[attr->index]);

/* +16 degrees offset for temp2 for the LM99 */
if (data->kind == lm99 && attr->index == 3)
temp += 16000;

return sprintf(buf, "%d\n", temp - temp_from_s8(data->temp_hyst));
}

Expand Down Expand Up @@ -691,6 +711,15 @@ static int lm90_detect(struct i2c_client *new_client, int kind,
} else
if ((chip_id & 0xF0) == 0x30) { /* LM89/LM99 */
kind = lm99;
dev_info(&adapter->dev,
"Assuming LM99 chip at "
"0x%02x\n", address);
dev_info(&adapter->dev,
"If it is an LM89, pass "
"force_lm86=%d,0x%02x when "
"loading the lm90 driver\n",
i2c_adapter_id(adapter),
address);
} else
if (address == 0x4C
&& (chip_id & 0xF0) == 0x10) { /* LM86 */
Expand Down

0 comments on commit deea774

Please sign in to comment.