From ad0f62a411aeb5066d64985214634b073920800b Mon Sep 17 00:00:00 2001 From: Alex Bee Date: Sun, 31 Oct 2021 10:36:42 +0100 Subject: [PATCH 1/2] Rockchip: rework alsa card configs Also drop no longer needed HDMI.conf and I2S.conf --- .../filesystem/usr/share/alsa/cards/HDMI.conf | 34 ------------------- .../filesystem/usr/share/alsa/cards/I2S.conf | 12 ------- .../usr/share/alsa/cards/SPDIF.conf | 2 +- .../usr/share/alsa/cards/simple-card.conf | 20 ++++------- 4 files changed, 8 insertions(+), 60 deletions(-) delete mode 100644 projects/Rockchip/filesystem/usr/share/alsa/cards/HDMI.conf delete mode 100644 projects/Rockchip/filesystem/usr/share/alsa/cards/I2S.conf diff --git a/projects/Rockchip/filesystem/usr/share/alsa/cards/HDMI.conf b/projects/Rockchip/filesystem/usr/share/alsa/cards/HDMI.conf deleted file mode 100644 index a79abf8d3e..0000000000 --- a/projects/Rockchip/filesystem/usr/share/alsa/cards/HDMI.conf +++ /dev/null @@ -1,34 +0,0 @@ -# -# Configuration for HDMI -# - - - -HDMI.pcm.hdmi.0 { - @args [ CARD AES0 AES1 AES2 AES3 ] - @args.CARD { type string } - @args.AES0 { type integer } - @args.AES1 { type integer } - @args.AES2 { type integer } - @args.AES3 { type integer } - type hooks - slave.pcm { - type hw - card $CARD - device 0 - } - hooks.0 { - type ctl_elems - hook_args [ - { - interface MIXER - name "IEC958 Playback Default" - lock true - preserve true - optional true - value [ $AES0 $AES1 $AES2 $AES3 ] - } - ] - } - hint.device 0 -} diff --git a/projects/Rockchip/filesystem/usr/share/alsa/cards/I2S.conf b/projects/Rockchip/filesystem/usr/share/alsa/cards/I2S.conf deleted file mode 100644 index 0a21710eaa..0000000000 --- a/projects/Rockchip/filesystem/usr/share/alsa/cards/I2S.conf +++ /dev/null @@ -1,12 +0,0 @@ -# -# Configuration for I2S -# - - - -I2S.pcm.front.0 { - @args [ CARD ] - @args.CARD { type string } - type hw - card $CARD -} diff --git a/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf b/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf index 1618b55161..39c1c4e8ef 100644 --- a/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf +++ b/projects/Rockchip/filesystem/usr/share/alsa/cards/SPDIF.conf @@ -21,7 +21,7 @@ SPDIF.pcm.iec958.0 { type ctl_elems hook_args [ { - interface MIXER + interface PCM name "IEC958 Playback Default" lock true preserve true diff --git a/projects/Rockchip/filesystem/usr/share/alsa/cards/simple-card.conf b/projects/Rockchip/filesystem/usr/share/alsa/cards/simple-card.conf index 93b41e95c6..f7b81c0316 100644 --- a/projects/Rockchip/filesystem/usr/share/alsa/cards/simple-card.conf +++ b/projects/Rockchip/filesystem/usr/share/alsa/cards/simple-card.conf @@ -4,6 +4,9 @@ +simple-card.pcm.hdmi."hdmi-sound" "cards.simple-card.pcm.hdmi.HDMI" +simple-card.pcm.hdmi."rockchip_tinker-codec" "cards.simple-card.pcm.hdmi.HDMI" + simple-card.pcm.hdmi."HDMI" { @args [ CARD DEVICE AES0 AES1 AES2 AES3 ] @args.CARD { type string } @@ -22,7 +25,7 @@ simple-card.pcm.hdmi."HDMI" { type ctl_elems hook_args [ { - interface MIXER + interface PCM name "IEC958 Playback Default" lock true preserve true @@ -41,7 +44,6 @@ simple-card.pcm.hdmi.0 { @args.AES1 { type integer } @args.AES2 { type integer } @args.AES3 { type integer } - @func refer name { @func concat @@ -62,7 +64,6 @@ simple-card.pcm.hdmi.0 { device 999 hint.device 999 } - } # @@ -89,7 +90,7 @@ simple-card.pcm.iec958."SPDIF" { type ctl_elems hook_args [ { - interface MIXER + interface PCM name "IEC958 Playback Default" lock true preserve true @@ -165,6 +166,8 @@ simple-card.pcm.iec958.1 { +simple-card.pcm.front."I2S" "cards.simple-card.pcm.front.Analog" + simple-card.pcm.front."Analog" { @args [ CARD DEVICE ] @args.CARD { type string } @@ -174,15 +177,6 @@ simple-card.pcm.front."Analog" { hint.device $DEVICE } -simple-card.pcm.front."I2S" { - @args [ CARD ] - @args.CARD { type string } - @args.DEVICE { type integer } - type hw - card $CARD - hint.device $DEVICE -} - simple-card.pcm.front.0 { @args [ CARD ] @args.CARD { type string } From 36685c26e34e7846dfbd899232397ba50df0b155 Mon Sep 17 00:00:00 2001 From: Alex Bee Date: Sun, 31 Oct 2021 02:36:13 +0200 Subject: [PATCH 2/2] Rockchip: linux: switch to .prepare instead of .hw_params for dw-hdmi i2s --- .../default/linux-1002-for-libreelec.patch | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/projects/Rockchip/patches/linux/default/linux-1002-for-libreelec.patch b/projects/Rockchip/patches/linux/default/linux-1002-for-libreelec.patch index 1e9c2e0b51..6e8a5583d2 100644 --- a/projects/Rockchip/patches/linux/default/linux-1002-for-libreelec.patch +++ b/projects/Rockchip/patches/linux/default/linux-1002-for-libreelec.patch @@ -647,3 +647,44 @@ index 3d98e2251ea5..b201700ccc8a 100644 .num_irqs = ARRAY_SIZE(rockchip_vdpu2_irqs), +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Alex Bee +Date: Sat, 30 Oct 2021 12:19:19 +0200 +Subject: [PATCH] WIP: drm: bridge: dw-hdmi: switch from .hw_parmas to .prepare + for i2s + +Seems to be the only way to get AES bits correctly as set by +userspace. +TODO: check other consequences. + +Signed-off-by: Alex Bee +--- + drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +index feb04f127b55..f7631f2e34c5 100644 +--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c ++++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c +@@ -34,9 +34,9 @@ static inline u8 hdmi_read(struct dw_hdmi_i2s_audio_data *audio, int offset) + return audio->read(hdmi, offset); + } + +-static int dw_hdmi_i2s_hw_params(struct device *dev, void *data, +- struct hdmi_codec_daifmt *fmt, +- struct hdmi_codec_params *hparms) ++static int dw_hdmi_i2s_prepare(struct device *dev, void *data, ++ struct hdmi_codec_daifmt *fmt, ++ struct hdmi_codec_params *hparms) + { + struct dw_hdmi_i2s_audio_data *audio = data; + struct dw_hdmi *hdmi = audio->hdmi; +@@ -171,7 +171,7 @@ static int dw_hdmi_i2s_hook_plugged_cb(struct device *dev, void *data, + } + + static const struct hdmi_codec_ops dw_hdmi_i2s_ops = { +- .hw_params = dw_hdmi_i2s_hw_params, ++ .prepare = dw_hdmi_i2s_prepare, + .audio_startup = dw_hdmi_i2s_audio_startup, + .audio_shutdown = dw_hdmi_i2s_audio_shutdown, + .get_eld = dw_hdmi_i2s_get_eld,