aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/lm75.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/lm75.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/lm75.c')
-rw-r--r--drivers/hwmon/lm75.c56
1 files changed, 26 insertions, 30 deletions
diff --git a/drivers/hwmon/lm75.c b/drivers/hwmon/lm75.c
index 55bd87c15c9a..e392548cccb8 100644
--- a/drivers/hwmon/lm75.c
+++ b/drivers/hwmon/lm75.c
@@ -239,6 +239,7 @@ static int lm75_detect(struct i2c_client *new_client, int kind,
239{ 239{
240 struct i2c_adapter *adapter = new_client->adapter; 240 struct i2c_adapter *adapter = new_client->adapter;
241 int i; 241 int i;
242 int cur, conf, hyst, os;
242 243
243 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA | 244 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA |
244 I2C_FUNC_SMBUS_WORD_DATA)) 245 I2C_FUNC_SMBUS_WORD_DATA))
@@ -251,40 +252,35 @@ static int lm75_detect(struct i2c_client *new_client, int kind,
251 The cycling+unused addresses combination is not tested, 252 The cycling+unused addresses combination is not tested,
252 since it would significantly slow the detection down and would 253 since it would significantly slow the detection down and would
253 hardly add any value. */ 254 hardly add any value. */
254 if (kind < 0) {
255 int cur, conf, hyst, os;
256
257 /* Unused addresses */
258 cur = i2c_smbus_read_word_data(new_client, 0);
259 conf = i2c_smbus_read_byte_data(new_client, 1);
260 hyst = i2c_smbus_read_word_data(new_client, 2);
261 if (i2c_smbus_read_word_data(new_client, 4) != hyst
262 || i2c_smbus_read_word_data(new_client, 5) != hyst
263 || i2c_smbus_read_word_data(new_client, 6) != hyst
264 || i2c_smbus_read_word_data(new_client, 7) != hyst)
265 return -ENODEV;
266 os = i2c_smbus_read_word_data(new_client, 3);
267 if (i2c_smbus_read_word_data(new_client, 4) != os
268 || i2c_smbus_read_word_data(new_client, 5) != os
269 || i2c_smbus_read_word_data(new_client, 6) != os
270 || i2c_smbus_read_word_data(new_client, 7) != os)
271 return -ENODEV;
272 255
273 /* Unused bits */ 256 /* Unused addresses */
274 if (conf & 0xe0) 257 cur = i2c_smbus_read_word_data(new_client, 0);
275 return -ENODEV; 258 conf = i2c_smbus_read_byte_data(new_client, 1);
259 hyst = i2c_smbus_read_word_data(new_client, 2);
260 if (i2c_smbus_read_word_data(new_client, 4) != hyst
261 || i2c_smbus_read_word_data(new_client, 5) != hyst
262 || i2c_smbus_read_word_data(new_client, 6) != hyst
263 || i2c_smbus_read_word_data(new_client, 7) != hyst)
264 return -ENODEV;
265 os = i2c_smbus_read_word_data(new_client, 3);
266 if (i2c_smbus_read_word_data(new_client, 4) != os
267 || i2c_smbus_read_word_data(new_client, 5) != os
268 || i2c_smbus_read_word_data(new_client, 6) != os
269 || i2c_smbus_read_word_data(new_client, 7) != os)
270 return -ENODEV;
276 271
277 /* Addresses cycling */ 272 /* Unused bits */
278 for (i = 8; i < 0xff; i += 8) 273 if (conf & 0xe0)
279 if (i2c_smbus_read_byte_data(new_client, i + 1) != conf 274 return -ENODEV;
280 || i2c_smbus_read_word_data(new_client, i + 2) != hyst 275
281 || i2c_smbus_read_word_data(new_client, i + 3) != os) 276 /* Addresses cycling */
282 return -ENODEV; 277 for (i = 8; i < 0xff; i += 8) {
278 if (i2c_smbus_read_byte_data(new_client, i + 1) != conf
279 || i2c_smbus_read_word_data(new_client, i + 2) != hyst
280 || i2c_smbus_read_word_data(new_client, i + 3) != os)
281 return -ENODEV;
283 } 282 }
284 283
285 /* NOTE: we treat "force=..." and "force_lm75=..." the same.
286 * Only new-style driver binding distinguishes chip types.
287 */
288 strlcpy(info->type, "lm75", I2C_NAME_SIZE); 284 strlcpy(info->type, "lm75", I2C_NAME_SIZE);
289 285
290 return 0; 286 return 0;