aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbmixer.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-09-10 09:33:07 -0400
committerTakashi Iwai <tiwai@suse.de>2009-09-10 09:33:07 -0400
commitfd30afa454282bbe1b36d5d77bd72c0ea5b3f97c (patch)
tree37557d4c96d89641eef362995322547b91b24669 /sound/usb/usbmixer.c
parentb34c8663940dfc7da767c42b37605e5ad3ae11f7 (diff)
parentf1e6d3c5cf86675e54a17a89668aa6685d2ef59d (diff)
Merge branch 'topic/usb-audio' into for-linus
* topic/usb-audio: ALSA: usb-audio - Fix types taken in min() sound: usb-audio: do not make URBs longer than sync packet interval sound: usb-audio: add MIDI drain callback sound: usb-audio: use multiple output URBs sound: usb-audio: use multiple input URBs sound: usb-audio: Xonar U1 digital output support
Diffstat (limited to 'sound/usb/usbmixer.c')
-rw-r--r--sound/usb/usbmixer.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index df8969188d15..ab5a3ac2ac47 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -86,6 +86,7 @@ struct usb_mixer_interface {
86 u8 rc_buffer[6]; 86 u8 rc_buffer[6];
87 87
88 u8 audigy2nx_leds[3]; 88 u8 audigy2nx_leds[3];
89 u8 xonar_u1_status;
89}; 90};
90 91
91 92
@@ -2042,6 +2043,58 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry,
2042 } 2043 }
2043} 2044}
2044 2045
2046static int snd_xonar_u1_switch_get(struct snd_kcontrol *kcontrol,
2047 struct snd_ctl_elem_value *ucontrol)
2048{
2049 struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol);
2050
2051 ucontrol->value.integer.value[0] = !!(mixer->xonar_u1_status & 0x02);
2052 return 0;
2053}
2054
2055static int snd_xonar_u1_switch_put(struct snd_kcontrol *kcontrol,
2056 struct snd_ctl_elem_value *ucontrol)
2057{
2058 struct usb_mixer_interface *mixer = snd_kcontrol_chip(kcontrol);
2059 u8 old_status, new_status;
2060 int err, changed;
2061
2062 old_status = mixer->xonar_u1_status;
2063 if (ucontrol->value.integer.value[0])
2064 new_status = old_status | 0x02;
2065 else
2066 new_status = old_status & ~0x02;
2067 changed = new_status != old_status;
2068 err = snd_usb_ctl_msg(mixer->chip->dev,
2069 usb_sndctrlpipe(mixer->chip->dev, 0), 0x08,
2070 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
2071 50, 0, &new_status, 1, 100);
2072 if (err < 0)
2073 return err;
2074 mixer->xonar_u1_status = new_status;
2075 return changed;
2076}
2077
2078static struct snd_kcontrol_new snd_xonar_u1_output_switch = {
2079 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2080 .name = "Digital Playback Switch",
2081 .info = snd_ctl_boolean_mono_info,
2082 .get = snd_xonar_u1_switch_get,
2083 .put = snd_xonar_u1_switch_put,
2084};
2085
2086static int snd_xonar_u1_controls_create(struct usb_mixer_interface *mixer)
2087{
2088 int err;
2089
2090 err = snd_ctl_add(mixer->chip->card,
2091 snd_ctl_new1(&snd_xonar_u1_output_switch, mixer));
2092 if (err < 0)
2093 return err;
2094 mixer->xonar_u1_status = 0x05;
2095 return 0;
2096}
2097
2045int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, 2098int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
2046 int ignore_error) 2099 int ignore_error)
2047{ 2100{
@@ -2084,6 +2137,13 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,
2084 snd_audigy2nx_proc_read); 2137 snd_audigy2nx_proc_read);
2085 } 2138 }
2086 2139
2140 if (mixer->chip->usb_id == USB_ID(0x0b05, 0x1739) ||
2141 mixer->chip->usb_id == USB_ID(0x0b05, 0x1743)) {
2142 err = snd_xonar_u1_controls_create(mixer);
2143 if (err < 0)
2144 goto _error;
2145 }
2146
2087 err = snd_device_new(chip->card, SNDRV_DEV_LOWLEVEL, mixer, &dev_ops); 2147 err = snd_device_new(chip->card, SNDRV_DEV_LOWLEVEL, mixer, &dev_ops);
2088 if (err < 0) 2148 if (err < 0)
2089 goto _error; 2149 goto _error;