mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Antoine <t.antoine@uclouvain.be>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: "Rob Herring" <robh@kernel.org>,
	"Peter Griffin" <peter.griffin@linaro.org>,
	"André Draszik" <andre.draszik@linaro.org>,
	"Tudor Ambarus" <tudor.ambarus@linaro.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Alim Akhtar" <alim.akhtar@samsung.com>,
	"Catalin Marinas" <catalin.marinas@arm.com>,
	"Will Deacon" <will@kernel.org>,
	"Dimitri Fedrau" <dima.fedrau@gmail.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org
Subject: Re: [PATCH v3 2/5] power: supply: add support for max77759 fuel gauge
Date: Wed, 30 Apr 2025 15:49:39 +0200	[thread overview]
Message-ID: <49ead205-0181-4d2f-83c4-e04e501dc95c@uclouvain.be> (raw)
In-Reply-To: <ieh6g5m4oectmje2gowa6rl2blzjuovjpyd3cmbvoql4qn2c7m@2osiwclwxi43>

Hi,

On 4/30/25 02:36, Sebastian Reichel wrote:
> Hi,
> 
> On Mon, Apr 21, 2025 at 08:13:33PM +0200, Thomas Antoine via B4 Relay wrote:
>> From: Thomas Antoine <t.antoine@uclouvain.be>
>>
>> The interface of the Maxim MAX77759 fuel gauge has a lot of common with the
>> Maxim MAX1720x. A major difference is the lack of non-volatile memory
>> slave address. No slave is available at address 0xb of the i2c bus, which
>> is coherent with the following driver from google: line 5836 disables
>> non-volatile memory for m5 gauge.
>>
>> Link: https://android.googlesource.com/kernel/google-modules/bms/+/1a68c36bef474573cc8629cc1d121eb6a81ab68c/max1720x_battery.c
>>
>> Other differences include the lack of V_BATT register to read the battery
>> level. The voltage must instead be read from V_CELL, the lowest voltage of
>> all cells. The mask to identify the chip is different. The computation of
>> the charge must also be changed to take into account TASKPERIOD, which
>> can add a factor 2 to the result.
>>
>> Add support for the MAX77759 by taking into account all of those
>> differences based on chip type.
>>
>> Do not advertise temp probes using the non-volatile memory as those are
>> not available.
>>
>> The regmap was proposed by André Draszik in
>>
>> Link: https://lore.kernel.org/all/d1bade77b5281c1de6b2ddcb4dbbd033e455a116.camel@linaro.org/
>>
>> Signed-off-by: Thomas Antoine <t.antoine@uclouvain.be>
>> ---
> 
> [...] (I actually skipped reviewing big parts here for now)
> 
>>
>> +		ret = of_property_read_u32(dev->of_node,
>> +					   "shunt-resistor-micro-ohms", &val);
> 
> device_property_read_u32(dev, ...)
> 
>> [...]
>> +	ret = of_property_read_u32(dev->of_node,
>> +				   "charge-full-design-microamp-hours", &info->charge_full_design);
>> +	if (ret)
>> +		info->charge_full_design = 0;
> 
> This is not in the DT binding and thus not allowed. Also I will NAK
> adding it to the DT binding, since the following should be used:
> 
> Documentation/devicetree/bindings/power/supply/battery.yaml
> 
> followed by using power_supply_get_battery_info() in this driver.
> 
> Adding this support is probably a good idea, since it allows
> providing all kind of static information from DT and you are
> missing the non-volatile memory part from the existing chip.
> 
> Note that the power-supply core will pick up and expose any
> of these properties automatically.
>

As I said to Dimitri Fedrau, this is actually a mistake on my part coming from
an attempt at getting things working which failed. Charge full design should
be correctly computed now so I don't think it would be useful to get it from
DT.
 
>> +	ret = max1720x_get_rsense(dev, info, data);
>>  	if (ret)
>> -		return dev_err_probe(dev, ret, "Failed to probe nvmem\n");
>> +		return dev_err_probe(dev, ret, "Failed to get RSense\n");
> 
> You can either drop this error print, or the ones in
> max1720x_get_rsense(). No need to print two errors.
> 
> Greetings,
> 
> -- Sebastian

I will do that in v4.

Best regards,
Thomas

  reply	other threads:[~2025-04-30 13:49 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21 18:13 [PATCH v3 0/5] Google Pixel 6 (oriole): max77759 fuel gauge enablement and driver support Thomas Antoine via B4 Relay
2025-04-21 18:13 ` [PATCH v3 1/5] power: supply: correct capacity computation Thomas Antoine via B4 Relay
2025-04-22  9:46   ` Dimitri Fedrau
2025-04-23  7:48     ` Thomas Antoine
2025-04-21 18:13 ` [PATCH v3 2/5] power: supply: add support for max77759 fuel gauge Thomas Antoine via B4 Relay
2025-04-22 18:48   ` Dimitri Fedrau
2025-04-23  8:02     ` Thomas Antoine
2025-04-30  0:36   ` Sebastian Reichel
2025-04-30 13:49     ` Thomas Antoine [this message]
2025-04-21 18:13 ` [PATCH v3 3/5] dt-bindings: power: supply: add max77759-fg flavor Thomas Antoine via B4 Relay
2025-04-22 10:05   ` Krzysztof Kozlowski
2025-04-23  8:05     ` Thomas Antoine
2025-04-23 13:45       ` Krzysztof Kozlowski
2025-04-30 13:51         ` Thomas Antoine
2025-04-21 18:13 ` [PATCH v3 4/5] arm64: defconfig: enable Maxim max1720x driver Thomas Antoine via B4 Relay
2025-04-21 18:13 ` [PATCH v3 5/5] arm64: dts: exynos: gs101-oriole: enable Maxim max77759 fuel gauge Thomas Antoine via B4 Relay
2025-04-21 21:53 ` [PATCH v3 0/5] Google Pixel 6 (oriole): max77759 fuel gauge enablement and driver support Rob Herring (Arm)

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=49ead205-0181-4d2f-83c4-e04e501dc95c@uclouvain.be \
    --to=t.antoine@uclouvain.be \
    --cc=alim.akhtar@samsung.com \
    --cc=andre.draszik@linaro.org \
    --cc=catalin.marinas@arm.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dima.fedrau@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=peter.griffin@linaro.org \
    --cc=robh@kernel.org \
    --cc=sebastian.reichel@collabora.com \
    --cc=tudor.ambarus@linaro.org \
    --cc=will@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

all inboxes | Powered by JetHome®