mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 2/3] hwmon: (sht3x) add device-tree support
       [not found] <20230624160148.218786-1-JuenKit_Yip@hotmail.com>
@ 2023-06-24 16:01 ` JuenKit_Yip
  2023-06-24 16:34   ` Guenter Roeck
  2023-06-24 16:01 ` [PATCH 3/3] dt-bindings: <hwmon>: add sht3x devicetree binding JuenKit_Yip
  1 sibling, 1 reply; 5+ messages in thread
From: JuenKit_Yip @ 2023-06-24 16:01 UTC (permalink / raw)
  To: jdelvare, linux, krzysztof.kozlowki+dt, conor+dt, broonie,
	vincent, michal.simek, geert+renesas
  Cc: linux-hwmon, devicetree, linux-kernel, JuenKit Yip

From: JuenKit Yip <JuenKit_Yip@hotmail.com>

add "compatible" property for supporting device-tree

Signed-off-by: JuenKit Yip <JuenKit_Yip@hotmail.com>
---
 drivers/hwmon/sht3x.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c
index 9b2dadd11eeb..e7648c011e5f 100644
--- a/drivers/hwmon/sht3x.c
+++ b/drivers/hwmon/sht3x.c
@@ -925,8 +925,18 @@ static const struct i2c_device_id sht3x_ids[] = {
 
 MODULE_DEVICE_TABLE(i2c, sht3x_ids);
 
+/* devicetree ID table */
+static const struct of_device_id sht3x_of_match[] = {
+	{ .compatible = "sensirion,sht3x" },
+	{ .compatible = "sensirion,sts3x" },
+	{},
+};
+
 static struct i2c_driver sht3x_i2c_driver = {
-	.driver.name = "sht3x",
+	.driver = {
+		.name = "sht3x",
+		.of_match_table = of_match_ptr(sht3x_of_match),
+	},
 	.probe       = sht3x_probe,
 	.id_table    = sht3x_ids,
 };
-- 
2.30.2


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

* [PATCH 3/3] dt-bindings: <hwmon>: add sht3x devicetree binding
       [not found] <20230624160148.218786-1-JuenKit_Yip@hotmail.com>
  2023-06-24 16:01 ` [PATCH 2/3] hwmon: (sht3x) add device-tree support JuenKit_Yip
@ 2023-06-24 16:01 ` JuenKit_Yip
  2023-06-24 16:36   ` Guenter Roeck
  2023-06-24 17:25   ` Rob Herring
  1 sibling, 2 replies; 5+ messages in thread
From: JuenKit_Yip @ 2023-06-24 16:01 UTC (permalink / raw)
  To: jdelvare, linux, krzysztof.kozlowki+dt, conor+dt, broonie,
	vincent, michal.simek, geert+renesas
  Cc: linux-hwmon, devicetree, linux-kernel, JuenKit Yip

From: JuenKit Yip <JuenKit_Yip@hotmail.com>

add sht3x devicetree binding files

Signed-off-by: JuenKit Yip <JuenKit_Yip@hotmail.com>
---
 .../devicetree/bindings/hwmon/sht3x.yaml      | 31 +++++++++++++++++++
 .../devicetree/bindings/trivial-devices.yaml  |  4 +++
 2 files changed, 35 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/sht3x.yaml

diff --git a/Documentation/devicetree/bindings/hwmon/sht3x.yaml b/Documentation/devicetree/bindings/hwmon/sht3x.yaml
new file mode 100644
index 000000000000..8ff0b8d41f91
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/sht3x.yaml
@@ -0,0 +1,31 @@
+# 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-schemas/core.yaml#
+
+title: Sensirion SHT3x-DIS humidity and temperature sensor
+
+maintainers:
+  - JuenKit Yip <JuenKit_Yip@hotmail.com>
+
+properties:
+  compatible:
+    enum:
+      - sensirion,sht3x
+      - sensirion,sts3x
+  reg:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+
+addtionalProperties: false
+
+examples:
+  - |
+    sensor@4a {
+      compatible = "sensirion,sht3x";
+      reg = <0x4a>;
+    };
diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
index ba2bfb547909..b2369d1fad68 100644
--- a/Documentation/devicetree/bindings/trivial-devices.yaml
+++ b/Documentation/devicetree/bindings/trivial-devices.yaml
@@ -331,6 +331,10 @@ properties:
           - sensirion,sgp30
             # Sensirion gas sensor with I2C interface
           - sensirion,sgp40
+            # Sensirion SHT3x-DIS humidity and temperature sensor
+          - sensirion,sht3x
+            # Sensirion STS3x humidity sensor
+          - sensirion,sts3x
             # Sensirion temperature & humidity sensor with I2C interface
           - sensirion,sht4x
             # Sensortek 3 axis accelerometer
-- 
2.30.2


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

* Re: [PATCH 2/3] hwmon: (sht3x) add device-tree support
  2023-06-24 16:01 ` [PATCH 2/3] hwmon: (sht3x) add device-tree support JuenKit_Yip
@ 2023-06-24 16:34   ` Guenter Roeck
  0 siblings, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-06-24 16:34 UTC (permalink / raw)
  To: JuenKit_Yip, jdelvare, krzysztof.kozlowki+dt, conor+dt, broonie,
	vincent, michal.simek, geert+renesas
  Cc: linux-hwmon, devicetree, linux-kernel

On 6/24/23 09:01, JuenKit_Yip@hotmail.com wrote:
> From: JuenKit Yip <JuenKit_Yip@hotmail.com>
> 
> add "compatible" property for supporting device-tree
> 
> Signed-off-by: JuenKit Yip <JuenKit_Yip@hotmail.com>
> ---
>   drivers/hwmon/sht3x.c | 12 +++++++++++-
>   1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/sht3x.c b/drivers/hwmon/sht3x.c
> index 9b2dadd11eeb..e7648c011e5f 100644
> --- a/drivers/hwmon/sht3x.c
> +++ b/drivers/hwmon/sht3x.c
> @@ -925,8 +925,18 @@ static const struct i2c_device_id sht3x_ids[] = {
>   
>   MODULE_DEVICE_TABLE(i2c, sht3x_ids);
>   
> +/* devicetree ID table */
> +static const struct of_device_id sht3x_of_match[] = {
> +	{ .compatible = "sensirion,sht3x" },
> +	{ .compatible = "sensirion,sts3x" },
> +	{},
> +};

Add

MODULE_DEVICE_TABLE(of, sht3x_of_match);

> +
>   static struct i2c_driver sht3x_i2c_driver = {
> -	.driver.name = "sht3x",
> +	.driver = {
> +		.name = "sht3x",
> +		.of_match_table = of_match_ptr(sht3x_of_match),

Drop of_match_ptr().

> +	},
>   	.probe       = sht3x_probe,
>   	.id_table    = sht3x_ids,
>   };


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

* Re: [PATCH 3/3] dt-bindings: <hwmon>: add sht3x devicetree binding
  2023-06-24 16:01 ` [PATCH 3/3] dt-bindings: <hwmon>: add sht3x devicetree binding JuenKit_Yip
@ 2023-06-24 16:36   ` Guenter Roeck
  2023-06-24 17:25   ` Rob Herring
  1 sibling, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2023-06-24 16:36 UTC (permalink / raw)
  To: JuenKit_Yip, jdelvare, krzysztof.kozlowki+dt, conor+dt, broonie,
	vincent, michal.simek, geert+renesas
  Cc: linux-hwmon, devicetree, linux-kernel

On 6/24/23 09:01, JuenKit_Yip@hotmail.com wrote:
> From: JuenKit Yip <JuenKit_Yip@hotmail.com>
> 
> add sht3x devicetree binding files
> 
> Signed-off-by: JuenKit Yip <JuenKit_Yip@hotmail.com>
> ---
>   .../devicetree/bindings/hwmon/sht3x.yaml      | 31 +++++++++++++++++++

This isn't needed if the compatibles are added to trivial-devices.yaml
(and it really only makes sense if there are additional properties
besides compatible).

Guenter

>   .../devicetree/bindings/trivial-devices.yaml  |  4 +++
>   2 files changed, 35 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/hwmon/sht3x.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/sht3x.yaml b/Documentation/devicetree/bindings/hwmon/sht3x.yaml
> new file mode 100644
> index 000000000000..8ff0b8d41f91
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/sht3x.yaml
> @@ -0,0 +1,31 @@
> +# 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-schemas/core.yaml#
> +
> +title: Sensirion SHT3x-DIS humidity and temperature sensor
> +
> +maintainers:
> +  - JuenKit Yip <JuenKit_Yip@hotmail.com>
> +
> +properties:
> +  compatible:
> +    enum:
> +      - sensirion,sht3x
> +      - sensirion,sts3x
> +  reg:
> +    maxItems: 1
> +
> +required:
> +  - compatible
> +  - reg
> +
> +addtionalProperties: false
> +
> +examples:
> +  - |
> +    sensor@4a {
> +      compatible = "sensirion,sht3x";
> +      reg = <0x4a>;
> +    };
> diff --git a/Documentation/devicetree/bindings/trivial-devices.yaml b/Documentation/devicetree/bindings/trivial-devices.yaml
> index ba2bfb547909..b2369d1fad68 100644
> --- a/Documentation/devicetree/bindings/trivial-devices.yaml
> +++ b/Documentation/devicetree/bindings/trivial-devices.yaml
> @@ -331,6 +331,10 @@ properties:
>             - sensirion,sgp30
>               # Sensirion gas sensor with I2C interface
>             - sensirion,sgp40
> +            # Sensirion SHT3x-DIS humidity and temperature sensor
> +          - sensirion,sht3x
> +            # Sensirion STS3x humidity sensor
> +          - sensirion,sts3x
>               # Sensirion temperature & humidity sensor with I2C interface
>             - sensirion,sht4x
>               # Sensortek 3 axis accelerometer


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

* Re: [PATCH 3/3] dt-bindings: <hwmon>: add sht3x devicetree binding
  2023-06-24 16:01 ` [PATCH 3/3] dt-bindings: <hwmon>: add sht3x devicetree binding JuenKit_Yip
  2023-06-24 16:36   ` Guenter Roeck
@ 2023-06-24 17:25   ` Rob Herring
  1 sibling, 0 replies; 5+ messages in thread
From: Rob Herring @ 2023-06-24 17:25 UTC (permalink / raw)
  To: JuenKit_Yip
  Cc: vincent, linux-kernel, krzysztof.kozlowki+dt, geert+renesas,
	linux, michal.simek, linux-hwmon, jdelvare, broonie, conor+dt,
	devicetree


On Sun, 25 Jun 2023 00:01:48 +0800, JuenKit_Yip@hotmail.com wrote:
> From: JuenKit Yip <JuenKit_Yip@hotmail.com>
> 
> add sht3x devicetree binding files
> 
> Signed-off-by: JuenKit Yip <JuenKit_Yip@hotmail.com>
> ---
>  .../devicetree/bindings/hwmon/sht3x.yaml      | 31 +++++++++++++++++++
>  .../devicetree/bindings/trivial-devices.yaml  |  4 +++
>  2 files changed, 35 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/sht3x.yaml
> 

My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):

yamllint warnings/errors:
./Documentation/devicetree/bindings/hwmon/sht3x.yaml:2:2: [error] syntax error: expected alphabetic or numeric character, but found ' ' (syntax)

dtschema/dtc warnings/errors:
make[1]: *** Deleting file 'Documentation/devicetree/bindings/hwmon/sht3x.example.dts'
Documentation/devicetree/bindings/hwmon/sht3x.yaml:2:2: could not find expected directive name
make[1]: *** [Documentation/devicetree/bindings/Makefile:26: Documentation/devicetree/bindings/hwmon/sht3x.example.dts] Error 1
make[1]: *** Waiting for unfinished jobs....
./Documentation/devicetree/bindings/hwmon/sht3x.yaml:2:2: could not find expected directive name
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/hwmon/sht3x.yaml: ignoring, error parsing file
make: *** [Makefile:1512: dt_binding_check] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/DB4PR10MB626179DE1C511B10ECA74D209220A@DB4PR10MB6261.EURPRD10.PROD.OUTLOOK.COM

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.


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

end of thread, other threads:[~2023-06-24 17:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20230624160148.218786-1-JuenKit_Yip@hotmail.com>
2023-06-24 16:01 ` [PATCH 2/3] hwmon: (sht3x) add device-tree support JuenKit_Yip
2023-06-24 16:34   ` Guenter Roeck
2023-06-24 16:01 ` [PATCH 3/3] dt-bindings: <hwmon>: add sht3x devicetree binding JuenKit_Yip
2023-06-24 16:36   ` Guenter Roeck
2023-06-24 17:25   ` Rob Herring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®