From: Nicolas MURE <nicolas.mure2019@gmail.com>
To: alsa-devel@alsa-project.org
Cc: Nicolas MURE <nicolas.mure2019@gmail.com>, livvy@base.nu
Subject: [PATCH 4/4] ASLA: usb-audio: fix Pioneer DJM-850 control label info
Date: Fri, 26 Feb 2021 14:34:29 +0100 [thread overview]
Message-ID: <20210226133429.20081-5-nicolas.mure2019@gmail.com> (raw)
In-Reply-To: <20210226133429.20081-1-nicolas.mure2019@gmail.com>
Unlike the other DJM, the value to set the "CD/LINE" and "LINE" capture
control options are inverted. This fix makes sure that the displayed
info label while using `alsamixer` matches the input switches label
on the DJM-850 mixer.
Signed-off-by: Nicolas MURE <nicolas.mure2019@gmail.com>
---
sound/usb/mixer_quirks.c | 28 ++++++++++++++++++++++++----
1 file changed, 24 insertions(+), 4 deletions(-)
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index b325b6597d91..5b77e8140ba6 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -2693,7 +2693,7 @@ static const char *snd_djm_get_label_caplevel(u16 wvalue)
}
};
-static const char *snd_djm_get_label_cap(u16 wvalue)
+static const char *snd_djm_get_label_cap_common(u16 wvalue)
{
switch (wvalue & 0x00ff) {
case SND_DJM_CAP_LINE: return "Control Tone LINE";
@@ -2715,6 +2715,25 @@ static const char *snd_djm_get_label_cap(u16 wvalue)
}
};
+// The DJM-850 has different values for CD/LINE and LINE capture
+// control options than the other DJM declared in this file.
+static const char *snd_djm_get_label_cap_850(u16 wvalue)
+{
+ switch (wvalue & 0x00ff) {
+ case 0x00: return "Control Tone CD/LINE";
+ case 0x01: return "Control Tone LINE";
+ default: return snd_djm_get_label_cap_common(wvalue);
+ }
+};
+
+static const char *snd_djm_get_label_cap(u8 device_idx, u16 wvalue)
+{
+ switch (device_idx) {
+ case SND_DJM_850_IDX: return snd_djm_get_label_cap_850(wvalue);
+ default: return snd_djm_get_label_cap_common(wvalue);
+ }
+};
+
static const char *snd_djm_get_label_pb(u16 wvalue)
{
switch (wvalue & 0x00ff) {
@@ -2725,11 +2744,11 @@ static const char *snd_djm_get_label_pb(u16 wvalue)
}
};
-static const char *snd_djm_get_label(u16 wvalue, u16 windex)
+static const char *snd_djm_get_label(u8 device_idx, u16 wvalue, u16 windex)
{
switch (windex) {
case SND_DJM_WINDEX_CAPLVL: return snd_djm_get_label_caplevel(wvalue);
- case SND_DJM_WINDEX_CAP: return snd_djm_get_label_cap(wvalue);
+ case SND_DJM_WINDEX_CAP: return snd_djm_get_label_cap(device_idx, wvalue);
case SND_DJM_WINDEX_PB: return snd_djm_get_label_pb(wvalue);
default: return NULL;
}
@@ -2852,7 +2871,8 @@ static int snd_djm_controls_info(struct snd_kcontrol *kctl,
if (info->value.enumerated.item >= noptions)
info->value.enumerated.item = noptions - 1;
- name = snd_djm_get_label(ctl->options[info->value.enumerated.item],
+ name = snd_djm_get_label(device_idx,
+ ctl->options[info->value.enumerated.item],
ctl->wIndex);
if (!name)
return -EINVAL;
--
2.29.2
prev parent reply other threads:[~2021-03-01 13:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-26 13:34 [PATCH 0/4]: ALSA: usb-audio: Add Pioneer DJM-850 support Nicolas MURE
2021-02-26 13:34 ` [PATCH 1/4] ALSA: usb-audio: Add Pioneer DJM-850 to quirks-table Nicolas MURE
2021-02-26 13:34 ` [PATCH 2/4] ASLA: usb-audio: Declare Pioneer DJM-850 mixer controls Nicolas MURE
2021-02-26 13:34 ` [PATCH 3/4] ALSA: usb-audio: Configure Pioneer DJM-850 samplerate Nicolas MURE
2021-03-01 13:58 ` Takashi Iwai
2021-03-01 15:27 ` [PATCH v2 0/4] ALSA: usb-audio: Add Pioneer DJM-850 support Nicolas MURE
2021-03-01 15:27 ` [PATCH v2 1/4] ALSA: usb-audio: Add Pioneer DJM-850 to quirks-table Nicolas MURE
2021-03-01 15:27 ` [PATCH v2 2/4] ASLA: usb-audio: Declare Pioneer DJM-850 mixer controls Nicolas MURE
2021-03-01 15:27 ` [PATCH v2 3/4] ALSA: usb-audio: Configure Pioneer DJM-850 samplerate Nicolas MURE
2021-03-01 15:27 ` [PATCH v2 4/4] ASLA: usb-audio: fix Pioneer DJM-850 control label info Nicolas MURE
2021-03-02 9:20 ` [PATCH v2 0/4] ALSA: usb-audio: Add Pioneer DJM-850 support Takashi Iwai
2021-02-26 13:34 ` Nicolas MURE [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=20210226133429.20081-5-nicolas.mure2019@gmail.com \
--to=nicolas.mure2019@gmail.com \
--cc=alsa-devel@alsa-project.org \
--cc=livvy@base.nu \
/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