mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
Merge pull request #806 from Kwiboo/aml-audio
C2/Hub/Play2: Simplify passthrough audio
This commit is contained in:
commit
4417cf4f92
@ -39,7 +39,7 @@ case "$LINUX" in
|
||||
PKG_SOURCE_DIR="$PKG_NAME-amlogic-$PKG_VERSION*"
|
||||
;;
|
||||
amlogic-3.14)
|
||||
PKG_VERSION="eb67324"
|
||||
PKG_VERSION="069e204"
|
||||
PKG_URL="https://github.com/LibreELEC/linux-amlogic/archive/$PKG_VERSION.tar.gz"
|
||||
PKG_SOURCE_DIR="$PKG_NAME-amlogic-$PKG_VERSION*"
|
||||
;;
|
||||
|
@ -19,7 +19,7 @@ index ac76ef6..cf0e929 100644
|
||||
-#define STUB_RATES SNDRV_PCM_RATE_8000_192000
|
||||
-#define STUB_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | \
|
||||
- SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
|
||||
+#define STUB_RATES SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000
|
||||
+#define STUB_RATES SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000
|
||||
+#define STUB_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE
|
||||
|
||||
struct pinctrl *pin_spdif_ctl;
|
||||
@ -48,7 +48,7 @@ index 3626676..d2ebad1 100644
|
||||
-#define AML_DAI_I2S_RATES (SNDRV_PCM_RATE_8000_192000)
|
||||
-#define AML_DAI_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
|
||||
- SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
|
||||
+#define AML_DAI_I2S_RATES SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000
|
||||
+#define AML_DAI_I2S_RATES SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000
|
||||
+#define AML_DAI_I2S_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE
|
||||
|
||||
static struct snd_soc_dai_ops aml_dai_i2s_ops = {
|
||||
|
@ -0,0 +1,24 @@
|
||||
From 370709ff0bd108a8bf66656e1424c38341e0b0ac Mon Sep 17 00:00:00 2001
|
||||
From: Jonas Karlman <jonas@kwiboo.se>
|
||||
Date: Fri, 7 Oct 2016 13:42:10 +0200
|
||||
Subject: [PATCH] AESinkALSA: force default device for non-passthrough
|
||||
|
||||
---
|
||||
xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 3 +--
|
||||
1 file changed, 1 insertion(+), 2 deletions(-)
|
||||
|
||||
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
|
||||
index 6a9066b..4d7f85d 100644
|
||||
--- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
|
||||
+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
|
||||
@@ -535,9 +535,8 @@ bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device)
|
||||
m_passthrough = false;
|
||||
}
|
||||
#if defined(HAS_LIBAMCODEC)
|
||||
- if (aml_present())
|
||||
+ if (!m_passthrough && aml_present())
|
||||
{
|
||||
- aml_set_audio_passthrough(m_passthrough);
|
||||
device = "default";
|
||||
}
|
||||
#endif
|
@ -1,103 +0,0 @@
|
||||
From a49dd2258d46279466d5aaba44d1f0ee06253ff2 Mon Sep 17 00:00:00 2001
|
||||
From: kszaq <kszaquitto@gmail.com>
|
||||
Date: Sun, 4 Sep 2016 00:51:03 +0200
|
||||
Subject: [PATCH] [aml] Multichannel-PCM and HD Audio passthrough
|
||||
|
||||
1. If we want passthrough, is should be redirected to device 1. To make sure device 1 output is enabled, set device 0 to stereo.
|
||||
2. Set digital_codec parameter to notify sound driver about audio format.
|
||||
3. Amlogic wants 48kHz for EAC3 passthrough.
|
||||
4. Identify Amlogic audio output as HDMI.
|
||||
---
|
||||
xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 59 +++++++++++++++++++++++++++--
|
||||
1 file changed, 55 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
|
||||
index 6a9066b..9741e3e 100644
|
||||
--- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
|
||||
+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "settings/AdvancedSettings.h"
|
||||
#if defined(HAS_LIBAMCODEC)
|
||||
#include "utils/AMLUtils.h"
|
||||
+#include "utils/SysfsUtils.h"
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_POSIX
|
||||
@@ -534,13 +535,57 @@ bool CAESinkALSA::Initialize(AEAudioFormat &format, std::string &device)
|
||||
{
|
||||
m_passthrough = false;
|
||||
}
|
||||
-#if defined(HAS_LIBAMCODEC)
|
||||
- if (aml_present())
|
||||
+
|
||||
+ if (device.find("M8AUDIO") != std::string::npos)
|
||||
{
|
||||
+ int aml_digital_codec = 0;
|
||||
+
|
||||
+ if (m_passthrough)
|
||||
+ {
|
||||
+ /* Open 2 channels at device 0 to enable device 1 output to HDMI */
|
||||
+ ALSAConfig m_inconfig, m_outconfig;
|
||||
+ snd_config_t *config;
|
||||
+ m_inconfig = inconfig;
|
||||
+ m_inconfig.channels = 2;
|
||||
+ snd_config_copy(&config, snd_config);
|
||||
+ OpenPCMDevice("hw:AMLM8AUDIO,0", "", m_inconfig.channels, &m_pcm, config);
|
||||
+ snd_config_delete(config);
|
||||
+ InitializeHW(m_inconfig, m_outconfig);
|
||||
+
|
||||
+ /* Passthrough is supported only by device 1 */
|
||||
+ device = "hw:AMLM8AUDIO,1";
|
||||
+
|
||||
+ switch(format.m_streamInfo.m_type)
|
||||
+ {
|
||||
+ case CAEStreamInfo::STREAM_TYPE_AC3:
|
||||
+ aml_digital_codec = 2;
|
||||
+ break;
|
||||
+
|
||||
+ case CAEStreamInfo::STREAM_TYPE_DTS_512:
|
||||
+ case CAEStreamInfo::STREAM_TYPE_DTS_1024:
|
||||
+ case CAEStreamInfo::STREAM_TYPE_DTS_2048:
|
||||
+ case CAEStreamInfo::STREAM_TYPE_DTSHD_CORE:
|
||||
+ aml_digital_codec = 3;
|
||||
+ break;
|
||||
+
|
||||
+ case CAEStreamInfo::STREAM_TYPE_EAC3:
|
||||
+ aml_digital_codec = 4;
|
||||
+ inconfig.sampleRate = 48000;
|
||||
+ break;
|
||||
+
|
||||
+ case CAEStreamInfo::STREAM_TYPE_DTSHD:
|
||||
+ aml_digital_codec = 8;
|
||||
+ break;
|
||||
+
|
||||
+ case CAEStreamInfo::STREAM_TYPE_TRUEHD:
|
||||
+ aml_digital_codec = 7;
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
aml_set_audio_passthrough(m_passthrough);
|
||||
- device = "default";
|
||||
+ SysfsUtils::SetInt("/sys/class/audiodsp/digital_codec", aml_digital_codec);
|
||||
}
|
||||
-#endif
|
||||
|
||||
if (inconfig.channels == 0)
|
||||
{
|
||||
@@ -1550,6 +1595,12 @@ void CAESinkALSA::EnumerateDevice(AEDeviceInfoList &list, const std::string &dev
|
||||
info.m_dataFormats.push_back(i);
|
||||
}
|
||||
|
||||
+ if (info.m_displayName.find("M8AUDIO") != std::string::npos)
|
||||
+ {
|
||||
+ info.m_displayNameExtra = "HDMI";
|
||||
+ info.m_deviceType = AE_DEVTYPE_HDMI;
|
||||
+ }
|
||||
+
|
||||
if (info.m_deviceType == AE_DEVTYPE_HDMI)
|
||||
{
|
||||
// we don't trust ELD information and push back our supported formats explicitely
|
||||
--
|
||||
1.8.3.1
|
||||
|
@ -3,18 +3,6 @@
|
||||
#
|
||||
|
||||
AML-M8AUDIO.pcm.default {
|
||||
@args [ CARD ]
|
||||
@args.CARD { type string }
|
||||
type plug
|
||||
slave.pcm {
|
||||
@func concat
|
||||
strings [ "dmix:" $CARD ]
|
||||
}
|
||||
}
|
||||
|
||||
<confdir:pcm/front.conf>
|
||||
|
||||
AML-M8AUDIO.pcm.front.0 {
|
||||
@args [ CARD ]
|
||||
@args.CARD { type string }
|
||||
type hw
|
||||
@ -23,30 +11,33 @@ AML-M8AUDIO.pcm.front.0 {
|
||||
format S32_LE
|
||||
}
|
||||
|
||||
<confdir:pcm/surround71.conf>
|
||||
<confdir:pcm/hdmi.conf>
|
||||
|
||||
AML-M8AUDIO.pcm.surround71.0 {
|
||||
@args [ CARD ]
|
||||
AML-M8AUDIO.pcm.hdmi.0 {
|
||||
@args [ CARD AES0 AES1 AES2 AES3 ]
|
||||
@args.CARD { type string }
|
||||
type route
|
||||
ttable.0.0 1
|
||||
ttable.1.1 1
|
||||
ttable.2.6 1
|
||||
ttable.3.7 1
|
||||
ttable.4.3 1
|
||||
ttable.5.2 1
|
||||
ttable.6.4 1
|
||||
ttable.7.5 1
|
||||
@args.AES0 { type integer }
|
||||
@args.AES1 { type integer }
|
||||
@args.AES2 { type integer }
|
||||
@args.AES3 { type integer }
|
||||
type hooks
|
||||
slave.pcm {
|
||||
type plug
|
||||
slave {
|
||||
pcm {
|
||||
type hw
|
||||
card $CARD
|
||||
device 0
|
||||
type hw
|
||||
card $CARD
|
||||
device 1
|
||||
format S16_LE
|
||||
}
|
||||
hooks.0 {
|
||||
type ctl_elems
|
||||
hook_args [
|
||||
{
|
||||
interface MIXER
|
||||
name "IEC958 Playback Default"
|
||||
lock true
|
||||
preserve true
|
||||
optional true
|
||||
value [ $AES0 $AES1 $AES2 $AES3 ]
|
||||
}
|
||||
channels 8
|
||||
format S32_LE
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,6 @@ CONFIG_PROC_PID_CPUSET=y
|
||||
CONFIG_CGROUP_CPUACCT=y
|
||||
CONFIG_RESOURCE_COUNTERS=y
|
||||
# CONFIG_MEMCG is not set
|
||||
CONFIG_CGROUP_PERF=y
|
||||
CONFIG_CGROUP_SCHED=y
|
||||
CONFIG_FAIR_GROUP_SCHED=y
|
||||
CONFIG_CFS_BANDWIDTH=y
|
||||
@ -173,8 +172,7 @@ CONFIG_PERF_USE_VMALLOC=y
|
||||
#
|
||||
# Kernel Performance Events And Counters
|
||||
#
|
||||
CONFIG_PERF_EVENTS=y
|
||||
# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
|
||||
# CONFIG_PERF_EVENTS is not set
|
||||
CONFIG_VM_EVENT_COUNTERS=y
|
||||
CONFIG_SLUB_DEBUG=y
|
||||
CONFIG_COMPAT_BRK=y
|
||||
@ -194,7 +192,6 @@ CONFIG_HAVE_DMA_CONTIGUOUS=y
|
||||
CONFIG_GENERIC_SMP_IDLE_THREAD=y
|
||||
CONFIG_HAVE_CLK=y
|
||||
CONFIG_HAVE_DMA_API_DEBUG=y
|
||||
CONFIG_HAVE_HW_BREAKPOINT=y
|
||||
CONFIG_HAVE_PERF_REGS=y
|
||||
CONFIG_HAVE_PERF_USER_STACK_DUMP=y
|
||||
CONFIG_HAVE_ARCH_JUMP_LABEL=y
|
||||
@ -309,7 +306,6 @@ CONFIG_ARCH_SPARSEMEM_ENABLE=y
|
||||
CONFIG_ARCH_SPARSEMEM_DEFAULT=y
|
||||
CONFIG_ARCH_SELECT_MEMORY_MODEL=y
|
||||
CONFIG_HAVE_ARCH_PFN_VALID=y
|
||||
CONFIG_HW_PERF_EVENTS=y
|
||||
CONFIG_ARMV7_COMPAT=y
|
||||
CONFIG_ARMV7_COMPAT_CPUINFO=y
|
||||
CONFIG_SYS_SUPPORTS_HUGETLBFS=y
|
||||
@ -1138,7 +1134,6 @@ CONFIG_AML_AO_CEC=y
|
||||
# Amlogic Crypto Support
|
||||
#
|
||||
# CONFIG_CRYPTO_AML is not set
|
||||
# CONFIG_AMLOGIC_WATCHPOINT is not set
|
||||
|
||||
#
|
||||
# Generic Driver Options
|
||||
|
@ -3,18 +3,6 @@
|
||||
#
|
||||
|
||||
AML-M8AUDIO.pcm.default {
|
||||
@args [ CARD ]
|
||||
@args.CARD { type string }
|
||||
type plug
|
||||
slave.pcm {
|
||||
@func concat
|
||||
strings [ "dmix:" $CARD ]
|
||||
}
|
||||
}
|
||||
|
||||
<confdir:pcm/front.conf>
|
||||
|
||||
AML-M8AUDIO.pcm.front.0 {
|
||||
@args [ CARD ]
|
||||
@args.CARD { type string }
|
||||
type hw
|
||||
@ -23,30 +11,33 @@ AML-M8AUDIO.pcm.front.0 {
|
||||
format S32_LE
|
||||
}
|
||||
|
||||
<confdir:pcm/surround71.conf>
|
||||
<confdir:pcm/hdmi.conf>
|
||||
|
||||
AML-M8AUDIO.pcm.surround71.0 {
|
||||
@args [ CARD ]
|
||||
AML-M8AUDIO.pcm.hdmi.0 {
|
||||
@args [ CARD AES0 AES1 AES2 AES3 ]
|
||||
@args.CARD { type string }
|
||||
type route
|
||||
ttable.0.0 1
|
||||
ttable.1.1 1
|
||||
ttable.2.6 1
|
||||
ttable.3.7 1
|
||||
ttable.4.3 1
|
||||
ttable.5.2 1
|
||||
ttable.6.4 1
|
||||
ttable.7.5 1
|
||||
@args.AES0 { type integer }
|
||||
@args.AES1 { type integer }
|
||||
@args.AES2 { type integer }
|
||||
@args.AES3 { type integer }
|
||||
type hooks
|
||||
slave.pcm {
|
||||
type plug
|
||||
slave {
|
||||
pcm {
|
||||
type hw
|
||||
card $CARD
|
||||
device 0
|
||||
type hw
|
||||
card $CARD
|
||||
device 1
|
||||
format S16_LE
|
||||
}
|
||||
hooks.0 {
|
||||
type ctl_elems
|
||||
hook_args [
|
||||
{
|
||||
interface MIXER
|
||||
name "IEC958 Playback Default"
|
||||
lock true
|
||||
preserve true
|
||||
optional true
|
||||
value [ $AES0 $AES1 $AES2 $AES3 ]
|
||||
}
|
||||
channels 8
|
||||
format S32_LE
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -3,18 +3,6 @@
|
||||
#
|
||||
|
||||
AML-M8AUDIO.pcm.default {
|
||||
@args [ CARD ]
|
||||
@args.CARD { type string }
|
||||
type plug
|
||||
slave.pcm {
|
||||
@func concat
|
||||
strings [ "dmix:" $CARD ]
|
||||
}
|
||||
}
|
||||
|
||||
<confdir:pcm/front.conf>
|
||||
|
||||
AML-M8AUDIO.pcm.front.0 {
|
||||
@args [ CARD ]
|
||||
@args.CARD { type string }
|
||||
type hw
|
||||
@ -23,30 +11,33 @@ AML-M8AUDIO.pcm.front.0 {
|
||||
format S32_LE
|
||||
}
|
||||
|
||||
<confdir:pcm/surround71.conf>
|
||||
<confdir:pcm/hdmi.conf>
|
||||
|
||||
AML-M8AUDIO.pcm.surround71.0 {
|
||||
@args [ CARD ]
|
||||
AML-M8AUDIO.pcm.hdmi.0 {
|
||||
@args [ CARD AES0 AES1 AES2 AES3 ]
|
||||
@args.CARD { type string }
|
||||
type route
|
||||
ttable.0.0 1
|
||||
ttable.1.1 1
|
||||
ttable.2.6 1
|
||||
ttable.3.7 1
|
||||
ttable.4.3 1
|
||||
ttable.5.2 1
|
||||
ttable.6.4 1
|
||||
ttable.7.5 1
|
||||
@args.AES0 { type integer }
|
||||
@args.AES1 { type integer }
|
||||
@args.AES2 { type integer }
|
||||
@args.AES3 { type integer }
|
||||
type hooks
|
||||
slave.pcm {
|
||||
type plug
|
||||
slave {
|
||||
pcm {
|
||||
type hw
|
||||
card $CARD
|
||||
device 0
|
||||
type hw
|
||||
card $CARD
|
||||
device 1
|
||||
format S16_LE
|
||||
}
|
||||
hooks.0 {
|
||||
type ctl_elems
|
||||
hook_args [
|
||||
{
|
||||
interface MIXER
|
||||
name "IEC958 Playback Default"
|
||||
lock true
|
||||
preserve true
|
||||
optional true
|
||||
value [ $AES0 $AES1 $AES2 $AES3 ]
|
||||
}
|
||||
channels 8
|
||||
format S32_LE
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -2657,7 +2657,8 @@ CONFIG_SND_SOC=y
|
||||
# CONFIG_SND_DESIGNWARE_I2S is not set
|
||||
CONFIG_SND_AML_M8_SOC=y
|
||||
CONFIG_SND_AML_M8=y
|
||||
# CONFIG_SND_AML_SPLIT_MODE is not set
|
||||
CONFIG_SND_AML_SPLIT_MODE=y
|
||||
# CONFIG_SND_AML_SPLIT_MODE_MMAP is not set
|
||||
CONFIG_SND_SOC_I2C_AND_SPI=y
|
||||
CONFIG_SND_SOC_DUMMY_CODEC=y
|
||||
CONFIG_SND_SOC_TAS5707=y
|
||||
|
Loading…
x
Reference in New Issue
Block a user