From 6b40ed52d24fbe2b32928462640574edcf55baf8 Mon Sep 17 00:00:00 2001 From: Javier Viguera Date: Mon, 23 Jun 2025 17:27:16 +0200 Subject: [PATCH] meta-digi-dey: backport ALSA and PulseAudio fixes from meta-imx * Y2038: compile pulseaudio and alsa-lib with 64bit time flags * Add patch to fix playback stuck issues on suspend/resume https://onedigi.atlassian.net/browse/DEL-9681 Signed-off-by: Javier Viguera --- ...x-Fix-resume-with-multiple-instances.patch | 64 +++++++++++++++++++ .../alsa/alsa-lib_%.bbappend | 7 ++ .../pulseaudio/pulseaudio_%.bbappend | 4 +- 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 meta-digi-dey/dynamic-layers/freescale-layer/recipes-multimedia/alsa/alsa-lib/0001-pcm-dmix-Fix-resume-with-multiple-instances.patch create mode 100644 meta-digi-dey/dynamic-layers/freescale-layer/recipes-multimedia/alsa/alsa-lib_%.bbappend diff --git a/meta-digi-dey/dynamic-layers/freescale-layer/recipes-multimedia/alsa/alsa-lib/0001-pcm-dmix-Fix-resume-with-multiple-instances.patch b/meta-digi-dey/dynamic-layers/freescale-layer/recipes-multimedia/alsa/alsa-lib/0001-pcm-dmix-Fix-resume-with-multiple-instances.patch new file mode 100644 index 000000000..9ab62d434 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/freescale-layer/recipes-multimedia/alsa/alsa-lib/0001-pcm-dmix-Fix-resume-with-multiple-instances.patch @@ -0,0 +1,64 @@ +From 2adc30e9838daf62312f32a0a93129d64b1668b3 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 6 Sep 2024 10:05:56 +0200 +Subject: [PATCH] pcm: dmix: Fix resume with multiple instances + +Upstream-Status: Pending + +The fix for PCM dmix suspend/resume checks spcm->info bit of +SND_PCM_INFO_RESUME for applying a workaround for drivers with the +full resume support. This assumed that scpm->info is exposed from the +underlying slave PCM device. + +The above is true for the first opened instance, but for the second +opened instance, it's a copy from the saved data in shmem. And, we +dropped SND_PCM_INFO_RESUME bit there to assure not to expose the full +resume capability to applications. This resulted in the +inconsistencies, and when the second instance is resumed at first, it +misses the snd_pcm_resume() call, hence the driver doesn't react +properly any longer. + +For addressing it, we keep SND_PCM_INFO_RESUME bit in shmptr->s.info +bits as is, while dropping the bit exposed to apps in +snd_pcm_direct_hw_refine() and *_hw_params() callbacks. + +Fixes: 6d1d620eadf3 ("pcm: dmix: resume workaround for buggy driver") +Reported-and-tested-by: Chancel Liu +Closes: https://lore.kernel.org/DB9PR04MB94988752ED7C43B399E0BC00E3942@DB9PR04MB9498.eurprd04.prod.outlook.com +Signed-off-by: Takashi Iwai +--- + src/pcm/pcm_direct.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/pcm/pcm_direct.c b/src/pcm/pcm_direct.c +index e53e5923..17e677f6 100644 +--- a/src/pcm/pcm_direct.c ++++ b/src/pcm/pcm_direct.c +@@ -1018,6 +1018,7 @@ int snd_pcm_direct_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params) + } + dshare->timer_ticks = hw_param_interval(params, SND_PCM_HW_PARAM_PERIOD_SIZE)->max / dshare->slave_period_size; + params->info = dshare->shmptr->s.info; ++ params->info &= ~SND_PCM_INFO_RESUME; + #ifdef REFINE_DEBUG + snd_output_puts(log, "DMIX REFINE (end):\n"); + snd_pcm_hw_params_dump(params, log); +@@ -1031,6 +1032,7 @@ int snd_pcm_direct_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params) + snd_pcm_direct_t *dmix = pcm->private_data; + + params->info = dmix->shmptr->s.info; ++ params->info &= ~SND_PCM_INFO_RESUME; + params->rate_num = dmix->shmptr->s.rate; + params->rate_den = 1; + params->fifo_size = 0; +@@ -1183,8 +1185,6 @@ static void save_slave_setting(snd_pcm_direct_t *dmix, snd_pcm_t *spcm) + COPY_SLAVE(buffer_time); + COPY_SLAVE(sample_bits); + COPY_SLAVE(frame_bits); +- +- dmix->shmptr->s.info &= ~SND_PCM_INFO_RESUME; + } + + #undef COPY_SLAVE +-- +2.46.0 + diff --git a/meta-digi-dey/dynamic-layers/freescale-layer/recipes-multimedia/alsa/alsa-lib_%.bbappend b/meta-digi-dey/dynamic-layers/freescale-layer/recipes-multimedia/alsa/alsa-lib_%.bbappend new file mode 100644 index 000000000..b8cb4e151 --- /dev/null +++ b/meta-digi-dey/dynamic-layers/freescale-layer/recipes-multimedia/alsa/alsa-lib_%.bbappend @@ -0,0 +1,7 @@ +# Copyright (C) 2025, Digi International Inc. + +FILESEXTRAPATHS:prepend := "${THISDIR}/alsa-lib:" +# override meta-freescale/recipes-multimedia/alsa/alsa-lib_%.bbappend +GLIBC_64BIT_TIME_FLAGS:arm:imx-nxp-bsp = " -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" + +SRC_URI:append = " file://0001-pcm-dmix-Fix-resume-with-multiple-instances.patch" diff --git a/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend index 2f5f01f3c..f44917355 100644 --- a/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend +++ b/meta-digi-dey/recipes-multimedia/pulseaudio/pulseaudio_%.bbappend @@ -1,4 +1,4 @@ -# Copyright (C) 2019-2024, Digi International Inc. +# Copyright (C) 2019-2025, Digi International Inc. FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" @@ -57,6 +57,8 @@ SRC_URI:append:mx9-nxp-bsp = " \ # Disable allow-autospawn-for-root as default PACKAGECONFIG:remove = "autospawn-for-root" +PACKAGECONFIG[oss-output] = "-Doss-output=enabled,-Doss-output=disabled," +GLIBC_64BIT_TIME_FLAGS:pn-pulseaudio = " ${@bb.utils.contains('PACKAGECONFIG', 'oss-output', '', ' -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64', d)}" EXTRA_OECONF:append:ccimx6 = " --disable-memfd"