From 8eeb748bb603340223f5a4d6225a8545c5912df1 Mon Sep 17 00:00:00 2001 From: Christian Hewitt Date: Sun, 24 Jan 2021 04:19:11 +0000 Subject: [PATCH] alsa-lib: update Amlogic patches --- ...IC-HDMI-and-AMLOGIC-HDMI-SPDIF-confs.patch | 106 +++--------------- ...WIP-add-Amlogic-cards-to-Makefile.am.patch | 4 +- ...IP-add-Amlogic-cards-to-aliases.conf.patch | 20 +++- ...-0004-WIP-pcm-iec958-dw-hdmi-changes.patch | 103 ----------------- 4 files changed, 33 insertions(+), 200 deletions(-) delete mode 100644 projects/Amlogic/patches/alsa-lib/amlogic-0004-WIP-pcm-iec958-dw-hdmi-changes.patch diff --git a/projects/Amlogic/patches/alsa-lib/amlogic-0001-WIP-add-AMLOGIC-HDMI-and-AMLOGIC-HDMI-SPDIF-confs.patch b/projects/Amlogic/patches/alsa-lib/amlogic-0001-WIP-add-AMLOGIC-HDMI-and-AMLOGIC-HDMI-SPDIF-confs.patch index fee0a1df85..fc0f32438a 100644 --- a/projects/Amlogic/patches/alsa-lib/amlogic-0001-WIP-add-AMLOGIC-HDMI-and-AMLOGIC-HDMI-SPDIF-confs.patch +++ b/projects/Amlogic/patches/alsa-lib/amlogic-0001-WIP-add-AMLOGIC-HDMI-and-AMLOGIC-HDMI-SPDIF-confs.patch @@ -1,21 +1,21 @@ -From 5065391b1af43c1896089a0e81ebe98d7bdcec5a Mon Sep 17 00:00:00 2001 +From 0d37174c3b629235867e288b4ab9f32cf8c2e80f Mon Sep 17 00:00:00 2001 From: chewitt Date: Thu, 14 May 2020 13:31:34 +0000 -Subject: [PATCH 1/4] WIP: add AMLOGIC-HDMI and AMLOGIC-HDMI-SPDIF confs +Subject: [PATCH 1/3] WIP: add AMLOGIC-HDMI and AMLOGIC-HDMI-SPDIF confs --- - src/conf/cards/AMLOGIC-HDMI-SPDIF.conf | 210 +++++++++++++++++++++++++ - src/conf/cards/AMLOGIC-HDMI.conf | 206 ++++++++++++++++++++++++ - 2 files changed, 416 insertions(+) + src/conf/cards/AMLOGIC-HDMI-SPDIF.conf | 174 +++++++++++++++++++++++++ + src/conf/cards/AMLOGIC-HDMI.conf | 170 ++++++++++++++++++++++++ + 2 files changed, 344 insertions(+) create mode 100644 src/conf/cards/AMLOGIC-HDMI-SPDIF.conf create mode 100644 src/conf/cards/AMLOGIC-HDMI.conf diff --git a/src/conf/cards/AMLOGIC-HDMI-SPDIF.conf b/src/conf/cards/AMLOGIC-HDMI-SPDIF.conf new file mode 100644 -index 00000000..88404be4 +index 00000000..d2783edc --- /dev/null +++ b/src/conf/cards/AMLOGIC-HDMI-SPDIF.conf -@@ -0,0 +1,210 @@ +@@ -0,0 +1,174 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv) + @@ -37,41 +37,6 @@ index 00000000..88404be4 +} + +# -+# Dmix hardware 24-bit output. -+# -+AMLOGIC-HDMI-SPDIF.pcm.dmix-s24le { -+ @args [ CARD ] -+ @args.CARD { type string } -+ type plug -+ slave.pcm { @func concat strings [ "dmix:" $CARD ",FORMAT=S24_LE" ] } -+} -+ -+# -+# Softvol with dmix output -+# -+AMLOGIC-HDMI-SPDIF.pcm.default { -+ @args [ CARD ] -+ @args.CARD { type string } -+ type asym -+ playback.pcm { -+ type softvol -+ slave.pcm { -+ @func refer name { -+ @func concat strings [ -+ "cards." -+ { @func card_driver card $CARD } -+ ".pcm.dmix-s24le:CARD=" $CARD -+ ] -+ } -+ } -+ control { -+ name "PCM Playback Volume" -+ card $CARD -+ } -+ } -+} -+ -+# +# Common output path for front and surround outputs +# +AMLOGIC-HDMI-SPDIF.pcm.common.0 { @@ -102,12 +67,11 @@ index 00000000..88404be4 + +# The mapping of ALSA channels to surround channels is very imprecise. +# ALSA uses a different terminology and speaker placement to the CEA -+# surround positioning. CEA has the positioning of: ++# surround positioning. CEA has the positioning of: +# +# LFE +# FL FLC FC FRC FR +# -+# +# RL RLC RC RRC RR +# +# ALSA's idea is: @@ -192,8 +156,8 @@ index 00000000..88404be4 + ttable.7.5 1.0 # SR -> slave 5 -> hdmi 5 RR +} + -+ -+ ++# ++# +#AMLOGIC-HDMI-SPDIF.pcm.hdmi.0 { +# @args [ CARD AES0 AES1 AES2 AES3 ] +# @args.CARD { @@ -222,16 +186,16 @@ index 00000000..88404be4 +# status [ $AES0 $AES1 $AES2 $AES3 ] +# hdmi_mode true +#} -+ ++# +# -+ ++# +#AMLOGIC-HDMI-SPDIF.pcm.iec958.0 AMLOGIC-HDMI-SPDIF.pcm.hdmi.0 diff --git a/src/conf/cards/AMLOGIC-HDMI.conf b/src/conf/cards/AMLOGIC-HDMI.conf new file mode 100644 -index 00000000..ef964385 +index 00000000..8e410c4d --- /dev/null +++ b/src/conf/cards/AMLOGIC-HDMI.conf -@@ -0,0 +1,206 @@ +@@ -0,0 +1,170 @@ +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv) + @@ -253,41 +217,6 @@ index 00000000..ef964385 +} + +# -+# Dmix hardware 24-bit output. -+# -+AMLOGIC-HDMI.pcm.dmix-s24le { -+ @args [ CARD ] -+ @args.CARD { type string } -+ type plug -+ slave.pcm { @func concat strings [ "dmix:" $CARD ",FORMAT=S24_LE" ] } -+} -+ -+# -+# Softvol with dmix output -+# -+AMLOGIC-HDMI.pcm.default { -+ @args [ CARD ] -+ @args.CARD { type string } -+ type asym -+ playback.pcm { -+ type softvol -+ slave.pcm { -+ @func refer name { -+ @func concat strings [ -+ "cards." -+ { @func card_driver card $CARD } -+ ".pcm.dmix-s24le:CARD=" $CARD -+ ] -+ } -+ } -+ control { -+ name "PCM Playback Volume" -+ card $CARD -+ } -+ } -+} -+ -+# +# Common output path for front and surround outputs +# +AMLOGIC-HDMI.pcm.common.0 { @@ -318,11 +247,10 @@ index 00000000..ef964385 + +# The mapping of ALSA channels to surround channels is very imprecise. +# ALSA uses a different terminology and speaker placement to the CEA -+# surround positioning. CEA has the positioning of: ++# surround positioning. CEA has the positioning of: +# +# LFE -+# FL FLC FC FRC FR -+# ++# FL FLC FC FRC FR# +# +# RL RLC RC RRC RR +# @@ -409,7 +337,7 @@ index 00000000..ef964385 +} + +# -+ ++# +#AMLOGIC-HDMI.pcm.hdmi.0 { +# @args [ CARD AES0 AES1 AES2 AES3 ] +# @args.CARD { diff --git a/projects/Amlogic/patches/alsa-lib/amlogic-0002-WIP-add-Amlogic-cards-to-Makefile.am.patch b/projects/Amlogic/patches/alsa-lib/amlogic-0002-WIP-add-Amlogic-cards-to-Makefile.am.patch index 3c93543eb3..48b5b4264b 100644 --- a/projects/Amlogic/patches/alsa-lib/amlogic-0002-WIP-add-Amlogic-cards-to-Makefile.am.patch +++ b/projects/Amlogic/patches/alsa-lib/amlogic-0002-WIP-add-Amlogic-cards-to-Makefile.am.patch @@ -1,7 +1,7 @@ -From ab0ecb7aa4327a3ffff14df1fe065d3010f1ab93 Mon Sep 17 00:00:00 2001 +From 515f49934ea4b552cda1661aa5ac03f1d5874777 Mon Sep 17 00:00:00 2001 From: chewitt Date: Fri, 15 May 2020 06:12:43 +0000 -Subject: [PATCH 2/4] WIP: add Amlogic cards to Makefile.am +Subject: [PATCH 2/3] WIP: add Amlogic cards to Makefile.am --- src/conf/cards/Makefile.am | 2 ++ diff --git a/projects/Amlogic/patches/alsa-lib/amlogic-0003-WIP-add-Amlogic-cards-to-aliases.conf.patch b/projects/Amlogic/patches/alsa-lib/amlogic-0003-WIP-add-Amlogic-cards-to-aliases.conf.patch index e1f7b1af19..13374b821b 100644 --- a/projects/Amlogic/patches/alsa-lib/amlogic-0003-WIP-add-Amlogic-cards-to-aliases.conf.patch +++ b/projects/Amlogic/patches/alsa-lib/amlogic-0003-WIP-add-Amlogic-cards-to-aliases.conf.patch @@ -1,17 +1,17 @@ -From b4f63bbf0ec2693598d3fa411b36c58b5b4cfca8 Mon Sep 17 00:00:00 2001 +From b22476f67deae9b0daf69516e7b94f64e7acc895 Mon Sep 17 00:00:00 2001 From: chewitt Date: Thu, 14 May 2020 13:32:26 +0000 -Subject: [PATCH 3/4] WIP: add Amlogic cards to aliases.conf +Subject: [PATCH 3/3] WIP: add Amlogic cards to aliases.conf --- - src/conf/cards/aliases.conf | 40 +++++++++++++++++++++++++++++++++++++ - 1 file changed, 40 insertions(+) + src/conf/cards/aliases.conf | 48 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 48 insertions(+) diff --git a/src/conf/cards/aliases.conf b/src/conf/cards/aliases.conf -index 18a920f4..3d5623e5 100644 +index 18a920f4..14dedb63 100644 --- a/src/conf/cards/aliases.conf +++ b/src/conf/cards/aliases.conf -@@ -58,6 +58,46 @@ CMI8787 cards.CMI8788 +@@ -58,6 +58,54 @@ CMI8787 cards.CMI8788 pistachio cards.pistachio-card VC4-HDMI cards.vc4-hdmi @@ -30,6 +30,7 @@ index 18a920f4..3d5623e5 100644 +NEXBOX-A95X cards.AMLOGIC-HDMI +ODROID-C2 cards.AMLOGIC-HDMI +ODROID-C4 cards.AMLOGIC-HDMI ++ODROID-HC4 cards.AMLOGIC-HDMI +ODROID-N2 cards.AMLOGIC-HDMI +SEI510 cards.AMLOGIC-HDMI +SEI610 cards.AMLOGIC-HDMI @@ -54,6 +55,13 @@ index 18a920f4..3d5623e5 100644 +U200 cards.AMLOGIC-HDMI-SPDIF +TANIX-TX5MAX cards.AMLOGIC-HDMI-SPDIF +KHADAS-VIM3L cards.AMLOGIC-HDMI ++ ++# Meson 8 Cards ++EC100 cards.AMLOGIC-HDMI ++ODROID-C1 cards.AMLOGIC-HDMI ++M8S cards.AMLOGIC-HDMI-SPDIF ++MXIII cards.AMLOGIC-HDMI-SPDIF ++WETEK-CORE cards.AMLOGIC-HDMI-SPDIF + diff --git a/projects/Amlogic/patches/alsa-lib/amlogic-0004-WIP-pcm-iec958-dw-hdmi-changes.patch b/projects/Amlogic/patches/alsa-lib/amlogic-0004-WIP-pcm-iec958-dw-hdmi-changes.patch deleted file mode 100644 index ddaee75914..0000000000 --- a/projects/Amlogic/patches/alsa-lib/amlogic-0004-WIP-pcm-iec958-dw-hdmi-changes.patch +++ /dev/null @@ -1,103 +0,0 @@ -From f1ed3a8196a202d9a933cdc0aadc4d001a85008c Mon Sep 17 00:00:00 2001 -From: Jernej Skrabec -Date: Tue, 7 Jul 2020 15:59:16 +0000 -Subject: [PATCH 4/4] WIP: pcm: iec958: dw-hdmi changes - -Signed-off-by: Jernej Skrabec ---- - src/pcm/pcm_iec958.c | 45 +++++++++++++++++++------------------------- - 1 file changed, 19 insertions(+), 26 deletions(-) - -diff --git a/src/pcm/pcm_iec958.c b/src/pcm/pcm_iec958.c -index a11a0439..dc4f5990 100644 ---- a/src/pcm/pcm_iec958.c -+++ b/src/pcm/pcm_iec958.c -@@ -71,8 +71,8 @@ enum { PREAMBLE_Z, PREAMBLE_X, PREAMBLE_Y }; - #endif /* DOC_HIDDEN */ - - /* -- * Determine parity for time slots 4 upto 30 -- * to be sure that bit 4 upt 31 will carry -+ * Determine parity for time slots 0 upto 18 -+ * to be sure that bit 0 upt 19 will carry - * an even number of ones and zeros. - */ - static unsigned int iec958_parity(unsigned int data) -@@ -80,9 +80,8 @@ static unsigned int iec958_parity(unsigned int data) - unsigned int parity; - int bit; - -- data >>= 4; /* start from bit 4 */ - parity = 0; -- for (bit = 4; bit <= 30; bit++) { -+ for (bit = 0; bit <= 18; bit++) { - if (data & 1) - parity++; - data >>= 1; -@@ -94,13 +93,12 @@ static unsigned int iec958_parity(unsigned int data) - * Compose 32bit IEC958 subframe, two sub frames - * build one frame with two channels. - * -- * bit 0-3 = preamble -- * 4-7 = AUX (=0) -- * 8-27 = data (12-27 for 16bit, 8-27 for 20bit, and 24bit without AUX) -- * 28 = validity (0 for valid data, else 'in error') -- * 29 = user data (0) -- * 30 = channel status (24 bytes for 192 frames) -- * 31 = parity -+ * bit 0-15 = data -+ * 16 = validity (0 for valid data, else 'in error') -+ * 17 = user data (0) -+ * 18 = channel status (24 bytes for 192 frames) -+ * 19 = parity -+ * 20 = frame start - */ - - static inline uint32_t iec958_subframe(snd_pcm_iec958_t *iec, uint32_t data, int channel) -@@ -108,24 +106,20 @@ static inline uint32_t iec958_subframe(snd_pcm_iec958_t *iec, uint32_t data, int - unsigned int byte = iec->counter >> 3; - unsigned int mask = 1 << (iec->counter - (byte << 3)); - -- /* bit 4-27 */ -- data >>= 4; -- data &= ~0xf; -+ data >>= 16; - - /* set IEC status bits (up to 192 bits) */ - if (iec->status[byte] & mask) -- data |= 0x40000000; -+ data |= 0x40000; - -- if (iec958_parity(data)) /* parity bit 4-30 */ -- data |= 0x80000000; -+ if (iec958_parity(data)) -+ data |= 0x80000; - -- /* Preamble */ -- if (channel) -- data |= iec->preamble[PREAMBLE_Y]; /* odd sub frame, 'Y' */ -- else if (! iec->counter) -- data |= iec->preamble[PREAMBLE_Z]; /* Block start, 'Z' */ -- else -- data |= iec->preamble[PREAMBLE_X]; /* even sub frame, 'X' */ -+ /* block start */ -+ if (!iec->counter) -+ data |= 0x100000; -+ -+ data <<= 11; - - if (iec->byteswap) - data = bswap_32(data); -@@ -137,8 +131,7 @@ static inline int32_t iec958_to_s32(snd_pcm_iec958_t *iec, uint32_t data) - { - if (iec->byteswap) - data = bswap_32(data); -- data &= ~0xf; -- data <<= 4; -+ data <<= 16; - return (int32_t)data; - } - --- -2.17.1 -