Skip to contentSkip to conversation

ALSA: usb-audio: dB mapping fixes

PATCH New Takashi Iwai 1 participant 4 messages Nov 16, 2021 Sound

lore
Share & tools
lore
#2 lore raw

PATCH 2/3 ALSA: usb-audio: Add minimal-mute notion in dB mapping table

In reply to Takashi Iwai

Some devices do mute the volume at the minimal volume, and for such devices, we need to set SNDRV_CTL_TLVT_DB_MINMAX_MUTE to the TLV information. It corresponds to setting usb_mixer_elem_info.min_mute flag in the USB-audio driver.

This patch adds a new field min_mute in usbmix_dB_map so that the mixer map entry can pass the flag.

---
 sound/usb/mixer.c      | 1 +
 sound/usb/mixer_maps.c | 1 +
 2 files changed, 2 insertions(+)
sound/usb/mixer.c +1 -0
index 6e7bac8203ba..5b9fd07ce2a2 100644
@@ -145,6 +145,7 @@ static inline void check_mapped_dB(const struct usbmix_name_map *p,
 	if (p && p->dB) {
 		cval->dBmin = p->dB->min;
 		cval->dBmax = p->dB->max;
+		cval->min_mute = p->dB->min_mute;
 		cval->initialized = 1;
 	}
 }
sound/usb/mixer_maps.c +1 -0
index 92c06b1bb979..9d71c569b148 100644
@@ -8,6 +8,7 @@
 struct usbmix_dB_map {
 	int min;
 	int max;
+	bool min_mute;
 };
 
 struct usbmix_name_map {
Signature · 1 line
2.26.2
#3 lore raw

PATCH 3/3 ALSA: usb-audio: Fix dB level of Bose Revolve+ SoundLink

In reply to Takashi Iwai

Bose Revolve+ SoundLink (0a57:40fa) advertises invalid dB level for the speaker volume. This patch provides the correction in the mixer map quirk table entry.

Note that this requires the prerequisite change to add min_mute flag to the dB map table.

---
 sound/usb/mixer_maps.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)
sound/usb/mixer_maps.c +12 -0
index 9d71c569b148..5d391f62351b 100644
@@ -337,6 +337,13 @@ static const struct usbmix_name_map bose_companion5_map[] = {
 	{ 0 }	/* terminator */
 };
 
+/* Bose Revolve+ SoundLink, correction of dB maps */
+static const struct usbmix_dB_map bose_soundlink_dB = {-8283, -0, true};
+static const struct usbmix_name_map bose_soundlink_map[] = {
+	{ 2, NULL, .dB = &bose_soundlink_dB },
+	{ 0 }	/* terminator */
+};
+
 /* Sennheiser Communications Headset [PC 8], the dB value is reported as -6 negative maximum  */
 static const struct usbmix_dB_map sennheiser_pc8_dB = {-9500, 0};
 static const struct usbmix_name_map sennheiser_pc8_map[] = {
@@ -522,6 +529,11 @@ static const struct usbmix_ctl_map usbmix_ctl_maps[] = {
 		.id = USB_ID(0x05a7, 0x1020),
 		.map = bose_companion5_map,
 	},
+	{
+		/* Bose Revolve+ SoundLink */
+		.id = USB_ID(0x05a7, 0x40fa),
+		.map = bose_soundlink_map,
+	},
 	{
 		/* Corsair Virtuoso SE (wired mode) */
 		.id = USB_ID(0x1b1c, 0x0a3d),
Signature · 1 line
2.26.2
#0 lore raw

cover ALSA: usb-audio: dB mapping fixes

Hi,

here is a small patch set to slightly extend the dB mapping table in USB-audio driver to add the support for minimal-mute. The feature itself is already present in the driver, and it's a matter of addition in the mapping table. This is used in the quirk for Bose SoundLink.

Takashi

===

Takashi Iwai (3):
ALSA: usb-audio: Use int for dB map values
ALSA: usb-audio: Add minimal-mute notion in dB mapping table
ALSA: usb-audio: Fix dB level of Bose Revolve+ SoundLink

 sound/usb/mixer.c      |  1 +
 sound/usb/mixer_maps.c | 17 +++++++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/3 ALSA: usb-audio: Use int for dB map values

The values in usbmix_dB_map should be rather signed while we're using u32. As the copied target (usb_mixer_elem_info.dBmin and dBmax) is int, let's make them also int.

---
 sound/usb/mixer_maps.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/usb/mixer_maps.c +2 -2
index 55eea90ee993..92c06b1bb979 100644
@@ -6,8 +6,8 @@
  */
 
 struct usbmix_dB_map {
-	u32 min;
-	u32 max;
+	int min;
+	int max;
 };
 
 struct usbmix_name_map {
Signature · 1 line
2.26.2