* [PATCH v3 0/2] mfd: axp20x: improve support without interrupts
@ 2023-09-19 10:39 Andre Przywara
2023-09-19 10:39 ` [PATCH v3 1/2] dt-bindings: mfd: x-powers,axp152: make interrupt optional for more chips Andre Przywara
2023-09-19 10:39 ` [PATCH v3 2/2] mfd: axp20x: Generalise handling without interrupt Andre Przywara
0 siblings, 2 replies; 6+ messages in thread
From: Andre Przywara @ 2023-09-19 10:39 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Icenowy Zheng, Mark Brown, Jernej Skrabec, Samuel Holland,
Shengyu Qu, Martin Botka, Matthew Croughan, linux-sunxi,
devicetree, linux-kernel
This is a more of a re-send, rebased on top of v6.6-rc2, with the tags
added, and adding back the binding patch, since this seems to have fallen
through the cracks somehow.
Changelog below.
------------------------------
Every AXP PMIC we support sports an IRQ pin, that signals certain events
to the SoC. For some of the chip's functionality an interrupt is crucial
for operation (for instance a power key event), but for the basic
regulator features for instance the interrupt does not add much.
Recently we started seeing boards with smaller PMICs, that don't bother
to connect the IRQ line to anything. So far we handled this as a special
case for the AXP305, but there are more examples now that justify a more
general solution.
Patch 1/2 adds more PMICs to the list of chips for which the interrupts
DT property is optional: this is needed to correctly describe some newer
boards without the IRQ pin connected.
Ideally we would make this optional for every PMIC, but it is unclear
whether this is a good idea: many older the "bigger" PMICs have multiple
MFD devices that require an interrupt, so not having interrupt
functionality might not be feasible for their operation. Also so far all
boards with those PMICs connect the IRQ pin, so there is no immediate
need for such a relaxation.
Patch 2/2 then generalises the "no interrupt specified" case in the MFD
driver, as this was special cased for two PMIC models so far. This
allows boards with an AXP313a to not specify an IRQ line: there are
actually multiple boards relying on this out there.
Cheers,
Andre
Changelog v3 ... v2:
- rebased on top of v6.6-rc2
- add back binding patch
- tags added
Changelog v2 ... v1:
- drop reordering approach, use separate cell lists instead
Andre Przywara (2):
dt-bindings: mfd: x-powers,axp152: make interrupt optional for more
chips
mfd: axp20x: Generalise handling without interrupt
.../bindings/mfd/x-powers,axp152.yaml | 5 ++-
drivers/mfd/axp20x.c | 44 ++++++++++---------
2 files changed, 28 insertions(+), 21 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v3 1/2] dt-bindings: mfd: x-powers,axp152: make interrupt optional for more chips
2023-09-19 10:39 [PATCH v3 0/2] mfd: axp20x: improve support without interrupts Andre Przywara
@ 2023-09-19 10:39 ` Andre Przywara
2023-09-24 19:50 ` Jernej Škrabec
2023-09-28 13:46 ` (subset) " Lee Jones
2023-09-19 10:39 ` [PATCH v3 2/2] mfd: axp20x: Generalise handling without interrupt Andre Przywara
1 sibling, 2 replies; 6+ messages in thread
From: Andre Przywara @ 2023-09-19 10:39 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Icenowy Zheng, Mark Brown, Jernej Skrabec, Samuel Holland,
Shengyu Qu, Martin Botka, Matthew Croughan, linux-sunxi,
devicetree, linux-kernel
All X-Powers PMICs described by this binding have an IRQ pin, and so
far (almost) all boards connected this to some NMI pin or GPIO on the SoC
they are connected to.
However we start to see boards that omit this connection, and technically
the IRQ pin is not essential to the basic PMIC operation.
The existing Linux driver allows skipping the IRQ pin setup for two chips
already, so update the binding to also make the DT property optional for
the missing chip. And while we are at it, add the AXP313a to that list,
as they are actually boards out there not connecting the IRQ pin.
This allows to have DTs correctly describing those boards not wiring up
the interrupt.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
---
Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
index 9ad55746133b5..06f1779835a1e 100644
--- a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
+++ b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
@@ -67,7 +67,10 @@ allOf:
properties:
compatible:
contains:
- const: x-powers,axp305
+ enum:
+ - x-powers,axp15060
+ - x-powers,axp305
+ - x-powers,axp313a
then:
required:
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v3 2/2] mfd: axp20x: Generalise handling without interrupt
2023-09-19 10:39 [PATCH v3 0/2] mfd: axp20x: improve support without interrupts Andre Przywara
2023-09-19 10:39 ` [PATCH v3 1/2] dt-bindings: mfd: x-powers,axp152: make interrupt optional for more chips Andre Przywara
@ 2023-09-19 10:39 ` Andre Przywara
1 sibling, 0 replies; 6+ messages in thread
From: Andre Przywara @ 2023-09-19 10:39 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai, Rob Herring, Krzysztof Kozlowski,
Conor Dooley
Cc: Icenowy Zheng, Mark Brown, Jernej Skrabec, Samuel Holland,
Shengyu Qu, Martin Botka, Matthew Croughan, linux-sunxi,
devicetree, linux-kernel
At the moment we allow the AXP15060 and the AXP806 PMICs to omit the
interrupt line to the SoC, and we skip registering the PEK (power key)
driver in this case, since that crashes when no IRQ is described in the
DT node.
The IRQ pin potentially not being connected to anything does affect more
PMICs, though, and the PEK driver is not the only one requiring an
interrupt: at least the AC power supply driver crashes in a similar
fashion.
Generalise the handling of AXP MFD devices when the platform tables
describe no interrupt, by allowing each device to specify an alternative
MFD list for this case. If no specific alternative is specified, we go
with the safe default of "just the regulators", which matches the current
situation.
This enables new devices using the AXP313a PMIC, but not connecting the
IRQ pin.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
---
drivers/mfd/axp20x.c | 44 ++++++++++++++++++++++++--------------------
1 file changed, 24 insertions(+), 20 deletions(-)
diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index 87603eeaa2770..d93189b0230de 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -1133,6 +1133,8 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
struct device *dev = axp20x->dev;
const struct acpi_device_id *acpi_id;
const struct of_device_id *of_id;
+ const struct mfd_cell *cells_no_irq = NULL;
+ int nr_cells_no_irq = 0;
if (dev->of_node) {
of_id = of_match_device(dev->driver->of_match_table, dev);
@@ -1207,14 +1209,15 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
* if there is no interrupt line.
*/
if (of_property_read_bool(axp20x->dev->of_node,
- "x-powers,self-working-mode") &&
- axp20x->irq > 0) {
+ "x-powers,self-working-mode")) {
axp20x->nr_cells = ARRAY_SIZE(axp806_self_working_cells);
axp20x->cells = axp806_self_working_cells;
} else {
axp20x->nr_cells = ARRAY_SIZE(axp806_cells);
axp20x->cells = axp806_cells;
}
+ nr_cells_no_irq = ARRAY_SIZE(axp806_cells);
+ cells_no_irq = axp806_cells;
axp20x->regmap_cfg = &axp806_regmap_config;
axp20x->regmap_irq_chip = &axp806_regmap_irq_chip;
break;
@@ -1238,24 +1241,8 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
axp20x->regmap_irq_chip = &axp803_regmap_irq_chip;
break;
case AXP15060_ID:
- /*
- * Don't register the power key part if there is no interrupt
- * line.
- *
- * Since most use cases of AXP PMICs are Allwinner SOCs, board
- * designers follow Allwinner's reference design and connects
- * IRQ line to SOC, there's no need for those variants to deal
- * with cases that IRQ isn't connected. However, AXP15660 is
- * used by some other vendors' SOCs that didn't connect IRQ
- * line, we need to deal with this case.
- */
- if (axp20x->irq > 0) {
- axp20x->nr_cells = ARRAY_SIZE(axp15060_cells);
- axp20x->cells = axp15060_cells;
- } else {
- axp20x->nr_cells = ARRAY_SIZE(axp_regulator_only_cells);
- axp20x->cells = axp_regulator_only_cells;
- }
+ axp20x->nr_cells = ARRAY_SIZE(axp15060_cells);
+ axp20x->cells = axp15060_cells;
axp20x->regmap_cfg = &axp15060_regmap_config;
axp20x->regmap_irq_chip = &axp15060_regmap_irq_chip;
break;
@@ -1263,6 +1250,23 @@ int axp20x_match_device(struct axp20x_dev *axp20x)
dev_err(dev, "unsupported AXP20X ID %lu\n", axp20x->variant);
return -EINVAL;
}
+
+ /*
+ * Use an alternative cell array when no interrupt line is connected,
+ * since IRQs are required by some drivers.
+ * The default is the safe "regulator-only", as this works fine without
+ * an interrupt specified.
+ */
+ if (axp20x->irq <= 0) {
+ if (cells_no_irq) {
+ axp20x->nr_cells = nr_cells_no_irq;
+ axp20x->cells = cells_no_irq;
+ } else {
+ axp20x->nr_cells = ARRAY_SIZE(axp_regulator_only_cells);
+ axp20x->cells = axp_regulator_only_cells;
+ }
+ }
+
dev_info(dev, "AXP20x variant %s found\n",
axp20x_model_names[axp20x->variant]);
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: mfd: x-powers,axp152: make interrupt optional for more chips
2023-09-19 10:39 ` [PATCH v3 1/2] dt-bindings: mfd: x-powers,axp152: make interrupt optional for more chips Andre Przywara
@ 2023-09-24 19:50 ` Jernej Škrabec
2023-09-25 7:46 ` Lee Jones
2023-09-28 13:46 ` (subset) " Lee Jones
1 sibling, 1 reply; 6+ messages in thread
From: Jernej Škrabec @ 2023-09-24 19:50 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Andre Przywara
Cc: Icenowy Zheng, Mark Brown, Samuel Holland, Shengyu Qu,
Martin Botka, Matthew Croughan, linux-sunxi, devicetree,
linux-kernel
Dne torek, 19. september 2023 ob 12:39:12 CEST je Andre Przywara napisal(a):
> All X-Powers PMICs described by this binding have an IRQ pin, and so
> far (almost) all boards connected this to some NMI pin or GPIO on the SoC
> they are connected to.
> However we start to see boards that omit this connection, and technically
> the IRQ pin is not essential to the basic PMIC operation.
>
> The existing Linux driver allows skipping the IRQ pin setup for two chips
> already, so update the binding to also make the DT property optional for
> the missing chip. And while we are at it, add the AXP313a to that list,
> as they are actually boards out there not connecting the IRQ pin.
>
> This allows to have DTs correctly describing those boards not wiring up
> the interrupt.
>
> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
Should I pick this patch through sunxi tree?
Best regards,
Jernej
> ---
> Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
> index 9ad55746133b5..06f1779835a1e 100644
> --- a/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
> +++ b/Documentation/devicetree/bindings/mfd/x-powers,axp152.yaml
> @@ -67,7 +67,10 @@ allOf:
> properties:
> compatible:
> contains:
> - const: x-powers,axp305
> + enum:
> + - x-powers,axp15060
> + - x-powers,axp305
> + - x-powers,axp313a
>
> then:
> required:
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v3 1/2] dt-bindings: mfd: x-powers,axp152: make interrupt optional for more chips
2023-09-24 19:50 ` Jernej Škrabec
@ 2023-09-25 7:46 ` Lee Jones
0 siblings, 0 replies; 6+ messages in thread
From: Lee Jones @ 2023-09-25 7:46 UTC (permalink / raw)
To: Jernej Škrabec
Cc: Chen-Yu Tsai, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Andre Przywara, Icenowy Zheng, Mark Brown, Samuel Holland,
Shengyu Qu, Martin Botka, Matthew Croughan, linux-sunxi,
devicetree, linux-kernel
On Sun, 24 Sep 2023, Jernej Škrabec wrote:
> Dne torek, 19. september 2023 ob 12:39:12 CEST je Andre Przywara napisal(a):
> > All X-Powers PMICs described by this binding have an IRQ pin, and so
> > far (almost) all boards connected this to some NMI pin or GPIO on the SoC
> > they are connected to.
> > However we start to see boards that omit this connection, and technically
> > the IRQ pin is not essential to the basic PMIC operation.
> >
> > The existing Linux driver allows skipping the IRQ pin setup for two chips
> > already, so update the binding to also make the DT property optional for
> > the missing chip. And while we are at it, add the AXP313a to that list,
> > as they are actually boards out there not connecting the IRQ pin.
> >
> > This allows to have DTs correctly describing those boards not wiring up
> > the interrupt.
> >
> > Signed-off-by: Andre Przywara <andre.przywara@arm.com>
> > Acked-by: Conor Dooley <conor.dooley@microchip.com>
>
> Should I pick this patch through sunxi tree?
No thank you.
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: (subset) [PATCH v3 1/2] dt-bindings: mfd: x-powers,axp152: make interrupt optional for more chips
2023-09-19 10:39 ` [PATCH v3 1/2] dt-bindings: mfd: x-powers,axp152: make interrupt optional for more chips Andre Przywara
2023-09-24 19:50 ` Jernej Škrabec
@ 2023-09-28 13:46 ` Lee Jones
1 sibling, 0 replies; 6+ messages in thread
From: Lee Jones @ 2023-09-28 13:46 UTC (permalink / raw)
To: Lee Jones, Chen-Yu Tsai, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Andre Przywara
Cc: Icenowy Zheng, Mark Brown, Jernej Skrabec, Samuel Holland,
Shengyu Qu, Martin Botka, Matthew Croughan, linux-sunxi,
devicetree, linux-kernel
On Tue, 19 Sep 2023 11:39:12 +0100, Andre Przywara wrote:
> All X-Powers PMICs described by this binding have an IRQ pin, and so
> far (almost) all boards connected this to some NMI pin or GPIO on the SoC
> they are connected to.
> However we start to see boards that omit this connection, and technically
> the IRQ pin is not essential to the basic PMIC operation.
>
> The existing Linux driver allows skipping the IRQ pin setup for two chips
> already, so update the binding to also make the DT property optional for
> the missing chip. And while we are at it, add the AXP313a to that list,
> as they are actually boards out there not connecting the IRQ pin.
>
> [...]
Applied, thanks!
[1/2] dt-bindings: mfd: x-powers,axp152: make interrupt optional for more chips
commit: cf71329eb3a37f90c8ddec0651dc7b3fa76036c1
--
Lee Jones [李琼斯]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-09-28 13:46 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-19 10:39 [PATCH v3 0/2] mfd: axp20x: improve support without interrupts Andre Przywara
2023-09-19 10:39 ` [PATCH v3 1/2] dt-bindings: mfd: x-powers,axp152: make interrupt optional for more chips Andre Przywara
2023-09-24 19:50 ` Jernej Škrabec
2023-09-25 7:46 ` Lee Jones
2023-09-28 13:46 ` (subset) " Lee Jones
2023-09-19 10:39 ` [PATCH v3 2/2] mfd: axp20x: Generalise handling without interrupt Andre Przywara
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).