mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-17 02:15:57 +00:00
ALSA: usb-audio: fix Pioneer DJM-850 control label info
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> Link: https://lore.kernel.org/r/20210301152729.18094-5-nicolas.mure2019@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
1a2a94a439
commit
b8db8be812
@ -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) {
|
switch (wvalue & 0x00ff) {
|
||||||
case SND_DJM_CAP_LINE: return "Control Tone LINE";
|
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)
|
static const char *snd_djm_get_label_pb(u16 wvalue)
|
||||||
{
|
{
|
||||||
switch (wvalue & 0x00ff) {
|
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) {
|
switch (windex) {
|
||||||
case SND_DJM_WINDEX_CAPLVL: return snd_djm_get_label_caplevel(wvalue);
|
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);
|
case SND_DJM_WINDEX_PB: return snd_djm_get_label_pb(wvalue);
|
||||||
default: return NULL;
|
default: return NULL;
|
||||||
}
|
}
|
||||||
@ -2852,7 +2871,8 @@ static int snd_djm_controls_info(struct snd_kcontrol *kctl,
|
|||||||
if (info->value.enumerated.item >= noptions)
|
if (info->value.enumerated.item >= noptions)
|
||||||
info->value.enumerated.item = noptions - 1;
|
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);
|
ctl->wIndex);
|
||||||
if (!name)
|
if (!name)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user