From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796181462; b=14fCBa25QFfM1qWisS04MPWgwtXUfjDKIw5ZWjSFOqbvi9PqqH16Bw0HWbe2N/hkgrBv XIvtVqrtKpbb6D5jFvagk0cVF6Fov0qWedm0CHq1MGL2/JJ9WOGviFL1Zq/p1tyezHm5+ FTOcXeCMcJ87zfFfxU1YaHcYWwzxZ1EXM/W80lsc5DnW7joKKkBi3WWP8GWXsGb5/hJ+7 732Hl6x/R+Zd/RyvHrtbyxyI+aK4vJygbF7ZHWQEbog6UJZHhddMHaYe+jimdZY1DjCD1 R4Xp0iuFWaHJmIOyTC/Xfk5AjVGLTAvbhvm5Hkl9UtZuPHmyrOAuf2mEDVqO13eNGgA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796181462; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=MYVLh1ghgOM7xPsMaxGNZfPF9PBf7DX21lB25HkaxFc=; b=wsF8YUeRCkHr3qXYGlVS8zZhqDqPAspAG/GaVxn8pCG0ZayhHGom5FatJYi4ts8Gkq8l I2rOefuHLbKPFGXx2UzOV3apOP3rMF+KhkoWtj0bHlUvuFqAHjrCq+veQ67yIJ/WfNmyc uuhnsIqeZ6iogiFrEAMC8eujwRJNJwp+ia+PxWaUaWbUEl2BNRQNjFFMHw+WEar7ey99U 0rLeoQXmwu+HescAFMk0ueDyufEGNM98651pdo/nHMXAyLQVheLQ3FvyIr00/aZjv8z2H ik1045xJxh39JKWdfYcv99llkYLmNrD0HNnJVVaAlLJCEvgyRrjN2pKsJ2QPQ/UEUHg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b="z/C8MUbQ"; arc=none smtp.remote-ip=209.85.128.48 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 82839606A699 for ; Wed, 2 Dec 2026 03:17:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 82839606A699 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=z/C8MUbQ Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-4bb9d8e8e90so94055225e9.3 for ; Tue, 01 Dec 2026 19:17:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796181461; x=1796786261; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=MYVLh1ghgOM7xPsMaxGNZfPF9PBf7DX21lB25HkaxFc=; b=z/C8MUbQi70ZJx7v8TAjB9rDU9PnCVXkRkxKxGztCjYB3QObKEBKfFtH1vOcAz9v8t 0vlD1aosf4L7Zf20/Ds9NaSHgwzxYMzwhXKEhDa0z7WF6zvvOc6GSM1pghrozd4sEHue F2Vmehxi7DB2SYOWdUtkbcCcRtUTmQGUT11L6gOsC9AUoPKivVF8NqIoRS/wP93Y+q5v LN96lSP4KxhKrpBY4xRr+4GqIGMbk0PoyCXcUiN3SaLRRTh8K53WquPqEjbE8HX4Jswk jAKc7imSzPxFXjFeaj80sXs+NfHuI+qplIVwcxEowHMXLe1kMBz0mNAHnP5f8RQE3d12 LUwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796181461; x=1796786261; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=MYVLh1ghgOM7xPsMaxGNZfPF9PBf7DX21lB25HkaxFc=; b=cZ5aOrJ4Gs2YVMoBARB1fEMlL3XbY9WLHaYQ6KSQqKT5UxQ24KjlWR+RQN6oO4Es+v O9YI7TZGiHD6LLZ29UVr7t0XtpE5HmPdOwp/0t85A+Ix/Ha395Xi+kKALgP52W0J73DJ OIhsaeFLyAJitiY+2YB6zHF/SzB5AFo/d0DovTGbQ/HH2W/U4EAixqkbFFC5ypBz+Dh4 Ij13f5i6trSSMtadfGpJNTJ7f7+nf7o8Ug+7+Wb0fOyVwD17RNe5gmX1YNcG+2IkCeiG 6IwavlKTZXfS+tJUx5LPmVxNmW9HaTYZmf5S160P45w2OcBw9S68m18A+f762PFK7GRM tn/A== X-Forwarded-Encrypted: i=1; AL+hErGKvUQT06y/p7AvjppU2bsgbdBLP9DdaI8L5WvK/mQK4cDNUGIMqSG+gh/ObJ5Fk6aqk/BoRtaAl+dXBg==@vger.kernel.org X-Gm-Message-State: APuU4Z9wvYGM+UZLZqA353Yw0ydeMQ+Y6C2ykr5b9Ztyn161UX+Lj+ji 1MCmhRYHnr+flFg8LLn1ZTXxfEnGE9BR59U2kYK1rEcDhwGhQBUBz74z X-Gm-Gg: AZFdTZcsvWvOxBPD0xAm23+rm4UT4iTQDT/rbU9bat8JO9k2eJOZ0ANcRpKpry2uJSG Y7E1X6Y39YL8Yinyyqckbhk94uw3mjijEbiXE2c26b09SmylVtj6D5Rs4G8WWV4+G4Y1h2h82of gN8mfdbbl/oRbcbcyKpqzu1htE3Ac9/+Ic+ag1WRItEY45SMe0BHfhGL8zHaNC7zLIPcHDuIZz6 bHGyDr/kNSTrFAbFVMQw+8TjR6X6yoJNj7jWyzRU397mxv1dqgS5nfMVPdFSLSziFWzeXglLptm tg0IT58O0jDiIB4X5Mb2Jx+8RXQWm1c612gvue7NJnpQWid2XF78fHC1fU+vOa/hU8rlZxMHQ5W YREygTO4AH1ub077sbrhVmooiBc546jW2S/yTBlhZC5HUM3SHQHM4jJMtF0TmnykhITnvK0xw41 RdVsgGsQkRyJXG0tmirqs18l4qVQo2USVtgxYe90pU5/emFpp0JyopwJH1XRC9nnXc8kVsDvZfB ZtCjLfQu1TNrQgoaHk864D7PHqEWuCrUqc//IkSBffmoV/1u8xIHTFLL07fwjGvq678RWkGchZ8 fCSs1/P0jSyzHKktBeGVBfXiGlgCe/S4QFzMHxnLOE0zA6Ko8EAhG7XLA3Y= X-Received: by 2002:a05:600c:8486:b0:4ac:aae6:6401 with SMTP id 5b1f17b1804b1-4bb8880606fmr779299325e9.12.1796181461105; Tue, 01 Dec 2026 19:17:41 -0800 (PST) Received: from NULL.Home.net ([2001:8a0:7280:4000:12d:c3b9:cecc:8966]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb884a3a3dsm1050648415e9.10.2026.12.01.19.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 19:17:40 -0800 (PST) From: Eric Curtin To: linux-kernel@vger.kernel.org Cc: Ryan Roberts , Cheng-Yi Chiang , Tzung-Bi Shih , Guenter Roeck , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Benson Leung , Oder Chiou , chrome-platform@lists.linux.dev, linux-sound@vger.kernel.org Subject: [RFC PATCH v2 3/3] ASoC: codecs: Initialise PCM hardware tables at boot for page size Date: Wed, 2 Dec 2026 03:17:29 +0000 Message-ID: <20261202031733.1704898-4-ericcurtin17@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261202031733.1704898-1-ericcurtin17@gmail.com> References: <20261202031733.1704898-1-ericcurtin17@gmail.com> X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Ryan Roberts The snd_pcm_hardware tables in cros_ec_codec.c and rt5514-spi.c use PAGE_SIZE in their initialisers. That is not a constant expression with arm64 boot-time page size selection, so the tables cannot be static initialisers. Define them with DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(), which keeps a normal const initialiser for a fixed page size and otherwise fills the table in once the page size is known at boot. In cros_ec_codec.c the table was local to wov_pcm_open(), so it moves to file scope. Signed-off-by: Ryan Roberts Signed-off-by: Eric Curtin --- sound/soc/codecs/cros_ec_codec.c | 30 +++++++++++++++--------------- sound/soc/codecs/rt5514-spi.c | 5 +++-- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c index b6f7016a324a..f6e0395d47a1 100644 --- a/sound/soc/codecs/cros_ec_codec.c +++ b/sound/soc/codecs/cros_ec_codec.c @@ -874,24 +874,24 @@ static void wov_remove(struct snd_soc_component *component) &priv->ec_device->event_notifier, &priv->wov_notifier); } +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, hw_param, { + .info = SNDRV_PCM_INFO_MMAP | + SNDRV_PCM_INFO_INTERLEAVED | + SNDRV_PCM_INFO_MMAP_VALID, + .formats = SNDRV_PCM_FMTBIT_S16_LE, + .rates = SNDRV_PCM_RATE_16000, + .channels_min = 1, + .channels_max = 1, + .period_bytes_min = PAGE_SIZE, + .period_bytes_max = 0x20000 / 8, + .periods_min = 8, + .periods_max = 8, + .buffer_bytes_max = 0x20000, +}); + static int wov_pcm_open(struct snd_soc_component *component, struct snd_pcm_substream *substream) { - static const struct snd_pcm_hardware hw_param = { - .info = SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_MMAP_VALID, - .formats = SNDRV_PCM_FMTBIT_S16_LE, - .rates = SNDRV_PCM_RATE_16000, - .channels_min = 1, - .channels_max = 1, - .period_bytes_min = PAGE_SIZE, - .period_bytes_max = 0x20000 / 8, - .periods_min = 8, - .periods_max = 8, - .buffer_bytes_max = 0x20000, - }; - return snd_soc_set_runtime_hwparams(substream, &hw_param); } diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c index bcc2ff28b125..f619f3475397 100644 --- a/sound/soc/codecs/rt5514-spi.c +++ b/sound/soc/codecs/rt5514-spi.c @@ -46,7 +46,8 @@ struct rt5514_dsp { int irq; }; -static const struct snd_pcm_hardware rt5514_spi_pcm_hardware = { +static DEFINE_GLOBAL_PAGE_SIZE_VAR_CONST(struct snd_pcm_hardware, + rt5514_spi_pcm_hardware, { .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_INTERLEAVED, @@ -58,7 +59,7 @@ static const struct snd_pcm_hardware rt5514_spi_pcm_hardware = { .channels_min = 1, .channels_max = 1, .buffer_bytes_max = 0x20000, -}; +}); static struct snd_soc_dai_driver rt5514_spi_dai = { .name = "rt5514-dsp-cpu-dai",