Skip to contentSkip to conversation

sound: airoha: add support for AN7581 PCM driver

RFC PATCH Superseded Christian Marangi 2 participants 2 messages Oct 3, 2025 – Oct 9, 2025 Sound

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 sound: airoha: add support for AN7581 PCM driver

The Airoha AN7581 SoC have alternative Sound Card that expose PCM OPs dedicated for VoIP application.

---
 sound/Kconfig             |   2 +
 sound/Makefile            |   2 +-
 sound/airoha/Kconfig      |   9 +
 sound/airoha/Makefile     |   3 +
 sound/airoha/an7581-pcm.c | 637 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 652 insertions(+), 1 deletion(-)
 create mode 100644 sound/airoha/Kconfig
 create mode 100644 sound/airoha/Makefile
 create mode 100644 sound/airoha/an7581-pcm.c
sound/Kconfig +2 -0
index 8b40205394fe..7886c2460e86 100644
@@ -63,6 +63,8 @@ source "sound/ppc/Kconfig"
 
 source "sound/ac97/Kconfig"
 
+source "sound/airoha/Kconfig"
+
 source "sound/aoa/Kconfig"
 
 source "sound/arm/Kconfig"
sound/Makefile +1 -1
index 5942311a4232..85008bb22b7e 100644
@@ -6,7 +6,7 @@ obj-$(CONFIG_SOUND) += soundcore.o
 obj-$(CONFIG_DMASOUND) += oss/dmasound/
 obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \
 	firewire/ sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/ hda/ x86/ xen/ \
-	virtio/
+	virtio/ airoha/
 obj-$(CONFIG_SND_AOA) += aoa/
 
 # This one must be compilable even if sound is configured out
sound/airoha/Kconfig new file +9 -0
new file mode 100644
index 000000000000..fe226fedd1a4
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+config SND_AN7581_PCM
+	tristate "PCM support for Airoha AN7581 chip"
+	help
+	  This adds PCM driver for Airoha AN7581 boards
+	  that can be used with other codecs.
+	  Select Y if you have such device.
+	  If unsure select "N".
sound/airoha/Makefile new file +3 -0
new file mode 100644
index 000000000000..039b8853d5a2
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_SND_AN7581_PCM) += an7581-pcm.o
sound/airoha/an7581-pcm.c new file +637 -0

637 lines not on this page · raw message

Signature · 1 line
2.51.0
#1 lore raw

Hi Christian,

Quoted 15 lines · Christian Marangi

The Airoha AN7581 SoC have alternative Sound Card that expose PCM OPs dedicated for VoIP application.

---
 sound/Kconfig             |   2 +
 sound/Makefile            |   2 +-
 sound/airoha/Kconfig      |   9 +
 sound/airoha/Makefile     |   3 +
 sound/airoha/an7581-pcm.c | 637 ++++++++++++++++++++++++++++++++++++++
 5 files changed, 652 insertions(+), 1 deletion(-)
 create mode 100644 sound/airoha/Kconfig
 create mode 100644 sound/airoha/Makefile
 create mode 100644 sound/airoha/an7581-pcm.c

[...]

Quoted 6 lines
sound/airoha/an7581-pcm.c new file +0 -0
new file mode 100644
index 000000000000..bf1fc447aed4
@@ -0,0 +1,637 @@

[...]

Quoted 13 lines
sound/airoha/an7581-pcm.c new file +13 -0
+static int an7581_pcm_probe(struct platform_device *pdev)
+{
+	struct device *dev = &pdev->dev;
+	struct an7581_pcm_priv *priv;
+	struct snd_card *card;
+	struct snd_pcm *pcm;
+	int irq;
+	int ret;
+
+	ret = snd_devm_card_new(dev, 1, "AN7581 PCM SOUND",
+				THIS_MODULE, 0, &card);
+	if (ret)
+		return ret;

sound/airoha/an7581-pcm.c line 545

Quoted 10 lines
sound/airoha/an7581-pcm.c new file +10 -0
+
+	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+	if (!priv)
+		return -ENOMEM;
+
+	priv->map = device_node_to_regmap(dev->of_node);
+	if (!IS_ERR(priv->map))
+		return PTR_ERR(priv->map);
+
+	priv->reset = devm_reset_control_get_exclusive(dev, "pcm1");

Is there more than one reset input per PCM module? Lookup by name is only needed if there are multiple resets.

This question should be answered by a device tree binding document for airoha,an7581-pcm.

regards
Philipp