250
253
addresses 0x04-0x07 returning the last read value.
251
254
The cycling+unused addresses combination is not tested,
252
255
since it would significantly slow the detection down and would
253
hardly add any value. */
255
/* Unused addresses */
256
cur = i2c_smbus_read_word_data(new_client, 0);
256
hardly add any value.
258
The National Semiconductor LM75A is different than earlier
259
LM75s. It has an ID byte of 0xaX (where X is the chip
260
revision, with 1 being the only revision in existence) in
261
register 7, and unused registers return 0xff rather than the
257
265
conf = i2c_smbus_read_byte_data(new_client, 1);
258
hyst = i2c_smbus_read_word_data(new_client, 2);
259
if (i2c_smbus_read_word_data(new_client, 4) != hyst
260
|| i2c_smbus_read_word_data(new_client, 5) != hyst
261
|| i2c_smbus_read_word_data(new_client, 6) != hyst
262
|| i2c_smbus_read_word_data(new_client, 7) != hyst)
264
os = i2c_smbus_read_word_data(new_client, 3);
265
if (i2c_smbus_read_word_data(new_client, 4) != os
266
|| i2c_smbus_read_word_data(new_client, 5) != os
267
|| i2c_smbus_read_word_data(new_client, 6) != os
268
|| i2c_smbus_read_word_data(new_client, 7) != os)
269
/* First check for LM75A */
270
if (i2c_smbus_read_byte_data(new_client, 7) == LM75A_ID) {
271
/* LM75A returns 0xff on unused registers so
272
just to be sure we check for that too. */
273
if (i2c_smbus_read_byte_data(new_client, 4) != 0xff
274
|| i2c_smbus_read_byte_data(new_client, 5) != 0xff
275
|| i2c_smbus_read_byte_data(new_client, 6) != 0xff)
278
hyst = i2c_smbus_read_byte_data(new_client, 2);
279
os = i2c_smbus_read_byte_data(new_client, 3);
280
} else { /* Traditional style LM75 detection */
281
/* Unused addresses */
282
hyst = i2c_smbus_read_byte_data(new_client, 2);
283
if (i2c_smbus_read_byte_data(new_client, 4) != hyst
284
|| i2c_smbus_read_byte_data(new_client, 5) != hyst
285
|| i2c_smbus_read_byte_data(new_client, 6) != hyst
286
|| i2c_smbus_read_byte_data(new_client, 7) != hyst)
288
os = i2c_smbus_read_byte_data(new_client, 3);
289
if (i2c_smbus_read_byte_data(new_client, 4) != os
290
|| i2c_smbus_read_byte_data(new_client, 5) != os
291
|| i2c_smbus_read_byte_data(new_client, 6) != os
292
|| i2c_smbus_read_byte_data(new_client, 7) != os)
275
296
/* Addresses cycling */
276
for (i = 8; i < 0xff; i += 8) {
297
for (i = 8; i <= 248; i += 40) {
277
298
if (i2c_smbus_read_byte_data(new_client, i + 1) != conf
278
|| i2c_smbus_read_word_data(new_client, i + 2) != hyst
279
|| i2c_smbus_read_word_data(new_client, i + 3) != os)
299
|| i2c_smbus_read_byte_data(new_client, i + 2) != hyst
300
|| i2c_smbus_read_byte_data(new_client, i + 3) != os)
302
if (is_lm75a && i2c_smbus_read_byte_data(new_client, i + 7)
283
strlcpy(info->type, "lm75", I2C_NAME_SIZE);
307
strlcpy(info->type, is_lm75a ? "lm75a" : "lm75", I2C_NAME_SIZE);