mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Ruppert <arc@gmx.li>
To: perex@perex.cz, tiwai@suse.com, linux-kernel@vger.kernel.org,
	linux-sound@vger.kernel.org
Cc: arc@gmx.li, mrwillporter@gmail.com
Subject: [PATCH 4/4] ALSA: mixer_evo: Add tlv for mixer channels
Date: Mon, 26 Oct 2026 18:44:26 +0100	[thread overview]
Message-ID: <20261026174427.24947-5-arc@gmx.li> (raw)
In-Reply-To: <20261026174427.24947-1-arc@gmx.li>

mixer_evo didn't declare tlv for the recording mixer matrix which seems to
confuse some userland programs. Add tlv definitions to fix this.

We still do not add tlv for the crossfader (generally labelled "mixer")
because there doesn't seem to be a way to declare this so that userland
programs just keep it as linear as it is and should be.

Signed-off-by: Christian Ruppert <arc@gmx.li>
---
 sound/usb/mixer_evo.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/sound/usb/mixer_evo.c b/sound/usb/mixer_evo.c
index 867d083953ba..c1e0332232f2 100644
--- a/sound/usb/mixer_evo.c
+++ b/sound/usb/mixer_evo.c
@@ -14,6 +14,7 @@
 #include <linux/slab.h>
 #include <sound/core.h>
 #include <sound/control.h>
+#include <sound/tlv.h>
 
 #include "usbaudio.h"
 #include "mixer.h"
@@ -31,6 +32,9 @@ enum snd_evo_type {
 	SND_EVO_TYPE_NCTYPES
 };
 
+/* Mixer matrix: -128dB (mute) to +6dB */
+static const DECLARE_TLV_DB_MINMAX_MUTE(snd_evo_tlv_mixer, -12800, 600);
+
 static const struct snd_evo_ctrl_type {
 	snd_ctl_elem_type_t type;
 	bool invert;
@@ -40,6 +44,7 @@ static const struct snd_evo_ctrl_type {
 	union {
 		int integer;
 	} max;
+	const unsigned int *tlv;
 	u16 wValue;
 	u16 wIndex;
 } snd_evo_ctypes[SND_EVO_TYPE_NCTYPES] = {
@@ -49,6 +54,7 @@ static const struct snd_evo_ctrl_type {
 		.max.integer = 127,
 		.wValue = 0x0000,
 		.wIndex = 0x3800,
+		/* no TLV here because we can't describe the cross-fader */
 	},
 	[SND_EVO_TYPE_PHANTOM] = {
 		.type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
@@ -80,6 +86,7 @@ static const struct snd_evo_ctrl_type {
 		.max.integer = 6 * 256,
 		.wValue = 0x0100,
 		.wIndex = 0x3C00,
+		.tlv = snd_evo_tlv_mixer,
 	},
 };
 
@@ -431,8 +438,6 @@ static int snd_ctl_evo_info(struct snd_kcontrol *kctl,
 	const struct snd_evo_ctrl_type *const ctype = snd_evo_kctl_type(kctl);
 
 	uinfo->type = ctype->type;
-	uinfo->access = SNDRV_CTL_ELEM_ACCESS_READWRITE
-			| SNDRV_CTL_ELEM_ACCESS_VOLATILE;
 	uinfo->count = snd_evo_kctl_channels(kctl);
 	uinfo->value.integer.min = ctype->min.integer;
 	uinfo->value.integer.max = ctype->max.integer;
@@ -454,6 +459,10 @@ static int snd_evo_add_ctrl(struct usb_mixer_interface *mixer,
 	knew.info = snd_ctl_evo_info;
 	knew.private_value = snd_evo_kctl_priv(ctrl->type, ctrl->val_offs,
 					       ctrl->hwchannels);
+	knew.tlv.p = ctype->tlv;
+	knew.access = SNDRV_CTL_ELEM_ACCESS_READWRITE
+			| SNDRV_CTL_ELEM_ACCESS_VOLATILE
+			| (ctype->tlv ? SNDRV_CTL_ELEM_ACCESS_TLV_READ : 0);
 
 	switch (ctype->type) {
 	case SNDRV_CTL_ELEM_TYPE_INTEGER:
-- 
2.56.0


      parent reply	other threads:[~2026-10-26 17:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-26 17:44 [PATCH 0/4] ALSA: mixer_evo: minor fixes and tlv addition Christian Ruppert
2026-10-26 17:44 ` [PATCH 1/4] ALSA: mixer_evo: Remove double end marker device list Christian Ruppert
2026-10-26 17:44 ` [PATCH 2/4] ALSA: mixer_evo: Add missing snd_usb_lock calls Christian Ruppert
2026-10-26 17:44 ` [PATCH 3/4] ALSA: mixer_evo: Fix endianness of boolean inversion Christian Ruppert
2026-10-26 17:44 ` Christian Ruppert [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261026174427.24947-5-arc@gmx.li \
    --to=arc@gmx.li \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=mrwillporter@gmail.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®