From: Lee Jones <lee@kernel.org>
To: Chen-Yu Tsai <wens@kernel.org>
Cc: Chen-Yu Tsai <wens@csie.org>,
linux-sunxi@lists.linux.dev,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
Andre Przywara <andre.przywara@arm.com>,
Chris Morgan <macroalpha82@gmail.com>,
Vasily Khoruzhick <anarsoul@gmail.com>
Subject: Re: [PATCH] mfd: axp20x: Skip PEK on AXP313A/AXP323 if no interrupt line is available
Date: Tue, 1 Jul 2025 12:01:50 +0100 [thread overview]
Message-ID: <20250701110150.GJ10134@google.com> (raw)
In-Reply-To: <20250630135249.3961621-1-wens@kernel.org>
On Mon, 30 Jun 2025, Chen-Yu Tsai wrote:
> From: Chen-Yu Tsai <wens@csie.org>
>
> Originally an explicit ID for the AXP313/AXP323 regulator was set to
> avoid a conflict with the primary AXP717 PMIC on Allwinner A523 family
> boards.
>
> This didn't entirely work since on some or all of these boards, the
> interrupt line on this secondary PMIC was left unconnected, and thus
> the driver would fall back to the generic "no interrupt; only regulators"
> case, which didn't have the explicit ID set, thus undoing the intended
> fix.
>
> Explicitly exclude the PEK cell in the no IRQ case for the
> AXP313/AXP323, instead of using the generic fallback.
>
> Fixes: 249abf9b1e25 ("mfd: axp20x: Set explicit ID for AXP313 regulator")
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
> The other option would be to move the explicit ID to the generic
> fallback case instead. This is really only visible in sysfs and the
> kernel logs, so probably not that important.
> ---
> drivers/mfd/axp20x.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
> index 25c639b348cd..8877482a95a1 100644
> --- a/drivers/mfd/axp20x.c
> +++ b/drivers/mfd/axp20x.c
> @@ -1055,6 +1055,7 @@ static const struct mfd_cell axp152_cells[] = {
> static struct mfd_cell axp313a_cells[] = {
> /* AXP323 is sometimes paired with AXP717 as sub-PMIC */
> MFD_CELL_BASIC("axp20x-regulator", NULL, NULL, 0, 1),
> + /* Keep PEK as last entry for exclusion in no-irq cases */
> MFD_CELL_RES("axp313a-pek", axp313a_pek_resources),
> };
>
> @@ -1306,12 +1307,18 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
> axp20x->irq_flags = IRQF_TRIGGER_LOW;
> break;
> case AXP313A_ID:
> + /* Exclude PEK if no IRQ is available */
> + nr_cells_no_irq = ARRAY_SIZE(axp313a_cells) - 1;
This is too fragile. Please fine another way to achieve your goal.
> + cells_no_irq = axp313a_cells;
> axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
> axp20x->cells = axp313a_cells;
> axp20x->regmap_cfg = &axp313a_regmap_config;
> axp20x->regmap_irq_chip = &axp313a_regmap_irq_chip;
> break;
> case AXP323_ID:
> + /* Exclude PEK if no IRQ is available */
> + nr_cells_no_irq = ARRAY_SIZE(axp313a_cells) - 1;
> + cells_no_irq = axp313a_cells;
> axp20x->nr_cells = ARRAY_SIZE(axp313a_cells);
> axp20x->cells = axp313a_cells;
> axp20x->regmap_cfg = &axp323_regmap_config;
> --
> 2.39.5
>
--
Lee Jones [李琼斯]
prev parent reply other threads:[~2025-07-01 11:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-30 13:52 Chen-Yu Tsai
2025-07-01 11:01 ` Lee Jones [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=20250701110150.GJ10134@google.com \
--to=lee@kernel.org \
--cc=anarsoul@gmail.com \
--cc=andre.przywara@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=macroalpha82@gmail.com \
--cc=wens@csie.org \
--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®