Message ID | 20250116085939.1235598-2-leo.yang.sy0@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | hwmon: Add support for INA233 | expand |
On Thu, Jan 16, 2025 at 04:59:40PM +0800, Leo Yang wrote: > Add TI INA233 Current and Power Monitor bindings. > > Signed-off-by: Leo Yang <leo.yang.sy0@gmail.com> > --- > .../devicetree/bindings/hwmon/ti,ina2xx.yaml | 30 +++++++++++++++++++ > 1 file changed, 30 insertions(+) > > diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml > index 05a9cb36cd82..7372e282765b 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,12 +76,41 @@ properties: > the alert polarity to active-high. > $ref: /schemas/types.yaml#/definitions/flag > > + ti,maximum-expected-current-microamp: > + description: | > + This value indicates the maximum current in microamps that you can > + expect to measure with ina233 in your circuit. > + > + This value will be used to calculate the Current_LSB and current/power > + coefficient for the pmbus and to calibrate the IC. > + minimum: 32768 > + maximum: 4294967295 Uh, are these real values measurable by the device? The last one looks like UINT_MAX. > + default: 32768000 Default is 32 A? For what applications is this sensor used? Best regards, Krzysztof
Hi Krzysztof, On Thu, Jan 16, 2025 at 6:47 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > > + This value will be used to calculate the Current_LSB and current/power > > + coefficient for the pmbus and to calibrate the IC. > > + minimum: 32768 > > + maximum: 4294967295 > > Uh, are these real values measurable by the device? The last one looks > like UINT_MAX. According to the spec I don't see a definition of the upper limit of the current measurement, it all depends on how low the shunt resistance can be, so I'll use the upper limit of the u32 as the maximum for now, even though it's unlikely that this number will be present in the actual circuit. > > > + default: 32768000 > > Default is 32 A? For what applications is this sensor used? > According to spec 8.2.2.1 Programming the Calibration Register example, a Current_LSB with a maximum expected current of 15A is approximately 457.7uA. The example shows that a Current_LSB of 500 or 1000uA/bit can be used. So I choose 1000uA as the default value here, this value corresponds to the expected maximum current which is 32A (with some loss of accuracy to have a larger measurement range), and yes maybe the user doesn't need such a large current, so the accuracy-sensitive use of the scene can be adjusted according to the actual measurement range of the expected maximum current, I'm trying to retain some flexibility for the user. Thank you for all your suggestions, they are very useful and I have gained a lot from them. Best Regards, Leo Yang
On Thu, Jan 16, 2025 at 09:52:08PM +0800, Leo Yang wrote: > Hi Krzysztof, > > On Thu, Jan 16, 2025 at 6:47 PM Krzysztof Kozlowski <krzk@kernel.org> wrote: > > > > > + This value will be used to calculate the Current_LSB and current/power > > > + coefficient for the pmbus and to calibrate the IC. > > > + minimum: 32768 > > > + maximum: 4294967295 > > > > Uh, are these real values measurable by the device? The last one looks > > like UINT_MAX. > > According to the spec I don't see a definition of the upper limit of the > current measurement, it all depends on how low the shunt resistance can > be, so I'll use the upper limit of the u32 as the maximum for now, even > though it's unlikely that this number will be present in the actual circuit. > > > > > > + default: 32768000 > > > > Default is 32 A? For what applications is this sensor used? > > > > According to spec 8.2.2.1 Programming the Calibration Register example, > a Current_LSB with a maximum expected current of 15A is approximately > 457.7uA. > The example shows that a Current_LSB of 500 or 1000uA/bit can be used. > So I choose 1000uA as the default value here, this value corresponds to > the expected maximum current which is 32A (with some loss of accuracy to > have a larger measurement range), and yes maybe the user doesn't > need such a large current, so the accuracy-sensitive use of the scene > can be adjusted according to the actual measurement range of the > expected maximum current, I'm trying to retain some flexibility for the > user. > Datasheet indeed does not describe actual limits, expect 5 mA on the pin, but that depends on shunt resistor, so fine with me: Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Best regards, Krzysztof
diff --git a/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml b/Documentation/devicetree/bindings/hwmon/ti,ina2xx.yaml index 05a9cb36cd82..7372e282765b 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,12 +76,41 @@ properties: the alert polarity to active-high. $ref: /schemas/types.yaml#/definitions/flag + ti,maximum-expected-current-microamp: + description: | + This value indicates the maximum current in microamps that you can + expect to measure with ina233 in your circuit. + + This value will be used to calculate the Current_LSB and current/power + coefficient for the pmbus and to calibrate the IC. + minimum: 32768 + maximum: 4294967295 + default: 32768000 + required: - compatible - reg allOf: - $ref: hwmon-common.yaml# + - if: + properties: + compatible: + contains: + enum: + - silergy,sy24655 + - ti,ina209 + - ti,ina219 + - ti,ina220 + - ti,ina226 + - ti,ina230 + - ti,ina231 + - ti,ina237 + - ti,ina238 + - ti,ina260 + then: + properties: + ti,maximum-expected-current-microamp: false unevaluatedProperties: false
Add TI INA233 Current and Power Monitor bindings. Signed-off-by: Leo Yang <leo.yang.sy0@gmail.com> --- .../devicetree/bindings/hwmon/ti,ina2xx.yaml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+)