hwmon: (lm90) Add support for max6695
Subsystems (3)
PATCH v3 7/7 hwmon: (lm90) Add support for max6695
--- Documentation/hwmon/lm90 | 17 +++ drivers/hwmon/Kconfig | 4 +- drivers/hwmon/lm90.c | 250 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 247 insertions(+), 24 deletions(-)
Documentation/hwmon/lm90 +17 -0
@@ -84,6 +84,17 @@ Supported chips: Addresses scanned: I2C 0x4c Datasheet: Publicly available at the Maxim website http://www.maxim-ic.com/quick_view2.cfm/qv_pk/3500 + * Maxim MAX6695 + Prefix: 'max6695' + Addresses scanned: I2C 0x18 + Datasheet: Publicly available at the Maxim website + http://www.maxim-ic.com/datasheet/index.mvp/id/4199 + * Maxim MAX6696 + Prefix: 'max6695' + Addresses scanned: I2C 0x18, 0x19, 0x1a, 0x29, 0x2a, 0x2b, + 0x4c, 0x4d and 0x4e + Datasheet: Publicly available at the Maxim website + http://www.maxim-ic.com/datasheet/index.mvp/id/4199 * Winbond/Nuvoton W83L771AWG/ASG Prefix: 'w83l771' Addresses scanned: I2C 0x4c
@@ -152,6 +163,12 @@ MAX6680 and MAX6681: * Selectable address * Remote sensor type selection +MAX6695 and MAX6696: + * Better local resolution + * Selectable address (max6696) + * Second critical temperature limit + * Two remote sensors + W83L771AWG/ASG * The AWG and ASG variants only differ in package format. * Filter and alert configuration register at 0xBF
drivers/hwmon/Kconfig +2 -2
@@ -605,8 +605,8 @@ config SENSORS_LM90 If you say yes here you get support for National Semiconductor LM90, LM86, LM89 and LM99, Analog Devices ADM1032 and ADT7461, Maxim MAX6646, MAX6647, MAX6648, MAX6649, MAX6657, MAX6658, MAX6659, - MAX6680, MAX6681 and MAX6692, and Winbond/Nuvoton W83L771AWG/ASG - sensor chips. + MAX6680, MAX6681, MAX6692, MAX6695, MAX6696, and Winbond/Nuvoton + W83L771AWG/ASG sensor chips. This driver can also be built as a module. If so, the module will be called lm90.
drivers/hwmon/lm90.c +228 -22
428 lines not on this page · raw message
Signature · 7 lines
1.7.0.87.g0901d _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH v3 7/7] hwmon: (lm90) Add support for
Hi Guenter,
Sorry for being a little slow, but...
Quoted 19 lines · Guenter Roeck
Signed-off-by Guenter Roeck <[email protected]>--- Documentation/hwmon/lm90 | 17 +++ drivers/hwmon/Kconfig | 4 +- drivers/hwmon/lm90.c | 250 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 247 insertions(+), 24 deletions(-)(...)
drivers/hwmon/lm90.c +2
-0@@ -154,6 +160,8 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,#define LM90_HAVE_LOCAL_EXT (1 << 2)/* extended local temperature */ #define LM90_HAVE_REM_LIMIT_EXT (1 << 3)/* extended remote limit */ #define LM90_HAVE_EMERGENCY (1 << 4)/* 3rd upper (emergency) limit */ +#define LM90_HAVE_EMERGENCY_ALARM (1 << 5)/* emergency alarm */ +#define LM90_HAVE_TEMP3 (1 << 6)/* 3rd temperature sensor */ /* * Functions declaration
drivers/hwmon/lm90.c static struct lm90_data *lm90_update_device(struct device *dev) · line 1327
Quoted 8 lines
drivers/hwmon/lm90.c +4
-1@@ -1135,7 +1321,27 @@ static struct lm90_data *lm90_update_device(struct device *dev)lm90_read_reg (client,MAX6659_REG_R_REMOTE_EMERG , &data->temp8[5 ]); } -lm90_read_reg (client,LM90_REG_R_STATUS , &data->alarms); +lm90_read_reg (client,LM90_REG_R_STATUS , &alarms); + data->alarms = alarms;/* save as 16 bit value */ + +if (data->kind = max6696) {
Wouldn't this be better written:
if (data->flags & LM90_HAVE_TEMP3) {drivers/hwmon/lm90.c static struct lm90_data *lm90_update_device(struct device *dev) · line 1340
Quoted 13 lines
drivers/hwmon/lm90.c +13
-0+lm90_select_remote_channel (client, data,1 ); +lm90_read_reg (client,LM90_REG_R_REMOTE_CRIT , + &data->temp8[6 ]); +lm90_read_reg (client,MAX6659_REG_R_REMOTE_EMERG , + &data->temp8[7 ]); +lm90_read16 (client,LM90_REG_R_REMOTE_TEMPH , +LM90_REG_R_REMOTE_TEMPL , &data->temp11[5 ]); +if (!lm90_read_reg (client,LM90_REG_R_REMOTE_LOWH , &h)) + data->temp11[6 ] = h <<8 ; +if (!lm90_read_reg (client,LM90_REG_R_REMOTE_HIGHH , &h)) + data->temp11[7 ] = h <<8 ; +lm90_select_remote_channel (client, data,0 ); +
and:
if (data->flags & (LM90_HAVE_TEMP3 | LM90_HAVE_EMERGENCY_ALARM))
drivers/hwmon/lm90.c static struct lm90_data *lm90_update_device(struct device *dev) · line 1344
Quoted 4 lines
drivers/hwmon/lm90.c +4
-0+if (!lm90_read_reg (client,MAX6696_REG_R_STATUS2 , + &alarms)) + data->alarms |= alarms <<8 ; + }
so that adding support for more chips with these features in the future is easier?
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH v3 7/7] hwmon: (lm90) Add support for
In reply to Guenter RoeckHi Jean,
Quoted 53 lines · Jean Delvare
Hi Guenter,
Sorry for being a little slow, but...
Quoted 19 lines · Guenter Roeck
Signed-off-by Guenter Roeck <[email protected]>--- Documentation/hwmon/lm90 | 17 +++ drivers/hwmon/Kconfig | 4 +- drivers/hwmon/lm90.c | 250 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 247 insertions(+), 24 deletions(-)(...)
drivers/hwmon/lm90.c +2
-0@@ -154,6 +160,8 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,#define LM90_HAVE_LOCAL_EXT (1 << 2)/* extended local temperature */ #define LM90_HAVE_REM_LIMIT_EXT (1 << 3)/* extended remote limit */ #define LM90_HAVE_EMERGENCY (1 << 4)/* 3rd upper (emergency) limit */ +#define LM90_HAVE_EMERGENCY_ALARM (1 << 5)/* emergency alarm */ +#define LM90_HAVE_TEMP3 (1 << 6)/* 3rd temperature sensor */ /* * Functions declaration drivers/hwmon/lm90.c static struct lm90_data *lm90_update_device(struct device *dev) · line 1327
Quoted 8 lines
drivers/hwmon/lm90.c +4
-1@@ -1135,7 +1321,27 @@ static struct lm90_data *lm90_update_device(struct device *dev)lm90_read_reg (client,MAX6659_REG_R_REMOTE_EMERG , &data->temp8[5 ]); } -lm90_read_reg (client,LM90_REG_R_STATUS , &data->alarms); +lm90_read_reg (client,LM90_REG_R_STATUS , &alarms); + data->alarms = alarms;/* save as 16 bit value */ + +if (data->kind = max6696) {Wouldn't this be better written:
if (data->flags & LM90_HAVE_TEMP3) {drivers/hwmon/lm90.c static struct lm90_data *lm90_update_device(struct device *dev) · line 1340
Quoted 13 lines
drivers/hwmon/lm90.c +13
-0+lm90_select_remote_channel (client, data,1 ); +lm90_read_reg (client,LM90_REG_R_REMOTE_CRIT , + &data->temp8[6 ]); +lm90_read_reg (client,MAX6659_REG_R_REMOTE_EMERG , + &data->temp8[7 ]); +lm90_read16 (client,LM90_REG_R_REMOTE_TEMPH , +LM90_REG_R_REMOTE_TEMPL , &data->temp11[5 ]); +if (!lm90_read_reg (client,LM90_REG_R_REMOTE_LOWH , &h)) + data->temp11[6 ] = h <<8 ; +if (!lm90_read_reg (client,LM90_REG_R_REMOTE_HIGHH , &h)) + data->temp11[7 ] = h <<8 ; +lm90_select_remote_channel (client, data,0 ); +and:
Quoted 2 lines
if (data->flags & (LM90_HAVE_TEMP3 | LM90_HAVE_EMERGENCY_ALARM))
Possibly. I didn't do it on purpose, though, since it is not clear yet if the registers used to access those sensors on future chips will be the same or completely different. I figured it is better to play safe and implement the actual register accesses by checking ->kind instead of using the capability flags.
Later on it might end up as
if (data->flags & LM90_HAVE_TEMP3) {
switch (data->kind) {
case max6696:
...
break;
case newchip:
...
break;
}
}Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH v3 7/7] hwmon: (lm90) Add support for
In reply to Guenter RoeckQuoted 65 lines · Guenter Roeck
Hi Jean,
Quoted 53 lines · Jean Delvare
Hi Guenter,
Sorry for being a little slow, but...
Quoted 19 lines · Guenter Roeck
Signed-off-by Guenter Roeck <[email protected]>--- Documentation/hwmon/lm90 | 17 +++ drivers/hwmon/Kconfig | 4 +- drivers/hwmon/lm90.c | 250 ++++++++++++++++++++++++++++++++++++++++++---- 3 files changed, 247 insertions(+), 24 deletions(-)(...)
drivers/hwmon/lm90.c +2
-0@@ -154,6 +160,8 @@ enum chips { lm90, adm1032, lm99, lm86, max6657, max6659, adt7461, max6680,#define LM90_HAVE_LOCAL_EXT (1 << 2)/* extended local temperature */ #define LM90_HAVE_REM_LIMIT_EXT (1 << 3)/* extended remote limit */ #define LM90_HAVE_EMERGENCY (1 << 4)/* 3rd upper (emergency) limit */ +#define LM90_HAVE_EMERGENCY_ALARM (1 << 5)/* emergency alarm */ +#define LM90_HAVE_TEMP3 (1 << 6)/* 3rd temperature sensor */ /* * Functions declaration drivers/hwmon/lm90.c static struct lm90_data *lm90_update_device(struct device *dev) · line 1327
Quoted 8 lines
drivers/hwmon/lm90.c +4
-1@@ -1135,7 +1321,27 @@ static struct lm90_data *lm90_update_device(struct device *dev)lm90_read_reg (client,MAX6659_REG_R_REMOTE_EMERG , &data->temp8[5 ]); } -lm90_read_reg (client,LM90_REG_R_STATUS , &data->alarms); +lm90_read_reg (client,LM90_REG_R_STATUS , &alarms); + data->alarms = alarms;/* save as 16 bit value */ + +if (data->kind = max6696) {Wouldn't this be better written:
if (data->flags & LM90_HAVE_TEMP3) {drivers/hwmon/lm90.c static struct lm90_data *lm90_update_device(struct device *dev) · line 1340
Quoted 13 lines
drivers/hwmon/lm90.c +13
-0+lm90_select_remote_channel (client, data,1 ); +lm90_read_reg (client,LM90_REG_R_REMOTE_CRIT , + &data->temp8[6 ]); +lm90_read_reg (client,MAX6659_REG_R_REMOTE_EMERG , + &data->temp8[7 ]); +lm90_read16 (client,LM90_REG_R_REMOTE_TEMPH , +LM90_REG_R_REMOTE_TEMPL , &data->temp11[5 ]); +if (!lm90_read_reg (client,LM90_REG_R_REMOTE_LOWH , &h)) + data->temp11[6 ] = h <<8 ; +if (!lm90_read_reg (client,LM90_REG_R_REMOTE_HIGHH , &h)) + data->temp11[7 ] = h <<8 ; +lm90_select_remote_channel (client, data,0 ); +and:
Quoted 2 lines
if (data->flags & (LM90_HAVE_TEMP3 | LM90_HAVE_EMERGENCY_ALARM))Possibly. I didn't do it on purpose, though, since it is not clear yet if the registers used to access those sensors on future chips will be the same or completely different. I figured it is better to play safe and implement the actual register accesses by checking ->kind instead of using the capability flags.
Later on it might end up as
Quoted 11 lines
if (data->flags & LM90_HAVE_TEMP3) {
switch (data->kind) {
case max6696:
...
break;
case newchip:
...
break;
}
}Right, that makes sense. Sorry for the noise.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors