Skip to contentSkip to conversation

Apple ADMAC driver

PATCH Applied Martin Povišer 2 participants 5 messages May 31, 2022 – Jun 9, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v4 cover Apple ADMAC driver

Hi,

I am doing another push of this neglected series which adds support for Audio DMA Controller on recent Apple SoCs.

All best,
Martin

Changes since v3:
- collected Rob's r-b tag on binding
- split off MAINTAINERS commit for easier merging (allegedly)

Changes since v2:
(link: https://lore.kernel.org/dmaengine/[email protected]/ )
- in binding, make 'interrupts' fixed length and add a comment
- do not use devm allocation on descriptors
- use platform_get_irq_optional to not log errors in the course of looking for an usable interrupt
- make channel no. unsigned

Changes since v1:
(link: https://lore.kernel.org/dmaengine/[email protected]/ )
- in binding, drop 'apple,internal-irq-destination' in favor of prepending entries to 'interrupts'
- drop admac_peek/poke helpers
- use special versions of dev_err/WARN_ON where desirable, fix %pad formatter invocation
- bring implementation of terminate_all up to dmaengine spec, add device_synchronize
- minor fixes (comments, formatting)

Martin Povišer (3):
dt-bindings: dma: Add Apple ADMAC
dmaengine: apple-admac: Add Apple ADMAC driver
MAINTAINERS: Add ADMAC driver under ARM/APPLE MACHINE

 .../devicetree/bindings/dma/apple,admac.yaml  |  75 ++
 MAINTAINERS                                   |   2 +
 drivers/dma/Kconfig                           |   8 +
 drivers/dma/Makefile                          |   1 +
 drivers/dma/apple-admac.c                     | 818 ++++++++++++++++++
 5 files changed, 904 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/apple,admac.yaml
 create mode 100644 drivers/dma/apple-admac.c
Signature · 1 line
2.33.0
#1 lore raw

PATCH v4 1/3 dt-bindings: dma: Add Apple ADMAC

Apple's Audio DMA Controller (ADMAC) is used to fetch and store audio samples on SoCs from the "Apple Silicon" family.

---
 .../devicetree/bindings/dma/apple,admac.yaml  | 75 +++++++++++++++++++
 1 file changed, 75 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/dma/apple,admac.yaml
Documentation/devicetree/bindings/dma/apple,admac.yaml new file +75 -0
new file mode 100644
index 000000000000..ab8a4ec7779f
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/dma/apple,admac.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Apple Audio DMA Controller (ADMAC)
+
+description: |
+  Apple's Audio DMA Controller (ADMAC) is used to fetch and store audio samples
+  on SoCs from the "Apple Silicon" family.
+
+  The controller has been seen with up to 24 channels. Even-numbered channels
+  are TX-only, odd-numbered are RX-only. Individual channels are coupled to
+  fixed device endpoints.
+
+maintainers:
+  - Martin Povišer <[email protected]>
+
+allOf:
+  - $ref: "dma-controller.yaml#"
+
+properties:
+  compatible:
+    items:
+      - enum:
+          - apple,t6000-admac
+          - apple,t8103-admac
+      - const: apple,admac
+
+  reg:
+    maxItems: 1
+
+  '#dma-cells':
+    const: 1
+    description:
+      Clients specify a single cell with channel number.
+
+  dma-channels:
+    maximum: 24
+
+  interrupts:
+    minItems: 4
+    maxItems: 4
+    description:
+      Interrupts that correspond to the 4 IRQ outputs of the controller. Usually
+      only one of the controller outputs will be connected as an usable interrupt
+      source. The remaining interrupts will be left without a valid value, e.g.
+      in an interrupts-extended list the disconnected positions will contain
+      an empty phandle reference <0>.
+
+required:
+  - compatible
+  - reg
+  - '#dma-cells'
+  - dma-channels
+  - interrupts
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/apple-aic.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    admac: dma-controller@238200000 {
+      compatible = "apple,t8103-admac", "apple,admac";
+      reg = <0x38200000 0x34000>;
+      dma-channels = <24>;
+      interrupts-extended = <0>,
+                            <&aic AIC_IRQ 626 IRQ_TYPE_LEVEL_HIGH>,
+                            <0>,
+                            <0>;
+      #dma-cells = <1>;
+    };
Signature · 1 line
2.33.0
#2 lore raw

PATCH v4 2/3 dmaengine: apple-admac: Add Apple ADMAC driver

In reply to Martin Povišer

Add driver for Audio DMA Controller present on Apple SoCs from the "Apple Silicon" family.

---
 drivers/dma/Kconfig       |   8 +
 drivers/dma/Makefile      |   1 +
 drivers/dma/apple-admac.c | 818 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 827 insertions(+)
 create mode 100644 drivers/dma/apple-admac.c
drivers/dma/Kconfig +8 -0
index 487ed4ddc3be..a06d2a7627aa 100644
@@ -85,6 +85,14 @@ config AMCC_PPC440SPE_ADMA
 	help
 	  Enable support for the AMCC PPC440SPe RAID engines.
 
+config APPLE_ADMAC
+	tristate "Apple ADMAC support"
+	depends on ARCH_APPLE || COMPILE_TEST
+	select DMA_ENGINE
+	default ARCH_APPLE
+	help
+	  Enable support for Audio DMA Controller found on Apple Silicon SoCs.
+
 config AT_HDMAC
 	tristate "Atmel AHB DMA support"
 	depends on ARCH_AT91
drivers/dma/Makefile +1 -0
index 2f1b87ffd7ab..10f7d4241001 100644
@@ -17,6 +17,7 @@ obj-$(CONFIG_ALTERA_MSGDMA) += altera-msgdma.o
 obj-$(CONFIG_AMBA_PL08X) += amba-pl08x.o
 obj-$(CONFIG_AMCC_PPC440SPE_ADMA) += ppc4xx/
 obj-$(CONFIG_AMD_PTDMA) += ptdma/
+obj-$(CONFIG_APPLE_ADMAC) += apple-admac.o
 obj-$(CONFIG_AT_HDMAC) += at_hdmac.o
 obj-$(CONFIG_AT_XDMAC) += at_xdmac.o
 obj-$(CONFIG_AXI_DMAC) += dma-axi-dmac.o
drivers/dma/apple-admac.c new file +818 -0

818 lines not on this page · raw message

Signature · 1 line
2.33.0
#3 lore raw

PATCH v4 3/3 MAINTAINERS: Add ADMAC driver under ARM/APPLE MACHINE

In reply to Martin Povišer

Register the driver source and binding schema.

---
 MAINTAINERS | 2 ++
 1 file changed, 2 insertions(+)
MAINTAINERS +2 -0
index 6850d079f012..8cd1b4484746 100644
@@ -1835,6 +1835,7 @@ T:	git https://github.com/AsahiLinux/linux.git
 F:	Documentation/devicetree/bindings/arm/apple.yaml
 F:	Documentation/devicetree/bindings/arm/apple/*
 F:	Documentation/devicetree/bindings/clock/apple,nco.yaml
+F:	Documentation/devicetree/bindings/dma/apple,admac.yaml
 F:	Documentation/devicetree/bindings/i2c/apple,i2c.yaml
 F:	Documentation/devicetree/bindings/interrupt-controller/apple,*
 F:	Documentation/devicetree/bindings/iommu/apple,sart.yaml
@@ -1848,6 +1849,7 @@ F:	Documentation/devicetree/bindings/power/apple*
 F:	Documentation/devicetree/bindings/watchdog/apple,wdt.yaml
 F:	arch/arm64/boot/dts/apple/
 F:	drivers/clk/clk-apple-nco.c
+F:	drivers/dma/apple-admac.c
 F:	drivers/i2c/busses/i2c-pasemi-core.c
 F:	drivers/i2c/busses/i2c-pasemi-platform.c
 F:	drivers/iommu/apple-dart.c
Signature · 1 line
2.33.0
maintainer Applied
#4 lore raw
In reply to Martin Povišer
Quoted 4 lines · Martin Povišer

Hi,

I am doing another push of this neglected series which adds support for Audio DMA Controller on recent Apple SoCs.

Applied, thanks

Signature · 1 line
~Vinod