hwmon/lm70: Adds support for LM71 and LM74
Subsystems (2)
PATCH 2/2 hwmon/lm70: Adds support for LM71 and LM74
Adding support for LM74 and LM71 chips
drivers/hwmon/Kconfig +3 -3
@@ -530,12 +530,12 @@ will be called lm63. config SENSORS_LM70 - tristate "National Semiconductor LM70 / Texas Instruments TMP121" + tristate "National Semiconductor LM70 and compatibles" depends on SPI_MASTER help If you say yes here you get support for the National Semiconductor - LM70 and Texas Instruments TMP121/TMP123 digital temperature - sensor chips. + LM70, LM71, LM74 and Texas Instruments TMP121/TMP123 digital tempera- + ture sensor chips. This driver can also be built as a module. If so, the module will be called lm70.
drivers/hwmon/lm70.c +22 -3
@@ -43,6 +43,8 @@#define LM70_CHIP_LM70 0/* original NS LM70 */ #define LM70_CHIP_TMP121 1/* TI TMP121/TMP123 */ +#define LM70_CHIP_LM71 2/* NS LM71 */ +#define LM70_CHIP_LM74 3/* NS LM71 */ struct lm70 {struct device *hwmon_dev;
@@ -88,9 +90,13 @@* Celsius. * So it's equivalent to multiplying by 0.25 * 1000 = 250. * -* TMP121/TMP123: +* LM74 and TMP121/TMP123: * 13 bits of 2's complement data, discard LSB 3 bits, * resolution 0.0625 degrees celsius. +* +* LM71: +* 14 bits of 2's complement data, discard LSB 2 bits, +* resolution 0.0312 degrees celsius. */ switch (p_lm70->chip) {case LM70_CHIP_LM70 :
@@ -98,8 +104,13 @@break ;case LM70_CHIP_TMP121 : +case LM70_CHIP_LM74 : val = ((int )raw /8 ) *625 /10 ;break ; + +case LM70_CHIP_LM71 : + val = ((int )raw /4 ) *3125 /100 ; +break ; } status =sprintf (buf,"%d\n" , val);/* millidegrees Celsius */
@@ -123,6 +134,12 @@case LM70_CHIP_TMP121 : ret =sprintf (buf,"tmp121\n" );break ; +case LM71_CHIP_LM71 : + ret =sprintf (buf,"lm71\n" ); +break ; +case LM74_CHIP_LM74 : + ret =sprintf (buf,"lm74\n" ); +break ;default : ret = -EINVAL ; }
@@ -139,7 +156,7 @@struct lm70 *p_lm70;int status; -/* signaling is SPI_MODE_0 for both LM70 and TMP121 */ +/* signaling is SPI_MODE_0 */ if (spi->mode & (SPI_CPOL |SPI_CPHA ))return -EINVAL ;
@@ -198,6 +215,8 @@static const struct spi_device_id lm70_ids[] = { {"lm70" ,LM70_CHIP_LM70 }, {"tmp121" ,LM70_CHIP_TMP121 }, + {"lm71" ,LM70_CHIP_LM71 }, + {"lm74" ,LM70_CHIP_LM74 }, { }, };MODULE_DEVICE_TABLE (spi, lm70_ids);
@@ -215,5 +234,5 @@module_spi_driver (lm70_driver);MODULE_AUTHOR ("Kaiwan N Billimoria" ); -MODULE_DESCRIPTION ("NS LM70 / TI TMP121/TMP123 Linux driver" ); +MODULE_DESCRIPTION ("NS LM70 and compatibles Linux driver" );MODULE_LICENSE ("GPL" );
Documentation/hwmon/lm70 +8 -1
@@ -6,6 +6,10 @@ Datasheet: http://www.national.com/pf/LM/LM70.html * Texas Instruments TMP121/TMP123 Information: http://focus.ti.com/docs/prod/folders/print/tmp121.html + * National Semiconductor LM71 + Datasheet: http://www.ti.com/product/LM71 + * National Semiconductor LM74 + Datasheet: http://www.ti.com/product/LM74 Author: Kaiwan N Billimoria <[email protected]>
@@ -31,9 +35,12 @@ with a "SPI master controller driver", see drivers/spi/spi_lm70llp.c and its associated documentation. -The TMP121/TMP123 are very similar; main difference is 13-bit temperature +The LM74 and TMP121/TMP123 are very similar; main difference is 13-bit temperature data (0.0625 degrees celsius resolution). +The LM71 is also very similar; main difference is 14-bit temperature +data (0.03125 degrees celsius resolution). + Thanks to --------- Jean Delvare <[email protected]> for mentoring the hwmon-side driver
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Guenter Roeck
maintainerQuoted 4 lines · Christophe Leroy
Adding support for LM74 and LM71 chips
Signed-off-by Christophe Leroy <[email protected]>
Hi Christophe,
couple of comments below.
Quoted 23 lines
diff -u linux-3.5-vanilla/drivers/hwmon/Kconfig linux-3.5/drivers/hwmon/Kconfig
drivers/hwmon/Kconfig +3
-3@@ -530,12 +530,12 @@ will be called lm63. config SENSORS_LM70 - tristate "National Semiconductor LM70 / Texas Instruments TMP121" + tristate "National Semiconductor LM70 and compatibles" depends on SPI_MASTER help If you say yes here you get support for the National Semiconductor - LM70 and Texas Instruments TMP121/TMP123 digital temperature - sensor chips. + LM70, LM71, LM74 and Texas Instruments TMP121/TMP123 digital tempera- + ture sensor chips. This driver can also be built as a module. If so, the module will be called lm70.diff -u
linux-3.5-vanilla/drivers/hwmon/lm70.clinux-3.5/drivers/hwmon/lm70.c
drivers/hwmon/lm70.c line 48
Quoted 6 lines
drivers/hwmon/lm70.c +2
-0@@ -43,6 +43,8 @@#define LM70_CHIP_LM70 0/* original NS LM70 */ #define LM70_CHIP_TMP121 1/* TI TMP121/TMP123 */ +#define LM70_CHIP_LM71 2/* NS LM71 */ +#define LM70_CHIP_LM74 3/* NS LM71 */
NS LM71 -> NS LM74
Quoted 32 lines
drivers/hwmon/lm70.c +10
-1struct lm70 {struct device *hwmon_dev;@@ -88,9 +90,13 @@* Celsius. * So it's equivalent to multiplying by 0.25 * 1000 = 250. * -* TMP121/TMP123: +* LM74 and TMP121/TMP123: * 13 bits of 2's complement data, discard LSB 3 bits, * resolution 0.0625 degrees celsius. +* +* LM71: +* 14 bits of 2's complement data, discard LSB 2 bits, +* resolution 0.0312 degrees celsius. */ switch (p_lm70->chip) {case LM70_CHIP_LM70 :@@ -98,8 +104,13 @@break ;case LM70_CHIP_TMP121 : +case LM70_CHIP_LM74 : val = ((int )raw /8 ) *625 /10 ;break ; + +case LM70_CHIP_LM71 : + val = ((int )raw /4 ) *3125 /100 ; +break ; } status =sprintf (buf,"%d\n" , val);/* millidegrees Celsius */
drivers/hwmon/lm70.c line 142
Quoted 9 lines
drivers/hwmon/lm70.c +6
-0@@ -123,6 +134,12 @@case LM70_CHIP_TMP121 : ret =sprintf (buf,"tmp121\n" );break ; +case LM71_CHIP_LM71 : + ret =sprintf (buf,"lm71\n" ); +break ; +case LM74_CHIP_LM74 : + ret =sprintf (buf,"lm74\n" ); +break ;
Please make sure to at least compile your code ... the above doesn't compile.
Quoted 13 lines
drivers/hwmon/lm70.c +1
-1default : ret = -EINVAL ; }@@ -139,7 +156,7 @@struct lm70 *p_lm70;int status; -/* signaling is SPI_MODE_0 for both LM70 and TMP121 */ +/* signaling is SPI_MODE_0 */ if (spi->mode & (SPI_CPOL |SPI_CPHA ))return -EINVAL ;
drivers/hwmon/lm70.c line 219
Quoted 5 lines
drivers/hwmon/lm70.c +2
-0@@ -198,6 +215,8 @@static const struct spi_device_id lm70_ids[] = { {"lm70" ,LM70_CHIP_LM70 }, {"tmp121" ,LM70_CHIP_TMP121 }, + {"lm71" ,LM70_CHIP_LM71 }, + {"lm74" ,LM70_CHIP_LM74 },
Please align LM70_xxx to the first two lines.
Quoted 25 lines
drivers/hwmon/lm70.c +1
-1{ }, };MODULE_DEVICE_TABLE (spi, lm70_ids);@@ -215,5 +234,5 @@module_spi_driver (lm70_driver);MODULE_AUTHOR ("Kaiwan N Billimoria" ); -MODULE_DESCRIPTION ("NS LM70 / TI TMP121/TMP123 Linux driver" ); +MODULE_DESCRIPTION ("NS LM70 and compatibles Linux driver" );MODULE_LICENSE ("GPL" );diff -u linux-3.5-vanilla/Documentation/hwmon/lm70 linux-3.5/Documentation/hwmon/lm70
Documentation/hwmon/lm70 +4
-0@@ -6,6 +6,10 @@ Datasheet: http://www.national.com/pf/LM/LM70.html * Texas Instruments TMP121/TMP123 Information: http://focus.ti.com/docs/prod/folders/print/tmp121.html + * National Semiconductor LM71 + Datasheet: http://www.ti.com/product/LM71 + * National Semiconductor LM74 + Datasheet: http://www.ti.com/product/LM74 Author: Kaiwan N Billimoria <[email protected]>
Documentation/hwmon/lm70 line 38
Quoted 5 lines
Documentation/hwmon/lm70 +1
-1@@ -31,9 +35,12 @@ with a "SPI master controller driver", see drivers/spi/spi_lm70llp.c and its associated documentation. -The TMP121/TMP123 are very similar; main difference is 13-bit temperature +The LM74 and TMP121/TMP123 are very similar; main difference is 13-bit temperature
Please move the last word to the next line to keep the line length at 80 columns.
Thanks,
Guenter
Quoted 9 lines
Documentation/hwmon/lm70 +3
-0data (0.0625 degrees celsius resolution). +The LM71 is also very similar; main difference is 14-bit temperature +data (0.03125 degrees celsius resolution). + Thanks to --------- Jean Delvare <[email protected]> for mentoring the hwmon-side driver