mfd: axp20x: Change volatile ranges on axp803
Subsystems (3)
PATCH 1/1 mfd: axp20x: Change volatile ranges on axp803
From: Ondrej Jirman <[email protected]>
Regulator control registers can be cached. They don't update by themselves. Enable cache on them, to speed up voltage changes, particularly DCDC2 which needs to be handled quickly due to being used for CPUX cores and is changed very frequently by some cpufreq schedulers.
This shrinks register access over RSB bus to one write per voltage change (down from 4 or so).
--- drivers/mfd/axp20x.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)
drivers/mfd/axp20x.c +27 -1
@@ -172,6 +172,18 @@ static const struct regmap_range axp288_volatile_ranges[] = { regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), }; +static const struct regmap_range axp803_volatile_ranges[] = { +regmap_reg_range (AXP20X_PWR_INPUT_STATUS ,AXP288_POWER_REASON ), +regmap_reg_range (AXP288_BC_GLOBAL ,AXP288_BC_GLOBAL ), +regmap_reg_range (AXP288_BC_DET_STAT ,AXP20X_VBUS_IPSOUT_MGMT ), +regmap_reg_range (AXP20X_CHRG_BAK_CTRL ,AXP20X_CHRG_BAK_CTRL ), +regmap_reg_range (AXP20X_IRQ1_EN ,AXP20X_IPSOUT_V_HIGH_L ), +regmap_reg_range (AXP20X_TIMER_CTRL ,AXP20X_TIMER_CTRL ), +regmap_reg_range (AXP20X_GPIO1_CTRL ,AXP22X_GPIO_STATE ), +regmap_reg_range (AXP288_RT_BATT_V_H ,AXP288_RT_BATT_V_L ), +regmap_reg_range (AXP20X_FG_RES ,AXP288_FG_CC_CAP_REG ), +}; +static const struct regmap_access_table axp288_writeable_table = { .yes_ranges = axp288_writeable_ranges, .n_yes_ranges =ARRAY_SIZE (axp288_writeable_ranges),
@@ -182,6 +194,11 @@ static const struct regmap_access_table axp288_volatile_table = { .n_yes_ranges = ARRAY_SIZE(axp288_volatile_ranges), }; +static const struct regmap_access_table axp803_volatile_table = { + .yes_ranges = axp803_volatile_ranges, + .n_yes_ranges =ARRAY_SIZE (axp803_volatile_ranges), +}; +static const struct regmap_range axp806_writeable_ranges[] = {regmap_reg_range (AXP20X_DATACACHE (0 ),AXP20X_DATACACHE (3 )),regmap_reg_range (AXP806_PWR_OUT_CTRL1 ,AXP806_CLDO3_V_CTRL ),
@@ -456,6 +473,15 @@ static const struct regmap_config axp22x_regmap_config = { .cache_type = REGCACHE_MAPLE, }; +static const struct regmap_config axp803_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .wr_table = &axp288_writeable_table, + .volatile_table = &axp803_volatile_table, + .max_register =AXP288_FG_TUNE5 , + .cache_type =REGCACHE_MAPLE , +}; +static const struct regmap_config axp288_regmap_config = { .reg_bits =8 , .val_bits =8 ,
@@ -1368,7 +1394,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)case AXP803_ID : axp20x->nr_cells =ARRAY_SIZE (axp803_cells); axp20x->cells = axp803_cells; - axp20x->regmap_cfg = &axp288_regmap_config; + axp20x->regmap_cfg = &axp803_regmap_config; axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;break ;case AXP806_ID :
Signature · 1 line
2.53.0
Jernej Škrabec
maintainerDne nedelja, 15. marec 2026 ob 13:49:31 Srednjeevropski standardni čas je Ondřej Jirman napisal(a):
Quoted 6 lines
From: Ondrej Jirman <[email protected]>
Regulator control registers can be cached. They don't update by themselves. Enable cache on them, to speed up voltage changes, particularly DCDC2 which needs to be handled quickly due to being used for CPUX cores and is changed very frequently by some cpufreq schedulers.
That's not really the case, DCDC2-DCDC6 registers have DVM finished status bit, which is volatile and it is right to have them in volatile range. However, it is true that other registers are non-volatile, so that range can be considerably shrinked. It seems that AXP288 have same register layout but I can't say for sure (I only found datasheet for AXP288C), so it's best to leave it alone and apply changes only to AXP803.
Best regards,
Jernej
Quoted 70 lines
This shrinks register access over RSB bus to one write per voltage change (down from 4 or so).
Signed-off-by Ondrej Jirman <[email protected]>--- drivers/mfd/axp20x.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)drivers/mfd/axp20x.c +27
-1@@ -172,6 +172,18 @@ static const struct regmap_range axp288_volatile_ranges[] = { regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), }; +static const struct regmap_range axp803_volatile_ranges[] = { +regmap_reg_range (AXP20X_PWR_INPUT_STATUS ,AXP288_POWER_REASON ), +regmap_reg_range (AXP288_BC_GLOBAL ,AXP288_BC_GLOBAL ), +regmap_reg_range (AXP288_BC_DET_STAT ,AXP20X_VBUS_IPSOUT_MGMT ), +regmap_reg_range (AXP20X_CHRG_BAK_CTRL ,AXP20X_CHRG_BAK_CTRL ), +regmap_reg_range (AXP20X_IRQ1_EN ,AXP20X_IPSOUT_V_HIGH_L ), +regmap_reg_range (AXP20X_TIMER_CTRL ,AXP20X_TIMER_CTRL ), +regmap_reg_range (AXP20X_GPIO1_CTRL ,AXP22X_GPIO_STATE ), +regmap_reg_range (AXP288_RT_BATT_V_H ,AXP288_RT_BATT_V_L ), +regmap_reg_range (AXP20X_FG_RES ,AXP288_FG_CC_CAP_REG ), +}; +static const struct regmap_access_table axp288_writeable_table = { .yes_ranges = axp288_writeable_ranges, .n_yes_ranges =ARRAY_SIZE (axp288_writeable_ranges),@@ -182,6 +194,11 @@ static const struct regmap_access_table axp288_volatile_table = { .n_yes_ranges = ARRAY_SIZE(axp288_volatile_ranges), }; +static const struct regmap_access_table axp803_volatile_table = { + .yes_ranges = axp803_volatile_ranges, + .n_yes_ranges =ARRAY_SIZE (axp803_volatile_ranges), +}; +static const struct regmap_range axp806_writeable_ranges[] = {regmap_reg_range (AXP20X_DATACACHE (0 ),AXP20X_DATACACHE (3 )),regmap_reg_range (AXP806_PWR_OUT_CTRL1 ,AXP806_CLDO3_V_CTRL ),@@ -456,6 +473,15 @@ static const struct regmap_config axp22x_regmap_config = { .cache_type = REGCACHE_MAPLE, }; +static const struct regmap_config axp803_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .wr_table = &axp288_writeable_table, + .volatile_table = &axp803_volatile_table, + .max_register =AXP288_FG_TUNE5 , + .cache_type =REGCACHE_MAPLE , +}; +static const struct regmap_config axp288_regmap_config = { .reg_bits =8 , .val_bits =8 ,@@ -1368,7 +1394,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)case AXP803_ID : axp20x->nr_cells =ARRAY_SIZE (axp803_cells); axp20x->cells = axp803_cells; - axp20x->regmap_cfg = &axp288_regmap_config; + axp20x->regmap_cfg = &axp803_regmap_config; axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;break ;case AXP806_ID :
Quoted 8 lines · Jernej Škrabec
Dne nedelja, 15. marec 2026 ob 13:49:31 Srednjeevropski standardni čas je Ondřej Jirman napisal(a):
Quoted 6 lines
From: Ondrej Jirman <[email protected]>
Regulator control registers can be cached. They don't update by themselves. Enable cache on them, to speed up voltage changes, particularly DCDC2 which needs to be handled quickly due to being used for CPUX cores and is changed very frequently by some cpufreq schedulers.
Quoted 6 lines
That's not really the case, DCDC2-DCDC6 registers have DVM finished status bit, which is volatile and it is right to have them in volatile range. However, it is true that other registers are non-volatile, so that range can be considerably shrinked. It seems that AXP288 have same register layout but I can't say for sure (I only found datasheet for AXP288C), so it's best to leave it alone and apply changes only to AXP803.
While true, it's not used by any kernel drivers, and having the whole register marked volatile for a single unused bit is contributing 10s of % of permanent CPU load just from cpufreq DVFS operations alone when using schedutil governor, which is doing DVFS hundred or more times per second.
If someone will want to use this bit in the regulator driver, they can use eg. regmap_read_bypassed() to access the bit, while keepig the other parts of regulator implementation performant.
But I guess it may deserve a comment in the code.
Kind regards,
o.
Quoted 77 lines
Best regards,
JernejQuoted 70 lines
This shrinks register access over RSB bus to one write per voltage change (down from 4 or so).
Signed-off-by Ondrej Jirman <[email protected]>--- drivers/mfd/axp20x.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)drivers/mfd/axp20x.c +27
-1@@ -172,6 +172,18 @@ static const struct regmap_range axp288_volatile_ranges[] = { regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), }; +static const struct regmap_range axp803_volatile_ranges[] = { +regmap_reg_range (AXP20X_PWR_INPUT_STATUS ,AXP288_POWER_REASON ), +regmap_reg_range (AXP288_BC_GLOBAL ,AXP288_BC_GLOBAL ), +regmap_reg_range (AXP288_BC_DET_STAT ,AXP20X_VBUS_IPSOUT_MGMT ), +regmap_reg_range (AXP20X_CHRG_BAK_CTRL ,AXP20X_CHRG_BAK_CTRL ), +regmap_reg_range (AXP20X_IRQ1_EN ,AXP20X_IPSOUT_V_HIGH_L ), +regmap_reg_range (AXP20X_TIMER_CTRL ,AXP20X_TIMER_CTRL ), +regmap_reg_range (AXP20X_GPIO1_CTRL ,AXP22X_GPIO_STATE ), +regmap_reg_range (AXP288_RT_BATT_V_H ,AXP288_RT_BATT_V_L ), +regmap_reg_range (AXP20X_FG_RES ,AXP288_FG_CC_CAP_REG ), +}; +static const struct regmap_access_table axp288_writeable_table = { .yes_ranges = axp288_writeable_ranges, .n_yes_ranges =ARRAY_SIZE (axp288_writeable_ranges),@@ -182,6 +194,11 @@ static const struct regmap_access_table axp288_volatile_table = { .n_yes_ranges = ARRAY_SIZE(axp288_volatile_ranges), }; +static const struct regmap_access_table axp803_volatile_table = { + .yes_ranges = axp803_volatile_ranges, + .n_yes_ranges =ARRAY_SIZE (axp803_volatile_ranges), +}; +static const struct regmap_range axp806_writeable_ranges[] = {regmap_reg_range (AXP20X_DATACACHE (0 ),AXP20X_DATACACHE (3 )),regmap_reg_range (AXP806_PWR_OUT_CTRL1 ,AXP806_CLDO3_V_CTRL ),@@ -456,6 +473,15 @@ static const struct regmap_config axp22x_regmap_config = { .cache_type = REGCACHE_MAPLE, }; +static const struct regmap_config axp803_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .wr_table = &axp288_writeable_table, + .volatile_table = &axp803_volatile_table, + .max_register =AXP288_FG_TUNE5 , + .cache_type =REGCACHE_MAPLE , +}; +static const struct regmap_config axp288_regmap_config = { .reg_bits =8 , .val_bits =8 ,@@ -1368,7 +1394,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)case AXP803_ID : axp20x->nr_cells =ARRAY_SIZE (axp803_cells); axp20x->cells = axp803_cells; - axp20x->regmap_cfg = &axp288_regmap_config; + axp20x->regmap_cfg = &axp803_regmap_config; axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;break ;case AXP806_ID :
Jernej Škrabec
maintainerDne sobota, 21. marec 2026 ob 19:26:43 Srednjeevropski poletni čas je Ondřej Jirman napisal(a):
Quoted 16 lines · Jernej Škrabec
Quoted 8 lines
Dne nedelja, 15. marec 2026 ob 13:49:31 Srednjeevropski standardni čas je Ondřej Jirman napisal(a):
Quoted 6 lines
From: Ondrej Jirman <[email protected]>
Regulator control registers can be cached. They don't update by themselves. Enable cache on them, to speed up voltage changes, particularly DCDC2 which needs to be handled quickly due to being used for CPUX cores and is changed very frequently by some cpufreq schedulers.
Quoted 6 lines
That's not really the case, DCDC2-DCDC6 registers have DVM finished status bit, which is volatile and it is right to have them in volatile range. However, it is true that other registers are non-volatile, so that range can be considerably shrinked. It seems that AXP288 have same register layout but I can't say for sure (I only found datasheet for AXP288C), so it's best to leave it alone and apply changes only to AXP803.
Quoted 8 lines
While true, it's not used by any kernel drivers, and having the whole register marked volatile for a single unused bit is contributing 10s of % of permanent CPU load just from cpufreq DVFS operations alone when using schedutil governor, which is doing DVFS hundred or more times per second.
If someone will want to use this bit in the regulator driver, they can use eg.
regmap_read_bypassed()to access the bit, while keepig the other parts of regulator implementation performant.
This sounds like a good compromise.
Quoted 2 lines
But I guess it may deserve a comment in the code.
For sure.
BR Jernej
Quoted 82 lines
Kind regards,
o.Quoted 77 lines
Best regards,
JernejQuoted 70 lines
This shrinks register access over RSB bus to one write per voltage change (down from 4 or so).
Signed-off-by Ondrej Jirman <[email protected]>--- drivers/mfd/axp20x.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-)drivers/mfd/axp20x.c +27
-1@@ -172,6 +172,18 @@ static const struct regmap_range axp288_volatile_ranges[] = { regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), }; +static const struct regmap_range axp803_volatile_ranges[] = { +regmap_reg_range (AXP20X_PWR_INPUT_STATUS ,AXP288_POWER_REASON ), +regmap_reg_range (AXP288_BC_GLOBAL ,AXP288_BC_GLOBAL ), +regmap_reg_range (AXP288_BC_DET_STAT ,AXP20X_VBUS_IPSOUT_MGMT ), +regmap_reg_range (AXP20X_CHRG_BAK_CTRL ,AXP20X_CHRG_BAK_CTRL ), +regmap_reg_range (AXP20X_IRQ1_EN ,AXP20X_IPSOUT_V_HIGH_L ), +regmap_reg_range (AXP20X_TIMER_CTRL ,AXP20X_TIMER_CTRL ), +regmap_reg_range (AXP20X_GPIO1_CTRL ,AXP22X_GPIO_STATE ), +regmap_reg_range (AXP288_RT_BATT_V_H ,AXP288_RT_BATT_V_L ), +regmap_reg_range (AXP20X_FG_RES ,AXP288_FG_CC_CAP_REG ), +}; +static const struct regmap_access_table axp288_writeable_table = { .yes_ranges = axp288_writeable_ranges, .n_yes_ranges =ARRAY_SIZE (axp288_writeable_ranges),@@ -182,6 +194,11 @@ static const struct regmap_access_table axp288_volatile_table = { .n_yes_ranges = ARRAY_SIZE(axp288_volatile_ranges), }; +static const struct regmap_access_table axp803_volatile_table = { + .yes_ranges = axp803_volatile_ranges, + .n_yes_ranges =ARRAY_SIZE (axp803_volatile_ranges), +}; +static const struct regmap_range axp806_writeable_ranges[] = {regmap_reg_range (AXP20X_DATACACHE (0 ),AXP20X_DATACACHE (3 )),regmap_reg_range (AXP806_PWR_OUT_CTRL1 ,AXP806_CLDO3_V_CTRL ),@@ -456,6 +473,15 @@ static const struct regmap_config axp22x_regmap_config = { .cache_type = REGCACHE_MAPLE, }; +static const struct regmap_config axp803_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .wr_table = &axp288_writeable_table, + .volatile_table = &axp803_volatile_table, + .max_register =AXP288_FG_TUNE5 , + .cache_type =REGCACHE_MAPLE , +}; +static const struct regmap_config axp288_regmap_config = { .reg_bits =8 , .val_bits =8 ,@@ -1368,7 +1394,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)case AXP803_ID : axp20x->nr_cells =ARRAY_SIZE (axp803_cells); axp20x->cells = axp803_cells; - axp20x->regmap_cfg = &axp288_regmap_config; + axp20x->regmap_cfg = &axp803_regmap_config; axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;break ;case AXP806_ID :
Quoted 11 lines · 在 2026-03-21六的 07:25 +0100,Jernej Škrabec写道:
Dne nedelja, 15. marec 2026 ob 13:49:31 Srednjeevropski standardni čas je Ondřej Jirman napisal(a):
Quoted 8 lines
From: Ondrej Jirman <[email protected]>
Regulator control registers can be cached. They don't update by themselves. Enable cache on them, to speed up voltage changes, particularly DCDC2 which needs to be handled quickly due to being used
for CPUX cores and is changed very frequently by some cpufreq schedulers.
Quoted 11 lines
That's not really the case, DCDC2-DCDC6 registers have DVM finished status
bit, which is volatile and it is right to have them in volatile range.
However, it is true that other registers are non-volatile, so that range can
be considerably shrinked. It seems that AXP288 have same register layout
but I can't say for sure (I only found datasheet for AXP288C), so it's best
to leave it alone and apply changes only to AXP803.
I have AXP288 datasheet, and register map looks the same with AXP288C.
BTW I think AXP288/288C/803/813(PMIC part) is the same die -- they have the same "IC type no" value of 0b010001, and their difference could be explained as package difference -- AXP803 doesn't wire AXP813's DCDC7 and wire SWIN to DCDC1 out, and AXP288 doesn't wire AXP813's DCDC3. (As of RSB, all AXP PMICs boot at I2C mode by default, and the main SoC switches it to RSB when it's needed; AXP288 is paired with non- Allwinner SoCs (Intel ones) so it just doesn't advertise RSB.)
Thanks,
Icenowy
Quoted 87 lines
Best regards,
JernejQuoted 79 lines
This shrinks register access over RSB bus to one write per voltage change (down from 4 or so).
Signed-off-by Ondrej Jirman <[email protected]>---
drivers/mfd/axp20x.c | 28 +++++++++++++++++++++++++++-1 file changed, 27 insertions(+), 1 deletion(-)drivers/mfd/axp20x.c +0
-0@@ -172,6 +172,18 @@ static const struct regmap_range axp288_volatile_ranges[] = { regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), };drivers/mfd/axp20x.c +2
-0+static const struct regmap_range axp803_volatile_ranges[] = { + regmap_reg_range(AXP20X_PWR_INPUT_STATUS,
AXP288_POWER_REASON),drivers/mfd/axp20x.c +2
-0+regmap_reg_range (AXP288_BC_GLOBAL ,AXP288_BC_GLOBAL ), + regmap_reg_range(AXP288_BC_DET_STAT,
AXP20X_VBUS_IPSOUT_MGMT),drivers/mfd/axp20x.c +1
-0+ regmap_reg_range(AXP20X_CHRG_BAK_CTRL,
AXP20X_CHRG_BAK_CTRL),drivers/mfd/axp20x.c +7
-0+regmap_reg_range (AXP20X_IRQ1_EN ,AXP20X_IPSOUT_V_HIGH_L ), +regmap_reg_range (AXP20X_TIMER_CTRL ,AXP20X_TIMER_CTRL ), +regmap_reg_range (AXP20X_GPIO1_CTRL ,AXP22X_GPIO_STATE ), +regmap_reg_range (AXP288_RT_BATT_V_H ,AXP288_RT_BATT_V_L ), + regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), +}; +static const struct
regmap_access_tableaxp288_writeable_table= {
.yes_ranges =axp288_writeable_ranges,
.n_yes_ranges =ARRAY_SIZE(axp288_writeable_ranges),drivers/mfd/axp20x.c +0
-0@@ -182,6 +194,11 @@ static const struct regmap_access_table axp288_volatile_table = { .n_yes_ranges = ARRAY_SIZE(axp288_volatile_ranges), };drivers/mfd/axp20x.c +5
-0+static const struct regmap_access_table axp803_volatile_table = { + .yes_ranges = axp803_volatile_ranges, + .n_yes_ranges =ARRAY_SIZE (axp803_volatile_ranges), +}; +static const struct
regmap_rangeaxp806_writeable_ranges[] = {regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_DATACACHE(3)),regmap_reg_range(AXP806_PWR_OUT_CTRL1, AXP806_CLDO3_V_CTRL),drivers/mfd/axp20x.c +0
-0@@ -456,6 +473,15 @@ static const struct regmap_config axp22x_regmap_config = { .cache_type = REGCACHE_MAPLE, };drivers/mfd/axp20x.c +9
-0+static const struct regmap_config axp803_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .wr_table = &axp288_writeable_table, + .volatile_table = &axp803_volatile_table, + .max_register =AXP288_FG_TUNE5 , + .cache_type =REGCACHE_MAPLE , +}; +static const struct
regmap_configaxp288_regmap_config= {
.reg_bits = 8,
.val_bits = 8,drivers/mfd/axp20x.c +0
-0@@ -1368,7 +1394,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)case
AXP803_ID:
axp20x->nr_cells=ARRAY_SIZE(axp803_cells);axp20x->cells=axp803_cells;drivers/mfd/axp20x.c +1
-1- axp20x->regmap_cfg = &axp288_regmap_config; + axp20x->regmap_cfg = &axp803_regmap_config;
axp20x->regmap_irq_chip=&axp803_regmap_irq_chip; break;
caseAXP806_ID:
Quoted 27 lines · 在 2026-04-21二的 13:06 +0800,Icenowy Zheng写道:
Quoted 11 lines · 在 2026-03-21六的 07:25 +0100,Jernej Škrabec写道:
Dne nedelja, 15. marec 2026 ob 13:49:31 Srednjeevropski standardni čas je Ondřej Jirman napisal(a):
Quoted 8 lines
From: Ondrej Jirman <[email protected]>
Regulator control registers can be cached. They don't update by themselves. Enable cache on them, to speed up voltage changes, particularly DCDC2 which needs to be handled quickly due to being used
for CPUX cores and is changed very frequently by some cpufreq schedulers.Quoted 11 lines
That's not really the case, DCDC2-DCDC6 registers have DVM finished status
bit, which is volatile and it is right to have them in volatile range.
However, it is true that other registers are non-volatile, so that range can
be considerably shrinked. It seems that AXP288 have same register layout
but I can't say for sure (I only found datasheet for AXP288C), so it's best
to leave it alone and apply changes only to AXP803.I have AXP288 datasheet, and register map looks the same with AXP288C.
Quoted 10 lines
BTW I think AXP288/288C/803/813(PMIC part) is the same die -- they have
the same "IC type no" value of0b010001, and their difference could be
explained as package difference -- AXP803 doesn't wire AXP813's DCDC7 and wire SWIN to DCDC1 out, and AXP288 doesn't wire AXP813's DCDC3. (As
of RSB, all AXP PMICs boot at I2C mode by default, and the main SoC switches it to RSB when it's needed; AXP288 is paired with non- Allwinner SoCs (Intel ones) so it just doesn't advertise RSB.)
P.S. my "AXP813 datasheet v1.0-20140901.pdf" file has a PDF title of "AXP288".
And I think AXP813 has the most functionality because it's a BGA chip. (Weirdly the switch bit is "reserved" on the datasheet despite SWIN and SWOUT pins are there -- but the kernel driver has the switch defined and it matches AXP803 DC1SW).
Thanks,
Icenowy
Quoted 97 lines
Thanks,
IcenowyQuoted 93 lines
Best regards,
JernejQuoted 85 lines
This shrinks register access over RSB bus to one write per voltage
change (down from 4 or so).Signed-off-by Ondrej Jirman <[email protected]>---
drivers/mfd/axp20x.c | 28 +++++++++++++++++++++++++++-1 file changed, 27 insertions(+), 1 deletion(-)drivers/mfd/axp20x.c +0
-0@@ -172,6 +172,18 @@ static const struct regmap_range axp288_volatile_ranges[] = { regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), };drivers/mfd/axp20x.c +2
-0+static const struct regmap_range axp803_volatile_ranges[] = { + regmap_reg_range(AXP20X_PWR_INPUT_STATUS,
AXP288_POWER_REASON),drivers/mfd/axp20x.c +2
-0+regmap_reg_range (AXP288_BC_GLOBAL ,AXP288_BC_GLOBAL ), + regmap_reg_range(AXP288_BC_DET_STAT,
AXP20X_VBUS_IPSOUT_MGMT),drivers/mfd/axp20x.c +1
-0+ regmap_reg_range(AXP20X_CHRG_BAK_CTRL,
AXP20X_CHRG_BAK_CTRL),drivers/mfd/axp20x.c +1
-0+ regmap_reg_range(AXP20X_IRQ1_EN,
AXP20X_IPSOUT_V_HIGH_L),drivers/mfd/axp20x.c +3
-0+regmap_reg_range (AXP20X_TIMER_CTRL ,AXP20X_TIMER_CTRL ), +regmap_reg_range (AXP20X_GPIO1_CTRL ,AXP22X_GPIO_STATE ), + regmap_reg_range(AXP288_RT_BATT_V_H,
AXP288_RT_BATT_V_L),drivers/mfd/axp20x.c +3
-0+ regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), +}; +static const struct
regmap_access_tableaxp288_writeable_table= {
.yes_ranges =axp288_writeable_ranges,
.n_yes_ranges =ARRAY_SIZE(axp288_writeable_ranges),drivers/mfd/axp20x.c +0
-0@@ -182,6 +194,11 @@ static const struct regmap_access_table axp288_volatile_table = { .n_yes_ranges = ARRAY_SIZE(axp288_volatile_ranges), };
+static const structregmap_access_tableaxp803_volatile_table= {drivers/mfd/axp20x.c +4
-0+ .yes_ranges = axp803_volatile_ranges, + .n_yes_ranges = ARRAY_SIZE(axp803_volatile_ranges), +}; +static const struct
regmap_rangeaxp806_writeable_ranges[] = {regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_DATACACHE(3)),regmap_reg_range(AXP806_PWR_OUT_CTRL1, AXP806_CLDO3_V_CTRL),drivers/mfd/axp20x.c +0
-0@@ -456,6 +473,15 @@ static const struct regmap_config axp22x_regmap_config = { .cache_type = REGCACHE_MAPLE, };drivers/mfd/axp20x.c +9
-0+static const struct regmap_config axp803_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .wr_table = &axp288_writeable_table, + .volatile_table = &axp803_volatile_table, + .max_register =AXP288_FG_TUNE5 , + .cache_type =REGCACHE_MAPLE , +}; +static const struct
regmap_configaxp288_regmap_config= {
.reg_bits = 8,
.val_bits = 8,drivers/mfd/axp20x.c +0
-0@@ -1368,7 +1394,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)case
AXP803_ID:
axp20x->nr_cells=ARRAY_SIZE(axp803_cells);axp20x->cells=axp803_cells;drivers/mfd/axp20x.c +1
-1- axp20x->regmap_cfg = &axp288_regmap_config; + axp20x->regmap_cfg = &axp803_regmap_config;
axp20x->regmap_irq_chip=&axp803_regmap_irq_chip;
break;
caseAXP806_ID:
Quoted 27 lines · 在 2026-04-21二的 13:06 +0800,Icenowy Zheng写道:
Quoted 11 lines · 在 2026-03-21六的 07:25 +0100,Jernej Škrabec写道:
Dne nedelja, 15. marec 2026 ob 13:49:31 Srednjeevropski standardni čas je Ondřej Jirman napisal(a):
Quoted 8 lines
From: Ondrej Jirman <[email protected]>
Regulator control registers can be cached. They don't update by themselves. Enable cache on them, to speed up voltage changes, particularly DCDC2 which needs to be handled quickly due to being used
for CPUX cores and is changed very frequently by some cpufreq schedulers.Quoted 11 lines
That's not really the case, DCDC2-DCDC6 registers have DVM finished status
bit, which is volatile and it is right to have them in volatile range.
However, it is true that other registers are non-volatile, so that range can
be considerably shrinked. It seems that AXP288 have same register layout
but I can't say for sure (I only found datasheet for AXP288C), so it's best
to leave it alone and apply changes only to AXP803.I have AXP288 datasheet, and register map looks the same with AXP288C.
Quoted 10 lines
BTW I think AXP288/288C/803/813(PMIC part) is the same die -- they have
the same "IC type no" value of0b010001, and their difference could be
explained as package difference -- AXP803 doesn't wire AXP813's DCDC7 and wire SWIN to DCDC1 out, and AXP288 doesn't wire AXP813's DCDC3. (As
of RSB, all AXP PMICs boot at I2C mode by default, and the main SoC switches it to RSB when it's needed; AXP288 is paired with non- Allwinner SoCs (Intel ones) so it just doesn't advertise RSB.)
Forgot to mention that AXP8x3 also have dedicated VBUS and ACIN inputs while AXP288 has only VBUS -- but in the AXP803 datasheet, VBUS and ACIN shorted together is a valid use case and can be detected by the PMIC, and when they're shorted the VBUS current limit is active (the ACIN current limit is ignored); so for AXP288 it could be explained that the ACIN is shorted with VBUS in the package.
Thanks,
Icenowy
Quoted 97 lines
Thanks,
IcenowyQuoted 93 lines
Best regards,
JernejQuoted 85 lines
This shrinks register access over RSB bus to one write per voltage
change (down from 4 or so).Signed-off-by Ondrej Jirman <[email protected]>---
drivers/mfd/axp20x.c | 28 +++++++++++++++++++++++++++-1 file changed, 27 insertions(+), 1 deletion(-)drivers/mfd/axp20x.c +0
-0@@ -172,6 +172,18 @@ static const struct regmap_range axp288_volatile_ranges[] = { regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), };drivers/mfd/axp20x.c +2
-0+static const struct regmap_range axp803_volatile_ranges[] = { + regmap_reg_range(AXP20X_PWR_INPUT_STATUS,
AXP288_POWER_REASON),drivers/mfd/axp20x.c +2
-0+regmap_reg_range (AXP288_BC_GLOBAL ,AXP288_BC_GLOBAL ), + regmap_reg_range(AXP288_BC_DET_STAT,
AXP20X_VBUS_IPSOUT_MGMT),drivers/mfd/axp20x.c +1
-0+ regmap_reg_range(AXP20X_CHRG_BAK_CTRL,
AXP20X_CHRG_BAK_CTRL),drivers/mfd/axp20x.c +1
-0+ regmap_reg_range(AXP20X_IRQ1_EN,
AXP20X_IPSOUT_V_HIGH_L),drivers/mfd/axp20x.c +3
-0+regmap_reg_range (AXP20X_TIMER_CTRL ,AXP20X_TIMER_CTRL ), +regmap_reg_range (AXP20X_GPIO1_CTRL ,AXP22X_GPIO_STATE ), + regmap_reg_range(AXP288_RT_BATT_V_H,
AXP288_RT_BATT_V_L),drivers/mfd/axp20x.c +3
-0+ regmap_reg_range(AXP20X_FG_RES, AXP288_FG_CC_CAP_REG), +}; +static const struct
regmap_access_tableaxp288_writeable_table= {
.yes_ranges =axp288_writeable_ranges,
.n_yes_ranges =ARRAY_SIZE(axp288_writeable_ranges),drivers/mfd/axp20x.c +0
-0@@ -182,6 +194,11 @@ static const struct regmap_access_table axp288_volatile_table = { .n_yes_ranges = ARRAY_SIZE(axp288_volatile_ranges), };
+static const structregmap_access_tableaxp803_volatile_table= {drivers/mfd/axp20x.c +4
-0+ .yes_ranges = axp803_volatile_ranges, + .n_yes_ranges = ARRAY_SIZE(axp803_volatile_ranges), +}; +static const struct
regmap_rangeaxp806_writeable_ranges[] = {regmap_reg_range(AXP20X_DATACACHE(0), AXP20X_DATACACHE(3)),regmap_reg_range(AXP806_PWR_OUT_CTRL1, AXP806_CLDO3_V_CTRL),drivers/mfd/axp20x.c +0
-0@@ -456,6 +473,15 @@ static const struct regmap_config axp22x_regmap_config = { .cache_type = REGCACHE_MAPLE, };drivers/mfd/axp20x.c +9
-0+static const struct regmap_config axp803_regmap_config = { + .reg_bits =8 , + .val_bits =8 , + .wr_table = &axp288_writeable_table, + .volatile_table = &axp803_volatile_table, + .max_register =AXP288_FG_TUNE5 , + .cache_type =REGCACHE_MAPLE , +}; +static const struct
regmap_configaxp288_regmap_config= {
.reg_bits = 8,
.val_bits = 8,drivers/mfd/axp20x.c +0
-0@@ -1368,7 +1394,7 @@ int axp20x_match_device(struct axp20x_dev *axp20x)case
AXP803_ID:
axp20x->nr_cells=ARRAY_SIZE(axp803_cells);axp20x->cells=axp803_cells;drivers/mfd/axp20x.c +1
-1- axp20x->regmap_cfg = &axp288_regmap_config; + axp20x->regmap_cfg = &axp803_regmap_config;
axp20x->regmap_irq_chip=&axp803_regmap_irq_chip;
break;
caseAXP806_ID: