From nobody Thu Apr 16 08:37:25 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB7FC30BF70; Sun, 1 Mar 2026 21:37:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401077; cv=pass; b=GE22yjvPPokD8LekyMQaIg7ikOFLea7YYNFRVysBrSDWX4oL5fm7DPimgZpELMLgmyt03+qRxqIb+qQetuMQJawBkhmr344+6RiHRnkrV145TEmOSVlvLabsG6mXqgnEuIAx23T5Nfkm08porqfeJ8DwXvBXVkCLtles0EhNW14= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401077; c=relaxed/simple; bh=ZmnG1mvLC+nqfqk1ivL295tgmudCFqWeCE+Ry39YMC4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k7ObEIBDFlQLhmQaPa+DvHJ1/xvGS3ZKk+M5TRvkt3cOwM6ce9f1TNYfjlzQx9eALP5RncFPYDER3jXDae5P5+2ahel3uec7+Aclc+MaIytfBaWRZXY8YnbCYOVyDS6kXz5/K/lD63Bny8WPiWrnLCwsbn5R9qHKLaM3A0VT2bQ= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=qpQRnSDZ; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="qpQRnSDZ" ARC-Seal: i=1; a=rsa-sha256; t=1772401058; cv=none; d=zohomail.com; s=zohoarc; b=ZYvFFpXWVuiqRiAiEAwiP7ZX5pQsYucoWyWb0wM8FA7Qi3EGBhVyWUfrA7Bk8YDFQyX1OFVCgPsxaX4h8wIAPDcImDn/Y5YThEJtiur2eShMtEQNkHL0jKZaF5cfvfkfURB6IiNNCRTBGs2Nt61unBO1GTHHnX7G+UTOoTodmLs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772401058; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=m5MkS0FlgjmLHAzJnS3KdKIY+xY7EDfUNnbvaa6b+l4=; b=YCgKpb2NblOlwMfxJ5RUzwh84t4hDu1YmZYuPlQ4Od0ID6sPkGO2TApzHeeY08nM46FO9616kxfIGcFBsQBcaL/Ma8hOxZ6jRH1FghVt0dBXvd/4VXJflV/hxDpgVLMHJAr4nGIT+BcCevx4euYmZfyRYCIW7ZluzSH42gdeY/k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772401058; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=m5MkS0FlgjmLHAzJnS3KdKIY+xY7EDfUNnbvaa6b+l4=; b=qpQRnSDZ6OFlug+2D/c08eqaGUFlhi6TKvdTWqj3Y3OMM+XUpUSYe7eUUfd2v87t gsDq79CciDTNsp0Cvs/kjrFzyQRnmPB9sq/lMMOipEBn3Bw3imSeCwT+7Az45w2DTc/ QrT/nslj8YTK+TAhflDZvJo6kZy/WMa8QSOMh3MBwOdfDds8DaAbMxAHhD9OhhPgEea LsLX14UNwAqwa+/8PskQtMj7+WhCIhWEfYB859tAlaORvMrrJmDO8rJprA8g+2jVltb iHQSHXjR8yescB+1YJJXanaGhVkreRMrvCh4KkfpbSrdR1Y1Xo17ZdMS8mq/SZmG11e In/ebz6wgA== Received: by mx.zohomail.com with SMTPS id 1772401057166967.3911990035651; Sun, 1 Mar 2026 13:37:37 -0800 (PST) From: Rong Zhang To: Jaroslav Kysela , Takashi Iwai Cc: Rong Zhang , Jonathan Corbet , Shuah Khan , Cryolitia PukNgae , Arun Raghavan , linux-sound@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Icenowy Zheng , stable@vger.kernel.org Subject: [PATCH 1/9] Revert "ALSA: usb: Increase volume range that triggers a warning" Date: Mon, 2 Mar 2026 05:37:17 +0800 Message-ID: <20260301213726.428505-2-i@rong.moe> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260301213726.428505-1-i@rong.moe> References: <20260301213726.428505-1-i@rong.moe> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" UAC uses 2 bytes to store volume values, so the maximum volume range is 0xFFFF (65535, val =3D -32768/32767/1). The reverted commit bumpped the range of triggering the warning to > 65535, effectively making the range check a no-op. It didn't fix anything but covered any potential problems and deviated from the original intention of the range check. This reverts commit 6b971191fcfc9e3c2c0143eea22534f1f48dbb62. Fixes: 6b971191fcfc ("ALSA: usb: Increase volume range that triggers a warn= ing") Cc: stable@vger.kernel.org Signed-off-by: Rong Zhang --- sound/usb/mixer.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index ac8c71ba94834..df0d3df9c7ece 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1813,10 +1813,11 @@ static void __build_feature_ctl(struct usb_mixer_in= terface *mixer, =20 range =3D (cval->max - cval->min) / cval->res; /* - * There are definitely devices with a range of ~20,000, so let's be - * conservative and allow for a bit more. + * Are there devices with volume range more than 255? I use a bit more + * to be sure. 384 is a resolution magic number found on Logitech + * devices. It will definitively catch all buggy Logitech devices. */ - if (range > 65535) { + if (range > 384) { usb_audio_warn(mixer->chip, "Warning! Unlikely big volume range (=3D%u), cval->res is probab= ly wrong.", range); --=20 2.51.0 From nobody Thu Apr 16 08:37:25 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 55CAC2F1FEA; Sun, 1 Mar 2026 21:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401078; cv=pass; b=fvWX1I/J/FGE0nNFOFcdGee5qQi/UWvehmxyJ6UABNpAkSFZ4YwpX+ssSxY3Hw0VljhLfioWtMpM1EyIRlyySmLXkomMzW+CB8etJvMa9/LxwwuDHdFK8ZLKdpJ5BNEiBeJ/2Lwnjy5jAtx51CMId6jmWXi37mu4yp1f/IiMDyY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401078; c=relaxed/simple; bh=/lQIky8CZKavwRz8u5C5zMFPyf0VvC0LS2EBXvJ14Mg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iCLgKkIv55mWbBIsvs9pzaK6MymIKYyNAgzUXdPAZw+kb9FdHoFsPXrLQhU67pglGJ59H1O67xSI9lLBjGHRYygvRiVMOffxZbHbIQfU/T93EOeTOyU2bsNnDMy4gzda0AKp6d1by+CF64R9N6VPzwzYpaubHU1X/HKdCWQw6pY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=mLSzJnLL; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="mLSzJnLL" ARC-Seal: i=1; a=rsa-sha256; t=1772401062; cv=none; d=zohomail.com; s=zohoarc; b=CPOGVLSK7TuL32Hm/qxUDxZQqHGWVZ/ivxo7pzy1oXHRXBLWrcXMMhu0QMABS555ubWcmW+znLp82j2HJB1D+Pws98r7magOhV0J88VGEMB8TuS5GMkL9oivdYTWflYP0gpuw9D05gDAaLqyfEfbbV3hJI1V6YIxyohAzlHLiWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772401062; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=dfOtOj2mJ90DyMmFUn0bS67YeVG/vNESqFGEOc96Ml8=; b=LUCt5oGY4inX7IfvR67U+s3NVJdPhYqhNbSoyfETc+KYfr6NF1CV5lvFn6FmhF8B63zMOXZt77LYI47U7P90y0OA88Xv26EklOY842XA5e2Ewwaf0aTxH3jaA01RZYaDX9zwysAZFrrx/PJFL46l4zmAOVhcdj3ANsSbJgVnXew= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772401062; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=dfOtOj2mJ90DyMmFUn0bS67YeVG/vNESqFGEOc96Ml8=; b=mLSzJnLLpvR/1aeJOdzsvvWoOiL9w5RoXWbhoYrjpDH0bPK5Maqt414Mz203Vw7q 8EfMqFY+sv6H7JFsSh/c6rnDN4l/G2GhQdWC+YwBXQap8bkrPPwnKFVr1UXn6DMICOd CjrAA3fQlq/IfnpybhtMSdLwne09PqfPlC57mMuE7XUEyrjm96QQqSXtytb71aGXd/B Bob1cxGiXIM7RB2wd5YbGtJjBq7o96YAh3KusGwzrIWv3ON+X0AbS28uVG445JOntnV G6eXE1+Qz7uUbKllaK4IAbVaWjOMPQTIj3KqUiD8h1eBGDWqmeGJZSNvnjoayDz3d5U gALemgFAPQ== Received: by mx.zohomail.com with SMTPS id 1772401060546918.7972675807081; Sun, 1 Mar 2026 13:37:40 -0800 (PST) From: Rong Zhang To: Jaroslav Kysela , Takashi Iwai Cc: Rong Zhang , Jonathan Corbet , Shuah Khan , Cryolitia PukNgae , Arun Raghavan , linux-sound@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Icenowy Zheng Subject: [PATCH 2/9] ALSA: usb-audio: Add helper function for volume range checks Date: Mon, 2 Mar 2026 05:37:18 +0800 Message-ID: <20260301213726.428505-3-i@rong.moe> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260301213726.428505-1-i@rong.moe> References: <20260301213726.428505-1-i@rong.moe> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" When a potentially insane volume range is found, the volume control parameters will be printed in WARN level instead of DEBUG level. Currently, it's done by emitting a open-coded usb_audio_warn() in the corresponding check. The following changes are about to add more checks against volumen ranges. As the first step, extract the current check logic into a helper function to improve readability. No functional change intended. Signed-off-by: Rong Zhang --- sound/usb/mixer.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index df0d3df9c7ece..f52ca0d7e6653 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1660,6 +1660,27 @@ static const struct usb_feature_control_info *get_fe= ature_control_info(int contr return NULL; } =20 +static bool check_insane_volume_range(struct usb_mixer_interface *mixer, + struct snd_kcontrol *kctl, + struct usb_mixer_elem_info *cval) +{ + int range =3D (cval->max - cval->min) / cval->res; + + /* + * Are there devices with volume range more than 255? I use a bit more + * to be sure. 384 is a resolution magic number found on Logitech + * devices. It will definitively catch all buggy Logitech devices. + */ + if (range > 384) { + usb_audio_warn(mixer->chip, + "Warning! Unlikely big volume range (=3D%u), cval->res is probab= ly wrong.", + range); + return true; + } + + return false; +} + static void __build_feature_ctl(struct usb_mixer_interface *mixer, const struct usbmix_name_map *imap, unsigned int ctl_mask, int control, @@ -1673,7 +1694,6 @@ static void __build_feature_ctl(struct usb_mixer_inte= rface *mixer, struct snd_kcontrol *kctl; struct usb_mixer_elem_info *cval; const struct usbmix_name_map *map; - unsigned int range; =20 if (control =3D=3D UAC_FU_GRAPHIC_EQUALIZER) { /* FIXME: not supported yet */ @@ -1811,25 +1831,16 @@ static void __build_feature_ctl(struct usb_mixer_in= terface *mixer, =20 snd_usb_mixer_fu_apply_quirk(mixer, cval, unitid, kctl); =20 - range =3D (cval->max - cval->min) / cval->res; - /* - * Are there devices with volume range more than 255? I use a bit more - * to be sure. 384 is a resolution magic number found on Logitech - * devices. It will definitively catch all buggy Logitech devices. - */ - if (range > 384) { - usb_audio_warn(mixer->chip, - "Warning! Unlikely big volume range (=3D%u), cval->res is probab= ly wrong.", - range); - usb_audio_warn(mixer->chip, - "[%d] FU [%s] ch =3D %d, val =3D %d/%d/%d", + if (check_insane_volume_range(mixer, kctl, cval)) { + usb_audio_warn(mixer->chip, "[%d] FU [%s] ch =3D %d, val =3D %d/%d/%d\n", cval->head.id, kctl->id.name, cval->channels, cval->min, cval->max, cval->res); + } else { + usb_audio_dbg(mixer->chip, "[%d] FU [%s] ch =3D %d, val =3D %d/%d/%d\n", + cval->head.id, kctl->id.name, cval->channels, + cval->min, cval->max, cval->res); } =20 - usb_audio_dbg(mixer->chip, "[%d] FU [%s] ch =3D %d, val =3D %d/%d/%d\n", - cval->head.id, kctl->id.name, cval->channels, - cval->min, cval->max, cval->res); snd_usb_mixer_add_control(&cval->head, kctl); } =20 --=20 2.51.0 From nobody Thu Apr 16 08:37:25 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7713A30C359; Sun, 1 Mar 2026 21:37:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401078; cv=pass; b=kt9Mx/kosCfmqThOOPXAqtxZnBK0AUzWdmyMBHZ1zc8TmvB+nRqi1Q1FBnbEqa+JQPfQbaAJdwPVGJ9o9Ri6bI99kIcFYzbcmIBHePyHS4jwcAUxK6GNOrE0fqFGb3v+TkTfZ70aVkROcCdngjYZUZ1KTYPAeB0TPi9m0rmfMMw= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401078; c=relaxed/simple; bh=bwsJSfMDmrTaxkbp/XYlbzcwS+2yEhdoPtsODrAUjJQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ot82ZWM14YOAEdT9CRbhJE+mCrRx531s+Ra1DwYIG/5xzXdDERSe3zmqB68/bIt6Nq71BL0zg44nk3mmkCb8v93AFJGPn3Cas2FY/fttVQKXz/jkRuvdaSk+55rjVKI4I57hA3hY0t7X61J0H7HNt5yDiWmPUVNbVH7R9JJWYTE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=eFqJL2q0; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="eFqJL2q0" ARC-Seal: i=1; a=rsa-sha256; t=1772401064; cv=none; d=zohomail.com; s=zohoarc; b=NdGLV4WZ92BtMh3ztK1M7gxp0E9ryLWQlHw7Rz41h/61EEGG5fd02VQwxPKrUEUfUEIS9P60srvi/DGHJ+F2hQEbaVl2KKXyGiIOMYULhuMTHHNEnL3iFZkxPqXjqDcawCKTKjQUCW+Q+S/n8Z8qbAMztbrLbMOVx+t7ZwWtqQ0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772401064; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=9lmwt1a5i7dWGlVNbXzYeTJ7RIriT+tawyy94Ui5hSg=; b=cL9q127Ovgpx51EVPkA0+NgoBYw202Hl2nhMGBtLFyX6QT/hcRRATEfRuVLMYbl8lpdTVytZPuWcx+LJpPscwoTs8tafQxf8R4u1CLQx7TWm4w+PipoG4WGMn5Gw7FNssWY+QUl9mipkeb2SzDAoOqcvvLLuvckmxDAzpagWRIE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772401064; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=9lmwt1a5i7dWGlVNbXzYeTJ7RIriT+tawyy94Ui5hSg=; b=eFqJL2q0ZF+SqVM890j8MJTiQL16/gW5W80I3eQFK4FDBJxNAR1B5Yos1T0wnNnH aNdbFZmTY6zEYGHoMUo/Fo2nQ3iBTmpkR+67LvkakzVlNQKm8wsTx35uvkMoSAw3p3n 4XjVsl/Wwlm2sqyBePUbfdKbZbDY6eidhgHxe9F8+4bk5H6chHF4OWI44OSO0Nypdi0 6k9Bqxdfu8XPn6qy8JWc9ifZFW67JO9AaZOW/vXhAoYQZwPbR39lYN0ycU/Ptk+cj1W L4FYrlB8NCKitU00r97dfj9DzrDTUdOYpZrED9qVkAZ058HimaC/mES3g2ldwYyovoE DWL95EuGHA== Received: by mx.zohomail.com with SMTPS id 1772401063925169.42103332375314; Sun, 1 Mar 2026 13:37:43 -0800 (PST) From: Rong Zhang To: Jaroslav Kysela , Takashi Iwai Cc: Rong Zhang , Jonathan Corbet , Shuah Khan , Cryolitia PukNgae , Arun Raghavan , linux-sound@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Icenowy Zheng Subject: [PATCH 3/9] ALSA: usb-audio: Improve volume range checks Date: Mon, 2 Mar 2026 05:37:19 +0800 Message-ID: <20260301213726.428505-4-i@rong.moe> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260301213726.428505-1-i@rong.moe> References: <20260301213726.428505-1-i@rong.moe> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Currently the volume range check is only meant to discover quirky microphone on webcam devices and facing these issues: - The check is only meaningful for dB volume, but it doesn't check if the TLV callback is the corresponding one - A common quirky pattern "val =3D 0/100/1" doesn't trigger any warning - Some modern devices trigger the check, but they are legit - The warning message doesn't apply to some quirky messages with linear volume - The term "range" in the warning message is confusing. At readers' first glance it should be (max - min), but it turns out to be ((max - min) / res) Solve these issues by improving the checking logic to: - Ignore mixers with non-dB TLV - Warn on unlikely small volume ranges (max - min < 256) - Add some heuristics to determine if the volume range is unlikely big - Rephrase the warning message to mention linear volume - Rephrase the warning message in correct wording Signed-off-by: Rong Zhang --- sound/usb/mixer.c | 54 +++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index f52ca0d7e6653..7007e0c9489b4 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -1664,20 +1664,62 @@ static bool check_insane_volume_range(struct usb_mi= xer_interface *mixer, struct snd_kcontrol *kctl, struct usb_mixer_elem_info *cval) { - int range =3D (cval->max - cval->min) / cval->res; + int range, steps, threshold; =20 /* - * Are there devices with volume range more than 255? I use a bit more - * to be sure. 384 is a resolution magic number found on Logitech - * devices. It will definitively catch all buggy Logitech devices. + * If a device quirk has overrode our TLV callback, no warning should + * be generated since our checks are only meaningful for dB volume. */ - if (range > 384) { + if (!(kctl->vd[0].access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK) || + kctl->tlv.c !=3D snd_usb_mixer_vol_tlv) + return false; + + /* + * Meaningless volume control capability (<1dB). This should cover + * devices mapping their volume to val =3D 0/100/1, which are very likely + * to be quirky. + */ + range =3D cval->max - cval->min; + if (range < 256) { usb_audio_warn(mixer->chip, - "Warning! Unlikely big volume range (=3D%u), cval->res is probab= ly wrong.", + "Warning! Unlikely small volume range (=3D%u), linear volume or = custom curve?", range); return true; } =20 + steps =3D range / cval->res; + + /* + * There are definitely devices with ~20,000 ranges (e.g., HyperX Cloud + * III with val =3D -18944/0/1), so we use some heuristics here: + * + * min < 0 < max: Attenuator + amplifier? Likely to be sane + * + * min < 0 =3D max: DSP? Voltage attenuator with FW conversion to dB? + * Likely to be sane + * + * min < max < 0: Measured values? Neutral + * + * min =3D 0 < max: Oversimplified FW conversion? Linear volume? Likely to + * be quirky (e.g., MV-SILICON) + * + * 0 < min < max: Amplifier with fixed gains? Likely to be quirky + * (e.g., Logitech webcam) + */ + if (cval->min < 0 && 0 <=3D cval->max) + threshold =3D 24576; /* 65535 * (3 / 8) */ + else if (cval->min < cval->max && cval->max < 0) + threshold =3D 1024; + else + threshold =3D 384; + + if (steps > threshold) { + usb_audio_warn(mixer->chip, + "Warning! Unlikely big volume step count (=3D%u), linear volume = or wrong cval->res?", + steps); + return true; + } + return false; } =20 --=20 2.51.0 From nobody Thu Apr 16 08:37:25 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 02C192DAFB0; Sun, 1 Mar 2026 21:38:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401084; cv=pass; b=OU5wt/PmrqNMM2U+3AAtB643ItJwltMkBFUZ3ty7ZUf+upIyaC+D0XzAO8DFkbjQkltyP1rS3coygrsiA/pPwnUkZByqSEuaU4FpKdhXKCXAfCw87zR8JM2g139HgSe/XSiDTHjHhqQMB6xEGwRE3fP1qA9zkmykmeIjjN2Toc4= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401084; c=relaxed/simple; bh=cmKQeW5KbUAo3wyFi/wc1QyH3nk9s0ofvckbCyAw97E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ew4Xuq35rcWDCPQGtZ2o8V2Wa809Pq6gbAUKudBklm7Ur8Wi5lJ/KE2dDk6q0TiKnwO5UytqnYN+3Jd6rHn85vGbuV4rdeTGcLlZl7ZRp9PpaDIsEl0u3moLDg/eeqZGK+nUEsnbabxNibAtMyNG4+1uaE+SAIS5ogsEUzycIHg= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=FKcf6lj5; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="FKcf6lj5" ARC-Seal: i=1; a=rsa-sha256; t=1772401068; cv=none; d=zohomail.com; s=zohoarc; b=KCbci48IgbAUDvSFECc2doD/ANTMyES+/2D7/Bc74PRnxkXGB9/Mkm0BHNS7KvcTDUYzq0muUPOjIVZLs54lXcdvfeZb6w8gSvstSLWQ/fbCFfKfLgcMR65uqXXRmfqUu4SSVdYnp1xJvRoLZa9I+Bee7qzUyK3LpRN5A3iuHjI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772401068; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=wVzjsoySm0puYUAQlobj5BlJAVClteKPejGg2hR7+yc=; b=K211ssyb0Qiw0G3NyNdqi9pYleECUrfYWPY0QQialoqdoc9TGbgDbDSqmVl/SO/riVOUneeoGWgk/6ugY8Go7N1E4F9ZKQK3ngb9L2UzycxqKn9M5uRmw+zoA2Z+7TXA1VSzbOhY1Z4mcxyz9Vggail98QVlaiWGPQnpMTPpYLs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772401068; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=wVzjsoySm0puYUAQlobj5BlJAVClteKPejGg2hR7+yc=; b=FKcf6lj5PUBYeR2mwR+SijKCfqeQUWnoF7ETI+Zy04NyY7/RZPszJA3cemidbnXT ZGvKeI1mzXKqqT/vtZ0PEyrszfk8XZ6BC1yudWYgHNmvdE+Zj3Tn/PJRonTy6cYb3tI mOLCVYOih7fDV8dqWsoFehyv67sCghF8Aaozc9QeeVoWe22ljIoCZu7aildkwYce3Rw djrnEYquDgofVJwIl0rZ3io8bFJyV0VoC9ObApWD7FzMHiEgF9gD37KxqsT01waDyD/ fGvPQPDTcKs/vGYxxN9G2Jnubupy0nLtKVpVgrUAHffjTbdJAjsZua7T5eCscK7Gd52 QFPHCIcMiw== Received: by mx.zohomail.com with SMTPS id 1772401067209476.7686188353042; Sun, 1 Mar 2026 13:37:47 -0800 (PST) From: Rong Zhang To: Jaroslav Kysela , Takashi Iwai Cc: Rong Zhang , Jonathan Corbet , Shuah Khan , Cryolitia PukNgae , Arun Raghavan , linux-sound@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Icenowy Zheng Subject: [PATCH 4/9] ALSA: usb-audio: Support string-descriptor-based quirk table entry Date: Mon, 2 Mar 2026 05:37:20 +0800 Message-ID: <20260301213726.428505-5-i@rong.moe> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260301213726.428505-1-i@rong.moe> References: <20260301213726.428505-1-i@rong.moe> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Some quirky devices do not have a unique VID/PID. Matching them using DEVICE_FLG() or VENDOR_FLG() may result in conflicts. Add two new macros DEVICE_STRING_FLG() and VENDOR_STRING_FLG() to match USB string descriptors (manufacturer and/or product) in addition to VID and/or PID, so that we can deconflict these devices safely. No functional change intended. Signed-off-by: Rong Zhang --- sound/usb/quirks.c | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index c6a78efbcaa30..495dd46ce515c 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -2,8 +2,10 @@ /* */ =20 +#include #include #include +#include #include #include #include @@ -2135,16 +2137,39 @@ void snd_usb_audioformat_attributes_quirk(struct sn= d_usb_audio *chip, /* * driver behavior quirk flags */ +struct usb_string_match { + const char *manufacturer; + const char *product; +}; + struct usb_audio_quirk_flags_table { u32 id; u32 flags; + const struct usb_string_match *usb_string_match; }; =20 #define DEVICE_FLG(vid, pid, _flags) \ { .id =3D USB_ID(vid, pid), .flags =3D (_flags) } #define VENDOR_FLG(vid, _flags) DEVICE_FLG(vid, 0, _flags) =20 +/* Use as a last resort if using DEVICE_FLG() is prone to VID/PID conflict= s. */ +#define DEVICE_STRING_FLG(vid, pid, _manufacturer, _product, _flags) \ +{ \ + .id =3D USB_ID(vid, pid), \ + .usb_string_match =3D &(const struct usb_string_match) { \ + .manufacturer =3D _manufacturer, \ + .product =3D _product, \ + }, \ + .flags =3D (_flags), \ +} + +/* Use as a last resort if using VENDOR_FLG() is prone to VID conflicts. */ +#define VENDOR_STRING_FLG(vid, _manufacturer, _flags) \ + DEVICE_STRING_FLG(vid, 0, _manufacturer, NULL, _flags) + static const struct usb_audio_quirk_flags_table quirk_flags_table[] =3D { + /* Device and string descriptor matches */ + /* Device matches */ DEVICE_FLG(0x001f, 0x0b21, /* AB13X USB Audio */ QUIRK_FLAG_FORCE_IFACE_RESET | QUIRK_FLAG_IFACE_DELAY), @@ -2414,6 +2439,8 @@ static const struct usb_audio_quirk_flags_table quirk= _flags_table[] =3D { DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), =20 + /* Vendor and string descriptor matches */ + /* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */ QUIRK_FLAG_GET_SAMPLE_RATE), @@ -2558,14 +2585,69 @@ void snd_usb_apply_flag_dbg(const char *reason, } } =20 +#define USB_STRING_SIZE 128 + +static inline int snd_usb_get_strings(struct snd_usb_audio *chip, + char *manufacturer, char *product) +{ + int ret; + + if (manufacturer) { + ret =3D usb_string(chip->dev, chip->dev->descriptor.iManufacturer, + manufacturer, USB_STRING_SIZE); + if (ret < 0) { + usb_audio_warn(chip, "failed to get manufacturer string: %d\n", ret); + return ret; + } + } + + if (product) { + ret =3D usb_string(chip->dev, chip->dev->descriptor.iProduct, + product, USB_STRING_SIZE); + if (ret < 0) { + usb_audio_warn(chip, "failed to get product string: %d\n", ret); + return ret; + } + } + + return 1; /* ok */ +} + void snd_usb_init_quirk_flags_table(struct snd_usb_audio *chip) { const struct usb_audio_quirk_flags_table *p; + char manufacturer[USB_STRING_SIZE]; + char product[USB_STRING_SIZE]; + int got_usb_strings =3D 0; /* <0: error, 0: pending, >0: ok */ =20 for (p =3D quirk_flags_table; p->id; p++) { if (chip->usb_id =3D=3D p->id || (!USB_ID_PRODUCT(p->id) && USB_ID_VENDOR(chip->usb_id) =3D=3D USB_ID_VENDOR(p->id))) { + if (!p->usb_string_match) + goto apply; /* DEVICE_FLG or VENDOR_FLG */ + + /* DEVICE_STRING_FLG or VENDOR_STRING_FLG */ + if (!got_usb_strings) { + got_usb_strings =3D snd_usb_get_strings(chip, + p->usb_string_match->manufacturer ? manufacturer : NULL, + p->usb_string_match->product ? product : NULL); + } + + BUILD_BUG_ON(!got_usb_strings); + + if (got_usb_strings < 0) + continue; + + if (p->usb_string_match->manufacturer && + strcmp(p->usb_string_match->manufacturer, manufacturer)) + continue; + + if (p->usb_string_match->product && + strcmp(p->usb_string_match->product, product)) + continue; + +apply: snd_usb_apply_flag_dbg("builtin table", chip, p->flags); chip->quirk_flags |=3D p->flags; return; --=20 2.51.0 From nobody Thu Apr 16 08:37:25 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 96C77337BB5; Sun, 1 Mar 2026 21:38:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401088; cv=pass; b=cw9E351LsM3isPeFmNYNFlSPcYQ3JLAlwlwmeQjaBnhNf3EcA0NJSmZyvbi3OP/PkC6LfE9h0hcTrn88EUtwPVdCJmiH75s3+h2oi2DD2MMPPBYIylnb7y/exXleMyVB8sRGv7Iityy/iKlcTcdNl73dBfWWDycr5IhOWrRHcso= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401088; c=relaxed/simple; bh=lczvhptfCNDqAj/xQ2IouLznCNoPQjxx9kJs0HqVGa0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ie3rCb+2GsS9EhkovhRJIiEab+UJdHiuo2Jf7EugfGj/0lA3zfJ/ptish1Yh1wTvRyy57Y20sZDSx8Hd5xuEId3jTtIU/jCWFos4SLBemcT9RQF/86DrXbf0t98O7J38iKMbJuFXCZDiEUYu3B2XrR76TKww6ABrF64oHZHOXG0= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=KSaQXlU2; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="KSaQXlU2" ARC-Seal: i=1; a=rsa-sha256; t=1772401072; cv=none; d=zohomail.com; s=zohoarc; b=HduUuQmGpxN9hS4l4PVdyqsbx4wtiE7iMPg3cXgV86RaSU61tEPXx7T8owWMd5BfbygkpQnSs2kgnL0F+BYDEvNEtApmjygGvExsajcfHJYGBIcZgJQVJwcRk50c+SEzN3i9BLt8e6vQqCesbf1l2aNRonlcYTAgoVLgMZ12BUk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772401072; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=FfPX+WxmbQTz243CKnnpQci8rBV7QviMzCvuGaRyn40=; b=nKuYVZPl1/PkL9bwbfzGCqGEsWkTVRbDIoE+h5g+3wgM/PrqqYqDAo9XCDTnif8zIGDUqc/AJgds5ksvuNqyGe37EaKZFeda6WBr4j4kp1WJg3AonJ7ftXa6OqNL7NZcQlUlqlAkKwIhex6B/bjaVP4KgRoMxxkp0BAdjpCKWFs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772401072; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=FfPX+WxmbQTz243CKnnpQci8rBV7QviMzCvuGaRyn40=; b=KSaQXlU2rquNgz/sPmuLi3hvErBwRnX87817FlHqCgAE9jb/cs6Rap33Nt5LJeJX c4MqTegd9154IMLvbPtflBbEv7Ig8kvCsTRKSEyKvLH9vAN7SJu4FtP2lOLphQQwAOl d67cxQTP9HrHn0AQtWCvDdXiHZYgVt+I86fvKFnjZ8zPlmvmBITsecCa83LCFceXVk7 e2WS8RQUvzftSSYlwrBpeT6QGyWENc9VaoVGPy8+CJS5+G7mJCrV4PTy8/DaPIdWwET 4J/gG7lFEzeUesQA9f8zVK20ESJT6irPvjkPhRDhFOmTNtJeXdh8PXcAkCQSu6tkOdQ VetuyDWDaQ== Received: by mx.zohomail.com with SMTPS id 1772401070492785.438855171703; Sun, 1 Mar 2026 13:37:50 -0800 (PST) From: Rong Zhang To: Jaroslav Kysela , Takashi Iwai Cc: Rong Zhang , Jonathan Corbet , Shuah Khan , Cryolitia PukNgae , Arun Raghavan , linux-sound@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Icenowy Zheng Subject: [PATCH 5/9] ALSA: usb-audio: Deconflict VID between Focusrite Novation & MV-SILICON Date: Mon, 2 Mar 2026 05:37:21 +0800 Message-ID: <20260301213726.428505-6-i@rong.moe> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260301213726.428505-1-i@rong.moe> References: <20260301213726.428505-1-i@rong.moe> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" MV-SILICON is a SoC manufacturer producing multifunctional audio SoCs. Many budget-oriented OEM devices are built on top of them. However, some of them are just too budget-constrained that their manufacturers didn't even have a USB VID and simply picked a random VID. Some OEMs unfortunately picked the VID of Focusrite Novation (0x1235), resulting in VID conflicts as we had defined a VENDOR_FLG() for the latter. Add a VENDOR_STRING_FLG() for MV-SILICON to stop the matching procedure for these quirky devices, so that quirk flags for Focusrite Novation won't be accidentally applied on them. Quirky device samples: usb 7-1: New USB device found, idVendor=3D1235, idProduct=3D0003, bcdDevi= ce=3D 1.00 usb 7-1: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D3 usb 7-1: Product: G1 usb 7-1: Manufacturer: MV-SILICON usb 7-1: SerialNumber: 20190808 usb 7-1: New USB device found, idVendor=3D1235, idProduct=3D0003, bcdDevi= ce=3D 1.00 usb 7-1: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D3 usb 7-1: Product: mvsilicon B1 usb audio usb 7-1: Manufacturer: MV-SILICON usb 7-1: SerialNumber: 20190808 usb 1-1.2: New USB device found, idVendor=3D1235, idProduct=3D0002, bcdDe= vice=3D 1.00 usb 1-1.2: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D.= .. usb 1-1.2: Product: V8 usb 1-1.2: Manufacturer: MV-SILICON usb 1-1.2: SerialNumber: ... * https://github.com/linuxhw/Dmesg/blob/main/Desktop/Others/Intel/Intel%2= 0X79/96ED1CC44499/LINUXMINT-19.3/5.0.0-32-GENERIC/X86_64/5BE1E4C74C#L1122 usb 2-1.6: New USB device found, idVendor=3D1235, idProduct=3D0002, bcdDe= vice=3D 1.00 usb 2-1.6: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D.= .. usb 2-1.6: Product: V9 usb 2-1.6: Manufacturer: MV-SILICON usb 2-1.6: SerialNumber: ... * https://github.com/linuxhw/Dmesg/blob/main/Desktop/Hewlett-Packard/ProL= iant/ProLiant%20ML110%20G6/79B1D707316A/KUBUNTU-21.04/5.11.0-33-GENERIC/X86= _64/A43F59C4AB#L1009 Signed-off-by: Rong Zhang --- sound/usb/quirks.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 495dd46ce515c..5370bcd99e9d0 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -2440,6 +2440,9 @@ static const struct usb_audio_quirk_flags_table quirk= _flags_table[] =3D { QUIRK_FLAG_ALIGN_TRANSFER), =20 /* Vendor and string descriptor matches */ + VENDOR_STRING_FLG(0x1235, /* VID conflict with Focusrite Novation */ + "MV-SILICON", + 0), /* Stop matching */ =20 /* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */ --=20 2.51.0 From nobody Thu Apr 16 08:37:25 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4070D32BF41; Sun, 1 Mar 2026 21:38:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401093; cv=pass; b=VKM9gWmLYPfeo0nmjpDC0MJEs2MR62OYVcgVHfATotSI+R1jpF8VcQ5MAk3KBfem252EJ+D++B+fnauklF+2sXr28wpGSe6zlXAhsaUoCLFI3R8UDa0fzAQqR96ga1OjM5UZtOrN+lYtdYqGkRtxaNRGFtE1yXeNgMRfR16tezU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401093; c=relaxed/simple; bh=93BcJKEa7weHV5+oiJ7vYIUaejRc41m2DGRjhII4XD8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ha3pQ2XfyWOm+r4z2VaYK5GvAQmRDEKqci0NhpRkSy50oOCb5RKJT6A//KFvqUt2d42mCu2T/Woe5pR58dyzAVhzjXwp2Ppbj7PjHNBHQbWGgzjl9SmCQSYQ2+4TVDIOPlvqxsFpJ94gl+/H5Q6hb9DFZD3q6aC2345g5dbrQI8= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=UR98z6G9; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="UR98z6G9" ARC-Seal: i=1; a=rsa-sha256; t=1772401074; cv=none; d=zohomail.com; s=zohoarc; b=G8v2O34kyUMuQMxqpFaVvvlSmILuUQIWCO/beVfD6xk9KL76sQJ4UW5R2lYmmkMBS/rZbpFAaI6Kpifort6xONl1msliZz7V0leIRDCPc3bdkmptp+JRiDUnT5FPWNkuBazVF6qfHQnUwwroHLVGTROx1hzhcLuKZ2XdbpmD4Sc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772401074; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=3NnbcanYvL9rtxNc6BLLdiHQwPg1qzD0xRJGy28M5hI=; b=RkXIuWbBPWIxVTm/OQusyhXb7PZbkVpSi6xxxhwYbSknXB74pzMaRj0tkpQyj/WQJkYr0++IfQPmItoNH76KPFTpOfLd7QSY06mG64LaFcyv2wONUds16n00LzHQLqfZhRRRlJU0O4OKxZiURiNw8EPmVQj3g03G64QAl3bM1AE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772401074; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=3NnbcanYvL9rtxNc6BLLdiHQwPg1qzD0xRJGy28M5hI=; b=UR98z6G9qvPutD2OIMDxDAKkH12+N6XvVVflM/8MPVmm2UKYgPuaKRBcIHtNUqPi wNryYIQVNzav+sYnzFpazse8pfYHIK/KL/UhjNbIN5PTSaL7o2vF9T/3aJFz2gwex7f IN7G4O/hiE5XEEWok0adMcbMCPIR4n5Q6BMrodu+JZVHN3oE/yLvaMukkh6LsxW79JW t3i2EGAr4VtdavZcPEBjCAbTwONbDx4sNc3e6jrN6QI6/Snsl65lLA8S+R+omu2bf46 0/hiTBgnTJOvishz6rozsKMWMMy0QIVPW5tl0dm2F1ZyYQ5U8wtDwKcehsioFWjT+lv WpPJ01ABkw== Received: by mx.zohomail.com with SMTPS id 1772401073863668.3313527377625; Sun, 1 Mar 2026 13:37:53 -0800 (PST) From: Rong Zhang To: Jaroslav Kysela , Takashi Iwai Cc: Rong Zhang , Jonathan Corbet , Shuah Khan , Cryolitia PukNgae , Arun Raghavan , linux-sound@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Icenowy Zheng Subject: [PATCH 6/9] ALSA: doc: Add doc for QUIRK_FLAG_SKIP_IFACE_SETUP of snd-usb-audio Date: Mon, 2 Mar 2026 05:37:22 +0800 Message-ID: <20260301213726.428505-7-i@rong.moe> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260301213726.428505-1-i@rong.moe> References: <20260301213726.428505-1-i@rong.moe> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" QUIRK_FLAG_SKIP_IFACE_SETUP was introduced in commit 38c322068a26 ("ALSA: usb-audio: Add QUIRK_FLAG_SKIP_IFACE_SETUP") without appropriate documentation, so add it. Signed-off-by: Rong Zhang --- Documentation/sound/alsa-configuration.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/sound/alsa-configuration.rst b/Documentation/sou= nd/alsa-configuration.rst index 0a4eaa7d66ddd..55b845d382368 100644 --- a/Documentation/sound/alsa-configuration.rst +++ b/Documentation/sound/alsa-configuration.rst @@ -2372,6 +2372,10 @@ quirk_flags audible volume * bit 25: ``mixer_capture_min_mute`` Similar to bit 24 but for capture streams + * bit 26: ``skip_iface_setup`` + Skip the probe-time interface setup (usb_set_interface, + init_pitch, init_sample_rate); redundant with + snd_usb_endpoint_prepare() at stream-open time =20 This module supports multiple devices, autoprobe and hotplugging. =20 --=20 2.51.0 From nobody Thu Apr 16 08:37:25 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22B79330D36; Sun, 1 Mar 2026 21:38:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401096; cv=pass; b=bbWZhFIR2JOc1opu83K1Y+aGwvgBhyHMM5PSfttrqsL0to2BkgpROIb2trHWN+zU+B5/tcvV1kO43B5Gbgb4CywX93qejnUOww2NJWBxeKbz48fUt2iD9JxxSD+ByK3O5dwpzdpmo+34sP+waFuhQB5UGEDwfTxzitxUk48i6X8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401096; c=relaxed/simple; bh=NV6B+vR93yzbfYx0xgNbx6LdRSzbyo7jtpb1exSRwlg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cVeNJ7Xd1VVUHQzc40OgdgxMPE87CSpKc9MxaWVlxJdvfa5PslaZbc2YsES8B55ciSGgUx8HdnWNzbyXd6pCfOab8UZ4rvLtzd7zTGa+5g21EKlACtyZFWInFj/qO9nC3TxpoIx8JyWZrjKRyTCPFtIK8QOcY/75+Jzi3NciV44= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=qs4z5pAi; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="qs4z5pAi" ARC-Seal: i=1; a=rsa-sha256; t=1772401078; cv=none; d=zohomail.com; s=zohoarc; b=O2v8R5F0Ie3QIFrS5RKPBl/bgBOQzjc3MmCq47lfAty13KckoL+633ESIPmG4CNpJXLL0TzqjlCUSlJGjPEBtP0llv4IR37mgKAc3Ysi1km3hFHUTi9tr5V56Tbdb3EMqa2siKhtYXSxaTjD/PENC/wb6voFp0mVWhCDR+kxdao= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772401078; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=Nk/d40ubXKnyIOAqI0bxPfrDmDq/xH6w6w+exU5IJVA=; b=hgR/dCg2ZFhXFtpCGBhpFgDlJ/tXp8U96NQlVCD8jwAc9YpdmMkf27Um6zmPKSN+EQSOmUwIXuCVP+7kcz6jZYyJYaUA5NY463Xs+jndWNuuiuJdFzRCANIuh2xbGMGnEw+2AZgWCxi2XU2ALylQMA6MQsEjJ+QjcdkJnaoAfgg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772401078; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=Nk/d40ubXKnyIOAqI0bxPfrDmDq/xH6w6w+exU5IJVA=; b=qs4z5pAidKhacmG3T7AZFexjReNUi5CS4f5CQzxNoqRPD2iU7FI9WgJPFEJczcVc Zz0a4ZEEZRBt3J6RBgpLY6UYsFgPxeixD5NOCEa2pkK4w7lzcznK0JT8nO+CJEARK94 HTLcjbfVBIAeOHWw189pzDhAQbiDhzRgmSqhoZGHm0kqIGJojVNIt4VKCRv86uIljnQ 5WaWEOQW7iOAMZVsQuS1PrL7/gIZVtccP/PR0i4tE94orFZH+NFFMEqzarWcmfr5CVG JRISrtmDRvXFg+stc5bz8zo2CevnswxXlO+ncwtBY7z34pQ0kEJHT3ssE8Of2h/Vc0r y5QEAWL5wQ== Received: by mx.zohomail.com with SMTPS id 1772401077137449.52785599032256; Sun, 1 Mar 2026 13:37:57 -0800 (PST) From: Rong Zhang To: Jaroslav Kysela , Takashi Iwai Cc: Rong Zhang , Jonathan Corbet , Shuah Khan , Cryolitia PukNgae , Arun Raghavan , linux-sound@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Icenowy Zheng Subject: [PATCH 7/9] ALSA: usb-audio: Add QUIRK_FLAG_MIXER_{PLAYBACK,CAPTURE}_LINEAR_VOL Date: Mon, 2 Mar 2026 05:37:23 +0800 Message-ID: <20260301213726.428505-8-i@rong.moe> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260301213726.428505-1-i@rong.moe> References: <20260301213726.428505-1-i@rong.moe> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Some quirky devices tune their volume by linearly tuning the voltage level (linear volume). In other words, such devices has a linear TLV mapping of DECLARE_TLV_DB_LINEAR(scale, TLV_DB_GAIN_MUTE, 0). Add quirk flags MIXER_PLAYBACK_LINEAR_VOL and MIXER_CAPTURE_LINEAR_VOL to represent this case respectively for playback and capture mixers. No functional change intended. Signed-off-by: Rong Zhang --- Documentation/sound/alsa-configuration.rst | 7 +++++ sound/usb/mixer_quirks.c | 34 ++++++++++++++++++++++ sound/usb/quirks.c | 2 ++ sound/usb/usbaudio.h | 12 ++++++++ 4 files changed, 55 insertions(+) diff --git a/Documentation/sound/alsa-configuration.rst b/Documentation/sou= nd/alsa-configuration.rst index 55b845d382368..f75f087639415 100644 --- a/Documentation/sound/alsa-configuration.rst +++ b/Documentation/sound/alsa-configuration.rst @@ -2376,6 +2376,13 @@ quirk_flags Skip the probe-time interface setup (usb_set_interface, init_pitch, init_sample_rate); redundant with snd_usb_endpoint_prepare() at stream-open time + * bit 27: ``mixer_playback_linear_vol`` + Set linear volume mapping for devices where the playback volume + control value is mapped to voltage (instead of dB) level linearl= y. + In short: ``x(raw) =3D (raw - raw_min) / (raw_max - raw_min)``; + ``V(x) =3D k * x``; ``dB(x) =3D 20 * log10(x)``. Overrides bit 24 + * bit 28: ``mixer_capture_linear_vol`` + Similar to bit 27 but for capture streams. Overrides bit 25 =20 This module supports multiple devices, autoprobe and hotplugging. =20 diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 11e205da7964d..539044c0c6440 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c @@ -4634,6 +4634,25 @@ static void snd_fix_plt_name(struct snd_usb_audio *c= hip, usb_audio_dbg(chip, "something wrong in kctl name %s\n", id->name); } =20 +static void snd_usb_mixer_fu_quirk_linear_scale(struct usb_mixer_interface= *mixer, + struct usb_mixer_elem_info *cval, + struct snd_kcontrol *kctl) +{ + static const DECLARE_TLV_DB_LINEAR(scale, TLV_DB_GAIN_MUTE, 0); + + if (cval->min_mute) { + /* + * We are clearing SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK, + * resulting in min_mute being a no-op. + */ + usb_audio_warn(mixer->chip, "LINEAR_VOL overrides MIN_MUTE\n"); + } + + kctl->tlv.p =3D scale; + kctl->vd[0].access |=3D SNDRV_CTL_ELEM_ACCESS_TLV_READ; + kctl->vd[0].access &=3D ~SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK; +} + void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer, struct usb_mixer_elem_info *cval, int unitid, struct snd_kcontrol *kctl) @@ -4660,6 +4679,21 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_i= nterface *mixer, "applying capture min mute quirk\n"); cval->min_mute =3D 1; } + + if (mixer->chip->quirk_flags & QUIRK_FLAG_MIXER_PLAYBACK_LINEAR_VOL) + if (cval->control =3D=3D UAC_FU_VOLUME && strstr(kctl->id.name, "Playbac= k")) { + usb_audio_info(mixer->chip, + "applying playback linear volume quirk\n"); + snd_usb_mixer_fu_quirk_linear_scale(mixer, cval, kctl); + } + + if (mixer->chip->quirk_flags & QUIRK_FLAG_MIXER_CAPTURE_LINEAR_VOL) + if (cval->control =3D=3D UAC_FU_VOLUME && strstr(kctl->id.name, "Capture= ")) { + usb_audio_info(mixer->chip, + "applying capture linear volume quirk\n"); + snd_usb_mixer_fu_quirk_linear_scale(mixer, cval, kctl); + } + /* ALSA-ify some Plantronics headset control names */ if (USB_ID_VENDOR(mixer->chip->usb_id) =3D=3D 0x047f && (cval->control =3D=3D UAC_FU_MUTE || cval->control =3D=3D UAC_FU_VOLU= ME)) diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 5370bcd99e9d0..2327288e2b20f 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -2540,6 +2540,8 @@ static const char *const snd_usb_audio_quirk_flag_nam= es[] =3D { QUIRK_STRING_ENTRY(MIXER_PLAYBACK_MIN_MUTE), QUIRK_STRING_ENTRY(MIXER_CAPTURE_MIN_MUTE), QUIRK_STRING_ENTRY(SKIP_IFACE_SETUP), + QUIRK_STRING_ENTRY(MIXER_PLAYBACK_LINEAR_VOL), + QUIRK_STRING_ENTRY(MIXER_CAPTURE_LINEAR_VOL), NULL }; =20 diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index 085530cf62d92..58fd07f8c3c97 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h @@ -228,6 +228,14 @@ extern bool snd_usb_skip_validation; * Skip the probe-time interface setup (usb_set_interface, * init_pitch, init_sample_rate); redundant with * snd_usb_endpoint_prepare() at stream-open time + * QUIRK_FLAG_MIXER_PLAYBACK_LINEAR_VOL + * Set linear volume mapping for devices where the playback volume control + * value is mapped to voltage (instead of dB) level linearly. In short: + * x(raw) =3D (raw - raw_min) / (raw_max - raw_min); V(x) =3D k * x; + * dB(x) =3D 20 * log10(x). Overrides QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE + * QUIRK_FLAG_MIXER_CAPTURE_LINEAR_VOL + * Similar to QUIRK_FLAG_MIXER_PLAYBACK_LINEAR_VOL, but for capture strea= ms. + * Overrides QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE */ =20 enum { @@ -258,6 +266,8 @@ enum { QUIRK_TYPE_MIXER_PLAYBACK_MIN_MUTE =3D 24, QUIRK_TYPE_MIXER_CAPTURE_MIN_MUTE =3D 25, QUIRK_TYPE_SKIP_IFACE_SETUP =3D 26, + QUIRK_TYPE_MIXER_PLAYBACK_LINEAR_VOL =3D 27, + QUIRK_TYPE_MIXER_CAPTURE_LINEAR_VOL =3D 28, /* Please also edit snd_usb_audio_quirk_flag_names */ }; =20 @@ -290,5 +300,7 @@ enum { #define QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE QUIRK_FLAG(MIXER_PLAYBACK_MIN_M= UTE) #define QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE QUIRK_FLAG(MIXER_CAPTURE_MIN_MUT= E) #define QUIRK_FLAG_SKIP_IFACE_SETUP QUIRK_FLAG(SKIP_IFACE_SETUP) +#define QUIRK_FLAG_MIXER_PLAYBACK_LINEAR_VOL QUIRK_FLAG(MIXER_PLAYBACK_LIN= EAR_VOL) +#define QUIRK_FLAG_MIXER_CAPTURE_LINEAR_VOL QUIRK_FLAG(MIXER_CAPTURE_LINEA= R_VOL) =20 #endif /* __USBAUDIO_H */ --=20 2.51.0 From nobody Thu Apr 16 08:37:25 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BC98733A9D1; Sun, 1 Mar 2026 21:38:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401098; cv=pass; b=OVOmCHu82eiSP2WFYrlZA3VW8FdffoVlsBqNdjJub+uprzsfON3+Ozmrrv4109z2IPQ/VZcQme+6HuoIvEp7LyEj0cH7MH0HLPlfaq4A0AG/uBVn3qWJxZ3TxNSnh93QBM1GSOaGzWXwCDz7CAQPmihPq/xDlXLBQMTVtsvv8sY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401098; c=relaxed/simple; bh=rTMH0qUdpUYeHAGR3XYd7dD9J2AlOdnDYFIS12f0w3s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JpwePauSEv/Euk0U9Qp6QCgXi95cIf3OQ3o9VJf9K3tOLxakPqfQ0CbnSGLayQg8ixon1oJW89iIevgFwPxE2Qr0vp27PH8seS0l+7Ij/rpGnrwuD+TkTi3tosYdso5XPhX0ZODx6TzFOIMch/TqsyEoARsqkKpF/yjKtH8PYJs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=jJqTik4a; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="jJqTik4a" ARC-Seal: i=1; a=rsa-sha256; t=1772401082; cv=none; d=zohomail.com; s=zohoarc; b=iRX572EjkFmIAfLTHLNvT87eevUCYC8FqbI9d47G9/7NT7l75x2WXzVpYaTTaMY3fL4vrgZD3bOb0loWYeesqPaLxwOdRC+MMdiNoi//dhHkbgtlDDZ8pC3N+tYXf/BqYKnZQepxAsMOUIDfUvOX91haRHlAYgaOgikWfvU2wRQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772401082; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=KR3grbK+HY18oMi24XzG2N+wZ4FjkwNc6AKveDdT6L0=; b=ioVJDNgpGa58nCNsIw+gdqoP/gePn8HhcvQzPek3sORoLea5XDSVHYVEQ5wOHAwPCoww9Jb3K6X1dx0LqXF+XiIn7vpTiQX7MD8qCLAoUS6gFBw24tzdr1Z9X2pOSi9TOM6yEWch2eQ331Mn9hMF5cTMZVyGcu1RkFLGIJwvGhA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772401082; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Message-Id:Reply-To; bh=KR3grbK+HY18oMi24XzG2N+wZ4FjkwNc6AKveDdT6L0=; b=jJqTik4atZ1gSXCahUuVvInclb1WGVLHl7Cjz7yC1iEhsta78eCinH3WaROMYUGz FsYfKEI+xTYyK/4GTkM9PGICMQiXZ2PrOzxCtXjAwLyttqAohPtQYJb9jo40rvwuf8B w6Ny6HJYS30bdiU8Mvd8bAC5q6/ljwiebzt0xDzYw0IzmvD0Df6w9umZXPLYOBcP0Kg 3WxB6uNgvb6Mb2BTb6UW+hGwx16JeW/DfZNaBsToZPqzMBWPzR7VDne9X5wdZmlVfki iFkdgujswSmmtPjwT4WNvklAgpe2OMI0QVpkkXhipcp9L7b16NxqLccC6bo3qbqmvqL B7QtYq93SQ== Received: by mx.zohomail.com with SMTPS id 1772401080433616.176832505962; Sun, 1 Mar 2026 13:38:00 -0800 (PST) From: Rong Zhang To: Jaroslav Kysela , Takashi Iwai Cc: Rong Zhang , Jonathan Corbet , Shuah Khan , Cryolitia PukNgae , Arun Raghavan , linux-sound@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Icenowy Zheng Subject: [PATCH 8/9] ALSA: usb-audio: Add linear volume quirk for Hotone Audio Pulze Mini Date: Mon, 2 Mar 2026 05:37:24 +0800 Message-ID: <20260301213726.428505-9-i@rong.moe> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260301213726.428505-1-i@rong.moe> References: <20260301213726.428505-1-i@rong.moe> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External Content-Type: text/plain; charset="utf-8" Hotone Audio Pulze Mini is a modeling amplifier with UAC interface. Its Playback and Capture mixers use linear volume with val =3D 0/100/1. Add a quirk table entry matching VID/PID=3D0x84ef/0x0082 and applying linear volume quirk flags, so that it can work properly. Quirky device sample: usb 7-1: New USB device found, idVendor=3D84ef, idProduct=3D0082, bcdDevi= ce=3D 1.03 usb 7-1: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D3 usb 7-1: Product: Pulze Mini usb 7-1: Manufacturer: Hotone Audio usb 7-1: SerialNumber: 20240807 Signed-off-by: Rong Zhang --- sound/usb/quirks.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 2327288e2b20f..ec809b7eb5bea 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -2438,6 +2438,8 @@ static const struct usb_audio_quirk_flags_table quirk= _flags_table[] =3D { QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ QUIRK_FLAG_ALIGN_TRANSFER), + DEVICE_FLG(0x84ef, 0x0082, /* Hotone Audio Pulze Mini */ + QUIRK_FLAG_MIXER_PLAYBACK_LINEAR_VOL | QUIRK_FLAG_MIXER_CAPTURE_LINEA= R_VOL), =20 /* Vendor and string descriptor matches */ VENDOR_STRING_FLG(0x1235, /* VID conflict with Focusrite Novation */ --=20 2.51.0 From nobody Thu Apr 16 08:37:25 2026 Received: from sender4-op-o15.zoho.com (sender4-op-o15.zoho.com [136.143.188.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B941E2D060B; Sun, 1 Mar 2026 21:40:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.15 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401220; cv=pass; b=dsSMcmCwx9mSi3r8ZhkcICT19NS2wQ6DgsNfJnnm6cCVPolqm7CygfdkO2yxbLOKflfnu0h3Ez6fAxJM0Sto1+DEg3QOanmm+kI9sJBy7KoJDmQedl03IrOUz0iufnzRhzYZBNd1PnZyTmITqtf3JGWdheOwtxIAd38xXBwtVbo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772401220; c=relaxed/simple; bh=A5QVI4sc3toPzsBJ0eGEdjAvm937Zw+ZKOz9Z1bfWys=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=eEENI+H/k6ATT3w8sbC18HyMipIW7Kn5oJvGugh6TEwbY7DCLObu167AXmHbkwFnaONFOd1ex8FIdVJa2QtnKHt7InF/gW1hjwmULte3jVRVi4h0Ua6LkwOEjrr0RjOWFcveZHY7H22gWXlWUWadtObxQ7rBUXBW7/ELfpHYJSI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe; spf=pass smtp.mailfrom=rong.moe; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b=Lei5bRoz; arc=pass smtp.client-ip=136.143.188.15 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rong.moe Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rong.moe Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=rong.moe header.i=i@rong.moe header.b="Lei5bRoz" ARC-Seal: i=1; a=rsa-sha256; t=1772401086; cv=none; d=zohomail.com; s=zohoarc; b=AkufcGUvDYmFgTf+4E+ZxuYgHHmDSaJ/tS2bxjK+ClXMmVhalnSQjwpzEBKuv4XZDIFxDrsV6yQKN0gwKfk0yDsvGVlodyv0Dq0gN3DzerrJWlAQfy4f3dOZ0MV+xx2LJ80zBE1ue3GKyq/kzueDKiWBfMqM7/AAjJ/kQNlH/dk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1772401086; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=/BvEQBitzjedx/UMLrqh7LvNZcltcVro9BjyKn24tic=; b=YS3X/CWsP8v8/q3DqJH6wH7Lr5jG95xgeZItF5ptG6POuFrAeEL5HJEq6jtD1ughnSTQsxbR/kNzU9qOyF/aEXEl0BrcwQ/YYfxMNYsfQjTDdyvfS6adpjlbj1Dgyq68d8NZhc6Dx6n/NE+AkUzbZ34pOYcQsukD+1+zefQRKgo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=rong.moe; spf=pass smtp.mailfrom=i@rong.moe; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1772401086; s=zmail2048; d=rong.moe; i=i@rong.moe; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=/BvEQBitzjedx/UMLrqh7LvNZcltcVro9BjyKn24tic=; b=Lei5bRozpthnVLtXlK4V2HXOxe4dUcBZwg4uiy5wY4UE/GM21DdQdrv3C7tnqtk0 BDl3QvUV8WTyWD0gjTYGUR6qDT0hvu32MPourBU0mWWXMkPibqzQwRuYQnVsXQIzpEO my5hg1pkAPvmwk4+29f11UOxdioFUS4+dq7a6fwfLbdoc4Jc1bpgTpyK+VW6KGoy8EP /GDn+T87QxHdNvwtumLOfG8ktl2VDpqGe5ZScuuQufNCb/H9u9gRfAWZqga2SRtg2y5 ChM+RNP5iSNjKbqveIq5M6vQcf7p/xcTut2GQfn9zgXHgGeixwFa3TqxN+j4x4mxO1B L0AVjSm1Wg== Received: by mx.zohomail.com with SMTPS id 1772401084192965.1066787772661; Sun, 1 Mar 2026 13:38:04 -0800 (PST) From: Rong Zhang To: Jaroslav Kysela , Takashi Iwai Cc: Rong Zhang , Jonathan Corbet , Shuah Khan , Cryolitia PukNgae , Arun Raghavan , linux-sound@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Icenowy Zheng Subject: [PATCH 9/9] ALSA: usb-audio: Apply linear volume quirk on MV-SILICON devices Date: Mon, 2 Mar 2026 05:37:25 +0800 Message-ID: <20260301213726.428505-10-i@rong.moe> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260301213726.428505-1-i@rong.moe> References: <20260301213726.428505-1-i@rong.moe> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMailClient: External MV-SILICON is a SoC manufacturer producing multifunctional audio SoCs. Many devices built on top of their SDK share a common quirk that the Playback and Capture mixers use linear volume with val =3D 0/4096/1. The SDK seems to always report "MV-SILICON" for manufacturer string. Hence, match it so that we don't need to define quirk table entries separately for each devices. The "val =3D 0/4096/1" pattern is also checked against before applying the quirk, in order that the quirk won't accidentally break unseen variants. Quirky device samples: usb 7-1: New USB device found, idVendor=3D1235, idProduct=3D0003, bcdDevi= ce=3D 1.00 usb 7-1: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D3 usb 7-1: Product: G1 usb 7-1: Manufacturer: MV-SILICON usb 7-1: SerialNumber: 20190808 usb 7-1: New USB device found, idVendor=3D1235, idProduct=3D0003, bcdDevi= ce=3D 1.00 usb 7-1: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D3 usb 7-1: Product: mvsilicon B1 usb audio usb 7-1: Manufacturer: MV-SILICON usb 7-1: SerialNumber: 20190808 usb 5-1.4: New USB device found, idVendor=3D8888, idProduct=3D1719, bcdDe= vice=3D 1.00 usb 5-1.4: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D3 usb 5-1.4: Product: HF310 USB Audio usb 5-1.4: Manufacturer: MV-SILICON usb 5-1.4: SerialNumber: 20190808 usb 7-1: New USB device found, idVendor=3D2717, idProduct=3D5086, bcdDevi= ce=3D 1.00 usb 7-1: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D3 usb 7-1: Product: Redmi =E7=94=B5=E8=84=91=E9=9F=B3=E7=AE=B1 usb 7-1: Manufacturer: MV-SILICON usb 7-1: SerialNumber: 20190808 usb 2-1.2: New USB device found, idVendor=3D3142, idProduct=3Da601, bcdDe= vice=3D 1.00 usb 2-1.2: New USB device strings: Mfr=3D1, Product=3D2, SerialNumber=3D3 usb 2-1.2: Product: fifine Microphone usb 2-1.2: Manufacturer: MV-SILICON usb 2-1.2: SerialNumber: 20190808 * https://forum.ubuntu-it.org/viewtopic.php?t=3D659345 Signed-off-by: Rong Zhang --- sound/usb/mixer_quirks.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 539044c0c6440..e97814dc90259 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c @@ -4588,6 +4588,24 @@ static void snd_dragonfly_quirk_db_scale(struct usb_= mixer_interface *mixer, } } =20 +static void snd_usb_mv_silicon_quirks(struct usb_mixer_interface *mixer, + struct usb_mixer_elem_info *cval, + struct snd_kcontrol *kctl) +{ + if (cval->min =3D=3D 0 && cval->max =3D=3D 4096 && cval->res =3D=3D 1) { + /* The final effects will be printed later. */ + usb_audio_info(mixer->chip, "applying MV-SILICON quirks (0/4096/1 varian= t)\n"); + + /* Respect MIN_MUTE set by module parameters. */ + if (!(mixer->chip->quirk_flags & QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE)) + mixer->chip->quirk_flags |=3D QUIRK_FLAG_MIXER_PLAYBACK_LINEAR_VOL; + if (!(mixer->chip->quirk_flags & QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE)) + mixer->chip->quirk_flags |=3D QUIRK_FLAG_MIXER_CAPTURE_LINEAR_VOL; + } else { + usb_audio_dbg(mixer->chip, "not applying MV-SILICON quirks on unknown va= riant"); + } +} + /* * Some Plantronics headsets have control names that don't meet ALSA naming * standards. This function fixes nonstandard source names. By the time @@ -4664,6 +4682,10 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_i= nterface *mixer, break; } =20 + if (cval->control =3D=3D UAC_FU_VOLUME && + !strncmp(mixer->chip->card->longname, "MV-SILICON", 10)) + snd_usb_mv_silicon_quirks(mixer, cval, kctl); + /* lowest playback value is muted on some devices */ if (mixer->chip->quirk_flags & QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE) if (strstr(kctl->id.name, "Playback")) { --=20 2.51.0