* [PATCH 0/2] iio: humidity: si7020: Check device property for skipping reset in probe
@ 2022-05-11 19:08 Eddie James
2022-05-11 19:08 ` [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings Eddie James
2022-05-11 19:08 ` [PATCH 2/2] iio: humidity: si7020: Check device property for skipping reset in probe Eddie James
0 siblings, 2 replies; 8+ messages in thread
From: Eddie James @ 2022-05-11 19:08 UTC (permalink / raw)
To: linux-iio
Cc: linux-kernel, devicetree, jic23, lars, robh+dt,
krzysztof.kozlowski+dt, dbarksdale, eajames
I2C commands issued after the SI7020 is starting up or after reset
can potentially upset the startup sequence. Therefore, the host
needs to wait for the startup sequence to finish before issuing
further i2c commands. This is impractical in cases where the SI7020
is on a shared bus or behind a mux, which may switch channels at
any time (generating I2C traffic). Therefore, check for a device
property that indicates that the driver should skip resetting the
device when probing.
Eddie James (2):
dt-bindings: iio: humidity: Add si7020 bindings
iio: humidity: si7020: Check device property for skipping reset in probe
.../bindings/iio/humidity/silabs,si7020.yaml | 42 +++++++++++++++++++
drivers/iio/humidity/si7020.c | 14 ++++---
2 files changed, 50 insertions(+), 6 deletions(-)
create mode 100644 Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
--
2.27.0
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings
2022-05-11 19:08 [PATCH 0/2] iio: humidity: si7020: Check device property for skipping reset in probe Eddie James
@ 2022-05-11 19:08 ` Eddie James
2022-05-11 22:08 ` Eddie James
` (3 more replies)
2022-05-11 19:08 ` [PATCH 2/2] iio: humidity: si7020: Check device property for skipping reset in probe Eddie James
1 sibling, 4 replies; 8+ messages in thread
From: Eddie James @ 2022-05-11 19:08 UTC (permalink / raw)
To: linux-iio
Cc: linux-kernel, devicetree, jic23, lars, robh+dt,
krzysztof.kozlowski+dt, dbarksdale, eajames
Document the si7020 bindings with a new "silabs,skip-reset" property.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
.../bindings/iio/humidity/silabs,si7020.yaml | 42 +++++++++++++++++++
1 file changed, 42 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
diff --git a/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml b/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
new file mode 100644
index 000000000000..ab53bb8d9606
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
@@ -0,0 +1,42 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/humidity/silabs,si7020.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SI7020 humidity + temperature sensor
+
+maintainers:
+ - David Barksdale <dbarksdale@uplogix.com>
+
+description: |
+ The Silicon Labs Si7013/20/21 Relative Humidity and Temperature Sensors
+ are i2c devices which have an identical programming interface for
+ measuring relative humidity and temperature.
+
+properties:
+ compatible:
+ const: silabs,si7020
+
+ reg:
+ maxItems: 1
+
+ siliabs,skip-reset:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description:
+ Disables resetting of the device during probe
+
+required:
+ - compatible
+ - reg
+
+additionalProperties: false
+
+examples:
+ - |
+ si7021-a20@40 {
+ silabs,skip-reset;
+ compatible = "silabs,si7020";
+ reg = <0x40>;
+ };
+...
--
2.27.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] iio: humidity: si7020: Check device property for skipping reset in probe
2022-05-11 19:08 [PATCH 0/2] iio: humidity: si7020: Check device property for skipping reset in probe Eddie James
2022-05-11 19:08 ` [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings Eddie James
@ 2022-05-11 19:08 ` Eddie James
1 sibling, 0 replies; 8+ messages in thread
From: Eddie James @ 2022-05-11 19:08 UTC (permalink / raw)
To: linux-iio
Cc: linux-kernel, devicetree, jic23, lars, robh+dt,
krzysztof.kozlowski+dt, dbarksdale, eajames
I2C commands issued after the SI7020 is starting up or after reset
can potentially upset the startup sequence. Therefore, the host
needs to wait for the startup sequence to finish before issuing
further i2c commands. This is impractical in cases where the SI7020
is on a shared bus or behind a mux, which may switch channels at
any time (generating I2C traffic). Therefore, check for a device
property that indicates that the driver should skip resetting the
device when probing.
Signed-off-by: Eddie James <eajames@linux.ibm.com>
---
drivers/iio/humidity/si7020.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/iio/humidity/si7020.c b/drivers/iio/humidity/si7020.c
index ab6537f136ba..49f6a1b1f5c4 100644
--- a/drivers/iio/humidity/si7020.c
+++ b/drivers/iio/humidity/si7020.c
@@ -115,12 +115,14 @@ static int si7020_probe(struct i2c_client *client,
I2C_FUNC_SMBUS_READ_WORD_DATA))
return -EOPNOTSUPP;
- /* Reset device, loads default settings. */
- ret = i2c_smbus_write_byte(client, SI7020CMD_RESET);
- if (ret < 0)
- return ret;
- /* Wait the maximum power-up time after software reset. */
- msleep(15);
+ if (!device_property_read_bool(&client->dev, "silabs,skip-reset")) {
+ /* Reset device, loads default settings. */
+ ret = i2c_smbus_write_byte(client, SI7020CMD_RESET);
+ if (ret < 0)
+ return ret;
+ /* Wait the maximum power-up time after software reset. */
+ msleep(15);
+ }
indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
if (!indio_dev)
--
2.27.0
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings
2022-05-11 19:08 ` [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings Eddie James
@ 2022-05-11 22:08 ` Eddie James
2022-05-13 8:49 ` Krzysztof Kozlowski
2022-05-12 13:49 ` Rob Herring
` (2 subsequent siblings)
3 siblings, 1 reply; 8+ messages in thread
From: Eddie James @ 2022-05-11 22:08 UTC (permalink / raw)
To: linux-iio
Cc: linux-kernel, devicetree, jic23, lars, robh+dt,
krzysztof.kozlowski+dt, dbarksdale, miltonm
On 5/11/22 14:08, Eddie James wrote:
> Document the si7020 bindings with a new "silabs,skip-reset" property.
I missed the entry in trivial-devices.txt. I can push a v2 or a separate
patch for that.
Eddie
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
> .../bindings/iio/humidity/silabs,si7020.yaml | 42 +++++++++++++++++++
> 1 file changed, 42 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
>
> diff --git a/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml b/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
> new file mode 100644
> index 000000000000..ab53bb8d9606
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
> @@ -0,0 +1,42 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/humidity/silabs,si7020.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: SI7020 humidity + temperature sensor
> +
> +maintainers:
> + - David Barksdale <dbarksdale@uplogix.com>
> +
> +description: |
> + The Silicon Labs Si7013/20/21 Relative Humidity and Temperature Sensors
> + are i2c devices which have an identical programming interface for
> + measuring relative humidity and temperature.
> +
> +properties:
> + compatible:
> + const: silabs,si7020
> +
> + reg:
> + maxItems: 1
> +
> + siliabs,skip-reset:
> + $ref: /schemas/types.yaml#/definitions/flag
> + description:
> + Disables resetting of the device during probe
> +
> +required:
> + - compatible
> + - reg
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + si7021-a20@40 {
> + silabs,skip-reset;
> + compatible = "silabs,si7020";
> + reg = <0x40>;
> + };
> +...
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings
2022-05-11 19:08 ` [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings Eddie James
2022-05-11 22:08 ` Eddie James
@ 2022-05-12 13:49 ` Rob Herring
2022-05-13 8:48 ` Krzysztof Kozlowski
2022-05-13 8:50 ` Krzysztof Kozlowski
3 siblings, 0 replies; 8+ messages in thread
From: Rob Herring @ 2022-05-12 13:49 UTC (permalink / raw)
To: Eddie James
Cc: jic23, krzysztof.kozlowski+dt, linux-iio, devicetree, robh+dt,
lars, linux-kernel, dbarksdale
On Wed, 11 May 2022 14:08:34 -0500, Eddie James wrote:
> Document the si7020 bindings with a new "silabs,skip-reset" property.
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
> ---
> .../bindings/iio/humidity/silabs,si7020.yaml | 42 +++++++++++++++++++
> 1 file changed, 42 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/humidity/silabs,si7020.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:
dtschema/dtc warnings/errors:
Documentation/devicetree/bindings/iio/humidity/silabs,si7020.example.dts:21.13-26: Warning (reg_format): /example-0/si7021-a20@40:reg: property has invalid length (4 bytes) (#address-cells == 1, #size-cells == 1)
Documentation/devicetree/bindings/iio/humidity/silabs,si7020.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/humidity/silabs,si7020.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/humidity/silabs,si7020.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/humidity/silabs,si7020.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/iio/humidity/silabs,si7020.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.example.dtb: example-0: si7021-a20@40:reg:0: [64] is too short
From schema: /usr/local/lib/python3.10/dist-packages/dtschema/schemas/reg.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.example.dtb: si7021-a20@40: 'silabs,skip-reset' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.example.dtb: si7021-a20@40: 'silabs,skip-reset' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/trivial-devices.yaml
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings
2022-05-11 19:08 ` [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings Eddie James
2022-05-11 22:08 ` Eddie James
2022-05-12 13:49 ` Rob Herring
@ 2022-05-13 8:48 ` Krzysztof Kozlowski
2022-05-13 8:50 ` Krzysztof Kozlowski
3 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-13 8:48 UTC (permalink / raw)
To: Eddie James, linux-iio
Cc: linux-kernel, devicetree, jic23, lars, robh+dt,
krzysztof.kozlowski+dt, dbarksdale
On 11/05/2022 21:08, Eddie James wrote:
> Document the si7020 bindings with a new "silabs,skip-reset" property.
>
> Signed-off-by: Eddie James <eajames@linux.ibm.com>
Thank you for your patch. There is something to discuss/improve.
> ---
> .../bindings/iio/humidity/silabs,si7020.yaml | 42 +++++++++++++++++++
> 1 file changed, 42 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
>
> diff --git a/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml b/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
> new file mode 100644
> index 000000000000..ab53bb8d9606
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/humidity/silabs,si7020.yaml
> @@ -0,0 +1,42 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/humidity/silabs,si7020.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: SI7020 humidity + temperature sensor
> +
> +maintainers:
> + - David Barksdale <dbarksdale@uplogix.com>
> +
> +description: |
> + The Silicon Labs Si7013/20/21 Relative Humidity and Temperature Sensors
> + are i2c devices which have an identical programming interface for
> + measuring relative humidity and temperature.
> +
> +properties:
> + compatible:
> + const: silabs,si7020
> +
> + reg:
> + maxItems: 1
> +
> + siliabs,skip-reset:
Do not describe implementation (driver) behavior, but the device hardware.
> + $ref: /schemas/types.yaml#/definitions/flag
"type:boolean" is shorter
> + description:
> + Disables resetting of the device during probe
> +
> +required:
> + - compatible
> + - reg
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + si7021-a20@40 {
Generic node name, so "sensor"?
> + silabs,skip-reset;
> + compatible = "silabs,si7020";
> + reg = <0x40>;
Order the properties: 1. compatible, 2. reg, then the rest.
> + };
> +...
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings
2022-05-11 22:08 ` Eddie James
@ 2022-05-13 8:49 ` Krzysztof Kozlowski
0 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-13 8:49 UTC (permalink / raw)
To: Eddie James, linux-iio
Cc: linux-kernel, devicetree, jic23, lars, robh+dt,
krzysztof.kozlowski+dt, dbarksdale, miltonm
On 12/05/2022 00:08, Eddie James wrote:
>
> On 5/11/22 14:08, Eddie James wrote:
>> Document the si7020 bindings with a new "silabs,skip-reset" property.
>
>
> I missed the entry in trivial-devices.txt. I can push a v2 or a separate
> patch for that.
In this patch, please. Anyway you need v2.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings
2022-05-11 19:08 ` [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings Eddie James
` (2 preceding siblings ...)
2022-05-13 8:48 ` Krzysztof Kozlowski
@ 2022-05-13 8:50 ` Krzysztof Kozlowski
3 siblings, 0 replies; 8+ messages in thread
From: Krzysztof Kozlowski @ 2022-05-13 8:50 UTC (permalink / raw)
To: Eddie James, linux-iio
Cc: linux-kernel, devicetree, jic23, lars, robh+dt,
krzysztof.kozlowski+dt, dbarksdale
On 11/05/2022 21:08, Eddie James wrote:
> Document the si7020 bindings with a new "silabs,skip-reset" property.
> +examples:
> + - |
> + si7021-a20@40 {
> + silabs,skip-reset;
> + compatible = "silabs,si7020";
> + reg = <0x40>;
> + };
As Rob's bot pointed out - you need to test your bindings. See
writing-schema.rst. Don't send bindings which do not work.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-05-13 8:50 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 19:08 [PATCH 0/2] iio: humidity: si7020: Check device property for skipping reset in probe Eddie James
2022-05-11 19:08 ` [PATCH 1/2] dt-bindings: iio: humidity: Add si7020 bindings Eddie James
2022-05-11 22:08 ` Eddie James
2022-05-13 8:49 ` Krzysztof Kozlowski
2022-05-12 13:49 ` Rob Herring
2022-05-13 8:48 ` Krzysztof Kozlowski
2022-05-13 8:50 ` Krzysztof Kozlowski
2022-05-11 19:08 ` [PATCH 2/2] iio: humidity: si7020: Check device property for skipping reset in probe Eddie James
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.