aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Knoth <adi@drcomp.erfurt.thur.de>2013-07-05 05:28:21 -0400
committerTakashi Iwai <tiwai@suse.de>2013-07-05 08:53:25 -0400
commiteb0d4dbf3d7f503f435022da46ef1495ca570d85 (patch)
treeb2351357ec47b926ce3c5cc0d9c2f520b70e559e
parent38816545a2cc6f436e5f9b26ebcb4cc2813eeb5c (diff)
ALSA: hdspm - Use snd_ctl_enum_info() for texts_autosync
Also use snd_ctl_enum_info() to fill the autosync enumerated controls. Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/rme9652/hdspm.c29
1 files changed, 10 insertions, 19 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 5a2eb644458e..ffd5d7c08a4b 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -558,36 +558,36 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
558/* names for speed modes */ 558/* names for speed modes */
559static char *hdspm_speed_names[] = { "single", "double", "quad" }; 559static char *hdspm_speed_names[] = { "single", "double", "quad" };
560 560
561static char *texts_autosync_aes_tco[] = { "Word Clock", 561static const char *const texts_autosync_aes_tco[] = { "Word Clock",
562 "AES1", "AES2", "AES3", "AES4", 562 "AES1", "AES2", "AES3", "AES4",
563 "AES5", "AES6", "AES7", "AES8", 563 "AES5", "AES6", "AES7", "AES8",
564 "TCO", "Sync In" 564 "TCO", "Sync In"
565}; 565};
566static char *texts_autosync_aes[] = { "Word Clock", 566static const char *const texts_autosync_aes[] = { "Word Clock",
567 "AES1", "AES2", "AES3", "AES4", 567 "AES1", "AES2", "AES3", "AES4",
568 "AES5", "AES6", "AES7", "AES8", 568 "AES5", "AES6", "AES7", "AES8",
569 "Sync In" 569 "Sync In"
570}; 570};
571static char *texts_autosync_madi_tco[] = { "Word Clock", 571static const char *const texts_autosync_madi_tco[] = { "Word Clock",
572 "MADI", "TCO", "Sync In" }; 572 "MADI", "TCO", "Sync In" };
573static char *texts_autosync_madi[] = { "Word Clock", 573static const char *const texts_autosync_madi[] = { "Word Clock",
574 "MADI", "Sync In" }; 574 "MADI", "Sync In" };
575 575
576static char *texts_autosync_raydat_tco[] = { 576static const char *const texts_autosync_raydat_tco[] = {
577 "Word Clock", 577 "Word Clock",
578 "ADAT 1", "ADAT 2", "ADAT 3", "ADAT 4", 578 "ADAT 1", "ADAT 2", "ADAT 3", "ADAT 4",
579 "AES", "SPDIF", "TCO", "Sync In" 579 "AES", "SPDIF", "TCO", "Sync In"
580}; 580};
581static char *texts_autosync_raydat[] = { 581static const char *const texts_autosync_raydat[] = {
582 "Word Clock", 582 "Word Clock",
583 "ADAT 1", "ADAT 2", "ADAT 3", "ADAT 4", 583 "ADAT 1", "ADAT 2", "ADAT 3", "ADAT 4",
584 "AES", "SPDIF", "Sync In" 584 "AES", "SPDIF", "Sync In"
585}; 585};
586static char *texts_autosync_aio_tco[] = { 586static const char *const texts_autosync_aio_tco[] = {
587 "Word Clock", 587 "Word Clock",
588 "ADAT", "AES", "SPDIF", "TCO", "Sync In" 588 "ADAT", "AES", "SPDIF", "TCO", "Sync In"
589}; 589};
590static char *texts_autosync_aio[] = { "Word Clock", 590static const char *const texts_autosync_aio[] = { "Word Clock",
591 "ADAT", "AES", "SPDIF", "Sync In" }; 591 "ADAT", "AES", "SPDIF", "Sync In" };
592 592
593static const char *const texts_freq[] = { 593static const char *const texts_freq[] = {
@@ -975,7 +975,7 @@ struct hdspm {
975 975
976 struct hdspm_tco *tco; /* NULL if no TCO detected */ 976 struct hdspm_tco *tco; /* NULL if no TCO detected */
977 977
978 char **texts_autosync; 978 const char *const *texts_autosync;
979 int texts_autosync_items; 979 int texts_autosync_items;
980 980
981 cycles_t last_interrupt; 981 cycles_t last_interrupt;
@@ -2888,16 +2888,7 @@ static int snd_hdspm_info_pref_sync_ref(struct snd_kcontrol *kcontrol,
2888{ 2888{
2889 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol); 2889 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2890 2890
2891 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2891 snd_ctl_enum_info(uinfo, 1, hdspm->texts_autosync_items, hdspm->texts_autosync);
2892 uinfo->count = 1;
2893 uinfo->value.enumerated.items = hdspm->texts_autosync_items;
2894
2895 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
2896 uinfo->value.enumerated.item =
2897 uinfo->value.enumerated.items - 1;
2898
2899 strcpy(uinfo->value.enumerated.name,
2900 hdspm->texts_autosync[uinfo->value.enumerated.item]);
2901 2892
2902 return 0; 2893 return 0;
2903} 2894}