From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.44 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796057127; b=4TiMsXoAIfmQn96sJcIL3yqSLekkto/dpKd4UPBnIe9I6INeNYS7BP/V6zJVuvxJi5f5 TxYmtTv/GaPl4A2/mch6/ADkdpEbPB8Z3SvAs0sgdOMSdYv3vDtNtROZmXqEdjiPrg377 TalYUjJ4nP6gsNnKM6D/RDZmDudrdGzc7r1tkVTPwH1g6XVNlj4+nWzykVu6jI6yTsBEe Ew75MQJpw4KbntdQ2kU0R4LIp776Qi81fu44z//5Op2Hxd9w4hpbc7a6jhEoxEycLtq7d 3PqgZdVKWrmOpCwky1phpi0TH7lipiclFl45n07C6Tvu4FnVVVQraWmG3IR2kN89NDQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796057127; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=8eLgNuslzjJN4/te/K0TVTCtAX6hL8KT5JMW9RllMR8=; b=J7cw6d+HmQic9HB+DV6arZuQoaRMebdbO+rsRUOoPFeC7gLXWJNmRixQA8iBY998JP3L ZTCRv5McMul7Rm19oPQkSqJ1ySpveJbIkk2XPdM0XvDN7PxvdlFDFA/Q4ZGfHrVEEu9GX mfDglEu+ytK+nauIqDeK8VLrEyWQMDLw1Ug/NdXeSOBcxNscMqBo49KZT9gnHdOJBFgc5 gYe4e8w2FXInIOgMD6ykEIbCBG8DL3PjTfH9v+FeEH3Ql1xtak7Y4oI8oaRlypHf8I9Bn hR0uWMBWL2y9ewA8Yi/hf0plQbOCUCmmhXW+mI8sBTgW72u+KQdiLws3vzSKUc1x7lw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=bSe4dZ0U; arc=none smtp.remote-ip=209.85.161.44 Received: from mail-oo1-f44.google.com (mail-oo1-f44.google.com [209.85.161.44]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4563E60A3803 for ; Mon, 30 Nov 2026 16:45:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 4563E60A3803 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=bSe4dZ0U Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-702fd86d674so6914605eaf.2 for ; Mon, 30 Nov 2026 08:45:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796057126; x=1796661926; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=8eLgNuslzjJN4/te/K0TVTCtAX6hL8KT5JMW9RllMR8=; b=bSe4dZ0UItIyRU7VBqL78K4wPCY07/3aihsSY9NooMxB2CXNaLxM0+Y3lX89cspk4U lU0N5dGo0mWJ/yY+lZzAmsBSX0qU136IHdICTTup71x2gTMLDSFT7hXI2xRmSr48BSBz e1o9PdVqczUeylAw/r9hxyV2ILyYnxTabAq6Z3FiuJ/uLUPWluY3/vEdeRPVQychXT8/ iDmle6uPtPcd2nr0tRtswaEwmbOgzTRJgy92X/SgxBTR/4yZ4WbCnZ1gpN7I2aN6ERos UhImnpQCtd5Ax11RXBMTJnRP03phVhKLMdZ59A7aLT3wFxBMUdAcvpXOlxoxVxV7rl0O FqfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796057126; x=1796661926; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=8eLgNuslzjJN4/te/K0TVTCtAX6hL8KT5JMW9RllMR8=; b=0sIacCGTJaRu8HU1VrGvA0+C7VZFBNwuPeUZZW39uNgJ3p+w0VAdj5Z3zI8nrmCn04 RqsSvN5zrXIFoYAYhPtljD/km2Z1/zgNf0Ae3kgAUX8uTHYynoEVR1ELP069N6Hfi3kG jrZN9Kr6jxL3M8/QPIcucbpvuyFbm4Fo4FH5PYBusn5DYTOk7OuBZ4zvrrTioSWT81bG mDVPpyFsgdCOvOWYfv/zvkTFp+LbYKf4AGBAH1TjW+llIYSVBpzQ2T+Bih+gsvNraqnx uaKzC1jE6mbb6+vgiFoIVxKIb48KrSQ6Tp1v2xTnv7ZmbYiY/+boOJHI3tH7TwmBwycB 6b6Q== X-Forwarded-Encrypted: i=1; AL+hErFcP4/C04U2o0MTzRRS8DAqptOKCOfPxCur49cGvUaVZm7HtS2T9sNNz/UUT23VinbA1vzB6OUwUmutL2A=@vger.kernel.org X-Gm-Message-State: APuU4Z9by9rBpNWZhMDevxQJTPrhgjA86LPLzLHCZ1OuQhg2cdtWkx3H S8zRe90GXrIqJ0HEqvK9LrAzdafIal/UytBXFMkFMEMBW7c0HCyWa4SYj/gbbu8z X-Gm-Gg: AZFdTZcqEYWsGcrhFLIG4jjg81STu0gxEtjEJCkQhVU1odQ3w5yY4Ck4MrSOHRYCSf8 97BAXzQplaVgLCOkGX4CwVK7he70cHMjLEYXuJe9cSnE30AWAyHrJQzy+E4osIkMmaHU1NdIZIo LuiADuz4qvkp0BdXaanvjE8RfHy91twiLZsihzbLLYaXIupw6mWEAp55GxSoEAvU2a9pUsay2gp oAFOraXAbYRDbFPlmbak4vkJ4z73Os8R26hh6LE/skPvEUaNy1bbyj13s0zfxlBINir7VyAJhPA FBiUY2TSICiRpmdUF+HUGrjSZm4XpPrkp0a/WgrqsScV+s7cyuNzKogrWmctKxfFq35EF9Kh/0J 014EbfbOFBmsnfuTwSHEBNqeYg+wvGZ2fMzJHzIxHkejqDqmhtX2lwxF4RF3/xsCfIYOfVPbbuj RC6GdX56cmy7PEn1u8eppT4iykhDKMyxV0ppQhLajWQhMUUa86BngIwMHgP5WuChEz3GnYdZq3d GVoPxNXOwDrXUGx41IZB4rG0jbEWU6FBEuDYbl0VTHTDUSr9gA+Vw412Yyfp9ibxY579cQKMg5j YHMZJeYql4vj6BRA5NOOvFaLMzCNjEaCexfmJYAB7jacAA== X-Received: by 2002:a05:6820:162b:b0:71b:911f:ae01 with SMTP id 006d021491bc7-71b911fae90mr11480986eaf.55.1796057126033; Mon, 30 Nov 2026 08:45:26 -0800 (PST) Received: from localhost.localdomain ([2600:1702:4ff0:baa0:5054:ff:fe3d:4ddb]) by smtp.gmail.com with ESMTPSA id 586e51a60fabf-4bc5f7ae7dcsm28002053fac.8.2026.11.30.08.45.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 08:45:25 -0800 (PST) From: Will Porter To: Takashi Iwai , Jaroslav Kysela Cc: Christian Ruppert , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, Neil Andrews , Nikita Tarasov Subject: [PATCH v2 21/21] ALSA: mixer_audient: Replace the Audient iD14 MkI FU 12 control Date: Mon, 30 Nov 2026 10:44:28 -0600 Message-ID: <20261130164428.2930348-22-mrwillporter@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261130164428.2930348-1-mrwillporter@gmail.com> References: <20261130164428.2930348-1-mrwillporter@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Feature unit 12 sets the level of the mixer outputs: channels 1-2 Main, 3-4 Cue. Two firmware faults make the generic control wrong on the MkI: - GET CUR does not return the FU 12 value. It returns a reply buffer that the device shares with FU 10, MU 60 and XU 51. The buffer holds the data of the last GET or SET to any of them. So the generic sticky-GET check passes, because GET echoes the SET just sent. The check then writes the stale value that it read first to channel 1. - Main L ignores its level, but Main R applies it. So any Main value other than 0 dB unbalances the main outputs. audient_id14_map already records this asymmetry. A loopback cable measured it: Main R at -20 dB and -40 dB changes its output by -20.0 and -40.9 dB. Main L at the same values changes nothing. Cue L and Cue R both work: Cue L follows the set value within about 1 dB down to at least -70 dB; the headphone residual hides lower levels. Replace the generic control with one of the same name, count and range. It is "Monitor Mix Playback Volume", with four values from 0 to 127 in 1 dB steps. 127 is 0 dB. For Cue, value 0 writes 0x8000 (-128 dB, one step below the GET RANGE minimum of -127 dB), and the TLV declares it as mute. On Cue L, value 0 gives no output above the fixed headphone residual, about 76 dB below 0 dB. The four values keep the Main L/R, Cue L/R layout of existing saved ALSA states. The control holds Main at 0 dB: Main L does not apply a level, so 0 dB on Main R keeps the main outputs balanced. A put always sends 0 dB to channels 1-2, whatever Main values it asks for. After a successful write, get reports 127 (0 dB) for them. For Cue the control shows the last value the device accepted. At probe the driver writes Main 0 dB and Cue muted, once per channel. A channel whose probe write fails reads as mute until a put succeeds. The iD14 MkI profile in alsa-ucm-conf writes 127,127,127,127 to this control at boot and when its HiFi verb starts. The new control accepts that write: Main stays at 0 dB and Cue goes to 0 dB, the same result as with the generic control. Differences from the generic control: - Value 0 is now mute. It was -127 dB. - The control holds Main at 0 dB. A Main R attenuation stored with the generic control (for example 107, -20 dB) now restores as 0 dB, which raises Main R by 20 dB. Main L never applied that attenuation, so Main R comes up to the level that Main L already had. FU 12 comes before the monitor controller (XU 54) and the headphone level (FU 10), so the volume knob still sets the listening level. - Cue starts muted at every probe. An output routed to the Cue Mix keeps that routing across a module reload or a rebind. On mains power it also keeps it across a replug. If the probe writes succeed, that output is then muted until user space sets the Cue level (alsactl restore or the UCM boot write). On bus power the MkI returns to DAW Thru when it enumerates, so no output is on the Cue Mix at probe. The control is a new type in the device table, with the INIT_HW, CACHE and GET_BROKEN flags. GET_BROKEN, because of the shared reply buffer: the driver sends no GET to FU 12. The unified get and put convert between the control value and the device value, and hold Main at 0 dB. Co-developed-by: Christian Ruppert Signed-off-by: Christian Ruppert Signed-off-by: Will Porter --- sound/usb/mixer_audient.c | 124 +++++++++++++++++++++++++++++++++++--- sound/usb/mixer_maps.c | 2 +- 2 files changed, 115 insertions(+), 11 deletions(-) diff --git a/sound/usb/mixer_audient.c b/sound/usb/mixer_audient.c index cc33ccf83c1c2..93fad4b74e18d 100644 --- a/sound/usb/mixer_audient.c +++ b/sound/usb/mixer_audient.c @@ -55,17 +55,45 @@ enum snd_audient_type { SND_AUDIENT_TYPE_ID14_MON_ID_KEY, SND_AUDIENT_TYPE_ID14_MON_TALKBACK_SRC, SND_AUDIENT_TYPE_ID14_OPTICAL_MODE, + SND_AUDIENT_TYPE_ID14_FU12, SND_AUDIENT_TYPE_NCTYPES }; /* Mixer matrix: -128dB (mute) to +6dB */ static const DECLARE_TLV_DB_MINMAX_MUTE(snd_audient_tlv_mixer, -12800, 600); +/* + * iD14 MkI FU 12, the mixer output level: CN 1-2 Main, 3-4 Cue. GET RANGE + * works (-127 ... 0 dB, 1 dB steps), but GET CUR returns a reply buffer the + * device shares with other units, not the FU 12 value. So the generic + * control shows stale data, and its sticky-GET check passes and then writes + * that stale value to Main L. + * + * The firmware ignores Main L (CN 1) but applies Main R (CN 2), so any Main + * level other than 0 dB unbalances the main outputs (Cue L and Cue R both + * work). This control holds Main at 0 dB: a put sends 0 dB to CN 1-2 + * whatever it asks for, and get reports it. + * + * It keeps the generic control's name and format: four values, 0 ... 127 + * in 1 dB steps, 127 = 0 dB, 0 = mute (0x8000). It shows the last value the + * device accepted, and every put sends all four channels. + */ +#define ID14_FU12_MAIN_CHANNELS 2 /* CN 1-2, held at 0 dB */ +#define ID14_FU12_MAX 127 +#define ID14_FU12_MUTE 0 +#define ID14_FU12_HW_MUTE (-128 * 256) + +static const DECLARE_TLV_DB_MINMAX_MUTE(snd_audient_tlv_id14_fu12, -12700, 0); + +/* control type flags */ #define SND_AUDIENT_CTYPE_FLAGS_SIGNED BIT(0) #define SND_AUDIENT_CTYPE_FLAGS_INIT_HW BIT(1) #define SND_AUDIENT_CTYPE_FLAGS_GET_BROKEN BIT(2) #define SND_AUDIENT_CTYPE_FLAGS_CACHE BIT(3) +/* Private control element types for quirky controls */ +#define SNDRV_AUDIENT_CTL_ELEM_TYPE_ID14_FU12 (SNDRV_CTL_ELEM_TYPE_LAST + 1) + /* * An enumerated control: item i sends values[i]. A get of a device value * outside the list returns -EIO; it does not show a wrong item. @@ -376,6 +404,21 @@ static const struct snd_audient_ctrl_type { .unit = ID14_IT_DIGITAL, .sel = ID14_IT_OPTICAL_MODE, }, + [SND_AUDIENT_TYPE_ID14_FU12] = { + .type = SNDRV_AUDIENT_CTL_ELEM_TYPE_ID14_FU12, + .flags = SND_AUDIENT_CTYPE_FLAGS_SIGNED + | SND_AUDIENT_CTYPE_FLAGS_INIT_HW + | SND_AUDIENT_CTYPE_FLAGS_GET_BROKEN + | SND_AUDIENT_CTYPE_FLAGS_CACHE, + .len = 2, + .min.integer = -127 * 256, + .max.integer = 0, + .init = ID14_FU12_HW_MUTE, + .res = 256, + .unit = ID14_FU_MIX, + .sel = UAC_FU_VOLUME, + .tlv = snd_audient_tlv_id14_fu12, + }, }; @@ -470,6 +513,7 @@ static const struct snd_audient_ctrl snd_audient_id14_mk1_controls[] = { ID14_CTRL("iD Key Function Playback Enum", MON_ID_KEY, 0, 1), ID14_CTRL("Talkback Source Capture Enum", MON_TALKBACK_SRC, 0, 1), ID14_CTRL("Digital In Mode Capture Enum", OPTICAL_MODE, 0, 1), + ID14_CTRL("Monitor Mix Playback Volume", FU12, 1, 4), { 0 }, /* sentinel */ }; @@ -734,6 +778,31 @@ static int snd_audient_enum_item(const struct snd_audient_enum *e, u32 value) return -EIO; } +static inline u32 +snd_audient_fu12_from_ctl(const struct snd_audient_ctrl_type *ctype, long val) +{ + s32 ret; + + if (val == ID14_FU12_MUTE) + ret = ID14_FU12_HW_MUTE; + else + ret = ctype->min.integer + val * ctype->res; + + return (u32)ret; +} + +static inline long +snd_audient_fu12_to_ctl(const struct snd_audient_ctrl_type *ctype, u32 buf) +{ + s32 val = (s32)buf; + + if (val == ID14_FU12_HW_MUTE) + return ID14_FU12_MUTE; + else + return min(DIV_ROUND_CLOSEST(val - ctype->min.integer, + (long)ctype->res), + snd_audient_int_max(ctype)); +} static int snd_ctl_audient_get(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *ctl_val) @@ -798,6 +867,10 @@ static int snd_ctl_audient_get(struct snd_kcontrol *kctl, ctl_val->value.enumerated.item[i] = ret; } break; + case SNDRV_AUDIENT_CTL_ELEM_TYPE_ID14_FU12: + ctl_val->value.integer.value[i] = + snd_audient_fu12_to_ctl(ctype, buf); + break; } } @@ -833,6 +906,11 @@ static int snd_ctl_audient_set(struct snd_kcontrol *kctl, if (v->enumerated.item[i] >= e->items) return -EINVAL; break; + case SNDRV_AUDIENT_CTL_ELEM_TYPE_ID14_FU12: + if (v->integer.value[i] < 0 + || v->integer.value[i] > ID14_FU12_MAX) + return -EINVAL; + break; } } @@ -858,6 +936,14 @@ static int snd_ctl_audient_set(struct snd_kcontrol *kctl, case SNDRV_CTL_ELEM_TYPE_ENUMERATED: val = e->values[v->enumerated.item[i]]; break; + case SNDRV_AUDIENT_CTL_ELEM_TYPE_ID14_FU12: + if (i < ID14_FU12_MAIN_CHANNELS) { + val = ctype->max.integer; + } else { + val = snd_audient_fu12_from_ctl(ctype, + v->integer.value[i]); + } + break; } ret = snd_audient_raw_set_one(elem, ctype, base + i, val, @@ -878,25 +964,30 @@ static int snd_ctl_audient_info(struct snd_kcontrol *kctl, const struct snd_audient_ctrl_type *const ctype = snd_audient_kctl_type(kctl); + uinfo->type = ctype->type; + uinfo->count = snd_audient_kctl_channels(kctl); + switch (ctype->type) { - case SNDRV_CTL_ELEM_TYPE_ENUMERATED: - return snd_ctl_enum_info(uinfo, - snd_audient_kctl_channels(kctl), - ctype->enumeration->items, - ctype->enumeration->texts); case SNDRV_CTL_ELEM_TYPE_BOOLEAN: uinfo->value.integer.min = 0; uinfo->value.integer.max = 1; break; - default: + case SNDRV_CTL_ELEM_TYPE_INTEGER: uinfo->value.integer.min = snd_audient_int_min(ctype); uinfo->value.integer.max = snd_audient_int_max(ctype); break; + case SNDRV_CTL_ELEM_TYPE_ENUMERATED: + return snd_ctl_enum_info(uinfo, + snd_audient_kctl_channels(kctl), + ctype->enumeration->items, + ctype->enumeration->texts); + case SNDRV_AUDIENT_CTL_ELEM_TYPE_ID14_FU12: + uinfo->value.integer.min = 0; + uinfo->value.integer.max = ID14_FU12_MAX; + uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; + break; } - uinfo->type = ctype->type; - uinfo->count = snd_audient_kctl_channels(kctl); - return 0; } @@ -948,9 +1039,22 @@ static int snd_audient_add_ctrl(struct usb_mixer_interface *mixer, int i; for (i = 0; i < ctrl->hwchannels; i++) { + u32 init; + + switch (ctype->type) { + case SNDRV_AUDIENT_CTL_ELEM_TYPE_ID14_FU12: + if (i < ID14_FU12_MAIN_CHANNELS) + init = ctype->max.integer; + else + init = ctype->init; + break; + default: + init = ctype->init; + break; + } ret = snd_audient_raw_set_one(elem, ctype, ctrl->val_offs + i, - ctype->init, true); + init, true); if (ret < 0) usb_audio_warn(mixer->chip, "%s: cannot set channel %d (%d)\n", diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c index b88244b12a98a..0ff180e450b5b 100644 --- a/sound/usb/mixer_maps.c +++ b/sound/usb/mixer_maps.c @@ -543,7 +543,7 @@ static const struct usbmix_name_map audient_id14_map[] = { /* Audient iD14 MkI: model-specific control map. */ static const struct usbmix_name_map audient_id14_mk1_map[] = { { 11, NULL }, /* FU, see mixer_audient.c */ - { 12, "Monitor Mix Playback" }, /* FU, partial coverage */ + { 12, NULL }, /* FU, see mixer_audient.c */ { 60, NULL }, /* MU, see mixer_audient.c */ {} }; -- 2.47.3