From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.46 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796181462; b=HsUNDJApK7oZ7MgsrscOpOnpJHSJR5PxYDp3wws15aLpnvFAvqo6iYJYzhu+XJnQcMOu /FwctZyyvYlXoiJqlZP2cbUmizf2v9yiqYgwlmOoCUdsw5b428dkZUHaWxTMpUBpBE+Sn 8ze6ipr1I+iXn04q1pVRzp8YHSYV7fA/oIqFxBnWvbLH6nXd7FhQyytpiLZ4ANVJp+cDv os1POYoTmevsRGAXcOaZXMlzoX157h541gqXWXRVAaCWzcrqzbT7Zxt4vl+U8Bl3t0Yv1 JJBhXZcPAaHI4QooEaWNDuLbmZ17nfn9jNMvj2MsJX7wC9b1M7o+rIUEfeba29RSiJg== 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=ChVsL8GOIZT0ZT7HuaYwCl9g3IiP2jPhj3s06UEo2uBs3qB33jMRATKl356k0MDiZ31V OT2cRT3mjmZjoqsAbXKr/AyUnpjKz1t03TevKqQEeyNCYz/PRt/bdS/keUkth+gGXGiTZ qN0UAKdwo/AE7SW/Je+VYNunIMlIwHSwIZtLKs834U01lwwJmZupamjfBsOaxe2yqaJsa 6t9Lthwg5iyjvCuybaEeHcKvz2yHwUEFqMKCDfXPOwJFBa8IX7JEr8MIBOjUgieiHTU7H vu+F2SYbdcxHjT82FTacP3Lg6laqp2bLpVBR4G+qJxwLopqrmLWeApveIVbMi4L6Y9g== 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="TFvLTb/D"; arc=none smtp.remote-ip=209.85.221.46 Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) (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 8F77160A3830 for ; Wed, 2 Dec 2026 03:17:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8F77160A3830 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=TFvLTb/D Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-498f5fa4f70so10572778f8f.0 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=lists.linux.dev; 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=TFvLTb/DM4L3Jog2SVPzSBYP7dRHAj4ogPnVOP7IerMHkMAKaSlOQzskGeziJMeG7M 3elz+2qDuK/MQoZ/TQRvwvN7IJme08o/4MVf2tfFIpgeXj+Yqo3x4C5632RQb/DrRy7H 6YLCjdP4LVLT5CUExtJNaacz0IZwy2atEzFqcGrsnV6dgBcG8Z7kqSqAwScXiXUOkxwm vCILDuTVrdZo6ZGyQUu7WxbbRlvbjHit4VX6fwcBUcqQFN+Yu5LEWhq6pqXHaFD9XpiB CCjdriuoXYKxsuUD9CoRIIYKzjQncZzJTjAlr/Fiha7yRPGHN+vdFPCRxYOUUgpiZRKv yEww== 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=KP4ItUSKU/xS0EIj+1CeTIwDSqtXNO+0EEpXx4K9AGCXMLst6RoA11jlxNDuwKzoEP oRXgDXIaFu8VPhoR/e8miYH5oYFTuO1g/oywZQ/rhkpXKSnxbCrS4bnUgA1DPLDITG8M 4cPGKIyrUmrtKNtkQXrSAh2JFL2a5FcDx8pemLHSHpjDqYm9ALO905FHALQXg0yyokv6 W91Twbkv/j64SqstJpwG31ow/pdYV77fNPnqEDnq3YOWY54xWisD+OCOxBvwPu8UQRls nD2ZpyTbn9ssA20wPzHjf7Q22MVBepvGPh66pw5EAt6cxurKtnA6gIGQR/GoSIqprJki AReA== X-Forwarded-Encrypted: i=1; AL+hErGikLCCy4Wa7YexTClz9NPOuWbbuilqyq5IOH42ScGojdKH1c4mbKFmOduVxJlxiFkcliUPJk3Z3zXiN8cjaaU=@lists.linux.dev X-Gm-Message-State: APuU4Z+dc13QdmZ82ueD8dnxpGcN3eklY0yp5TPOuPLqxpghrAJJZSgn xv5vpfbyNGUwOV4B5ozr6luxE93b+NO4u5IFPYu4QzSDDRZROSGaOW82 X-Gm-Gg: AZFdTZcj32jjeJY/wJwBmGhJWjwxS3txxsfuBKoIrAijic6GiNH3bkFOHDPAeSYGl9A ++4rTKAECI60/3LH0xlvuj5VU4ysLmRDdGtxkzuT/Y+pA8CBHcglk9QYwEWo2XNB1GVphoLJ5mG sD8ZBuei/XoUSSKpt9ptrSokZOahuNn+BOmGdneXvys5eEC4Z+QikX8gmQBmiMcNosBH3a8WVuN qW98OWB5zgZX5mNW4NCpprLx9GW63aGBhYtWxvL2dTqvPNOkWLApK5qh2ndnFH9GleaiAJY23EB 31Upqk0Dw/oSyA6fzwM3z8SFYYiAehsuyqIR8hLFgFmhYLNOIftukGjd9be1gscZAC+eI/KBCcj alAYThhRi6BHKHQcxOpODV2I1T+hILtdpovzYhV1sDvi8v9sTdfebuteJJDKMqPxEVLftr8Rqox G9Wi3CCzyt5ljCqxw/ZxaPYfWnfL3v8qVqm/Kc1CH9fYkOV7k+Qmzc7i5VBdefCGPmvTZ8I1J4K BEGfnanMc4g872tCs0CAt+TOL7mLua527jWH/XHUA6JiwY3NByyYF2DzeqpAK6FQ9+gn0yr2BLR zPV4wNVhSO1CNBLA0mry9AX4IPUu3Kuc3hsLsQJNEhDz56iZq3mdXw4g7c4= 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: chrome-platform@lists.linux.dev 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",