hwmon: (lm95234) Add support for LM95233
Subsystems (2)
Guenter Roeck
maintainerPATCH 2/2 hwmon: (lm95234) Add support for LM95233
LM95233 is similar to LM95234, but it only supports two instead of four external temperature sensors.
--- Documentation/hwmon/lm95234 | 15 ++++++--- drivers/hwmon/lm95234.c | 78 ++++++++++++++++++++++++++++++++------------- 2 files changed, 66 insertions(+), 27 deletions(-)
Documentation/hwmon/lm95234 +10 -5
@@ -2,6 +2,10 @@ Kernel driver lm95234 ========== Supported chips: + * National Semiconductor / Texas Instruments LM95233 + Addresses scanned: I2C 0x18, 0x2a, 0x2b + Datasheet: Publicly available at the Texas Instruments website + http://www.ti.com/product/lm95233 * National Semiconductor / Texas Instruments LM95234 Addresses scanned: I2C 0x18, 0x4d, 0x4e Datasheet: Publicly available at the Texas Instruments website
@@ -13,11 +17,12 @@ Author: Guenter Roeck <[email protected]> Description ----------- -LM95234 is an 11-bit digital temperature sensor with a 2-wire System Management -Bus (SMBus) interface and TrueTherm technology that can very accurately monitor -the temperature of four remote diodes as well as its own temperature. -The four remote diodes can be external devices such as microprocessors, -graphics processors or diode-connected 2N3904s. The LM95234's TruTherm +LM95233 and LM95234 are 11-bit digital temperature sensors with a 2-wire +System Management Bus (SMBus) interface and TrueTherm technology +that can very accurately monitor the temperature of two (LM95233) +or four (LM95234) remote diodes as well as its own temperature. +The remote diodes can be external devices such as microprocessors, +graphics processors or diode-connected 2N3904s. The chip's TruTherm beta compensation technology allows sensing of 90 nm or 65 nm process thermal diodes accurately.
drivers/hwmon/lm95234.c +56 -22
164 lines not on this page · raw message
Signature · 7 lines
1.9.1 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Guenter,
Quoted 8 lines · Guenter Roeck
LM95233 is similar to LM95234, but it only supports two instead of four external temperature sensors.
Signed-off-by Guenter Roeck <[email protected]>--- Documentation/hwmon/lm95234 | 15 ++++++--- drivers/hwmon/lm95234.c | 78 ++++++++++++++++++++++++++++++++------------- 2 files changed, 66 insertions(+), 27 deletions(-)
Please also update drivers/hwmon/Kconfig.
Quoted 23 lines
(...)
static int lm95234_detect(structi2c_client*client,drivers/hwmon/lm95234.c +9
-1struct i2c_board_info *info) {struct i2c_adapter *adapter = client->adapter; +int address = client->addr;int mfg_id, chip_id, val; +const char *name;if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA ))return -ENODEV ;@@ -622,8 +640,20 @@ static int lm95234_detect(struct i2c_client *client,return -ENODEV ; chip_id =i2c_smbus_read_byte_data (client,LM95234_REG_CHIP_ID ); -if (chip_id !=LM95234_CHIP_ID ) +switch (chip_id) { +case LM95233_CHIP_ID : +if (address !=0x18 && address !=0x2a && address !=0x2b ) +return -ENODEV ; + name ="lm95233" ; +break ; +case LM95234_CHIP_ID :
drivers/hwmon/lm95234.c static int lm95234_detect(struct i2c_client *client, · line 659
Quoted 10 lines
drivers/hwmon/lm95234.c +6
-0+if (address !=0x18 && address !=0x4d && address !=0x4e ) +return -ENODEV ; + name ="lm95234" ; +break ; +default :return -ENODEV ; + } val =i2c_smbus_read_byte_data (client,LM95234_REG_STATUS );if (val &0x30 )
After that the code checks for unused bits in 5 registers, 3 of which have more unused bits in the case of the LM95233. Checking these would make the detection code slightly less prone to false positives, at the price of slightly more complicated detection code. Did you not do it on purpose, or is it an overlook? I admit I'm not sure myself if the gain is worth the code, but OTOH in general we try to keep the detection logic the same between drivers and sensors-detect.
Also maybe update MODULE_DESCRIPTION? And as usual add the new device to wiki/Devices. Interestingly, sensors-detect is already up-to-date.
Thanks,
Signature · 7 lines
Jean Delvare SUSE L3 Support _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerQuoted 45 lines · Jean Delvare
Hi Guenter,
Quoted 8 lines · Guenter Roeck
LM95233 is similar to LM95234, but it only supports two instead of four external temperature sensors.
Signed-off-by Guenter Roeck <[email protected]>--- Documentation/hwmon/lm95234 | 15 ++++++--- drivers/hwmon/lm95234.c | 78 ++++++++++++++++++++++++++++++++------------- 2 files changed, 66 insertions(+), 27 deletions(-)Please also update
drivers/hwmon/Kconfig.Quoted 31 lines
(...)
static int lm95234_detect(structi2c_client*client,drivers/hwmon/lm95234.c +15
-1struct i2c_board_info *info) {struct i2c_adapter *adapter = client->adapter; +int address = client->addr;int mfg_id, chip_id, val; +const char *name;if (!i2c_check_functionality (adapter,I2C_FUNC_SMBUS_BYTE_DATA ))return -ENODEV ;@@ -622,8 +640,20 @@ static int lm95234_detect(struct i2c_client *client,return -ENODEV ; chip_id =i2c_smbus_read_byte_data (client,LM95234_REG_CHIP_ID ); -if (chip_id !=LM95234_CHIP_ID ) +switch (chip_id) { +case LM95233_CHIP_ID : +if (address !=0x18 && address !=0x2a && address !=0x2b ) +return -ENODEV ; + name ="lm95233" ; +break ; +case LM95234_CHIP_ID : +if (address !=0x18 && address !=0x4d && address !=0x4e ) +return -ENODEV ; + name ="lm95234" ; +break ; +default :return -ENODEV ; + }
Quoted 11 lines
drivers/hwmon/lm95234.c static int lm95234_detect(struct i2c_client *client, · line 659
Quoted 2 lines
drivers/hwmon/lm95234.c +0
-0val =i2c_smbus_read_byte_data (client,LM95234_REG_STATUS );if (val &0x30 )After that the code checks for unused bits in 5 registers, 3 of which have more unused bits in the case of the LM95233. Checking these would make the detection code slightly less prone to false positives, at the price of slightly more complicated detection code. Did you not do it on purpose, or is it an overlook? I admit I'm not sure myself if the gain is worth the code, but OTOH in general we try to keep the detection logic the same between drivers and sensors-detect.
Hi Jean,
I'll need to connect the hardware again and make sure that the more specific detection works. I wrote those patches back in April and completely forgot about them, so I don't really remember details ...
Quoted 3 lines
Also maybe update
MODULE_DESCRIPTION? And as usual add the new device to wiki/Devices. Interestingly, sensors-detect is already up-to-date.
Sure, done. I also updated several links to other National Semiconductor devices to point to the TI website.
Quoted 2 lines
Reviewed-by Jean Delvare <[email protected]>
Thanks a lot for the reviews!
Guenter
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors