All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Sicelo A. Mhlongo" <absicsz@gmail.com>
To: sre@kernel.org, pali@kernel.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Sicelo A. Mhlongo" <absicsz@gmail.com>
Subject: [PATCH 0/1] power: supply: bq27xxx: expose battery data when CI=1
Date: Tue, 19 Apr 2022 23:36:46 +0200	[thread overview]
Message-ID: <20220419213647.1186284-1-absicsz@gmail.com> (raw)

We currently discard capacity information provided by the chip when the
Capacity Inaccurate flag is set. However, in many cases, having this
stale data is better than no information at all.

Even if the chip has been fully reset, the datasheet shows that capacity 
values (NAC specifically) can be seeded by using the WRTNAC facility of 
the Control and Mode registers. After seeding, CI remains set, but the
capacity values are as accurate as the NAC value provided to WRTNAC is.

On the Nokia N900, such seed value can be obtained from rx51_battery, 
which reads battery data directly from the battery's BSI pin. This can
be done in userspace via i2c access to the registers. With this patch,
once seeded, capacity values are available through the driver.

The patch was successfully tested on bq27200 on the Nokia N900.

Signed-off-by: Sicelo A. Mhlongo <absicsz@gmail.com>

Sicelo A. Mhlongo (1):
  power: supply: bq27xxx: expose battery data when CI=1

 drivers/power/supply/bq27xxx_battery.c | 58 +++++++++++++-------------
 1 file changed, 28 insertions(+), 30 deletions(-)

-- 
2.35.2


             reply	other threads:[~2022-04-19 21:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-19 21:36 Sicelo A. Mhlongo [this message]
2022-04-19 21:36 ` [PATCH 1/1] power: supply: bq27xxx: expose battery data when CI=1 Sicelo A. Mhlongo
2022-04-19 21:59   ` Pali Rohár
2022-04-19 22:09 ` [PATCH 0/1] " Pali Rohár
2022-04-19 22:32   ` Sicelo

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=20220419213647.1186284-1-absicsz@gmail.com \
    --to=absicsz@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pali@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.