Skip to contentSkip to conversation

hwmon: (tmp401) Detect TMP435 on all addresses it supports

PATCH In review Guenter Roeck 2 participants 3 messages Dec 7, 2014 – Dec 8, 2014 Hardware monitoring

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/1 hwmon: (tmp401) Detect TMP435 on all addresses it supports

TMP435 supports a range of I2C addresses, not just 0x4c.

Cc Patrick Titiano <[email protected]>
Cc Bartosz Golaszewski <[email protected]>

---
Tested with TMP435 at addresses 0x37 and 0x48.

 drivers/hwmon/tmp401.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/hwmon/tmp401.c +4 -5
index f2182ee..99664eb 100644
@@ -44,7 +44,8 @@
 #include <linux/sysfs.h>
 
 /* Addresses to scan */
-static const unsigned short normal_i2c[] = { 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
+static const unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4c, 0x4d,
+	0x4e, 0x4f, I2C_CLIENT_END };
 
 enum chips { tmp401, tmp411, tmp431, tmp432, tmp435 };
 
@@ -679,18 +680,16 @@ static int tmp401_detect(struct i2c_client *client,
 		kind = tmp411;
 		break;
 	case TMP431_DEVICE_ID:
-		if (client->addr = 0x4e)
+		if (client->addr != 0x4c && client->addr != 0x4d)
 			return -ENODEV;
 		kind = tmp431;
 		break;
 	case TMP432_DEVICE_ID:
-		if (client->addr = 0x4e)
+		if (client->addr != 0x4c && client->addr != 0x4d)
 			return -ENODEV;
 		kind = tmp432;
 		break;
 	case TMP435_DEVICE_ID:
-		if (client->addr != 0x4c)
-			return -ENODEV;
 		kind = tmp435;
 		break;
 	default:
Signature · 7 lines
1.9.1


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Reviewed-by on v1 1/1
#1 lore raw

Hi Guenter,

Quoted 36 lines · Guenter Roeck

TMP435 supports a range of I2C addresses, not just 0x4c.

Cc Patrick Titiano <[email protected]>
Cc Bartosz Golaszewski <[email protected]>

---
Tested with TMP435 at addresses 0x37 and 0x48.

 drivers/hwmon/tmp401.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/hwmon/tmp401.c +3 -3
index f2182ee..99664eb 100644
@@ -44,7 +44,8 @@
 #include <linux/sysfs.h>
 
 /* Addresses to scan */
-static const unsigned short normal_i2c[] = { 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
+static const unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4c, 0x4d,
+	0x4e, 0x4f, I2C_CLIENT_END };
 
 enum chips { tmp401, tmp411, tmp431, tmp432, tmp435 };
 
@@ -679,18 +680,16 @@ static int tmp401_detect(struct i2c_client *client,
 		kind = tmp411;
 		break;
 	case TMP431_DEVICE_ID:
-		if (client->addr = 0x4e)
+		if (client->addr != 0x4c && client->addr != 0x4d)
 			return -ENODEV;
 		kind = tmp431;
 		break;
 	case TMP432_DEVICE_ID:
-		if (client->addr = 0x4e)

drivers/hwmon/tmp401.c static int tmp401_detect(struct i2c_client *client, · line 695

Quoted 10 lines
drivers/hwmon/tmp401.c +1 -2
+		if (client->addr != 0x4c && client->addr != 0x4d)
 			return -ENODEV;
 		kind = tmp432;
 		break;
 	case TMP435_DEVICE_ID:
-		if (client->addr != 0x4c)
-			return -ENODEV;
 		kind = tmp435;
 		break;
 	default:

Looks good, but you should update Documentation/hwmon/tmp401 in the same way.

Signature · 7 lines
Jean Delvare
SUSE L3 Support

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
author maintainer
#2 lore raw
In reply to Guenter Roeck
Quoted 44 lines · Jean Delvare

Hi Guenter,

Quoted 41 lines · Guenter Roeck

TMP435 supports a range of I2C addresses, not just 0x4c.

Cc Patrick Titiano <[email protected]>
Cc Bartosz Golaszewski <[email protected]>

---
Tested with TMP435 at addresses 0x37 and 0x48.

  drivers/hwmon/tmp401.c | 9 ++++-----
  1 file changed, 4 insertions(+), 5 deletions(-)
drivers/hwmon/tmp401.c +4 -3
index f2182ee..99664eb 100644
@@ -44,7 +44,8 @@
  #include <linux/sysfs.h>
 
  /* Addresses to scan */
-static const unsigned short normal_i2c[] = { 0x4c, 0x4d, 0x4e, I2C_CLIENT_END };
+static const unsigned short normal_i2c[] = { 0x37, 0x48, 0x49, 0x4a, 0x4c, 0x4d,
+	0x4e, 0x4f, I2C_CLIENT_END };
 
  enum chips { tmp401, tmp411, tmp431, tmp432, tmp435 };
 
@@ -679,18 +680,16 @@ static int tmp401_detect(struct i2c_client *client,
  		kind = tmp411;
  		break;
  	case TMP431_DEVICE_ID:
-		if (client->addr = 0x4e)
+		if (client->addr != 0x4c && client->addr != 0x4d)
  			return -ENODEV;
  		kind = tmp431;
  		break;
  	case TMP432_DEVICE_ID:
-		if (client->addr = 0x4e)
+		if (client->addr != 0x4c && client->addr != 0x4d)
  			return -ENODEV;
  		kind = tmp432;
  		break;
  	case TMP435_DEVICE_ID:
Quoted 9 lines

drivers/hwmon/tmp401.c static int tmp401_detect(struct i2c_client *client, · line 695

Quoted 5 lines
drivers/hwmon/tmp401.c +0 -2
-		if (client->addr != 0x4c)
-			return -ENODEV;
  		kind = tmp435;
  		break;
  	default:

Looks good, but you should update Documentation/hwmon/tmp401 in the same way.

Yes, I'll do that.

Quoted 2 lines

Thanks!

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors