Skip to content

Commit

Permalink
ALSA: bebob: Use different labels for digital input/output
Browse files Browse the repository at this point in the history
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: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Takashi Sakamoto authored and Takashi Iwai committed Jul 22, 2014
1 parent 9014011 commit 5a0438f
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions sound/firewire/bebob/bebob_maudio.c
Original file line number Diff line number Diff line change
Expand Up @@ -434,22 +434,22 @@ static struct snd_kcontrol_new special_sync_ctl = {
.get = special_sync_ctl_get,
};

/* Digital interface control for special firmware */
static char *const special_dig_iface_labels[] = {
/* Digital input interface control for special firmware */
static char *const special_dig_in_iface_labels[] = {
"S/PDIF Optical", "S/PDIF Coaxial", "ADAT Optical"
};
static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl,
struct snd_ctl_elem_info *einf)
{
einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
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)
einf->value.enumerated.item = einf->value.enumerated.items - 1;

strcpy(einf->value.enumerated.name,
special_dig_iface_labels[einf->value.enumerated.item]);
special_dig_in_iface_labels[einf->value.enumerated.item]);

return 0;
}
Expand Down Expand Up @@ -504,9 +504,14 @@ static int special_dig_in_iface_ctl_set(struct snd_kcontrol *kctl,
dig_in_fmt,
params->dig_out_fmt,
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;

/* For S/PDIF, optical/coaxial interfaces are selectable. */
err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface);
if (err < 0)
dev_err(&bebob->unit->device,
Expand All @@ -525,18 +530,22 @@ static struct snd_kcontrol_new special_dig_in_iface_ctl = {
.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,
struct snd_ctl_elem_info *einf)
{
einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
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)
einf->value.enumerated.item = einf->value.enumerated.items - 1;

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;
}
Expand Down

0 comments on commit 5a0438f

Please sign in to comment.