aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm92.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:53:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-09 22:53:11 -0500
commitf71eaf68406cfee91b6a96bcdf7ce33dc78829c5 (patch)
tree92a1663ae15d521f25849d28ebb4dfad10567892 /drivers/hwmon/lm92.c
parent78f1ae193d1662c22cfebb916e788e1ca896c0fe (diff)
parent54fe4671aa5853ca88da72d67e969a3d8de6dcf6 (diff)
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging
* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging: (41 commits) hwmon: (adt7475) Add VID support for the ADT7476 hwmon: (adt7475) Add an entry in MAINTAINERS hwmon: (adt7475) Add support for the ADT7476 hwmon: (adt7475) Voltage attenuators can be bypassed hwmon: (adt7475) Print device information on probe hwmon: (adt7475) Handle alternative pin functions hwmon: (adt7475) Move sysfs files removal to a separate function hwmon: (adt7475) Add support for the ADT7490 hwmon: (adt7475) Improve device detection hwmon: (adt7475) Add missing static marker hwmon: (adt7475) Rework voltage inputs handling hwmon: (adt7475) Implement pwm_use_point2_pwm_at_crit hwmon: (adt7475) New documentation hwmon: (adt7475) Add support for the ADT7473 hwmon: (f71882fg) Add support for the f71889fg (version 2) hwmon: (f71882fg) Fix sysfs file removal hwmon: (f71882fg) Cleanup sysfs attr creation 2/2 hwmon: (f71882fg) Cleanup sysfs attr creation 1/2 hwmon: (thmc50) Stop using I2C_CLIENT_MODULE_PARM hwmon: Add Freescale MC13783 ADC driver ...
Diffstat (limited to 'drivers/hwmon/lm92.c')
-rw-r--r--drivers/hwmon/lm92.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/drivers/hwmon/lm92.c b/drivers/hwmon/lm92.c
index b2e00c5a7eec..47ac698709dc 100644
--- a/drivers/hwmon/lm92.c
+++ b/drivers/hwmon/lm92.c
@@ -323,31 +323,22 @@ static int lm92_detect(struct i2c_client *new_client, int kind,
323 struct i2c_board_info *info) 323 struct i2c_board_info *info)
324{ 324{
325 struct i2c_adapter *adapter = new_client->adapter; 325 struct i2c_adapter *adapter = new_client->adapter;
326 u8 config;
327 u16 man_id;
326 328
327 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA 329 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA
328 | I2C_FUNC_SMBUS_WORD_DATA)) 330 | I2C_FUNC_SMBUS_WORD_DATA))
329 return -ENODEV; 331 return -ENODEV;
330 332
331 /* A negative kind means that the driver was loaded with no force 333 config = i2c_smbus_read_byte_data(new_client, LM92_REG_CONFIG);
332 parameter (default), so we must identify the chip. */ 334 man_id = i2c_smbus_read_word_data(new_client, LM92_REG_MAN_ID);
333 if (kind < 0) { 335
334 u8 config = i2c_smbus_read_byte_data(new_client, 336 if ((config & 0xe0) == 0x00 && man_id == 0x0180)
335 LM92_REG_CONFIG); 337 pr_info("lm92: Found National Semiconductor LM92 chip\n");
336 u16 man_id = i2c_smbus_read_word_data(new_client, 338 else if (max6635_check(new_client))
337 LM92_REG_MAN_ID); 339 pr_info("lm92: Found Maxim MAX6635 chip\n");
338 340 else
339 if ((config & 0xe0) == 0x00 341 return -ENODEV;
340 && man_id == 0x0180) {
341 pr_info("lm92: Found National Semiconductor LM92 chip\n");
342 kind = lm92;
343 } else
344 if (max6635_check(new_client)) {
345 pr_info("lm92: Found Maxim MAX6635 chip\n");
346 kind = lm92; /* No separate prefix */
347 }
348 else
349 return -ENODEV;
350 }
351 342
352 strlcpy(info->type, "lm92", I2C_NAME_SIZE); 343 strlcpy(info->type, "lm92", I2C_NAME_SIZE);
353 344