git: 9e7e15b539a6 - main - snd_hdspe(4): AO4S/AI4S support.

From: Ruslan Bukin <br_at_FreeBSD.org>
Date: Fri, 04 Oct 2024 18:41:17 UTC
The branch main has been updated by br:

URL: https://cgit.FreeBSD.org/src/commit/?id=9e7e15b539a6f3ef98854a47ee346c9100875c8a

commit 9e7e15b539a6f3ef98854a47ee346c9100875c8a
Author:     Ruslan Bukin <br@FreeBSD.org>
AuthorDate: 2024-10-04 18:33:36 +0000
Commit:     Ruslan Bukin <br@FreeBSD.org>
CommitDate: 2024-10-04 18:36:06 +0000

    snd_hdspe(4): AO4S/AI4S support.
    
    Add support for RME AO4S/AI4S extension cards. They are designed as a bracket
    with 4 stereo TRS jacks each.
    
    https://archiv.rme-audio.de/download/ao4s192_e.pdf
    https://archiv.rme-audio.de/download/ai4s192_e.pdf
    
    Reviewed by: Florian Walpen <dev@submerge.ch>
    Differential Revision: https://reviews.freebsd.org/D46409
---
 sys/dev/sound/pci/hdspe-pcm.c |  4 ++++
 sys/dev/sound/pci/hdspe.c     |  1 +
 sys/dev/sound/pci/hdspe.h     | 22 ++++++++++++----------
 3 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/sys/dev/sound/pci/hdspe-pcm.c b/sys/dev/sound/pci/hdspe-pcm.c
index 79bfcbea3406..322fd69723c0 100644
--- a/sys/dev/sound/pci/hdspe-pcm.c
+++ b/sys/dev/sound/pci/hdspe-pcm.c
@@ -136,6 +136,8 @@ hdspe_channel_count(uint32_t ports, uint32_t adat_width)
 		/* AIO ports. */
 		if (ports & HDSPE_CHAN_AIO_LINE)
 			count += 2;
+		if (ports & HDSPE_CHAN_AIO_EXT)
+			count += 4;
 		if (ports & HDSPE_CHAN_AIO_PHONE)
 			count += 2;
 		if (ports & HDSPE_CHAN_AIO_AES)
@@ -189,6 +191,8 @@ hdspe_port_slot_offset(uint32_t port, unsigned int adat_width)
 	/* AIO ports */
 	case HDSPE_CHAN_AIO_LINE:
 		return (0);
+	case HDSPE_CHAN_AIO_EXT:
+		return (2);
 	case HDSPE_CHAN_AIO_PHONE:
 		return (6);
 	case HDSPE_CHAN_AIO_AES:
diff --git a/sys/dev/sound/pci/hdspe.c b/sys/dev/sound/pci/hdspe.c
index 66f5bc5c5d7a..0e25e9599328 100644
--- a/sys/dev/sound/pci/hdspe.c
+++ b/sys/dev/sound/pci/hdspe.c
@@ -78,6 +78,7 @@ static struct hdspe_clock_source hdspe_clock_source_table_aio[] = {
 
 static struct hdspe_channel chan_map_aio[] = {
 	{ HDSPE_CHAN_AIO_LINE,    "line" },
+	{ HDSPE_CHAN_AIO_EXT,      "ext" },
 	{ HDSPE_CHAN_AIO_PHONE,  "phone" },
 	{ HDSPE_CHAN_AIO_AES,      "aes" },
 	{ HDSPE_CHAN_AIO_SPDIF, "s/pdif" },
diff --git a/sys/dev/sound/pci/hdspe.h b/sys/dev/sound/pci/hdspe.h
index daffeb4ddebc..2f0bdddd930f 100644
--- a/sys/dev/sound/pci/hdspe.h
+++ b/sys/dev/sound/pci/hdspe.h
@@ -119,23 +119,25 @@
 #define	HDSPE_DMASEGSIZE		(HDSPE_CHANBUF_SIZE * HDSPE_MAX_SLOTS)
 
 #define	HDSPE_CHAN_AIO_LINE		(1 << 0)
-#define	HDSPE_CHAN_AIO_PHONE		(1 << 1)
-#define	HDSPE_CHAN_AIO_AES		(1 << 2)
-#define	HDSPE_CHAN_AIO_SPDIF		(1 << 3)
-#define	HDSPE_CHAN_AIO_ADAT		(1 << 4)
+#define	HDSPE_CHAN_AIO_EXT		(1 << 1)
+#define	HDSPE_CHAN_AIO_PHONE		(1 << 2)
+#define	HDSPE_CHAN_AIO_AES		(1 << 3)
+#define	HDSPE_CHAN_AIO_SPDIF		(1 << 4)
+#define	HDSPE_CHAN_AIO_ADAT		(1 << 5)
 #define	HDSPE_CHAN_AIO_ALL_REC		(HDSPE_CHAN_AIO_LINE | \
+					HDSPE_CHAN_AIO_EXT | \
 					HDSPE_CHAN_AIO_AES | \
 					HDSPE_CHAN_AIO_SPDIF | \
 					HDSPE_CHAN_AIO_ADAT)
 #define	HDSPE_CHAN_AIO_ALL		(HDSPE_CHAN_AIO_ALL_REC | \
 					HDSPE_CHAN_AIO_PHONE) \
 
-#define	HDSPE_CHAN_RAY_AES		(1 << 5)
-#define	HDSPE_CHAN_RAY_SPDIF		(1 << 6)
-#define	HDSPE_CHAN_RAY_ADAT1		(1 << 7)
-#define	HDSPE_CHAN_RAY_ADAT2		(1 << 8)
-#define	HDSPE_CHAN_RAY_ADAT3		(1 << 9)
-#define	HDSPE_CHAN_RAY_ADAT4		(1 << 10)
+#define	HDSPE_CHAN_RAY_AES		(1 << 6)
+#define	HDSPE_CHAN_RAY_SPDIF		(1 << 7)
+#define	HDSPE_CHAN_RAY_ADAT1		(1 << 8)
+#define	HDSPE_CHAN_RAY_ADAT2		(1 << 9)
+#define	HDSPE_CHAN_RAY_ADAT3		(1 << 10)
+#define	HDSPE_CHAN_RAY_ADAT4		(1 << 11)
 #define	HDSPE_CHAN_RAY_ALL		(HDSPE_CHAN_RAY_AES | \
 					HDSPE_CHAN_RAY_SPDIF | \
 					HDSPE_CHAN_RAY_ADAT1 | \