linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/4] hwmon: (sht21) Add devicetree support
@ 2025-09-08 15:54 Kurt Borja
  2025-09-08 15:54 ` [PATCH v4 1/4] hwmon: (sht21) Documentation cleanup Kurt Borja
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Kurt Borja @ 2025-09-08 15:54 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-hwmon, linux-doc, linux-kernel, devicetree, Kurt Borja

Hi all,

The sht21 driver actually supports all i2c sht2x chips so add support
for those names and additionally add DT support.

Tested for sht20 and verified against the datasheet for sht25.

Thanks!

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
Changes in v4:
- Reorder dt-bindings patch
- Drop stable tags
- Link to v3: https://lore.kernel.org/r/20250907-sht2x-v3-0-bf846bd1534b@gmail.com

Changes in v3:
- Add MODULE_DEVICE_TABLE() (I forgot, sorry for the noise!)
- Link to v2: https://lore.kernel.org/r/20250907-sht2x-v2-0-1c7dc90abf8e@gmail.com

Changes in v2:
- Add a documentation cleanup patch
- Add entry for each chip instead of sht2x placeholder
- Update Kconfig too
- Link to v1: https://lore.kernel.org/r/20250907-sht2x-v1-0-fd56843b1b43@gmail.com

---
Kurt Borja (4):
      hwmon: (sht21) Documentation cleanup
      hwmon: (sht21) Add support for SHT20, SHT25 chips
      dt-bindings: trivial-devices: Add sht2x sensors
      hwmon: (sht21) Add devicetree support

 .../devicetree/bindings/trivial-devices.yaml       |  3 +++
 Documentation/hwmon/sht21.rst                      | 26 +++++++++++++---------
 drivers/hwmon/Kconfig                              |  4 ++--
 drivers/hwmon/sht21.c                              | 15 ++++++++++++-
 4 files changed, 34 insertions(+), 14 deletions(-)
---
base-commit: 76eeb9b8de9880ca38696b2fb56ac45ac0a25c6c
change-id: 20250907-sht2x-9b96125a0cf5
-- 
 ~ Kurt


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4 1/4] hwmon: (sht21) Documentation cleanup
  2025-09-08 15:54 [PATCH v4 0/4] hwmon: (sht21) Add devicetree support Kurt Borja
@ 2025-09-08 15:54 ` Kurt Borja
  2025-09-08 19:20   ` Guenter Roeck
  2025-09-08 15:54 ` [PATCH v4 2/4] hwmon: (sht21) Add support for SHT20, SHT25 chips Kurt Borja
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Kurt Borja @ 2025-09-08 15:54 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-hwmon, linux-doc, linux-kernel, devicetree, Kurt Borja

Drop extra empty lines and organize sysfs entries in a table.

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
 Documentation/hwmon/sht21.rst | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/Documentation/hwmon/sht21.rst b/Documentation/hwmon/sht21.rst
index 1bccc8e8aac8d3532ec17dcdbc6a172102877085..9f66cd51b45dc4b89ce757d2209445478de046cd 100644
--- a/Documentation/hwmon/sht21.rst
+++ b/Documentation/hwmon/sht21.rst
@@ -13,8 +13,6 @@ Supported chips:
 
     https://www.sensirion.com/file/datasheet_sht21
 
-
-
   * Sensirion SHT25
 
     Prefix: 'sht25'
@@ -25,8 +23,6 @@ Supported chips:
 
     https://www.sensirion.com/file/datasheet_sht25
 
-
-
 Author:
 
   Urs Fleisch <urs.fleisch@sensirion.com>
@@ -47,13 +43,11 @@ in the board setup code.
 sysfs-Interface
 ---------------
 
-temp1_input
-	- temperature input
-
-humidity1_input
-	- humidity input
-eic
-	- Electronic Identification Code
+=================== ============================================================
+temp1_input         Temperature input
+humidity1_input     Humidity input
+eic                 Electronic Identification Code
+=================== ============================================================
 
 Notes
 -----

-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 2/4] hwmon: (sht21) Add support for SHT20, SHT25 chips
  2025-09-08 15:54 [PATCH v4 0/4] hwmon: (sht21) Add devicetree support Kurt Borja
  2025-09-08 15:54 ` [PATCH v4 1/4] hwmon: (sht21) Documentation cleanup Kurt Borja
@ 2025-09-08 15:54 ` Kurt Borja
  2025-09-08 19:21   ` Guenter Roeck
  2025-09-08 15:54 ` [PATCH v4 3/4] dt-bindings: trivial-devices: Add sht2x sensors Kurt Borja
  2025-09-08 15:54 ` [PATCH v4 4/4] hwmon: (sht21) Add devicetree support Kurt Borja
  3 siblings, 1 reply; 11+ messages in thread
From: Kurt Borja @ 2025-09-08 15:54 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-hwmon, linux-doc, linux-kernel, devicetree, Kurt Borja

All sht2x chips share the same communication protocol so add support for
them.

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
 Documentation/hwmon/sht21.rst | 10 ++++++++++
 drivers/hwmon/Kconfig         |  4 ++--
 drivers/hwmon/sht21.c         |  2 ++
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/Documentation/hwmon/sht21.rst b/Documentation/hwmon/sht21.rst
index 9f66cd51b45dc4b89ce757d2209445478de046cd..d20e8a460ba6c7c8452bcdce68a1fce963413640 100644
--- a/Documentation/hwmon/sht21.rst
+++ b/Documentation/hwmon/sht21.rst
@@ -3,6 +3,16 @@ Kernel driver sht21
 
 Supported chips:
 
+  * Sensirion SHT20
+
+    Prefix: 'sht20'
+
+    Addresses scanned: none
+
+    Datasheet: Publicly available at the Sensirion website
+
+    https://www.sensirion.com/file/datasheet_sht20
+
   * Sensirion SHT21
 
     Prefix: 'sht21'
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 9d28fcf7cd2a6f9e2f54694a717bd85ff4047b46..90dc8051418689e7a92293df15ce35cd822c77ff 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -1930,8 +1930,8 @@ config SENSORS_SHT21
 	tristate "Sensiron humidity and temperature sensors. SHT21 and compat."
 	depends on I2C
 	help
-	  If you say yes here you get support for the Sensiron SHT21, SHT25
-	  humidity and temperature sensors.
+	  If you say yes here you get support for the Sensiron SHT20, SHT21,
+	  SHT25 humidity and temperature sensors.
 
 	  This driver can also be built as a module. If so, the module
 	  will be called sht21.
diff --git a/drivers/hwmon/sht21.c b/drivers/hwmon/sht21.c
index 97327313529b467ed89d8f6b06c2d78efd54efbf..97d71e3361e9d7f0512880149ba6479601b2fc0c 100644
--- a/drivers/hwmon/sht21.c
+++ b/drivers/hwmon/sht21.c
@@ -275,7 +275,9 @@ static int sht21_probe(struct i2c_client *client)
 
 /* Device ID table */
 static const struct i2c_device_id sht21_id[] = {
+	{ "sht20" },
 	{ "sht21" },
+	{ "sht25" },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, sht21_id);

-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 3/4] dt-bindings: trivial-devices: Add sht2x sensors
  2025-09-08 15:54 [PATCH v4 0/4] hwmon: (sht21) Add devicetree support Kurt Borja
  2025-09-08 15:54 ` [PATCH v4 1/4] hwmon: (sht21) Documentation cleanup Kurt Borja
  2025-09-08 15:54 ` [PATCH v4 2/4] hwmon: (sht21) Add support for SHT20, SHT25 chips Kurt Borja
@ 2025-09-08 15:54 ` Kurt Borja
  2025-09-09  7:02   ` Krzysztof Kozlowski
  2025-09-09 12:25   ` Guenter Roeck
  2025-09-08 15:54 ` [PATCH v4 4/4] hwmon: (sht21) Add devicetree support Kurt Borja
  3 siblings, 2 replies; 11+ messages in thread
From: Kurt Borja @ 2025-09-08 15:54 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-hwmon, linux-doc, linux-kernel, devicetree, Kurt Borja

Add sensirion,sht2x trivial sensors.

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
 Documentation/devicetree/bindings/trivial-devices.yaml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index f3dd18681aa6f81255141bdda6daf8e45369a2c2..952244a7105591a0095b1ae57da7cb7345bdfc61 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -362,6 +362,9 @@ properties:
             # Sensirion low power multi-pixel gas sensor with I2C interface
           - sensirion,sgpc3
             # Sensirion temperature & humidity sensor with I2C interface
+          - sensirion,sht20
+          - sensirion,sht21
+          - sensirion,sht25
           - sensirion,sht4x
             # Sensortek 3 axis accelerometer
           - sensortek,stk8312

-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH v4 4/4] hwmon: (sht21) Add devicetree support
  2025-09-08 15:54 [PATCH v4 0/4] hwmon: (sht21) Add devicetree support Kurt Borja
                   ` (2 preceding siblings ...)
  2025-09-08 15:54 ` [PATCH v4 3/4] dt-bindings: trivial-devices: Add sht2x sensors Kurt Borja
@ 2025-09-08 15:54 ` Kurt Borja
  2025-09-09 12:26   ` Guenter Roeck
  3 siblings, 1 reply; 11+ messages in thread
From: Kurt Borja @ 2025-09-08 15:54 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck, Jonathan Corbet, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: linux-hwmon, linux-doc, linux-kernel, devicetree, Kurt Borja

Add DT support for sht2x chips.

Signed-off-by: Kurt Borja <kuurtb@gmail.com>
---
 drivers/hwmon/sht21.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/sht21.c b/drivers/hwmon/sht21.c
index 97d71e3361e9d7f0512880149ba6479601b2fc0c..627d35070a420ab9e51634bdc5cf5e3de3853326 100644
--- a/drivers/hwmon/sht21.c
+++ b/drivers/hwmon/sht21.c
@@ -282,8 +282,19 @@ static const struct i2c_device_id sht21_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, sht21_id);
 
+static const struct of_device_id sht21_of_match[] = {
+	{ .compatible = "sensirion,sht20" },
+	{ .compatible = "sensirion,sht21" },
+	{ .compatible = "sensirion,sht25" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sht21_of_match);
+
 static struct i2c_driver sht21_driver = {
-	.driver.name = "sht21",
+	.driver = {
+		.name = "sht21",
+		.of_match_table = sht21_of_match,
+	},
 	.probe       = sht21_probe,
 	.id_table    = sht21_id,
 };

-- 
2.51.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 1/4] hwmon: (sht21) Documentation cleanup
  2025-09-08 15:54 ` [PATCH v4 1/4] hwmon: (sht21) Documentation cleanup Kurt Borja
@ 2025-09-08 19:20   ` Guenter Roeck
  0 siblings, 0 replies; 11+ messages in thread
From: Guenter Roeck @ 2025-09-08 19:20 UTC (permalink / raw)
  To: Kurt Borja
  Cc: Jean Delvare, Jonathan Corbet, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-hwmon, linux-doc,
	linux-kernel, devicetree

On Mon, Sep 08, 2025 at 10:54:49AM -0500, Kurt Borja wrote:
> Drop extra empty lines and organize sysfs entries in a table.
> 
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>

Applied.

Guenter

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 2/4] hwmon: (sht21) Add support for SHT20, SHT25 chips
  2025-09-08 15:54 ` [PATCH v4 2/4] hwmon: (sht21) Add support for SHT20, SHT25 chips Kurt Borja
@ 2025-09-08 19:21   ` Guenter Roeck
  0 siblings, 0 replies; 11+ messages in thread
From: Guenter Roeck @ 2025-09-08 19:21 UTC (permalink / raw)
  To: Kurt Borja
  Cc: Jean Delvare, Jonathan Corbet, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-hwmon, linux-doc,
	linux-kernel, devicetree

On Mon, Sep 08, 2025 at 10:54:50AM -0500, Kurt Borja wrote:
> All sht2x chips share the same communication protocol so add support for
> them.
> 
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>

Applied.
Guenter

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 3/4] dt-bindings: trivial-devices: Add sht2x sensors
  2025-09-08 15:54 ` [PATCH v4 3/4] dt-bindings: trivial-devices: Add sht2x sensors Kurt Borja
@ 2025-09-09  7:02   ` Krzysztof Kozlowski
  2025-09-09 12:25   ` Guenter Roeck
  1 sibling, 0 replies; 11+ messages in thread
From: Krzysztof Kozlowski @ 2025-09-09  7:02 UTC (permalink / raw)
  To: Kurt Borja
  Cc: Jean Delvare, Guenter Roeck, Jonathan Corbet, Andy Shevchenko,
	Rob Herring, Krzysztof Kozlowski, Conor Dooley, linux-hwmon,
	linux-doc, linux-kernel, devicetree

On Mon, Sep 08, 2025 at 10:54:51AM -0500, Kurt Borja wrote:
> Add sensirion,sht2x trivial sensors.
> 
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> ---
>  Documentation/devicetree/bindings/trivial-devices.yaml | 3 +++
>  1 file changed, 3 insertions(+)

Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 3/4] dt-bindings: trivial-devices: Add sht2x sensors
  2025-09-08 15:54 ` [PATCH v4 3/4] dt-bindings: trivial-devices: Add sht2x sensors Kurt Borja
  2025-09-09  7:02   ` Krzysztof Kozlowski
@ 2025-09-09 12:25   ` Guenter Roeck
  2025-09-09 17:18     ` Kurt Borja
  1 sibling, 1 reply; 11+ messages in thread
From: Guenter Roeck @ 2025-09-09 12:25 UTC (permalink / raw)
  To: Kurt Borja
  Cc: Jean Delvare, Jonathan Corbet, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-hwmon, linux-doc,
	linux-kernel, devicetree

On Mon, Sep 08, 2025 at 10:54:51AM -0500, Kurt Borja wrote:
> Add sensirion,sht2x trivial sensors.
> 
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Applied.

Guenter

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 4/4] hwmon: (sht21) Add devicetree support
  2025-09-08 15:54 ` [PATCH v4 4/4] hwmon: (sht21) Add devicetree support Kurt Borja
@ 2025-09-09 12:26   ` Guenter Roeck
  0 siblings, 0 replies; 11+ messages in thread
From: Guenter Roeck @ 2025-09-09 12:26 UTC (permalink / raw)
  To: Kurt Borja
  Cc: Jean Delvare, Jonathan Corbet, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-hwmon, linux-doc,
	linux-kernel, devicetree

On Mon, Sep 08, 2025 at 10:54:52AM -0500, Kurt Borja wrote:
> Add DT support for sht2x chips.
> 
> Signed-off-by: Kurt Borja <kuurtb@gmail.com>

Applied.

Guenter

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 3/4] dt-bindings: trivial-devices: Add sht2x sensors
  2025-09-09 12:25   ` Guenter Roeck
@ 2025-09-09 17:18     ` Kurt Borja
  0 siblings, 0 replies; 11+ messages in thread
From: Kurt Borja @ 2025-09-09 17:18 UTC (permalink / raw)
  To: Guenter Roeck, Kurt Borja
  Cc: Jean Delvare, Jonathan Corbet, Andy Shevchenko, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, linux-hwmon, linux-doc,
	linux-kernel, devicetree

On Tue Sep 9, 2025 at 7:25 AM -05, Guenter Roeck wrote:
> On Mon, Sep 08, 2025 at 10:54:51AM -0500, Kurt Borja wrote:
>> Add sensirion,sht2x trivial sensors.
>> 
>> Signed-off-by: Kurt Borja <kuurtb@gmail.com>
>> Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> Applied.
>
> Guenter

Thanks Guenter and Krzysztof!


-- 
 ~ Kurt


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2025-09-09 17:19 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-08 15:54 [PATCH v4 0/4] hwmon: (sht21) Add devicetree support Kurt Borja
2025-09-08 15:54 ` [PATCH v4 1/4] hwmon: (sht21) Documentation cleanup Kurt Borja
2025-09-08 19:20   ` Guenter Roeck
2025-09-08 15:54 ` [PATCH v4 2/4] hwmon: (sht21) Add support for SHT20, SHT25 chips Kurt Borja
2025-09-08 19:21   ` Guenter Roeck
2025-09-08 15:54 ` [PATCH v4 3/4] dt-bindings: trivial-devices: Add sht2x sensors Kurt Borja
2025-09-09  7:02   ` Krzysztof Kozlowski
2025-09-09 12:25   ` Guenter Roeck
2025-09-09 17:18     ` Kurt Borja
2025-09-08 15:54 ` [PATCH v4 4/4] hwmon: (sht21) Add devicetree support Kurt Borja
2025-09-09 12:26   ` 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).