summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Farrugia <mark.farrugia@fiberdyne.com.au>2018-11-13 08:52:36 +1100
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2018-11-20 14:30:01 +0000
commite820f7b2e1428558ee20a3d0efe9cd5038f83439 (patch)
treeb4f1ecd22caba70738b2ae94e8a5ce2cfaa254af
parent4dc43a796722010ae3ed85fb1f0d7076e740ad38 (diff)
Add initial recipes for snd-avirt driver
The snd-avirt driver will provide an enhanced, dynamic ALSA loopback interface for 4a-softmixer, and provides the audio framework for low-latency audio hardmixers such as the Fiberdyne DSP onboard the Xtensa HiFi2, and the UNICENs Fiberdyne smart amplifier. Included are backport patches for kernels 4.12 and 4.9. Change-Id: I8b23507d7179d10dfa70b7f2f899db4534690392 Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
-rw-r--r--meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb1
-rw-r--r--meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0001-snd-avirt-backport-kernel-4.12-api.patch32
-rw-r--r--meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0002-snd-avirt-backport-kernel-4.9-api.patch63
-rw-r--r--meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bb14
-rw-r--r--meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bbappend22
5 files changed, 132 insertions, 0 deletions
diff --git a/meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb b/meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb
index e8926363..e6beb2ed 100644
--- a/meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb
+++ b/meta-audio-4a-framework/recipes-core/packagegroups/packagegroup-agl-audio.bb
@@ -16,6 +16,7 @@ RDEPENDS_${PN} += "\
bluez-alsa \
4a-softmixer \
4a-hal-generic \
+ snd-avirt \
${@bb.utils.contains('DISTRO_FEATURES', 'agl-devel', '4a-tools', '' , d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'pulseaudio', 'pulseaudio-module-4a-client', '' , d)} \
"
diff --git a/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0001-snd-avirt-backport-kernel-4.12-api.patch b/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0001-snd-avirt-backport-kernel-4.12-api.patch
new file mode 100644
index 00000000..689d64f4
--- /dev/null
+++ b/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0001-snd-avirt-backport-kernel-4.12-api.patch
@@ -0,0 +1,32 @@
+From ea9a8ede7f343d589c8d9fac945f7b3d9dca9c3f Mon Sep 17 00:00:00 2001
+From: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
+Date: Thu, 15 Nov 2018 09:47:29 +1100
+Subject: [PATCH] snd-avirt-backport-Kernel-API
+
+Backport snd-pcm-ops struct callbacks for kernels prior to
+4.13
+
+Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
+---
+ core.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/core.c b/core.c
+index 35998c0..6fd3ab3 100644
+--- a/core.c
++++ b/core.c
+@@ -250,9 +250,8 @@ static struct snd_pcm *pcm_create(struct snd_avirt_stream *stream)
+ PCM_OPS_SET(pcm_ops_ap, &pcm_ops, trigger);
+ PCM_OPS_SET(pcm_ops_ap, &pcm_ops, pointer);
+ PCM_OPS_SET(pcm_ops_ap, &pcm_ops, get_time_info);
+- PCM_OPS_SET(pcm_ops_ap, &pcm_ops, fill_silence);
+- PCM_OPS_SET(pcm_ops_ap, &pcm_ops, copy_user);
+- PCM_OPS_SET(pcm_ops_ap, &pcm_ops, copy_kernel);
++ PCM_OPS_SET(pcm_ops_ap, &pcm_ops, silence);
++ PCM_OPS_SET(pcm_ops_ap, &pcm_ops, copy);
+ PCM_OPS_SET(pcm_ops_ap, &pcm_ops, mmap);
+ PCM_OPS_SET(pcm_ops_ap, &pcm_ops, ack);
+
+--
+2.17.1
+
diff --git a/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0002-snd-avirt-backport-kernel-4.9-api.patch b/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0002-snd-avirt-backport-kernel-4.9-api.patch
new file mode 100644
index 00000000..fa944da0
--- /dev/null
+++ b/meta-audio-4a-framework/recipes-kernel/snd-avirt/files/0002-snd-avirt-backport-kernel-4.9-api.patch
@@ -0,0 +1,63 @@
+From fe7fc04e4f685c72b4f971ca0e23b10d683cffe0 Mon Sep 17 00:00:00 2001
+From: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
+Date: Fri, 16 Nov 2018 16:10:12 +1100
+Subject: [PATCH] snd-avirt-backport-kernel-4.9-api
+
+---
+ dummy/dummy.c | 6 +++---
+ loopback/loopback.c | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/dummy/dummy.c b/dummy/dummy.c
+index f683b92..c37be09 100644
+--- a/dummy/dummy.c
++++ b/dummy/dummy.c
+@@ -125,9 +125,9 @@ static int dummy_systimer_prepare(struct snd_pcm_substream *substream)
+ return 0;
+ }
+
+-static void dummy_systimer_callback(struct timer_list *t)
++static void dummy_systimer_callback(unsigned long data)
+ {
+- struct dummy_systimer_pcm *dpcm = from_timer(dpcm, t, timer);
++ struct dummy_systimer_pcm *dpcm = (struct dummy_systimer_pcm *)data;
+ unsigned long flags;
+ int elapsed = 0;
+
+@@ -162,7 +162,7 @@ static int dummy_systimer_create(struct snd_pcm_substream *substream)
+ if (!dpcm)
+ return -ENOMEM;
+ substream->runtime->private_data = dpcm;
+- timer_setup(&dpcm->timer, dummy_systimer_callback, 0);
++ setup_timer(&dpcm->timer, dummy_systimer_callback, (unsigned long)dpcm);
+ spin_lock_init(&dpcm->lock);
+ dpcm->substream = substream;
+ return 0;
+diff --git a/loopback/loopback.c b/loopback/loopback.c
+index 4181392..6667a69 100644
+--- a/loopback/loopback.c
++++ b/loopback/loopback.c
+@@ -498,9 +498,9 @@ unlock:
+ return running;
+ }
+
+-static void loopback_timer_function(struct timer_list *t)
++static void loopback_timer_function(unsigned long data)
+ {
+- struct loopback_pcm *dpcm = from_timer(dpcm, t, timer);
++ struct loopback_pcm *dpcm = (struct loopback_pcm *)data;
+ unsigned long flags;
+
+ spin_lock_irqsave(&dpcm->cable->lock, flags);
+@@ -652,7 +652,7 @@ static int loopback_open(struct snd_pcm_substream *substream)
+ }
+ dpcm->loopback = loopback;
+ dpcm->substream = substream;
+- timer_setup(&dpcm->timer, loopback_timer_function, 0);
++ setup_timer(&dpcm->timer, loopback_timer_function, (unsigned long)dpcm);
+
+ cable = loopback->cables[substream->pcm->device];
+ if (!cable) {
+--
+2.17.1
+
diff --git a/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bb b/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bb
new file mode 100644
index 00000000..6a5c9904
--- /dev/null
+++ b/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bb
@@ -0,0 +1,14 @@
+DESCRIPTION = "Build SND_AVIRT driver"
+LICENSE = "GPLv2"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0;md5=801f80980d171dd6425610833a22dbe6"
+
+inherit module
+
+PV = "0.1"
+
+SRC_URI = "git://gerrit.automotivelinux.org/gerrit/src/avirt;protocol=https;branch=${AGL_BRANCH}"
+
+S = "${WORKDIR}/git"
+SRCREV = "0b7527a463a9f494e15e067ff7bbc604f24fac3a"
+
+KERNEL_MODULE_AUTOLOAD += "snd-avirt-core snd-avirt-ap-loopback"
diff --git a/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bbappend b/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bbappend
new file mode 100644
index 00000000..3c9fea0e
--- /dev/null
+++ b/meta-audio-4a-framework/recipes-kernel/snd-avirt/snd-avirt.bbappend
@@ -0,0 +1,22 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+def prep_version (d) :
+ KV = d.getVar('KERNEL_VERSION', True)
+ if not KV :
+ return "4.12"
+ else:
+ return KV
+
+ORIG_KERN_VER = "${@prep_version(d)}"
+
+VANILLA_KERNEL_VERSION = "${@str(ORIG_KERN_VER.split("-")[0].split(".")[0]+ORIG_KERN_VER.split("-")[0].split(".")[1])}"
+
+APPLY_0001 = "${@str('no' if ${VANILLA_KERNEL_VERSION} > 412 else 'yes')}"
+APPLY_0002 = "${@str('no' if ${VANILLA_KERNEL_VERSION} > 49 else 'yes')}"
+
+SRC_URI_append = " \
+ file://0001-snd-avirt-backport-kernel-4.12-api.patch;apply=${APPLY_0001} \
+ file://0002-snd-avirt-backport-kernel-4.9-api.patch;apply=${APPLY_0002} \
+ "
+# Make sure we can expose KERNEL_VERSION ...
+do_patch[depends] += "virtual/kernel:do_populate_sysroot"