]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
Fixes for 5.15
authorSasha Levin <sashal@kernel.org>
Fri, 10 Jan 2025 00:09:18 +0000 (19:09 -0500)
committerSasha Levin <sashal@kernel.org>
Fri, 10 Jan 2025 00:09:18 +0000 (19:09 -0500)
Signed-off-by: Sasha Levin <sashal@kernel.org>
queue-5.15/asoc-mediatek-disable-buffer-pre-allocation.patch [new file with mode: 0644]
queue-5.15/series

diff --git a/queue-5.15/asoc-mediatek-disable-buffer-pre-allocation.patch b/queue-5.15/asoc-mediatek-disable-buffer-pre-allocation.patch
new file mode 100644 (file)
index 0000000..6f66e67
--- /dev/null
@@ -0,0 +1,57 @@
+From 5844a584c5b3f0193543924d6e75f722543ff4b9 Mon Sep 17 00:00:00 2001
+From: Sasha Levin <sashal@kernel.org>
+Date: Thu, 19 Dec 2024 18:53:02 +0800
+Subject: ASoC: mediatek: disable buffer pre-allocation
+
+From: Chen-Yu Tsai <wenst@chromium.org>
+
+[ Upstream commit 32c9c06adb5b157ef259233775a063a43746d699 ]
+
+On Chromebooks based on Mediatek MT8195 or MT8188, the audio frontend
+(AFE) is limited to accessing a very small window (1 MiB) of memory,
+which is described as a reserved memory region in the device tree.
+
+On these two platforms, the maximum buffer size is given as 512 KiB.
+The MediaTek common code uses the same value for preallocations. This
+means that only the first two PCM substreams get preallocations, and
+then the whole space is exhausted, barring any other substreams from
+working. Since the substreams used are not always the first two, this
+means audio won't work correctly.
+
+This is observed on the MT8188 Geralt Chromebooks, on which the
+"mediatek,dai-link" property was dropped when it was upstreamed. That
+property causes the driver to only register the PCM substreams listed
+in the property, and in the order given.
+
+Instead of trying to compute an optimal value and figuring out which
+streams are used, simply disable preallocation. The PCM buffers are
+managed by the core and are allocated and released on the fly. There
+should be no impact to any of the other MediaTek platforms.
+
+Signed-off-by: Chen-Yu Tsai <wenst@chromium.org>
+Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
+Link: https://patch.msgid.link/20241219105303.548437-1-wenst@chromium.org
+Signed-off-by: Mark Brown <broonie@kernel.org>
+Signed-off-by: Sasha Levin <sashal@kernel.org>
+---
+ sound/soc/mediatek/common/mtk-afe-platform-driver.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.c b/sound/soc/mediatek/common/mtk-afe-platform-driver.c
+index 01501d5747a7..52495c930ca3 100644
+--- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c
++++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c
+@@ -120,8 +120,8 @@ int mtk_afe_pcm_new(struct snd_soc_component *component,
+       struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
+       size = afe->mtk_afe_hardware->buffer_bytes_max;
+-      snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
+-                                     afe->dev, size, size);
++      snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, afe->dev, 0, size);
++
+       return 0;
+ }
+ EXPORT_SYMBOL_GPL(mtk_afe_pcm_new);
+-- 
+2.39.5
+
index ddbc4d8681400753dfc8487af1b62269229d2208..6e48c3aa1a2004c47baf3616ed2b53113f80a13c 100644 (file)
@@ -5,3 +5,4 @@ dm-array-fix-unreleased-btree-blocks-on-closing-a-fa.patch
 dm-array-fix-cursor-index-when-skipping-across-block.patch
 exfat-fix-the-infinite-loop-in-exfat_readdir.patch
 exfat-fix-the-infinite-loop-in-__exfat_free_cluster.patch
+asoc-mediatek-disable-buffer-pre-allocation.patch