diff options
author | Jordan Crouse <jordan.crouse@amd.com> | 2006-03-23 10:19:49 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-22 14:10:31 -0400 |
commit | 43cb7ebee2f478d3f987ad773d4e6b07fc23c631 (patch) | |
tree | f862838ccb28af35ba9e1951a26ba9fb4b99b0e3 /drivers/hwmon/lm83.c | |
parent | 52ab3f3dc711eeccbfbcc5d4f5c5d9b9ff59650f (diff) |
[PATCH] lm83: Add LM82 support
Add LM82 temperature sensor support (similar to the LM83,
but less featureful).
Signed-off-by: Jordan Crouse <jordan.crouse@amd.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/hwmon/lm83.c')
-rw-r--r-- | drivers/hwmon/lm83.c | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/drivers/hwmon/lm83.c b/drivers/hwmon/lm83.c index aac4ec2bf694..2137d7879df6 100644 --- a/drivers/hwmon/lm83.c +++ b/drivers/hwmon/lm83.c | |||
@@ -12,6 +12,10 @@ | |||
12 | * Since the datasheet omits to give the chip stepping code, I give it | 12 | * Since the datasheet omits to give the chip stepping code, I give it |
13 | * here: 0x03 (at register 0xff). | 13 | * here: 0x03 (at register 0xff). |
14 | * | 14 | * |
15 | * Also supports the LM82 temp sensor, which is basically a stripped down | ||
16 | * model of the LM83. Datasheet is here: | ||
17 | * http://www.national.com/pf/LM/LM82.html | ||
18 | * | ||
15 | * This program is free software; you can redistribute it and/or modify | 19 | * This program is free software; you can redistribute it and/or modify |
16 | * it under the terms of the GNU General Public License as published by | 20 | * it under the terms of the GNU General Public License as published by |
17 | * the Free Software Foundation; either version 2 of the License, or | 21 | * the Free Software Foundation; either version 2 of the License, or |
@@ -52,7 +56,7 @@ static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a, | |||
52 | * Insmod parameters | 56 | * Insmod parameters |
53 | */ | 57 | */ |
54 | 58 | ||
55 | I2C_CLIENT_INSMOD_1(lm83); | 59 | I2C_CLIENT_INSMOD_2(lm83, lm82); |
56 | 60 | ||
57 | /* | 61 | /* |
58 | * The LM83 registers | 62 | * The LM83 registers |
@@ -283,6 +287,9 @@ static int lm83_detect(struct i2c_adapter *adapter, int address, int kind) | |||
283 | if (man_id == 0x01) { /* National Semiconductor */ | 287 | if (man_id == 0x01) { /* National Semiconductor */ |
284 | if (chip_id == 0x03) { | 288 | if (chip_id == 0x03) { |
285 | kind = lm83; | 289 | kind = lm83; |
290 | } else | ||
291 | if (chip_id == 0x01) { | ||
292 | kind = lm82; | ||
286 | } | 293 | } |
287 | } | 294 | } |
288 | 295 | ||
@@ -296,6 +303,9 @@ static int lm83_detect(struct i2c_adapter *adapter, int address, int kind) | |||
296 | 303 | ||
297 | if (kind == lm83) { | 304 | if (kind == lm83) { |
298 | name = "lm83"; | 305 | name = "lm83"; |
306 | } else | ||
307 | if (kind == lm82) { | ||
308 | name = "lm82"; | ||
299 | } | 309 | } |
300 | 310 | ||
301 | /* We can fill in the remaining client fields */ | 311 | /* We can fill in the remaining client fields */ |
@@ -319,32 +329,46 @@ static int lm83_detect(struct i2c_adapter *adapter, int address, int kind) | |||
319 | goto exit_detach; | 329 | goto exit_detach; |
320 | } | 330 | } |
321 | 331 | ||
332 | /* | ||
333 | * The LM82 can only monitor one external diode which is | ||
334 | * at the same register as the LM83 temp3 entry - so we | ||
335 | * declare 1 and 3 common, and then 2 and 4 only for the LM83. | ||
336 | */ | ||
337 | |||
322 | device_create_file(&new_client->dev, | 338 | device_create_file(&new_client->dev, |
323 | &sensor_dev_attr_temp1_input.dev_attr); | 339 | &sensor_dev_attr_temp1_input.dev_attr); |
324 | device_create_file(&new_client->dev, | 340 | device_create_file(&new_client->dev, |
325 | &sensor_dev_attr_temp2_input.dev_attr); | ||
326 | device_create_file(&new_client->dev, | ||
327 | &sensor_dev_attr_temp3_input.dev_attr); | 341 | &sensor_dev_attr_temp3_input.dev_attr); |
328 | device_create_file(&new_client->dev, | 342 | |
329 | &sensor_dev_attr_temp4_input.dev_attr); | ||
330 | device_create_file(&new_client->dev, | 343 | device_create_file(&new_client->dev, |
331 | &sensor_dev_attr_temp1_max.dev_attr); | 344 | &sensor_dev_attr_temp1_max.dev_attr); |
332 | device_create_file(&new_client->dev, | 345 | device_create_file(&new_client->dev, |
333 | &sensor_dev_attr_temp2_max.dev_attr); | ||
334 | device_create_file(&new_client->dev, | ||
335 | &sensor_dev_attr_temp3_max.dev_attr); | 346 | &sensor_dev_attr_temp3_max.dev_attr); |
336 | device_create_file(&new_client->dev, | 347 | |
337 | &sensor_dev_attr_temp4_max.dev_attr); | ||
338 | device_create_file(&new_client->dev, | 348 | device_create_file(&new_client->dev, |
339 | &sensor_dev_attr_temp1_crit.dev_attr); | 349 | &sensor_dev_attr_temp1_crit.dev_attr); |
340 | device_create_file(&new_client->dev, | 350 | device_create_file(&new_client->dev, |
341 | &sensor_dev_attr_temp2_crit.dev_attr); | ||
342 | device_create_file(&new_client->dev, | ||
343 | &sensor_dev_attr_temp3_crit.dev_attr); | 351 | &sensor_dev_attr_temp3_crit.dev_attr); |
344 | device_create_file(&new_client->dev, | 352 | |
345 | &sensor_dev_attr_temp4_crit.dev_attr); | ||
346 | device_create_file(&new_client->dev, &dev_attr_alarms); | 353 | device_create_file(&new_client->dev, &dev_attr_alarms); |
347 | 354 | ||
355 | if (kind == lm83) { | ||
356 | device_create_file(&new_client->dev, | ||
357 | &sensor_dev_attr_temp2_input.dev_attr); | ||
358 | device_create_file(&new_client->dev, | ||
359 | &sensor_dev_attr_temp4_input.dev_attr); | ||
360 | |||
361 | device_create_file(&new_client->dev, | ||
362 | &sensor_dev_attr_temp2_max.dev_attr); | ||
363 | device_create_file(&new_client->dev, | ||
364 | &sensor_dev_attr_temp4_max.dev_attr); | ||
365 | |||
366 | device_create_file(&new_client->dev, | ||
367 | &sensor_dev_attr_temp2_crit.dev_attr); | ||
368 | device_create_file(&new_client->dev, | ||
369 | &sensor_dev_attr_temp4_crit.dev_attr); | ||
370 | } | ||
371 | |||
348 | return 0; | 372 | return 0; |
349 | 373 | ||
350 | exit_detach: | 374 | exit_detach: |