From: Sicelo <absicsz@gmail.com>
To: "H. Nikolaus Schaller" <hns@goldelico.com>
Cc: pali@kernel.org, Sebastian Reichel <sre@kernel.org>,
linux-pm@vger.kernel.org, maemo-leste@lists.dyne.org,
phone-devel@vger.kernel.org,
Discussions about the Letux Kernel <letux-kernel@openphoenux.org>,
akemnade@kernel.org
Subject: Re: [PATCH] power: supply: bq27xxx: do not report bogus zero values
Date: Fri, 28 Feb 2025 10:02:29 +0200 [thread overview]
Message-ID: <Z8FtlaYkbVG1xrsc@tp440p.steeds.sam> (raw)
In-Reply-To: <511351B0-A78B-4517-B183-D39A4F807CB6@goldelico.com>
Hi
On Thu, Feb 27, 2025 at 06:48:49PM +0100, H. Nikolaus Schaller wrote:
> >
> > I finally found time to test this patch on the GTA04 which uses an OpenMoko HF08
> > battery which comes with a built-in bq27000.
> >
> > The result is that I can't read the /sys/class/power_supply/bq27000-battery/charge_now
> > at all and always get EINVAL. Independently of the charge level reported without
> > your patch.
> >
> > If I remove this patch again, the values are reasonable as in all the years before.
> >
> > What I don't know is how and to which values the EEPROM of the bq27000 has been
> > factory programmed so that the HF08 battery maybehave differently from yours.
> >
> > Finally, I am not aware of reports from GTA04 users that the value stored in the NAC
> > register is being reset as you describe and capacity, energy and charge to be falsely
> > reported as 0.
> >
> > So please restrict this patch to the N900.
In the case of the HF08, the value will not get reset since the chip is
inside the battery as describe. However, the patch should be fine for
HF08 and N900, etc., since the EINVAL should only be emitted when it has
been reset. Unfortunately, I made the mistake below...
>
> You write:
>
> Therefore, discard readings for these properties if their value is 0 while EDVF is unset.
>
> but the 'val' is not checked at all. Only the error return value
> 'ret' of bq27xxx_simple_value() which is 0 if reading was ok.
>
> So shouldn't that be:
>
> + if (!val->intval && di->opts & BQ27XXX_O_ZERO &&
> + !(di->cache.flags & BQ27000_FLAG_EDVF))
> + return -EINVAL;
>
> This could explain why I always get an -EINVAL here since BQ27000_FLAG_EDVF is likely not set.
You are absolutely correct, Thank you. It seems I spent more time
testing the non-working condition than the working condition. Apologies.
Will you submit the fix, or I should?
Regards
Sicelo A. Mhlongo
next prev parent reply other threads:[~2025-02-28 8:02 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 21:51 [PATCH] power: supply: bq27xxx: do not report bogus zero values Sicelo A. Mhlongo
2025-02-27 17:14 ` H. Nikolaus Schaller
2025-02-27 17:48 ` H. Nikolaus Schaller
2025-02-28 8:02 ` Sicelo [this message]
2025-02-28 8:27 ` H. Nikolaus Schaller
2025-02-28 9:54 ` Sicelo
2025-02-28 10:01 ` H. Nikolaus Schaller
2025-03-10 17:26 ` Sicelo
2025-03-12 7:19 ` Sebastian Reichel
2025-03-12 12:20 ` Sicelo
2025-03-12 12:28 ` Sicelo
2025-03-13 7:28 ` H. Nikolaus Schaller
2025-03-13 7:42 ` Andreas Kemnade
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=Z8FtlaYkbVG1xrsc@tp440p.steeds.sam \
--to=absicsz@gmail.com \
--cc=akemnade@kernel.org \
--cc=hns@goldelico.com \
--cc=letux-kernel@openphoenux.org \
--cc=linux-pm@vger.kernel.org \
--cc=maemo-leste@lists.dyne.org \
--cc=pali@kernel.org \
--cc=phone-devel@vger.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