public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: "Jernej Škrabec" <jernej.skrabec@gmail.com>
Cc: Jagan Teki <jagan@amarulasolutions.com>,
	Jaehoon Chung <jh80.chung@samsung.com>,
	Samuel Holland <samuel@sholland.org>,
	SASANO Takayoshi <uaa@mx5.nisiq.net>,
	Mikhail Kalashnikov <iuncuim@gmail.com>,
	Piotr Oniszczuk <piotr.oniszczuk@gmail.com>,
	u-boot@lists.denx.de, linux-sunxi@lists.linux.dev
Subject: Re: [PATCH 3/3] power: regulator: add AXP313 support
Date: Sat, 21 Oct 2023 23:05:34 +0100	[thread overview]
Message-ID: <20231021230534.6ed056bc@slackpad.lan> (raw)
In-Reply-To: <2168063.Mh6RI2rZIc@archlinux>

On Sat, 21 Oct 2023 08:51:09 +0200
Jernej Škrabec <jernej.skrabec@gmail.com> wrote:

> On Wednesday, October 18, 2023 5:50:14 PM CEST Andre Przywara wrote:
> > The X-Powers AXP313a is a small PMIC with just three buck converters and
> > three LDOs, one of which is actually fixed (so not modelled here).
> > 
> > Add the compatible string and the respective regulator ranges to allow
> > drivers to adjust voltages.
> > 
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > ---
> >  drivers/power/pmic/axp.c                |  1 +
> >  drivers/power/regulator/axp_regulator.c | 17 +++++++++++++++++
> >  include/axp_pmic.h                      |  1 +
> >  3 files changed, 19 insertions(+)
> > 
> > diff --git a/drivers/power/pmic/axp.c b/drivers/power/pmic/axp.c
> > index 025dac24f28..0e1e45fba74 100644
> > --- a/drivers/power/pmic/axp.c
> > +++ b/drivers/power/pmic/axp.c
> > @@ -87,6 +87,7 @@ static const struct udevice_id axp_pmic_ids[] = {
> >  	{ .compatible = "x-powers,axp209", .data = AXP209_ID },
> >  	{ .compatible = "x-powers,axp221", .data = AXP221_ID },
> >  	{ .compatible = "x-powers,axp223", .data = AXP223_ID },
> > +	{ .compatible = "x-powers,axp313a", .data = AXP313_ID },
> >  	{ .compatible = "x-powers,axp803", .data = AXP803_ID },
> >  	{ .compatible = "x-powers,axp806", .data = AXP806_ID },
> >  	{ .compatible = "x-powers,axp809", .data = AXP809_ID },
> > diff --git a/drivers/power/regulator/axp_regulator.c
> > b/drivers/power/regulator/axp_regulator.c index 02f320eac1e..d27e09538e0
> > 100644
> > --- a/drivers/power/regulator/axp_regulator.c
> > +++ b/drivers/power/regulator/axp_regulator.c
> > @@ -173,6 +173,22 @@ static const struct axp_regulator_plat
> > axp22x_regulators[] = { { }
> >  };
> > 
> > +/*
> > + * The "dcdc1" regulator has another range, beyond 1.54V up to 3.4V, in
> > + * steps of 100mV. We cannot model this easily, but also don't need that,
> > + * since it's typically only used for ~1.1V anyway, so just ignore it.  
> 
> It can be modelled with look up table, as it's already done for some other 
> regulators?

Theoretically yes, but it would require about 105 entries, that's quite
a lot for something we don't need. As mentioned, it's
typically VDD_GPU/VDD_SYS, at 0.9V at reset, and no device used in
U-Boot directly references this regulator, so I think it wouldn't be
used anyways. I doubt that even with a user we ever would go beyond
1.54V. So for the sake of simplicity, I'd like to keep this cut to
those two ranges.

Thanks for having a look!

Cheers,
Andre

> 
> Best regards,
> Jernej
> 
> > + * Also the DCDC3 regulator is described wrongly in the (available) manual,
> > + * experiments show that the split point is at 1200mV, as for DCDC1/2. +
> > */
> > +static const struct axp_regulator_plat axp313_regulators[] = {
> > +	{ "dcdc1", 0x10, BIT(0), 0x13, 0x7f,  500, 1540,  10, 70 },
> > +	{ "dcdc2", 0x10, BIT(1), 0x14, 0x7f,  500, 1540,  10, 70 },
> > +	{ "dcdc3", 0x10, BIT(2), 0x15, 0x7f,  500, 1840,  10, 70 },
> > +	{ "aldo1", 0x10, BIT(3), 0x16, 0x1f,  500, 3500, 100, NA },
> > +	{ "dldo1", 0x10, BIT(4), 0x17, 0x1f,  500, 3500, 100, NA },
> > +	{ }
> > +};
> > +
> >  static const struct axp_regulator_plat axp803_regulators[] = {
> >  	{ "dcdc1", 0x10, BIT(0), 0x20, 0x1f, 1600, 3400, 100, NA },
> >  	{ "dcdc2", 0x10, BIT(1), 0x21, 0x7f,  500, 1300,  10, 70 },
> > @@ -274,6 +290,7 @@ static const struct axp_regulator_plat *const
> > axp_regulators[] = { [AXP209_ID]	= axp20x_regulators,
> >  	[AXP221_ID]	= axp22x_regulators,
> >  	[AXP223_ID]	= axp22x_regulators,
> > +	[AXP313_ID]	= axp313_regulators,
> >  	[AXP803_ID]	= axp803_regulators,
> >  	[AXP806_ID]	= axp806_regulators,
> >  	[AXP809_ID]	= axp809_regulators,
> > diff --git a/include/axp_pmic.h b/include/axp_pmic.h
> > index 4ac64865831..aabafc8501b 100644
> > --- a/include/axp_pmic.h
> > +++ b/include/axp_pmic.h
> > @@ -32,6 +32,7 @@ enum {
> >  	AXP209_ID,
> >  	AXP221_ID,
> >  	AXP223_ID,
> > +	AXP313_ID,
> >  	AXP803_ID,
> >  	AXP806_ID,
> >  	AXP809_ID,  
> 
> 
> 
> 
> 


  reply	other threads:[~2023-10-21 22:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-18 15:50 [PATCH 0/3] power: add AXP313 PMIC support Andre Przywara
2023-10-18 15:50 ` [PATCH 1/3] sunxi: board: simplify early PMIC setup conditions Andre Przywara
2023-10-21  6:34   ` Jernej Škrabec
2023-10-21 21:19     ` Andre Przywara
2023-10-31  6:42       ` Jaehoon Chung
2023-10-31 11:54         ` Andre Przywara
2023-10-18 15:50 ` [PATCH 2/3] power: pmic: sunxi: add AXP313 SPL driver Andre Przywara
2023-10-21  6:39   ` Jernej Škrabec
2023-10-18 15:50 ` [PATCH 3/3] power: regulator: add AXP313 support Andre Przywara
2023-10-21  6:51   ` Jernej Škrabec
2023-10-21 22:05     ` Andre Przywara [this message]
2023-10-31  6:09   ` Jaehoon Chung

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=20231021230534.6ed056bc@slackpad.lan \
    --to=andre.przywara@arm.com \
    --cc=iuncuim@gmail.com \
    --cc=jagan@amarulasolutions.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=jh80.chung@samsung.com \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=piotr.oniszczuk@gmail.com \
    --cc=samuel@sholland.org \
    --cc=u-boot@lists.denx.de \
    --cc=uaa@mx5.nisiq.net \
    /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