* [PATCH v2 0/2] hwmon: lm90: Add support for NCT7716, NCT7717 and NCT7718
@ 2025-01-17 10:07 Ming Yu
2025-01-17 10:07 ` [PATCH v2 1/2] hwmon: (lm90): " Ming Yu
2025-01-17 10:07 ` [PATCH v2 2/2] dt-bindings: hwmon: lm90: " Ming Yu
0 siblings, 2 replies; 5+ messages in thread
From: Ming Yu @ 2025-01-17 10:07 UTC (permalink / raw)
To: tmyu0, jdelvare, linux, corbet, robh, krzk+dt, conor+dt
Cc: linux-hwmon, linux-doc, linux-kernel, devicetree, Ming Yu
The patch series add support for NCT7716, NCT7717 and NCT7718 from
Nuvoton in lm90.
NCT7716 and NCT7717 only have 8 bit resolution local thermal sensor.
NCT7718 has local sensor and 11 bit resoulution remote thermal sensor.
Changes since version 1:
- Add new detection function lm90_detect_nuvoton_50()
- Fix the check for register values.
Ming Yu (2):
hwmon: (lm90): Add support for NCT7716, NCT7717 and NCT7718
dt-bindings: hwmon: lm90: Add support for NCT7716, NCT7717 and NCT7718
.../bindings/hwmon/national,lm90.yaml | 6 ++
Documentation/hwmon/lm90.rst | 43 ++++++++++
drivers/hwmon/Kconfig | 2 +-
drivers/hwmon/lm90.c | 82 ++++++++++++++++++-
4 files changed, 130 insertions(+), 3 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] hwmon: (lm90): Add support for NCT7716, NCT7717 and NCT7718
2025-01-17 10:07 [PATCH v2 0/2] hwmon: lm90: Add support for NCT7716, NCT7717 and NCT7718 Ming Yu
@ 2025-01-17 10:07 ` Ming Yu
2025-01-29 16:16 ` Guenter Roeck
2025-01-17 10:07 ` [PATCH v2 2/2] dt-bindings: hwmon: lm90: " Ming Yu
1 sibling, 1 reply; 5+ messages in thread
From: Ming Yu @ 2025-01-17 10:07 UTC (permalink / raw)
To: tmyu0, jdelvare, linux, corbet, robh, krzk+dt, conor+dt
Cc: linux-hwmon, linux-doc, linux-kernel, devicetree, Ming Yu
NCT7716 is similar to NCT7717 but has one more address support,
both of them only have a 8 bit resolution local thermal sensor.
NCT7718 has 11 bit resoulution remote thermal sensor.
Signed-off-by: Ming Yu <a0282524688@gmail.com>
---
Documentation/hwmon/lm90.rst | 43 +++++++++++++++++++
drivers/hwmon/Kconfig | 2 +-
drivers/hwmon/lm90.c | 82 +++++++++++++++++++++++++++++++++++-
3 files changed, 124 insertions(+), 3 deletions(-)
diff --git a/Documentation/hwmon/lm90.rst b/Documentation/hwmon/lm90.rst
index 23af17a0ab44..98452eed16d5 100644
--- a/Documentation/hwmon/lm90.rst
+++ b/Documentation/hwmon/lm90.rst
@@ -365,6 +365,34 @@ Supported chips:
Datasheet: Not publicly available, can be requested from Nuvoton
+ * Nuvoton NCT7716
+
+ Prefix: 'nct7716'
+
+ Addresses scanned: I2C 0x48, 0x49
+
+ Datasheet: Not publicly available, can be requested from Nuvoton
+
+ * Nuvoton NCT7717
+
+ Prefix: 'nct7717'
+
+ Addresses scanned: I2C 0x48
+
+ Datasheet: Publicly available at Nuvoton website
+
+ https://www.nuvoton.com/resource-files/Nuvoton_NCT7717U_Datasheet_V111.pdf
+
+ * Nuvoton NCT7718
+
+ Prefix: 'nct7718'
+
+ Addresses scanned: I2C 0x4c
+
+ Datasheet: Publicly available at Nuvoton website
+
+ https://www.nuvoton.com/resource-files/Nuvoton_NCT7718W_Datasheet_V11.pdf
+
* Philips/NXP SA56004X
Prefix: 'sa56004'
@@ -573,6 +601,21 @@ W83L771AWG/ASG
* The AWG and ASG variants only differ in package format.
* Diode ideality factor configuration (remote sensor) at 0xE3
+NCT7716:
+ * 8 bit sensor resolution
+ * Selectable address
+ * Configurable conversion rate
+
+NCT7717:
+ * 8 bit sensor resolution
+ * Configurable conversion rate
+
+NCT7718:
+ * Temperature offset register for remote temperature sensor
+ * 11 bit resolution for remote temperature sensor
+ * Low temperature limits
+ * Configurable conversion rate
+
SA56004X:
* Better local resolution
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index dd376602f3f1..70c4717b37b4 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1517,7 +1517,7 @@ config SENSORS_LM90
MAX6657, MAX6658, MAX6659, MAX6680, MAX6681, MAX6692, MAX6695,
MAX6696,
ON Semiconductor NCT1008, NCT210, NCT72, NCT214, NCT218,
- Winbond/Nuvoton W83L771W/G/AWG/ASG,
+ Winbond/Nuvoton W83L771W/G/AWG/ASG, NCT7716, NCT7717 and NCT7718,
Philips NE1618, SA56004, GMT G781, Texas Instruments TMP451 and TMP461
sensor chips.
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
index 511d95a0efb3..75f09553fd67 100644
--- a/drivers/hwmon/lm90.c
+++ b/drivers/hwmon/lm90.c
@@ -90,6 +90,9 @@
* This driver also supports NE1618 from Philips. It is similar to NE1617
* but supports 11 bit external temperature values.
*
+ * This driver also supports NCT7716, NCT7717 and NCT7718 from Nuvoton.
+ * The NCT7716 is similar to NCT7717 but has one more address support.
+ *
* Since the LM90 was the first chipset supported by this driver, most
* comments will refer to this chipset, but are actually general and
* concern all supported chipsets, unless mentioned otherwise.
@@ -119,13 +122,15 @@
* Address is fully defined internally and cannot be changed except for
* MAX6659, MAX6680 and MAX6681.
* LM86, LM89, LM90, LM99, ADM1032, ADM1032-1, ADT7461, ADT7461A, MAX6649,
- * MAX6657, MAX6658, NCT1008 and W83L771 have address 0x4c.
+ * MAX6657, MAX6658, NCT1008, NCT7718 and W83L771 have address 0x4c.
* ADM1032-2, ADT7461-2, ADT7461A-2, LM89-1, LM99-1, MAX6646, and NCT1008D
* have address 0x4d.
* MAX6647 has address 0x4e.
* MAX6659 can have address 0x4c, 0x4d or 0x4e.
* MAX6654, MAX6680, and MAX6681 can have address 0x18, 0x19, 0x1a, 0x29,
* 0x2a, 0x2b, 0x4c, 0x4d or 0x4e.
+ * NCT7716 can have address 0x48 or 0x49.
+ * NCT7717 has address 0x48.
* SA56004 can have address 0x48 through 0x4F.
*/
@@ -136,7 +141,7 @@ static const unsigned short normal_i2c[] = {
enum chips { adm1023, adm1032, adt7461, adt7461a, adt7481,
g781, lm84, lm90, lm99,
max1617, max6642, max6646, max6648, max6654, max6657, max6659, max6680, max6696,
- nct210, nct72, ne1618, sa56004, tmp451, tmp461, w83l771,
+ nct210, nct72, nct7716, nct7717, nct7718, ne1618, sa56004, tmp451, tmp461, w83l771,
};
/*
@@ -191,6 +196,9 @@ enum chips { adm1023, adm1032, adt7461, adt7461a, adt7481,
#define ADT7481_REG_MAN_ID 0x3e
#define ADT7481_REG_CHIP_ID 0x3d
+/* NCT7716/7717/7718 registers */
+#define NCT7716_REG_CHIP_ID 0xFD
+
/* Device features */
#define LM90_HAVE_EXTENDED_TEMP BIT(0) /* extended temperature support */
#define LM90_HAVE_OFFSET BIT(1) /* temperature offset register */
@@ -275,6 +283,9 @@ static const struct i2c_device_id lm90_id[] = {
{ "nct214", nct72 },
{ "nct218", nct72 },
{ "nct72", nct72 },
+ { "nct7716", nct7716 },
+ { "nct7717", nct7717 },
+ { "nct7718", nct7718 },
{ "ne1618", ne1618 },
{ "w83l771", w83l771 },
{ "sa56004", sa56004 },
@@ -382,6 +393,18 @@ static const struct of_device_id __maybe_unused lm90_of_match[] = {
.compatible = "onnn,nct72",
.data = (void *)nct72
},
+ {
+ .compatible = "nuvoton,nct7716",
+ .data = (void *)nct7716
+ },
+ {
+ .compatible = "nuvoton,nct7717",
+ .data = (void *)nct7717
+ },
+ {
+ .compatible = "nuvoton,nct7718",
+ .data = (void *)nct7718
+ },
{
.compatible = "winbond,w83l771",
.data = (void *)w83l771
@@ -601,6 +624,26 @@ static const struct lm90_params lm90_params[] = {
.resolution = 11,
.max_convrate = 7,
},
+ [nct7716] = {
+ .flags = LM90_HAVE_ALARMS | LM90_HAVE_CONVRATE,
+ .alert_alarms = 0x40,
+ .resolution = 8,
+ .max_convrate = 8,
+ },
+ [nct7717] = {
+ .flags = LM90_HAVE_ALARMS | LM90_HAVE_CONVRATE,
+ .alert_alarms = 0x40,
+ .resolution = 8,
+ .max_convrate = 8,
+ },
+ [nct7718] = {
+ .flags = LM90_HAVE_OFFSET | LM90_HAVE_REM_LIMIT_EXT | LM90_HAVE_CRIT
+ | LM90_HAVE_ALARMS | LM90_HAVE_LOW | LM90_HAVE_CONVRATE
+ | LM90_HAVE_REMOTE_EXT,
+ .alert_alarms = 0x7c,
+ .resolution = 11,
+ .max_convrate = 8,
+ },
[ne1618] = {
.flags = LM90_PAUSE_FOR_CONFIG | LM90_HAVE_BROKEN_ALERT
| LM90_HAVE_LOW | LM90_HAVE_CONVRATE | LM90_HAVE_REMOTE_EXT,
@@ -2300,6 +2343,38 @@ static const char *lm90_detect_nuvoton(struct i2c_client *client, int chip_id,
return name;
}
+static const char *lm90_detect_nuvoton_50(struct i2c_client *client, int chip_id,
+ int config1, int convrate)
+{
+ int chip_id2 = i2c_smbus_read_byte_data(client, NCT7716_REG_CHIP_ID);
+ int config2 = i2c_smbus_read_byte_data(client, LM90_REG_CONFIG2);
+ int address = client->addr;
+ const char *name = NULL;
+
+ if (chip_id2 < 0 || config2 < 0)
+ return NULL;
+
+ if (chip_id2 != 0x50 || convrate > 0x08)
+ return NULL;
+
+ switch (chip_id) {
+ case 0x90:
+ if (address == 0x48 && !(config1 & 0x3e) && !(config2 & 0xfe))
+ name = "nct7717";
+ break;
+ case 0x91:
+ if ((address == 0x48 || address == 0x49) && !(config1 & 0x3e) &&
+ !(config2 & 0xfe))
+ name = "nct7716";
+ else if (address == 0x4c && !(config1 & 0x38) && !(config2 & 0xf8))
+ name = "nct7718";
+ break;
+ default:
+ break;
+ }
+ return name;
+}
+
static const char *lm90_detect_nxp(struct i2c_client *client, bool common_address,
int chip_id, int config1, int convrate)
{
@@ -2484,6 +2559,9 @@ static int lm90_detect(struct i2c_client *client, struct i2c_board_info *info)
name = lm90_detect_maxim(client, common_address, chip_id,
config1, convrate);
break;
+ case 0x50:
+ name = lm90_detect_nuvoton_50(client, chip_id, config1, convrate);
+ break;
case 0x54: /* ON MC1066, Microchip TC1068, TCM1617 (originally TelCom) */
if (common_address && !(config1 & 0x3f) && !(convrate & 0xf8))
name = "mc1066";
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] dt-bindings: hwmon: lm90: Add support for NCT7716, NCT7717 and NCT7718
2025-01-17 10:07 [PATCH v2 0/2] hwmon: lm90: Add support for NCT7716, NCT7717 and NCT7718 Ming Yu
2025-01-17 10:07 ` [PATCH v2 1/2] hwmon: (lm90): " Ming Yu
@ 2025-01-17 10:07 ` Ming Yu
2025-01-29 16:16 ` Guenter Roeck
1 sibling, 1 reply; 5+ messages in thread
From: Ming Yu @ 2025-01-17 10:07 UTC (permalink / raw)
To: tmyu0, jdelvare, linux, corbet, robh, krzk+dt, conor+dt
Cc: linux-hwmon, linux-doc, linux-kernel, devicetree, Ming Yu,
Krzysztof Kozlowski
Add support for the Nuvoton NCT7716/7717/7718 thermal sensors.
NCT7716 and NCT7717 do not support to add temperature offset.
The maximum offset supported by NCT7718 is 127875 millicelsius
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Ming Yu <a0282524688@gmail.com>
---
Documentation/devicetree/bindings/hwmon/national,lm90.yaml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
index 6e59c8fdef30..4feb76919404 100644
--- a/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
+++ b/Documentation/devicetree/bindings/hwmon/national,lm90.yaml
@@ -32,6 +32,9 @@ properties:
- national,lm89
- national,lm90
- national,lm99
+ - nuvoton,nct7716
+ - nuvoton,nct7717
+ - nuvoton,nct7718
- nxp,sa56004
- onnn,nct1008
- ti,tmp451
@@ -120,6 +123,8 @@ allOf:
- dallas,max6659
- dallas,max6695
- dallas,max6696
+ - nuvoton,nct7716
+ - nuvoton,nct7717
then:
patternProperties:
"^channel@([0-2])$":
@@ -155,6 +160,7 @@ allOf:
- national,lm89
- national,lm90
- national,lm99
+ - nuvoton,nct7718
- nxp,sa56004
- winbond,w83l771
then:
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] dt-bindings: hwmon: lm90: Add support for NCT7716, NCT7717 and NCT7718
2025-01-17 10:07 ` [PATCH v2 2/2] dt-bindings: hwmon: lm90: " Ming Yu
@ 2025-01-29 16:16 ` Guenter Roeck
0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2025-01-29 16:16 UTC (permalink / raw)
To: Ming Yu
Cc: tmyu0, jdelvare, corbet, robh, krzk+dt, conor+dt, linux-hwmon,
linux-doc, linux-kernel, devicetree, Krzysztof Kozlowski
On Fri, Jan 17, 2025 at 06:07:44PM +0800, Ming Yu wrote:
> Add support for the Nuvoton NCT7716/7717/7718 thermal sensors.
>
> NCT7716 and NCT7717 do not support to add temperature offset.
> The maximum offset supported by NCT7718 is 127875 millicelsius
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Ming Yu <a0282524688@gmail.com>
Applied to hwmon-next.
Note that the branch will only be pushed to linux-next after the commit
window closed.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] hwmon: (lm90): Add support for NCT7716, NCT7717 and NCT7718
2025-01-17 10:07 ` [PATCH v2 1/2] hwmon: (lm90): " Ming Yu
@ 2025-01-29 16:16 ` Guenter Roeck
0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2025-01-29 16:16 UTC (permalink / raw)
To: Ming Yu
Cc: tmyu0, jdelvare, corbet, robh, krzk+dt, conor+dt, linux-hwmon,
linux-doc, linux-kernel, devicetree
On Fri, Jan 17, 2025 at 06:07:43PM +0800, Ming Yu wrote:
> NCT7716 is similar to NCT7717 but has one more address support,
> both of them only have a 8 bit resolution local thermal sensor.
>
> NCT7718 has 11 bit resoulution remote thermal sensor.
>
> Signed-off-by: Ming Yu <a0282524688@gmail.com>
Applied to hwmon-next.
Note that the branch will only be pushed to linux-next after the commit
window closed.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-29 16:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-17 10:07 [PATCH v2 0/2] hwmon: lm90: Add support for NCT7716, NCT7717 and NCT7718 Ming Yu
2025-01-17 10:07 ` [PATCH v2 1/2] hwmon: (lm90): " Ming Yu
2025-01-29 16:16 ` Guenter Roeck
2025-01-17 10:07 ` [PATCH v2 2/2] dt-bindings: hwmon: lm90: " Ming Yu
2025-01-29 16:16 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox