diff options
author | Adrian Knoth <adi@drcomp.erfurt.thur.de> | 2013-07-05 05:28:20 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-07-05 08:53:18 -0400 |
commit | 38816545a2cc6f436e5f9b26ebcb4cc2813eeb5c (patch) | |
tree | 1aab65dd9c710edfd06ec8853a97e92086a706cf /sound/pci/rme9652 | |
parent | 0dc831b9bca98a0d8dafb00fa7f20b3aef6cab67 (diff) |
ALSA: hdspm - Use snd_ctl_enum_info for most text arrays
Use snd_ctl_enum_info() to fill most of the enumerated controls. More
non-trivial occurrences will follow in separate commits.
Signed-off-by: Adrian Knoth <adi@drcomp.erfurt.thur.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/rme9652')
-rw-r--r-- | sound/pci/rme9652/hdspm.c | 50 |
1 files changed, 19 insertions, 31 deletions
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 630316c108c0..5a2eb644458e 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c | |||
@@ -590,7 +590,7 @@ static char *texts_autosync_aio_tco[] = { | |||
590 | static char *texts_autosync_aio[] = { "Word Clock", | 590 | static char *texts_autosync_aio[] = { "Word Clock", |
591 | "ADAT", "AES", "SPDIF", "Sync In" }; | 591 | "ADAT", "AES", "SPDIF", "Sync In" }; |
592 | 592 | ||
593 | static char *texts_freq[] = { | 593 | static const char *const texts_freq[] = { |
594 | "No Lock", | 594 | "No Lock", |
595 | "32 kHz", | 595 | "32 kHz", |
596 | "44.1 kHz", | 596 | "44.1 kHz", |
@@ -2286,21 +2286,8 @@ static int hdspm_get_s1_sample_rate(struct hdspm *hdspm, unsigned int idx) | |||
2286 | return (status >> (idx*4)) & 0xF; | 2286 | return (status >> (idx*4)) & 0xF; |
2287 | } | 2287 | } |
2288 | 2288 | ||
2289 | static void snd_hdspm_set_infotext(struct snd_ctl_elem_info *uinfo, | ||
2290 | char **texts, const int count) | ||
2291 | { | ||
2292 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | ||
2293 | uinfo->count = 1; | ||
2294 | uinfo->value.enumerated.items = count; | ||
2295 | if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) | ||
2296 | uinfo->value.enumerated.item = | ||
2297 | uinfo->value.enumerated.items - 1; | ||
2298 | strcpy(uinfo->value.enumerated.name, | ||
2299 | texts[uinfo->value.enumerated.item]); | ||
2300 | } | ||
2301 | |||
2302 | #define ENUMERATED_CTL_INFO(info, texts) \ | 2289 | #define ENUMERATED_CTL_INFO(info, texts) \ |
2303 | snd_hdspm_set_infotext(info, texts, ARRAY_SIZE(texts)) | 2290 | snd_ctl_enum_info(info, 1, ARRAY_SIZE(texts), texts) |
2304 | 2291 | ||
2305 | 2292 | ||
2306 | /* Helper function to query the external sample rate and return the | 2293 | /* Helper function to query the external sample rate and return the |
@@ -2477,7 +2464,7 @@ static void hdspm_set_system_clock_mode(struct hdspm *hdspm, int mode) | |||
2477 | static int snd_hdspm_info_system_clock_mode(struct snd_kcontrol *kcontrol, | 2464 | static int snd_hdspm_info_system_clock_mode(struct snd_kcontrol *kcontrol, |
2478 | struct snd_ctl_elem_info *uinfo) | 2465 | struct snd_ctl_elem_info *uinfo) |
2479 | { | 2466 | { |
2480 | static char *texts[] = { "Master", "AutoSync" }; | 2467 | static const char *const texts[] = { "Master", "AutoSync" }; |
2481 | ENUMERATED_CTL_INFO(uinfo, texts); | 2468 | ENUMERATED_CTL_INFO(uinfo, texts); |
2482 | return 0; | 2469 | return 0; |
2483 | } | 2470 | } |
@@ -3057,7 +3044,7 @@ static int snd_hdspm_get_autosync_ref(struct snd_kcontrol *kcontrol, | |||
3057 | static int snd_hdspm_info_tco_video_input_format(struct snd_kcontrol *kcontrol, | 3044 | static int snd_hdspm_info_tco_video_input_format(struct snd_kcontrol *kcontrol, |
3058 | struct snd_ctl_elem_info *uinfo) | 3045 | struct snd_ctl_elem_info *uinfo) |
3059 | { | 3046 | { |
3060 | static char *texts[] = {"No video", "NTSC", "PAL"}; | 3047 | static const char *const texts[] = {"No video", "NTSC", "PAL"}; |
3061 | ENUMERATED_CTL_INFO(uinfo, texts); | 3048 | ENUMERATED_CTL_INFO(uinfo, texts); |
3062 | return 0; | 3049 | return 0; |
3063 | } | 3050 | } |
@@ -3103,7 +3090,7 @@ static int snd_hdspm_get_tco_video_input_format(struct snd_kcontrol *kcontrol, | |||
3103 | static int snd_hdspm_info_tco_ltc_frames(struct snd_kcontrol *kcontrol, | 3090 | static int snd_hdspm_info_tco_ltc_frames(struct snd_kcontrol *kcontrol, |
3104 | struct snd_ctl_elem_info *uinfo) | 3091 | struct snd_ctl_elem_info *uinfo) |
3105 | { | 3092 | { |
3106 | static char *texts[] = {"No lock", "24 fps", "25 fps", "29.97 fps", | 3093 | static const char *const texts[] = {"No lock", "24 fps", "25 fps", "29.97 fps", |
3107 | "30 fps"}; | 3094 | "30 fps"}; |
3108 | ENUMERATED_CTL_INFO(uinfo, texts); | 3095 | ENUMERATED_CTL_INFO(uinfo, texts); |
3109 | return 0; | 3096 | return 0; |
@@ -3253,7 +3240,7 @@ static int hdspm_set_input_select(struct hdspm * hdspm, int out) | |||
3253 | static int snd_hdspm_info_input_select(struct snd_kcontrol *kcontrol, | 3240 | static int snd_hdspm_info_input_select(struct snd_kcontrol *kcontrol, |
3254 | struct snd_ctl_elem_info *uinfo) | 3241 | struct snd_ctl_elem_info *uinfo) |
3255 | { | 3242 | { |
3256 | static char *texts[] = { "optical", "coaxial" }; | 3243 | static const char *const texts[] = { "optical", "coaxial" }; |
3257 | ENUMERATED_CTL_INFO(uinfo, texts); | 3244 | ENUMERATED_CTL_INFO(uinfo, texts); |
3258 | return 0; | 3245 | return 0; |
3259 | } | 3246 | } |
@@ -3315,7 +3302,7 @@ static int hdspm_set_ds_wire(struct hdspm * hdspm, int ds) | |||
3315 | static int snd_hdspm_info_ds_wire(struct snd_kcontrol *kcontrol, | 3302 | static int snd_hdspm_info_ds_wire(struct snd_kcontrol *kcontrol, |
3316 | struct snd_ctl_elem_info *uinfo) | 3303 | struct snd_ctl_elem_info *uinfo) |
3317 | { | 3304 | { |
3318 | static char *texts[] = { "Single", "Double" }; | 3305 | static const char *const texts[] = { "Single", "Double" }; |
3319 | ENUMERATED_CTL_INFO(uinfo, texts); | 3306 | ENUMERATED_CTL_INFO(uinfo, texts); |
3320 | return 0; | 3307 | return 0; |
3321 | } | 3308 | } |
@@ -3388,7 +3375,7 @@ static int hdspm_set_qs_wire(struct hdspm * hdspm, int mode) | |||
3388 | static int snd_hdspm_info_qs_wire(struct snd_kcontrol *kcontrol, | 3375 | static int snd_hdspm_info_qs_wire(struct snd_kcontrol *kcontrol, |
3389 | struct snd_ctl_elem_info *uinfo) | 3376 | struct snd_ctl_elem_info *uinfo) |
3390 | { | 3377 | { |
3391 | static char *texts[] = { "Single", "Double", "Quad" }; | 3378 | static const char *const texts[] = { "Single", "Double", "Quad" }; |
3392 | ENUMERATED_CTL_INFO(uinfo, texts); | 3379 | ENUMERATED_CTL_INFO(uinfo, texts); |
3393 | return 0; | 3380 | return 0; |
3394 | } | 3381 | } |
@@ -3454,8 +3441,8 @@ static int snd_hdspm_info_tristate(struct snd_kcontrol *kcontrol, | |||
3454 | { | 3441 | { |
3455 | u32 regmask = kcontrol->private_value; | 3442 | u32 regmask = kcontrol->private_value; |
3456 | 3443 | ||
3457 | static char *texts_spdif[] = { "Optical", "Coaxial", "Internal" }; | 3444 | static const char *const texts_spdif[] = { "Optical", "Coaxial", "Internal" }; |
3458 | static char *texts_levels[] = { "Hi Gain", "+4 dBu", "-10 dBV" }; | 3445 | static const char *const texts_levels[] = { "Hi Gain", "+4 dBu", "-10 dBV" }; |
3459 | 3446 | ||
3460 | switch (regmask) { | 3447 | switch (regmask) { |
3461 | case HDSPM_c0_Input0: | 3448 | case HDSPM_c0_Input0: |
@@ -3542,7 +3529,7 @@ static int hdspm_set_madi_speedmode(struct hdspm *hdspm, int mode) | |||
3542 | static int snd_hdspm_info_madi_speedmode(struct snd_kcontrol *kcontrol, | 3529 | static int snd_hdspm_info_madi_speedmode(struct snd_kcontrol *kcontrol, |
3543 | struct snd_ctl_elem_info *uinfo) | 3530 | struct snd_ctl_elem_info *uinfo) |
3544 | { | 3531 | { |
3545 | static char *texts[] = { "Single", "Double", "Quad" }; | 3532 | static const char *const texts[] = { "Single", "Double", "Quad" }; |
3546 | ENUMERATED_CTL_INFO(uinfo, texts); | 3533 | ENUMERATED_CTL_INFO(uinfo, texts); |
3547 | return 0; | 3534 | return 0; |
3548 | } | 3535 | } |
@@ -3777,7 +3764,7 @@ static int snd_hdspm_put_playback_mixer(struct snd_kcontrol *kcontrol, | |||
3777 | static int snd_hdspm_info_sync_check(struct snd_kcontrol *kcontrol, | 3764 | static int snd_hdspm_info_sync_check(struct snd_kcontrol *kcontrol, |
3778 | struct snd_ctl_elem_info *uinfo) | 3765 | struct snd_ctl_elem_info *uinfo) |
3779 | { | 3766 | { |
3780 | static char *texts[] = { "No Lock", "Lock", "Sync", "N/A" }; | 3767 | static const char *const texts[] = { "No Lock", "Lock", "Sync", "N/A" }; |
3781 | ENUMERATED_CTL_INFO(uinfo, texts); | 3768 | ENUMERATED_CTL_INFO(uinfo, texts); |
3782 | return 0; | 3769 | return 0; |
3783 | } | 3770 | } |
@@ -3785,7 +3772,7 @@ static int snd_hdspm_info_sync_check(struct snd_kcontrol *kcontrol, | |||
3785 | static int snd_hdspm_tco_info_lock_check(struct snd_kcontrol *kcontrol, | 3772 | static int snd_hdspm_tco_info_lock_check(struct snd_kcontrol *kcontrol, |
3786 | struct snd_ctl_elem_info *uinfo) | 3773 | struct snd_ctl_elem_info *uinfo) |
3787 | { | 3774 | { |
3788 | static char *texts[] = { "No Lock", "Lock" }; | 3775 | static const char *const texts[] = { "No Lock", "Lock" }; |
3789 | ENUMERATED_CTL_INFO(uinfo, texts); | 3776 | ENUMERATED_CTL_INFO(uinfo, texts); |
3790 | return 0; | 3777 | return 0; |
3791 | } | 3778 | } |
@@ -4175,7 +4162,7 @@ static void hdspm_tco_write(struct hdspm *hdspm) | |||
4175 | static int snd_hdspm_info_tco_sample_rate(struct snd_kcontrol *kcontrol, | 4162 | static int snd_hdspm_info_tco_sample_rate(struct snd_kcontrol *kcontrol, |
4176 | struct snd_ctl_elem_info *uinfo) | 4163 | struct snd_ctl_elem_info *uinfo) |
4177 | { | 4164 | { |
4178 | static char *texts[] = { "44.1 kHz", "48 kHz" }; | 4165 | static const char *const texts[] = { "44.1 kHz", "48 kHz" }; |
4179 | ENUMERATED_CTL_INFO(uinfo, texts); | 4166 | ENUMERATED_CTL_INFO(uinfo, texts); |
4180 | return 0; | 4167 | return 0; |
4181 | } | 4168 | } |
@@ -4221,7 +4208,8 @@ static int snd_hdspm_put_tco_sample_rate(struct snd_kcontrol *kcontrol, | |||
4221 | static int snd_hdspm_info_tco_pull(struct snd_kcontrol *kcontrol, | 4208 | static int snd_hdspm_info_tco_pull(struct snd_kcontrol *kcontrol, |
4222 | struct snd_ctl_elem_info *uinfo) | 4209 | struct snd_ctl_elem_info *uinfo) |
4223 | { | 4210 | { |
4224 | static char *texts[] = { "0", "+ 0.1 %", "- 0.1 %", "+ 4 %", "- 4 %" }; | 4211 | static const char *const texts[] = { "0", "+ 0.1 %", "- 0.1 %", |
4212 | "+ 4 %", "- 4 %" }; | ||
4225 | ENUMERATED_CTL_INFO(uinfo, texts); | 4213 | ENUMERATED_CTL_INFO(uinfo, texts); |
4226 | return 0; | 4214 | return 0; |
4227 | } | 4215 | } |
@@ -4266,7 +4254,7 @@ static int snd_hdspm_put_tco_pull(struct snd_kcontrol *kcontrol, | |||
4266 | static int snd_hdspm_info_tco_wck_conversion(struct snd_kcontrol *kcontrol, | 4254 | static int snd_hdspm_info_tco_wck_conversion(struct snd_kcontrol *kcontrol, |
4267 | struct snd_ctl_elem_info *uinfo) | 4255 | struct snd_ctl_elem_info *uinfo) |
4268 | { | 4256 | { |
4269 | static char *texts[] = { "1:1", "44.1 -> 48", "48 -> 44.1" }; | 4257 | static const char *const texts[] = { "1:1", "44.1 -> 48", "48 -> 44.1" }; |
4270 | ENUMERATED_CTL_INFO(uinfo, texts); | 4258 | ENUMERATED_CTL_INFO(uinfo, texts); |
4271 | return 0; | 4259 | return 0; |
4272 | } | 4260 | } |
@@ -4312,7 +4300,7 @@ static int snd_hdspm_put_tco_wck_conversion(struct snd_kcontrol *kcontrol, | |||
4312 | static int snd_hdspm_info_tco_frame_rate(struct snd_kcontrol *kcontrol, | 4300 | static int snd_hdspm_info_tco_frame_rate(struct snd_kcontrol *kcontrol, |
4313 | struct snd_ctl_elem_info *uinfo) | 4301 | struct snd_ctl_elem_info *uinfo) |
4314 | { | 4302 | { |
4315 | static char *texts[] = { "24 fps", "25 fps", "29.97fps", | 4303 | static const char *const texts[] = { "24 fps", "25 fps", "29.97fps", |
4316 | "29.97 dfps", "30 fps", "30 dfps" }; | 4304 | "29.97 dfps", "30 fps", "30 dfps" }; |
4317 | ENUMERATED_CTL_INFO(uinfo, texts); | 4305 | ENUMERATED_CTL_INFO(uinfo, texts); |
4318 | return 0; | 4306 | return 0; |
@@ -4359,7 +4347,7 @@ static int snd_hdspm_put_tco_frame_rate(struct snd_kcontrol *kcontrol, | |||
4359 | static int snd_hdspm_info_tco_sync_source(struct snd_kcontrol *kcontrol, | 4347 | static int snd_hdspm_info_tco_sync_source(struct snd_kcontrol *kcontrol, |
4360 | struct snd_ctl_elem_info *uinfo) | 4348 | struct snd_ctl_elem_info *uinfo) |
4361 | { | 4349 | { |
4362 | static char *texts[] = { "LTC", "Video", "WCK" }; | 4350 | static const char *const texts[] = { "LTC", "Video", "WCK" }; |
4363 | ENUMERATED_CTL_INFO(uinfo, texts); | 4351 | ENUMERATED_CTL_INFO(uinfo, texts); |
4364 | return 0; | 4352 | return 0; |
4365 | } | 4353 | } |