diff options
Diffstat (limited to 'drivers/hwmon')
-rw-r--r-- | drivers/hwmon/Kconfig | 4 | ||||
-rw-r--r-- | drivers/hwmon/lm83.c | 50 |
2 files changed, 39 insertions, 15 deletions
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index 99cdc612d2c6..a6a8d66129b3 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
@@ -236,11 +236,11 @@ config SENSORS_LM80 | |||
236 | will be called lm80. | 236 | will be called lm80. |
237 | 237 | ||
238 | config SENSORS_LM83 | 238 | config SENSORS_LM83 |
239 | tristate "National Semiconductor LM83" | 239 | tristate "National Semiconductor LM83 and compatibles" |
240 | depends on HWMON && I2C | 240 | depends on HWMON && I2C |
241 | help | 241 | help |
242 | If you say yes here you get support for National Semiconductor | 242 | If you say yes here you get support for National Semiconductor |
243 | LM83 sensor chips. | 243 | LM82 and LM83 sensor chips. |
244 | 244 | ||
245 | This driver can also be built as a module. If so, the module | 245 | This driver can also be built as a module. If so, the module |
246 | will be called lm83. | 246 | will be called lm83. |
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: |