ARM Sunxi Platform Development
 help / color / mirror / Atom feed
From: Andre Przywara <andre.przywara@arm.com>
To: Chen-Yu Tsai <wens@csie.org>
Cc: Lee Jones <lee@kernel.org>, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>,
	devicetree@vger.kernel.org, linux-sunxi@lists.linux.dev,
	linux-kernel@vger.kernel.org,
	Martin Botka <martin.botka@somainline.org>,
	Chris Morgan <macromorgan@hotmail.com>
Subject: Re: [PATCH 4/5] mfd: axp20x: Add support for AXP323
Date: Fri, 4 Oct 2024 10:42:26 +0100	[thread overview]
Message-ID: <20241004104226.04534d8c@donnerap.manchester.arm.com> (raw)
In-Reply-To: <CAGb2v64jPk64Y-Aef1YPWkjCfp0eq6EasE2xszu8+WoX+Epv-A@mail.gmail.com>

On Thu, 3 Oct 2024 23:20:58 +0800
Chen-Yu Tsai <wens@csie.org> wrote:

> On Thu, Oct 3, 2024 at 7:15 PM Andre Przywara <andre.przywara@arm.com> wrote:
> >
> > The X-Powers AXP323 is a very close sibling of the AXP313A. The only
> > difference seems to be the ability to dual-phase the first two DC/DC
> > converter, which adds another register.
> >
> > Add the required boilerplate to introduce a new PMIC to the AXP MFD
> > driver. Where possible, this just maps into the existing structs defined
> > for the AXP313A, only deviating where needed.
> >
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > ---
> >  drivers/mfd/axp20x-i2c.c   |  1 +
> >  drivers/mfd/axp20x.c       | 26 ++++++++++++++++++++++++++
> >  include/linux/mfd/axp20x.h |  2 ++
> >  3 files changed, 29 insertions(+)
> >
> > diff --git a/drivers/mfd/axp20x-i2c.c b/drivers/mfd/axp20x-i2c.c
> > index 791a0b4cb64b..5c93136f977e 100644
> > --- a/drivers/mfd/axp20x-i2c.c
> > +++ b/drivers/mfd/axp20x-i2c.c
> > @@ -65,6 +65,7 @@ static const struct of_device_id axp20x_i2c_of_match[] = {
> >         { .compatible = "x-powers,axp221", .data = (void *)AXP221_ID },
> >         { .compatible = "x-powers,axp223", .data = (void *)AXP223_ID },
> >         { .compatible = "x-powers,axp313a", .data = (void *)AXP313A_ID },
> > +       { .compatible = "x-powers,axp323", .data = (void *)AXP323_ID },
> >         { .compatible = "x-powers,axp717", .data = (void *)AXP717_ID },
> >         { .compatible = "x-powers,axp803", .data = (void *)AXP803_ID },
> >         { .compatible = "x-powers,axp806", .data = (void *)AXP806_ID },
> > diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> > index bc08ae433260..8d90962b56d9 100644
> > --- a/drivers/mfd/axp20x.c
> > +++ b/drivers/mfd/axp20x.c
> > @@ -42,6 +42,7 @@ static const char * const axp20x_model_names[] = {
> >         [AXP223_ID] = "AXP223",
> >         [AXP288_ID] = "AXP288",
> >         [AXP313A_ID] = "AXP313a",
> > +       [AXP323_ID] = "AXP323",
> >         [AXP717_ID] = "AXP717",
> >         [AXP803_ID] = "AXP803",
> >         [AXP806_ID] = "AXP806",
> > @@ -193,6 +194,10 @@ static const struct regmap_range axp313a_writeable_ranges[] = {
> >         regmap_reg_range(AXP313A_ON_INDICATE, AXP313A_IRQ_STATE),
> >  };
> >
> > +static const struct regmap_range axp323_writeable_ranges[] = {
> > +       regmap_reg_range(AXP313A_ON_INDICATE, AXP323_DCDC_MODE_CTRL2),
> > +};
> > +
> >  static const struct regmap_range axp313a_volatile_ranges[] = {
> >         regmap_reg_range(AXP313A_SHUTDOWN_CTRL, AXP313A_SHUTDOWN_CTRL),
> >         regmap_reg_range(AXP313A_IRQ_STATE, AXP313A_IRQ_STATE),
> > @@ -203,6 +208,11 @@ static const struct regmap_access_table axp313a_writeable_table = {
> >         .n_yes_ranges = ARRAY_SIZE(axp313a_writeable_ranges),
> >  };
> >
> > +static const struct regmap_access_table axp323_writeable_table = {
> > +       .yes_ranges = axp323_writeable_ranges,
> > +       .n_yes_ranges = ARRAY_SIZE(axp323_writeable_ranges),
> > +};
> > +
> >  static const struct regmap_access_table axp313a_volatile_table = {
> >         .yes_ranges = axp313a_volatile_ranges,
> >         .n_yes_ranges = ARRAY_SIZE(axp313a_volatile_ranges),
> > @@ -433,6 +443,15 @@ static const struct regmap_config axp313a_regmap_config = {
> >         .cache_type = REGCACHE_MAPLE,
> >  };
> >
> > +static const struct regmap_config axp323_regmap_config = {
> > +       .reg_bits = 8,
> > +       .val_bits = 8,
> > +       .wr_table = &axp323_writeable_table,
> > +       .volatile_table = &axp313a_volatile_table,
> > +       .max_register = AXP323_DCDC_MODE_CTRL2,
> > +       .cache_type = REGCACHE_RBTREE,  
> 
> Maple tree instead?

Ah yes, you are right, this was lost over a rebase. Will fix in v2.

> The rest looks fine, so once fixed,
> 
> Reviewed-by: Chen-Yu Tsai <wens@csie.org>

Thanks!
Andre

> 
> > +};
> > +
> >  static const struct regmap_config axp717_regmap_config = {
> >         .reg_bits = 8,
> >         .val_bits = 8,
> > @@ -1221,6 +1240,7 @@ static int axp20x_power_off(struct sys_off_data *data)
> >         unsigned int shutdown_reg;
> >
> >         switch (axp20x->variant) {
> > +       case AXP323_ID:
> >         case AXP313A_ID:
> >                 shutdown_reg = AXP313A_SHUTDOWN_CTRL;
> >                 break;
> > @@ -1289,6 +1309,12 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
> >                 axp20x->regmap_cfg = &axp313a_regmap_config;
> >                 axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
> >                 break;
> > +       case AXP323_ID:
> > +               axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
> > +               axp20x->cells = axp313a_cells;
> > +               axp20x->regmap_cfg = &axp323_regmap_config;
> > +               axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
> > +               break;
> >         case AXP717_ID:
> >                 axp20x->nr_cells = ARRAY_SIZE(axp717_cells);
> >                 axp20x->cells = axp717_cells;
> > diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
> > index 79ecaaaa2070..c3df0e615fbf 100644
> > --- a/include/linux/mfd/axp20x.h
> > +++ b/include/linux/mfd/axp20x.h
> > @@ -19,6 +19,7 @@ enum axp20x_variants {
> >         AXP223_ID,
> >         AXP288_ID,
> >         AXP313A_ID,
> > +       AXP323_ID,
> >         AXP717_ID,
> >         AXP803_ID,
> >         AXP806_ID,
> > @@ -113,6 +114,7 @@ enum axp20x_variants {
> >  #define AXP313A_SHUTDOWN_CTRL          0x1a
> >  #define AXP313A_IRQ_EN                 0x20
> >  #define AXP313A_IRQ_STATE              0x21
> > +#define AXP323_DCDC_MODE_CTRL2         0x22
> >
> >  #define AXP717_ON_INDICATE             0x00
> >  #define AXP717_PMU_STATUS_2            0x01
> > --
> > 2.25.1
> >  


  reply	other threads:[~2024-10-04  9:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 11:14 [PATCH 0/5] regulator: add X-Powers AXP323 support Andre Przywara
2024-10-03 11:14 ` [PATCH 1/5] dt-bindings: mfd: x-powers,axp152: Document AXP323 Andre Przywara
2024-10-03 15:12   ` Chen-Yu Tsai
2024-10-03 15:49   ` Rob Herring (Arm)
2024-10-03 11:14 ` [PATCH 2/5] mfd: axp20x: ensure relationship between IDs and model names Andre Przywara
2024-10-03 15:12   ` Chen-Yu Tsai
2024-10-03 11:14 ` [PATCH 3/5] mfd: axp20x: Allow multiple regulators Andre Przywara
2024-10-03 15:19   ` Chen-Yu Tsai
2024-10-04  9:41     ` Andre Przywara
2024-10-06 22:48     ` Andre Przywara
2024-10-03 11:14 ` [PATCH 4/5] mfd: axp20x: Add support for AXP323 Andre Przywara
2024-10-03 15:20   ` Chen-Yu Tsai
2024-10-04  9:42     ` Andre Przywara [this message]
2024-10-03 11:14 ` [PATCH 5/5] regulator: axp20x: add support for the AXP323 Andre Przywara
2024-10-03 14:52   ` Mark Brown
2024-10-03 15:21   ` Chen-Yu Tsai

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=20241004104226.04534d8c@donnerap.manchester.arm.com \
    --to=andre.przywara@arm.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=macromorgan@hotmail.com \
    --cc=martin.botka@somainline.org \
    --cc=robh@kernel.org \
    --cc=wens@csie.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