From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.161.48 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796057128; b=5Ixiz754USvhJfC8UXlQp3NCFSbkW/sd4PrUU6CTdGPGIGaxifrJuk1QbG2xXUvKBTNv PIBhTs57ztzKdC7UwaKvOvx9GLNmYVjUz0nw/zMqM3iR/JncI442vPwy+iohM7KYigBqh ZDF7lBVH847yR2lQiludmCcIT95lGhwKw2diyXG9BhsxiLZ1+h4QkFmTj4jrtDhThFjzl yLvafDlJzLABcCjXESgLdaUvTGXcAgc7ty/t3XYBc0u1qB4z51m7BD1F+gmIOfUtMOmUE oG9GPLGYJdFtZoZMizD5HA/INNLSEaLdcLgb9dKhoYVcFRXC1/fIJJvh1K/62n3SCQg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796057128; 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=mHM4wUDoRP95ryGoahNQ68mxvXgdtzoQ9xAZz4X0om2qEYCm13s/JO9aUIcJwG0wTLrI V7uO4C0maTbBSNV4e/Fezsl6BNYZhddEsGauJvhK31beemLSWgm9p0SncfNOMnsguX6WX 53D5usRDoSX8e1X9N7Nj5T1DDrMriggiaFQoV5+Pmcddgu5NuNHuEcJk2HpN+StKbO23C 8FJmgTK8eJ5c8Ve8ql3ZNOe8tnz+Cz89pGhVCqqq9XXtE6Tlt50D3+P8NIKlPpQyMj7A0 k1BfZgIR1GggypOCF80vntJqEDGTe1yaJlWRnWsE+7+yxOuhfaZA/kmSHMutozm76IA== 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.48 Received: from mail-oo1-f48.google.com (mail-oo1-f48.google.com [209.85.161.48]) (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 471C660A3804 for ; Mon, 30 Nov 2026 16:45:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 471C660A3804 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-f48.google.com with SMTP id 006d021491bc7-71ac798b8bbso6399028eaf.1 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=PAatrEnW3vJ9uOzbu4ZPmOytSxrGgj8AwTkMpXxfUMsvkn2tnVOiwMxw7E7anQhyZB ij2euelSCrTcy231vl0g7SaZJHAhS5ITZWIPxMzRC915hjFpObu9sTuqKrxzyQxlVzFF VXYJV4RCvC3/UltSNw+LTA34Ss4lJyEg1KPRnnVS2lxCiMsACvENFLJMEPyP9cIFaFwy a6WR3WjVyB7YSGvnHEscrjdv3vEdyeH2tsHSCgIoFxIw519kD+sCTpOTDVFB2Rm7FPq6 2AOgKGEY2BfVIhdyNHeMOZ1pmc/QXslD1GBa9J01D01/hCIPq9ledHvsmLp2BUEfBFjH rrjA== X-Forwarded-Encrypted: i=1; AL+hErESXIfJMWZ+45sDpgnW8nkZyG8o58u1NBGvrpYVf7L+Tw8frBplviRM0qClsyrlZ5QZOGggNoHX7kmB5Q==@vger.kernel.org X-Gm-Message-State: APuU4Z/yYPu6EGpEs/CcxMEKNZ7ZV6cvIYzq+FW/NK4uiftLQaEGG/LC GEPG8BIH+2R00LybKdNiS6S7RzEcKK5w+A6y9pjboaDoqnaCmch8cy44 X-Gm-Gg: AZFdTZfFL5QS56OB7sO1sQQosdroH7F4dVKgtuDvi3I56yj15C8XonUIii1M+j/scUQ l8IEUc66I7VUhGfyG0NXIMxXaxSEfQFbU/WS66gxUKRl45sbZMPBRA4Mg508r2Uh6oY3YSplSf9 8ig2DQ72r3ybXVPs3lCbP+mzjCh+C6XuD9VPNb9IMpgK9A23CihD8JPvTemPPIC9IeM9Vm3dHKA TntL0/CQ1j5VPPS2JSRESVnqR4cSxNYi6X0q1sDxQ5LVShshBliAt9XhZHta7UsnsMjeIPaVYMN Y8eCBbI6Ab9IMHbj4T3b4y3EaUKXLcYPVy9Z4PTgQc7zLqtiV7IA19uYnjvtNtJOuZLN/6u+i2E Hqny48fPNteZlBwKlxF7LWKGIK1X0HCs/dD74yoCCnLnDnU3PLTQd3JkGULsmmxiP0PWW5iveUo E77/Apk/qAALy8Z7Vm8Yb9MqY0CWL+idcGAgGJ5Z2OCNaJZWG0kgAqlYknksOK3FNrzw13ENVMl 26Y4mfB/SL6tGyChDRT/l8dq241FQqnQKhXBC3gAaTedU4njlYXU3JGEOnd9YJkWuoE89EvGxyk IEohCO6QJava/iWWBF2UVLszDcn5yRVOIfb3swKkB1kL8g== 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-sound@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