[RFC PATCH 08/11] ALSA: mixer_audient: Add control initialization at probe
From: Christian Ruppert
Date: Sat Oct 31 2026 - 20:03:03 EST
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>
---
sound/usb/mixer_audient.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/sound/usb/mixer_audient.c b/sound/usb/mixer_audient.c
index 2f1b332859c9..803487ced997 100644
--- a/sound/usb/mixer_audient.c
+++ b/sound/usb/mixer_audient.c
@@ -36,6 +36,7 @@ enum snd_audient_type {
static const DECLARE_TLV_DB_MINMAX_MUTE(snd_audient_tlv_mixer, -12800, 600);
#define SND_AUDIENT_CTYPE_FLAGS_SIGNED (1L << 0)
+#define SND_AUDIENT_CTYPE_FLAGS_INIT_HW (1L << 1)
static const struct snd_audient_ctrl_type {
snd_ctl_elem_type_t type;
@@ -47,6 +48,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;
@@ -532,6 +534,18 @@ 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)
+ return ret;
+ }
+ }
+
elem = kzalloc_obj(*elem);
if (!elem)
return -ENOMEM;
--
2.56.0