diff mbox

/sys/class/power_supply/bq27200-0/capacity changed meaning between 4.1 and 4.4?

Message ID 56951A2C.9010602@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Andrew Davis Jan. 12, 2016, 3:22 p.m. UTC
On 01/11/2016 03:48 PM, Andrew F. Davis wrote:
> On 01/11/2016 03:42 PM, Pavel Machek wrote:
>> Hi!
>>
>>>> Did /sys/class/power_supply/bq27200-0/capacity change meaning between
>>>> 4.1 and 4.4?
>>
>>> There was a resent overhaul of this driver and a lot of code is
>>> vestigial as you have seen. I've been meaning to continue
>>> cleaning it up, my next step would probably to bring up regmap
>>
>> Ok, 1wire is probably reasonable approach. But we have an regression
>> between 4.1 and 4.4, and to debug it is probably by reading code.
>>
>> I can't prove you caused the regression, but you basically rewrote the
>> driver, so it should be easier for you to spot the bug.
>>
>
> Makes sense.
>
>> n900 has this variant:
>>
>>             bq27200: bq27200@55 {
>>                      compatible = "ti,bq27200";
>>                reg = <0x55>;
>>       };
>>
>
> Hmmm, not sure if I have this one on hand, I'll see if I can find an
> n900 around here (they seem to be pretty popular around here for testing
> (had a lot of TI parts)).
>
>> Will you try?
>>
>> If not, tell me, and I can do it, but it will involve a lot of swaring...
>>
>
> I'll give it a look over.

OK, I'm still looking for a test setup, but this was definitely a problem,
could you give this a try?:

Comments

Pavel Machek Jan. 12, 2016, 9:53 p.m. UTC | #1
Hi!

> >>If not, tell me, and I can do it, but it will involve a lot of swaring...
> >
> >I'll give it a look over.
> 
> OK, I'm still looking for a test setup, but this was definitely a problem,
> could you give this a try?:

Well, search no more. I tested it and seems to work ok. There's one
more blank line in the source, so I had to apply patch by hand.

Tested-by: Pavel Machek <pavel@ucw.cz>
Acked-by: Pavel Machek <pavel@ucw.cz>
Reported-by: Pavel Machek <pavel@ucw.cz>
Cc: stable@vger.kernel.org

? :-).

And... thanks!
									Pavel

> diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c
> index 880233c..4fec3cf 100644
> --- a/drivers/power/bq27xxx_battery.c
> +++ b/drivers/power/bq27xxx_battery.c
> @@ -470,8 +470,9 @@ static inline int bq27xxx_read(struct bq27xxx_device_info *di, int reg_index,
>  static int bq27xxx_battery_read_soc(struct bq27xxx_device_info *di)
>  {
>  	int soc;
> +	bool single = di->chip == BQ27000 || di->chip == BQ27010;
> -	soc = bq27xxx_read(di, BQ27XXX_REG_SOC, false);
> +	soc = bq27xxx_read(di, BQ27XXX_REG_SOC, single);
>  	if (soc < 0)
>  		dev_dbg(di->dev, "error reading State-of-Charge\n");
Pali Rohár Jan. 13, 2016, 8:44 a.m. UTC | #2
On Tuesday 12 January 2016 22:53:52 Pavel Machek wrote:
> Hi!
> 
> > >>If not, tell me, and I can do it, but it will involve a lot of swaring...
> > >
> > >I'll give it a look over.
> > 
> > OK, I'm still looking for a test setup, but this was definitely a problem,
> > could you give this a try?:
> 
> Well, search no more. I tested it and seems to work ok. There's one
> more blank line in the source, so I had to apply patch by hand.
> 
> Tested-by: Pavel Machek <pavel@ucw.cz>
> Acked-by: Pavel Machek <pavel@ucw.cz>
> Reported-by: Pavel Machek <pavel@ucw.cz>
> Cc: stable@vger.kernel.org
> 
> ? :-).
> 
> And... thanks!
> 									Pavel

There are more pending fixes for bq27xxx... Maybe your is duplicate?

http://thread.gmane.org/gmane.linux.power-management.general/70090
http://thread.gmane.org/gmane.linux.power-management.general/69716/focus=69714
http://thread.gmane.org/gmane.linux.power-management.general/69716/focus=2110580

Sebastian, please take them and ideally send to stable@ for backporting.

> 
> > diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c
> > index 880233c..4fec3cf 100644
> > --- a/drivers/power/bq27xxx_battery.c
> > +++ b/drivers/power/bq27xxx_battery.c
> > @@ -470,8 +470,9 @@ static inline int bq27xxx_read(struct bq27xxx_device_info *di, int reg_index,
> >  static int bq27xxx_battery_read_soc(struct bq27xxx_device_info *di)
> >  {
> >  	int soc;
> > +	bool single = di->chip == BQ27000 || di->chip == BQ27010;
> > -	soc = bq27xxx_read(di, BQ27XXX_REG_SOC, false);
> > +	soc = bq27xxx_read(di, BQ27XXX_REG_SOC, single);
> >  	if (soc < 0)
> >  		dev_dbg(di->dev, "error reading State-of-Charge\n");
>
Sebastian Reichel Jan. 13, 2016, 10:26 a.m. UTC | #3
On Wed, Jan 13, 2016 at 09:44:24AM +0100, Pali Rohár wrote:
> On Tuesday 12 January 2016 22:53:52 Pavel Machek wrote:
> > Hi!
> > 
> > > >>If not, tell me, and I can do it, but it will involve a lot of swaring...
> > > >
> > > >I'll give it a look over.
> > > 
> > > OK, I'm still looking for a test setup, but this was definitely a problem,
> > > could you give this a try?:
> > 
> > Well, search no more. I tested it and seems to work ok. There's one
> > more blank line in the source, so I had to apply patch by hand.
> > 
> > Tested-by: Pavel Machek <pavel@ucw.cz>
> > Acked-by: Pavel Machek <pavel@ucw.cz>
> > Reported-by: Pavel Machek <pavel@ucw.cz>
> > Cc: stable@vger.kernel.org
> > 
> > ? :-).
> > 
> > And... thanks!
> > 									Pavel
> 
> There are more pending fixes for bq27xxx... Maybe your is duplicate?

No, it's not a duplicate.

> http://thread.gmane.org/gmane.linux.power-management.general/70090
> http://thread.gmane.org/gmane.linux.power-management.general/69716/focus=69714
> http://thread.gmane.org/gmane.linux.power-management.general/69716/focus=2110580
> 
> Sebastian, please take them and ideally send to stable@ for backporting.

There is no need to send them to stable@, if they are properly
tagged with a 'Fixes: <sha1> ("title")' tag, so please always
include it in your commit messages, if possible :)

-- Sebastian
Pali Rohár Jan. 13, 2016, 10:32 a.m. UTC | #4
On Wednesday 13 January 2016 11:26:13 Sebastian Reichel wrote:
> On Wed, Jan 13, 2016 at 09:44:24AM +0100, Pali Rohár wrote:
> > On Tuesday 12 January 2016 22:53:52 Pavel Machek wrote:
> > > Hi!
> > > 
> > > > >>If not, tell me, and I can do it, but it will involve a lot of swaring...
> > > > >
> > > > >I'll give it a look over.
> > > > 
> > > > OK, I'm still looking for a test setup, but this was definitely a problem,
> > > > could you give this a try?:
> > > 
> > > Well, search no more. I tested it and seems to work ok. There's one
> > > more blank line in the source, so I had to apply patch by hand.
> > > 
> > > Tested-by: Pavel Machek <pavel@ucw.cz>
> > > Acked-by: Pavel Machek <pavel@ucw.cz>
> > > Reported-by: Pavel Machek <pavel@ucw.cz>
> > > Cc: stable@vger.kernel.org
> > > 
> > > ? :-).
> > > 
> > > And... thanks!
> > > 									Pavel
> > 
> > There are more pending fixes for bq27xxx... Maybe your is duplicate?
> 
> No, it's not a duplicate.
> 
> > http://thread.gmane.org/gmane.linux.power-management.general/70090
> > http://thread.gmane.org/gmane.linux.power-management.general/69716/focus=69714
> > http://thread.gmane.org/gmane.linux.power-management.general/69716/focus=2110580

Hm... It looks like Pavel's patch is subset of this 3rd patch as it fix
function bq27xxx_battery_read_soc()

> > Sebastian, please take them and ideally send to stable@ for backporting.
> 
> There is no need to send them to stable@, if they are properly
> tagged with a 'Fixes: <sha1> ("title")' tag, so please always
> include it in your commit messages, if possible :)

I have not sent those patches, but OK. In that email thread you can find
sha1 commit id which broke it.
Pavel Machek Jan. 13, 2016, 11:01 a.m. UTC | #5
On Wed 2016-01-13 11:26:13, Sebastian Reichel wrote:
> On Wed, Jan 13, 2016 at 09:44:24AM +0100, Pali Rohár wrote:
> > On Tuesday 12 January 2016 22:53:52 Pavel Machek wrote:
> > > Hi!
> > > 
> > > > >>If not, tell me, and I can do it, but it will involve a lot of swaring...
> > > > >
> > > > >I'll give it a look over.
> > > > 
> > > > OK, I'm still looking for a test setup, but this was definitely a problem,
> > > > could you give this a try?:
> > > 
> > > Well, search no more. I tested it and seems to work ok. There's one
> > > more blank line in the source, so I had to apply patch by hand.
> > > 
> > > Tested-by: Pavel Machek <pavel@ucw.cz>
> > > Acked-by: Pavel Machek <pavel@ucw.cz>
> > > Reported-by: Pavel Machek <pavel@ucw.cz>
> > > Cc: stable@vger.kernel.org
> > > 
> > > ? :-).
> > > 
> > > And... thanks!
> > > 									Pavel
> > 
> > There are more pending fixes for bq27xxx... Maybe your is duplicate?
> 
> No, it's not a duplicate.
> 
> > http://thread.gmane.org/gmane.linux.power-management.general/70090
> > http://thread.gmane.org/gmane.linux.power-management.general/69716/focus=69714
> > http://thread.gmane.org/gmane.linux.power-management.general/69716/focus=2110580
> > 
> > Sebastian, please take them and ideally send to stable@ for backporting.
> 
> There is no need to send them to stable@, if they are properly
> tagged with a 'Fixes: <sha1> ("title")' tag, so please always
> include it in your commit messages, if possible :)

Heh, sorry about that, but I don't know what it fixed. I guess git
blame would tell us. 

Anyway,
http://thread.gmane.org/gmane.linux.power-management.general/69716/focus=2110580
fixed an regression in 4.4 kernel, and did not get to 4.4, which is
rather sad :-(.

									Pavel
diff mbox

Patch

diff --git a/drivers/power/bq27xxx_battery.c b/drivers/power/bq27xxx_battery.c
index 880233c..4fec3cf 100644
--- a/drivers/power/bq27xxx_battery.c
+++ b/drivers/power/bq27xxx_battery.c
@@ -470,8 +470,9 @@  static inline int bq27xxx_read(struct bq27xxx_device_info *di, int reg_index,
  static int bq27xxx_battery_read_soc(struct bq27xxx_device_info *di)
  {
  	int soc;
+	bool single = di->chip == BQ27000 || di->chip == BQ27010;
  
-	soc = bq27xxx_read(di, BQ27XXX_REG_SOC, false);
+	soc = bq27xxx_read(di, BQ27XXX_REG_SOC, single);
  
  	if (soc < 0)
  		dev_dbg(di->dev, "error reading State-of-Charge\n");