* [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding
@ 2022-02-18 9:06 Christian Lamparter
2022-02-18 9:06 ` [PATCH v2 2/2] hwmon: (lm70) Add ti,tmp125 support Christian Lamparter
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Christian Lamparter @ 2022-02-18 9:06 UTC (permalink / raw)
To: linux-hwmon, devicetree; +Cc: Jean Delvare, Guenter Roeck, Rob Herring
From the freely available Texas Instruments' TMP125 datasheet:
"The TMP125 is an SPI-compatible temperature sensor available in the
tiny SOT23-6 package. Requiring no external components, the TMP125
is capable of measuring temperatures within 2 degree C of accuracy
over a temperature range of −25 degree C to +85 degree C and
2.5 degree C of accuracy over −40 degree C to +125 degree C."
The TMP125 is very similar to the TMP121/TMP122 series of familiar
chips.
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
---
Documentation/devicetree/bindings/trivial-devices.yaml | 1 +
1 file changed, 1 insertion(+)
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index 091792ba993e..09b98bf97c8d 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -337,6 +337,7 @@ properties:
# Thermometer with SPI interface
- ti,tmp121
- ti,tmp122
+ - ti,tmp125
# Digital Temperature Sensor
- ti,tmp275
# TI DC-DC converter on PMBus
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v2 2/2] hwmon: (lm70) Add ti,tmp125 support
2022-02-18 9:06 [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding Christian Lamparter
@ 2022-02-18 9:06 ` Christian Lamparter
2022-02-25 2:07 ` Guenter Roeck
2022-02-18 11:45 ` [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding Krzysztof Kozlowski
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Christian Lamparter @ 2022-02-18 9:06 UTC (permalink / raw)
To: linux-hwmon, devicetree; +Cc: Jean Delvare, Guenter Roeck, Rob Herring
The TMP125 is a 2 degree Celsius accurate Digital
Temperature Sensor with a SPI interface.
The temperature register is a 16-bit, read-only register.
The MSB (Bit 15) is a leading zero and never set. Bits 14
to 5 are the 1+9 temperature data bits in a two's
complement format. Bits 4 to 0 are useless copies of
Bit 5 value and therefore ignored.
This was tested on a Aerohive HiveAP-350.
Bonus: lm70 supports TMP122/TMP124 as well.
I added them to the Kconfig module description.
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
---
v1 -> v2: - spelling fixes + nicer (IMHO) texts (Roeck)
- added entry to Documentation/hwmon/lm70.rst (Roeck)
---
Documentation/hwmon/lm70.rst | 7 +++++++
drivers/hwmon/Kconfig | 4 ++--
drivers/hwmon/lm70.c | 16 ++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/Documentation/hwmon/lm70.rst b/Documentation/hwmon/lm70.rst
index 6ddc5b67ccb5..11303a7e16a8 100644
--- a/Documentation/hwmon/lm70.rst
+++ b/Documentation/hwmon/lm70.rst
@@ -15,6 +15,10 @@ Supported chips:
Information: https://www.ti.com/product/tmp122
+ * Texas Instruments TMP125
+
+ Information: https://www.ti.com/product/tmp125
+
* National Semiconductor LM71
Datasheet: https://www.ti.com/product/LM71
@@ -53,6 +57,9 @@ The LM74 and TMP121/TMP122/TMP123/TMP124 are very similar; main difference is
The TMP122/TMP124 also feature configurable temperature thresholds.
+The TMP125 is less accurate and provides 10-bit temperature data
+with 0.25 degrees Celsius resolution.
+
The LM71 is also very similar; main difference is 14-bit temperature
data (0.03125 degrees celsius resolution).
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 8df25f1079ba..94a47e70533f 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1208,8 +1208,8 @@ config SENSORS_LM70
depends on SPI_MASTER
help
If you say yes here you get support for the National Semiconductor
- LM70, LM71, LM74 and Texas Instruments TMP121/TMP123 digital tempera-
- ture sensor chips.
+ LM70, LM71, LM74 and Texas Instruments TMP121/TMP123, TMP122/TMP124,
+ TMP125 digital temperature sensor chips.
This driver can also be built as a module. If so, the module
will be called lm70.
diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
index d2a60de5b8de..c20a749fc7f2 100644
--- a/drivers/hwmon/lm70.c
+++ b/drivers/hwmon/lm70.c
@@ -34,6 +34,7 @@
#define LM70_CHIP_LM71 2 /* NS LM71 */
#define LM70_CHIP_LM74 3 /* NS LM74 */
#define LM70_CHIP_TMP122 4 /* TI TMP122/TMP124 */
+#define LM70_CHIP_TMP125 5 /* TI TMP125 */
struct lm70 {
struct spi_device *spi;
@@ -87,6 +88,12 @@ static ssize_t temp1_input_show(struct device *dev,
* LM71:
* 14 bits of 2's complement data, discard LSB 2 bits,
* resolution 0.0312 degrees celsius.
+ *
+ * TMP125:
+ * MSB/D15 is a leading zero. D14 is the sign-bit. This is
+ * followed by 9 temperature bits (D13..D5) in 2's complement
+ * data format with a resolution of 0.25 degrees celsius per unit.
+ * LSB 5 bits (D4..D0) share the same value as D5 and get discarded.
*/
switch (p_lm70->chip) {
case LM70_CHIP_LM70:
@@ -102,6 +109,10 @@ static ssize_t temp1_input_show(struct device *dev,
case LM70_CHIP_LM71:
val = ((int)raw / 4) * 3125 / 100;
break;
+
+ case LM70_CHIP_TMP125:
+ val = (sign_extend32(raw, 14) / 32) * 250;
+ break;
}
status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */
@@ -135,6 +146,10 @@ static const struct of_device_id lm70_of_ids[] = {
.compatible = "ti,tmp122",
.data = (void *) LM70_CHIP_TMP122,
},
+ {
+ .compatible = "ti,tmp125",
+ .data = (void *) LM70_CHIP_TMP125,
+ },
{
.compatible = "ti,lm71",
.data = (void *) LM70_CHIP_LM71,
@@ -184,6 +199,7 @@ static const struct spi_device_id lm70_ids[] = {
{ "lm70", LM70_CHIP_LM70 },
{ "tmp121", LM70_CHIP_TMP121 },
{ "tmp122", LM70_CHIP_TMP122 },
+ { "tmp125", LM70_CHIP_TMP125 },
{ "lm71", LM70_CHIP_LM71 },
{ "lm74", LM70_CHIP_LM74 },
{ },
--
2.35.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding
2022-02-18 9:06 [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding Christian Lamparter
2022-02-18 9:06 ` [PATCH v2 2/2] hwmon: (lm70) Add ti,tmp125 support Christian Lamparter
@ 2022-02-18 11:45 ` Krzysztof Kozlowski
2022-02-24 22:46 ` Rob Herring
2022-02-25 2:06 ` Guenter Roeck
3 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Kozlowski @ 2022-02-18 11:45 UTC (permalink / raw)
To: Christian Lamparter, linux-hwmon, devicetree
Cc: Jean Delvare, Guenter Roeck, Rob Herring
On 18/02/2022 10:06, Christian Lamparter wrote:
> From the freely available Texas Instruments' TMP125 datasheet:
>
> "The TMP125 is an SPI-compatible temperature sensor available in the
> tiny SOT23-6 package. Requiring no external components, the TMP125
> is capable of measuring temperatures within 2 degree C of accuracy
> over a temperature range of −25 degree C to +85 degree C and
> 2.5 degree C of accuracy over −40 degree C to +125 degree C."
>
> The TMP125 is very similar to the TMP121/TMP122 series of familiar
> chips.
>
> Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
> ---
> Documentation/devicetree/bindings/trivial-devices.yaml | 1 +
> 1 file changed, 1 insertion(+)
>
Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding
2022-02-18 9:06 [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding Christian Lamparter
2022-02-18 9:06 ` [PATCH v2 2/2] hwmon: (lm70) Add ti,tmp125 support Christian Lamparter
2022-02-18 11:45 ` [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding Krzysztof Kozlowski
@ 2022-02-24 22:46 ` Rob Herring
2022-02-25 2:06 ` Guenter Roeck
3 siblings, 0 replies; 6+ messages in thread
From: Rob Herring @ 2022-02-24 22:46 UTC (permalink / raw)
To: Christian Lamparter; +Cc: linux-hwmon, devicetree, Jean Delvare, Guenter Roeck
On Fri, Feb 18, 2022 at 10:06:42AM +0100, Christian Lamparter wrote:
> From the freely available Texas Instruments' TMP125 datasheet:
>
> "The TMP125 is an SPI-compatible temperature sensor available in the
> tiny SOT23-6 package. Requiring no external components, the TMP125
> is capable of measuring temperatures within 2 degree C of accuracy
> over a temperature range of −25 degree C to +85 degree C and
> 2.5 degree C of accuracy over −40 degree C to +125 degree C."
>
> The TMP125 is very similar to the TMP121/TMP122 series of familiar
> chips.
>
> Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
> ---
> Documentation/devicetree/bindings/trivial-devices.yaml | 1 +
> 1 file changed, 1 insertion(+)
Acked-by: Rob Herring <robh@kernel.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding
2022-02-18 9:06 [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding Christian Lamparter
` (2 preceding siblings ...)
2022-02-24 22:46 ` Rob Herring
@ 2022-02-25 2:06 ` Guenter Roeck
3 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2022-02-25 2:06 UTC (permalink / raw)
To: Christian Lamparter; +Cc: linux-hwmon, devicetree, Jean Delvare, Rob Herring
On Fri, Feb 18, 2022 at 10:06:42AM +0100, Christian Lamparter wrote:
> From the freely available Texas Instruments' TMP125 datasheet:
>
> "The TMP125 is an SPI-compatible temperature sensor available in the
> tiny SOT23-6 package. Requiring no external components, the TMP125
> is capable of measuring temperatures within 2 degree C of accuracy
> over a temperature range of −25 degree C to +85 degree C and
> 2.5 degree C of accuracy over −40 degree C to +125 degree C."
>
> The TMP125 is very similar to the TMP121/TMP122 series of familiar
> chips.
>
> Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
> Acked-by: Rob Herring <robh@kernel.org>
Applied to hwmon-next.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2 2/2] hwmon: (lm70) Add ti,tmp125 support
2022-02-18 9:06 ` [PATCH v2 2/2] hwmon: (lm70) Add ti,tmp125 support Christian Lamparter
@ 2022-02-25 2:07 ` Guenter Roeck
0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2022-02-25 2:07 UTC (permalink / raw)
To: Christian Lamparter; +Cc: linux-hwmon, devicetree, Jean Delvare, Rob Herring
On Fri, Feb 18, 2022 at 10:06:43AM +0100, Christian Lamparter wrote:
> The TMP125 is a 2 degree Celsius accurate Digital
> Temperature Sensor with a SPI interface.
>
> The temperature register is a 16-bit, read-only register.
> The MSB (Bit 15) is a leading zero and never set. Bits 14
> to 5 are the 1+9 temperature data bits in a two's
> complement format. Bits 4 to 0 are useless copies of
> Bit 5 value and therefore ignored.
>
> This was tested on a Aerohive HiveAP-350.
>
> Bonus: lm70 supports TMP122/TMP124 as well.
> I added them to the Kconfig module description.
>
> Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Applied to hwmon-next.
Thanks,
Guenter
> ---
> v1 -> v2: - spelling fixes + nicer (IMHO) texts (Roeck)
> - added entry to Documentation/hwmon/lm70.rst (Roeck)
> ---
> Documentation/hwmon/lm70.rst | 7 +++++++
> drivers/hwmon/Kconfig | 4 ++--
> drivers/hwmon/lm70.c | 16 ++++++++++++++++
> 3 files changed, 25 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/hwmon/lm70.rst b/Documentation/hwmon/lm70.rst
> index 6ddc5b67ccb5..11303a7e16a8 100644
> --- a/Documentation/hwmon/lm70.rst
> +++ b/Documentation/hwmon/lm70.rst
> @@ -15,6 +15,10 @@ Supported chips:
>
> Information: https://www.ti.com/product/tmp122
>
> + * Texas Instruments TMP125
> +
> + Information: https://www.ti.com/product/tmp125
> +
> * National Semiconductor LM71
>
> Datasheet: https://www.ti.com/product/LM71
> @@ -53,6 +57,9 @@ The LM74 and TMP121/TMP122/TMP123/TMP124 are very similar; main difference is
>
> The TMP122/TMP124 also feature configurable temperature thresholds.
>
> +The TMP125 is less accurate and provides 10-bit temperature data
> +with 0.25 degrees Celsius resolution.
> +
> The LM71 is also very similar; main difference is 14-bit temperature
> data (0.03125 degrees celsius resolution).
>
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 8df25f1079ba..94a47e70533f 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -1208,8 +1208,8 @@ config SENSORS_LM70
> depends on SPI_MASTER
> help
> If you say yes here you get support for the National Semiconductor
> - LM70, LM71, LM74 and Texas Instruments TMP121/TMP123 digital tempera-
> - ture sensor chips.
> + LM70, LM71, LM74 and Texas Instruments TMP121/TMP123, TMP122/TMP124,
> + TMP125 digital temperature sensor chips.
>
> This driver can also be built as a module. If so, the module
> will be called lm70.
> diff --git a/drivers/hwmon/lm70.c b/drivers/hwmon/lm70.c
> index d2a60de5b8de..c20a749fc7f2 100644
> --- a/drivers/hwmon/lm70.c
> +++ b/drivers/hwmon/lm70.c
> @@ -34,6 +34,7 @@
> #define LM70_CHIP_LM71 2 /* NS LM71 */
> #define LM70_CHIP_LM74 3 /* NS LM74 */
> #define LM70_CHIP_TMP122 4 /* TI TMP122/TMP124 */
> +#define LM70_CHIP_TMP125 5 /* TI TMP125 */
>
> struct lm70 {
> struct spi_device *spi;
> @@ -87,6 +88,12 @@ static ssize_t temp1_input_show(struct device *dev,
> * LM71:
> * 14 bits of 2's complement data, discard LSB 2 bits,
> * resolution 0.0312 degrees celsius.
> + *
> + * TMP125:
> + * MSB/D15 is a leading zero. D14 is the sign-bit. This is
> + * followed by 9 temperature bits (D13..D5) in 2's complement
> + * data format with a resolution of 0.25 degrees celsius per unit.
> + * LSB 5 bits (D4..D0) share the same value as D5 and get discarded.
> */
> switch (p_lm70->chip) {
> case LM70_CHIP_LM70:
> @@ -102,6 +109,10 @@ static ssize_t temp1_input_show(struct device *dev,
> case LM70_CHIP_LM71:
> val = ((int)raw / 4) * 3125 / 100;
> break;
> +
> + case LM70_CHIP_TMP125:
> + val = (sign_extend32(raw, 14) / 32) * 250;
> + break;
> }
>
> status = sprintf(buf, "%d\n", val); /* millidegrees Celsius */
> @@ -135,6 +146,10 @@ static const struct of_device_id lm70_of_ids[] = {
> .compatible = "ti,tmp122",
> .data = (void *) LM70_CHIP_TMP122,
> },
> + {
> + .compatible = "ti,tmp125",
> + .data = (void *) LM70_CHIP_TMP125,
> + },
> {
> .compatible = "ti,lm71",
> .data = (void *) LM70_CHIP_LM71,
> @@ -184,6 +199,7 @@ static const struct spi_device_id lm70_ids[] = {
> { "lm70", LM70_CHIP_LM70 },
> { "tmp121", LM70_CHIP_TMP121 },
> { "tmp122", LM70_CHIP_TMP122 },
> + { "tmp125", LM70_CHIP_TMP125 },
> { "lm71", LM70_CHIP_LM71 },
> { "lm74", LM70_CHIP_LM74 },
> { },
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2022-02-25 2:07 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-18 9:06 [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding Christian Lamparter
2022-02-18 9:06 ` [PATCH v2 2/2] hwmon: (lm70) Add ti,tmp125 support Christian Lamparter
2022-02-25 2:07 ` Guenter Roeck
2022-02-18 11:45 ` [PATCH v2 1/2] dt-bindings: Add ti,tmp125 temperature sensor binding Krzysztof Kozlowski
2022-02-24 22:46 ` Rob Herring
2022-02-25 2:06 ` Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).