aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/bebob/bebob_maudio.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-07-22 10:13:47 -0400
committerTakashi Iwai <tiwai@suse.de>2014-07-22 10:21:30 -0400
commit5a0438f4a6328b47bd3c00b2f03eb766cc72a75c (patch)
tree5db30338ebd7cd775d99c246b826a7e89bf72689 /sound/firewire/bebob/bebob_maudio.c
parent901401166464dc1875825235bb2541af31b4c384 (diff)
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: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/bebob/bebob_maudio.c')
-rw-r--r--sound/firewire/bebob/bebob_maudio.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c
index fc470c60e433..42e6f22156f0 100644
--- a/sound/firewire/bebob/bebob_maudio.c
+++ b/sound/firewire/bebob/bebob_maudio.c
@@ -434,8 +434,8 @@ static struct snd_kcontrol_new special_sync_ctl = {
434 .get = special_sync_ctl_get, 434 .get = special_sync_ctl_get,
435}; 435};
436 436
437/* Digital interface control for special firmware */ 437/* Digital input interface control for special firmware */
438static char *const special_dig_iface_labels[] = { 438static char *const special_dig_in_iface_labels[] = {
439 "S/PDIF Optical", "S/PDIF Coaxial", "ADAT Optical" 439 "S/PDIF Optical", "S/PDIF Coaxial", "ADAT Optical"
440}; 440};
441static int special_dig_in_iface_ctl_info(struct snd_kcontrol *kctl, 441static 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{ 443{
444 einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 444 einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
445 einf->count = 1; 445 einf->count = 1;
446 einf->value.enumerated.items = ARRAY_SIZE(special_dig_iface_labels); 446 einf->value.enumerated.items = ARRAY_SIZE(special_dig_in_iface_labels);
447 447
448 if (einf->value.enumerated.item >= einf->value.enumerated.items) 448 if (einf->value.enumerated.item >= einf->value.enumerated.items)
449 einf->value.enumerated.item = einf->value.enumerated.items - 1; 449 einf->value.enumerated.item = einf->value.enumerated.items - 1;
450 450
451 strcpy(einf->value.enumerated.name, 451 strcpy(einf->value.enumerated.name,
452 special_dig_iface_labels[einf->value.enumerated.item]); 452 special_dig_in_iface_labels[einf->value.enumerated.item]);
453 453
454 return 0; 454 return 0;
455} 455}
@@ -504,9 +504,14 @@ static int special_dig_in_iface_ctl_set(struct snd_kcontrol *kctl,
504 dig_in_fmt, 504 dig_in_fmt,
505 params->dig_out_fmt, 505 params->dig_out_fmt,
506 params->clk_lock); 506 params->clk_lock);
507 if ((err < 0) || (params->dig_in_fmt > 0)) /* ADAT */ 507 if (err < 0)
508 goto end;
509
510 /* For ADAT, optical interface is only available. */
511 if (params->dig_in_fmt > 0)
508 goto end; 512 goto end;
509 513
514 /* For S/PDIF, optical/coaxial interfaces are selectable. */
510 err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface); 515 err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface);
511 if (err < 0) 516 if (err < 0)
512 dev_err(&bebob->unit->device, 517 dev_err(&bebob->unit->device,
@@ -525,18 +530,22 @@ static struct snd_kcontrol_new special_dig_in_iface_ctl = {
525 .put = special_dig_in_iface_ctl_set 530 .put = special_dig_in_iface_ctl_set
526}; 531};
527 532
533/* Digital output interface control for special firmware */
534static char *const special_dig_out_iface_labels[] = {
535 "S/PDIF Optical and Coaxial", "ADAT Optical"
536};
528static int special_dig_out_iface_ctl_info(struct snd_kcontrol *kctl, 537static int special_dig_out_iface_ctl_info(struct snd_kcontrol *kctl,
529 struct snd_ctl_elem_info *einf) 538 struct snd_ctl_elem_info *einf)
530{ 539{
531 einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 540 einf->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
532 einf->count = 1; 541 einf->count = 1;
533 einf->value.enumerated.items = ARRAY_SIZE(special_dig_iface_labels) - 1; 542 einf->value.enumerated.items = ARRAY_SIZE(special_dig_out_iface_labels);
534 543
535 if (einf->value.enumerated.item >= einf->value.enumerated.items) 544 if (einf->value.enumerated.item >= einf->value.enumerated.items)
536 einf->value.enumerated.item = einf->value.enumerated.items - 1; 545 einf->value.enumerated.item = einf->value.enumerated.items - 1;
537 546
538 strcpy(einf->value.enumerated.name, 547 strcpy(einf->value.enumerated.name,
539 special_dig_iface_labels[einf->value.enumerated.item + 1]); 548 special_dig_out_iface_labels[einf->value.enumerated.item]);
540 549
541 return 0; 550 return 0;
542} 551}