From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17593369D64 for ; Sun, 23 Aug 2026 22:29:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787524196; cv=none; b=AYLtviotuXo79T4q99FCdcf4Gd9RsVMn12N1s99I9tjN8yJSUScc+wLMfJmkXpqgC6W6jqptdIh34//cNMmMyJKpgU1Pik0ickhhw97oV+YVnggAfJxtIAl6d6MU/lzJzyrNImUqLFKXHYr8jaUCuDZeHeT4A/0XwHSM2BtSND8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787524196; c=relaxed/simple; bh=YPtSVgt+I83Sizs3yqlmS4qpNDxhC5ISL27cr4nIfkk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H9JeWmDIMsfBSM3Ndh7fnIjcwjozHBxTQQtiFDfjKfrMptWtjG/ke7lZ0ImznifTOcCPefok5ykma63Aq68DF6On7+HDVKmX+gKKsY8fuZeVDT9wMC7HAcDaO/thjofY1VTrobq+lImavLYAVzYzPdhHyL97fbrUSQ4iy6v4cMc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=F7cp4Qt+; arc=none smtp.client-ip=209.85.167.52 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.b="F7cp4Qt+" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-5b29599b81cso3505924e87.1 for ; Sun, 23 Aug 2026 15:29:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787524193; x=1788128993; 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=Ce/iFmek4waUX1AI+D3lqcH6W5Vrp1c8Zj3tDAmkQBw=; b=F7cp4Qt+hjUAD/y3fNcwbb0faQ3mB6AYD7T91bPYbWznbeppou1UWGoGD5K+Sa4Gvv S0tcpUjHaFecV0352hw3crBQZx1maNElfgEaZTQRSQoFon8YX52Baroq/iM8qRYwwx8T nm3IHteImQ7bs4vIhDcElmhrisoorYStusqYyVFkTM9g/dX2cRbwnT+btmgCIg8TWrJj og54JXJ++WBQVHrLAXFO0pj8Ub1EuH568hfsZo99N4hk7rU2nRz2be02I0NE+22A+OLk fIOUADXh7U+PW9kyOinNwjjixZtWtu7CCaCQDHX7I9tiMd4ygozYv5n9ZWktdTzI9FZS ZtMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787524193; x=1788128993; 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=Ce/iFmek4waUX1AI+D3lqcH6W5Vrp1c8Zj3tDAmkQBw=; b=BZYstwfTHqcW++0M1EfpG44Xyrujhz82L/7LjLCo+ZD/nOzaBQ6WX+qCTnbSkjiCaw iZC/nWEVJsxW6e59pkr621IInnFu4gitVnL0L0x9aBrLpLAyMp33YTl/lD52o9XPiNBt u5xH3fEvn93rwm1s4d04H9Yv0FBqtp9bMtoNtDgptGd011vHNDDSC3kqGB1FNfJieayz LrdGSVh6ZZdyYrqXtOaVEJhjW/M1KC132dtzFscbmUtIiHnLr9t10VsFm21Is4tMHSAZ kNBBhds7gSLD5hh9xmk8ESat/zLAUGhvAzPbyYYlMLs0pKH5boHY/WQOHavFqqDQJsum FXvw== X-Forwarded-Encrypted: i=1; AHgh+Rq2b+TGbOVT5yZgtVblnvy/bfHi6HFdglbCDc9L+6in1TqDQ6FZuaeJCgevIP3uwl2l+KMg9BepejkR7gQ=@vger.kernel.org X-Gm-Message-State: AFuF++l6fBg1mVGzhNQOIwkNuSOfCNaMEdA+L8zMum1SgdTcr+lDDOZ+ Awh0o2tGXNd9UOZkzi6yoPR9diPNH2njeT5q6C4uiJhpqU+FBg2iyat8 X-Gm-Gg: AR+sD10bFjTaPyvQVP2ksMNLBY8kCrvhjLRkqd/yW17VpOS68mkXDNL7j9rOPN/Vlc5 XmOZtrpy65GbFS6VJHFAsDbij4M+0ovNN07kF/aEm6+MzU/tEHTAbhY/mvUMKk1LbEAsaLH8h05 aHxVwbE07A6dTARlRQI/ax84pInbFzpE1TatwRrxjBK1HCP90DJWdw2UPUdFE35AnG92hY82VUr yyrTwwWP8XBwwxAXAJ57NUGDEj78SQ7+apovN32uNwrjr248EWmiRA20Q1U49kXXZ7hx9jjtD1K pg237d1agbRrgJqc1+DfXopXGEVxQXGO6oKkDddniNn9x1UTuWGCnWlEpw0nAye3UgnFzPXeQll N4lCsrosvqIL3ZFIgk/Pi+sRn+n+8t6y3wVnC5OK8He0vJjDfZsyYNgrKbz+muWX2k4S6kaBis9 laJNOIdOezleYmBsBnGuLVoqmhDd7wlLHFd91bJ5j5898owpYv6oIMpdErdcFaktIS+fdBHCoWx uoi0pMoxSqB/iI/l+PmE2LuA1nmEJBv7Y7tjNiY0K5wycJMAVQ+vijMWdi8tDRPkF0BSFg= X-Received: by 2002:a05:6512:3c98:b0:5b1:5451:d969 with SMTP id 2adb3069b0e04-5b48b8aef26mr3724914e87.25.1787524192898; Sun, 23 Aug 2026 15:29:52 -0700 (PDT) Received: from localhost ([188.234.148.119]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5b48cda2bccsm1227499e87.28.2026.08.23.15.29.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Aug 2026 15:29:51 -0700 (PDT) From: Mikhail Gavrilov To: tiwai@suse.com Cc: perex@perex.cz, jikos@kernel.org, bentiss@kernel.org, linux-sound@vger.kernel.org, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Mikhail Gavrilov Subject: [PATCH v4 0/2] ALSA: usb-audio: the Topping M62's vendor controls Date: Mon, 24 Aug 2026 03:29:44 +0500 Message-ID: <20260823222946.171345-1-mikhail.v.gavrilov@gmail.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260823194822.29430-1-mikhail.v.gavrilov@gmail.com> References: <20260823194822.29430-1-mikhail.v.gavrilov@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit v4 answers the automated review of v3. One of its three findings led to a change; the other two do not hold, and I would rather say why here than leave the question hanging for a human reader of the thread. The change is in 2/2. The driver marks its elements USB_MIXER_BESPOKEN, which opts them out of the mixer core's restore_mixer_value(), so restoring across a suspend became this driver's own business. For the gains that is covered -- the device announces them and the cache re-syncs by itself -- but a source selector is never reported by the device at all, so nothing covered it: if the card had come up on its own defaults while the host slept, the driver's idea of the selector would have been silently wrong, and writing the remembered value back would have looked like no change and done nothing. The resume path now writes the chosen value again. Said plainly, because it matters for how you weigh it: I did not observe that. This card has a battery, and with the headphone selector on Playback 3/4 and music playing into that bus, a full suspend and wake brought the sound straight back untouched. The change closes a gap this driver opened by opting out of the core's restore, not a fault seen on the hardware. The two findings I am not acting on both concern a control callback using a freed private structure during disconnect. The ALSA core already excludes it. snd_ctl_elem_read() and snd_ctl_elem_write() take snd_power_ref_and_wait(card) around the callback; snd_card_disconnect() ends with snd_power_sync_ref(card), which waits until every such reference is dropped; and in usb-audio's disconnect, snd_card_disconnect() runs before usb_audio_disconnect_components() reaches snd_usb_mixer_disconnect() and hence this driver's private_free(). So no callback can be inside the driver when the structure is freed, and none can enter afterwards -- snd_power_ref_and_wait() sees card->shutdown and returns -ENODEV. The observation that the controls themselves live until snd_card_free() is correct; the access path to them is closed earlier. Nothing else changed since v3. The questions in the v2 cover letter -- about a third form in which snd-usb-audio would register the hid_driver itself, and about a control that can be written but not read -- still stand. Tested on the hardware: values arrive by themselves after probe, a front panel knob still reaches the driver ten minutes later and after a suspend and resume cycle, a write reaches the analogue stage (one source recorded at gain 30 and at gain 60 differs by 30.4 dB against the 30.0 dB the taper table predicts), the audible selector test passes, unbind and bind again works, and alsactl stores and restores these controls without complaint. On a KASAN and lockdep kernel, including unplug while a stream was running; no reports. Mikhail Gavrilov (2): ALSA: usb-audio: expose the Topping M62's analogue gains as mixer controls ALSA: usb-audio: let the M62's outputs say what they listen to MAINTAINERS | 6 + drivers/hid/hid-ids.h | 3 + drivers/hid/hid-quirks.c | 2 + sound/usb/Makefile | 1 + sound/usb/card.c | 19 + sound/usb/mixer_quirks.c | 5 + sound/usb/mixer_topping.c | 734 ++++++++++++++++++++++++++++++++++++++ sound/usb/mixer_topping.h | 7 + sound/usb/usbaudio.h | 4 + 9 files changed, 781 insertions(+) create mode 100644 sound/usb/mixer_topping.c create mode 100644 sound/usb/mixer_topping.h base-commit: 2709dd5ae32f0828f386327c76bba9f39f63a1c6 -- 2.55.0