Skip to contentSkip to conversation

mfd: axp20x: Add AXP288 volatile registers.

PATCH Applied Christian Mauderer 2 participants 5 messages Jan 11, 2017 – Jan 17, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: axp20x: Add AXP288 volatile registers.

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.

---
 drivers/mfd/axp20x.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/mfd/axp20x.c +3 -0
index ed918de84238..d74b3daca23f 100644
@@ -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 = {
Signature · 1 line
2.11.0
Applied
#1 lore raw
Quoted 8 lines · 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.

Quoted 4 lines
---
 drivers/mfd/axp20x.c | 3 +++
 1 file changed, 3 insertions(+)

Applied, thanks.

Quoted 15 lines
drivers/mfd/axp20x.c +3 -0
index ed918de84238..d74b3daca23f 100644
@@ -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 = {
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#2 lore raw

Am 13.01.2017 um 15:01 schrieb Lee Jones:

Quoted 10 lines · Christian Mauderer
Quoted 9 lines

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.

Quoted 6 lines
Quoted 4 lines
---
 drivers/mfd/axp20x.c | 3 +++
 1 file changed, 3 insertions(+)

Applied, thanks.

Thank you for applying it.

Quoted 17 lines
Quoted 16 lines
drivers/mfd/axp20x.c +3 -0
index ed918de84238..d74b3daca23f 100644
@@ -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 = {
#3 lore raw
In reply to Lee Jones
Quoted 10 lines · Lee Jones
Quoted 8 lines · 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.

Quoted 6 lines
Quoted 4 lines
---
 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.

Quoted 16 lines
Quoted 15 lines
drivers/mfd/axp20x.c +3 -0
index ed918de84238..d74b3daca23f 100644
@@ -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 = {
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
#4 lore raw

Am 17.01.2017 um 15:58 schrieb Lee Jones:

Quoted 17 lines · Lee Jones
Quoted 16 lines · Christian Mauderer
Quoted 13 lines

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.

---
 drivers/mfd/axp20x.c | 3 +++
 1 file changed, 3 insertions(+)
Quoted 5 lines
Quoted 1 line

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

Quoted 18 lines
Quoted 17 lines
Quoted 16 lines
drivers/mfd/axp20x.c +3 -0
index ed918de84238..d74b3daca23f 100644
@@ -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 = {