aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb/usbaudio.c
diff options
context:
space:
mode:
authorSergiy Kovalchuk <cnb_zerg@yahoo.com>2009-12-27 12:13:41 -0500
committerTakashi Iwai <tiwai@suse.de>2009-12-28 06:29:39 -0500
commit7d2b451e65d255427c108e990507964ac39c13ee (patch)
tree86e977405ae88b08fa74dff3202c9f88207dfacb /sound/usb/usbaudio.c
parent44eba3e82b35ae796826a65d8040001582adc10a (diff)
ALSA: usb-audio - Added functionality for E-mu 0404USB/0202USB/TrackerPre
Added functionality: 1) Extension Units support (all XU settings now available at alsamixer, kmix, etc): - "AnalogueIn soft limiter" switch; - "Sample rate" selector (values 0,1,2,3,4,5 corresponds to 44.1 48 ... 192 kHz); - "DigitalIn CLK source" selector (internal/external) (**); - "DigitalOut format SPDIF/AC3" switch (**); (**)E-mu-0404usb only. 2) Automatic device sample rate adjustment depending on substream samplerate for both capture and playback substream. [minor coding-style fixes by tiwai] Signed-off-by: Sergiy Kovalchuk <cnb_zerg@yahoo.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/usbaudio.c')
-rw-r--r--sound/usb/usbaudio.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 31b63ea098b7..286fa14e48bd 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -1271,6 +1271,47 @@ static int init_usb_sample_rate(struct usb_device *dev, int iface,
1271} 1271}
1272 1272
1273/* 1273/*
1274 * For E-Mu 0404USB/0202USB/TrackerPre sample rate should be set for device,
1275 * not for interface.
1276 */
1277static void set_format_emu_quirk(struct snd_usb_substream *subs,
1278 struct audioformat *fmt)
1279{
1280 unsigned char emu_samplerate_id = 0;
1281
1282 /* When capture is active
1283 * sample rate shouldn't be changed
1284 * by playback substream
1285 */
1286 if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) {
1287 if (subs->stream->substream[SNDRV_PCM_STREAM_CAPTURE].interface != -1)
1288 return;
1289 }
1290
1291 switch (fmt->rate_min) {
1292 case 48000:
1293 emu_samplerate_id = EMU_QUIRK_SR_48000HZ;
1294 break;
1295 case 88200:
1296 emu_samplerate_id = EMU_QUIRK_SR_88200HZ;
1297 break;
1298 case 96000:
1299 emu_samplerate_id = EMU_QUIRK_SR_96000HZ;
1300 break;
1301 case 176400:
1302 emu_samplerate_id = EMU_QUIRK_SR_176400HZ;
1303 break;
1304 case 192000:
1305 emu_samplerate_id = EMU_QUIRK_SR_192000HZ;
1306 break;
1307 default:
1308 emu_samplerate_id = EMU_QUIRK_SR_44100HZ;
1309 break;
1310 }
1311 snd_emuusb_set_samplerate(subs->stream->chip, emu_samplerate_id);
1312}
1313
1314/*
1274 * find a matching format and set up the interface 1315 * find a matching format and set up the interface
1275 */ 1316 */
1276static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) 1317static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
@@ -1383,6 +1424,14 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
1383 1424
1384 subs->cur_audiofmt = fmt; 1425 subs->cur_audiofmt = fmt;
1385 1426
1427 switch (subs->stream->chip->usb_id) {
1428 case USB_ID(0x041e, 0x3f02): /* E-Mu 0202 USB */
1429 case USB_ID(0x041e, 0x3f04): /* E-Mu 0404 USB */
1430 case USB_ID(0x041e, 0x3f0a): /* E-Mu Tracker Pre */
1431 set_format_emu_quirk(subs, fmt);
1432 break;
1433 }
1434
1386#if 0 1435#if 0
1387 printk(KERN_DEBUG 1436 printk(KERN_DEBUG
1388 "setting done: format = %d, rate = %d..%d, channels = %d\n", 1437 "setting done: format = %d, rate = %d..%d, channels = %d\n",