Commit 5a0438f4 authored by Takashi Sakamoto's avatar Takashi Sakamoto Committed by Takashi Iwai

ALSA: bebob: Use different labels for digital input/output

This commit uses different labels for control elements of digital input/output
interfaces to correct my misunderstanding about M-Audio Firewire 1814 and
ProjectMix I/O.

According to user manuals for these two models, they have two modes for
digital input; one is S/PDIF in both of optical and coaxial interfaces,
another is ADAT in optical interface only.

But in current implementation, a control element for it reduced labels which
a control element for digital output uses because of my misunderstanding
that optical interface is not available for digital input with S/PDIF mode.
Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 90140116
...@@ -434,8 +434,8 @@ static struct snd_kcontrol_new special_sync_ctl = { ...@@ -434,8 +434,8 @@ static struct snd_kcontrol_new special_sync_ctl = {
.get = special_sync_ctl_get, .get = special_sync_ctl_get,
}; };
/* Digital interface control for special firmware */ /* Digital input interface control for special firmware */
static char *const special_dig_iface_labels[] = { static char *const special_dig_in_iface_labels[] = {
"S/PDIF Optical", "S/PDIF Coaxial", "ADAT Optical" "S/PDIF Optical", "S/PDIF Coaxial", "ADAT Optical"
}; };
static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl, static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl,
...@@ -443,13 +443,13 @@ static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl, ...@@ -443,13 +443,13 @@ static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl,
{ {
einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
einf->count = 1; einf->count = 1;
einf->value.enumerated.items = ARRAY_SIZE(special_dig_iface_labels); einf->value.enumerated.items = ARRAY_SIZE(special_dig_in_iface_labels);
if (einf->value.enumerated.item >= einf->value.enumerated.items) if (einf->value.enumerated.item >= einf->value.enumerated.items)
einf->value.enumerated.item = einf->value.enumerated.items - 1; einf->value.enumerated.item = einf->value.enumerated.items - 1;
strcpy(einf->value.enumerated.name, strcpy(einf->value.enumerated.name,
special_dig_iface_labels[einf->value.enumerated.item]); special_dig_in_iface_labels[einf->value.enumerated.item]);
return 0; return 0;
} }
...@@ -504,9 +504,14 @@ static int special_dig_in_iface_ctl_set(struct snd_kcontrol *kctl, ...@@ -504,9 +504,14 @@ static int special_dig_in_iface_ctl_set(struct snd_kcontrol *kctl,
dig_in_fmt, dig_in_fmt,
params->dig_out_fmt, params->dig_out_fmt,
params->clk_lock); params->clk_lock);
if ((err < 0) || (params->dig_in_fmt > 0)) /* ADAT */ if (err < 0)
goto end;
/* For ADAT, optical interface is only available. */
if (params->dig_in_fmt > 0)
goto end; goto end;
/* For S/PDIF, optical/coaxial interfaces are selectable. */
err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface); err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface);
if (err < 0) if (err < 0)
dev_err(&bebob->unit->device, dev_err(&bebob->unit->device,
...@@ -525,18 +530,22 @@ static struct snd_kcontrol_new special_dig_in_iface_ctl = { ...@@ -525,18 +530,22 @@ static struct snd_kcontrol_new special_dig_in_iface_ctl = {
.put = special_dig_in_iface_ctl_set .put = special_dig_in_iface_ctl_set
}; };
/* Digital output interface control for special firmware */
static char *const special_dig_out_iface_labels[] = {
"S/PDIF Optical and Coaxial", "ADAT Optical"
};
static int special_dig_out_iface_ctl_info(struct snd_kcontrol *kctl, static int special_dig_out_iface_ctl_info(struct snd_kcontrol *kctl,
struct snd_ctl_elem_info *einf) struct snd_ctl_elem_info *einf)
{ {
einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
einf->count = 1; einf->count = 1;
einf->value.enumerated.items = ARRAY_SIZE(special_dig_iface_labels) - 1; einf->value.enumerated.items = ARRAY_SIZE(special_dig_out_iface_labels);
if (einf->value.enumerated.item >= einf->value.enumerated.items) if (einf->value.enumerated.item >= einf->value.enumerated.items)
einf->value.enumerated.item = einf->value.enumerated.items - 1; einf->value.enumerated.item = einf->value.enumerated.items - 1;
strcpy(einf->value.enumerated.name, strcpy(einf->value.enumerated.name,
special_dig_iface_labels[einf->value.enumerated.item + 1]); special_dig_out_iface_labels[einf->value.enumerated.item]);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment