Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1544932 > unrolled thread

BQ27xxx registers

Started byChris Lapa <chris@lapa.com.au>
First post2016-12-20 07:10 +0100
Last post2016-12-22 00:40 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.kernel


Contents

  BQ27xxx registers Chris Lapa <chris@lapa.com.au> - 2016-12-20 07:10 +0100
    Re: BQ27xxx registers Pali Rohár <pali.rohar@gmail.com> - 2016-12-20 12:40 +0100
      Re: BQ27xxx registers Chris Lapa <chris@lapa.com.au> - 2016-12-21 03:50 +0100
        Re: BQ27xxx registers Pali Rohár <pali.rohar@gmail.com> - 2016-12-21 13:50 +0100
          Re: BQ27xxx registers Sebastian Reichel <sre@kernel.org> - 2016-12-21 14:30 +0100
          Re: BQ27xxx registers Chris Lapa <chris@lapa.com.au> - 2016-12-22 00:40 +0100

#1544932 — BQ27xxx registers

FromChris Lapa <chris@lapa.com.au>
Date2016-12-20 07:10 +0100
SubjectBQ27xxx registers
Message-ID<sQlMC-1Lp-17@gated-at.bofh.it>

[Multipart message — attachments visible in raw view] — view raw

Hi,

I'm testing out the 4.9 kernel on a AM3359 board fitted with a 
BQ27510-G3 fuel gauge. The board previously worked on the 4.1 kernel, 
however on the 4.9 kernel the bq27xxx_battery.c driver is spitting out 
this error continuously:

power_supply bq27510-0: driver failed to report `charge_full_design' 
property: -121

I have narrowed down the problem to commit 099867a16 where the 
BQ27XXX_REG_DCAP value was changed from 0x2e to 0x3c.

I can generate a patch to fix this issue, however the bigger problem 
exists as to which revision fuel gauge the bq27xxx_battery.c driver is 
intended to support for each family.

Attached is a table I put together of all the register addresses for 
each supported device under the BQ27500 definition and what the current 
driver utilizes (I didn't paste it here as the word wrapping messes with 
the formatting).

There isn't really an ideal solution I can see where we keep the single 
BQ27500 definition and support all the functionality of each revision.

We can try and just support the latest revisions (BQ27510-G3 and 
BQ27520-G4) but I think it could hurt backwards compatibility for 
existing hardware.

I'm happy to work on a fix but just wanted to get some thoughts before 
proceeding.

Cheers,
Chris

[toc] | [next] | [standalone]


#1545061

FromPali Rohár <pali.rohar@gmail.com>
Date2016-12-20 12:40 +0100
Message-ID<sQqVX-4Z8-7@gated-at.bofh.it>
In reply to#1544932

[Multipart message — attachments visible in raw view] — view raw

On Tuesday 20 December 2016 07:00:41 Chris Lapa wrote:
> I can generate a patch to fix this issue, however the bigger problem
> exists as to which revision fuel gauge the bq27xxx_battery.c driver
> is intended to support for each family.

Hi! I think driver should support all revisions. There can be (and 
probably really is) hardware which uses old revision and such hardware 
should be still supported...

-- 
Pali Rohár
pali.rohar@gmail.com

[toc] | [prev] | [next] | [standalone]


#1545558

FromChris Lapa <chris@lapa.com.au>
Date2016-12-21 03:50 +0100
Message-ID<sQF8B-5NV-1@gated-at.bofh.it>
In reply to#1545061
On 20/12/16 10:34 pm, Pali Rohár wrote:
> On Tuesday 20 December 2016 07:00:41 Chris Lapa wrote:
>> I can generate a patch to fix this issue, however the bigger problem
>> exists as to which revision fuel gauge the bq27xxx_battery.c driver
>> is intended to support for each family.
>
> Hi! I think driver should support all revisions. There can be (and
> probably really is) hardware which uses old revision and such hardware
> should be still supported...
>

I agree. However due to the register address changes across the spectrum 
of revisions, each revision will have to be specified individually. For 
example, we will need to implement a BQ27510G1, BQ27510G2, BQ27510G3, 
BQ27520G1, BQ27520G2, BQ27520G3, BQ27520G4 definitions and prospective 
device tree additions ti,bq27510g1, ti,bq27510g2 etc.

The other option is to aim for bottom of the barrel support for all the 
devices under the BQ27500 definition but my feeling is it would get 
messier fast and be less maintainable.

My preference is to go with the first option if you agree?

Thanks,
Chris

[toc] | [prev] | [next] | [standalone]


#1545743

FromPali Rohár <pali.rohar@gmail.com>
Date2016-12-21 13:50 +0100
Message-ID<sQOvg-3vJ-17@gated-at.bofh.it>
In reply to#1545558

[Multipart message — attachments visible in raw view] — view raw

On Wednesday 21 December 2016 03:49:10 Chris Lapa wrote:
> On 20/12/16 10:34 pm, Pali Rohár wrote:
> > On Tuesday 20 December 2016 07:00:41 Chris Lapa wrote:
> >> I can generate a patch to fix this issue, however the bigger
> >> problem exists as to which revision fuel gauge the
> >> bq27xxx_battery.c driver is intended to support for each family.
> > 
> > Hi! I think driver should support all revisions. There can be (and
> > probably really is) hardware which uses old revision and such
> > hardware should be still supported...
> 
> I agree. However due to the register address changes across the
> spectrum of revisions, each revision will have to be specified
> individually. For example, we will need to implement a BQ27510G1,
> BQ27510G2, BQ27510G3, BQ27520G1, BQ27520G2, BQ27520G3, BQ27520G4
> definitions and prospective device tree additions ti,bq27510g1,
> ti,bq27510g2 etc.
> 
> The other option is to aim for bottom of the barrel support for all
> the devices under the BQ27500 definition but my feeling is it would
> get messier fast and be less maintainable.
> 
> My preference is to go with the first option if you agree?

Yes. If those chips have different register addresses, then those chips 
are different. Name, generation or suffix does not matter here.

Similarly there could be chips with different name, but same addresses, 
so can use one driver/configuration without any change.

So I'm for different name in device tree (or platform data or what is 
being used) to distinguish between different revisions.

-- 
Pali Rohár
pali.rohar@gmail.com

[toc] | [prev] | [next] | [standalone]


#1545767

FromSebastian Reichel <sre@kernel.org>
Date2016-12-21 14:30 +0100
Message-ID<sQP7Y-40K-39@gated-at.bofh.it>
In reply to#1545743

[Multipart message — attachments visible in raw view] — view raw

Hi,

On Wed, Dec 21, 2016 at 01:46:17PM +0100, Pali Rohár wrote:
> On Wednesday 21 December 2016 03:49:10 Chris Lapa wrote:
> > On 20/12/16 10:34 pm, Pali Rohár wrote:
> > > On Tuesday 20 December 2016 07:00:41 Chris Lapa wrote:
> > >> I can generate a patch to fix this issue, however the bigger
> > >> problem exists as to which revision fuel gauge the
> > >> bq27xxx_battery.c driver is intended to support for each family.
> > > 
> > > Hi! I think driver should support all revisions. There can be (and
> > > probably really is) hardware which uses old revision and such
> > > hardware should be still supported...
> > 
> > I agree. However due to the register address changes across the
> > spectrum of revisions, each revision will have to be specified
> > individually. For example, we will need to implement a BQ27510G1,
> > BQ27510G2, BQ27510G3, BQ27520G1, BQ27520G2, BQ27520G3, BQ27520G4
> > definitions and prospective device tree additions ti,bq27510g1,
> > ti,bq27510g2 etc.
> > 
> > The other option is to aim for bottom of the barrel support for all
> > the devices under the BQ27500 definition but my feeling is it would
> > get messier fast and be less maintainable.
> > 
> > My preference is to go with the first option if you agree?
> 
> Yes. If those chips have different register addresses, then those chips 
> are different. Name, generation or suffix does not matter here.
> 
> Similarly there could be chips with different name, but same addresses, 
> so can use one driver/configuration without any change.
> 
> So I'm for different name in device tree (or platform data or what is 
> being used) to distinguish between different revisions.

Sounds fine to me. Let's keep the compatible string without revision
as deprecated alias for the version currently implemented by the
driver (for backward compatibility).

-- Sebastian

[toc] | [prev] | [next] | [standalone]


#1546062

FromChris Lapa <chris@lapa.com.au>
Date2016-12-22 00:40 +0100
Message-ID<sQYEj-1tG-69@gated-at.bofh.it>
In reply to#1545743
On 21/12/16 11:46 pm, Pali Rohár wrote:
> On Wednesday 21 December 2016 03:49:10 Chris Lapa wrote:
>> On 20/12/16 10:34 pm, Pali Rohár wrote:
>>> On Tuesday 20 December 2016 07:00:41 Chris Lapa wrote:
>>>> I can generate a patch to fix this issue, however the bigger
>>>> problem exists as to which revision fuel gauge the
>>>> bq27xxx_battery.c driver is intended to support for each family.
>>>
>>> Hi! I think driver should support all revisions. There can be (and
>>> probably really is) hardware which uses old revision and such
>>> hardware should be still supported...
>>
>> I agree. However due to the register address changes across the
>> spectrum of revisions, each revision will have to be specified
>> individually. For example, we will need to implement a BQ27510G1,
>> BQ27510G2, BQ27510G3, BQ27520G1, BQ27520G2, BQ27520G3, BQ27520G4
>> definitions and prospective device tree additions ti,bq27510g1,
>> ti,bq27510g2 etc.
>>
>> The other option is to aim for bottom of the barrel support for all
>> the devices under the BQ27500 definition but my feeling is it would
>> get messier fast and be less maintainable.
>>
>> My preference is to go with the first option if you agree?
>
> Yes. If those chips have different register addresses, then those chips
> are different. Name, generation or suffix does not matter here.
>
> Similarly there could be chips with different name, but same addresses,
> so can use one driver/configuration without any change.
>
> So I'm for different name in device tree (or platform data or what is
> being used) to distinguish between different revisions.
>

I've been working my way through the revision migration datasheets and 
noticed this could be simplified with the FW_VERSION parameter. It is 
always located at the same address and is distinctly different between 
each chip revision. Unfortunately the migration datasheets vs individual 
revision datasheets firmware version information directly contradict 
each other. Which makes me wary of committing to using it.

Given that I don't have every single variant of this device to test 
with, its probably still safest to have the user manually specify each 
device. I should have some patches ready soon.

Thanks,
Chris

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web