ARM Sunxi Platform Development
 help / color / mirror / Atom feed
* [PATCH] mfd: axp20x: Change volatile ranges on axp803
@ 2026-03-15 12:49 Ondřej Jirman
  2026-03-21  6:25 ` Jernej Škrabec
  0 siblings, 1 reply; 7+ messages in thread
From: Ondřej Jirman @ 2026-03-15 12:49 UTC (permalink / raw)
  To: linux-sunxi; +Cc: linux-kernel, Ondrej Jirman, Lee Jones, Chen-Yu Tsai

From: Ondrej Jirman <megi@xff.cz>

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

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 drivers/mfd/axp20x.c | 28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 0d0d40972eb8..2ea409029d2f 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -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:
-- 
2.53.0


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

end of thread, other threads:[~2026-05-09 13:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-15 12:49 [PATCH] mfd: axp20x: Change volatile ranges on axp803 Ondřej Jirman
2026-03-21  6:25 ` Jernej Škrabec
2026-03-21 18:26   ` Ondřej Jirman
2026-05-09 13:00     ` Jernej Škrabec
2026-04-21  5:06   ` Icenowy Zheng
2026-04-21  5:10     ` Icenowy Zheng
2026-04-21  5:19     ` Icenowy Zheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox