* [PATCH] bq27x00_battery: fix flag register read
@ 2012-01-14 20:50 Grazvydas Ignotas
2012-01-19 10:49 ` Pali Rohár
0 siblings, 1 reply; 3+ messages in thread
From: Grazvydas Ignotas @ 2012-01-14 20:50 UTC (permalink / raw)
To: Anton Vorontsov
Cc: linux-kernel, Grazvydas Ignotas, Pali Rohár, Lars-Peter Clausen
When reading flags, bq27x00_read() argument is inverted and causes
reads 2 of bytes for bq27200 and 1 byte for bq27500, while their register
sizes are 1 and 2 bytes respectively. This causes bq27500 upper flag
bits always to be returned as 0, causing full charge state to never be
reported correctly, so fix it.
Cc: Pali Rohár <pali.rohar@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
---
drivers/power/bq27x00_battery.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/power/bq27x00_battery.c b/drivers/power/bq27x00_battery.c
index 98bf567..86decb4 100644
--- a/drivers/power/bq27x00_battery.c
+++ b/drivers/power/bq27x00_battery.c
@@ -312,7 +312,7 @@ static void bq27x00_update(struct bq27x00_device_info *di)
struct bq27x00_reg_cache cache = {0, };
bool is_bq27500 = di->chip == BQ27500;
- cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, is_bq27500);
+ cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500);
if (cache.flags >= 0) {
if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) {
dev_info(di->dev, "battery is not calibrated! ignoring capacity values\n");
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bq27x00_battery: fix flag register read
2012-01-14 20:50 [PATCH] bq27x00_battery: fix flag register read Grazvydas Ignotas
@ 2012-01-19 10:49 ` Pali Rohár
2012-02-01 17:36 ` Anton Vorontsov
0 siblings, 1 reply; 3+ messages in thread
From: Pali Rohár @ 2012-01-19 10:49 UTC (permalink / raw)
To: Grazvydas Ignotas; +Cc: Anton Vorontsov, linux-kernel, Lars-Peter Clausen
[-- Attachment #1: Type: text/plain, Size: 1487 bytes --]
On Saturday 14 January 2012 22:50:49 Grazvydas Ignotas wrote:
> When reading flags, bq27x00_read() argument is inverted and causes
> reads 2 of bytes for bq27200 and 1 byte for bq27500, while their register
> sizes are 1 and 2 bytes respectively. This causes bq27500 upper flag
> bits always to be returned as 0, causing full charge state to never be
> reported correctly, so fix it.
>
> Cc: Pali Rohár <pali.rohar@gmail.com>
> Cc: Lars-Peter Clausen <lars@metafoo.de>
> Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
> ---
> drivers/power/bq27x00_battery.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/power/bq27x00_battery.c
> b/drivers/power/bq27x00_battery.c index 98bf567..86decb4 100644
> --- a/drivers/power/bq27x00_battery.c
> +++ b/drivers/power/bq27x00_battery.c
> @@ -312,7 +312,7 @@ static void bq27x00_update(struct bq27x00_device_info
> *di) struct bq27x00_reg_cache cache = {0, };
> bool is_bq27500 = di->chip == BQ27500;
>
> - cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, is_bq27500);
> + cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500);
> if (cache.flags >= 0) {
> if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) {
> dev_info(di->dev, "battery is not calibrated! ignoring capacity
> values\n");
Yes, you are right, this patch fixing flags register reading.
Anton Vorontsov, can you send this patch to linux 3.3?
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bq27x00_battery: fix flag register read
2012-01-19 10:49 ` Pali Rohár
@ 2012-02-01 17:36 ` Anton Vorontsov
0 siblings, 0 replies; 3+ messages in thread
From: Anton Vorontsov @ 2012-02-01 17:36 UTC (permalink / raw)
To: Pali Rohár; +Cc: Grazvydas Ignotas, linux-kernel, Lars-Peter Clausen
On Thu, Jan 19, 2012 at 02:49:03AM -0800, Pali Rohár wrote:
> On Saturday 14 January 2012 22:50:49 Grazvydas Ignotas wrote:
> > When reading flags, bq27x00_read() argument is inverted and causes
> > reads 2 of bytes for bq27200 and 1 byte for bq27500, while their register
> > sizes are 1 and 2 bytes respectively. This causes bq27500 upper flag
> > bits always to be returned as 0, causing full charge state to never be
> > reported correctly, so fix it.
> >
> > Cc: Pali Rohár <pali.rohar@gmail.com>
> > Cc: Lars-Peter Clausen <lars@metafoo.de>
> > Signed-off-by: Grazvydas Ignotas <notasas@gmail.com>
> > ---
> > drivers/power/bq27x00_battery.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/power/bq27x00_battery.c
> > b/drivers/power/bq27x00_battery.c index 98bf567..86decb4 100644
> > --- a/drivers/power/bq27x00_battery.c
> > +++ b/drivers/power/bq27x00_battery.c
> > @@ -312,7 +312,7 @@ static void bq27x00_update(struct bq27x00_device_info
> > *di) struct bq27x00_reg_cache cache = {0, };
> > bool is_bq27500 = di->chip == BQ27500;
> >
> > - cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, is_bq27500);
> > + cache.flags = bq27x00_read(di, BQ27x00_REG_FLAGS, !is_bq27500);
> > if (cache.flags >= 0) {
> > if (!is_bq27500 && (cache.flags & BQ27000_FLAG_CI)) {
> > dev_info(di->dev, "battery is not calibrated! ignoring capacity
> > values\n");
>
> Yes, you are right, this patch fixing flags register reading.
> Anton Vorontsov, can you send this patch to linux 3.3?
Applied to battery-urgent.git, thanks guys!
--
Anton Vorontsov
Email: cbouatmailru@gmail.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-01 17:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-14 20:50 [PATCH] bq27x00_battery: fix flag register read Grazvydas Ignotas
2012-01-19 10:49 ` Pali Rohár
2012-02-01 17:36 ` Anton Vorontsov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).