* [PATCH v9 1/4] dt-bindings: mfd: x-powers: Add AC200
2026-09-03 20:09 [PATCH v9 0/4] mfd: add X-Powers AC200 support James Hilliard
@ 2026-09-03 20:09 ` James Hilliard
2026-09-03 20:17 ` sashiko-bot
2026-09-03 20:09 ` [PATCH v9 2/4] mfd: ac200: Add X-Powers AC200 support James Hilliard
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: James Hilliard @ 2026-09-03 20:09 UTC (permalink / raw)
To: Lee Jones, Arnd Bergmann, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, James Hilliard
Cc: Andrew Lunn, Jagielski, Jedrzej, Andre Przywara, Chen-Yu Tsai,
Jernej Skrabec, linux-sunxi, mfd, devicetree, linux-kernel,
Krzysztof Kozlowski
The AC200 is an I2C-controlled mixed-signal companion IC containing
audio, video, RTC and Fast Ethernet PHY functions.
Describe the parent device and its shared input clock. The Ethernet PHY
is represented by a PHY package on its MDIO bus, with a phandle back to
this device for access to the package control registers, so it does not
require an MFD child node. Function-specific supplies belong to their
consumer bindings rather than the shared parent.
The input clock must run at 24 or 27 MHz when the Ethernet PHY is used,
matching the rates encoded by its documented clock selector.
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
.../devicetree/bindings/mfd/x-powers,ac200.yaml | 50 ++++++++++++++++++++++
MAINTAINERS | 7 +++
2 files changed, 57 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
new file mode 100644
index 000000000000..ca7a910b2c73
--- /dev/null
+++ b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
@@ -0,0 +1,50 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/mfd/x-powers,ac200.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: X-Powers AC200 mixed-signal IC
+
+maintainers:
+ - James Hilliard <james.hilliard1@gmail.com>
+ - Jernej Skrabec <jernej.skrabec@gmail.com>
+
+description:
+ The AC200 is a mixed-signal companion IC containing audio, video, RTC and
+ Fast Ethernet PHY functions. Its control registers are accessed over I2C.
+
+properties:
+ compatible:
+ const: x-powers,ac200
+
+ reg:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+ description:
+ AC200 input clock. When using the Ethernet PHY, its configured rate must
+ be 24 or 27 MHz, matching the rates encoded by the documented EPHY clock
+ selector.
+
+required:
+ - compatible
+ - reg
+ - clocks
+
+additionalProperties: false
+
+examples:
+ - |
+ i2c {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ mixed-signal@10 {
+ compatible = "x-powers,ac200";
+ reg = <0x10>;
+ clocks = <&pwm 5>;
+ };
+ };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 3a19da74d00c..419340093c9b 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -29504,6 +29504,13 @@ F: drivers/net/wwan/
F: include/linux/wwan.h
F: include/uapi/linux/wwan.h
+X-POWERS AC200 DRIVERS
+M: Jernej Skrabec <jernej.skrabec@gmail.com>
+M: James Hilliard <james.hilliard1@gmail.com>
+L: linux-sunxi@lists.linux.dev
+S: Maintained
+F: Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
+
X-POWERS AXP288 PMIC DRIVERS
M: Hans de Goede <hansg@kernel.org>
S: Maintained
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v9 1/4] dt-bindings: mfd: x-powers: Add AC200
2026-09-03 20:09 ` [PATCH v9 1/4] dt-bindings: mfd: x-powers: Add AC200 James Hilliard
@ 2026-09-03 20:17 ` sashiko-bot
0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-09-03 20:17 UTC (permalink / raw)
To: James Hilliard; +Cc: linux-sunxi, conor+dt, devicetree, lee, robh, mfd
> The AC200 is an I2C-controlled mixed-signal companion IC containing
> audio, video, RTC and Fast Ethernet PHY functions.
>
> Describe the parent device and its shared input clock. The Ethernet PHY
> is represented by a PHY package on its MDIO bus, with a phandle back to
> this device for access to the package control registers, so it does not
> require an MFD child node. Function-specific supplies belong to their
> consumer bindings rather than the shared parent.
>
> The input clock must run at 24 or 27 MHz when the Ethernet PHY is used,
> matching the rates encoded by its documented clock selector.
>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-submit-ac200-mfd-v9-0-6b7ed278989c@gmail.com?part=1
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v9 2/4] mfd: ac200: Add X-Powers AC200 support
2026-09-03 20:09 [PATCH v9 0/4] mfd: add X-Powers AC200 support James Hilliard
2026-09-03 20:09 ` [PATCH v9 1/4] dt-bindings: mfd: x-powers: Add AC200 James Hilliard
@ 2026-09-03 20:09 ` James Hilliard
2026-09-03 20:21 ` sashiko-bot
2026-09-03 20:09 ` [PATCH v9 3/4] dt-bindings: mfd: x-powers: Describe AC200 functions James Hilliard
2026-09-03 20:09 ` [PATCH v9 4/4] mfd: ac200: Add codec and TV encoder cells James Hilliard
3 siblings, 1 reply; 11+ messages in thread
From: James Hilliard @ 2026-09-03 20:09 UTC (permalink / raw)
To: Lee Jones, Arnd Bergmann, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, James Hilliard
Cc: Andrew Lunn, Jagielski, Jedrzej, Andre Przywara, Chen-Yu Tsai,
Jernej Skrabec, linux-sunxi, mfd, devicetree, linux-kernel
The X-Powers AC200 is a mixed-signal companion IC with a paged register
map accessed over I2C.
Enable and rate-lock the shared input clock, wait 40 ms before the first
register access, initialize the paged regmap and deassert the common
reset. Set only the deassert bit instead of forcing a reset cycle, so
state established by firmware or independently powered functions remains
intact. Leave the common reset deasserted during driver removal and system
shutdown; function drivers own their block resets.
The Ethernet PHY is enumerated on its MDIO bus rather than as an MFD
child. It follows the x-powers,ac200 phandle and uses this regmap for
ancillary package-control access. The audio codec and TV encoder are
added as MFD children by subsequent patches.
Cache only the common page selector. Individual functions can reset
independently and invalidate their other registers, so leave all
functional registers volatile.
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
MAINTAINERS | 1 +
drivers/mfd/Kconfig | 12 ++++++
drivers/mfd/Makefile | 1 +
drivers/mfd/ac200.c | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 127 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 419340093c9b..1d03b0060bda 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -29510,6 +29510,7 @@ M: James Hilliard <james.hilliard1@gmail.com>
L: linux-sunxi@lists.linux.dev
S: Maintained
F: Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
+F: drivers/mfd/ac200.c
X-POWERS AXP288 PMIC DRIVERS
M: Hans de Goede <hansg@kernel.org>
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 857ca3bb0d5b..6dea35c8c18e 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -205,6 +205,18 @@ config MFD_AC100
This driver include only the core APIs. You have to select individual
components like codecs or RTC under the corresponding menus.
+config MFD_AC200
+ tristate "X-Powers AC200"
+ depends on COMMON_CLK
+ depends on I2C
+ depends on OF
+ select REGMAP_I2C
+ help
+ Support for the X-Powers AC200 mixed-signal companion IC. The AC200
+ contains audio, video, RTC and Fast Ethernet PHY functions and is
+ co-packaged with some Allwinner H6 and H616 SoCs. This driver provides
+ the shared register access used by the individual function drivers.
+
config MFD_AXP20X
tristate
select MFD_CORE
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index 72d3944b0ad8..f8101d2a9ce9 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -150,6 +150,7 @@ obj-$(CONFIG_MFD_DA9052_SPI) += da9052-spi.o
obj-$(CONFIG_MFD_DA9052_I2C) += da9052-i2c.o
obj-$(CONFIG_MFD_AC100) += ac100.o
+obj-$(CONFIG_MFD_AC200) += ac200.o
obj-$(CONFIG_MFD_AXP20X) += axp20x.o
obj-$(CONFIG_MFD_AXP20X_I2C) += axp20x-i2c.o
obj-$(CONFIG_MFD_AXP20X_RSB) += axp20x-rsb.o
diff --git a/drivers/mfd/ac200.c b/drivers/mfd/ac200.c
new file mode 100644
index 000000000000..94aa13deb0f8
--- /dev/null
+++ b/drivers/mfd/ac200.c
@@ -0,0 +1,113 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * MFD core driver for the X-Powers AC200
+ *
+ * Copyright (C) 2019 Jernej Skrabec <jernej.skrabec@gmail.com>
+ * Copyright (C) 2026 James Hilliard <james.hilliard1@gmail.com>
+ */
+
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/i2c.h>
+#include <linux/module.h>
+#include <linux/regmap.h>
+
+#define AC200_SYS_CONTROL_REG 0x0002
+#define AC200_SYS_CONTROL_CHIP_RESET_DEASSERT BIT(0)
+
+/* Interface register accessible from every register page. */
+#define AC200_TWI_REG_ADDR_H 0x00fe
+#define AC200_MAX_REG 0xa1f2
+
+static const struct regmap_range_cfg ac200_range_cfg[] = {
+ {
+ .range_max = AC200_MAX_REG,
+ .selector_reg = AC200_TWI_REG_ADDR_H,
+ .selector_mask = 0xff,
+ .window_len = 256,
+ },
+};
+
+/*
+ * Each AC200 sub-block can reset independently, invalidating its register
+ * contents without regmap's knowledge. Cache only the common page selector;
+ * this avoids a selector read-modify-write for every access on the same page
+ * without ever returning stale functional-register values.
+ */
+static bool ac200_volatile_reg(struct device *dev, unsigned int reg)
+{
+ return reg != AC200_TWI_REG_ADDR_H;
+}
+
+static const struct regmap_config ac200_regmap_config = {
+ .name = "ac200",
+ .reg_bits = 8,
+ .reg_stride = 2,
+ .val_bits = 16,
+ .ranges = ac200_range_cfg,
+ .num_ranges = ARRAY_SIZE(ac200_range_cfg),
+ .max_register = AC200_MAX_REG,
+ .volatile_reg = ac200_volatile_reg,
+ .cache_type = REGCACHE_MAPLE,
+};
+
+static int ac200_probe(struct i2c_client *client)
+{
+ struct device *dev = &client->dev;
+ struct regmap *regmap;
+ struct clk *clk;
+ int ret;
+
+ clk = devm_clk_get_enabled(dev, NULL);
+ if (IS_ERR(clk))
+ return dev_err_probe(dev, PTR_ERR(clk),
+ "failed to enable input clock\n");
+
+ ret = devm_clk_rate_exclusive_get(dev, clk);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to lock clock rate\n");
+
+ regmap = devm_regmap_init_i2c(client, &ac200_regmap_config);
+ if (IS_ERR(regmap))
+ return dev_err_probe(dev, PTR_ERR(regmap),
+ "failed to initialize regmap\n");
+
+ /*
+ * No minimum delay is documented. Match the vendor driver's 40 ms delay
+ * before its first AC200 register access after enabling the input clock.
+ */
+ msleep(40);
+
+ ret = regmap_set_bits(regmap, AC200_SYS_CONTROL_REG,
+ AC200_SYS_CONTROL_CHIP_RESET_DEASSERT);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
+static const struct of_device_id ac200_of_match[] = {
+ { .compatible = "x-powers,ac200" },
+ { }
+};
+MODULE_DEVICE_TABLE(of, ac200_of_match);
+
+static const struct i2c_device_id ac200_i2c_ids[] = {
+ { .name = "ac200" },
+ { }
+};
+MODULE_DEVICE_TABLE(i2c, ac200_i2c_ids);
+
+static struct i2c_driver ac200_driver = {
+ .driver = {
+ .name = "ac200",
+ .of_match_table = ac200_of_match,
+ },
+ .probe = ac200_probe,
+ .id_table = ac200_i2c_ids,
+};
+module_i2c_driver(ac200_driver);
+
+MODULE_AUTHOR("James Hilliard <james.hilliard1@gmail.com>");
+MODULE_DESCRIPTION("X-Powers AC200 MFD core driver");
+MODULE_LICENSE("GPL");
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v9 2/4] mfd: ac200: Add X-Powers AC200 support
2026-09-03 20:09 ` [PATCH v9 2/4] mfd: ac200: Add X-Powers AC200 support James Hilliard
@ 2026-09-03 20:21 ` sashiko-bot
0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-09-03 20:21 UTC (permalink / raw)
To: James Hilliard; +Cc: devicetree, lee, robh, linux-sunxi, mfd, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Regmap exposed to userspace and consumers before hardware initialization delay completes.
--
commit 35526ae046a1822af569d5228aa956640657303c
Author: James Hilliard <james.hilliard1@gmail.com>
mfd: ac200: Add X-Powers AC200 support
This commit adds MFD core driver support for the X-Powers AC200 mixed-signal
companion IC. It configures the shared regmap over I2C, handles clock
enabling, and manages the common reset state for the device.
> diff --git a/drivers/mfd/ac200.c b/drivers/mfd/ac200.c
> new file mode 100644
> index 0000000000000..94aa13deb0f8c
> --- /dev/null
> +++ b/drivers/mfd/ac200.c
[ ... ]
> +static int ac200_probe(struct i2c_client *client)
> +{
> + struct device *dev = &client->dev;
> + struct regmap *regmap;
> + struct clk *clk;
> + int ret;
> +
> + clk = devm_clk_get_enabled(dev, NULL);
> + if (IS_ERR(clk))
> + return dev_err_probe(dev, PTR_ERR(clk),
> + "failed to enable input clock\n");
> +
> + ret = devm_clk_rate_exclusive_get(dev, clk);
> + if (ret)
> + return dev_err_probe(dev, ret, "failed to lock clock rate\n");
> +
> + regmap = devm_regmap_init_i2c(client, &ac200_regmap_config);
> + if (IS_ERR(regmap))
> + return dev_err_probe(dev, PTR_ERR(regmap),
> + "failed to initialize regmap\n");
> +
> + /*
> + * No minimum delay is documented. Match the vendor driver's 40 ms delay
> + * before its first AC200 register access after enabling the input clock.
> + */
> + msleep(40);
[Severity: Medium]
Could exposing the regmap before the 40 ms initialization delay completes lead
to I2C bus lockups or device malfunctions?
The devm_regmap_init_i2c() call exposes the regmap to userspace via debugfs
and to other consumers, such as an asynchronously probing Ethernet PHY. During
this 40 ms window, these concurrent access paths might attempt to access the
hardware before the stabilization delay is met.
Would it be safer to move the msleep(40) above the regmap initialization to
prevent this race condition?
> +
> + ret = regmap_set_bits(regmap, AC200_SYS_CONTROL_REG,
> + AC200_SYS_CONTROL_CHIP_RESET_DEASSERT);
> + if (ret)
> + return ret;
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-submit-ac200-mfd-v9-0-6b7ed278989c@gmail.com?part=2
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v9 3/4] dt-bindings: mfd: x-powers: Describe AC200 functions
2026-09-03 20:09 [PATCH v9 0/4] mfd: add X-Powers AC200 support James Hilliard
2026-09-03 20:09 ` [PATCH v9 1/4] dt-bindings: mfd: x-powers: Add AC200 James Hilliard
2026-09-03 20:09 ` [PATCH v9 2/4] mfd: ac200: Add X-Powers AC200 support James Hilliard
@ 2026-09-03 20:09 ` James Hilliard
2026-09-03 20:14 ` sashiko-bot
2026-09-04 15:50 ` Conor Dooley
2026-09-03 20:09 ` [PATCH v9 4/4] mfd: ac200: Add codec and TV encoder cells James Hilliard
3 siblings, 2 replies; 11+ messages in thread
From: James Hilliard @ 2026-09-03 20:09 UTC (permalink / raw)
To: Lee Jones, Arnd Bergmann, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, James Hilliard
Cc: Andrew Lunn, Jagielski, Jedrzej, Andre Przywara, Chen-Yu Tsai,
Jernej Skrabec, linux-sunxi, mfd, devicetree, linux-kernel
From: Jernej Skrabec <jernej.skrabec@gmail.com>
Describe the AC200 audio codec and TV encoder as child nodes of the
shared I2C register provider. Keep their analog supplies on the function
consumers and describe the TV encoder display graph and optional bandgap
calibration cell.
Add the shared interrupt-controller properties and interrupt numbers needed
by the TV encoder. The Ethernet PHY remains represented on its primary MDIO
bus and is therefore not an MFD child.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
.../devicetree/bindings/mfd/x-powers,ac200.yaml | 136 +++++++++++++++++++++
MAINTAINERS | 1 +
include/dt-bindings/mfd/x-powers,ac200.h | 13 ++
3 files changed, 150 insertions(+)
diff --git a/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
index ca7a910b2c73..935dc07138cb 100644
--- a/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
+++ b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
@@ -28,15 +28,114 @@ properties:
be 24 or 27 MHz, matching the rates encoded by the documented EPHY clock
selector.
+ interrupts:
+ maxItems: 1
+ description:
+ The shared open-drain INTB output for the TV encoder, Ethernet PHY and
+ RTC interrupts.
+
+ interrupt-controller: true
+
+ '#interrupt-cells':
+ const: 1
+ description:
+ The interrupt number, as defined in
+ include/dt-bindings/mfd/x-powers,ac200.h.
+
+ codec:
+ type: object
+ $ref: /schemas/sound/dai-common.yaml#
+ unevaluatedProperties: false
+
+ properties:
+ compatible:
+ const: x-powers,ac200-codec
+
+ '#sound-dai-cells':
+ const: 0
+
+ ac-ldoin-supply:
+ description: The 3.3 V supply for the audio codec LDO input.
+
+ required:
+ - compatible
+ - '#sound-dai-cells'
+ - ac-ldoin-supply
+
+ tv-encoder:
+ type: object
+ additionalProperties: false
+
+ properties:
+ compatible:
+ const: x-powers,ac200-tve
+
+ interrupts:
+ maxItems: 1
+ description: Cable detection interrupt.
+
+ tv-vcc-supply:
+ description: The 3.3 V supply for the composite-video DAC.
+
+ nvmem-cells:
+ maxItems: 1
+
+ nvmem-cell-names:
+ items:
+ - const: bandgap
+
+ ports:
+ $ref: /schemas/graph.yaml#/properties/ports
+
+ properties:
+ port@0:
+ $ref: /schemas/graph.yaml#/properties/port
+ description: Input from the display pipeline, carrying CCIR656.
+
+ port@1:
+ $ref: /schemas/graph.yaml#/properties/port
+ description: Output to the composite-video connector.
+
+ required:
+ - port@0
+ - port@1
+
+ required:
+ - compatible
+ - interrupts
+ - tv-vcc-supply
+ - ports
+
+ dependencies:
+ nvmem-cells: [ nvmem-cell-names ]
+ nvmem-cell-names: [ nvmem-cells ]
+
required:
- compatible
- reg
- clocks
+allOf:
+ - if:
+ required:
+ - tv-encoder
+ then:
+ required:
+ - interrupts
+ - interrupt-controller
+ - '#interrupt-cells'
+
+dependencies:
+ interrupt-controller: [ '#interrupt-cells', interrupts ]
+ '#interrupt-cells': [ interrupt-controller ]
+
additionalProperties: false
examples:
- |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/mfd/x-powers,ac200.h>
+
i2c {
#address-cells = <1>;
#size-cells = <0>;
@@ -45,6 +144,43 @@ examples:
compatible = "x-powers,ac200";
reg = <0x10>;
clocks = <&pwm 5>;
+ interrupt-parent = <&pio>;
+ interrupts = <1 20 IRQ_TYPE_LEVEL_LOW>;
+ interrupt-controller;
+ #interrupt-cells = <1>;
+
+ codec {
+ compatible = "x-powers,ac200-codec";
+ #sound-dai-cells = <0>;
+ ac-ldoin-supply = <®_aldo2>;
+ };
+
+ tv-encoder {
+ compatible = "x-powers,ac200-tve";
+ interrupts = <AC200_IRQ_TVE>;
+ tv-vcc-supply = <®_aldo2>;
+
+ ports {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ port@0 {
+ reg = <0>;
+
+ tve_in: endpoint {
+ remote-endpoint = <&tcon_out_tve>;
+ };
+ };
+
+ port@1 {
+ reg = <1>;
+
+ tve_out: endpoint {
+ remote-endpoint = <&composite_in>;
+ };
+ };
+ };
+ };
};
};
...
diff --git a/MAINTAINERS b/MAINTAINERS
index 1d03b0060bda..8a48f6a1e593 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -29511,6 +29511,7 @@ L: linux-sunxi@lists.linux.dev
S: Maintained
F: Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
F: drivers/mfd/ac200.c
+F: include/dt-bindings/mfd/x-powers,ac200.h
X-POWERS AXP288 PMIC DRIVERS
M: Hans de Goede <hansg@kernel.org>
diff --git a/include/dt-bindings/mfd/x-powers,ac200.h b/include/dt-bindings/mfd/x-powers,ac200.h
new file mode 100644
index 000000000000..cc59e2ab4912
--- /dev/null
+++ b/include/dt-bindings/mfd/x-powers,ac200.h
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * Interrupt numbers of the X-Powers AC200 interrupt controller.
+ */
+
+#ifndef _DT_BINDINGS_MFD_X_POWERS_AC200_H
+#define _DT_BINDINGS_MFD_X_POWERS_AC200_H
+
+#define AC200_IRQ_TVE 0
+#define AC200_IRQ_EPHY 1
+#define AC200_IRQ_RTC 2
+
+#endif /* _DT_BINDINGS_MFD_X_POWERS_AC200_H */
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v9 3/4] dt-bindings: mfd: x-powers: Describe AC200 functions
2026-09-03 20:09 ` [PATCH v9 3/4] dt-bindings: mfd: x-powers: Describe AC200 functions James Hilliard
@ 2026-09-03 20:14 ` sashiko-bot
2026-09-04 15:50 ` Conor Dooley
1 sibling, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-09-03 20:14 UTC (permalink / raw)
To: James Hilliard; +Cc: lee, robh, linux-sunxi, conor+dt, devicetree, mfd
> From: Jernej Skrabec <jernej.skrabec@gmail.com>
>
> Describe the AC200 audio codec and TV encoder as child nodes of the
> shared I2C register provider. Keep their analog supplies on the function
> consumers and describe the TV encoder display graph and optional bandgap
> calibration cell.
>
> Add the shared interrupt-controller properties and interrupt numbers needed
> by the TV encoder. The Ethernet PHY remains represented on its primary MDIO
> bus and is therefore not an MFD child.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-submit-ac200-mfd-v9-0-6b7ed278989c@gmail.com?part=3
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH v9 3/4] dt-bindings: mfd: x-powers: Describe AC200 functions
2026-09-03 20:09 ` [PATCH v9 3/4] dt-bindings: mfd: x-powers: Describe AC200 functions James Hilliard
2026-09-03 20:14 ` sashiko-bot
@ 2026-09-04 15:50 ` Conor Dooley
2026-09-04 17:06 ` James Hilliard
1 sibling, 1 reply; 11+ messages in thread
From: Conor Dooley @ 2026-09-04 15:50 UTC (permalink / raw)
To: James Hilliard
Cc: Lee Jones, Arnd Bergmann, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Andrew Lunn, Jagielski, Jedrzej, Andre Przywara,
Chen-Yu Tsai, Jernej Skrabec, linux-sunxi, mfd, devicetree,
linux-kernel
[-- Attachment #1: Type: text/plain, Size: 7120 bytes --]
On Thu, Sep 03, 2026 at 02:09:42PM -0600, James Hilliard wrote:
> From: Jernej Skrabec <jernej.skrabec@gmail.com>
>
> Describe the AC200 audio codec and TV encoder as child nodes of the
> shared I2C register provider. Keep their analog supplies on the function
> consumers and describe the TV encoder display graph and optional bandgap
> calibration cell.
>
> Add the shared interrupt-controller properties and interrupt numbers needed
> by the TV encoder. The Ethernet PHY remains represented on its primary MDIO
> bus and is therefore not an MFD child.
>
> Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> ---
> .../devicetree/bindings/mfd/x-powers,ac200.yaml | 136 +++++++++++++++++++++
> MAINTAINERS | 1 +
> include/dt-bindings/mfd/x-powers,ac200.h | 13 ++
> 3 files changed, 150 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
> index ca7a910b2c73..935dc07138cb 100644
> --- a/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
> +++ b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
> @@ -28,15 +28,114 @@ properties:
> be 24 or 27 MHz, matching the rates encoded by the documented EPHY clock
> selector.
>
> + interrupts:
> + maxItems: 1
> + description:
> + The shared open-drain INTB output for the TV encoder, Ethernet PHY and
> + RTC interrupts.
> +
> + interrupt-controller: true
> +
> + '#interrupt-cells':
> + const: 1
> + description:
> + The interrupt number, as defined in
> + include/dt-bindings/mfd/x-powers,ac200.h.
> +
> + codec:
> + type: object
> + $ref: /schemas/sound/dai-common.yaml#
> + unevaluatedProperties: false
> +
> + properties:
> + compatible:
> + const: x-powers,ac200-codec
> +
> + '#sound-dai-cells':
> + const: 0
> +
> + ac-ldoin-supply:
> + description: The 3.3 V supply for the audio codec LDO input.
> +
> + required:
> + - compatible
> + - '#sound-dai-cells'
> + - ac-ldoin-supply
> +
> + tv-encoder:
> + type: object
> + additionalProperties: false
> +
> + properties:
> + compatible:
> + const: x-powers,ac200-tve
> +
> + interrupts:
> + maxItems: 1
> + description: Cable detection interrupt.
Given the example, this looks like a hack.
Is this mfd actually an interrupt controller, or is that just part of
this hack too?
Quite frankly, I am not really sure why either the tv-encoder or codec
have dedicated child nodes, they don't appear to have conflicting
properties.
Additionally, why is this not part of patch 1? Add the binding in a
complete state from the get-go. On that basis, at least,
pw-bot: changes-requested
Cheers,
Conor.
> +
> + tv-vcc-supply:
> + description: The 3.3 V supply for the composite-video DAC.
> +
> + nvmem-cells:
> + maxItems: 1
> +
> + nvmem-cell-names:
> + items:
> + - const: bandgap
> +
> + ports:
> + $ref: /schemas/graph.yaml#/properties/ports
> +
> + properties:
> + port@0:
> + $ref: /schemas/graph.yaml#/properties/port
> + description: Input from the display pipeline, carrying CCIR656.
> +
> + port@1:
> + $ref: /schemas/graph.yaml#/properties/port
> + description: Output to the composite-video connector.
> +
> + required:
> + - port@0
> + - port@1
> +
> + required:
> + - compatible
> + - interrupts
> + - tv-vcc-supply
> + - ports
> +
> + dependencies:
> + nvmem-cells: [ nvmem-cell-names ]
> + nvmem-cell-names: [ nvmem-cells ]
> +
> required:
> - compatible
> - reg
> - clocks
>
> +allOf:
> + - if:
> + required:
> + - tv-encoder
> + then:
> + required:
> + - interrupts
> + - interrupt-controller
> + - '#interrupt-cells'
> +
> +dependencies:
> + interrupt-controller: [ '#interrupt-cells', interrupts ]
> + '#interrupt-cells': [ interrupt-controller ]
> +
> additionalProperties: false
>
> examples:
> - |
> + #include <dt-bindings/interrupt-controller/irq.h>
> + #include <dt-bindings/mfd/x-powers,ac200.h>
> +
> i2c {
> #address-cells = <1>;
> #size-cells = <0>;
> @@ -45,6 +144,43 @@ examples:
> compatible = "x-powers,ac200";
> reg = <0x10>;
> clocks = <&pwm 5>;
> + interrupt-parent = <&pio>;
> + interrupts = <1 20 IRQ_TYPE_LEVEL_LOW>;
> + interrupt-controller;
> + #interrupt-cells = <1>;
> +
> + codec {
> + compatible = "x-powers,ac200-codec";
> + #sound-dai-cells = <0>;
> + ac-ldoin-supply = <®_aldo2>;
> + };
> +
> + tv-encoder {
> + compatible = "x-powers,ac200-tve";
> + interrupts = <AC200_IRQ_TVE>;
> + tv-vcc-supply = <®_aldo2>;
> +
> + ports {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + port@0 {
> + reg = <0>;
> +
> + tve_in: endpoint {
> + remote-endpoint = <&tcon_out_tve>;
> + };
> + };
> +
> + port@1 {
> + reg = <1>;
> +
> + tve_out: endpoint {
> + remote-endpoint = <&composite_in>;
> + };
> + };
> + };
> + };
> };
> };
> ...
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 1d03b0060bda..8a48f6a1e593 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -29511,6 +29511,7 @@ L: linux-sunxi@lists.linux.dev
> S: Maintained
> F: Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
> F: drivers/mfd/ac200.c
> +F: include/dt-bindings/mfd/x-powers,ac200.h
>
> X-POWERS AXP288 PMIC DRIVERS
> M: Hans de Goede <hansg@kernel.org>
> diff --git a/include/dt-bindings/mfd/x-powers,ac200.h b/include/dt-bindings/mfd/x-powers,ac200.h
> new file mode 100644
> index 000000000000..cc59e2ab4912
> --- /dev/null
> +++ b/include/dt-bindings/mfd/x-powers,ac200.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> +/*
> + * Interrupt numbers of the X-Powers AC200 interrupt controller.
> + */
> +
> +#ifndef _DT_BINDINGS_MFD_X_POWERS_AC200_H
> +#define _DT_BINDINGS_MFD_X_POWERS_AC200_H
> +
> +#define AC200_IRQ_TVE 0
> +#define AC200_IRQ_EPHY 1
> +#define AC200_IRQ_RTC 2
> +
> +#endif /* _DT_BINDINGS_MFD_X_POWERS_AC200_H */
>
> --
> 2.53.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread* Re: [PATCH v9 3/4] dt-bindings: mfd: x-powers: Describe AC200 functions
2026-09-04 15:50 ` Conor Dooley
@ 2026-09-04 17:06 ` James Hilliard
0 siblings, 0 replies; 11+ messages in thread
From: James Hilliard @ 2026-09-04 17:06 UTC (permalink / raw)
To: Conor Dooley
Cc: Lee Jones, Arnd Bergmann, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Andrew Lunn, Jagielski, Jedrzej, Andre Przywara,
Chen-Yu Tsai, Jernej Skrabec, linux-sunxi, mfd, devicetree,
linux-kernel
On Fri, Sep 4, 2026 at 9:50 AM Conor Dooley <conor@kernel.org> wrote:
>
> On Thu, Sep 03, 2026 at 02:09:42PM -0600, James Hilliard wrote:
> > From: Jernej Skrabec <jernej.skrabec@gmail.com>
> >
> > Describe the AC200 audio codec and TV encoder as child nodes of the
> > shared I2C register provider. Keep their analog supplies on the function
> > consumers and describe the TV encoder display graph and optional bandgap
> > calibration cell.
> >
> > Add the shared interrupt-controller properties and interrupt numbers needed
> > by the TV encoder. The Ethernet PHY remains represented on its primary MDIO
> > bus and is therefore not an MFD child.
> >
> > Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
> > Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
> > ---
> > .../devicetree/bindings/mfd/x-powers,ac200.yaml | 136 +++++++++++++++++++++
> > MAINTAINERS | 1 +
> > include/dt-bindings/mfd/x-powers,ac200.h | 13 ++
> > 3 files changed, 150 insertions(+)
> >
> > diff --git a/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
> > index ca7a910b2c73..935dc07138cb 100644
> > --- a/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
> > +++ b/Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
> > @@ -28,15 +28,114 @@ properties:
> > be 24 or 27 MHz, matching the rates encoded by the documented EPHY clock
> > selector.
> >
> > + interrupts:
> > + maxItems: 1
> > + description:
> > + The shared open-drain INTB output for the TV encoder, Ethernet PHY and
> > + RTC interrupts.
> > +
> > + interrupt-controller: true
> > +
> > + '#interrupt-cells':
> > + const: 1
> > + description:
> > + The interrupt number, as defined in
> > + include/dt-bindings/mfd/x-powers,ac200.h.
> > +
> > + codec:
> > + type: object
> > + $ref: /schemas/sound/dai-common.yaml#
> > + unevaluatedProperties: false
> > +
> > + properties:
> > + compatible:
> > + const: x-powers,ac200-codec
> > +
> > + '#sound-dai-cells':
> > + const: 0
> > +
> > + ac-ldoin-supply:
> > + description: The 3.3 V supply for the audio codec LDO input.
> > +
> > + required:
> > + - compatible
> > + - '#sound-dai-cells'
> > + - ac-ldoin-supply
> > +
> > + tv-encoder:
> > + type: object
> > + additionalProperties: false
> > +
> > + properties:
> > + compatible:
> > + const: x-powers,ac200-tve
> > +
> > + interrupts:
> > + maxItems: 1
> > + description: Cable detection interrupt.
>
> Given the example, this looks like a hack.
> Is this mfd actually an interrupt controller, or is that just part of
> this hack too?
The AC200 has separate TV encoder, Ethernet PHY and RTC status and
enable bits which are multiplexed onto its shared INTB output, so the
intent was to represent that demultiplexer as an interrupt controller.
I notice that the example's tv-encoder interrupts property inherits
interrupt-parent = <&pio> rather than explicitly referencing the AC200
interrupt domain. Is that incorrect interrupt relationship what looks
like a hack here, or do you also object to representing the AC200
interrupt demultiplexer as an interrupt controller?
> Quite frankly, I am not really sure why either the tv-encoder or codec
> have dedicated child nodes, they don't appear to have conflicting
> properties.
Do you mean that the DT properties for both functions should be folded
into the AC200 parent node, while the MFD driver still creates separate
codec and TV encoder platform devices?
Lee requested at least two MFD children in this series, so I want to
distinguish the Linux MFD cells from whether those cells need dedicated
firmware child nodes.
> Additionally, why is this not part of patch 1? Add the binding in a
> complete state from the get-go. On that basis, at least,
> pw-bot: changes-requested
Do you want patches 1 and 3 combined into one complete binding patch,
while retaining separate implementation commits for the base provider
and the MFD cells?
> Cheers,
> Conor.
>
> > +
> > + tv-vcc-supply:
> > + description: The 3.3 V supply for the composite-video DAC.
> > +
> > + nvmem-cells:
> > + maxItems: 1
> > +
> > + nvmem-cell-names:
> > + items:
> > + - const: bandgap
> > +
> > + ports:
> > + $ref: /schemas/graph.yaml#/properties/ports
> > +
> > + properties:
> > + port@0:
> > + $ref: /schemas/graph.yaml#/properties/port
> > + description: Input from the display pipeline, carrying CCIR656.
> > +
> > + port@1:
> > + $ref: /schemas/graph.yaml#/properties/port
> > + description: Output to the composite-video connector.
> > +
> > + required:
> > + - port@0
> > + - port@1
> > +
> > + required:
> > + - compatible
> > + - interrupts
> > + - tv-vcc-supply
> > + - ports
> > +
> > + dependencies:
> > + nvmem-cells: [ nvmem-cell-names ]
> > + nvmem-cell-names: [ nvmem-cells ]
> > +
> > required:
> > - compatible
> > - reg
> > - clocks
> >
> > +allOf:
> > + - if:
> > + required:
> > + - tv-encoder
> > + then:
> > + required:
> > + - interrupts
> > + - interrupt-controller
> > + - '#interrupt-cells'
> > +
> > +dependencies:
> > + interrupt-controller: [ '#interrupt-cells', interrupts ]
> > + '#interrupt-cells': [ interrupt-controller ]
> > +
> > additionalProperties: false
> >
> > examples:
> > - |
> > + #include <dt-bindings/interrupt-controller/irq.h>
> > + #include <dt-bindings/mfd/x-powers,ac200.h>
> > +
> > i2c {
> > #address-cells = <1>;
> > #size-cells = <0>;
> > @@ -45,6 +144,43 @@ examples:
> > compatible = "x-powers,ac200";
> > reg = <0x10>;
> > clocks = <&pwm 5>;
> > + interrupt-parent = <&pio>;
> > + interrupts = <1 20 IRQ_TYPE_LEVEL_LOW>;
> > + interrupt-controller;
> > + #interrupt-cells = <1>;
> > +
> > + codec {
> > + compatible = "x-powers,ac200-codec";
> > + #sound-dai-cells = <0>;
> > + ac-ldoin-supply = <®_aldo2>;
> > + };
> > +
> > + tv-encoder {
> > + compatible = "x-powers,ac200-tve";
> > + interrupts = <AC200_IRQ_TVE>;
> > + tv-vcc-supply = <®_aldo2>;
> > +
> > + ports {
> > + #address-cells = <1>;
> > + #size-cells = <0>;
> > +
> > + port@0 {
> > + reg = <0>;
> > +
> > + tve_in: endpoint {
> > + remote-endpoint = <&tcon_out_tve>;
> > + };
> > + };
> > +
> > + port@1 {
> > + reg = <1>;
> > +
> > + tve_out: endpoint {
> > + remote-endpoint = <&composite_in>;
> > + };
> > + };
> > + };
> > + };
> > };
> > };
> > ...
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 1d03b0060bda..8a48f6a1e593 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -29511,6 +29511,7 @@ L: linux-sunxi@lists.linux.dev
> > S: Maintained
> > F: Documentation/devicetree/bindings/mfd/x-powers,ac200.yaml
> > F: drivers/mfd/ac200.c
> > +F: include/dt-bindings/mfd/x-powers,ac200.h
> >
> > X-POWERS AXP288 PMIC DRIVERS
> > M: Hans de Goede <hansg@kernel.org>
> > diff --git a/include/dt-bindings/mfd/x-powers,ac200.h b/include/dt-bindings/mfd/x-powers,ac200.h
> > new file mode 100644
> > index 000000000000..cc59e2ab4912
> > --- /dev/null
> > +++ b/include/dt-bindings/mfd/x-powers,ac200.h
> > @@ -0,0 +1,13 @@
> > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> > +/*
> > + * Interrupt numbers of the X-Powers AC200 interrupt controller.
> > + */
> > +
> > +#ifndef _DT_BINDINGS_MFD_X_POWERS_AC200_H
> > +#define _DT_BINDINGS_MFD_X_POWERS_AC200_H
> > +
> > +#define AC200_IRQ_TVE 0
> > +#define AC200_IRQ_EPHY 1
> > +#define AC200_IRQ_RTC 2
> > +
> > +#endif /* _DT_BINDINGS_MFD_X_POWERS_AC200_H */
> >
> > --
> > 2.53.0
> >
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH v9 4/4] mfd: ac200: Add codec and TV encoder cells
2026-09-03 20:09 [PATCH v9 0/4] mfd: add X-Powers AC200 support James Hilliard
` (2 preceding siblings ...)
2026-09-03 20:09 ` [PATCH v9 3/4] dt-bindings: mfd: x-powers: Describe AC200 functions James Hilliard
@ 2026-09-03 20:09 ` James Hilliard
2026-09-03 20:20 ` sashiko-bot
3 siblings, 1 reply; 11+ messages in thread
From: James Hilliard @ 2026-09-03 20:09 UTC (permalink / raw)
To: Lee Jones, Arnd Bergmann, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, James Hilliard
Cc: Andrew Lunn, Jagielski, Jedrzej, Andre Przywara, Chen-Yu Tsai,
Jernej Skrabec, linux-sunxi, mfd, devicetree, linux-kernel
From: Jernej Skrabec <jernej.skrabec@gmail.com>
Register the AC200 audio codec and TV encoder as MFD cells when their
enabled child nodes are present. Filtering the cell list avoids creating
unused platform devices, or warnings about missing firmware nodes, on
boards which use only the separately enumerated MDIO PHY.
Add a regmap IRQ controller for the shared level-triggered INTB output so
the TV encoder can consume its cable-detection interrupt. The source
function remains responsible for clearing its interrupt condition.
Signed-off-by: Jernej Skrabec <jernej.skrabec@gmail.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: James Hilliard <james.hilliard1@gmail.com>
---
drivers/mfd/Kconfig | 5 ++-
drivers/mfd/ac200.c | 119 +++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 122 insertions(+), 2 deletions(-)
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 6dea35c8c18e..5193c6f71bd8 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -210,12 +210,15 @@ config MFD_AC200
depends on COMMON_CLK
depends on I2C
depends on OF
+ select MFD_CORE
select REGMAP_I2C
+ select REGMAP_IRQ
help
Support for the X-Powers AC200 mixed-signal companion IC. The AC200
contains audio, video, RTC and Fast Ethernet PHY functions and is
co-packaged with some Allwinner H6 and H616 SoCs. This driver provides
- the shared register access used by the individual function drivers.
+ the shared register access and instantiates the individual function
+ devices.
config MFD_AXP20X
tristate
diff --git a/drivers/mfd/ac200.c b/drivers/mfd/ac200.c
index 94aa13deb0f8..f7d818141d9c 100644
--- a/drivers/mfd/ac200.c
+++ b/drivers/mfd/ac200.c
@@ -9,11 +9,24 @@
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/i2c.h>
+#include <linux/interrupt.h>
+#include <linux/irq.h>
+#include <linux/mfd/core.h>
#include <linux/module.h>
+#include <linux/of.h>
#include <linux/regmap.h>
+#include <dt-bindings/mfd/x-powers,ac200.h>
+
#define AC200_SYS_CONTROL_REG 0x0002
#define AC200_SYS_CONTROL_CHIP_RESET_DEASSERT BIT(0)
+#define AC200_SYS_IRQ_ENABLE_REG 0x0004
+#define AC200_SYS_IRQ_INTB_ENABLE BIT(15)
+#define AC200_SYS_IRQ_INTB_ACTIVE_HIGH BIT(14)
+#define AC200_SYS_IRQ_RTC BIT(12)
+#define AC200_SYS_IRQ_EPHY BIT(8)
+#define AC200_SYS_IRQ_TVE BIT(4)
+#define AC200_SYS_IRQ_STATUS_REG 0x0006
/* Interface register accessible from every register page. */
#define AC200_TWI_REG_ADDR_H 0x00fe
@@ -51,6 +64,103 @@ static const struct regmap_config ac200_regmap_config = {
.cache_type = REGCACHE_MAPLE,
};
+static const struct regmap_irq ac200_irqs[] = {
+ REGMAP_IRQ_REG(AC200_IRQ_TVE, 0, AC200_SYS_IRQ_TVE),
+ REGMAP_IRQ_REG(AC200_IRQ_EPHY, 0, AC200_SYS_IRQ_EPHY),
+ REGMAP_IRQ_REG(AC200_IRQ_RTC, 0, AC200_SYS_IRQ_RTC),
+};
+
+/*
+ * SYS_IRQ_ENABLE is an enable register rather than a mask register, hence
+ * unmask_base. SYS_IRQ_STATUS reflects the source levels, so the function
+ * which raised an interrupt is responsible for clearing it.
+ */
+static const struct regmap_irq_chip ac200_irq_chip = {
+ .name = "ac200",
+ .status_base = AC200_SYS_IRQ_STATUS_REG,
+ .unmask_base = AC200_SYS_IRQ_ENABLE_REG,
+ .num_regs = 1,
+ .irqs = ac200_irqs,
+ .num_irqs = ARRAY_SIZE(ac200_irqs),
+};
+
+static const struct mfd_cell ac200_cells[] = {
+ {
+ .name = "ac200-codec",
+ .of_compatible = "x-powers,ac200-codec",
+ }, {
+ .name = "ac200-tve",
+ .of_compatible = "x-powers,ac200-tve",
+ },
+};
+
+static int ac200_init_irq(struct device *dev, struct regmap *regmap, int irq)
+{
+ struct regmap_irq_chip_data *irq_data;
+ unsigned int trigger;
+ u16 value = AC200_SYS_IRQ_INTB_ENABLE;
+ int ret;
+
+ trigger = irq_get_trigger_type(irq);
+ switch (trigger) {
+ case IRQ_TYPE_LEVEL_HIGH:
+ value |= AC200_SYS_IRQ_INTB_ACTIVE_HIGH;
+ break;
+ case IRQ_TYPE_NONE:
+ case IRQ_TYPE_LEVEL_LOW:
+ break;
+ default:
+ return dev_err_probe(dev, -EINVAL,
+ "INTB is level triggered, not type %u\n",
+ trigger);
+ }
+
+ ret = regmap_update_bits(regmap, AC200_SYS_IRQ_ENABLE_REG,
+ AC200_SYS_IRQ_INTB_ENABLE |
+ AC200_SYS_IRQ_INTB_ACTIVE_HIGH, value);
+ if (ret)
+ return ret;
+
+ ret = devm_regmap_add_irq_chip(dev, regmap, irq, IRQF_ONESHOT, 0,
+ &ac200_irq_chip, &irq_data);
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to add IRQ chip\n");
+
+ return 0;
+}
+
+static int ac200_add_devices(struct device *dev)
+{
+ struct mfd_cell cells[ARRAY_SIZE(ac200_cells)];
+ unsigned int num_cells = 0;
+ unsigned int i;
+ int ret;
+
+ for (i = 0; i < ARRAY_SIZE(ac200_cells); i++) {
+ const struct mfd_cell *cell = &ac200_cells[i];
+ struct device_node *child;
+
+ child = of_get_compatible_child(dev->of_node,
+ cell->of_compatible);
+ if (!child)
+ continue;
+ if (of_device_is_available(child))
+ cells[num_cells++] = *cell;
+ of_node_put(child);
+ }
+
+ if (!num_cells)
+ return 0;
+
+ ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, cells, num_cells,
+ NULL, 0, NULL);
+ if (ret)
+ return dev_err_probe(dev, ret,
+ "failed to add function devices\n");
+
+ return 0;
+}
+
static int ac200_probe(struct i2c_client *client)
{
struct device *dev = &client->dev;
@@ -83,7 +193,13 @@ static int ac200_probe(struct i2c_client *client)
if (ret)
return ret;
- return 0;
+ if (client->irq > 0) {
+ ret = ac200_init_irq(dev, regmap, client->irq);
+ if (ret)
+ return ret;
+ }
+
+ return ac200_add_devices(dev);
}
static const struct of_device_id ac200_of_match[] = {
@@ -108,6 +224,7 @@ static struct i2c_driver ac200_driver = {
};
module_i2c_driver(ac200_driver);
+MODULE_AUTHOR("Jernej Skrabec <jernej.skrabec@gmail.com>");
MODULE_AUTHOR("James Hilliard <james.hilliard1@gmail.com>");
MODULE_DESCRIPTION("X-Powers AC200 MFD core driver");
MODULE_LICENSE("GPL");
--
2.53.0
^ permalink raw reply related [flat|nested] 11+ messages in thread* Re: [PATCH v9 4/4] mfd: ac200: Add codec and TV encoder cells
2026-09-03 20:09 ` [PATCH v9 4/4] mfd: ac200: Add codec and TV encoder cells James Hilliard
@ 2026-09-03 20:20 ` sashiko-bot
0 siblings, 0 replies; 11+ messages in thread
From: sashiko-bot @ 2026-09-03 20:20 UTC (permalink / raw)
To: James Hilliard; +Cc: robh, conor+dt, lee, devicetree, mfd, linux-sunxi
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] Using PLATFORM_DEVID_NONE instead of PLATFORM_DEVID_AUTO causes sysfs device naming collisions.
- [Low] Dynamic creation of a local stack copy of the mfd_cell array for filtering violates MFD architectural rules.
--
commit 5b7692c955e218224dd53b696f2b08c851828b93
Author: Jernej Skrabec <jernej.skrabec@gmail.com>
mfd: ac200: Add codec and TV encoder cells
Register the AC200 audio codec and TV encoder as MFD cells when their
enabled child nodes are present. Filtering the cell list avoids creating
unused platform devices.
> diff --git a/drivers/mfd/ac200.c b/drivers/mfd/ac200.c
> index 94aa13deb0f8c..f7d818141d9cb 100644
> --- a/drivers/mfd/ac200.c
> +++ b/drivers/mfd/ac200.c
[ ... ]
> +static int ac200_add_devices(struct device *dev)
> +{
> + struct mfd_cell cells[ARRAY_SIZE(ac200_cells)];
> + unsigned int num_cells = 0;
> + unsigned int i;
> + int ret;
> +
> + for (i = 0; i < ARRAY_SIZE(ac200_cells); i++) {
> + const struct mfd_cell *cell = &ac200_cells[i];
> + struct device_node *child;
> +
> + child = of_get_compatible_child(dev->of_node,
> + cell->of_compatible);
> + if (!child)
> + continue;
> + if (of_device_is_available(child))
> + cells[num_cells++] = *cell;
[Severity: Low]
Does creating a dynamic local stack copy of the mfd_cell array here
violate the MFD architectural guidelines?
The MFD subsystem rules typically require cell arrays to remain static const.
Dynamically amending and explicitly copying into a local array during probe
in ac200_add_devices() bypasses the standard static definition approach.
Could this instead use static references or a switch statement if variants
or filtering are needed?
> + of_node_put(child);
> + }
> +
> + if (!num_cells)
> + return 0;
> +
> + ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, cells, num_cells,
> + NULL, 0, NULL);
[Severity: Medium]
Can passing PLATFORM_DEVID_NONE here cause sysfs device naming collisions?
If a system developer instantiates multiple AC200 chips in the device tree,
the second instance might fail during devm_mfd_add_devices() because both
instances will attempt to register child platform devices with identical
hard-coded names (like 'ac200-codec').
Would it be safer to use PLATFORM_DEVID_AUTO to allow automatic cell
indexing and properly support multi-instance configurations?
> + if (ret)
> + return dev_err_probe(dev, ret,
> + "failed to add function devices\n");
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260903-submit-ac200-mfd-v9-0-6b7ed278989c@gmail.com?part=4
^ permalink raw reply [flat|nested] 11+ messages in thread