aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbmixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/usb/usbmixer.c')
-rw-r--r--sound/usb/usbmixer.c183
1 files changed, 89 insertions, 94 deletions
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index e570d140258d..678dac2d4dba 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -46,18 +46,13 @@
46/* ignore error from controls - for debugging */ 46/* ignore error from controls - for debugging */
47/* #define IGNORE_CTL_ERROR */ 47/* #define IGNORE_CTL_ERROR */
48 48
49typedef struct usb_mixer_build mixer_build_t;
50typedef struct usb_audio_term usb_audio_term_t;
51typedef struct usb_mixer_elem_info usb_mixer_elem_info_t;
52
53
54struct usb_mixer_interface { 49struct usb_mixer_interface {
55 snd_usb_audio_t *chip; 50 struct snd_usb_audio *chip;
56 unsigned int ctrlif; 51 unsigned int ctrlif;
57 struct list_head list; 52 struct list_head list;
58 unsigned int ignore_ctl_error; 53 unsigned int ignore_ctl_error;
59 struct urb *urb; 54 struct urb *urb;
60 usb_mixer_elem_info_t **id_elems; /* array[256], indexed by unit id */ 55 struct usb_mixer_elem_info **id_elems; /* array[256], indexed by unit id */
61 56
62 /* Sound Blaster remote control stuff */ 57 /* Sound Blaster remote control stuff */
63 enum { 58 enum {
@@ -86,21 +81,21 @@ struct usb_audio_term {
86 81
87struct usbmix_name_map; 82struct usbmix_name_map;
88 83
89struct usb_mixer_build { 84struct mixer_build {
90 snd_usb_audio_t *chip; 85 struct snd_usb_audio *chip;
91 struct usb_mixer_interface *mixer; 86 struct usb_mixer_interface *mixer;
92 unsigned char *buffer; 87 unsigned char *buffer;
93 unsigned int buflen; 88 unsigned int buflen;
94 DECLARE_BITMAP(unitbitmap, 256); 89 DECLARE_BITMAP(unitbitmap, 256);
95 usb_audio_term_t oterm; 90 struct usb_audio_term oterm;
96 const struct usbmix_name_map *map; 91 const struct usbmix_name_map *map;
97 const struct usbmix_selector_map *selector_map; 92 const struct usbmix_selector_map *selector_map;
98}; 93};
99 94
100struct usb_mixer_elem_info { 95struct usb_mixer_elem_info {
101 struct usb_mixer_interface *mixer; 96 struct usb_mixer_interface *mixer;
102 usb_mixer_elem_info_t *next_id_elem; /* list of controls with same id */ 97 struct usb_mixer_elem_info *next_id_elem; /* list of controls with same id */
103 snd_ctl_elem_id_t *elem_id; 98 struct snd_ctl_elem_id *elem_id;
104 unsigned int id; 99 unsigned int id;
105 unsigned int control; /* CS or ICN (high byte) */ 100 unsigned int control; /* CS or ICN (high byte) */
106 unsigned int cmask; /* channel mask bitmap: 0 = master */ 101 unsigned int cmask; /* channel mask bitmap: 0 = master */
@@ -179,7 +174,7 @@ enum {
179#include "usbmixer_maps.c" 174#include "usbmixer_maps.c"
180 175
181/* get the mapped name if the unit matches */ 176/* get the mapped name if the unit matches */
182static int check_mapped_name(mixer_build_t *state, int unitid, int control, char *buf, int buflen) 177static int check_mapped_name(struct mixer_build *state, int unitid, int control, char *buf, int buflen)
183{ 178{
184 const struct usbmix_name_map *p; 179 const struct usbmix_name_map *p;
185 180
@@ -197,7 +192,7 @@ static int check_mapped_name(mixer_build_t *state, int unitid, int control, char
197} 192}
198 193
199/* check whether the control should be ignored */ 194/* check whether the control should be ignored */
200static int check_ignored_ctl(mixer_build_t *state, int unitid, int control) 195static int check_ignored_ctl(struct mixer_build *state, int unitid, int control)
201{ 196{
202 const struct usbmix_name_map *p; 197 const struct usbmix_name_map *p;
203 198
@@ -214,7 +209,7 @@ static int check_ignored_ctl(mixer_build_t *state, int unitid, int control)
214} 209}
215 210
216/* get the mapped selector source name */ 211/* get the mapped selector source name */
217static int check_mapped_selector_name(mixer_build_t *state, int unitid, 212static int check_mapped_selector_name(struct mixer_build *state, int unitid,
218 int index, char *buf, int buflen) 213 int index, char *buf, int buflen)
219{ 214{
220 const struct usbmix_selector_map *p; 215 const struct usbmix_selector_map *p;
@@ -231,7 +226,7 @@ static int check_mapped_selector_name(mixer_build_t *state, int unitid,
231/* 226/*
232 * find an audio control unit with the given unit id 227 * find an audio control unit with the given unit id
233 */ 228 */
234static void *find_audio_control_unit(mixer_build_t *state, unsigned char unit) 229static void *find_audio_control_unit(struct mixer_build *state, unsigned char unit)
235{ 230{
236 unsigned char *p; 231 unsigned char *p;
237 232
@@ -248,7 +243,7 @@ static void *find_audio_control_unit(mixer_build_t *state, unsigned char unit)
248/* 243/*
249 * copy a string with the given id 244 * copy a string with the given id
250 */ 245 */
251static int snd_usb_copy_string_desc(mixer_build_t *state, int index, char *buf, int maxlen) 246static int snd_usb_copy_string_desc(struct mixer_build *state, int index, char *buf, int maxlen)
252{ 247{
253 int len = usb_string(state->chip->dev, index, buf, maxlen - 1); 248 int len = usb_string(state->chip->dev, index, buf, maxlen - 1);
254 buf[len] = 0; 249 buf[len] = 0;
@@ -258,7 +253,7 @@ static int snd_usb_copy_string_desc(mixer_build_t *state, int index, char *buf,
258/* 253/*
259 * convert from the byte/word on usb descriptor to the zero-based integer 254 * convert from the byte/word on usb descriptor to the zero-based integer
260 */ 255 */
261static int convert_signed_value(usb_mixer_elem_info_t *cval, int val) 256static int convert_signed_value(struct usb_mixer_elem_info *cval, int val)
262{ 257{
263 switch (cval->val_type) { 258 switch (cval->val_type) {
264 case USB_MIXER_BOOLEAN: 259 case USB_MIXER_BOOLEAN:
@@ -288,7 +283,7 @@ static int convert_signed_value(usb_mixer_elem_info_t *cval, int val)
288/* 283/*
289 * convert from the zero-based int to the byte/word for usb descriptor 284 * convert from the zero-based int to the byte/word for usb descriptor
290 */ 285 */
291static int convert_bytes_value(usb_mixer_elem_info_t *cval, int val) 286static int convert_bytes_value(struct usb_mixer_elem_info *cval, int val)
292{ 287{
293 switch (cval->val_type) { 288 switch (cval->val_type) {
294 case USB_MIXER_BOOLEAN: 289 case USB_MIXER_BOOLEAN:
@@ -305,7 +300,7 @@ static int convert_bytes_value(usb_mixer_elem_info_t *cval, int val)
305 return 0; /* not reached */ 300 return 0; /* not reached */
306} 301}
307 302
308static int get_relative_value(usb_mixer_elem_info_t *cval, int val) 303static int get_relative_value(struct usb_mixer_elem_info *cval, int val)
309{ 304{
310 if (! cval->res) 305 if (! cval->res)
311 cval->res = 1; 306 cval->res = 1;
@@ -317,7 +312,7 @@ static int get_relative_value(usb_mixer_elem_info_t *cval, int val)
317 return (val - cval->min) / cval->res; 312 return (val - cval->min) / cval->res;
318} 313}
319 314
320static int get_abs_value(usb_mixer_elem_info_t *cval, int val) 315static int get_abs_value(struct usb_mixer_elem_info *cval, int val)
321{ 316{
322 if (val < 0) 317 if (val < 0)
323 return cval->min; 318 return cval->min;
@@ -335,7 +330,7 @@ static int get_abs_value(usb_mixer_elem_info_t *cval, int val)
335 * retrieve a mixer value 330 * retrieve a mixer value
336 */ 331 */
337 332
338static int get_ctl_value(usb_mixer_elem_info_t *cval, int request, int validx, int *value_ret) 333static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)
339{ 334{
340 unsigned char buf[2]; 335 unsigned char buf[2];
341 int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; 336 int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
@@ -357,13 +352,13 @@ static int get_ctl_value(usb_mixer_elem_info_t *cval, int request, int validx, i
357 return -EINVAL; 352 return -EINVAL;
358} 353}
359 354
360static int get_cur_ctl_value(usb_mixer_elem_info_t *cval, int validx, int *value) 355static int get_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int *value)
361{ 356{
362 return get_ctl_value(cval, GET_CUR, validx, value); 357 return get_ctl_value(cval, GET_CUR, validx, value);
363} 358}
364 359
365/* channel = 0: master, 1 = first channel */ 360/* channel = 0: master, 1 = first channel */
366static inline int get_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, int *value) 361static inline int get_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, int *value)
367{ 362{
368 return get_ctl_value(cval, GET_CUR, (cval->control << 8) | channel, value); 363 return get_ctl_value(cval, GET_CUR, (cval->control << 8) | channel, value);
369} 364}
@@ -372,7 +367,7 @@ static inline int get_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, in
372 * set a mixer value 367 * set a mixer value
373 */ 368 */
374 369
375static int set_ctl_value(usb_mixer_elem_info_t *cval, int request, int validx, int value_set) 370static int set_ctl_value(struct usb_mixer_elem_info *cval, int request, int validx, int value_set)
376{ 371{
377 unsigned char buf[2]; 372 unsigned char buf[2];
378 int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; 373 int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
@@ -394,12 +389,12 @@ static int set_ctl_value(usb_mixer_elem_info_t *cval, int request, int validx, i
394 return -EINVAL; 389 return -EINVAL;
395} 390}
396 391
397static int set_cur_ctl_value(usb_mixer_elem_info_t *cval, int validx, int value) 392static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value)
398{ 393{
399 return set_ctl_value(cval, SET_CUR, validx, value); 394 return set_ctl_value(cval, SET_CUR, validx, value);
400} 395}
401 396
402static inline int set_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, int value) 397static inline int set_cur_mix_value(struct usb_mixer_elem_info *cval, int channel, int value)
403{ 398{
404 return set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, value); 399 return set_ctl_value(cval, SET_CUR, (cval->control << 8) | channel, value);
405} 400}
@@ -409,7 +404,7 @@ static inline int set_cur_mix_value(usb_mixer_elem_info_t *cval, int channel, in
409 * parser routines begin here... 404 * parser routines begin here...
410 */ 405 */
411 406
412static int parse_audio_unit(mixer_build_t *state, int unitid); 407static int parse_audio_unit(struct mixer_build *state, int unitid);
413 408
414 409
415/* 410/*
@@ -430,9 +425,9 @@ static int check_matrix_bitmap(unsigned char *bmap, int ich, int och, int num_ou
430 * if failed, give up and free the control instance. 425 * if failed, give up and free the control instance.
431 */ 426 */
432 427
433static int add_control_to_empty(mixer_build_t *state, snd_kcontrol_t *kctl) 428static int add_control_to_empty(struct mixer_build *state, struct snd_kcontrol *kctl)
434{ 429{
435 usb_mixer_elem_info_t *cval = kctl->private_data; 430 struct usb_mixer_elem_info *cval = kctl->private_data;
436 int err; 431 int err;
437 432
438 while (snd_ctl_find_id(state->chip->card, &kctl->id)) 433 while (snd_ctl_find_id(state->chip->card, &kctl->id))
@@ -496,7 +491,7 @@ static struct iterm_name_combo {
496 { 0 }, 491 { 0 },
497}; 492};
498 493
499static int get_term_name(mixer_build_t *state, usb_audio_term_t *iterm, 494static int get_term_name(struct mixer_build *state, struct usb_audio_term *iterm,
500 unsigned char *name, int maxlen, int term_only) 495 unsigned char *name, int maxlen, int term_only)
501{ 496{
502 struct iterm_name_combo *names; 497 struct iterm_name_combo *names;
@@ -546,7 +541,7 @@ static int get_term_name(mixer_build_t *state, usb_audio_term_t *iterm,
546 * parse the source unit recursively until it reaches to a terminal 541 * parse the source unit recursively until it reaches to a terminal
547 * or a branched unit. 542 * or a branched unit.
548 */ 543 */
549static int check_input_term(mixer_build_t *state, int id, usb_audio_term_t *term) 544static int check_input_term(struct mixer_build *state, int id, struct usb_audio_term *term)
550{ 545{
551 unsigned char *p1; 546 unsigned char *p1;
552 547
@@ -621,7 +616,7 @@ static struct usb_feature_control_info audio_feature_info[] = {
621 616
622 617
623/* private_free callback */ 618/* private_free callback */
624static void usb_mixer_elem_free(snd_kcontrol_t *kctl) 619static void usb_mixer_elem_free(struct snd_kcontrol *kctl)
625{ 620{
626 kfree(kctl->private_data); 621 kfree(kctl->private_data);
627 kctl->private_data = NULL; 622 kctl->private_data = NULL;
@@ -635,7 +630,7 @@ static void usb_mixer_elem_free(snd_kcontrol_t *kctl)
635/* 630/*
636 * retrieve the minimum and maximum values for the specified control 631 * retrieve the minimum and maximum values for the specified control
637 */ 632 */
638static int get_min_max(usb_mixer_elem_info_t *cval, int default_min) 633static int get_min_max(struct usb_mixer_elem_info *cval, int default_min)
639{ 634{
640 /* for failsafe */ 635 /* for failsafe */
641 cval->min = default_min; 636 cval->min = default_min;
@@ -683,9 +678,9 @@ static int get_min_max(usb_mixer_elem_info_t *cval, int default_min)
683 678
684 679
685/* get a feature/mixer unit info */ 680/* get a feature/mixer unit info */
686static int mixer_ctl_feature_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 681static int mixer_ctl_feature_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
687{ 682{
688 usb_mixer_elem_info_t *cval = kcontrol->private_data; 683 struct usb_mixer_elem_info *cval = kcontrol->private_data;
689 684
690 if (cval->val_type == USB_MIXER_BOOLEAN || 685 if (cval->val_type == USB_MIXER_BOOLEAN ||
691 cval->val_type == USB_MIXER_INV_BOOLEAN) 686 cval->val_type == USB_MIXER_INV_BOOLEAN)
@@ -707,9 +702,9 @@ static int mixer_ctl_feature_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
707} 702}
708 703
709/* get the current value from feature/mixer unit */ 704/* get the current value from feature/mixer unit */
710static int mixer_ctl_feature_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 705static int mixer_ctl_feature_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
711{ 706{
712 usb_mixer_elem_info_t *cval = kcontrol->private_data; 707 struct usb_mixer_elem_info *cval = kcontrol->private_data;
713 int c, cnt, val, err; 708 int c, cnt, val, err;
714 709
715 if (cval->cmask) { 710 if (cval->cmask) {
@@ -748,9 +743,9 @@ static int mixer_ctl_feature_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
748} 743}
749 744
750/* put the current value to feature/mixer unit */ 745/* put the current value to feature/mixer unit */
751static int mixer_ctl_feature_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 746static int mixer_ctl_feature_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
752{ 747{
753 usb_mixer_elem_info_t *cval = kcontrol->private_data; 748 struct usb_mixer_elem_info *cval = kcontrol->private_data;
754 int c, cnt, val, oval, err; 749 int c, cnt, val, oval, err;
755 int changed = 0; 750 int changed = 0;
756 751
@@ -791,7 +786,7 @@ static int mixer_ctl_feature_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
791 return changed; 786 return changed;
792} 787}
793 788
794static snd_kcontrol_new_t usb_feature_unit_ctl = { 789static struct snd_kcontrol_new usb_feature_unit_ctl = {
795 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 790 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
796 .name = "", /* will be filled later manually */ 791 .name = "", /* will be filled later manually */
797 .info = mixer_ctl_feature_info, 792 .info = mixer_ctl_feature_info,
@@ -804,15 +799,15 @@ static snd_kcontrol_new_t usb_feature_unit_ctl = {
804 * build a feature control 799 * build a feature control
805 */ 800 */
806 801
807static void build_feature_ctl(mixer_build_t *state, unsigned char *desc, 802static void build_feature_ctl(struct mixer_build *state, unsigned char *desc,
808 unsigned int ctl_mask, int control, 803 unsigned int ctl_mask, int control,
809 usb_audio_term_t *iterm, int unitid) 804 struct usb_audio_term *iterm, int unitid)
810{ 805{
811 unsigned int len = 0; 806 unsigned int len = 0;
812 int mapped_name = 0; 807 int mapped_name = 0;
813 int nameid = desc[desc[0] - 1]; 808 int nameid = desc[desc[0] - 1];
814 snd_kcontrol_t *kctl; 809 struct snd_kcontrol *kctl;
815 usb_mixer_elem_info_t *cval; 810 struct usb_mixer_elem_info *cval;
816 811
817 control++; /* change from zero-based to 1-based value */ 812 control++; /* change from zero-based to 1-based value */
818 813
@@ -928,10 +923,10 @@ static void build_feature_ctl(mixer_build_t *state, unsigned char *desc,
928 * 923 *
929 * most of controlls are defined here. 924 * most of controlls are defined here.
930 */ 925 */
931static int parse_audio_feature_unit(mixer_build_t *state, int unitid, unsigned char *ftr) 926static int parse_audio_feature_unit(struct mixer_build *state, int unitid, unsigned char *ftr)
932{ 927{
933 int channels, i, j; 928 int channels, i, j;
934 usb_audio_term_t iterm; 929 struct usb_audio_term iterm;
935 unsigned int master_bits, first_ch_bits; 930 unsigned int master_bits, first_ch_bits;
936 int err, csize; 931 int err, csize;
937 932
@@ -984,15 +979,15 @@ static int parse_audio_feature_unit(mixer_build_t *state, int unitid, unsigned c
984 * input channel number (zero based) is given in control field instead. 979 * input channel number (zero based) is given in control field instead.
985 */ 980 */
986 981
987static void build_mixer_unit_ctl(mixer_build_t *state, unsigned char *desc, 982static void build_mixer_unit_ctl(struct mixer_build *state, unsigned char *desc,
988 int in_pin, int in_ch, int unitid, 983 int in_pin, int in_ch, int unitid,
989 usb_audio_term_t *iterm) 984 struct usb_audio_term *iterm)
990{ 985{
991 usb_mixer_elem_info_t *cval; 986 struct usb_mixer_elem_info *cval;
992 unsigned int input_pins = desc[4]; 987 unsigned int input_pins = desc[4];
993 unsigned int num_outs = desc[5 + input_pins]; 988 unsigned int num_outs = desc[5 + input_pins];
994 unsigned int i, len; 989 unsigned int i, len;
995 snd_kcontrol_t *kctl; 990 struct snd_kcontrol *kctl;
996 991
997 if (check_ignored_ctl(state, unitid, 0)) 992 if (check_ignored_ctl(state, unitid, 0))
998 return; 993 return;
@@ -1039,9 +1034,9 @@ static void build_mixer_unit_ctl(mixer_build_t *state, unsigned char *desc,
1039/* 1034/*
1040 * parse a mixer unit 1035 * parse a mixer unit
1041 */ 1036 */
1042static int parse_audio_mixer_unit(mixer_build_t *state, int unitid, unsigned char *desc) 1037static int parse_audio_mixer_unit(struct mixer_build *state, int unitid, unsigned char *desc)
1043{ 1038{
1044 usb_audio_term_t iterm; 1039 struct usb_audio_term iterm;
1045 int input_pins, num_ins, num_outs; 1040 int input_pins, num_ins, num_outs;
1046 int pin, ich, err; 1041 int pin, ich, err;
1047 1042
@@ -1089,9 +1084,9 @@ static int parse_audio_mixer_unit(mixer_build_t *state, int unitid, unsigned cha
1089 */ 1084 */
1090 1085
1091/* get callback for processing/extension unit */ 1086/* get callback for processing/extension unit */
1092static int mixer_ctl_procunit_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1087static int mixer_ctl_procunit_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1093{ 1088{
1094 usb_mixer_elem_info_t *cval = kcontrol->private_data; 1089 struct usb_mixer_elem_info *cval = kcontrol->private_data;
1095 int err, val; 1090 int err, val;
1096 1091
1097 err = get_cur_ctl_value(cval, cval->control << 8, &val); 1092 err = get_cur_ctl_value(cval, cval->control << 8, &val);
@@ -1107,9 +1102,9 @@ static int mixer_ctl_procunit_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
1107} 1102}
1108 1103
1109/* put callback for processing/extension unit */ 1104/* put callback for processing/extension unit */
1110static int mixer_ctl_procunit_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1105static int mixer_ctl_procunit_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1111{ 1106{
1112 usb_mixer_elem_info_t *cval = kcontrol->private_data; 1107 struct usb_mixer_elem_info *cval = kcontrol->private_data;
1113 int val, oval, err; 1108 int val, oval, err;
1114 1109
1115 err = get_cur_ctl_value(cval, cval->control << 8, &oval); 1110 err = get_cur_ctl_value(cval, cval->control << 8, &oval);
@@ -1128,7 +1123,7 @@ static int mixer_ctl_procunit_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
1128} 1123}
1129 1124
1130/* alsa control interface for processing/extension unit */ 1125/* alsa control interface for processing/extension unit */
1131static snd_kcontrol_new_t mixer_procunit_ctl = { 1126static struct snd_kcontrol_new mixer_procunit_ctl = {
1132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1127 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1133 .name = "", /* will be filled later */ 1128 .name = "", /* will be filled later */
1134 .info = mixer_ctl_feature_info, 1129 .info = mixer_ctl_feature_info,
@@ -1205,11 +1200,11 @@ static struct procunit_info procunits[] = {
1205/* 1200/*
1206 * build a processing/extension unit 1201 * build a processing/extension unit
1207 */ 1202 */
1208static int build_audio_procunit(mixer_build_t *state, int unitid, unsigned char *dsc, struct procunit_info *list, char *name) 1203static int build_audio_procunit(struct mixer_build *state, int unitid, unsigned char *dsc, struct procunit_info *list, char *name)
1209{ 1204{
1210 int num_ins = dsc[6]; 1205 int num_ins = dsc[6];
1211 usb_mixer_elem_info_t *cval; 1206 struct usb_mixer_elem_info *cval;
1212 snd_kcontrol_t *kctl; 1207 struct snd_kcontrol *kctl;
1213 int i, err, nameid, type, len; 1208 int i, err, nameid, type, len;
1214 struct procunit_info *info; 1209 struct procunit_info *info;
1215 struct procunit_value_info *valinfo; 1210 struct procunit_value_info *valinfo;
@@ -1297,12 +1292,12 @@ static int build_audio_procunit(mixer_build_t *state, int unitid, unsigned char
1297} 1292}
1298 1293
1299 1294
1300static int parse_audio_processing_unit(mixer_build_t *state, int unitid, unsigned char *desc) 1295static int parse_audio_processing_unit(struct mixer_build *state, int unitid, unsigned char *desc)
1301{ 1296{
1302 return build_audio_procunit(state, unitid, desc, procunits, "Processing Unit"); 1297 return build_audio_procunit(state, unitid, desc, procunits, "Processing Unit");
1303} 1298}
1304 1299
1305static int parse_audio_extension_unit(mixer_build_t *state, int unitid, unsigned char *desc) 1300static int parse_audio_extension_unit(struct mixer_build *state, int unitid, unsigned char *desc)
1306{ 1301{
1307 return build_audio_procunit(state, unitid, desc, NULL, "Extension Unit"); 1302 return build_audio_procunit(state, unitid, desc, NULL, "Extension Unit");
1308} 1303}
@@ -1315,9 +1310,9 @@ static int parse_audio_extension_unit(mixer_build_t *state, int unitid, unsigned
1315/* info callback for selector unit 1310/* info callback for selector unit
1316 * use an enumerator type for routing 1311 * use an enumerator type for routing
1317 */ 1312 */
1318static int mixer_ctl_selector_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 1313static int mixer_ctl_selector_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
1319{ 1314{
1320 usb_mixer_elem_info_t *cval = kcontrol->private_data; 1315 struct usb_mixer_elem_info *cval = kcontrol->private_data;
1321 char **itemlist = (char **)kcontrol->private_value; 1316 char **itemlist = (char **)kcontrol->private_value;
1322 1317
1323 snd_assert(itemlist, return -EINVAL); 1318 snd_assert(itemlist, return -EINVAL);
@@ -1331,9 +1326,9 @@ static int mixer_ctl_selector_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
1331} 1326}
1332 1327
1333/* get callback for selector unit */ 1328/* get callback for selector unit */
1334static int mixer_ctl_selector_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1329static int mixer_ctl_selector_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1335{ 1330{
1336 usb_mixer_elem_info_t *cval = kcontrol->private_data; 1331 struct usb_mixer_elem_info *cval = kcontrol->private_data;
1337 int val, err; 1332 int val, err;
1338 1333
1339 err = get_cur_ctl_value(cval, 0, &val); 1334 err = get_cur_ctl_value(cval, 0, &val);
@@ -1350,9 +1345,9 @@ static int mixer_ctl_selector_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
1350} 1345}
1351 1346
1352/* put callback for selector unit */ 1347/* put callback for selector unit */
1353static int mixer_ctl_selector_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1348static int mixer_ctl_selector_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1354{ 1349{
1355 usb_mixer_elem_info_t *cval = kcontrol->private_data; 1350 struct usb_mixer_elem_info *cval = kcontrol->private_data;
1356 int val, oval, err; 1351 int val, oval, err;
1357 1352
1358 err = get_cur_ctl_value(cval, 0, &oval); 1353 err = get_cur_ctl_value(cval, 0, &oval);
@@ -1371,7 +1366,7 @@ static int mixer_ctl_selector_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
1371} 1366}
1372 1367
1373/* alsa control interface for selector unit */ 1368/* alsa control interface for selector unit */
1374static snd_kcontrol_new_t mixer_selectunit_ctl = { 1369static struct snd_kcontrol_new mixer_selectunit_ctl = {
1375 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1370 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1376 .name = "", /* will be filled later */ 1371 .name = "", /* will be filled later */
1377 .info = mixer_ctl_selector_info, 1372 .info = mixer_ctl_selector_info,
@@ -1383,12 +1378,12 @@ static snd_kcontrol_new_t mixer_selectunit_ctl = {
1383/* private free callback. 1378/* private free callback.
1384 * free both private_data and private_value 1379 * free both private_data and private_value
1385 */ 1380 */
1386static void usb_mixer_selector_elem_free(snd_kcontrol_t *kctl) 1381static void usb_mixer_selector_elem_free(struct snd_kcontrol *kctl)
1387{ 1382{
1388 int i, num_ins = 0; 1383 int i, num_ins = 0;
1389 1384
1390 if (kctl->private_data) { 1385 if (kctl->private_data) {
1391 usb_mixer_elem_info_t *cval = kctl->private_data; 1386 struct usb_mixer_elem_info *cval = kctl->private_data;
1392 num_ins = cval->max; 1387 num_ins = cval->max;
1393 kfree(cval); 1388 kfree(cval);
1394 kctl->private_data = NULL; 1389 kctl->private_data = NULL;
@@ -1405,13 +1400,13 @@ static void usb_mixer_selector_elem_free(snd_kcontrol_t *kctl)
1405/* 1400/*
1406 * parse a selector unit 1401 * parse a selector unit
1407 */ 1402 */
1408static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned char *desc) 1403static int parse_audio_selector_unit(struct mixer_build *state, int unitid, unsigned char *desc)
1409{ 1404{
1410 unsigned int num_ins = desc[4]; 1405 unsigned int num_ins = desc[4];
1411 unsigned int i, nameid, len; 1406 unsigned int i, nameid, len;
1412 int err; 1407 int err;
1413 usb_mixer_elem_info_t *cval; 1408 struct usb_mixer_elem_info *cval;
1414 snd_kcontrol_t *kctl; 1409 struct snd_kcontrol *kctl;
1415 char **namelist; 1410 char **namelist;
1416 1411
1417 if (! num_ins || desc[0] < 6 + num_ins) { 1412 if (! num_ins || desc[0] < 6 + num_ins) {
@@ -1452,7 +1447,7 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned
1452 } 1447 }
1453#define MAX_ITEM_NAME_LEN 64 1448#define MAX_ITEM_NAME_LEN 64
1454 for (i = 0; i < num_ins; i++) { 1449 for (i = 0; i < num_ins; i++) {
1455 usb_audio_term_t iterm; 1450 struct usb_audio_term iterm;
1456 len = 0; 1451 len = 0;
1457 namelist[i] = kmalloc(MAX_ITEM_NAME_LEN, GFP_KERNEL); 1452 namelist[i] = kmalloc(MAX_ITEM_NAME_LEN, GFP_KERNEL);
1458 if (! namelist[i]) { 1453 if (! namelist[i]) {
@@ -1511,7 +1506,7 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned
1511 * parse an audio unit recursively 1506 * parse an audio unit recursively
1512 */ 1507 */
1513 1508
1514static int parse_audio_unit(mixer_build_t *state, int unitid) 1509static int parse_audio_unit(struct mixer_build *state, int unitid)
1515{ 1510{
1516 unsigned char *p1; 1511 unsigned char *p1;
1517 1512
@@ -1556,7 +1551,7 @@ static void snd_usb_mixer_free(struct usb_mixer_interface *mixer)
1556 kfree(mixer); 1551 kfree(mixer);
1557} 1552}
1558 1553
1559static int snd_usb_mixer_dev_free(snd_device_t *device) 1554static int snd_usb_mixer_dev_free(struct snd_device *device)
1560{ 1555{
1561 struct usb_mixer_interface *mixer = device->device_data; 1556 struct usb_mixer_interface *mixer = device->device_data;
1562 snd_usb_mixer_free(mixer); 1557 snd_usb_mixer_free(mixer);
@@ -1571,7 +1566,7 @@ static int snd_usb_mixer_dev_free(snd_device_t *device)
1571static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) 1566static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
1572{ 1567{
1573 unsigned char *desc; 1568 unsigned char *desc;
1574 mixer_build_t state; 1569 struct mixer_build state;
1575 int err; 1570 int err;
1576 const struct usbmix_ctl_map *map; 1571 const struct usbmix_ctl_map *map;
1577 struct usb_host_interface *hostif; 1572 struct usb_host_interface *hostif;
@@ -1611,7 +1606,7 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer)
1611static void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, 1606static void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer,
1612 int unitid) 1607 int unitid)
1613{ 1608{
1614 usb_mixer_elem_info_t *info; 1609 struct usb_mixer_elem_info *info;
1615 1610
1616 for (info = mixer->id_elems[unitid]; info; info = info->next_id_elem) 1611 for (info = mixer->id_elems[unitid]; info; info = info->next_id_elem)
1617 snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE, 1612 snd_ctl_notify(mixer->chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
@@ -1725,7 +1720,7 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb,
1725 wake_up(&mixer->rc_waitq); 1720 wake_up(&mixer->rc_waitq);
1726} 1721}
1727 1722
1728static int snd_usb_sbrc_hwdep_open(snd_hwdep_t *hw, struct file *file) 1723static int snd_usb_sbrc_hwdep_open(struct snd_hwdep *hw, struct file *file)
1729{ 1724{
1730 struct usb_mixer_interface *mixer = hw->private_data; 1725 struct usb_mixer_interface *mixer = hw->private_data;
1731 1726
@@ -1734,7 +1729,7 @@ static int snd_usb_sbrc_hwdep_open(snd_hwdep_t *hw, struct file *file)
1734 return 0; 1729 return 0;
1735} 1730}
1736 1731
1737static int snd_usb_sbrc_hwdep_release(snd_hwdep_t *hw, struct file *file) 1732static int snd_usb_sbrc_hwdep_release(struct snd_hwdep *hw, struct file *file)
1738{ 1733{
1739 struct usb_mixer_interface *mixer = hw->private_data; 1734 struct usb_mixer_interface *mixer = hw->private_data;
1740 1735
@@ -1743,7 +1738,7 @@ static int snd_usb_sbrc_hwdep_release(snd_hwdep_t *hw, struct file *file)
1743 return 0; 1738 return 0;
1744} 1739}
1745 1740
1746static long snd_usb_sbrc_hwdep_read(snd_hwdep_t *hw, char __user *buf, 1741static long snd_usb_sbrc_hwdep_read(struct snd_hwdep *hw, char __user *buf,
1747 long count, loff_t *offset) 1742 long count, loff_t *offset)
1748{ 1743{
1749 struct usb_mixer_interface *mixer = hw->private_data; 1744 struct usb_mixer_interface *mixer = hw->private_data;
@@ -1763,7 +1758,7 @@ static long snd_usb_sbrc_hwdep_read(snd_hwdep_t *hw, char __user *buf,
1763 return err < 0 ? err : count; 1758 return err < 0 ? err : count;
1764} 1759}
1765 1760
1766static unsigned int snd_usb_sbrc_hwdep_poll(snd_hwdep_t *hw, struct file *file, 1761static unsigned int snd_usb_sbrc_hwdep_poll(struct snd_hwdep *hw, struct file *file,
1767 poll_table *wait) 1762 poll_table *wait)
1768{ 1763{
1769 struct usb_mixer_interface *mixer = hw->private_data; 1764 struct usb_mixer_interface *mixer = hw->private_data;
@@ -1774,7 +1769,7 @@ static unsigned int snd_usb_sbrc_hwdep_poll(snd_hwdep_t *hw, struct file *file,
1774 1769
1775static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) 1770static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer)
1776{ 1771{
1777 snd_hwdep_t *hwdep; 1772 struct snd_hwdep *hwdep;
1778 int err, len; 1773 int err, len;
1779 1774
1780 switch (mixer->chip->usb_id) { 1775 switch (mixer->chip->usb_id) {
@@ -1825,7 +1820,7 @@ static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer)
1825 return 0; 1820 return 0;
1826} 1821}
1827 1822
1828static int snd_audigy2nx_led_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) 1823static int snd_audigy2nx_led_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
1829{ 1824{
1830 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 1825 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
1831 uinfo->count = 1; 1826 uinfo->count = 1;
@@ -1834,7 +1829,7 @@ static int snd_audigy2nx_led_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
1834 return 0; 1829 return 0;
1835} 1830}
1836 1831
1837static int snd_audigy2nx_led_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1832static int snd_audigy2nx_led_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1838{ 1833{
1839 struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); 1834 struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol);
1840 int index = kcontrol->private_value; 1835 int index = kcontrol->private_value;
@@ -1843,7 +1838,7 @@ static int snd_audigy2nx_led_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
1843 return 0; 1838 return 0;
1844} 1839}
1845 1840
1846static int snd_audigy2nx_led_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) 1841static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1847{ 1842{
1848 struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol); 1843 struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol);
1849 int index = kcontrol->private_value; 1844 int index = kcontrol->private_value;
@@ -1863,7 +1858,7 @@ static int snd_audigy2nx_led_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
1863 return changed; 1858 return changed;
1864} 1859}
1865 1860
1866static snd_kcontrol_new_t snd_audigy2nx_controls[] = { 1861static struct snd_kcontrol_new snd_audigy2nx_controls[] = {
1867 { 1862 {
1868 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1863 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1869 .name = "CMSS LED Switch", 1864 .name = "CMSS LED Switch",
@@ -1904,8 +1899,8 @@ static int snd_audigy2nx_controls_create(struct usb_mixer_interface *mixer)
1904 return 0; 1899 return 0;
1905} 1900}
1906 1901
1907static void snd_audigy2nx_proc_read(snd_info_entry_t *entry, 1902static void snd_audigy2nx_proc_read(struct snd_info_entry *entry,
1908 snd_info_buffer_t *buffer) 1903 struct snd_info_buffer *buffer)
1909{ 1904{
1910 static const struct { 1905 static const struct {
1911 int unitid; 1906 int unitid;
@@ -1935,9 +1930,9 @@ static void snd_audigy2nx_proc_read(snd_info_entry_t *entry,
1935 } 1930 }
1936} 1931}
1937 1932
1938int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif) 1933int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif)
1939{ 1934{
1940 static snd_device_ops_t dev_ops = { 1935 static struct snd_device_ops dev_ops = {
1941 .dev_free = snd_usb_mixer_dev_free 1936 .dev_free = snd_usb_mixer_dev_free
1942 }; 1937 };
1943 struct usb_mixer_interface *mixer; 1938 struct usb_mixer_interface *mixer;
@@ -1967,7 +1962,7 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif)
1967 goto _error; 1962 goto _error;
1968 1963
1969 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020)) { 1964 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020)) {
1970 snd_info_entry_t *entry; 1965 struct snd_info_entry *entry;
1971 1966
1972 if ((err = snd_audigy2nx_controls_create(mixer)) < 0) 1967 if ((err = snd_audigy2nx_controls_create(mixer)) < 0)
1973 goto _error; 1968 goto _error;