From: Konrad Dybcio <konrad.dybcio@linaro.org>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Marijn Suijten <marijn.suijten@somainline.org>,
Rob Herring <robh@kernel.org>,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pm@vger.kernel.org
Subject: Re: [PATCH RESEND v2 3/3] power: supply: Introduce MM8013 fuel gauge driver
Date: Thu, 14 Sep 2023 20:46:21 +0200 [thread overview]
Message-ID: <36287e2f-ddff-4323-bbc2-e7a07a9283e7@linaro.org> (raw)
In-Reply-To: <20230913154552.okinfq6gdxf2d7ab@mercury.elektranox.org>
On 13.09.2023 17:45, Sebastian Reichel wrote:
> Hi,
>
> On Wed, Aug 23, 2023 at 04:36:15PM +0200, Konrad Dybcio wrote:
>> Add a driver for the Mitsumi MM8013 fuel gauge. The driver is a vastly
>> cleaned up and improved version of the one that shipped in some obscure
>> Lenovo downstream kernel [1], with some register definitions borrowed from
>> ChromeOS EC platform code [2].
>>
>> [1] https://github.com/adazem009/kernel_lenovo_bengal/commit/b6b346427a871715709bd22aae449b9383f3b66b
>> [2] https://chromium.googlesource.com/chromiumos/platform/ec/+/master/driver/battery/mm8013.h
>> Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org>
>> ---
[...]
>
> Please use regmap.
Ack
[...]
>> + switch (psp) {
>> + case POWER_SUPPLY_PROP_CAPACITY:
>
> this is in %, while the next two are in uAh. So the fuel gauge does
> not provide the current capacity in uAh
> (POWER_SUPPLY_PROP_CHARGE_NOW)?
Yes. Doesn't seem like raw values are supported.
[...]
>
> this is just 'val->intval = (s16) ret;'.
>
>> + val->intval *= -1000;
Ack
>
> and this seems to be the only property, that properly scales its
> values, assuming the hardware reports data in mA.
>
[...]
>
> that's in **micro** volts
Oh, I didn't read enough docs..
>
>> + ret = mm8013_read_reg(client, REG_VOLTAGE);
>
> this effectively does i2c_smbus_read_word_data() and thus the
> maximum is is 65536. 65536uV = 65mV. I have serious doubts, that
> this code does what you want. The same is true for a couple of
> the other properties.
Ack
[...]
> With the next submission please include a dump of the uevent
> in sysfs in the cover letter or below the fold, so that its
> easy to validty check if the reported values look sensible.
State of what-will-be-sent in v(n+1), with additional fixups:
POWER_SUPPLY_NAME=mm8013
POWER_SUPPLY_TYPE=Battery
POWER_SUPPLY_CAPACITY=100
POWER_SUPPLY_CHARGE_FULL=7124
POWER_SUPPLY_CHARGE_FULL_DESIGN=7500
POWER_SUPPLY_CURRENT_NOW=-122000
POWER_SUPPLY_CYCLE_COUNT=27
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_STATUS=Full
POWER_SUPPLY_TEMP=324
POWER_SUPPLY_VOLTAGE_NOW=4407000
>
> Thanks and sorry for the slow processing,
No worries
Konrad
next prev parent reply other threads:[~2023-09-14 18:51 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-23 14:36 [PATCH RESEND v2 0/3] MM8013 fg driver Konrad Dybcio
2023-08-23 14:36 ` [PATCH RESEND v2 1/3] dt-bindings: vendor-prefixes: Add Mitsumi Electric Co., Ltd Konrad Dybcio
2023-08-23 14:36 ` [PATCH RESEND v2 2/3] dt-bindings: power: supply: Document Mitsumi MM8013 fuel gauge Konrad Dybcio
2023-09-13 15:02 ` Sebastian Reichel
2023-08-23 14:36 ` [PATCH RESEND v2 3/3] power: supply: Introduce MM8013 fuel gauge driver Konrad Dybcio
2023-09-13 15:45 ` Sebastian Reichel
2023-09-14 18:46 ` Konrad Dybcio [this message]
2023-09-14 19:17 ` Sebastian Reichel
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=36287e2f-ddff-4323-bbc2-e7a07a9283e7@linaro.org \
--to=konrad.dybcio@linaro.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=marijn.suijten@somainline.org \
--cc=robh+dt@kernel.org \
--cc=robh@kernel.org \
--cc=sebastian.reichel@collabora.com \
/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®