diff options
Diffstat (limited to 'sound/usb/usbmixer.c')
-rw-r--r-- | sound/usb/usbmixer.c | 75 |
1 files changed, 71 insertions, 4 deletions
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index c72ad0c82581..dd0c1d7bf3ed 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -187,6 +187,21 @@ enum { | |||
187 | USB_PROC_DCR_RELEASE = 6, | 187 | USB_PROC_DCR_RELEASE = 6, |
188 | }; | 188 | }; |
189 | 189 | ||
190 | /*E-mu 0202(0404) eXtension Unit(XU) control*/ | ||
191 | enum { | ||
192 | USB_XU_CLOCK_RATE = 0xe301, | ||
193 | USB_XU_CLOCK_SOURCE = 0xe302, | ||
194 | USB_XU_DIGITAL_IO_STATUS = 0xe303, | ||
195 | USB_XU_DEVICE_OPTIONS = 0xe304, | ||
196 | USB_XU_DIRECT_MONITORING = 0xe305, | ||
197 | USB_XU_METERING = 0xe306 | ||
198 | }; | ||
199 | enum { | ||
200 | USB_XU_CLOCK_SOURCE_SELECTOR = 0x02, /* clock source*/ | ||
201 | USB_XU_CLOCK_RATE_SELECTOR = 0x03, /* clock rate */ | ||
202 | USB_XU_DIGITAL_FORMAT_SELECTOR = 0x01, /* the spdif format */ | ||
203 | USB_XU_SOFT_LIMIT_SELECTOR = 0x03 /* soft limiter */ | ||
204 | }; | ||
190 | 205 | ||
191 | /* | 206 | /* |
192 | * manual mapping of mixer names | 207 | * manual mapping of mixer names |
@@ -1352,7 +1367,32 @@ static struct procunit_info procunits[] = { | |||
1352 | { USB_PROC_DCR, "DCR", dcr_proc_info }, | 1367 | { USB_PROC_DCR, "DCR", dcr_proc_info }, |
1353 | { 0 }, | 1368 | { 0 }, |
1354 | }; | 1369 | }; |
1355 | 1370 | /* | |
1371 | * predefined data for extension units | ||
1372 | */ | ||
1373 | static struct procunit_value_info clock_rate_xu_info[] = { | ||
1374 | { USB_XU_CLOCK_RATE_SELECTOR, "Selector", USB_MIXER_U8, 0 }, | ||
1375 | { 0 } | ||
1376 | }; | ||
1377 | static struct procunit_value_info clock_source_xu_info[] = { | ||
1378 | { USB_XU_CLOCK_SOURCE_SELECTOR, "External", USB_MIXER_BOOLEAN }, | ||
1379 | { 0 } | ||
1380 | }; | ||
1381 | static struct procunit_value_info spdif_format_xu_info[] = { | ||
1382 | { USB_XU_DIGITAL_FORMAT_SELECTOR, "SPDIF/AC3", USB_MIXER_BOOLEAN }, | ||
1383 | { 0 } | ||
1384 | }; | ||
1385 | static struct procunit_value_info soft_limit_xu_info[] = { | ||
1386 | { USB_XU_SOFT_LIMIT_SELECTOR, " ", USB_MIXER_BOOLEAN }, | ||
1387 | { 0 } | ||
1388 | }; | ||
1389 | static struct procunit_info extunits[] = { | ||
1390 | { USB_XU_CLOCK_RATE, "Clock rate", clock_rate_xu_info }, | ||
1391 | { USB_XU_CLOCK_SOURCE, "DigitalIn CLK source", clock_source_xu_info }, | ||
1392 | { USB_XU_DIGITAL_IO_STATUS, "DigitalOut format:", spdif_format_xu_info }, | ||
1393 | { USB_XU_DEVICE_OPTIONS, "AnalogueIn Soft Limit", soft_limit_xu_info }, | ||
1394 | { 0 } | ||
1395 | }; | ||
1356 | /* | 1396 | /* |
1357 | * build a processing/extension unit | 1397 | * build a processing/extension unit |
1358 | */ | 1398 | */ |
@@ -1415,8 +1455,18 @@ static int build_audio_procunit(struct mixer_build *state, int unitid, unsigned | |||
1415 | cval->max = dsc[15]; | 1455 | cval->max = dsc[15]; |
1416 | cval->res = 1; | 1456 | cval->res = 1; |
1417 | cval->initialized = 1; | 1457 | cval->initialized = 1; |
1418 | } else | 1458 | } else { |
1419 | get_min_max(cval, valinfo->min_value); | 1459 | if (type == USB_XU_CLOCK_RATE) { |
1460 | /* E-Mu USB 0404/0202/TrackerPre | ||
1461 | * samplerate control quirk | ||
1462 | */ | ||
1463 | cval->min = 0; | ||
1464 | cval->max = 5; | ||
1465 | cval->res = 1; | ||
1466 | cval->initialized = 1; | ||
1467 | } else | ||
1468 | get_min_max(cval, valinfo->min_value); | ||
1469 | } | ||
1420 | 1470 | ||
1421 | kctl = snd_ctl_new1(&mixer_procunit_ctl, cval); | 1471 | kctl = snd_ctl_new1(&mixer_procunit_ctl, cval); |
1422 | if (! kctl) { | 1472 | if (! kctl) { |
@@ -1458,7 +1508,7 @@ static int parse_audio_processing_unit(struct mixer_build *state, int unitid, un | |||
1458 | 1508 | ||
1459 | static int parse_audio_extension_unit(struct mixer_build *state, int unitid, unsigned char *desc) | 1509 | static int parse_audio_extension_unit(struct mixer_build *state, int unitid, unsigned char *desc) |
1460 | { | 1510 | { |
1461 | return build_audio_procunit(state, unitid, desc, NULL, "Extension Unit"); | 1511 | return build_audio_procunit(state, unitid, desc, extunits, "Extension Unit"); |
1462 | } | 1512 | } |
1463 | 1513 | ||
1464 | 1514 | ||
@@ -2136,6 +2186,23 @@ static int snd_xonar_u1_controls_create(struct usb_mixer_interface *mixer) | |||
2136 | return 0; | 2186 | return 0; |
2137 | } | 2187 | } |
2138 | 2188 | ||
2189 | void snd_emuusb_set_samplerate(struct snd_usb_audio *chip, | ||
2190 | unsigned char samplerate_id) | ||
2191 | { | ||
2192 | struct usb_mixer_interface *mixer; | ||
2193 | struct usb_mixer_elem_info *cval; | ||
2194 | int unitid = 12; /* SamleRate ExtensionUnit ID */ | ||
2195 | |||
2196 | list_for_each_entry(mixer, &chip->mixer_list, list) { | ||
2197 | cval = mixer->id_elems[unitid]; | ||
2198 | if (cval) { | ||
2199 | set_cur_ctl_value(cval, cval->control << 8, samplerate_id); | ||
2200 | snd_usb_mixer_notify_id(mixer, unitid); | ||
2201 | } | ||
2202 | break; | ||
2203 | } | ||
2204 | } | ||
2205 | |||
2139 | int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, | 2206 | int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, |
2140 | int ignore_error) | 2207 | int ignore_error) |
2141 | { | 2208 | { |