mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 21:26:49 +00:00
Merge pull request #709 from kszaq/wh_hd_passthrough
projects/WeTek_Hub: enable multichannel PCM and HD Audio passthrough
This commit is contained in:
commit
90c67a7f7c
@ -1,11 +0,0 @@
|
||||
pcm.!default {
|
||||
type hw
|
||||
card 0
|
||||
device 1
|
||||
format S16_LE
|
||||
}
|
||||
|
||||
ctl.!default {
|
||||
type hw
|
||||
card 0
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
#
|
||||
# Configuration for Amlogic M8 Audio
|
||||
#
|
||||
|
||||
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
|
||||
card $CARD
|
||||
device 0
|
||||
format S32_LE
|
||||
}
|
||||
|
||||
<confdir:pcm/surround71.conf>
|
||||
|
||||
AML-M8AUDIO.pcm.surround71.0 {
|
||||
@args [ CARD ]
|
||||
@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
|
||||
slave.pcm {
|
||||
type plug
|
||||
slave {
|
||||
pcm {
|
||||
type hw
|
||||
card $CARD
|
||||
device 0
|
||||
}
|
||||
channels 8
|
||||
format S32_LE
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
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
|
||||
|
@ -1,30 +0,0 @@
|
||||
From 4b3958857f85df99dece4faffd42b15a9445e5cb Mon Sep 17 00:00:00 2001
|
||||
From: Alex Deryskyba <alex@codesnake.com>
|
||||
Date: Tue, 30 Jun 2015 11:19:57 +0200
|
||||
Subject: [PATCH 2/5] [aml] Ugly workaround to show DTS/AC3 caps
|
||||
|
||||
... but don't run into multi channel issues as we can only open 2 pcm channels
|
||||
---
|
||||
xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
|
||||
index 6a9066b..7abf119 100644
|
||||
--- a/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
|
||||
+++ b/xbmc/cores/AudioEngine/Sinks/AESinkALSA.cpp
|
||||
@@ -1301,6 +1301,12 @@ void CAESinkALSA::EnumerateDevicesEx(AEDeviceInfoList &list, bool force)
|
||||
|
||||
AEDeviceType CAESinkALSA::AEDeviceTypeFromName(const std::string &name)
|
||||
{
|
||||
+#ifdef HAS_LIBAMCODEC
|
||||
+ // ugly workaround to show DTS / AC3 caps
|
||||
+ // but don't run into multi channel issues
|
||||
+ // as we can only open 2 pcm channels
|
||||
+ return AE_DEVTYPE_IEC958;
|
||||
+#endif
|
||||
if (name.substr(0, 4) == "hdmi")
|
||||
return AE_DEVTYPE_HDMI;
|
||||
else if (name.substr(0, 6) == "iec958" || name.substr(0, 5) == "spdif")
|
||||
--
|
||||
1.7.10.4
|
||||
|
@ -0,0 +1,58 @@
|
||||
From edab2a489829689fdaadb90f1897c948ea3c9020 Mon Sep 17 00:00:00 2001
|
||||
From: kszaq <kszaquitto@gmail.com>
|
||||
Date: Wed, 3 Jun 2015 10:20:04 +0200
|
||||
Subject: [PATCH] sound/soc/aml/m8: Report only working frequecies and bit
|
||||
depths
|
||||
|
||||
---
|
||||
sound/soc/aml/m8/aml_spdif_codec.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/sound/soc/aml/m8/aml_spdif_codec.c b/sound/soc/aml/m8/aml_spdif_codec.c
|
||||
index ac76ef6..cf0e929 100644
|
||||
--- a/sound/soc/aml/m8/aml_spdif_codec.c
|
||||
+++ b/sound/soc/aml/m8/aml_spdif_codec.c
|
||||
@@ -26,9 +26,8 @@
|
||||
|
||||
#define DRV_NAME "spdif-dit"
|
||||
|
||||
-#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_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE
|
||||
|
||||
struct pinctrl *pin_spdif_ctl;
|
||||
struct device *spdif_dev;
|
||||
--
|
||||
1.8.3.1
|
||||
|
||||
From 1e6294498438359c4ac39b2ab563487d750fbaaf Mon Sep 17 00:00:00 2001
|
||||
From: kszaq <kszaquitto@gmail.com>
|
||||
Date: Tue, 30 Aug 2016 23:31:29 +0200
|
||||
Subject: [PATCH] sound/soc/aml/m8: report only working frequencies and bit
|
||||
depths for I2S
|
||||
|
||||
---
|
||||
sound/soc/aml/m8/aml_i2s_dai.c | 5 ++---
|
||||
1 file changed, 2 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/sound/soc/aml/m8/aml_i2s_dai.c b/sound/soc/aml/m8/aml_i2s_dai.c
|
||||
index 3626676..d2ebad1 100644
|
||||
--- a/sound/soc/aml/m8/aml_i2s_dai.c
|
||||
+++ b/sound/soc/aml/m8/aml_i2s_dai.c
|
||||
@@ -290,9 +290,8 @@ static int aml_dai_i2s_resume(struct snd_soc_dai *dai)
|
||||
return 0;
|
||||
}
|
||||
|
||||
-#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_FORMATS SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE
|
||||
|
||||
static struct snd_soc_dai_ops aml_dai_i2s_ops = {
|
||||
.startup = aml_dai_i2s_startup,
|
||||
--
|
||||
1.8.3.1
|
||||
|
Loading…
x
Reference in New Issue
Block a user