ASoC: SDCA: Align mute controls to ALSA expectations

Currently mute controls will be called "FU xx Mute Switch" (note
the switch is added programmatically outside the coverage of this
patch) and the accompanying volume control would be called "FU xx
Channel Volume".  These names are taken from the SDCA specification,
however, this does not mesh well with the ALSA naming system. ALSA
generally expects enables rather than mutes and expects that mutes
and volumes have matching names.

Update the names and invert the mute controls to make them more
standard "FU XX Channel Switch", this does slightly deviate from
the SDCA specification but it makes the rest of the Linux ecosystem
a lot happier.

Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20251127163426.2500633-2-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Charles Keepax 2025-11-27 16:34:20 +00:00 committed by Mark Brown
parent c45d5d9803
commit 5fee9edf79
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0
2 changed files with 4 additions and 1 deletions

View File

@ -611,7 +611,7 @@ enum sdca_entity0_controls {
#define SDCA_CTL_NDAI_PACKETTYPE_NAME "NDAI Packet Type" #define SDCA_CTL_NDAI_PACKETTYPE_NAME "NDAI Packet Type"
#define SDCA_CTL_MIXER_NAME "Mixer" #define SDCA_CTL_MIXER_NAME "Mixer"
#define SDCA_CTL_SELECTOR_NAME "Selector" #define SDCA_CTL_SELECTOR_NAME "Selector"
#define SDCA_CTL_MUTE_NAME "Mute" #define SDCA_CTL_MUTE_NAME "Channel"
#define SDCA_CTL_CHANNEL_VOLUME_NAME "Channel Volume" #define SDCA_CTL_CHANNEL_VOLUME_NAME "Channel Volume"
#define SDCA_CTL_AGC_NAME "AGC" #define SDCA_CTL_AGC_NAME "AGC"
#define SDCA_CTL_BASS_BOOST_NAME "Bass Boost" #define SDCA_CTL_BASS_BOOST_NAME "Bass Boost"

View File

@ -886,6 +886,9 @@ static int populate_control(struct device *dev,
mc->min = 0; mc->min = 0;
mc->max = clamp((0x1ull << control->nbits) - 1, 0, type_max(mc->max)); mc->max = clamp((0x1ull << control->nbits) - 1, 0, type_max(mc->max));
if (SDCA_CTL_TYPE(entity->type, control->sel) == SDCA_CTL_TYPE_S(FU, MUTE))
mc->invert = true;
(*kctl)->name = control_name; (*kctl)->name = control_name;
(*kctl)->private_value = (unsigned long)mc; (*kctl)->private_value = (unsigned long)mc;
(*kctl)->iface = SNDRV_CTL_ELEM_IFACE_MIXER; (*kctl)->iface = SNDRV_CTL_ELEM_IFACE_MIXER;