From: Piyush Patle <piyushpatle228@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Sheetal <sheetal@nvidia.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
Thierry Reding <thierry.reding@gmail.com>,
Liam Girdwood <lgirdwood@gmail.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>,
linux-sound@vger.kernel.org, linux-tegra@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/2] ASoC: tegra210: simplify byte map handling in ADX and AMX
Date: Wed, 8 Apr 2026 22:38:16 +0530 [thread overview]
Message-ID: <20260408170818.70322-1-piyushpatle228@gmail.com> (raw)
In-Reply-To: <20260407170308.100238-3-piyushpatle228@gmail.com>
The Tegra210 ADX and AMX drivers both keep their "Byte Map N" ALSA
control state as a byte-packed u32 map[] array along with a separate
byte_mask[] bitmap. This is because the control range exposed to
userspace is [0, 256], where 256 is the "disabled" sentinel and
does not fit in a byte, so the two arrays have to be cross-checked
on every get()/put().
This series stores each slot as a u16 holding the user-visible
value directly, turning get_byte_map() into a direct return and
put_byte_map() into a compare-and-store. The hardware-facing packed
RAM word and the IN_BYTE_EN / OUT_BYTE_EN enable masks are computed
on the fly inside each write_map_ram() callback, which is the only
place that needs to know the hardware layout. The byte_mask[] field
is dropped from both driver state structs.
There is no userspace-visible ABI change. Control declarations,
ranges, initial values and handling of out-of-range writes is
preserved by treating values outside [0, 255] as disabled (256),
matching previous behavior. As a side effect each patch also fixes
a latent bug in put_byte_map() where an enabled-to-enabled value
change was not persisted.
The packed RAM word construction is also updated to ensure the shift
operates on a u32 value, avoiding potential undefined behavior due
to signed integer promotion.
Addresses TODO comments left in tegra210_{adx,amx}_get_byte_map().
Changes since v1:
- Allocate byte_mask[] dynamically using kcalloc() based on
soc_data->byte_mask_size instead of fixed-size arrays
- Propagate -ENOMEM from write_map_ram() to callers
- Replace magic numbers with TEGRA_{ADX,AMX}_SLOTS_PER_WORD
- Use BITS_PER_BYTE and BITS_PER_TYPE() instead of literal shifts
- Add <linux/bits.h> and <linux/slab.h> includes
Patch 1/2: ASoC: tegra210_adx: simplify byte map get/put logic
Patch 2/2: ASoC: tegra210_amx: simplify byte map get/put logic
--
2.34.1
next prev parent reply other threads:[~2026-04-08 17:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-07 17:03 [PATCH 0/2] ASoC: tegra210: simplify byte map handling in ADX and AMX Piyush Patle
2026-04-07 17:03 ` [PATCH 1/2] ASoC: tegra210_adx: simplify byte map get/put logic Piyush Patle
2026-04-07 17:03 ` [PATCH 2/2] ASoC: tegra210_amx: " Piyush Patle
2026-04-08 14:08 ` Sheetal .
2026-04-08 17:08 ` Piyush Patle [this message]
2026-04-08 17:08 ` [PATCH v2 1/2] ASoC: tegra210_adx: " Piyush Patle
2026-04-08 17:38 ` Jon Hunter
2026-04-08 21:19 ` Piyush Patle
2026-04-08 17:47 ` Mark Brown
2026-04-08 21:25 ` Piyush Patle
2026-04-08 17:08 ` [PATCH v2 2/2] ASoC: tegra210_amx: " Piyush Patle
2026-04-08 17:49 ` Mark Brown
2026-04-08 17:41 ` [PATCH v2 0/2] ASoC: tegra210: simplify byte map handling in ADX and AMX Mark Brown
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=20260408170818.70322-1-piyushpatle228@gmail.com \
--to=piyushpatle228@gmail.com \
--cc=broonie@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=kuninori.morimoto.gx@renesas.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=perex@perex.cz \
--cc=sheetal@nvidia.com \
--cc=thierry.reding@gmail.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