[RFC PATCH v2 2/3] ASoC: tegra: Initialise PCM hardware limits at boot for page size

From: Eric Curtin

Date: Tue Dec 01 2026 - 22:19:01 EST


From: Ryan Roberts <ryan.roberts@xxxxxxx>

tegra_pcm_hardware and tegra_dmaengine_pcm_config use PAGE_SIZE in their
initialisers, which is not a constant expression with arm64 boot-time
page size selection.

Define both with DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(), which keeps a
normal const initialiser for a fixed page size and otherwise fills them
in once the page size is known at boot.

Signed-off-by: Ryan Roberts <ryan.roberts@xxxxxxx>
Signed-off-by: Eric Curtin <eric.curtin@xxxxxxxxxx>
---
sound/soc/tegra/tegra_pcm.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index c490a9e66858..4fe019433f9a 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -24,7 +24,8 @@
#include <sound/dmaengine_pcm.h>
#include "tegra_pcm.h"

-static const struct snd_pcm_hardware tegra_pcm_hardware = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware,
+ tegra_pcm_hardware, {
.info = SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED,
@@ -34,13 +35,14 @@ static const struct snd_pcm_hardware tegra_pcm_hardware = {
.periods_max = 8,
.buffer_bytes_max = PAGE_SIZE * 8,
.fifo_size = 4,
-};
+});

-static const struct snd_dmaengine_pcm_config tegra_dmaengine_pcm_config = {
+static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_dmaengine_pcm_config,
+ tegra_dmaengine_pcm_config, {
.pcm_hardware = &tegra_pcm_hardware,
.prepare_slave_config = snd_dmaengine_pcm_prepare_slave_config,
.prealloc_buffer_size = PAGE_SIZE * 8,
-};
+});

int tegra_pcm_platform_register(struct device *dev)
{