Skip to contentSkip to conversation

hwmon: (lm90) Add support for G781 and G781-1

PATCH Superseded Guenter Roeck 3 participants 4 messages Jan 22, 2012 – Jan 23, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Guenter Roeck

author maintainer
#0 lore raw

PATCH 1/1 hwmon: (lm90) Add support for G781 and G781-1

GMT G781 and G781-1 are ADM1032-compatible temperature sensor chips. Add support to the LM90 driver.

---
Compile-tested only.

 drivers/hwmon/lm90.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)
drivers/hwmon/lm90.c +15 -1
index 2e207de..7694b98 100644
@@ -107,7 +107,7 @@ static const unsigned short normal_i2c[] = {
 	0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
 
 enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
-	max6646, w83l771, max6696, sa56004 };
+	max6646, w83l771, max6696, sa56004, g781 };
 
 /*
  * The LM90 registers
@@ -184,6 +184,7 @@ static const struct i2c_device_id lm90_id[] = {
 	{ "adm1032", adm1032 },
 	{ "adt7461", adt7461 },
 	{ "adt7461a", adt7461 },
+	{ "g781", g781 },
 	{ "lm90", lm90 },
 	{ "lm86", lm86 },
 	{ "lm89", lm86 },
@@ -229,6 +230,12 @@ static const struct lm90_params lm90_params[] = {
 		.alert_alarms = 0x7c,
 		.max_convrate = 10,
 	},
+	[g781] = {
+		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
+		  | LM90_HAVE_BROKEN_ALERT,
+		.alert_alarms = 0x7c,
+		.max_convrate = 8,
+	},
 	[lm86] = {
 		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT,
 		.alert_alarms = 0x7b,
@@ -1291,6 +1298,13 @@ static int lm90_detect(struct i2c_client *client,
 		 && convrate <= 0x09) {
 			name = "sa56004";
 		}
+	} else
+	if (man_id = 0x47) { /* GMT */
+		if (convrate <= 0x08
+		    && (config1 & 0x3F) = 0x00
+		    && ((address = 0x4C && chip_id = 0x01)      /* G781   */
+			|| (address = 0x4D && chip_id = 0x03))) /* G781-1 */
+			name = "g781";
 	}
 
 	if (!name) { /* identification failed */
Signature · 7 lines
1.7.5.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw
Quoted 10 lines · Guenter Roeck

GMT G781 and G781-1 are ADM1032-compatible temperature sensor chips. Add support to the LM90 driver.

---
Compile-tested only.

 drivers/hwmon/lm90.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

You'll also have to update Documentation/hwmon/lm90, Kconfig, the header comment of lm90.c and the address information comment right before normal_i2c[] in that file.

Quoted 23 lines
drivers/hwmon/lm90.c +2 -1
index 2e207de..7694b98 100644
@@ -107,7 +107,7 @@ static const unsigned short normal_i2c[] = {
 	0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
 
 enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
-	max6646, w83l771, max6696, sa56004 };
+	max6646, w83l771, max6696, sa56004, g781 };
 
 /*
  * The LM90 registers
@@ -184,6 +184,7 @@ static const struct i2c_device_id lm90_id[] = {
 	{ "adm1032", adm1032 },
 	{ "adt7461", adt7461 },
 	{ "adt7461a", adt7461 },
+	{ "g781", g781 },
 	{ "lm90", lm90 },
 	{ "lm86", lm86 },
 	{ "lm89", lm86 },

drivers/hwmon/lm90.c static const struct lm90_params lm90_params[] = { · line 235

Quoted 6 lines
drivers/hwmon/lm90.c +3 -0
@@ -229,6 +230,12 @@ static const struct lm90_params lm90_params[] = {
 		.alert_alarms = 0x7c,
 		.max_convrate = 10,
 	},
+	[g781] = {
+		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
+		  | LM90_HAVE_BROKEN_ALERT,

How do you know it has broken alert? Playing it safe, or does anything in the datasheet suggest so? So far, only Analog Devices chips are known to need this. I'd rather have Mike test first, and only put this flag if really needed (it has a cost.)

Quoted 7 lines
drivers/hwmon/lm90.c +3 -0
+		.alert_alarms = 0x7c,
+		.max_convrate = 8,
+	},
 	[lm86] = {
 		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT,
 		.alert_alarms = 0x7b,

drivers/hwmon/lm90.c static int lm90_detect(struct i2c_client *client, · line 1304

Quoted 7 lines
drivers/hwmon/lm90.c +4 -0
@@ -1291,6 +1298,13 @@ static int lm90_detect(struct i2c_client *client,
 		 && convrate <= 0x09) {
 			name = "sa56004";
 		}
+	} else
+	if (man_id = 0x47) { /* GMT */
+		if (convrate <= 0x08
+		    && (config1 & 0x3F) = 0x00

Would be nice to use the same alignment logic as the rest of the code in this function, even though it might not be your preferred one.

drivers/hwmon/lm90.c static int lm90_detect(struct i2c_client *client, · line 1306

Quoted 2 lines
drivers/hwmon/lm90.c +2 -0
+		    && ((address = 0x4C && chip_id = 0x01)      /* G781   */
+			|| (address = 0x4D && chip_id = 0x03))) /* G781-1 */

As for the sensors-detect patch, 0x01 is the right value for both variants of the chip.

Quoted 4 lines
drivers/hwmon/lm90.c +1 -0
+			name = "g781";
 	}
 
 	if (!name) { /* identification failed */
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Guenter Roeck

Hi Jean,

Quoted 9 lines · Jean Delvare
Quoted 8 lines · Guenter Roeck

GMT G781 and G781-1 are ADM1032-compatible temperature sensor chips. Add support to the LM90 driver.

---
Compile-tested only.

Quoted 7 lines
Quoted 2 lines
 drivers/hwmon/lm90.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

You'll also have to update Documentation/hwmon/lm90, Kconfig, the header comment of lm90.c and the address information comment right before normal_i2c[] in that file.

ok

Quoted 26 lines
Quoted 26 lines
drivers/hwmon/lm90.c +2 -1
index 2e207de..7694b98 100644
@@ -107,7 +107,7 @@ static const unsigned short normal_i2c[] = {
 	0x4d, 0x4e, 0x4f, I2C_CLIENT_END };
 
 enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,
-	max6646, w83l771, max6696, sa56004 };
+	max6646, w83l771, max6696, sa56004, g781 };
 
 /*
  * The LM90 registers
@@ -184,6 +184,7 @@ static const struct i2c_device_id lm90_id[] = {
 	{ "adm1032", adm1032 },
 	{ "adt7461", adt7461 },
 	{ "adt7461a", adt7461 },
+	{ "g781", g781 },
 	{ "lm90", lm90 },
 	{ "lm86", lm86 },
 	{ "lm89", lm86 },
@@ -229,6 +230,12 @@ static const struct lm90_params lm90_params[] = {
 		.alert_alarms = 0x7c,
 		.max_convrate = 10,
 	},
Quoted 9 lines

drivers/hwmon/lm90.c static const struct lm90_params lm90_params[] = { · line 235

Quoted 3 lines
drivers/hwmon/lm90.c +3 -0
+	[g781] = {
+		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
+		  | LM90_HAVE_BROKEN_ALERT,

How do you know it has broken alert? Playing it safe, or does anything in the datasheet suggest so? So far, only Analog Devices chips are known to need this. I'd rather have Mike test first, and only put this flag if really needed (it has a cost.)

Datasheet says "Note that the ALERT interrupt latch is not automatically cleared when the status flag bit is cleared." Maybe I misunderstood that ? No problem, though, I'll take it out.

Quoted 9 lines
Quoted 9 lines
drivers/hwmon/lm90.c +3 -0
+		.alert_alarms = 0x7c,
+		.max_convrate = 8,
+	},
 	[lm86] = {
 		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT,
 		.alert_alarms = 0x7b,
@@ -1291,6 +1298,13 @@ static int lm90_detect(struct i2c_client *client,
 		 && convrate <= 0x09) {
 			name = "sa56004";
Quoted 9 lines

drivers/hwmon/lm90.c static int lm90_detect(struct i2c_client *client, · line 1304

Quoted 5 lines
drivers/hwmon/lm90.c +4 -0
 		}
+	} else
+	if (man_id = 0x47) { /* GMT */
+		if (convrate <= 0x08
+		    && (config1 & 0x3F) = 0x00

Would be nice to use the same alignment logic as the rest of the code in this function, even though it might not be your preferred one.

Sure.

Quoted 6 lines

drivers/hwmon/lm90.c static int lm90_detect(struct i2c_client *client, · line 1306

Quoted 2 lines
drivers/hwmon/lm90.c +2 -0
+		    && ((address = 0x4C && chip_id = 0x01)      /* G781   */
+			|| (address = 0x4D && chip_id = 0x03))) /* G781-1 */

As for the sensors-detect patch, 0x01 is the right value for both variants of the chip.

Datasheet says:

The G781 and G781-1 have the following SMBus
slave address:

	A6 A5 A4 A3 A2 A1 A0

G781 1 0 0 1 1 0 0
G781-1 1 0 0 1 1 0 1

and:

MFGIO FEh 0100 0111 Manufacturer ID
DEVID FFh G781 0000 0001 Device ID

		G781-1	0000 0011

Obviously G781 can be on both addresses, but what to do with devid 0x03 ?

Guenter

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

#3 lore raw
In reply to Guenter Roeck
Quoted 17 lines · Guenter Roeck
Quoted 16 lines · Jean Delvare

drivers/hwmon/lm90.c static const struct lm90_params lm90_params[] = { · line 235

Quoted 9 lines · Guenter Roeck
drivers/hwmon/lm90.c +3 -0
(...)
@@ -229,6 +230,12 @@ static const struct lm90_params lm90_params[] = {
 		.alert_alarms = 0x7c,
 		.max_convrate = 10,
 	},
+	[g781] = {
+		.flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT
+		  | LM90_HAVE_BROKEN_ALERT,

How do you know it has broken alert? Playing it safe, or does anything in the datasheet suggest so? So far, only Analog Devices chips are known to need this. I'd rather have Mike test first, and only put this flag if really needed (it has a cost.)

Quoted 3 lines

Datasheet says "Note that the ALERT interrupt latch is not automatically cleared when the status flag bit is cleared." Maybe I misunderstood that ? No problem, though, I'll take it out.

Keep it in then :) I was suspecting a careless copy-n-paste, but apparently I was wrong, sorry about that. I had not read the datasheet carefully, while obviously you did exactly that.

Quoted 15 lines
Quoted 7 lines

drivers/hwmon/lm90.c static int lm90_detect(struct i2c_client *client, · line 1306

Quoted 3 lines
drivers/hwmon/lm90.c +2 -0
(...)
+		    && ((address = 0x4C && chip_id = 0x01)      /* G781   */
+			|| (address = 0x4D && chip_id = 0x03))) /* G781-1 */

As for the sensors-detect patch, 0x01 is the right value for both variants of the chip.

Datasheet says:

The G781 and G781-1 have the following SMBus
slave address:

	A6 A5 A4 A3 A2 A1 A0

G781 1 0 0 1 1 0 0
G781-1 1 0 0 1 1 0 1

Quoted 7 lines

and:

MFGIO FEh 0100 0111 Manufacturer ID
DEVID FFh G781 0000 0001 Device ID

		G781-1	0000 0011

Obviously G781 can be on both addresses, but what to do with devid 0x03 ?

I read it the other way around. Obviously G781-1 has address 0x4D and the same device ID as the G781. I.e. the datasheet is wrong. That would be consistent with what the other manufacturers did (e.g. LM89 and LM89-1 have the same device ID.)

I'd stick to what Mike has, at least we know this exists. If we get reports of unsupported devices, we can add the new IDs later.

Signature · 6 lines
Jean Delvare

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