mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Icenowy Zheng <uwu@icenowy.me>
To: "Jernej �0�7krabec" <jernej.skrabec@gmail.com>,
	linux-sunxi@lists.linux.dev, "Ond�0�0ej Jirman" <megi@xff.cz>
Cc: linux-kernel@vger.kernel.org, Lee Jones <lee@kernel.org>,
	Chen-Yu Tsai <wens@kernel.org>
Subject: Re: [PATCH] mfd: axp20x: Change volatile ranges on axp803
Date: Tue, 21 Apr 2026 13:19:50 +0800	[thread overview]
Message-ID: <4cd64f5eba093d2dc122628a94cd0aba1071e626.camel@icenowy.me> (raw)
In-Reply-To: <b2d1246045ac27562865c8b399f21a839b14b19e.camel@icenowy.me>

在 2026-04-21二的 13:06 +0800,Icenowy Zheng写道:
> 在 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):
> > > 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.
> > 
> > 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.)

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

> 
> Thanks,
> Icenowy
> 
> > 
> > Best regards,
> > Jernej
> > 
> > > 
> > > 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:
> > > 
> > 
> > 
> > 
> > 

      parent reply	other threads:[~2026-04-21  5:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-15 12:49 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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4cd64f5eba093d2dc122628a94cd0aba1071e626.camel@icenowy.me \
    --to=uwu@icenowy.me \
    --cc=jernej.skrabec@gmail.com \
    --cc=lee@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=megi@xff.cz \
    --cc=wens@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®