hwmon: (lm95245) Add support for LM95235
Subsystems (2)
Guenter Roeck
maintainerPATCH 1/2 hwmon: (lm95245) Add support for LM95235
LM95235 is register compatible to LM95245.
Also update link to LM95245 data sheet.
--- Documentation/hwmon/lm95245 | 14 +++++++++----- drivers/hwmon/lm95245.c | 31 ++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 12 deletions(-)
Documentation/hwmon/lm95245 +9 -5
@@ -2,10 +2,14 @@ Kernel driver lm95245 ========= Supported chips: - * National Semiconductor LM95245 + * TI LM95235 + Addresses scanned: I2C 0x18, 0x29, 0x4c + Datasheet: Publicly available at the TI website + http://www.ti.com/lit/ds/symlink/lm95235.pdf + * TI / National Semiconductor LM95245 Addresses scanned: I2C 0x18, 0x19, 0x29, 0x4c, 0x4d - Datasheet: Publicly available at the National Semiconductor website - http://www.national.com/mpf/LM/LM95245.html + Datasheet: Publicly available at the TI website + http://www.ti.com/lit/ds/symlink/lm95245.pdf Author: Alexander Stein <[email protected]>
@@ -13,10 +17,10 @@ Author: Alexander Stein <[email protected]> Description ----------- -The LM95245 is an 11-bit digital temperature sensor with a 2-wire System +LM95235 and LM95245 are 11-bit digital temperature sensors with a 2-wire System Management Bus (SMBus) interface and TruTherm technology that can monitor the temperature of a remote diode as well as its own temperature. -The LM95245 can be used to very accurately monitor the temperature of +The chips can be used to very accurately monitor the temperature of external devices such as microprocessors. All temperature values are given in millidegrees Celsius. Local temperature
drivers/hwmon/lm95245.c +24 -7
@@ -98,7 +98,8 @@ static const unsigned short normal_i2c[] = {#define STATUS1_LOC 0x01#define MANUFACTURER_ID 0x01 -#define DEFAULT_REVISION 0xB3 +#define LM95235_REVISION 0xB1 +#define LM95245_REVISION 0xB3static const u8 lm95245_reg_address[] = {LM95245_REG_R_LOCAL_TEMPH_S ,
@@ -427,17 +428,32 @@ static int lm95245_detect(struct i2c_client *new_client, struct i2c_board_info *info) {struct i2c_adapter *adapter = new_client->adapter; +int address = new_client->addr; +const char *name; +int rev, id;if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA ))return -ENODEV ; -if (i2c_smbus_read_byte_data (new_client,LM95245_REG_R_MAN_ID ) - !=MANUFACTURER_ID - ||i2c_smbus_read_byte_data (new_client,LM95245_REG_R_CHIP_ID ) - !=DEFAULT_REVISION ) + id =i2c_smbus_read_byte_data (new_client,LM95245_REG_R_MAN_ID ); +if (id !=MANUFACTURER_ID )return -ENODEV ; -strlcpy (info->type,DEVNAME ,I2C_NAME_SIZE ); + rev =i2c_smbus_read_byte_data (new_client,LM95245_REG_R_CHIP_ID ); +switch (rev) { +case LM95235_REVISION : +if (address !=0x18 && address !=0x29 && address !=0x4c ) +return -ENODEV ; + name ="lm95235" ; +break ; +case LM95245_REVISION : + name ="lm95245" ; +break ; +default : +return -ENODEV ; + } + +strlcpy (info->type, name,I2C_NAME_SIZE );return 0 ; }
@@ -484,7 +500,8 @@ static int lm95245_probe(struct i2c_client *client,/* Driver data (common to all clients) */ static const struct i2c_device_id lm95245_id[] = { - {DEVNAME ,0 }, + {"lm95235" ,0 }, + {"lm95245" ,1 }, { } };MODULE_DEVICE_TABLE (i2c, lm95245_id);
Signature · 7 lines
1.9.1 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Guenter,
Quoted 19 lines · Guenter Roeck
LM95235 is register compatible to LM95245.
Also update link to LM95245 data sheet.
Signed-off-by Guenter Roeck <[email protected]>--- Documentation/hwmon/lm95245 | 14 +++++++++----- drivers/hwmon/lm95245.c | 31 ++++++++++++++++++++++++------- 2 files changed, 33 insertions(+), 12 deletions(-)Documentation/hwmon/lm95245 +0
-1@@ -2,10 +2,14 @@ Kernel driver lm95245 ========= Supported chips: - * National Semiconductor LM95245
Documentation/hwmon/lm95245 Kernel driver lm95245 · line 12
Quoted 10 lines
Documentation/hwmon/lm95245 +7
-2+ * TI LM95235 + Addresses scanned: I2C 0x18, 0x29, 0x4c + Datasheet: Publicly available at the TI website + http://www.ti.com/lit/ds/symlink/lm95235.pdf + * TI / National Semiconductor LM95245 Addresses scanned: I2C 0x18, 0x19, 0x29, 0x4c, 0x4d - Datasheet: Publicly available at the National Semiconductor website - http://www.national.com/mpf/LM/LM95245.html + Datasheet: Publicly available at the TI website + http://www.ti.com/lit/ds/symlink/lm95245.pdf
The old location is also listed at the top of drivers/hwmon/lm95245.c. I suggest that you drop that second reference, so that there's a single place to update when the datasheets move.
Quoted 69 lines
Documentation/hwmon/lm95245 +2
-2Author: Alexander Stein <[email protected]>@@ -13,10 +17,10 @@ Author: Alexander Stein <[email protected]> Description ----------- -The LM95245 is an 11-bit digital temperature sensor with a 2-wire System +LM95235 and LM95245 are 11-bit digital temperature sensors with a 2-wire System Management Bus (SMBus) interface and TruTherm technology that can monitor the temperature of a remote diode as well as its own temperature. -The LM95245 can be used to very accurately monitor the temperature of +The chips can be used to very accurately monitor the temperature of external devices such as microprocessors. All temperature values are given in millidegrees Celsius. Local temperaturedrivers/hwmon/lm95245.c +22
-6@@ -98,7 +98,8 @@ static const unsigned short normal_i2c[] = {#define STATUS1_LOC 0x01#define MANUFACTURER_ID 0x01 -#define DEFAULT_REVISION 0xB3 +#define LM95235_REVISION 0xB1 +#define LM95245_REVISION 0xB3static const u8 lm95245_reg_address[] = {LM95245_REG_R_LOCAL_TEMPH_S ,@@ -427,17 +428,32 @@ static int lm95245_detect(struct i2c_client *new_client, struct i2c_board_info *info) {struct i2c_adapter *adapter = new_client->adapter; +int address = new_client->addr; +const char *name; +int rev, id;if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA ))return -ENODEV ; -if (i2c_smbus_read_byte_data (new_client,LM95245_REG_R_MAN_ID ) - !=MANUFACTURER_ID - ||i2c_smbus_read_byte_data (new_client,LM95245_REG_R_CHIP_ID ) - !=DEFAULT_REVISION ) + id =i2c_smbus_read_byte_data (new_client,LM95245_REG_R_MAN_ID ); +if (id !=MANUFACTURER_ID )return -ENODEV ; -strlcpy (info->type,DEVNAME ,I2C_NAME_SIZE ); + rev =i2c_smbus_read_byte_data (new_client,LM95245_REG_R_CHIP_ID ); +switch (rev) { +case LM95235_REVISION : +if (address !=0x18 && address !=0x29 && address !=0x4c ) +return -ENODEV ; + name ="lm95235" ; +break ; +case LM95245_REVISION : + name ="lm95245" ; +break ; +default : +return -ENODEV ; + } + +strlcpy (info->type, name,I2C_NAME_SIZE );return 0 ; }
drivers/hwmon/lm95245.c static int lm95245_probe(struct i2c_client *client, · line 487
Quoted 4 lines
drivers/hwmon/lm95245.c +0
-1@@ -484,7 +500,8 @@ static int lm95245_probe(struct i2c_client *client,/* Driver data (common to all clients) */ static const struct i2c_device_id lm95245_id[] = { - {DEVNAME ,0 },
Please drop DEVNAME while you're here, there's a single occurrence left and it's not even used as a device name.
drivers/hwmon/lm95245.c static int lm95245_probe(struct i2c_client *client, · line 504
Quoted 2 lines
drivers/hwmon/lm95245.c +2
-0+ { "lm95235", 0 }, + { "lm95245", 1 },
That "1" serves no purpose as the driver makes no use if this field.
drivers/hwmon/lm95245.c static int lm95245_probe(struct i2c_client *client, · line 507
Quoted 3 lines
drivers/hwmon/lm95245.c +0
-0{ } };MODULE_DEVICE_TABLE (i2c, lm95245_id);
Maybe update MODULE_DESCRIPTION too?
Please also add the LM95235 to wiki/Devices.
Signature · 7 lines
Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 3 lines · Jean Delvare
Maybe update
MODULE_DESCRIPTIONtoo?Please also add the LM95235 to wiki/Devices.
... and drivers/hwmon/Kconfig.
Thanks,
Signature · 7 lines
Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors