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>
This commit is contained in:
parent
38816545a2
commit
eb0d4dbf3d
1 changed files with 10 additions and 19 deletions
|
@ -558,36 +558,36 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
|
||||||
/* names for speed modes */
|
/* names for speed modes */
|
||||||
static char *hdspm_speed_names[] = { "single", "double", "quad" };
|
static char *hdspm_speed_names[] = { "single", "double", "quad" };
|
||||||
|
|
||||||
static char *texts_autosync_aes_tco[] = { "Word Clock",
|
static const char *const texts_autosync_aes_tco[] = { "Word Clock",
|
||||||
"AES1", "AES2", "AES3", "AES4",
|
"AES1", "AES2", "AES3", "AES4",
|
||||||
"AES5", "AES6", "AES7", "AES8",
|
"AES5", "AES6", "AES7", "AES8",
|
||||||
"TCO", "Sync In"
|
"TCO", "Sync In"
|
||||||
};
|
};
|
||||||
static char *texts_autosync_aes[] = { "Word Clock",
|
static const char *const texts_autosync_aes[] = { "Word Clock",
|
||||||
"AES1", "AES2", "AES3", "AES4",
|
"AES1", "AES2", "AES3", "AES4",
|
||||||
"AES5", "AES6", "AES7", "AES8",
|
"AES5", "AES6", "AES7", "AES8",
|
||||||
"Sync In"
|
"Sync In"
|
||||||
};
|
};
|
||||||
static char *texts_autosync_madi_tco[] = { "Word Clock",
|
static const char *const texts_autosync_madi_tco[] = { "Word Clock",
|
||||||
"MADI", "TCO", "Sync In" };
|
"MADI", "TCO", "Sync In" };
|
||||||
static char *texts_autosync_madi[] = { "Word Clock",
|
static const char *const texts_autosync_madi[] = { "Word Clock",
|
||||||
"MADI", "Sync In" };
|
"MADI", "Sync In" };
|
||||||
|
|
||||||
static char *texts_autosync_raydat_tco[] = {
|
static const char *const texts_autosync_raydat_tco[] = {
|
||||||
"Word Clock",
|
"Word Clock",
|
||||||
"ADAT 1", "ADAT 2", "ADAT 3", "ADAT 4",
|
"ADAT 1", "ADAT 2", "ADAT 3", "ADAT 4",
|
||||||
"AES", "SPDIF", "TCO", "Sync In"
|
"AES", "SPDIF", "TCO", "Sync In"
|
||||||
};
|
};
|
||||||
static char *texts_autosync_raydat[] = {
|
static const char *const texts_autosync_raydat[] = {
|
||||||
"Word Clock",
|
"Word Clock",
|
||||||
"ADAT 1", "ADAT 2", "ADAT 3", "ADAT 4",
|
"ADAT 1", "ADAT 2", "ADAT 3", "ADAT 4",
|
||||||
"AES", "SPDIF", "Sync In"
|
"AES", "SPDIF", "Sync In"
|
||||||
};
|
};
|
||||||
static char *texts_autosync_aio_tco[] = {
|
static const char *const texts_autosync_aio_tco[] = {
|
||||||
"Word Clock",
|
"Word Clock",
|
||||||
"ADAT", "AES", "SPDIF", "TCO", "Sync In"
|
"ADAT", "AES", "SPDIF", "TCO", "Sync In"
|
||||||
};
|
};
|
||||||
static char *texts_autosync_aio[] = { "Word Clock",
|
static const char *const texts_autosync_aio[] = { "Word Clock",
|
||||||
"ADAT", "AES", "SPDIF", "Sync In" };
|
"ADAT", "AES", "SPDIF", "Sync In" };
|
||||||
|
|
||||||
static const char *const texts_freq[] = {
|
static const char *const texts_freq[] = {
|
||||||
|
@ -975,7 +975,7 @@ struct hdspm {
|
||||||
|
|
||||||
struct hdspm_tco *tco; /* NULL if no TCO detected */
|
struct hdspm_tco *tco; /* NULL if no TCO detected */
|
||||||
|
|
||||||
char **texts_autosync;
|
const char *const *texts_autosync;
|
||||||
int texts_autosync_items;
|
int texts_autosync_items;
|
||||||
|
|
||||||
cycles_t last_interrupt;
|
cycles_t last_interrupt;
|
||||||
|
@ -2888,16 +2888,7 @@ static int snd_hdspm_info_pref_sync_ref(struct snd_kcontrol *kcontrol,
|
||||||
{
|
{
|
||||||
struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
|
struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
|
||||||
|
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
snd_ctl_enum_info(uinfo, 1, hdspm->texts_autosync_items, hdspm->texts_autosync);
|
||||||
uinfo->count = 1;
|
|
||||||
uinfo->value.enumerated.items = hdspm->texts_autosync_items;
|
|
||||||
|
|
||||||
if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
|
|
||||||
uinfo->value.enumerated.item =
|
|
||||||
uinfo->value.enumerated.items - 1;
|
|
||||||
|
|
||||||
strcpy(uinfo->value.enumerated.name,
|
|
||||||
hdspm->texts_autosync[uinfo->value.enumerated.item]);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue