From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Eric Curtin <ericcurtin17@gmail.com>
Cc: linux-kernel@vger.kernel.org, Ryan Roberts <ryan.roberts@arm.com>,
Cheng-Yi Chiang <cychiang@chromium.org>,
Guenter Roeck <groeck@chromium.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>, Benson Leung <bleung@chromium.org>,
Oder Chiou <oder_chiou@realtek.com>,
chrome-platform@lists.linux.dev, linux-sound@vger.kernel.org
Subject: Re: [RFC PATCH v2 3/3] ASoC: codecs: Initialise PCM hardware tables at boot for page size
Date: Wed, 2 Dec 2026 04:56:28 +0000 [thread overview]
Message-ID: <aw-k_E-SolAz65Yz@google.com> (raw)
In-Reply-To: <20261202031733.1704898-4-ericcurtin17@gmail.com>
On Wed, Dec 02, 2026 at 03:17:29AM +0000, Eric Curtin wrote:
> From: Ryan Roberts <ryan.roberts@arm.com>
>
> 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.
The cover letter [1] should be sent to the recipients of the patch as well,
so the context is easier to find.
[1] https://lore.kernel.org/all/20261202031733.1704898-1-ericcurtin17@gmail.com
> 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,
> +});
If keeping it this way, hw_param is moved from function scope to file scope
and needs a prefix, e.g., wov_hw_param.
> +
> 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,
> - };
> -
Overall, I think this is overkill. Replacing PAGE_SIZE here with SZ_4K
would be the simplest fix. At least cros_ec_codec was written and tested
assuming PAGE_SIZE is 4K.
prev parent reply other threads:[~2026-12-02 4:56 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 3:17 [RFC PATCH v2 0/3] ALSA/ASoC: Prepare for boot-time page size selection on arm64 Eric Curtin
2026-12-02 3:17 ` [RFC PATCH v2 1/3] ALSA: Handle run-time PAGE_SIZE in PCM hardware tables and #if checks Eric Curtin
2026-12-02 3:17 ` [RFC PATCH v2 2/3] ASoC: tegra: Initialise PCM hardware limits at boot for page size Eric Curtin
2026-12-02 3:17 ` [RFC PATCH v2 3/3] ASoC: codecs: Initialise PCM hardware tables " Eric Curtin
2026-12-02 4:56 ` Tzung-Bi Shih [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aw-k_E-SolAz65Yz@google.com \
--to=tzungbi@kernel.org \
--cc=bleung@chromium.org \
--cc=broonie@kernel.org \
--cc=chrome-platform@lists.linux.dev \
--cc=cychiang@chromium.org \
--cc=ericcurtin17@gmail.com \
--cc=groeck@chromium.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=oder_chiou@realtek.com \
--cc=perex@perex.cz \
--cc=ryan.roberts@arm.com \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®