Linux LED subsystem development
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Lee Jones <lee@kernel.org>, Pavel Machek <pavel@kernel.org>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Sebastian Reichel <sre@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Andreas Kemnade <andreas@kemnade.info>,
	linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	linux-gpio@vger.kernel.org
Subject: Re: [RFC PATCH 03/13] dt-bindings: power: supply: BD72720 managed battery
Date: Mon, 13 Oct 2025 16:00:50 +0300	[thread overview]
Message-ID: <f2e6f0eb-b412-4cf6-8615-d669b8066393@gmail.com> (raw)
In-Reply-To: <CACRpkdbHBQQnnTUrUzOrYxzQKCzDyy8aNK7w8OEFz-ic8ic1FQ@mail.gmail.com>

On 13/10/2025 15:45, Linus Walleij wrote:
> Hi Matti,
> 
> thanks for your patch!
> 
> On Tue, Oct 7, 2025 at 10:33 AM Matti Vaittinen
> <mazziesaccount@gmail.com> wrote:
> 
>> The BD72720 PMIC has a battery charger + coulomb counter block. These
>> can be used to manage charging of a lithium-ion battery and to do fuel
>> gauging.
>>
>> ROHM has developed a so called "zero-correction" -algotihm to improve
> 
> algorithm?

Indeed :)

> 
>> the fuel-gauging accuracy close to the point where battery is depleted.
>> This relies on battery specific "VDR" tables, which are measured from
>> the battery, and which describe the voltage drop rate. More thorough
>> explanation about the "zero correction" and "VDR" parameters is here:
>> https://lore.kernel.org/all/676253b9-ff69-7891-1f26-a8b5bb5a421b@fi.rohmeurope.com/
>>
>> Document the VDR zero-correction specific battery properties used by the
>> BD72720 and some other ROHM chargers.
>>
>> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
> 
>> The parameters are describing the battery voltage drop rates - so they
>> are properties of the battery, not the charger. Thus they do not belong
>> in the charger node.
> 
> Right!
> 
>> The right place for them is the battery node, which is described by the
>> generic "battery.yaml". I was not comfortable with adding these
>> properties to the generic battery.yaml because they are:
>>    - Meaningful only for those charger drivers which have the VDR
>>      algorithm implemented. (And even though the algorithm is not charger
>>      specific, AFAICS, it is currently only used by some ROHM PMIC
>>      drivers).
>>    - Technique of measuring the VDR tables for a battery is not widely
>>      known. AFAICS, only folks at ROHM are measuring those for some
>>      customer products. We do have those tables available for some of the
>>      products though (Kobo?).
> 
> It would be sad if we later on have to convert it to a standard property
> because it turns out to be wider used than we know.
> 
> But I buy your reasoning!
> 
>> +properties:
>> +  rohm,voltage-vdr-thresh-microvolt:
>> +    description: Threshold for starting the VDR correction
>> +
>> +  rohm,volt-drop-soc:
>> +    description: Table of capacity values matching the values in VDR tables.
>> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> 
> Which unit is this? Seems to be capacity in % *10?

Ah, right. Should've documented this! Thanks.

>> +  rohm,volt-drop-high-temp-microvolt:
>> +    description: VDR table for high temperature
>> +
>> +  rohm,volt-drop-normal-temp-microvolt:
>> +    description: VDR table for normal temperature
>> +
>> +  rohm,volt-drop-low-temp-microvolt:
>> +    description: VDR table for low temperature
>> +
>> +  rohm,volt-drop-very-low-temp-microvolt:
>> +    description: VDR table for very low temperature
> 
> Doesn't the four last properties require to be defined as uint32-array?

I have been under impression that the "-microvolt" ending suffices, but 
I may be wrong. At last the 'make dt_binding_check' didn't give me a shout.

> 
>> +        rohm,volt-drop-soc = <1000 1000 950 900 850 800 750 700 650 600 550 500
>> +          450 400 350 300 250 200 150 100 50 00 (-50)>;
> 
> This one makes a lot of sense.
> 
>> +        rohm,volt-drop-high-temp-microvolt =  <100 100 102 104 106 109 114 124
>> +          117 107 107 109 112 116 117 108 109 109 108 109 122 126 130>;
>> +
>> +        rohm,volt-drop-normal-temp-microvolt = <100 100 102 105 98 100 105 102
>> +          101 99 98 100 103 105 109 117 111 109 110 114 128 141 154>;
>> +
>> +        rohm,volt-drop-low-temp-microvolt = <100 100 98 107 112 114 118 118 112
>> +          108 108 110 111 113 117 123 131 144 157 181 220 283 399>;
>> +
>> +        rohm,volt-drop-very-low-temp-microvolt = <86 86 105 109 114 110 115 115
>> +          110 108 110 112 114 118 124 134 136 160 177 201 241 322 403>;
> 
> I would have expected something like this, to avoid the a bit fuzzy definitions
> of high, normal, low and very low temperature either:
> 
> Provide an array of temperatures in millicentigrades (I just guessed
> these temperatures, you will know the real ones!):
> 
> rohm,vold-drop-temperatures-millicelsius = <500, 250, 100, (-50)>;
> rohm,volt-drop-microvolt-0 = <...>;
> rohm,volt-drop-microvolt-1 = <...>;
> rohm,volt-drop-microvolt-2 = <...>;
> rohm,volt-drop-microvolt-3 = <...>;
> 
> Where each array correspond to the temperature, or if you wanna
> go all-out custom:
> 
> rohm,volt-drop-50-celsius-microvolt = <...>;
> (...)
> 
> So we get the actual temperature in there one way or the other.

I agree. This is a good idea. I'll try one of these :)

> 
>> +        rohm,voltage-vdr-thresh-microvolt = <4150000>;
> 
> This property seems to be missing from the bindings?

I think it is the first binding in the file :)

Yours,
	-- Matti


  reply	other threads:[~2025-10-13 13:00 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-07  8:32 [RFC PATCH 00/13] Support ROHM BD72720 PMIC Matti Vaittinen
2025-10-07  8:32 ` [RFC PATCH 01/13] dt-bindings: regulator: ROHM BD72720 Matti Vaittinen
2025-10-07  8:33 ` [RFC PATCH 02/13] dt-bindings: Add trickle-charge upper limit Matti Vaittinen
2025-10-13 12:31   ` Linus Walleij
2025-10-07  8:33 ` [RFC PATCH 03/13] dt-bindings: power: supply: BD72720 managed battery Matti Vaittinen
2025-10-13 12:45   ` Linus Walleij
2025-10-13 13:00     ` Matti Vaittinen [this message]
2025-10-14 10:29       ` Linus Walleij
2025-10-07  8:33 ` [RFC PATCH 04/13] dt-bindings: mfd: ROHM BD72720 Matti Vaittinen
2025-10-13 12:58   ` Linus Walleij
2025-10-14 12:11     ` Matti Vaittinen
2025-10-14 12:58       ` Linus Walleij
2025-10-07  8:33 ` [RFC PATCH 05/13] dt-bindings: leds: bd72720: Add BD72720 Matti Vaittinen
2025-10-07  8:33 ` [RFC PATCH 06/13] mfd: bd71828: Support ROHM BD72720 Matti Vaittinen
2025-10-09 16:18   ` Lee Jones
2025-10-10 12:09     ` Matti Vaittinen
2025-10-10 13:03       ` Andreas Kemnade
2025-10-13  9:27         ` Matti Vaittinen
2025-10-13 13:19           ` Andreas Kemnade
2025-10-14  5:41             ` Matti Vaittinen
2025-10-15  7:46               ` Matti Vaittinen
2025-10-10 14:45       ` Lee Jones
2025-10-13 12:28         ` Matti Vaittinen
2025-10-16 15:27           ` Lee Jones
2025-10-07  8:34 ` [RFC PATCH 07/13] regulator: bd71828: rename IC specific entities Matti Vaittinen
2025-10-07  8:34 ` [RFC PATCH 08/13] regulator: bd71828: Support ROHM BD72720 Matti Vaittinen
2025-10-07  8:34 ` [RFC PATCH 09/13] gpio: Support ROHM BD72720 gpios Matti Vaittinen
2025-10-13 12:54   ` Linus Walleij
2025-10-16 11:04   ` Bartosz Golaszewski
2025-10-07  8:34 ` [RFC PATCH 10/13] clk: clk-bd718x7: Support BD72720 clk gate Matti Vaittinen
2025-10-07  8:34 ` [RFC PATCH 11/13] rtc: bd70528: Support BD72720 rtc Matti Vaittinen
2025-10-07  8:35 ` [RFC PATCH 12/13] power: supply: bd71828-power: Support ROHM BD72720 Matti Vaittinen
2025-10-07  8:35 ` [RFC PATCH 13/13] MAINTAINERS: Add ROHM BD72720 PMIC Matti Vaittinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f2e6f0eb-b412-4cf6-8615-d669b8066393@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=andreas@kemnade.info \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=pavel@kernel.org \
    --cc=robh@kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox