summaryrefslogtreecommitdiffstats
path: root/meta-audio-4a-framework/recipes-multimedia/4a-hal-config
diff options
context:
space:
mode:
authorStephane Desneux <stephane.desneux@iot.bzh>2017-11-11 19:00:27 +0100
committerStephane Desneux <stephane.desneux@iot.bzh>2017-11-11 23:44:36 +0100
commit54447aa1f8eb8366567a96f45713fd1cae036e1e (patch)
tree4b64dd821e616967bc15e33e135ce81704b6bb65 /meta-audio-4a-framework/recipes-multimedia/4a-hal-config
parentc3ec51de4f611d0c841cbae34611bfdf4cf8628f (diff)
Initial integration of 4A (AGL Advance Audio Agent)
This is a move of the work done initially by Ronan Le Martret <ronan.lemartret@iot.bzh> in https://gerrit.automotivelinux.org/gerrit/#/c/11651/ Change-Id: I3c2124b186e72fd9804ff713b22a36a93283650e Signed-off-by: Stephane Desneux <stephane.desneux@iot.bzh>
Diffstat (limited to 'meta-audio-4a-framework/recipes-multimedia/4a-hal-config')
-rw-r--r--meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb40
-rw-r--r--meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template36
-rw-r--r--meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template136
3 files changed, 212 insertions, 0 deletions
diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb
new file mode 100644
index 00000000..32f42299
--- /dev/null
+++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/4a-hal-config.bb
@@ -0,0 +1,40 @@
+SUMMARY = "4A - HAL Configuration"
+DESCRIPTION = "Configuration files for HALs used in 4A (AGL Advanced Audio Agent)"
+HOMEPAGE = "https://git.automotivelinux.org/src/4a-hal-reference/"
+SECTION = "apps"
+
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/Apache-2.0;md5=89aea4e17d99a7cacdbeed46a0096b10"
+
+SRC_URI = "file://asound.conf.template \
+ file://ahl-config.json.template \
+ "
+
+PV = "0.1"
+
+RPROVIDES_${PN} = "virtual/4a-hal-config"
+
+PACKAGE_ARCH = "${MACHINE_ARCH}"
+
+AUDIO_DEV_NAME ?= "Speakers"
+AUDIO_DEV_NAME_ID ?= "usb-audio"
+
+AUDIO_DEV_NAME_m3ulcb = "M3-Speakers"
+AUDIO_DEV_NAME_ID_m3ulcb = "rsnddai0ak4613h"
+
+inherit afb-system
+
+do_install () {
+ install -d ${D}/${sysconfdir}
+ install -m 0755 ${WORKDIR}/asound.conf.template ${D}/${sysconfdir}/asound.conf
+ sed -i "s|@AUDIO_DEV_NAME@|${AUDIO_DEV_NAME}|g" ${D}/${sysconfdir}/asound.conf
+ sed -i "s|@AUDIO_DEV_NAME_ID@|${AUDIO_DEV_NAME_ID}|g" ${D}/${sysconfdir}/asound.conf
+ sed -i "s|@INSTALL_PREFIX@|${INSTALL_PREFIX}|g" ${D}/${sysconfdir}/asound.conf
+
+ install -d "${D}${prefix}/agl-service-audio-4a"
+ install -m 0755 ${WORKDIR}/ahl-config.json.template "${D}${prefix}/agl-service-audio-4a/ahl-agl-service-audio-4a-config.json"
+ sed -i "s|@AUDIO_DEV_NAME_ID@|${AUDIO_DEV_NAME_ID}|g" "${D}${prefix}/agl-service-audio-4a/ahl-agl-service-audio-4a-config.json"
+}
+
+FILES_${PN} += "${sysconfdir}/asound.conf"
+FILES_${PN} += "${prefix}/agl-service-audio-4a/ahl-agl-service-audio-4a-config.json"
diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template
new file mode 100644
index 00000000..82e9668d
--- /dev/null
+++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/ahl-config.json.template
@@ -0,0 +1,36 @@
+{
+ "version": "0.2.0",
+ "policy_module": "AudioPolicy_v1",
+ "description": "High-level binding configuration file",
+ "note": "Devices and routings are always listed in order of priority (for device selection rules)",
+ "hal_list": ["@AUDIO_DEV_NAME_ID@"],
+ "audio_roles": [
+ {
+ "name": "Guidance",
+ "description": "Important user information where user action is expected (e.g. navigation instruction)",
+ "priority": 25,
+ "output": [
+ "alsa.plug:Guidance_Main"
+ ],
+ "interupt_behavior": "continue"
+ },
+ {
+ "name": "Notification",
+ "description": "HMI or else notifications (e.g. touchscreen events, speech recognition on/off,...)",
+ "priority": 100,
+ "output": [
+ "alsa.plug:Notification_Main"
+ ],
+ "interupt_behavior": "pause"
+ },
+ {
+ "name": "Entertainment",
+ "description": "Multimedia content (e.g. tuner, media player, etc.)",
+ "priority": 0,
+ "output": [
+ "alsa.plug:Entertainment_Main"
+ ],
+ "interupt_behavior": "pause"
+ }
+ ]
+}
diff --git a/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template
new file mode 100644
index 00000000..87e833da
--- /dev/null
+++ b/meta-audio-4a-framework/recipes-multimedia/4a-hal-config/files/asound.conf.template
@@ -0,0 +1,136 @@
+
+# ------------------------------------------------------
+# Mixer PCM allow to play multiple stream simultaneously
+# ------------------------------------------------------
+pcm.@AUDIO_DEV_NAME@ {
+ type dmix
+ slave {pcm "hw:@AUDIO_DEV_NAME_ID@"} #
+ ipc_key 1001 # ipc_key should be unique to each dmix
+}
+
+# -----------------------------------------------------
+# Register ControllerHookPlugin (ToiBeFix fullpath)
+# -----------------------------------------------------
+pcm_hook_type.CtlHookPlugin {
+ install "AlsaInstallHook"
+ lib "@INSTALL_PREFIX@/lib/policy_alsa_hook.so"
+}
+
+
+# -------------------------------------------------------
+# Define one Audio Virtual Channel per Audio Roles
+# -------------------------------------------------------
+pcm.MusicPCM {
+ type softvol
+
+ # Point Slave on HOOK for policies control
+ slave.pcm "@AUDIO_DEV_NAME@"
+
+ # name should match with HAL definition
+ control.name "Playback Multimedia"
+}
+
+pcm.NaviPCM {
+ type softvol
+
+ # Point Slave on HOOK for policies control
+ slave.pcm "@AUDIO_DEV_NAME@"
+
+ # name should match with HAL definition
+ control.name "Playback Navigation"
+}
+
+pcm.UrgentPCM {
+ type softvol
+
+ # Point Slave on HOOK for policies control
+ slave.pcm "@AUDIO_DEV_NAME@"
+
+ # name should match with HAL definition
+ control.name "Playback Emergency"
+}
+
+# ----------------------------------------------------
+# Define one hooked PCM channel per Audio Roles
+# ----------------------------------------------------
+pcm.Multimedia {
+ type hooks
+ slave {pcm "MusicPCM"}
+ hooks.0 {
+ comment "Defined used hook sharelib and provide arguments/config to install func"
+ type "CtlHookPlugin"
+ hook_args {
+
+ # print few log messages (default false)
+ verbose true
+
+ # uri to audio-4a policy engine
+ uri="unix:/var/tmp/pol4a"
+
+ # timeout in ms (default 500)
+ timeout 5000
+
+ # force API synchronous mode
+ synchronous true
+
+ # api subcall to request a role
+ request {
+ multimedia-role "{'uid':'alsa-hook-client'}"
+ signal-timeout "{'timeout':180, 'music':'quit'}"
+ }
+
+ # api subcall to request a role
+ release {
+ release-role "{'uid':'alsa-hook-client'}"
+ }
+
+ # map AGL event on Unix signal. Search in event for json key=value
+ events {
+ sig-02 {search music, value quit}
+ sig-31 {search event, value start}
+ sig-32 {search event, value start}
+ }
+ }
+ }
+}
+
+pcm.Navigation {
+ type hooks
+ slave {pcm "NaviPCM"}
+ hooks.0 {
+ comment "Defined used hook sharelib and provide arguments/config to install func"
+ type "CtlHookPlugin"
+ hook_args {
+
+ # print few log messages (default false)
+ verbose true
+
+ # uri to audio-4a policy engine
+ uri="unix:/var/tmp/pol4a"
+
+ # timeout in ms (default 500)
+ timeout 5000
+
+ # force API synchronous mode
+ synchronous true
+
+ # api subcall to request a role
+ request {
+ navigation-role "{'uid':'alsa-hook-client'}"
+ signal-timeout "{'timeout':5, 'navi':'quit'}"
+ }
+
+ # api subcall to request a role
+ release {
+ release-role "{'uid':'alsa-hook-client'}"
+ }
+
+ # map AGL event on Unix signal. Search in event for json key=value
+ events {
+ sig-02 {search navi, value quit}
+ sig-31 {search event, value start}
+ sig-32 {search event, value start}
+ }
+ }
+ }
+}