[RFC PATCH 08/16] ALSA: mixer_audient: Add control initialization at probe
From: Will Porter
Date: Fri Nov 06 2026 - 11:40:21 EST
From: Christian Ruppert <arc@xxxxxx>
Add the possibility to initialize certain control types to known values at
probe time. This is particularly useful for controls which initially read
wrong values and for controls which cannot be read at all.
Signed-off-by: Christian Ruppert <arc@xxxxxx>
Co-developed-by: Will Porter <mrwillporter@xxxxxxxxx>
Signed-off-by: Will Porter <mrwillporter@xxxxxxxxx>
Assisted-by: Claude:claude-opus-5-5
---
sound/usb/mixer_audient.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/sound/usb/mixer_audient.c b/sound/usb/mixer_audient.c
index 433bb5479d8e..70ec3274a5e4 100644
--- a/sound/usb/mixer_audient.c
+++ b/sound/usb/mixer_audient.c
@@ -38,6 +38,7 @@ enum snd_audient_type {
static const DECLARE_TLV_DB_MINMAX_MUTE(snd_audient_tlv_mixer, -12800, 600);
#define SND_AUDIENT_CTYPE_FLAGS_SIGNED BIT(0)
+#define SND_AUDIENT_CTYPE_FLAGS_INIT_HW BIT(1)
static const struct snd_audient_ctrl_type {
snd_ctl_elem_type_t type;
@@ -49,6 +50,7 @@ static const struct snd_audient_ctrl_type {
union {
long integer;
} max; /* for booleans holds physical int value for true */
+ u32 init;
const unsigned int *tlv;
u8 unit;
u8 sel;
@@ -533,6 +535,20 @@ static int snd_audient_add_ctrl(struct usb_mixer_interface *mixer,
return -EINVAL;
}
+ if (ctype->flags & SND_AUDIENT_CTYPE_FLAGS_INIT_HW) {
+ int i;
+
+ for (i = 0; i < ctrl->hwchannels; i++) {
+ int ret = snd_audient_raw_set_one(mixer, ctype,
+ ctrl->val_offs + i,
+ ctype->init);
+ if (ret < 0)
+ usb_audio_warn(mixer->chip,
+ "%s: cannot set channel %d (%d)\n",
+ ctrl->name, i, ret);
+ }
+ }
+
elem = kzalloc_obj(*elem);
if (!elem)
return -ENOMEM;
--
2.47.3