2 * USB Audio Driver for ALSA
4 * Quirks and vendor-specific extensions for mixer interfaces
6 * Copyright (c) 2002 by Takashi Iwai <tiwai@suse.de>
8 * Many codes borrowed from audio.c by
9 * Alan Cox (alan@lxorguk.ukuu.org.uk)
10 * Thomas Sailer (sailer@ife.ee.ethz.ch)
12 * Audio Advantage Micro II support added by:
13 * Przemek Rudy (prudy1@o2.pl)
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include <linux/init.h>
31 #include <linux/slab.h>
32 #include <linux/usb.h>
33 #include <linux/usb/audio.h>
35 #include <sound/asoundef.h>
36 #include <sound/core.h>
37 #include <sound/control.h>
38 #include <sound/hwdep.h>
39 #include <sound/info.h>
43 #include "mixer_quirks.h"
46 extern struct snd_kcontrol_new
*snd_usb_feature_unit_ctl
;
48 struct std_mono_table
{
49 unsigned int unitid
, control
, cmask
;
52 snd_kcontrol_tlv_rw_t
*tlv_callback
;
55 /* private_free callback */
56 static void usb_mixer_elem_free(struct snd_kcontrol
*kctl
)
58 kfree(kctl
->private_data
);
59 kctl
->private_data
= NULL
;
62 /* This function allows for the creation of standard UAC controls.
63 * See the quirks for M-Audio FTUs or Ebox-44.
64 * If you don't want to set a TLV callback pass NULL.
66 * Since there doesn't seem to be a devices that needs a multichannel
67 * version, we keep it mono for simplicity.
69 static int snd_create_std_mono_ctl_offset(struct usb_mixer_interface
*mixer
,
76 snd_kcontrol_tlv_rw_t
*tlv_callback
)
79 struct usb_mixer_elem_info
*cval
;
80 struct snd_kcontrol
*kctl
;
82 cval
= kzalloc(sizeof(*cval
), GFP_KERNEL
);
88 cval
->val_type
= val_type
;
90 cval
->control
= control
;
92 cval
->idx_off
= idx_off
;
94 /* get_min_max() is called only for integer volumes later,
95 * so provide a short-cut for booleans */
103 kctl
= snd_ctl_new1(snd_usb_feature_unit_ctl
, cval
);
110 snprintf(kctl
->id
.name
, sizeof(kctl
->id
.name
), name
);
111 kctl
->private_free
= usb_mixer_elem_free
;
115 kctl
->tlv
.c
= tlv_callback
;
116 kctl
->vd
[0].access
|=
117 SNDRV_CTL_ELEM_ACCESS_TLV_READ
|
118 SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK
;
120 /* Add control to mixer */
121 err
= snd_usb_mixer_add_control(mixer
, kctl
);
128 static int snd_create_std_mono_ctl(struct usb_mixer_interface
*mixer
,
130 unsigned int control
,
134 snd_kcontrol_tlv_rw_t
*tlv_callback
)
136 return snd_create_std_mono_ctl_offset(mixer
, unitid
, control
, cmask
,
137 val_type
, 0 /* Offset */, name
, tlv_callback
);
141 * Create a set of standard UAC controls from a table
143 static int snd_create_std_mono_table(struct usb_mixer_interface
*mixer
,
144 struct std_mono_table
*t
)
148 while (t
->name
!= NULL
) {
149 err
= snd_create_std_mono_ctl(mixer
, t
->unitid
, t
->control
,
150 t
->cmask
, t
->val_type
, t
->name
, t
->tlv_callback
);
160 * Sound Blaster remote control configuration
162 * format of remote control data:
164 * Audigy 2 NX: 06 80 xx 00 00 00
165 * Live! 24-bit: 06 80 xx yy 22 83
167 static const struct rc_config
{
172 u8 min_packet_length
; /* minimum accepted length of the URB result */
176 { USB_ID(0x041e, 0x3000), 0, 1, 2, 1, 18, 0x0013 }, /* Extigy */
177 { USB_ID(0x041e, 0x3020), 2, 1, 6, 6, 18, 0x0013 }, /* Audigy 2 NX */
178 { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */
179 { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */
180 { USB_ID(0x041e, 0x30df), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 Pro */
181 { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */
184 static void snd_usb_soundblaster_remote_complete(struct urb
*urb
)
186 struct usb_mixer_interface
*mixer
= urb
->context
;
187 const struct rc_config
*rc
= mixer
->rc_cfg
;
190 if (urb
->status
< 0 || urb
->actual_length
< rc
->min_packet_length
)
193 code
= mixer
->rc_buffer
[rc
->offset
];
195 code
|= mixer
->rc_buffer
[rc
->offset
+ 1] << 8;
197 /* the Mute button actually changes the mixer control */
198 if (code
== rc
->mute_code
)
199 snd_usb_mixer_notify_id(mixer
, rc
->mute_mixer_id
);
200 mixer
->rc_code
= code
;
202 wake_up(&mixer
->rc_waitq
);
205 static long snd_usb_sbrc_hwdep_read(struct snd_hwdep
*hw
, char __user
*buf
,
206 long count
, loff_t
*offset
)
208 struct usb_mixer_interface
*mixer
= hw
->private_data
;
212 if (count
!= 1 && count
!= 4)
214 err
= wait_event_interruptible(mixer
->rc_waitq
,
215 (rc_code
= xchg(&mixer
->rc_code
, 0)) != 0);
218 err
= put_user(rc_code
, buf
);
220 err
= put_user(rc_code
, (u32 __user
*)buf
);
222 return err
< 0 ? err
: count
;
225 static unsigned int snd_usb_sbrc_hwdep_poll(struct snd_hwdep
*hw
, struct file
*file
,
228 struct usb_mixer_interface
*mixer
= hw
->private_data
;
230 poll_wait(file
, &mixer
->rc_waitq
, wait
);
231 return mixer
->rc_code
? POLLIN
| POLLRDNORM
: 0;
234 static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface
*mixer
)
236 struct snd_hwdep
*hwdep
;
239 for (i
= 0; i
< ARRAY_SIZE(rc_configs
); ++i
)
240 if (rc_configs
[i
].usb_id
== mixer
->chip
->usb_id
)
242 if (i
>= ARRAY_SIZE(rc_configs
))
244 mixer
->rc_cfg
= &rc_configs
[i
];
246 len
= mixer
->rc_cfg
->packet_length
;
248 init_waitqueue_head(&mixer
->rc_waitq
);
249 err
= snd_hwdep_new(mixer
->chip
->card
, "SB remote control", 0, &hwdep
);
252 snprintf(hwdep
->name
, sizeof(hwdep
->name
),
253 "%s remote control", mixer
->chip
->card
->shortname
);
254 hwdep
->iface
= SNDRV_HWDEP_IFACE_SB_RC
;
255 hwdep
->private_data
= mixer
;
256 hwdep
->ops
.read
= snd_usb_sbrc_hwdep_read
;
257 hwdep
->ops
.poll
= snd_usb_sbrc_hwdep_poll
;
258 hwdep
->exclusive
= 1;
260 mixer
->rc_urb
= usb_alloc_urb(0, GFP_KERNEL
);
263 mixer
->rc_setup_packet
= kmalloc(sizeof(*mixer
->rc_setup_packet
), GFP_KERNEL
);
264 if (!mixer
->rc_setup_packet
) {
265 usb_free_urb(mixer
->rc_urb
);
266 mixer
->rc_urb
= NULL
;
269 mixer
->rc_setup_packet
->bRequestType
=
270 USB_DIR_IN
| USB_TYPE_CLASS
| USB_RECIP_INTERFACE
;
271 mixer
->rc_setup_packet
->bRequest
= UAC_GET_MEM
;
272 mixer
->rc_setup_packet
->wValue
= cpu_to_le16(0);
273 mixer
->rc_setup_packet
->wIndex
= cpu_to_le16(0);
274 mixer
->rc_setup_packet
->wLength
= cpu_to_le16(len
);
275 usb_fill_control_urb(mixer
->rc_urb
, mixer
->chip
->dev
,
276 usb_rcvctrlpipe(mixer
->chip
->dev
, 0),
277 (u8
*)mixer
->rc_setup_packet
, mixer
->rc_buffer
, len
,
278 snd_usb_soundblaster_remote_complete
, mixer
);
282 #define snd_audigy2nx_led_info snd_ctl_boolean_mono_info
284 static int snd_audigy2nx_led_get(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
286 struct usb_mixer_interface
*mixer
= snd_kcontrol_chip(kcontrol
);
287 int index
= kcontrol
->private_value
;
289 ucontrol
->value
.integer
.value
[0] = mixer
->audigy2nx_leds
[index
];
293 static int snd_audigy2nx_led_put(struct snd_kcontrol
*kcontrol
, struct snd_ctl_elem_value
*ucontrol
)
295 struct usb_mixer_interface
*mixer
= snd_kcontrol_chip(kcontrol
);
296 int index
= kcontrol
->private_value
;
297 int value
= ucontrol
->value
.integer
.value
[0];
302 changed
= value
!= mixer
->audigy2nx_leds
[index
];
303 down_read(&mixer
->chip
->shutdown_rwsem
);
304 if (mixer
->chip
->shutdown
) {
308 if (mixer
->chip
->usb_id
== USB_ID(0x041e, 0x3042))
309 err
= snd_usb_ctl_msg(mixer
->chip
->dev
,
310 usb_sndctrlpipe(mixer
->chip
->dev
, 0), 0x24,
311 USB_DIR_OUT
| USB_TYPE_VENDOR
| USB_RECIP_OTHER
,
313 /* USB X-Fi S51 Pro */
314 if (mixer
->chip
->usb_id
== USB_ID(0x041e, 0x30df))
315 err
= snd_usb_ctl_msg(mixer
->chip
->dev
,
316 usb_sndctrlpipe(mixer
->chip
->dev
, 0), 0x24,
317 USB_DIR_OUT
| USB_TYPE_VENDOR
| USB_RECIP_OTHER
,
320 err
= snd_usb_ctl_msg(mixer
->chip
->dev
,
321 usb_sndctrlpipe(mixer
->chip
->dev
, 0), 0x24,
322 USB_DIR_OUT
| USB_TYPE_VENDOR
| USB_RECIP_OTHER
,
323 value
, index
+ 2, NULL
, 0);
325 up_read(&mixer
->chip
->shutdown_rwsem
);
328 mixer
->audigy2nx_leds
[index
] = value
;
332 static struct snd_kcontrol_new snd_audigy2nx_controls
[] = {
334 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
335 .name
= "CMSS LED Switch",
336 .info
= snd_audigy2nx_led_info
,
337 .get
= snd_audigy2nx_led_get
,
338 .put
= snd_audigy2nx_led_put
,
342 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
343 .name
= "Power LED Switch",
344 .info
= snd_audigy2nx_led_info
,
345 .get
= snd_audigy2nx_led_get
,
346 .put
= snd_audigy2nx_led_put
,
350 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
351 .name
= "Dolby Digital LED Switch",
352 .info
= snd_audigy2nx_led_info
,
353 .get
= snd_audigy2nx_led_get
,
354 .put
= snd_audigy2nx_led_put
,
359 static int snd_audigy2nx_controls_create(struct usb_mixer_interface
*mixer
)
363 for (i
= 0; i
< ARRAY_SIZE(snd_audigy2nx_controls
); ++i
) {
364 /* USB X-Fi S51 doesn't have a CMSS LED */
365 if ((mixer
->chip
->usb_id
== USB_ID(0x041e, 0x3042)) && i
== 0)
367 /* USB X-Fi S51 Pro doesn't have one either */
368 if ((mixer
->chip
->usb_id
== USB_ID(0x041e, 0x30df)) && i
== 0)
370 if (i
> 1 && /* Live24ext has 2 LEDs only */
371 (mixer
->chip
->usb_id
== USB_ID(0x041e, 0x3040) ||
372 mixer
->chip
->usb_id
== USB_ID(0x041e, 0x3042) ||
373 mixer
->chip
->usb_id
== USB_ID(0x041e, 0x30df) ||
374 mixer
->chip
->usb_id
== USB_ID(0x041e, 0x3048)))
376 err
= snd_ctl_add(mixer
->chip
->card
,
377 snd_ctl_new1(&snd_audigy2nx_controls
[i
], mixer
));
381 mixer
->audigy2nx_leds
[1] = 1; /* Power LED is on by default */
385 static void snd_audigy2nx_proc_read(struct snd_info_entry
*entry
,
386 struct snd_info_buffer
*buffer
)
388 static const struct sb_jack
{
391 } jacks_audigy2nx
[] = {
397 }, jacks_live24ext
[] = {
398 {4, "line in"}, /* &1=Line, &2=Mic*/
399 {3, "hph out"}, /* headphones */
400 {0, "RC "}, /* last command, 6 bytes see rc_config above */
403 const struct sb_jack
*jacks
;
404 struct usb_mixer_interface
*mixer
= entry
->private_data
;
408 snd_iprintf(buffer
, "%s jacks\n\n", mixer
->chip
->card
->shortname
);
409 if (mixer
->chip
->usb_id
== USB_ID(0x041e, 0x3020))
410 jacks
= jacks_audigy2nx
;
411 else if (mixer
->chip
->usb_id
== USB_ID(0x041e, 0x3040) ||
412 mixer
->chip
->usb_id
== USB_ID(0x041e, 0x3048))
413 jacks
= jacks_live24ext
;
417 for (i
= 0; jacks
[i
].name
; ++i
) {
418 snd_iprintf(buffer
, "%s: ", jacks
[i
].name
);
419 down_read(&mixer
->chip
->shutdown_rwsem
);
420 if (mixer
->chip
->shutdown
)
423 err
= snd_usb_ctl_msg(mixer
->chip
->dev
,
424 usb_rcvctrlpipe(mixer
->chip
->dev
, 0),
425 UAC_GET_MEM
, USB_DIR_IN
| USB_TYPE_CLASS
|
426 USB_RECIP_INTERFACE
, 0,
427 jacks
[i
].unitid
<< 8, buf
, 3);
428 up_read(&mixer
->chip
->shutdown_rwsem
);
429 if (err
== 3 && (buf
[0] == 3 || buf
[0] == 6))
430 snd_iprintf(buffer
, "%02x %02x\n", buf
[1], buf
[2]);
432 snd_iprintf(buffer
, "?\n");
437 static int snd_emu0204_ch_switch_info(struct snd_kcontrol
*kcontrol
,
438 struct snd_ctl_elem_info
*uinfo
)
440 static const char *texts
[2] = {"1/2",
444 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
446 uinfo
->value
.enumerated
.items
= 2;
447 if (uinfo
->value
.enumerated
.item
> 1)
448 uinfo
->value
.enumerated
.item
= 1;
449 strcpy(uinfo
->value
.enumerated
.name
,
450 texts
[uinfo
->value
.enumerated
.item
]);
455 static int snd_emu0204_ch_switch_get(struct snd_kcontrol
*kcontrol
,
456 struct snd_ctl_elem_value
*ucontrol
)
458 ucontrol
->value
.enumerated
.item
[0] = kcontrol
->private_value
;
462 static int snd_emu0204_ch_switch_put(struct snd_kcontrol
*kcontrol
,
463 struct snd_ctl_elem_value
*ucontrol
)
465 struct usb_mixer_interface
*mixer
= snd_kcontrol_chip(kcontrol
);
466 unsigned int value
= ucontrol
->value
.enumerated
.item
[0];
468 unsigned char buf
[2];
474 buf
[1] = value
? 0x02 : 0x01;
476 changed
= value
!= kcontrol
->private_value
;
477 down_read(&mixer
->chip
->shutdown_rwsem
);
478 if (mixer
->chip
->shutdown
) {
482 err
= snd_usb_ctl_msg(mixer
->chip
->dev
,
483 usb_sndctrlpipe(mixer
->chip
->dev
, 0), UAC_SET_CUR
,
484 USB_RECIP_INTERFACE
| USB_TYPE_CLASS
| USB_DIR_OUT
,
485 0x0400, 0x0e00, buf
, 2);
487 up_read(&mixer
->chip
->shutdown_rwsem
);
490 kcontrol
->private_value
= value
;
495 static struct snd_kcontrol_new snd_emu0204_controls
[] = {
497 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
498 .name
= "Front Jack Channels",
499 .info
= snd_emu0204_ch_switch_info
,
500 .get
= snd_emu0204_ch_switch_get
,
501 .put
= snd_emu0204_ch_switch_put
,
506 static int snd_emu0204_controls_create(struct usb_mixer_interface
*mixer
)
510 for (i
= 0; i
< ARRAY_SIZE(snd_emu0204_controls
); ++i
) {
511 err
= snd_ctl_add(mixer
->chip
->card
,
512 snd_ctl_new1(&snd_emu0204_controls
[i
], mixer
));
519 /* ASUS Xonar U1 / U3 controls */
521 static int snd_xonar_u1_switch_get(struct snd_kcontrol
*kcontrol
,
522 struct snd_ctl_elem_value
*ucontrol
)
524 struct usb_mixer_interface
*mixer
= snd_kcontrol_chip(kcontrol
);
526 ucontrol
->value
.integer
.value
[0] = !!(mixer
->xonar_u1_status
& 0x02);
530 static int snd_xonar_u1_switch_put(struct snd_kcontrol
*kcontrol
,
531 struct snd_ctl_elem_value
*ucontrol
)
533 struct usb_mixer_interface
*mixer
= snd_kcontrol_chip(kcontrol
);
534 u8 old_status
, new_status
;
537 old_status
= mixer
->xonar_u1_status
;
538 if (ucontrol
->value
.integer
.value
[0])
539 new_status
= old_status
| 0x02;
541 new_status
= old_status
& ~0x02;
542 changed
= new_status
!= old_status
;
543 down_read(&mixer
->chip
->shutdown_rwsem
);
544 if (mixer
->chip
->shutdown
)
547 err
= snd_usb_ctl_msg(mixer
->chip
->dev
,
548 usb_sndctrlpipe(mixer
->chip
->dev
, 0), 0x08,
549 USB_DIR_OUT
| USB_TYPE_VENDOR
| USB_RECIP_OTHER
,
550 50, 0, &new_status
, 1);
551 up_read(&mixer
->chip
->shutdown_rwsem
);
554 mixer
->xonar_u1_status
= new_status
;
558 static struct snd_kcontrol_new snd_xonar_u1_output_switch
= {
559 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
560 .name
= "Digital Playback Switch",
561 .info
= snd_ctl_boolean_mono_info
,
562 .get
= snd_xonar_u1_switch_get
,
563 .put
= snd_xonar_u1_switch_put
,
566 static int snd_xonar_u1_controls_create(struct usb_mixer_interface
*mixer
)
570 err
= snd_ctl_add(mixer
->chip
->card
,
571 snd_ctl_new1(&snd_xonar_u1_output_switch
, mixer
));
574 mixer
->xonar_u1_status
= 0x05;
578 /* Native Instruments device quirks */
580 #define _MAKE_NI_CONTROL(bRequest,wIndex) ((bRequest) << 16 | (wIndex))
582 static int snd_nativeinstruments_control_get(struct snd_kcontrol
*kcontrol
,
583 struct snd_ctl_elem_value
*ucontrol
)
585 struct usb_mixer_interface
*mixer
= snd_kcontrol_chip(kcontrol
);
586 struct usb_device
*dev
= mixer
->chip
->dev
;
587 u8 bRequest
= (kcontrol
->private_value
>> 16) & 0xff;
588 u16 wIndex
= kcontrol
->private_value
& 0xffff;
592 down_read(&mixer
->chip
->shutdown_rwsem
);
593 if (mixer
->chip
->shutdown
)
596 ret
= usb_control_msg(dev
, usb_rcvctrlpipe(dev
, 0), bRequest
,
597 USB_TYPE_VENDOR
| USB_RECIP_DEVICE
| USB_DIR_IN
,
599 &tmp
, sizeof(tmp
), 1000);
600 up_read(&mixer
->chip
->shutdown_rwsem
);
604 "unable to issue vendor read request (ret = %d)", ret
);
608 ucontrol
->value
.integer
.value
[0] = tmp
;
613 static int snd_nativeinstruments_control_put(struct snd_kcontrol
*kcontrol
,
614 struct snd_ctl_elem_value
*ucontrol
)
616 struct usb_mixer_interface
*mixer
= snd_kcontrol_chip(kcontrol
);
617 struct usb_device
*dev
= mixer
->chip
->dev
;
618 u8 bRequest
= (kcontrol
->private_value
>> 16) & 0xff;
619 u16 wIndex
= kcontrol
->private_value
& 0xffff;
620 u16 wValue
= ucontrol
->value
.integer
.value
[0];
623 down_read(&mixer
->chip
->shutdown_rwsem
);
624 if (mixer
->chip
->shutdown
)
627 ret
= usb_control_msg(dev
, usb_sndctrlpipe(dev
, 0), bRequest
,
628 USB_TYPE_VENDOR
| USB_RECIP_DEVICE
| USB_DIR_OUT
,
631 up_read(&mixer
->chip
->shutdown_rwsem
);
635 "unable to issue vendor write request (ret = %d)", ret
);
642 static struct snd_kcontrol_new snd_nativeinstruments_ta6_mixers
[] = {
644 .name
= "Direct Thru Channel A",
645 .private_value
= _MAKE_NI_CONTROL(0x01, 0x03),
648 .name
= "Direct Thru Channel B",
649 .private_value
= _MAKE_NI_CONTROL(0x01, 0x05),
652 .name
= "Phono Input Channel A",
653 .private_value
= _MAKE_NI_CONTROL(0x02, 0x03),
656 .name
= "Phono Input Channel B",
657 .private_value
= _MAKE_NI_CONTROL(0x02, 0x05),
661 static struct snd_kcontrol_new snd_nativeinstruments_ta10_mixers
[] = {
663 .name
= "Direct Thru Channel A",
664 .private_value
= _MAKE_NI_CONTROL(0x01, 0x03),
667 .name
= "Direct Thru Channel B",
668 .private_value
= _MAKE_NI_CONTROL(0x01, 0x05),
671 .name
= "Direct Thru Channel C",
672 .private_value
= _MAKE_NI_CONTROL(0x01, 0x07),
675 .name
= "Direct Thru Channel D",
676 .private_value
= _MAKE_NI_CONTROL(0x01, 0x09),
679 .name
= "Phono Input Channel A",
680 .private_value
= _MAKE_NI_CONTROL(0x02, 0x03),
683 .name
= "Phono Input Channel B",
684 .private_value
= _MAKE_NI_CONTROL(0x02, 0x05),
687 .name
= "Phono Input Channel C",
688 .private_value
= _MAKE_NI_CONTROL(0x02, 0x07),
691 .name
= "Phono Input Channel D",
692 .private_value
= _MAKE_NI_CONTROL(0x02, 0x09),
696 static int snd_nativeinstruments_create_mixer(struct usb_mixer_interface
*mixer
,
697 const struct snd_kcontrol_new
*kc
,
701 struct snd_kcontrol_new
template = {
702 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
703 .access
= SNDRV_CTL_ELEM_ACCESS_READWRITE
,
704 .get
= snd_nativeinstruments_control_get
,
705 .put
= snd_nativeinstruments_control_put
,
706 .info
= snd_ctl_boolean_mono_info
,
709 for (i
= 0; i
< count
; i
++) {
710 struct snd_kcontrol
*c
;
712 template.name
= kc
[i
].name
;
713 template.private_value
= kc
[i
].private_value
;
715 c
= snd_ctl_new1(&template, mixer
);
716 err
= snd_ctl_add(mixer
->chip
->card
, c
);
725 /* M-Audio FastTrack Ultra quirks */
726 /* FTU Effect switch (also used by C400/C600) */
727 struct snd_ftu_eff_switch_priv_val
{
728 struct usb_mixer_interface
*mixer
;
735 static int snd_ftu_eff_switch_info(struct snd_kcontrol
*kcontrol
,
736 struct snd_ctl_elem_info
*uinfo
)
738 static const char *texts
[8] = {"Room 1",
748 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_ENUMERATED
;
750 uinfo
->value
.enumerated
.items
= 8;
751 if (uinfo
->value
.enumerated
.item
> 7)
752 uinfo
->value
.enumerated
.item
= 7;
753 strcpy(uinfo
->value
.enumerated
.name
,
754 texts
[uinfo
->value
.enumerated
.item
]);
759 static int snd_ftu_eff_switch_get(struct snd_kcontrol
*kctl
,
760 struct snd_ctl_elem_value
*ucontrol
)
762 struct snd_usb_audio
*chip
;
763 struct usb_mixer_interface
*mixer
;
764 struct snd_ftu_eff_switch_priv_val
*pval
;
766 unsigned char value
[2];
769 const int val_len
= 2;
774 pval
= (struct snd_ftu_eff_switch_priv_val
*)
777 if (pval
->is_cached
) {
778 ucontrol
->value
.enumerated
.item
[0] = pval
->cached_value
;
782 mixer
= (struct usb_mixer_interface
*) pval
->mixer
;
783 if (snd_BUG_ON(!mixer
))
786 chip
= (struct snd_usb_audio
*) mixer
->chip
;
787 if (snd_BUG_ON(!chip
))
791 validx
= pval
->validx
;
793 down_read(&mixer
->chip
->shutdown_rwsem
);
794 if (mixer
->chip
->shutdown
)
797 err
= snd_usb_ctl_msg(chip
->dev
,
798 usb_rcvctrlpipe(chip
->dev
, 0), UAC_GET_CUR
,
799 USB_RECIP_INTERFACE
| USB_TYPE_CLASS
| USB_DIR_IN
,
800 validx
<< 8, snd_usb_ctrl_intf(chip
) | (id
<< 8),
802 up_read(&mixer
->chip
->shutdown_rwsem
);
806 ucontrol
->value
.enumerated
.item
[0] = value
[0];
807 pval
->cached_value
= value
[0];
813 static int snd_ftu_eff_switch_put(struct snd_kcontrol
*kctl
,
814 struct snd_ctl_elem_value
*ucontrol
)
816 struct snd_usb_audio
*chip
;
817 struct snd_ftu_eff_switch_priv_val
*pval
;
819 struct usb_mixer_interface
*mixer
;
820 int changed
, cur_val
, err
, new_val
;
821 unsigned char value
[2];
824 const int val_len
= 2;
828 pval
= (struct snd_ftu_eff_switch_priv_val
*)
830 cur_val
= pval
->cached_value
;
831 new_val
= ucontrol
->value
.enumerated
.item
[0];
833 mixer
= (struct usb_mixer_interface
*) pval
->mixer
;
834 if (snd_BUG_ON(!mixer
))
837 chip
= (struct snd_usb_audio
*) mixer
->chip
;
838 if (snd_BUG_ON(!chip
))
842 validx
= pval
->validx
;
844 if (!pval
->is_cached
) {
845 /* Read current value */
846 down_read(&mixer
->chip
->shutdown_rwsem
);
847 if (mixer
->chip
->shutdown
)
850 err
= snd_usb_ctl_msg(chip
->dev
,
851 usb_rcvctrlpipe(chip
->dev
, 0), UAC_GET_CUR
,
852 USB_RECIP_INTERFACE
| USB_TYPE_CLASS
| USB_DIR_IN
,
853 validx
<< 8, snd_usb_ctrl_intf(chip
) | (id
<< 8),
855 up_read(&mixer
->chip
->shutdown_rwsem
);
860 pval
->cached_value
= cur_val
;
863 /* update value if needed */
864 if (cur_val
!= new_val
) {
867 down_read(&mixer
->chip
->shutdown_rwsem
);
868 if (mixer
->chip
->shutdown
)
871 err
= snd_usb_ctl_msg(chip
->dev
,
872 usb_sndctrlpipe(chip
->dev
, 0), UAC_SET_CUR
,
873 USB_RECIP_INTERFACE
| USB_TYPE_CLASS
| USB_DIR_OUT
,
874 validx
<< 8, snd_usb_ctrl_intf(chip
) | (id
<< 8),
876 up_read(&mixer
->chip
->shutdown_rwsem
);
880 pval
->cached_value
= new_val
;
888 static void kctl_private_value_free(struct snd_kcontrol
*kctl
)
890 kfree((void *)kctl
->private_value
);
893 static int snd_ftu_create_effect_switch(struct usb_mixer_interface
*mixer
,
894 int validx
, int bUnitID
)
896 static struct snd_kcontrol_new
template = {
897 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
898 .name
= "Effect Program Switch",
900 .access
= SNDRV_CTL_ELEM_ACCESS_READWRITE
,
901 .info
= snd_ftu_eff_switch_info
,
902 .get
= snd_ftu_eff_switch_get
,
903 .put
= snd_ftu_eff_switch_put
907 struct snd_kcontrol
*kctl
;
908 struct snd_ftu_eff_switch_priv_val
*pval
;
910 pval
= kzalloc(sizeof(*pval
), GFP_KERNEL
);
914 pval
->cached_value
= 0;
917 pval
->bUnitID
= bUnitID
;
918 pval
->validx
= validx
;
920 template.private_value
= (unsigned long) pval
;
921 kctl
= snd_ctl_new1(&template, mixer
->chip
);
927 kctl
->private_free
= kctl_private_value_free
;
928 err
= snd_ctl_add(mixer
->chip
->card
, kctl
);
935 /* Create volume controls for FTU devices*/
936 static int snd_ftu_create_volume_ctls(struct usb_mixer_interface
*mixer
)
939 unsigned int control
, cmask
;
942 const unsigned int id
= 5;
943 const int val_type
= USB_MIXER_S16
;
945 for (out
= 0; out
< 8; out
++) {
947 for (in
= 0; in
< 8; in
++) {
949 snprintf(name
, sizeof(name
),
950 "AIn%d - Out%d Capture Volume",
952 err
= snd_create_std_mono_ctl(mixer
, id
, control
,
953 cmask
, val_type
, name
,
954 &snd_usb_mixer_vol_tlv
);
958 for (in
= 8; in
< 16; in
++) {
960 snprintf(name
, sizeof(name
),
961 "DIn%d - Out%d Playback Volume",
963 err
= snd_create_std_mono_ctl(mixer
, id
, control
,
964 cmask
, val_type
, name
,
965 &snd_usb_mixer_vol_tlv
);
974 /* This control needs a volume quirk, see mixer.c */
975 static int snd_ftu_create_effect_volume_ctl(struct usb_mixer_interface
*mixer
)
977 static const char name
[] = "Effect Volume";
978 const unsigned int id
= 6;
979 const int val_type
= USB_MIXER_U8
;
980 const unsigned int control
= 2;
981 const unsigned int cmask
= 0;
983 return snd_create_std_mono_ctl(mixer
, id
, control
, cmask
, val_type
,
984 name
, snd_usb_mixer_vol_tlv
);
987 /* This control needs a volume quirk, see mixer.c */
988 static int snd_ftu_create_effect_duration_ctl(struct usb_mixer_interface
*mixer
)
990 static const char name
[] = "Effect Duration";
991 const unsigned int id
= 6;
992 const int val_type
= USB_MIXER_S16
;
993 const unsigned int control
= 3;
994 const unsigned int cmask
= 0;
996 return snd_create_std_mono_ctl(mixer
, id
, control
, cmask
, val_type
,
997 name
, snd_usb_mixer_vol_tlv
);
1000 /* This control needs a volume quirk, see mixer.c */
1001 static int snd_ftu_create_effect_feedback_ctl(struct usb_mixer_interface
*mixer
)
1003 static const char name
[] = "Effect Feedback Volume";
1004 const unsigned int id
= 6;
1005 const int val_type
= USB_MIXER_U8
;
1006 const unsigned int control
= 4;
1007 const unsigned int cmask
= 0;
1009 return snd_create_std_mono_ctl(mixer
, id
, control
, cmask
, val_type
,
1013 static int snd_ftu_create_effect_return_ctls(struct usb_mixer_interface
*mixer
)
1019 const unsigned int id
= 7;
1020 const int val_type
= USB_MIXER_S16
;
1021 const unsigned int control
= 7;
1023 for (ch
= 0; ch
< 4; ++ch
) {
1025 snprintf(name
, sizeof(name
),
1026 "Effect Return %d Volume", ch
+ 1);
1027 err
= snd_create_std_mono_ctl(mixer
, id
, control
,
1028 cmask
, val_type
, name
,
1029 snd_usb_mixer_vol_tlv
);
1037 static int snd_ftu_create_effect_send_ctls(struct usb_mixer_interface
*mixer
)
1043 const unsigned int id
= 5;
1044 const int val_type
= USB_MIXER_S16
;
1045 const unsigned int control
= 9;
1047 for (ch
= 0; ch
< 8; ++ch
) {
1049 snprintf(name
, sizeof(name
),
1050 "Effect Send AIn%d Volume", ch
+ 1);
1051 err
= snd_create_std_mono_ctl(mixer
, id
, control
, cmask
,
1053 snd_usb_mixer_vol_tlv
);
1057 for (ch
= 8; ch
< 16; ++ch
) {
1059 snprintf(name
, sizeof(name
),
1060 "Effect Send DIn%d Volume", ch
- 7);
1061 err
= snd_create_std_mono_ctl(mixer
, id
, control
, cmask
,
1063 snd_usb_mixer_vol_tlv
);
1070 static int snd_ftu_create_mixer(struct usb_mixer_interface
*mixer
)
1074 err
= snd_ftu_create_volume_ctls(mixer
);
1078 err
= snd_ftu_create_effect_switch(mixer
, 1, 6);
1082 err
= snd_ftu_create_effect_volume_ctl(mixer
);
1086 err
= snd_ftu_create_effect_duration_ctl(mixer
);
1090 err
= snd_ftu_create_effect_feedback_ctl(mixer
);
1094 err
= snd_ftu_create_effect_return_ctls(mixer
);
1098 err
= snd_ftu_create_effect_send_ctls(mixer
);
1105 void snd_emuusb_set_samplerate(struct snd_usb_audio
*chip
,
1106 unsigned char samplerate_id
)
1108 struct usb_mixer_interface
*mixer
;
1109 struct usb_mixer_elem_info
*cval
;
1110 int unitid
= 12; /* SamleRate ExtensionUnit ID */
1112 list_for_each_entry(mixer
, &chip
->mixer_list
, list
) {
1113 cval
= mixer
->id_elems
[unitid
];
1115 snd_usb_mixer_set_ctl_value(cval
, UAC_SET_CUR
,
1118 snd_usb_mixer_notify_id(mixer
, unitid
);
1124 /* M-Audio Fast Track C400/C600 */
1125 /* C400/C600 volume controls, this control needs a volume quirk, see mixer.c */
1126 static int snd_c400_create_vol_ctls(struct usb_mixer_interface
*mixer
)
1129 unsigned int cmask
, offset
;
1134 const unsigned int id
= 0x40;
1135 const int val_type
= USB_MIXER_S16
;
1136 const int control
= 1;
1138 switch (mixer
->chip
->usb_id
) {
1139 case USB_ID(0x0763, 0x2030):
1143 case USB_ID(0x0763, 0x2031):
1149 for (chan
= 0; chan
< num_outs
+ num_ins
; chan
++) {
1150 for (out
= 0; out
< num_outs
; out
++) {
1151 if (chan
< num_outs
) {
1152 snprintf(name
, sizeof(name
),
1153 "PCM%d-Out%d Playback Volume",
1156 snprintf(name
, sizeof(name
),
1157 "In%d-Out%d Playback Volume",
1158 chan
- num_outs
+ 1, out
+ 1);
1161 cmask
= (out
== 0) ? 0 : 1 << (out
- 1);
1162 offset
= chan
* num_outs
;
1163 err
= snd_create_std_mono_ctl_offset(mixer
, id
, control
,
1164 cmask
, val_type
, offset
, name
,
1165 &snd_usb_mixer_vol_tlv
);
1174 /* This control needs a volume quirk, see mixer.c */
1175 static int snd_c400_create_effect_volume_ctl(struct usb_mixer_interface
*mixer
)
1177 static const char name
[] = "Effect Volume";
1178 const unsigned int id
= 0x43;
1179 const int val_type
= USB_MIXER_U8
;
1180 const unsigned int control
= 3;
1181 const unsigned int cmask
= 0;
1183 return snd_create_std_mono_ctl(mixer
, id
, control
, cmask
, val_type
,
1184 name
, snd_usb_mixer_vol_tlv
);
1187 /* This control needs a volume quirk, see mixer.c */
1188 static int snd_c400_create_effect_duration_ctl(struct usb_mixer_interface
*mixer
)
1190 static const char name
[] = "Effect Duration";
1191 const unsigned int id
= 0x43;
1192 const int val_type
= USB_MIXER_S16
;
1193 const unsigned int control
= 4;
1194 const unsigned int cmask
= 0;
1196 return snd_create_std_mono_ctl(mixer
, id
, control
, cmask
, val_type
,
1197 name
, snd_usb_mixer_vol_tlv
);
1200 /* This control needs a volume quirk, see mixer.c */
1201 static int snd_c400_create_effect_feedback_ctl(struct usb_mixer_interface
*mixer
)
1203 static const char name
[] = "Effect Feedback Volume";
1204 const unsigned int id
= 0x43;
1205 const int val_type
= USB_MIXER_U8
;
1206 const unsigned int control
= 5;
1207 const unsigned int cmask
= 0;
1209 return snd_create_std_mono_ctl(mixer
, id
, control
, cmask
, val_type
,
1213 static int snd_c400_create_effect_vol_ctls(struct usb_mixer_interface
*mixer
)
1221 const unsigned int id
= 0x42;
1222 const int val_type
= USB_MIXER_S16
;
1223 const int control
= 1;
1225 switch (mixer
->chip
->usb_id
) {
1226 case USB_ID(0x0763, 0x2030):
1230 case USB_ID(0x0763, 0x2031):
1236 for (chan
= 0; chan
< num_outs
+ num_ins
; chan
++) {
1237 if (chan
< num_outs
) {
1238 snprintf(name
, sizeof(name
),
1239 "Effect Send DOut%d",
1242 snprintf(name
, sizeof(name
),
1243 "Effect Send AIn%d",
1244 chan
- num_outs
+ 1);
1247 cmask
= (chan
== 0) ? 0 : 1 << (chan
- 1);
1248 err
= snd_create_std_mono_ctl(mixer
, id
, control
,
1249 cmask
, val_type
, name
,
1250 &snd_usb_mixer_vol_tlv
);
1258 static int snd_c400_create_effect_ret_vol_ctls(struct usb_mixer_interface
*mixer
)
1266 const unsigned int id
= 0x40;
1267 const int val_type
= USB_MIXER_S16
;
1268 const int control
= 1;
1270 switch (mixer
->chip
->usb_id
) {
1271 case USB_ID(0x0763, 0x2030):
1274 /* { 0x3c, 0x43, 0x3e, 0x45, 0x40, 0x47 } */
1276 case USB_ID(0x0763, 0x2031):
1279 /* { 0x70, 0x79, 0x72, 0x7b, 0x74, 0x7d, 0x76, 0x7f } */
1283 for (chan
= 0; chan
< num_outs
; chan
++) {
1284 snprintf(name
, sizeof(name
),
1288 cmask
= (chan
== 0) ? 0 :
1289 1 << (chan
+ (chan
% 2) * num_outs
- 1);
1290 err
= snd_create_std_mono_ctl_offset(mixer
, id
, control
,
1291 cmask
, val_type
, offset
, name
,
1292 &snd_usb_mixer_vol_tlv
);
1300 static int snd_c400_create_mixer(struct usb_mixer_interface
*mixer
)
1304 err
= snd_c400_create_vol_ctls(mixer
);
1308 err
= snd_c400_create_effect_vol_ctls(mixer
);
1312 err
= snd_c400_create_effect_ret_vol_ctls(mixer
);
1316 err
= snd_ftu_create_effect_switch(mixer
, 2, 0x43);
1320 err
= snd_c400_create_effect_volume_ctl(mixer
);
1324 err
= snd_c400_create_effect_duration_ctl(mixer
);
1328 err
= snd_c400_create_effect_feedback_ctl(mixer
);
1336 * The mixer units for Ebox-44 are corrupt, and even where they
1337 * are valid they presents mono controls as L and R channels of
1338 * stereo. So we provide a good mixer here.
1340 static struct std_mono_table ebox44_table
[] = {
1345 .val_type
= USB_MIXER_INV_BOOLEAN
,
1346 .name
= "Headphone Playback Switch"
1352 .val_type
= USB_MIXER_S16
,
1353 .name
= "Headphone A Mix Playback Volume"
1359 .val_type
= USB_MIXER_S16
,
1360 .name
= "Headphone B Mix Playback Volume"
1367 .val_type
= USB_MIXER_INV_BOOLEAN
,
1368 .name
= "Output Playback Switch"
1374 .val_type
= USB_MIXER_S16
,
1375 .name
= "Output A Playback Volume"
1381 .val_type
= USB_MIXER_S16
,
1382 .name
= "Output B Playback Volume"
1389 .val_type
= USB_MIXER_INV_BOOLEAN
,
1390 .name
= "Input Capture Switch"
1396 .val_type
= USB_MIXER_S16
,
1397 .name
= "Input A Capture Volume"
1403 .val_type
= USB_MIXER_S16
,
1404 .name
= "Input B Capture Volume"
1410 /* Audio Advantage Micro II findings:
1412 * Mapping spdif AES bits to vendor register.bit:
1413 * AES0: [0 0 0 0 2.3 2.2 2.1 2.0] - default 0x00
1414 * AES1: [3.3 3.2.3.1.3.0 2.7 2.6 2.5 2.4] - default: 0x01
1415 * AES2: [0 0 0 0 0 0 0 0]
1416 * AES3: [0 0 0 0 0 0 x 0] - 'x' bit is set basing on standard usb request
1417 * (UAC_EP_CS_ATTR_SAMPLE_RATE) for Audio Devices
1421 * r3: 0x20 (b7 is zeroed just before playback (except IEC61937) and set
1422 * just after it to 0xa0, presumably it disables/mutes some analog
1423 * parts when there is no audio.)
1426 * Optical transmitter on/off:
1427 * vendor register.bit: 9.1
1428 * 0 - on (0x28 register value)
1429 * 1 - off (0x2a register value)
1432 static int snd_microii_spdif_info(struct snd_kcontrol
*kcontrol
,
1433 struct snd_ctl_elem_info
*uinfo
)
1435 uinfo
->type
= SNDRV_CTL_ELEM_TYPE_IEC958
;
1440 static int snd_microii_spdif_default_get(struct snd_kcontrol
*kcontrol
,
1441 struct snd_ctl_elem_value
*ucontrol
)
1443 struct usb_mixer_interface
*mixer
= snd_kcontrol_chip(kcontrol
);
1445 struct usb_interface
*iface
;
1446 struct usb_host_interface
*alts
;
1448 unsigned char data
[3];
1451 ucontrol
->value
.iec958
.status
[0] = kcontrol
->private_value
& 0xff;
1452 ucontrol
->value
.iec958
.status
[1] = (kcontrol
->private_value
>> 8) & 0xff;
1453 ucontrol
->value
.iec958
.status
[2] = 0x00;
1455 /* use known values for that card: interface#1 altsetting#1 */
1456 iface
= usb_ifnum_to_if(mixer
->chip
->dev
, 1);
1457 alts
= &iface
->altsetting
[1];
1458 ep
= get_endpoint(alts
, 0)->bEndpointAddress
;
1460 err
= snd_usb_ctl_msg(mixer
->chip
->dev
,
1461 usb_rcvctrlpipe(mixer
->chip
->dev
, 0),
1463 USB_TYPE_CLASS
| USB_RECIP_ENDPOINT
| USB_DIR_IN
,
1464 UAC_EP_CS_ATTR_SAMPLE_RATE
<< 8,
1471 rate
= data
[0] | (data
[1] << 8) | (data
[2] << 16);
1472 ucontrol
->value
.iec958
.status
[3] = (rate
== 48000) ?
1473 IEC958_AES3_CON_FS_48000
: IEC958_AES3_CON_FS_44100
;
1480 static int snd_microii_spdif_default_put(struct snd_kcontrol
*kcontrol
,
1481 struct snd_ctl_elem_value
*ucontrol
)
1483 struct usb_mixer_interface
*mixer
= snd_kcontrol_chip(kcontrol
);
1486 unsigned long priv_backup
= kcontrol
->private_value
;
1488 reg
= ((ucontrol
->value
.iec958
.status
[1] & 0x0f) << 4) |
1489 (ucontrol
->value
.iec958
.status
[0] & 0x0f);
1490 err
= snd_usb_ctl_msg(mixer
->chip
->dev
,
1491 usb_sndctrlpipe(mixer
->chip
->dev
, 0),
1493 USB_DIR_OUT
| USB_TYPE_VENDOR
| USB_RECIP_OTHER
,
1501 kcontrol
->private_value
&= 0xfffff0f0;
1502 kcontrol
->private_value
|= (ucontrol
->value
.iec958
.status
[1] & 0x0f) << 8;
1503 kcontrol
->private_value
|= (ucontrol
->value
.iec958
.status
[0] & 0x0f);
1505 reg
= (ucontrol
->value
.iec958
.status
[0] & IEC958_AES0_NONAUDIO
) ?
1507 reg
|= (ucontrol
->value
.iec958
.status
[1] >> 4) & 0x0f;
1508 err
= snd_usb_ctl_msg(mixer
->chip
->dev
,
1509 usb_sndctrlpipe(mixer
->chip
->dev
, 0),
1511 USB_DIR_OUT
| USB_TYPE_VENDOR
| USB_RECIP_OTHER
,
1519 kcontrol
->private_value
&= 0xffff0fff;
1520 kcontrol
->private_value
|= (ucontrol
->value
.iec958
.status
[1] & 0xf0) << 8;
1522 /* The frequency bits in AES3 cannot be set via register access. */
1524 /* Silently ignore any bits from the request that cannot be set. */
1526 err
= (priv_backup
!= kcontrol
->private_value
);
1531 static int snd_microii_spdif_mask_get(struct snd_kcontrol
*kcontrol
,
1532 struct snd_ctl_elem_value
*ucontrol
)
1534 ucontrol
->value
.iec958
.status
[0] = 0x0f;
1535 ucontrol
->value
.iec958
.status
[1] = 0xff;
1536 ucontrol
->value
.iec958
.status
[2] = 0x00;
1537 ucontrol
->value
.iec958
.status
[3] = 0x00;
1542 static int snd_microii_spdif_switch_get(struct snd_kcontrol
*kcontrol
,
1543 struct snd_ctl_elem_value
*ucontrol
)
1545 ucontrol
->value
.integer
.value
[0] = !(kcontrol
->private_value
& 0x02);
1550 static int snd_microii_spdif_switch_put(struct snd_kcontrol
*kcontrol
,
1551 struct snd_ctl_elem_value
*ucontrol
)
1553 struct usb_mixer_interface
*mixer
= snd_kcontrol_chip(kcontrol
);
1555 u8 reg
= ucontrol
->value
.integer
.value
[0] ? 0x28 : 0x2a;
1557 err
= snd_usb_ctl_msg(mixer
->chip
->dev
,
1558 usb_sndctrlpipe(mixer
->chip
->dev
, 0),
1560 USB_DIR_OUT
| USB_TYPE_VENDOR
| USB_RECIP_OTHER
,
1567 err
= (reg
!= (kcontrol
->private_value
& 0x0ff));
1569 kcontrol
->private_value
= reg
;
1575 static struct snd_kcontrol_new snd_microii_mixer_spdif
[] = {
1577 .iface
= SNDRV_CTL_ELEM_IFACE_PCM
,
1578 .name
= SNDRV_CTL_NAME_IEC958("", PLAYBACK
, DEFAULT
),
1579 .info
= snd_microii_spdif_info
,
1580 .get
= snd_microii_spdif_default_get
,
1581 .put
= snd_microii_spdif_default_put
,
1582 .private_value
= 0x00000100UL
,/* reset value */
1585 .access
= SNDRV_CTL_ELEM_ACCESS_READ
,
1586 .iface
= SNDRV_CTL_ELEM_IFACE_PCM
,
1587 .name
= SNDRV_CTL_NAME_IEC958("", PLAYBACK
, MASK
),
1588 .info
= snd_microii_spdif_info
,
1589 .get
= snd_microii_spdif_mask_get
,
1592 .iface
= SNDRV_CTL_ELEM_IFACE_MIXER
,
1593 .name
= SNDRV_CTL_NAME_IEC958("", PLAYBACK
, SWITCH
),
1594 .info
= snd_ctl_boolean_mono_info
,
1595 .get
= snd_microii_spdif_switch_get
,
1596 .put
= snd_microii_spdif_switch_put
,
1597 .private_value
= 0x00000028UL
,/* reset value */
1601 static int snd_microii_controls_create(struct usb_mixer_interface
*mixer
)
1605 for (i
= 0; i
< ARRAY_SIZE(snd_microii_mixer_spdif
); ++i
) {
1606 err
= snd_ctl_add(mixer
->chip
->card
,
1607 snd_ctl_new1(&snd_microii_mixer_spdif
[i
], mixer
));
1615 int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface
*mixer
)
1618 struct snd_info_entry
*entry
;
1620 if ((err
= snd_usb_soundblaster_remote_init(mixer
)) < 0)
1623 switch (mixer
->chip
->usb_id
) {
1624 case USB_ID(0x041e, 0x3020):
1625 case USB_ID(0x041e, 0x3040):
1626 case USB_ID(0x041e, 0x3042):
1627 case USB_ID(0x041e, 0x30df):
1628 case USB_ID(0x041e, 0x3048):
1629 err
= snd_audigy2nx_controls_create(mixer
);
1632 if (!snd_card_proc_new(mixer
->chip
->card
, "audigy2nx", &entry
))
1633 snd_info_set_text_ops(entry
, mixer
,
1634 snd_audigy2nx_proc_read
);
1638 case USB_ID(0x041e, 0x3f19):
1639 err
= snd_emu0204_controls_create(mixer
);
1644 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
1645 case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C400 */
1646 err
= snd_c400_create_mixer(mixer
);
1649 case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */
1650 case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */
1651 err
= snd_ftu_create_mixer(mixer
);
1654 case USB_ID(0x0b05, 0x1739): /* ASUS Xonar U1 */
1655 case USB_ID(0x0b05, 0x1743): /* ASUS Xonar U1 (2) */
1656 case USB_ID(0x0b05, 0x17a0): /* ASUS Xonar U3 */
1657 err
= snd_xonar_u1_controls_create(mixer
);
1660 case USB_ID(0x0d8c, 0x0103): /* Audio Advantage Micro II */
1661 err
= snd_microii_controls_create(mixer
);
1664 case USB_ID(0x17cc, 0x1011): /* Traktor Audio 6 */
1665 err
= snd_nativeinstruments_create_mixer(mixer
,
1666 snd_nativeinstruments_ta6_mixers
,
1667 ARRAY_SIZE(snd_nativeinstruments_ta6_mixers
));
1670 case USB_ID(0x17cc, 0x1021): /* Traktor Audio 10 */
1671 err
= snd_nativeinstruments_create_mixer(mixer
,
1672 snd_nativeinstruments_ta10_mixers
,
1673 ARRAY_SIZE(snd_nativeinstruments_ta10_mixers
));
1676 case USB_ID(0x200c, 0x1018): /* Electrix Ebox-44 */
1677 /* detection is disabled in mixer_maps.c */
1678 err
= snd_create_std_mono_table(mixer
, ebox44_table
);
1685 void snd_usb_mixer_rc_memory_change(struct usb_mixer_interface
*mixer
,
1690 /* unit ids specific to Extigy/Audigy 2 NX: */
1692 case 0: /* remote control */
1693 mixer
->rc_urb
->dev
= mixer
->chip
->dev
;
1694 usb_submit_urb(mixer
->rc_urb
, GFP_ATOMIC
);
1696 case 4: /* digital in jack */
1697 case 7: /* line in jacks */
1698 case 19: /* speaker out jacks */
1699 case 20: /* headphones out jack */
1701 /* live24ext: 4 = line-in jack */
1702 case 3: /* hp-out jack (may actuate Mute) */
1703 if (mixer
->chip
->usb_id
== USB_ID(0x041e, 0x3040) ||
1704 mixer
->chip
->usb_id
== USB_ID(0x041e, 0x3048))
1705 snd_usb_mixer_notify_id(mixer
, mixer
->rc_cfg
->mute_mixer_id
);
1708 usb_audio_dbg(mixer
->chip
, "memory change in unknown unit %d\n", unitid
);