Skip to content

Commit b3e992f

Browse files
committed
hwmon: (jc42) Strengthen detect function
Configuration register bit 5 must read 0 for all JC42.4 compliant chips. Several capability register bits must be set for all TSE2004 compliant chips. Use that information to strengthen the detect function. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent c98cf41 commit b3e992f

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/hwmon/jc42.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,11 @@ static int jc42_detect(struct i2c_client *client, struct i2c_board_info *info)
413413
if (cap < 0 || config < 0 || manid < 0 || devid < 0)
414414
return -ENODEV;
415415

416-
if ((cap & 0xff00) || (config & 0xf800))
416+
if ((cap & 0xff00) || (config & 0xf820))
417+
return -ENODEV;
418+
419+
if ((devid & TSE2004_DEVID_MASK) == TSE2004_DEVID &&
420+
(cap & 0x00e7) != 0x00e7)
417421
return -ENODEV;
418422

419423
for (i = 0; i < ARRAY_SIZE(jc42_chips); i++) {

0 commit comments

Comments
 (0)