mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-25 01:40:53 +07:00
ALSA: korg1212: Use snd_ctl_enum_info()
... and reduce the open codes. Also add missing const to text arrays. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
597da2e4df
commit
f861237c80
@ -444,9 +444,9 @@ static char *stateName[] = {
|
|||||||
"Invalid"
|
"Invalid"
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *clockSourceTypeName[] = { "ADAT", "S/PDIF", "local" };
|
static const char * const clockSourceTypeName[] = { "ADAT", "S/PDIF", "local" };
|
||||||
|
|
||||||
static char *clockSourceName[] = {
|
static const char * const clockSourceName[] = {
|
||||||
"ADAT at 44.1 kHz",
|
"ADAT at 44.1 kHz",
|
||||||
"ADAT at 48 kHz",
|
"ADAT at 48 kHz",
|
||||||
"S/PDIF at 44.1 kHz",
|
"S/PDIF at 44.1 kHz",
|
||||||
@ -455,7 +455,7 @@ static char *clockSourceName[] = {
|
|||||||
"local clock at 48 kHz"
|
"local clock at 48 kHz"
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *channelName[] = {
|
static const char * const channelName[] = {
|
||||||
"ADAT-1",
|
"ADAT-1",
|
||||||
"ADAT-2",
|
"ADAT-2",
|
||||||
"ADAT-3",
|
"ADAT-3",
|
||||||
@ -1844,14 +1844,9 @@ static int snd_korg1212_control_volume_put(struct snd_kcontrol *kcontrol,
|
|||||||
static int snd_korg1212_control_route_info(struct snd_kcontrol *kcontrol,
|
static int snd_korg1212_control_route_info(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_info *uinfo)
|
struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
return snd_ctl_enum_info(uinfo,
|
||||||
uinfo->count = (kcontrol->private_value >= 8) ? 2 : 1;
|
(kcontrol->private_value >= 8) ? 2 : 1,
|
||||||
uinfo->value.enumerated.items = kAudioChannels;
|
kAudioChannels, channelName);
|
||||||
if (uinfo->value.enumerated.item > kAudioChannels-1) {
|
|
||||||
uinfo->value.enumerated.item = kAudioChannels-1;
|
|
||||||
}
|
|
||||||
strcpy(uinfo->value.enumerated.name, channelName[uinfo->value.enumerated.item]);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_korg1212_control_route_get(struct snd_kcontrol *kcontrol,
|
static int snd_korg1212_control_route_get(struct snd_kcontrol *kcontrol,
|
||||||
@ -1961,14 +1956,7 @@ static int snd_korg1212_control_put(struct snd_kcontrol *kcontrol,
|
|||||||
static int snd_korg1212_control_sync_info(struct snd_kcontrol *kcontrol,
|
static int snd_korg1212_control_sync_info(struct snd_kcontrol *kcontrol,
|
||||||
struct snd_ctl_elem_info *uinfo)
|
struct snd_ctl_elem_info *uinfo)
|
||||||
{
|
{
|
||||||
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
|
return snd_ctl_enum_info(uinfo, 1, 3, clockSourceTypeName);
|
||||||
uinfo->count = 1;
|
|
||||||
uinfo->value.enumerated.items = 3;
|
|
||||||
if (uinfo->value.enumerated.item > 2) {
|
|
||||||
uinfo->value.enumerated.item = 2;
|
|
||||||
}
|
|
||||||
strcpy(uinfo->value.enumerated.name, clockSourceTypeName[uinfo->value.enumerated.item]);
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int snd_korg1212_control_sync_get(struct snd_kcontrol *kcontrol,
|
static int snd_korg1212_control_sync_get(struct snd_kcontrol *kcontrol,
|
||||||
|
Loading…
Reference in New Issue
Block a user