Skip to contentSkip to conversation

hwmon: (sht3x) Add support for GXCAS GXHT30

PATCH Superseded Zaixiang Xu 2 participants 7 messages Mar 19

Subsystems (2)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover hwmon: (sht3x) Add support for GXCAS GXHT30

This series adds support for the GXCAS GXHT30 humidity and temperature sensor. The GXHT30 is software compatible with the Sensirion SHT3x series, using the same I2C command set and conversion formulas.

Since the SHT3x series was previously undocumented in the kernel's DT binding schemas, this series also introduces the missing sensirion,sht3x.yaml binding file.

Zaixiang Xu (3):
dt-bindings: vendor-prefixes: Add GXCAS Technology
dt-bindings: hwmon: Add Sensirion SHT3x and GXCAS GXHT30
hwmon: (sht3x) Add support for GXCAS GXHT30

 Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml | 44 ++++++++++++++++++++
 Documentation/devicetree/bindings/vendor-prefixes.yaml       |  2 +
 drivers/hwmon/sht3x.c                                        | 16 +++++++-
 3 files changed, 61 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/3 dt-bindings: vendor-prefixes: Add GXCAS Technology

Add vendor prefix for Beijing Galaxy-CAS Technology Co., Ltd. (GXCAS).

---
 Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/vendor-prefixes.yaml +2 -0
index ee7fd3cfe203..354836eb8e72 100644
@@ -676,6 +676,8 @@ patternProperties:
     description: Gateworks Corporation
                  use "gateworks" vendor prefix
     deprecated: true
+  "^gxcas,.*":
+    description: Beijing Galaxy-CAS Technology Co., Ltd.
   "^hannstar,.*":
     description: HannStar Display Corporation
   "^haochuangyi,.*":
Signature · 1 line
2.34.1
#3 lore raw

PATCH 2/3 dt-bindings: hwmon: Add Sensirion SHT3x and GXCAS GXHT30

In reply to Zaixiang Xu

Add YAML devicetree binding schema for Sensirion SHT3x series and GXCAS GXHT30 humidity and temperature sensors.

---
 .../bindings/hwmon/sensirion,sht3x.yaml       | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml
Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml new file +44 -0
new file mode 100644
index 000000000000..47dbb743e2ee
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/sensirion,sht3x.yaml#
+$schema: http://devicetree.org/meta-schema.yaml#
+
+title: Sensirion SHT3x Humidity and Temperature Sensor
+
+maintainers:
+  - Zaixiang Xu <[email protected]>
+
+description: |
+  The SHT3x series is a family of humidity and temperature sensors by Sensirion.
+  It also includes compatible sensors like GXCAS GXHT30.
+
+properties:
+  compatible:
+    enum:
+      - sensirion,sht3x
+      - sensirion,sts3x
+      - sensirion,sht85
+      - gxcas,gxht30
+
+  reg:
+    maxItems: 1
+    description: I2C address (usually 0x44 or 0x45)
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        sensor@44 {
+            compatible = "gxcas,gxht30";
+            reg = <0x44>;
+        };
+    };
\ No newline at end of file
Signature · 1 line
2.34.1
#4 lore raw

Re: [PATCH 2/3] dt-bindings: hwmon: Add Sensirion SHT3x and GXCAS GXHT30

Quoted 1 line · Zaixiang Xu

Add YAML devicetree binding schema for Sensirion SHT3x series and GXCAS GXHT30 humidity and temperature sensors.

Please wrap commit message according to Linux coding style / submission process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597

Quoted 15 lines
---
 .../bindings/hwmon/sensirion,sht3x.yaml       | 44 +++++++++++++++++++
 1 file changed, 44 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml
Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml new file +2 -0
new file mode 100644
index 000000000000..47dbb743e2ee
@@ -0,0 +1,44 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2

Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml line 12

Quoted 10 lines
Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/hwmon/sensirion,sht3x.yaml#
+$schema: http://devicetree.org/meta-schema.yaml#
+
+title: Sensirion SHT3x Humidity and Temperature Sensor
+
+maintainers:
+  - Zaixiang Xu <[email protected]>
+
+description: |

Do not need '|' unless you need to preserve formatting.

Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml line 19

Quoted 7 lines
Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml new file +7 -0
+  The SHT3x series is a family of humidity and temperature sensors by Sensirion.
+  It also includes compatible sensors like GXCAS GXHT30.
+
+properties:
+  compatible:
+    enum:
+      - sensirion,sht3x

What the 'x' stands for? Wildcard?

Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml line 22

Quoted 3 lines
Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml new file +3 -0
+      - sensirion,sts3x
+      - sensirion,sht85
+      - gxcas,gxht30

Keep alphabetical order.

Quoted 13 lines
Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml new file +13 -0
+
+  reg:
+    maxItems: 1
+    description: I2C address (usually 0x44 or 0x45)
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |

Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml line 44

Quoted 10 lines
Documentation/devicetree/bindings/hwmon/sensirion,sht3x.yaml new file +9 -0
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        sensor@44 {
+            compatible = "gxcas,gxht30";
+            reg = <0x44>;
+        };
+    };
\ No newline at end of file

You have patch warnings.

No resources? No pins, supplies? Then it looks like trivial device so should go to trivial-devices.

Best regards,
Krzysztof

#5 lore raw

PATCH 3/3 hwmon: (sht3x) Add support for GXCAS GXHT30

In reply to Zaixiang Xu

Add support for GXCAS GXHT30 sensor to the sht3x driver. The GXHT30 is software compatible with the Sensirion SHT3x series.

---
 drivers/hwmon/sht3x.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/hwmon/sht3x.c +15 -1
index 08306ccb6d0b..4e2e5671610a 100644
@@ -934,13 +934,26 @@ static const struct i2c_device_id sht3x_ids[] = {
 	{"sht3x", sht3x},
 	{"sts3x", sts3x},
 	{"sht85", sht3x},
+	{"gxht30", sht3x},
 	{}
 };
 
 MODULE_DEVICE_TABLE(i2c, sht3x_ids);
 
+static const struct of_device_id sht3x_of_match[] = {
+	{ .compatible = "sensirion,sht3x" },
+	{ .compatible = "sensirion,sts3x" },
+	{ .compatible = "sensirion,sht85" },
+	{ .compatible = "gxcas,gxht30" },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sht3x_of_match);
+
 static struct i2c_driver sht3x_i2c_driver = {
-	.driver.name = "sht3x",
+	.driver = {
+		.name = "sht3x",
+		.of_match_table = sht3x_of_match,
+	},
 	.probe       = sht3x_probe,
 	.id_table    = sht3x_ids,
 };
@@ -948,5 +961,6 @@ module_i2c_driver(sht3x_i2c_driver);
 
 MODULE_AUTHOR("David Frey <[email protected]>");
 MODULE_AUTHOR("Pascal Sachs <[email protected]>");
+MODULE_AUTHOR("Your Name <[email protected]>");
 MODULE_DESCRIPTION("Sensirion SHT3x humidity and temperature sensor driver");
 MODULE_LICENSE("GPL");
Signature · 1 line
2.34.1
#6 lore raw
Quoted 1 line · Zaixiang Xu

Add support for GXCAS GXHT30 sensor to the sht3x driver. The GXHT30 is software compatible with the Sensirion SHT3x series.

Please wrap commit message according to Linux coding style / submission process (neither too early nor over the limit):
https://elixir.bootlin.com/linux/v6.4-rc1/source/Documentation/process/submitting-patches.rst#L597

Quoted 15 lines
---
 drivers/hwmon/sht3x.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/hwmon/sht3x.c +1 -0
index 08306ccb6d0b..4e2e5671610a 100644
@@ -934,13 +934,26 @@ static const struct i2c_device_id sht3x_ids[] = {
 	{"sht3x", sht3x},
 	{"sts3x", sts3x},
 	{"sht85", sht3x},
+	{"gxht30", sht3x},

drivers/hwmon/sht3x.c static const struct i2c_device_id sht3x_ids[] = { · line 947

Quoted 10 lines
drivers/hwmon/sht3x.c +5 -0
 	{}
 };
 
 MODULE_DEVICE_TABLE(i2c, sht3x_ids);
 
+static const struct of_device_id sht3x_of_match[] = {
+	{ .compatible = "sensirion,sht3x" },
+	{ .compatible = "sensirion,sts3x" },
+	{ .compatible = "sensirion,sht85" },
+	{ .compatible = "gxcas,gxht30" },

If this does not go to trivial devices, then they all look compatible so this should be expressed with fallback.

Quoted 14 lines
drivers/hwmon/sht3x.c +8 -1
+	{ }
+};
+MODULE_DEVICE_TABLE(of, sht3x_of_match);
+
 static struct i2c_driver sht3x_i2c_driver = {
-	.driver.name = "sht3x",
+	.driver = {
+		.name = "sht3x",
+		.of_match_table = sht3x_of_match,
+	},
 	.probe       = sht3x_probe,
 	.id_table    = sht3x_ids,
 };

drivers/hwmon/sht3x.c module_i2c_driver(sht3x_i2c_driver); · line 964

Quoted 4 lines
drivers/hwmon/sht3x.c +1 -0
@@ -948,5 +961,6 @@ module_i2c_driver(sht3x_i2c_driver);
 
 MODULE_AUTHOR("David Frey <[email protected]>");
 MODULE_AUTHOR("Pascal Sachs <[email protected]>");
+MODULE_AUTHOR("Your Name <[email protected]>");

Your or my name?

drivers/hwmon/sht3x.c module_i2c_driver(sht3x_i2c_driver); · line 966

Quoted 2 lines
drivers/hwmon/sht3x.c +0 -0
 MODULE_DESCRIPTION("Sensirion SHT3x humidity and temperature sensor driver");
 MODULE_LICENSE("GPL");

Best regards,
Krzysztof