linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mfd: axp20x: Add AXP288 volatile registers.
@ 2017-01-11 19:49 Christian Mauderer
  2017-01-13 14:01 ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Christian Mauderer @ 2017-01-11 19:49 UTC (permalink / raw)
  To: Lee Jones, Chen-Yu Tsai, linux-pm, linux-kernel; +Cc: Christian Mauderer

The axp288_fuelgauge driver and some other axp288_xxx are using a number
of the registers of the chip that are changed by hardware (for example
charge level). Because these registers are not marked as "volatile" in
the regmap, a cached version is used instead of the correct register
value. In case of the axp288_fuelgauge that leads to a battery level
that only changes on reboot. This patch adds the volatile registers of
the chip.

Signed-off-by: Christian Mauderer <oss@c-mauderer.de>
---
 drivers/mfd/axp20x.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index ed918de84238..d74b3daca23f 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -118,7 +118,10 @@ static const struct regmap_range axp288_writeable_ranges[] = {
 };
 
 static const struct regmap_range axp288_volatile_ranges[] = {
+	regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_PWR_OP_MODE),
 	regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IPSOUT_V_HIGH_L),
+	regmap_reg_range(AXP20X_CC_CTRL, AXP288_FG_OCVL_REG),
+	regmap_reg_range(AXP288_FG_DES_CAP1_REG, AXP288_FG_CC_CAP_REG),
 };
 
 static const struct regmap_access_table axp288_writeable_table = {
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mfd: axp20x: Add AXP288 volatile registers.
  2017-01-11 19:49 [PATCH] mfd: axp20x: Add AXP288 volatile registers Christian Mauderer
@ 2017-01-13 14:01 ` Lee Jones
  2017-01-13 15:54   ` Christian Mauderer
  2017-01-17 14:58   ` Lee Jones
  0 siblings, 2 replies; 5+ messages in thread
From: Lee Jones @ 2017-01-13 14:01 UTC (permalink / raw)
  To: Christian Mauderer; +Cc: Chen-Yu Tsai, linux-pm, linux-kernel

On Wed, 11 Jan 2017, Christian Mauderer wrote:

> The axp288_fuelgauge driver and some other axp288_xxx are using a number
> of the registers of the chip that are changed by hardware (for example
> charge level). Because these registers are not marked as "volatile" in
> the regmap, a cached version is used instead of the correct register
> value. In case of the axp288_fuelgauge that leads to a battery level
> that only changes on reboot. This patch adds the volatile registers of
> the chip.
> 
> Signed-off-by: Christian Mauderer <oss@c-mauderer.de>
> ---
>  drivers/mfd/axp20x.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied, thanks.

> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index ed918de84238..d74b3daca23f 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -118,7 +118,10 @@ static const struct regmap_range axp288_writeable_ranges[] = {
>  };
>  
>  static const struct regmap_range axp288_volatile_ranges[] = {
> +	regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_PWR_OP_MODE),
>  	regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IPSOUT_V_HIGH_L),
> +	regmap_reg_range(AXP20X_CC_CTRL, AXP288_FG_OCVL_REG),
> +	regmap_reg_range(AXP288_FG_DES_CAP1_REG, AXP288_FG_CC_CAP_REG),
>  };
>  
>  static const struct regmap_access_table axp288_writeable_table = {

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mfd: axp20x: Add AXP288 volatile registers.
  2017-01-13 14:01 ` Lee Jones
@ 2017-01-13 15:54   ` Christian Mauderer
  2017-01-17 14:58   ` Lee Jones
  1 sibling, 0 replies; 5+ messages in thread
From: Christian Mauderer @ 2017-01-13 15:54 UTC (permalink / raw)
  To: Lee Jones; +Cc: Chen-Yu Tsai, linux-pm, linux-kernel

Am 13.01.2017 um 15:01 schrieb Lee Jones:
> On Wed, 11 Jan 2017, Christian Mauderer wrote:
> 
>> The axp288_fuelgauge driver and some other axp288_xxx are using a number
>> of the registers of the chip that are changed by hardware (for example
>> charge level). Because these registers are not marked as "volatile" in
>> the regmap, a cached version is used instead of the correct register
>> value. In case of the axp288_fuelgauge that leads to a battery level
>> that only changes on reboot. This patch adds the volatile registers of
>> the chip.
>>
>> Signed-off-by: Christian Mauderer <oss@c-mauderer.de>
>> ---
>>  drivers/mfd/axp20x.c | 3 +++
>>  1 file changed, 3 insertions(+)
> 
> Applied, thanks.

Thank you for applying it.

> 
>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
>> index ed918de84238..d74b3daca23f 100644
>> --- a/drivers/mfd/axp20x.c
>> +++ b/drivers/mfd/axp20x.c
>> @@ -118,7 +118,10 @@ static const struct regmap_range axp288_writeable_ranges[] = {
>>  };
>>  
>>  static const struct regmap_range axp288_volatile_ranges[] = {
>> +	regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_PWR_OP_MODE),
>>  	regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IPSOUT_V_HIGH_L),
>> +	regmap_reg_range(AXP20X_CC_CTRL, AXP288_FG_OCVL_REG),
>> +	regmap_reg_range(AXP288_FG_DES_CAP1_REG, AXP288_FG_CC_CAP_REG),
>>  };
>>  
>>  static const struct regmap_access_table axp288_writeable_table = {
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mfd: axp20x: Add AXP288 volatile registers.
  2017-01-13 14:01 ` Lee Jones
  2017-01-13 15:54   ` Christian Mauderer
@ 2017-01-17 14:58   ` Lee Jones
  2017-01-17 19:46     ` Christian Mauderer
  1 sibling, 1 reply; 5+ messages in thread
From: Lee Jones @ 2017-01-17 14:58 UTC (permalink / raw)
  To: Christian Mauderer; +Cc: Chen-Yu Tsai, linux-pm, linux-kernel

On Fri, 13 Jan 2017, Lee Jones wrote:

> On Wed, 11 Jan 2017, Christian Mauderer wrote:
> 
> > The axp288_fuelgauge driver and some other axp288_xxx are using a number
> > of the registers of the chip that are changed by hardware (for example
> > charge level). Because these registers are not marked as "volatile" in
> > the regmap, a cached version is used instead of the correct register
> > value. In case of the axp288_fuelgauge that leads to a battery level
> > that only changes on reboot. This patch adds the volatile registers of
> > the chip.
> > 
> > Signed-off-by: Christian Mauderer <oss@c-mauderer.de>
> > ---
> >  drivers/mfd/axp20x.c | 3 +++
> >  1 file changed, 3 insertions(+)
> 
> Applied, thanks.

Change of plan.  This patch does not apply.

Please rebase it on top of the MFD tree.

> > diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> > index ed918de84238..d74b3daca23f 100644
> > --- a/drivers/mfd/axp20x.c
> > +++ b/drivers/mfd/axp20x.c
> > @@ -118,7 +118,10 @@ static const struct regmap_range axp288_writeable_ranges[] = {
> >  };
> >  
> >  static const struct regmap_range axp288_volatile_ranges[] = {
> > +	regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_PWR_OP_MODE),
> >  	regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IPSOUT_V_HIGH_L),
> > +	regmap_reg_range(AXP20X_CC_CTRL, AXP288_FG_OCVL_REG),
> > +	regmap_reg_range(AXP288_FG_DES_CAP1_REG, AXP288_FG_CC_CAP_REG),
> >  };
> >  
> >  static const struct regmap_access_table axp288_writeable_table = {
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mfd: axp20x: Add AXP288 volatile registers.
  2017-01-17 14:58   ` Lee Jones
@ 2017-01-17 19:46     ` Christian Mauderer
  0 siblings, 0 replies; 5+ messages in thread
From: Christian Mauderer @ 2017-01-17 19:46 UTC (permalink / raw)
  To: Lee Jones; +Cc: Chen-Yu Tsai, linux-pm, linux-kernel

Am 17.01.2017 um 15:58 schrieb Lee Jones:
> On Fri, 13 Jan 2017, Lee Jones wrote:
> 
>> On Wed, 11 Jan 2017, Christian Mauderer wrote:
>>
>>> The axp288_fuelgauge driver and some other axp288_xxx are using a number
>>> of the registers of the chip that are changed by hardware (for example
>>> charge level). Because these registers are not marked as "volatile" in
>>> the regmap, a cached version is used instead of the correct register
>>> value. In case of the axp288_fuelgauge that leads to a battery level
>>> that only changes on reboot. This patch adds the volatile registers of
>>> the chip.
>>>
>>> Signed-off-by: Christian Mauderer <oss@c-mauderer.de>
>>> ---
>>>  drivers/mfd/axp20x.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>
>> Applied, thanks.
> 
> Change of plan.  This patch does not apply.
> 
> Please rebase it on top of the MFD tree.

It seems that there is already a similar patch on mfd/for-mfd-next. I
tried to apply my patch to the linux/master and 4.9, to some of the
linux-power-supply and to mfd/for-mfd-next-next branch. I totally missed
the for-mfd-next one. Sorry for that.

As far as I can tell, the other patch already does everything that I
would need and it even seems to be slightly more accurate. So you can
just ignore my patch.

I'll test the already existing patches in the next few days on my device
and only send a new patch if something goes wrong. But I'm quite
confident that it is not necessary.

Thanks again.

Christian Mauderer

> 
>>> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
>>> index ed918de84238..d74b3daca23f 100644
>>> --- a/drivers/mfd/axp20x.c
>>> +++ b/drivers/mfd/axp20x.c
>>> @@ -118,7 +118,10 @@ static const struct regmap_range axp288_writeable_ranges[] = {
>>>  };
>>>  
>>>  static const struct regmap_range axp288_volatile_ranges[] = {
>>> +	regmap_reg_range(AXP20X_PWR_INPUT_STATUS, AXP20X_PWR_OP_MODE),
>>>  	regmap_reg_range(AXP20X_IRQ1_EN, AXP20X_IPSOUT_V_HIGH_L),
>>> +	regmap_reg_range(AXP20X_CC_CTRL, AXP288_FG_OCVL_REG),
>>> +	regmap_reg_range(AXP288_FG_DES_CAP1_REG, AXP288_FG_CC_CAP_REG),
>>>  };
>>>  
>>>  static const struct regmap_access_table axp288_writeable_table = {
>>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-01-17 19:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-11 19:49 [PATCH] mfd: axp20x: Add AXP288 volatile registers Christian Mauderer
2017-01-13 14:01 ` Lee Jones
2017-01-13 15:54   ` Christian Mauderer
2017-01-17 14:58   ` Lee Jones
2017-01-17 19:46     ` Christian Mauderer

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).