[PATCH 5/5] Documentation/devicetree/bindings/hwmon: Add TSC1641 binding

Igor Reznichenko posted 5 patches 3 months, 2 weeks ago
There is a newer version of this series
[PATCH 5/5] Documentation/devicetree/bindings/hwmon: Add TSC1641 binding
Posted by Igor Reznichenko 3 months, 2 weeks ago
Add a devicetree binding for the TSC1641 I2C power monitor.

Signed-off-by: Igor Reznichenko <igor@reznichenko.net>
---
 .../devicetree/bindings/hwmon/st,tsc1641.yaml | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml

diff --git a/Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml b/Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml
new file mode 100644
index 000000000000..e79f6dab4a87
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml
@@ -0,0 +1,54 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/st,tsc1641.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ST Microelectronics TSC1641 I2C power monitor
+
+maintainers:
+  - Igor Reznichenko <igor@reznichenko.net>
+
+description: |
+  TSC1641 is a 60 V, 16-bit high-precision power monitor with I2C and MIPI I3C interface
+
+  Datasheets:
+    https://www.st.com/resource/en/datasheet/tsc1641.pdf
+
+properties:
+  compatible:
+    const: st,tsc1641
+
+  reg:
+    maxItems: 1
+
+  shunt-resistor:
+    description:
+      Shunt resistor value in micro-ohms.
+    $ref: /schemas/types.yaml#/definitions/uint32
+
+  st,alert-polarity-active-high:
+    description: Default value is 0 which configures the normal polarity of the ALERT pin, being active low open-drain.
+      Setting this to 1 configures the polarity of the ALERT pin to be inverted and active high open-drain.
+      Specify this property to set the alert polarity to active-high.
+    $ref: /schemas/types.yaml#/definitions/flag
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        power-sensor@40 {
+            compatible = "st,tsc1641";
+            reg = <0x40>;
+            shunt-resistor = <5000>;
+            st,alert-polarity-active-high;
+        };
+    };
-- 
2.43.0
Re: [PATCH 5/5] Documentation/devicetree/bindings/hwmon: Add TSC1641 binding
Posted by Krzysztof Kozlowski 3 months, 2 weeks ago
On 22/10/2025 06:47, Igor Reznichenko wrote:
> Add a devicetree binding for the TSC1641 I2C power monitor.

Please use subject prefixes matching the subsystem. You can get them for
example with `git log --oneline -- DIRECTORY_OR_FILE` on the directory
your patch is touching. For bindings, the preferred subjects are
explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters

A nit, subject: drop second/last, redundant "binding". The "dt-bindings"
prefix is already stating that these are bindings.
See also:
https://elixir.bootlin.com/linux/v6.17-rc3/source/Documentation/devicetree/bindings/submitting-patches.rst#L18

Please organize the patch documenting compatible (DT bindings) before
their user.
See also:
https://elixir.bootlin.com/linux/v6.14-rc6/source/Documentation/devicetree/bindings/submitting-patches.rst#L46


> 
> Signed-off-by: Igor Reznichenko <igor@reznichenko.net>
> ---
>  .../devicetree/bindings/hwmon/st,tsc1641.yaml | 54 +++++++++++++++++++
>  1 file changed, 54 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml b/Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml
> new file mode 100644
> index 000000000000..e79f6dab4a87
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml
> @@ -0,0 +1,54 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/hwmon/st,tsc1641.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: ST Microelectronics TSC1641 I2C power monitor
> +
> +maintainers:
> +  - Igor Reznichenko <igor@reznichenko.net>
> +
> +description: |
> +  TSC1641 is a 60 V, 16-bit high-precision power monitor with I2C and MIPI I3C interface

Please wrap code according to the preferred limit expressed in Kernel
coding style, so at 80.

> +
> +  Datasheets:
> +    https://www.st.com/resource/en/datasheet/tsc1641.pdf
> +
> +properties:
> +  compatible:
> +    const: st,tsc1641
> +
> +  reg:
> +    maxItems: 1
> +
> +  shunt-resistor:

Use existing property, git grep shunt.

And then test it...

Best regards,
Krzysztof
Re: [PATCH 5/5] Documentation/devicetree/bindings/hwmon: Add TSC1641 binding
Posted by Rob Herring (Arm) 3 months, 2 weeks ago
On Tue, 21 Oct 2025 21:47:08 -0700, Igor Reznichenko wrote:
> Add a devicetree binding for the TSC1641 I2C power monitor.
> 
> Signed-off-by: Igor Reznichenko <igor@reznichenko.net>
> ---
>  .../devicetree/bindings/hwmon/st,tsc1641.yaml | 54 +++++++++++++++++++
>  1 file changed, 54 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:
./Documentation/devicetree/bindings/hwmon/st,tsc1641.yaml:31:111: [warning] line too long (119 > 110 characters) (line-length)

dtschema/dtc warnings/errors:

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20251022044708.314287-6-igor@reznichenko.net

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.