diff mbox series

[v2,1/2] dt-bindings: hwmon: ti,ina2xx: Add INA233 device

Message ID 20250110081546.61667-2-Leo-Yang@quantatw.com (mailing list archive)
State New
Headers show
Series hwmon: Add support for INA233 | expand

Commit Message

Leo Yang Jan. 10, 2025, 8:15 a.m. UTC
Add TI INA233 Current and Power Monitor bindings.

Signed-off-by: Leo Yang <Leo-Yang@quantatw.com>
---
 .../devicetree/bindings/hwmon/ti,ina2xx.yaml    | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Krzysztof Kozlowski Jan. 10, 2025, 8:22 a.m. UTC | #1
On 10/01/2025 09:15, Leo Yang wrote:
> Add TI INA233 Current and Power Monitor bindings.
> 
> Signed-off-by: Leo Yang <Leo-Yang@quantatw.com>
> ---
>  .../devicetree/bindings/hwmon/ti,ina2xx.yaml    | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml
> index 05a9cb36cd82..9759c69b904b 100644
> --- a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml
> +++ b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml
> @@ -27,6 +27,7 @@ properties:
>        - ti,ina226
>        - ti,ina230
>        - ti,ina231
> +      - ti,ina233
>        - ti,ina237
>        - ti,ina238
>        - ti,ina260
> @@ -75,6 +76,22 @@ properties:
>        the alert polarity to active-high.
>      $ref: /schemas/types.yaml#/definitions/flag
>  
> +  ti,current-lsb:
> +    description:
> +      This value depends on the maximum current that can be expected to be

Then use microamp unit suffix and drop the ref and all these calculations.

> +      measured by ina233 in your circuit, divide Maximum Expected Current
> +      by 2^15 and express it in microamps.
> +
> +      This value will be used to calculate the current/power coefficient for
> +      the pmbus and to calibrate the IC.
> +
> +      For device INA233.

And not valid for other devices? Then in allOf:if:then: you should
disallow it for others and drop redundant descriptions (don't repeat the
schema).

Best regards,
Krzysztof
Krzysztof Kozlowski Jan. 10, 2025, 8:36 a.m. UTC | #2
On Fri, Jan 10, 2025 at 04:15:45PM +0800, Leo Yang wrote:
> Add TI INA233 Current and Power Monitor bindings.
> 
> Signed-off-by: Leo Yang <Leo-Yang@quantatw.com>

Also, SoB does not match From.

Please run scripts/checkpatch.pl and fix reported warnings. After that,
run also 'scripts/checkpatch.pl --strict' and (probably) fix more
warnings. Some warnings can be ignored, especially from --strict run,
but the code here looks like it needs a fix. Feel free to get in touch
if the warning is not clear.

Best regards,
Krzysztof
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml
index 05a9cb36cd82..9759c69b904b 100644
--- a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml
+++ b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml
@@ -27,6 +27,7 @@  properties:
       - ti,ina226
       - ti,ina230
       - ti,ina231
+      - ti,ina233
       - ti,ina237
       - ti,ina238
       - ti,ina260
@@ -75,6 +76,22 @@  properties:
       the alert polarity to active-high.
     $ref: /schemas/types.yaml#/definitions/flag
 
+  ti,current-lsb:
+    description:
+      This value depends on the maximum current that can be expected to be
+      measured by ina233 in your circuit, divide Maximum Expected Current
+      by 2^15 and express it in microamps.
+
+      This value will be used to calculate the current/power coefficient for
+      the pmbus and to calibrate the IC.
+
+      For device INA233.
+
+      e.g. Calculate the Maximum Expected Current(A) / 2^15 in micro ampere (uA).
+      30A / 2^15 = 915 uA
+      If value is close to 1000 uA, can use 1000 uA to minimize rounding errors.
+    $ref: /schemas/types.yaml#/definitions/uint16
+
 required:
   - compatible
   - reg