diff mbox series

HWMon: LM80: Add "support" for Texas Instruments AMC80

Message ID 20240508090244.18070-1-andrei1998@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series HWMon: LM80: Add "support" for Texas Instruments AMC80 | expand

Commit Message

Andrei Aldea May 8, 2024, 9:02 a.m. UTC
Add support for AMC80 which is register compatible with LM96080 and a result of TI's acquisition of National Semiconductor

https://www.ti.com/lit/ds/symlink/amc80.pdf

Signed-off-by: Andrei Aldea <andrei1998@gmail.com>
---
 drivers/hwmon/Kconfig | 4 ++--
 drivers/hwmon/lm80.c  | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Guenter Roeck May 8, 2024, 12:40 p.m. UTC | #1
On Wed, May 08, 2024 at 04:02:44AM -0500, Andrei Aldea wrote:
> Add support for AMC80 which is register compatible with LM96080 and a result of TI's acquisition of National Semiconductor
> 
Line length. Also, "and a result of TI's acquisition of National
Semiconductor" is irrelevant.

> https://www.ti.com/lit/ds/symlink/amc80.pdf

This should be added to the documentation, not to the patch
description.

The subject should start with "hwmon: (lm80)", and please drop the quotes
around "support".

> 
> Signed-off-by: Andrei Aldea <andrei1998@gmail.com>
> ---
>  drivers/hwmon/Kconfig | 4 ++--
>  drivers/hwmon/lm80.c  | 6 ++++++

Chip description (Documentation/hwmon/lm80.rst) needs to be updated as
well.

>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 83945397b6eb..f901ece2ff43 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -1446,11 +1446,11 @@ config SENSORS_LM78
>  	  will be called lm78.
>  
>  config SENSORS_LM80
> -	tristate "National Semiconductor LM80 and LM96080"
> +	tristate "National Semiconductor LM80, LM96080 and compatibles"

		"National Semiconductor LM80 and compatibles"

>  	depends on I2C
>  	help
>  	  If you say yes here you get support for National Semiconductor
> -	  LM80 and LM96080 sensor chips.
> +	  LM80, LM96080 and Texas Instruments AMC80 sensor chips.
>  
>  	  This driver can also be built as a module. If so, the module
>  	  will be called lm80.
> diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
> index 63c7831bd3e1..0355b9d849be 100644
> --- a/drivers/hwmon/lm80.c
> +++ b/drivers/hwmon/lm80.c
> @@ -573,6 +573,11 @@ static int lm80_detect(struct i2c_client *client, struct i2c_board_info *info)
>  			return -ENODEV;
>  
>  		name = "lm96080";
> +
> +	/* Check for  AMC80 version which is register compatible with lm96080 */
> +	} else if (man_id == 0x80 && dev_id == 0x08) {
> +		name = "amc80";
> +
>  	} else {
>  		/* Check 6-bit addressing */
>  		for (i = 0x2a; i <= 0x3d; i++) {
> @@ -624,6 +629,7 @@ static int lm80_probe(struct i2c_client *client)
>  static const struct i2c_device_id lm80_id[] = {
>  	{ "lm80", 0 },
>  	{ "lm96080", 1 },
> +	{ "amc80", 2},

The driver_data values are unused and therefore unnecessary.

However, I did not have time to check the chip datasheet to confirm that
chip specific code is indeed not needed.

Guenter

>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, lm80_id);
> -- 
> 2.39.3 (Apple Git-146)
> 
>
diff mbox series

Patch

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 83945397b6eb..f901ece2ff43 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1446,11 +1446,11 @@  config SENSORS_LM78
 	  will be called lm78.
 
 config SENSORS_LM80
-	tristate "National Semiconductor LM80 and LM96080"
+	tristate "National Semiconductor LM80, LM96080 and compatibles"
 	depends on I2C
 	help
 	  If you say yes here you get support for National Semiconductor
-	  LM80 and LM96080 sensor chips.
+	  LM80, LM96080 and Texas Instruments AMC80 sensor chips.
 
 	  This driver can also be built as a module. If so, the module
 	  will be called lm80.
diff --git a/drivers/hwmon/lm80.c b/drivers/hwmon/lm80.c
index 63c7831bd3e1..0355b9d849be 100644
--- a/drivers/hwmon/lm80.c
+++ b/drivers/hwmon/lm80.c
@@ -573,6 +573,11 @@  static int lm80_detect(struct i2c_client *client, struct i2c_board_info *info)
 			return -ENODEV;
 
 		name = "lm96080";
+
+	/* Check for  AMC80 version which is register compatible with lm96080 */
+	} else if (man_id == 0x80 && dev_id == 0x08) {
+		name = "amc80";
+
 	} else {
 		/* Check 6-bit addressing */
 		for (i = 0x2a; i <= 0x3d; i++) {
@@ -624,6 +629,7 @@  static int lm80_probe(struct i2c_client *client)
 static const struct i2c_device_id lm80_id[] = {
 	{ "lm80", 0 },
 	{ "lm96080", 1 },
+	{ "amc80", 2},
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, lm80_id);