devicetree.vger.kernel.org archive mirror
 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 3/5] mfd: axp20x: Allow multiple regulators
Date: Fri, 4 Oct 2024 10:41:24 +0100	[thread overview]
Message-ID: <20241004104124.7280c81a@donnerap.manchester.arm.com> (raw)
In-Reply-To: <CAGb2v64c-KoCwzfXpPbyLtxgZbwoQ+e4uYAk7pcHCkrTRbfr3A@mail.gmail.com>

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

Hi Chen-Yu,

thanks for having a look!

> On Thu, Oct 3, 2024 at 7:15 PM Andre Przywara <andre.przywara@arm.com> wrote:
> >
> > At the moment trying to register a second AXP chip makes the probe fail,
> > as some sysfs registration fails due to a duplicate name:
> >
> > ...
> > [    3.688215] axp20x-i2c 0-0035: AXP20X driver loaded
> > [    3.695610] axp20x-i2c 0-0036: AXP20x variant AXP323 found
> > [    3.706151] sysfs: cannot create duplicate filename '/bus/platform/devices/axp20x-regulator'
> > [    3.714718] CPU: 0 UID: 0 PID: 1 Comm: swapper/0 Not tainted 6.12.0-rc1-00026-g50bf2e2c079d-dirty #192
> > [    3.724020] Hardware name: Avaota A1 (DT)
> > [    3.728029] Call trace:
> > [    3.730477]  dump_backtrace+0x94/0xec
> > [    3.734146]  show_stack+0x18/0x24
> > [    3.737462]  dump_stack_lvl+0x80/0xf4
> > [    3.741128]  dump_stack+0x18/0x24
> > [    3.744444]  sysfs_warn_dup+0x64/0x80
> > [    3.748109]  sysfs_do_create_link_sd+0xf0/0xf8
> > [    3.752553]  sysfs_create_link+0x20/0x40
> > [    3.756476]  bus_add_device+0x64/0x104
> > [    3.760229]  device_add+0x310/0x760
> > [    3.763717]  platform_device_add+0x10c/0x238
> > [    3.767990]  mfd_add_device+0x4ec/0x5c8
> > [    3.771829]  mfd_add_devices+0x88/0x11c
> > [    3.775666]  axp20x_device_probe+0x70/0x184
> > [    3.779851]  axp20x_i2c_probe+0x9c/0xd8
> > ...
> >
> > This is because we use PLATFORM_DEVID_NONE for the mfd_add_devices()
> > call, which would number the child devices in the same 0-based way, even
> > for the second (or any other) instance.
> >
> > Use PLATFORM_DEVID_AUTO instead, which automatically assigns
> > non-conflicting device numbers.  
> 
> That's weird... I don't remember running into this when working on the A80,
> which had two albeit different AXP chips. That was a long time ago though.

Yeah, I was wondering about this as well. And it's two different PMICs here
as well: most A523/T527 system seem to come with an AXP717/AXP323 combo.
Though there are not linked together in any way, like in this master/slave
mode of the AXP806.
I will test on (your old) A80 board, and will add a Fixes: tag in v2,
should it also fail there.

> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>  
> 
> Reviewed-by: Chen-Yu Tsai <wens@csie.org>

Thanks,
Andre

> 
> > ---
> >  drivers/mfd/axp20x.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> > index 5ceea359289f..bc08ae433260 100644
> > --- a/drivers/mfd/axp20x.c
> > +++ b/drivers/mfd/axp20x.c
> > @@ -1419,7 +1419,7 @@ int axp20x_device_probe(struct axp20x_dev *axp20x)
> >                 }
> >         }
> >
> > -       ret = mfd_add_devices(axp20x->dev, -1, axp20x->cells,
> > +       ret = mfd_add_devices(axp20x->dev, PLATFORM_DEVID_AUTO, axp20x->cells,
> >                               axp20x->nr_cells, NULL, 0, NULL);
> >
> >         if (ret) {
> > --
> > 2.25.1
> >  


  reply	other threads:[~2024-10-04  9:41 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 [this message]
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
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=20241004104124.7280c81a@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;
as well as URLs for NNTP newsgroup(s).