···280 no: ACPI OperationRegions are not marked as reserved,281 no further checks are performed.282283- ad1848= [HW,OSS]284- Format: <io>,<irq>,<dma>,<dma2>,<type>285-286 add_efi_memmap [EFI; X86] Include EFI memory map in287 kernel's map of available physical RAM.288289 advansys= [HW,SCSI]290 See header of drivers/scsi/advansys.c.291-292- aedsp16= [HW,OSS] Audio Excel DSP 16293- Format: <io>,<irq>,<dma>,<mss_io>,<mpu_io>,<mpu_irq>294- See also header of sound/oss/aedsp16.c.295296 agp= [AGP]297 { off | try_unsupported }···303304 aic79xx= [HW,SCSI]305 See Documentation/scsi/aic79xx.txt.000306307 alignment= [KNL,ARM]308 Allow the default userspace alignment fault handler···650 disable_timer_pin_1 [X86]651 Disable PIN 1 of APIC timer652 Can be useful to work around chipset bugs.653-654- dmasound= [HW,OSS] Sound subsystem buffers655656 dma_debug=off If the kernel is compiled with DMA_API_DEBUG support,657 this option disables the debugging code at boot.···1517 that the amount of memory usable for all allocations1518 is not too small.15191520- mpu401= [HW,OSS]1521- Format: <io>,<irq>1522-1523 MTD_Partition= [MTD]1524 Format: <name>,<region-number>,<size>,<offset>1525···1840 For example, to override I2C bus2:1841 omap_mux=i2c2_scl.i2c2_scl=0x100,i2c2_sda.i2c2_sda=0x10018421843- opl3= [HW,OSS]1844- Format: <io>1845-1846 oprofile.timer= [HW]1847 Use timer interrupt instead of performance counters1848···1850 arch_perfmon: [X86] Force use of architectural1851 perfmon on Intel CPUs instead of the1852 CPU specific event set.00018531854 osst= [HW,SCSI] SCSI Tape Driver1855 Format: <buffer_size>,<write_threshold>···1889 up parallel port mode and sets it to spp.1890 Currently this function knows 686a and 8231 chips.1891 Format: [spp|ps2|epp|ecp|ecpepp]1892-1893- pas2= [HW,OSS] Format:1894- <io>,<irq>,<dma>,<dma16>,<sb_io>,<sb_irq>,<sb_dma>,<sb_dma16>18951896 pas16= [HW,SCSI]1897 See header of drivers/scsi/pas16.c.···2159 [HW,MOUSE] Controls Logitech smartscroll autorepeat.2160 0 = disabled, 1 = enabled (default).21612162- pss= [HW,OSS] Personal Sound System (ECHO ESC614)2163- Format:2164- <io>,<mss_io>,<mss_irq>,<mss_dma>,<mpu_io>,<mpu_irq>2165-2166 pt. [PARIDE]2167 See Documentation/blockdev/paride.txt.2168···2367 1: Fast pin select (default)2368 2: ATC IRMode23692370- snd-ad1816a= [HW,ALSA]2371-2372- snd-ad1848= [HW,ALSA]2373-2374- snd-ali5451= [HW,ALSA]2375-2376- snd-als100= [HW,ALSA]2377-2378- snd-als4000= [HW,ALSA]2379-2380- snd-azt2320= [HW,ALSA]2381-2382- snd-cmi8330= [HW,ALSA]2383-2384- snd-cmipci= [HW,ALSA]2385-2386- snd-cs4231= [HW,ALSA]2387-2388- snd-cs4232= [HW,ALSA]2389-2390- snd-cs4236= [HW,ALSA]2391-2392- snd-cs4281= [HW,ALSA]2393-2394- snd-cs46xx= [HW,ALSA]2395-2396- snd-dt019x= [HW,ALSA]2397-2398- snd-dummy= [HW,ALSA]2399-2400- snd-emu10k1= [HW,ALSA]2401-2402- snd-ens1370= [HW,ALSA]2403-2404- snd-ens1371= [HW,ALSA]2405-2406- snd-es968= [HW,ALSA]2407-2408- snd-es1688= [HW,ALSA]2409-2410- snd-es18xx= [HW,ALSA]2411-2412- snd-es1938= [HW,ALSA]2413-2414- snd-es1968= [HW,ALSA]2415-2416- snd-fm801= [HW,ALSA]2417-2418- snd-gusclassic= [HW,ALSA]2419-2420- snd-gusextreme= [HW,ALSA]2421-2422- snd-gusmax= [HW,ALSA]2423-2424- snd-hdsp= [HW,ALSA]2425-2426- snd-ice1712= [HW,ALSA]2427-2428- snd-intel8x0= [HW,ALSA]2429-2430- snd-interwave= [HW,ALSA]2431-2432- snd-interwave-stb=2433- [HW,ALSA]2434-2435- snd-korg1212= [HW,ALSA]2436-2437- snd-maestro3= [HW,ALSA]2438-2439- snd-mpu401= [HW,ALSA]2440-2441- snd-mtpav= [HW,ALSA]2442-2443- snd-nm256= [HW,ALSA]2444-2445- snd-opl3sa2= [HW,ALSA]2446-2447- snd-opti92x-ad1848=2448- [HW,ALSA]2449-2450- snd-opti92x-cs4231=2451- [HW,ALSA]2452-2453- snd-opti93x= [HW,ALSA]2454-2455- snd-pmac= [HW,ALSA]2456-2457- snd-rme32= [HW,ALSA]2458-2459- snd-rme96= [HW,ALSA]2460-2461- snd-rme9652= [HW,ALSA]2462-2463- snd-sb8= [HW,ALSA]2464-2465- snd-sb16= [HW,ALSA]2466-2467- snd-sbawe= [HW,ALSA]2468-2469- snd-serial= [HW,ALSA]2470-2471- snd-sgalaxy= [HW,ALSA]2472-2473- snd-sonicvibes= [HW,ALSA]2474-2475- snd-sun-amd7930=2476- [HW,ALSA]2477-2478- snd-sun-cs4231= [HW,ALSA]2479-2480- snd-trident= [HW,ALSA]2481-2482- snd-usb-audio= [HW,ALSA,USB]2483-2484- snd-via82xx= [HW,ALSA]2485-2486- snd-virmidi= [HW,ALSA]2487-2488- snd-wavefront= [HW,ALSA]2489-2490- snd-ymfpci= [HW,ALSA]2491-2492 softlockup_panic=2493 [KNL] Should the soft-lockup detector generate panics.2494···2380 spia_fio_base=2381 spia_pedr=2382 spia_peddr=2383-2384- sscape= [HW,OSS]2385- Format: <io>,<irq>,<dma>,<mpu_io>,<mpu_irq>23862387 st= [HW,SCSI] SCSI tape parameters (buffers, etc.)2388 See Documentation/scsi/st.txt.···2520 to facilitate early boot debugging.2521 See also Documentation/trace/events.txt25222523- trix= [HW,OSS] MediaTrix AudioTrix Pro2524- Format:2525- <io>,<irq>,<dma>,<dma2>,<sb_io>,<sb_irq>,<sb_dma>,<mpu_io>,<mpu_irq>2526-2527 tsc= Disable clocksource-must-verify flag for TSC.2528 Format: <string>2529 [x86] reliable: mark tsc clocksource as reliable, this···25352536 u14-34f= [HW,SCSI] UltraStor 14F/34F SCSI host adapter2537 See header of drivers/scsi/u14-34f.c.2538-2539- uart401= [HW,OSS]2540- Format: <io>,<irq>2541-2542- uart6850= [HW,OSS]2543- Format: <io>,<irq>25442545 uhash_entries= [KNL,NET]2546 Set number of hash buckets for UDP/UDP-Lite connections···2701 overridden by individual drivers. 0 will hide2702 cursors, 1 will display them.27032704- waveartist= [HW,OSS]2705- Format: <io>,<irq>,<dma>,<dma2>2706-2707 wd33c93= [HW,SCSI]2708 See header of drivers/scsi/wd33c93.c.2709···27332734TODO:27352736- Add documentation for ALSA options.2737 Add more DRM drivers.
···280 no: ACPI OperationRegions are not marked as reserved,281 no further checks are performed.282000283 add_efi_memmap [EFI; X86] Include EFI memory map in284 kernel's map of available physical RAM.285286 advansys= [HW,SCSI]287 See header of drivers/scsi/advansys.c.0000288289 agp= [AGP]290 { off | try_unsupported }···310311 aic79xx= [HW,SCSI]312 See Documentation/scsi/aic79xx.txt.313+314+ ALSA [HW,ALSA]315+ See Documentation/sound/alsa/alsa-parameters.txt316317 alignment= [KNL,ARM]318 Allow the default userspace alignment fault handler···654 disable_timer_pin_1 [X86]655 Disable PIN 1 of APIC timer656 Can be useful to work around chipset bugs.00657658 dma_debug=off If the kernel is compiled with DMA_API_DEBUG support,659 this option disables the debugging code at boot.···1523 that the amount of memory usable for all allocations1524 is not too small.15250001526 MTD_Partition= [MTD]1527 Format: <name>,<region-number>,<size>,<offset>1528···1849 For example, to override I2C bus2:1850 omap_mux=i2c2_scl.i2c2_scl=0x100,i2c2_sda.i2c2_sda=0x10018510001852 oprofile.timer= [HW]1853 Use timer interrupt instead of performance counters1854···1862 arch_perfmon: [X86] Force use of architectural1863 perfmon on Intel CPUs instead of the1864 CPU specific event set.1865+1866+ OSS [HW,OSS]1867+ See Documentation/sound/oss/oss-parameters.txt18681869 osst= [HW,SCSI] SCSI Tape Driver1870 Format: <buffer_size>,<write_threshold>···1898 up parallel port mode and sets it to spp.1899 Currently this function knows 686a and 8231 chips.1900 Format: [spp|ps2|epp|ecp|ecpepp]00019011902 pas16= [HW,SCSI]1903 See header of drivers/scsi/pas16.c.···2171 [HW,MOUSE] Controls Logitech smartscroll autorepeat.2172 0 = disabled, 1 = enabled (default).217300002174 pt. [PARIDE]2175 See Documentation/blockdev/paride.txt.2176···2383 1: Fast pin select (default)2384 2: ATC IRMode2385000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002386 softlockup_panic=2387 [KNL] Should the soft-lockup detector generate panics.2388···2518 spia_fio_base=2519 spia_pedr=2520 spia_peddr=00025212522 st= [HW,SCSI] SCSI tape parameters (buffers, etc.)2523 See Documentation/scsi/st.txt.···2661 to facilitate early boot debugging.2662 See also Documentation/trace/events.txt266300002664 tsc= Disable clocksource-must-verify flag for TSC.2665 Format: <string>2666 [x86] reliable: mark tsc clocksource as reliable, this···26802681 u14-34f= [HW,SCSI] UltraStor 14F/34F SCSI host adapter2682 See header of drivers/scsi/u14-34f.c.00000026832684 uhash_entries= [KNL,NET]2685 Set number of hash buckets for UDP/UDP-Lite connections···2852 overridden by individual drivers. 0 will hide2853 cursors, 1 will display them.28540002855 wd33c93= [HW,SCSI]2856 See header of drivers/scsi/wd33c93.c.2857···28872888TODO:288902890 Add more DRM drivers.
+8
Documentation/sound/alsa/Procfile.txt
···103 bit 2 = Enable additional jiffies check104 bit 3 = Log hwptr update at each period interrupt105 bit 4 = Log hwptr update at each snd_pcm_update_hw_ptr()00106107 When the bit 0 is set, the driver will show the messages to108 kernel log when an xrun is detected. The debug message is···123124 Bits 3 and 4 are for logging the hwptr records. Note that125 these will give flood of kernel messages.000000126127card*/pcm*/sub*/info128 The general information of this PCM sub-stream.
···103 bit 2 = Enable additional jiffies check104 bit 3 = Log hwptr update at each period interrupt105 bit 4 = Log hwptr update at each snd_pcm_update_hw_ptr()106+ bit 5 = Show last 10 positions on error107+ bit 6 = Do above only once108109 When the bit 0 is set, the driver will show the messages to110 kernel log when an xrun is detected. The debug message is···121122 Bits 3 and 4 are for logging the hwptr records. Note that123 these will give flood of kernel messages.124+125+ When bit 5 is set, the driver logs the last 10 xrun errors and126+ the proc file shows each jiffies, position, period_size,127+ buffer_size, old_hw_ptr, and hw_ptr_base values.128+129+ When bit 6 is set, the full xrun log is shown only once.130131card*/pcm*/sub*/info132 The general information of this PCM sub-stream.
···1+ OSS Kernel Parameters2+ ~~~~~~~~~~~~~~~~~~~~~3+4+See Documentation/kernel-parameters.txt for general information on5+specifying module parameters.6+7+This document may not be entirely up to date and comprehensive. The command8+"modinfo -p ${modulename}" shows a current list of all parameters of a loadable9+module. Loadable modules, after being loaded into the running kernel, also10+reveal their parameters in /sys/module/${modulename}/parameters/. Some of these11+parameters may be changed at runtime by the command12+"echo -n ${value} > /sys/module/${modulename}/parameters/${parm}".13+14+15+ ad1848= [HW,OSS]16+ Format: <io>,<irq>,<dma>,<dma2>,<type>17+18+ aedsp16= [HW,OSS] Audio Excel DSP 1619+ Format: <io>,<irq>,<dma>,<mss_io>,<mpu_io>,<mpu_irq>20+ See also header of sound/oss/aedsp16.c.21+22+ dmasound= [HW,OSS] Sound subsystem buffers23+24+ mpu401= [HW,OSS]25+ Format: <io>,<irq>26+27+ opl3= [HW,OSS]28+ Format: <io>29+30+ pas2= [HW,OSS] Format:31+ <io>,<irq>,<dma>,<dma16>,<sb_io>,<sb_irq>,<sb_dma>,<sb_dma16>32+33+ pss= [HW,OSS] Personal Sound System (ECHO ESC614)34+ Format:35+ <io>,<mss_io>,<mss_irq>,<mss_dma>,<mpu_io>,<mpu_irq>36+37+ sscape= [HW,OSS]38+ Format: <io>,<irq>,<dma>,<mpu_io>,<mpu_irq>39+40+ trix= [HW,OSS] MediaTrix AudioTrix Pro41+ Format:42+ <io>,<irq>,<dma>,<dma2>,<sb_io>,<sb_irq>,<sb_dma>,<mpu_io>,<mpu_irq>43+44+ uart401= [HW,OSS]45+ Format: <io>,<irq>46+47+ uart6850= [HW,OSS]48+ Format: <io>,<irq>49+50+ waveartist= [HW,OSS]51+ Format: <io>,<irq>,<dma>,<dma2>
+6
arch/um/drivers/hostaudio_kern.c
···8#include "linux/slab.h"9#include "linux/sound.h"10#include "linux/soundcard.h"011#include "asm/uaccess.h"12#include "init.h"13#include "os.h"···199 if (file->f_mode & FMODE_WRITE)200 w = 1;2010202 ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0);00203 if (ret < 0) {204 kfree(state);205 return ret;···258 if (file->f_mode & FMODE_WRITE)259 w = 1;2600261 ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0);0262263 if (ret < 0) {264 printk(KERN_ERR "hostaudio_open_mixdev failed to open '%s', "
···8#include "linux/slab.h"9#include "linux/sound.h"10#include "linux/soundcard.h"11+#include "linux/smp_lock.h"12#include "asm/uaccess.h"13#include "init.h"14#include "os.h"···198 if (file->f_mode & FMODE_WRITE)199 w = 1;200201+ lock_kernel();202 ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0);203+ unlock_kernel();204+205 if (ret < 0) {206 kfree(state);207 return ret;···254 if (file->f_mode & FMODE_WRITE)255 w = 1;256257+ lock_kernel();258 ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0);259+ unlock_kernel();260261 if (ret < 0) {262 printk(KERN_ERR "hostaudio_open_mixdev failed to open '%s', "
···18/* v1.0 and v2.0 of this standard have many things in common. For the rest19 * of the definitions, please refer to audio.h */2000000000000000021static inline bool uac2_control_is_readable(u32 bmControls, u8 control)22{23 return (bmControls >> (control * 2)) & 0x1;···136137/* 4.9.2 Class-Specific AS Interface Descriptor */138139-struct uac_as_header_descriptor_v2 {140 __u8 bLength;141 __u8 bDescriptorType;142 __u8 bDescriptorSubtype;
···18/* v1.0 and v2.0 of this standard have many things in common. For the rest19 * of the definitions, please refer to audio.h */2021+/*22+ * bmControl field decoders23+ *24+ * From the USB Audio spec v2.0:25+ *26+ * bmaControls() is a (ch+1)-element array of 4-byte bitmaps,27+ * each containing a set of bit pairs. If a Control is present,28+ * it must be Host readable. If a certain Control is not29+ * present then the bit pair must be set to 0b00.30+ * If a Control is present but read-only, the bit pair must be31+ * set to 0b01. If a Control is also Host programmable, the bit32+ * pair must be set to 0b11. The value 0b10 is not allowed.33+ *34+ */35+36static inline bool uac2_control_is_readable(u32 bmControls, u8 control)37{38 return (bmControls >> (control * 2)) & 0x1;···121122/* 4.9.2 Class-Specific AS Interface Descriptor */123124+struct uac2_as_header_descriptor {125 __u8 bLength;126 __u8 bDescriptorType;127 __u8 bDescriptorSubtype;
+6-6
include/linux/usb/audio.h
···39#define UAC_MIXER_UNIT 0x0440#define UAC_SELECTOR_UNIT 0x0541#define UAC_FEATURE_UNIT 0x0642-#define UAC_PROCESSING_UNIT_V1 0x0743-#define UAC_EXTENSION_UNIT_V1 0x084445/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */46#define UAC_AS_GENERAL 0x01···151152/* Terminal Control Selectors */153/* 4.3.2 Class-Specific AC Interface Descriptor */154-struct uac_ac_header_descriptor_v1 {155 __u8 bLength; /* 8 + n */156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */···165166/* As above, but more useful for defining your own descriptors: */167#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \168-struct uac_ac_header_descriptor_v1_##n { \169 __u8 bLength; \170 __u8 bDescriptorType; \171 __u8 bDescriptorSubtype; \···205#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01206207/* 4.3.2.2 Output Terminal Descriptor */208-struct uac_output_terminal_descriptor_v1 {209 __u8 bLength; /* in bytes: 9 */210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */···395}396397/* 4.5.2 Class-Specific AS Interface Descriptor */398-struct uac_as_header_descriptor_v1 {399 __u8 bLength; /* in bytes: 7 */400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */401 __u8 bDescriptorSubtype; /* AS_GENERAL */
···39#define UAC_MIXER_UNIT 0x0440#define UAC_SELECTOR_UNIT 0x0541#define UAC_FEATURE_UNIT 0x0642+#define UAC1_PROCESSING_UNIT 0x0743+#define UAC1_EXTENSION_UNIT 0x084445/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */46#define UAC_AS_GENERAL 0x01···151152/* Terminal Control Selectors */153/* 4.3.2 Class-Specific AC Interface Descriptor */154+struct uac1_ac_header_descriptor {155 __u8 bLength; /* 8 + n */156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */···165166/* As above, but more useful for defining your own descriptors: */167#define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \168+struct uac1_ac_header_descriptor_##n { \169 __u8 bLength; \170 __u8 bDescriptorType; \171 __u8 bDescriptorSubtype; \···205#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01206207/* 4.3.2.2 Output Terminal Descriptor */208+struct uac1_output_terminal_descriptor {209 __u8 bLength; /* in bytes: 9 */210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */···395}396397/* 4.5.2 Class-Specific AS Interface Descriptor */398+struct uac1_as_header_descriptor {399 __u8 bLength; /* in bytes: 7 */400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */401 __u8 bDescriptorSubtype; /* AS_GENERAL */
+5-1
include/sound/asound.h
···212#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */213#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */214#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */215-#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_U18_3BE0000216217#ifdef SNDRV_LITTLE_ENDIAN218#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
···212#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */213#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */214#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */215+#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */216+#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */217+#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */218+#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */219+#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_G723_40_1B220221#ifdef SNDRV_LITTLE_ENDIAN222#define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
···170 AC97 codecs. In this mode, the power-mode is dynamically171 controlled at each open/close.172173- The mode is activated by passing power_save=1 option to174- snd-ac97-codec driver. You can toggle it dynamically over175- sysfs, too.0000000000000000176177config SND_AC97_POWER_SAVE_DEFAULT178 int "Default time-out for AC97 power-save mode"···197 help198 The default time-out value in seconds for AC97 automatic199 power-save mode. 0 means to disable the power-save mode.00200201endif # SND_DRIVERS
···170 AC97 codecs. In this mode, the power-mode is dynamically171 controlled at each open/close.172173+ The mode is activated by passing 'power_save=X' to the174+ snd-ac97-codec driver module, where 'X' is the time-out175+ value, a nonnegative integer that specifies how many176+ seconds of idle time the driver must count before it may177+ put the AC97 into power-save mode; a value of 0 (zero)178+ disables the use of this power-save mode.179+180+ After the snd-ac97-codec driver module has been loaded,181+ the 'power_save' parameter can be set via sysfs as follows:182+183+ echo 10 > /sys/module/snd_ac97_codec/parameters/power_save184+185+ In this case, the time-out is set to 10 seconds; setting186+ the time-out to 1 second (the minimum activation value)187+ isn't recommended because many applications try to reopen188+ the device frequently. A value of 10 seconds would be a189+ good choice for normal operations.190+191+ See Documentation/sound/alsa/powersave.txt for more details.192193config SND_AC97_POWER_SAVE_DEFAULT194 int "Default time-out for AC97 power-save mode"···181 help182 The default time-out value in seconds for AC97 automatic183 power-save mode. 0 means to disable the power-save mode.184+185+ See SND_AC97_POWER_SAVE for more details.186187endif # SND_DRIVERS
···2429 return mask;2430}24312432-static int vwsnd_audio_do_ioctl(struct inode *inode,2433- struct file *file,2434 unsigned int cmd,2435 unsigned long arg)2436{···2445 int ival;244624472448- DBGEV("(inode=0x%p, file=0x%p, cmd=0x%x, arg=0x%lx)\n",2449- inode, file, cmd, arg);2450 switch (cmd) {2451 case OSS_GETVERSION: /* _SIOR ('M', 118, int) */2452 DBGX("OSS_GETVERSION\n");···2884 return -EINVAL;2885}28862887-static int vwsnd_audio_ioctl(struct inode *inode,2888- struct file *file,2889 unsigned int cmd,2890 unsigned long arg)2891{2892 vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data;2893 int ret;289402895 mutex_lock(&devc->io_mutex);2896- ret = vwsnd_audio_do_ioctl(inode, file, cmd, arg);2897 mutex_unlock(&devc->io_mutex);002898 return ret;2899}2900···29222923 DBGE("(inode=0x%p, file=0x%p)\n", inode, file);292402925 INC_USE_COUNT;2926 for (devc = vwsnd_dev_list; devc; devc = devc->next_dev)2927 if ((devc->audio_minor & ~0x0F) == (minor & ~0x0F))···29302931 if (devc == NULL) {2932 DEC_USE_COUNT;02933 return -ENODEV;2934 }2935···2939 mutex_unlock(&devc->open_mutex);2940 if (file->f_flags & O_NONBLOCK) {2941 DEC_USE_COUNT;02942 return -EBUSY;2943 }2944 interruptible_sleep_on(&devc->open_wait);2945 if (signal_pending(current)) {2946 DEC_USE_COUNT;02947 return -ERESTARTSYS;2948 }2949 mutex_lock(&devc->open_mutex);···29982999 file->private_data = devc;3000 DBGRV();03001 return 0;3002}3003···3050 .read = vwsnd_audio_read,3051 .write = vwsnd_audio_write,3052 .poll = vwsnd_audio_poll,3053- .ioctl = vwsnd_audio_ioctl,3054 .mmap = vwsnd_audio_mmap,3055 .open = vwsnd_audio_open,3056 .release = vwsnd_audio_release,···3068 DBGEV("(inode=0x%p, file=0x%p)\n", inode, file);30693070 INC_USE_COUNT;03071 for (devc = vwsnd_dev_list; devc; devc = devc->next_dev)3072 if (devc->mixer_minor == iminor(inode))3073 break;30743075 if (devc == NULL) {3076 DEC_USE_COUNT;03077 return -ENODEV;3078 }3079 file->private_data = devc;03080 return 0;3081}3082···32123213/* This is the ioctl entry to the mixer driver. */32143215-static int vwsnd_mixer_ioctl(struct inode *ioctl,3216- struct file *file,3217 unsigned int cmd,3218 unsigned long arg)3219{···32233224 DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg);322503226 mutex_lock(&devc->mix_mutex);3227 {3228 if ((cmd & ~nrmask) == MIXER_READ(0))···3234 retval = -EINVAL;3235 }3236 mutex_unlock(&devc->mix_mutex);03237 return retval;3238}32393240static const struct file_operations vwsnd_mixer_fops = {3241 .owner = THIS_MODULE,3242 .llseek = no_llseek,3243- .ioctl = vwsnd_mixer_ioctl,3244 .open = vwsnd_mixer_open,3245 .release = vwsnd_mixer_release,3246};
···2429 return mask;2430}24312432+static int vwsnd_audio_do_ioctl(struct file *file,02433 unsigned int cmd,2434 unsigned long arg)2435{···2446 int ival;244724482449+ DBGEV("(file=0x%p, cmd=0x%x, arg=0x%lx)\n",2450+ file, cmd, arg);2451 switch (cmd) {2452 case OSS_GETVERSION: /* _SIOR ('M', 118, int) */2453 DBGX("OSS_GETVERSION\n");···2885 return -EINVAL;2886}28872888+static long vwsnd_audio_ioctl(struct file *file,02889 unsigned int cmd,2890 unsigned long arg)2891{2892 vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data;2893 int ret;28942895+ lock_kernel();2896 mutex_lock(&devc->io_mutex);2897+ ret = vwsnd_audio_do_ioctl(file, cmd, arg);2898 mutex_unlock(&devc->io_mutex);2899+ unlock_kernel();2900+2901 return ret;2902}2903···29212922 DBGE("(inode=0x%p, file=0x%p)\n", inode, file);29232924+ lock_kernel();2925 INC_USE_COUNT;2926 for (devc = vwsnd_dev_list; devc; devc = devc->next_dev)2927 if ((devc->audio_minor & ~0x0F) == (minor & ~0x0F))···29282929 if (devc == NULL) {2930 DEC_USE_COUNT;2931+ unlock_kernel();2932 return -ENODEV;2933 }2934···2936 mutex_unlock(&devc->open_mutex);2937 if (file->f_flags & O_NONBLOCK) {2938 DEC_USE_COUNT;2939+ unlock_kernel();2940 return -EBUSY;2941 }2942 interruptible_sleep_on(&devc->open_wait);2943 if (signal_pending(current)) {2944 DEC_USE_COUNT;2945+ unlock_kernel();2946 return -ERESTARTSYS;2947 }2948 mutex_lock(&devc->open_mutex);···29932994 file->private_data = devc;2995 DBGRV();2996+ unlock_kernel();2997 return 0;2998}2999···3044 .read = vwsnd_audio_read,3045 .write = vwsnd_audio_write,3046 .poll = vwsnd_audio_poll,3047+ .unlocked_ioctl = vwsnd_audio_ioctl,3048 .mmap = vwsnd_audio_mmap,3049 .open = vwsnd_audio_open,3050 .release = vwsnd_audio_release,···3062 DBGEV("(inode=0x%p, file=0x%p)\n", inode, file);30633064 INC_USE_COUNT;3065+ lock_kernel();3066 for (devc = vwsnd_dev_list; devc; devc = devc->next_dev)3067 if (devc->mixer_minor == iminor(inode))3068 break;30693070 if (devc == NULL) {3071 DEC_USE_COUNT;3072+ unlock_kernel();3073 return -ENODEV;3074 }3075 file->private_data = devc;3076+ unlock_kernel();3077 return 0;3078}3079···32033204/* This is the ioctl entry to the mixer driver. */32053206+static long vwsnd_mixer_ioctl(struct file *file,03207 unsigned int cmd,3208 unsigned long arg)3209{···32153216 DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg);32173218+ lock_kernel();3219 mutex_lock(&devc->mix_mutex);3220 {3221 if ((cmd & ~nrmask) == MIXER_READ(0))···3225 retval = -EINVAL;3226 }3227 mutex_unlock(&devc->mix_mutex);3228+ unlock_kernel();3229 return retval;3230}32313232static const struct file_operations vwsnd_mixer_fops = {3233 .owner = THIS_MODULE,3234 .llseek = no_llseek,3235+ .unlocked_ioctl = vwsnd_mixer_ioctl,3236 .open = vwsnd_mixer_open,3237 .release = vwsnd_mixer_release,3238};
+2-8
sound/oss/waveartist.c
···184static inline int185waveartist_sleep(int timeout_ms)186{187- unsigned int timeout = timeout_ms * 10 * HZ / 100;188-189- do {190- set_current_state(TASK_INTERRUPTIBLE);191- timeout = schedule_timeout(timeout);192- } while (timeout);193-194- return 0;195}196197static int
···184static inline int185waveartist_sleep(int timeout_ms)186{187+ unsigned int timeout = msecs_to_jiffies(timeout_ms*100);188+ return schedule_timeout_interruptible(timeout);000000189}190191static int
+2-2
sound/pci/als4000.c
···763 /* SPECS_PAGE: 39 */764 for (i = ALS4K_GCR91_DMA0_ADDR; i <= ALS4K_GCR96_DMA3_MODE_COUNT; ++i)765 snd_als4k_gcr_write(chip, i, 0);766-767 snd_als4k_gcr_write(chip, ALS4K_GCR99_DMA_EMULATION_CTRL,768- snd_als4k_gcr_read(chip, ALS4K_GCR99_DMA_EMULATION_CTRL));769 spin_unlock_irq(&chip->reg_lock);770}771
···763 /* SPECS_PAGE: 39 */764 for (i = ALS4K_GCR91_DMA0_ADDR; i <= ALS4K_GCR96_DMA3_MODE_COUNT; ++i)765 snd_als4k_gcr_write(chip, i, 0);766+ /* enable burst mode to prevent dropouts during high PCI bus usage */767 snd_als4k_gcr_write(chip, ALS4K_GCR99_DMA_EMULATION_CTRL,768+ (snd_als4k_gcr_read(chip, ALS4K_GCR99_DMA_EMULATION_CTRL) & ~0x07) | 0x04);769 spin_unlock_irq(&chip->reg_lock);770}771
+9-7
sound/pci/asihpi/asihpi.c
···460 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream);461 int err;462 u16 format;0463 unsigned int bytes_per_sec;464465 print_hwparams(params);···513 dpcm->hpi_buffer_attached);514 }515 bytes_per_sec = params_rate(params) * params_channels(params);516- bytes_per_sec *= snd_pcm_format_width(params_format(params));0517 bytes_per_sec /= 8;518- if (bytes_per_sec <= 0)519 return -EINVAL;520521 dpcm->bytes_per_sec = bytes_per_sec;···13851386compile_time_assert(1387 (ARRAY_SIZE(asihpi_src_names) ==1388- (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_BASE+1)),1389 assert_src_names_size);13901391#if ASI_STYLE_NAMES···14161417compile_time_assert(1418 (ARRAY_SIZE(asihpi_dst_names) ==1419- (HPI_DESTNODE_LAST_INDEX-HPI_DESTNODE_BASE+1)),1420 assert_dst_names_size);14211422static inline int ctl_add(struct snd_card *card, struct snd_kcontrol_new *ctl,···2173 &src_node_type, &src_node_index);21742175 sprintf(uinfo->value.enumerated.name, "%s %d",2176- asihpi_src_names[src_node_type - HPI_SOURCENODE_BASE],2177 src_node_index);2178 return 0;2179}···26052606 }26072608- hpi_ctl.src_node_type -= HPI_SOURCENODE_BASE;2609- hpi_ctl.dst_node_type -= HPI_DESTNODE_BASE;26102611 /* ASI50xx in SSX mode has multiple meters on the same node.2612 Use subindex to create distinct ALSA controls
···460 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream);461 int err;462 u16 format;463+ int width;464 unsigned int bytes_per_sec;465466 print_hwparams(params);···512 dpcm->hpi_buffer_attached);513 }514 bytes_per_sec = params_rate(params) * params_channels(params);515+ width = snd_pcm_format_width(params_format(params));516+ bytes_per_sec *= width;517 bytes_per_sec /= 8;518+ if (width < 0 || bytes_per_sec == 0)519 return -EINVAL;520521 dpcm->bytes_per_sec = bytes_per_sec;···13831384compile_time_assert(1385 (ARRAY_SIZE(asihpi_src_names) ==1386+ (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_NONE+1)),1387 assert_src_names_size);13881389#if ASI_STYLE_NAMES···14141415compile_time_assert(1416 (ARRAY_SIZE(asihpi_dst_names) ==1417+ (HPI_DESTNODE_LAST_INDEX-HPI_DESTNODE_NONE+1)),1418 assert_dst_names_size);14191420static inline int ctl_add(struct snd_card *card, struct snd_kcontrol_new *ctl,···2171 &src_node_type, &src_node_index);21722173 sprintf(uinfo->value.enumerated.name, "%s %d",2174+ asihpi_src_names[src_node_type - HPI_SOURCENODE_NONE],2175 src_node_index);2176 return 0;2177}···26032604 }26052606+ hpi_ctl.src_node_type -= HPI_SOURCENODE_NONE;2607+ hpi_ctl.dst_node_type -= HPI_DESTNODE_NONE;26082609 /* ASI50xx in SSX mode has multiple meters on the same node.2610 Use subindex to create distinct ALSA controls
+48-20
sound/pci/asihpi/hpi.h
···50#define HPI_VER_RELEASE(v) ((int)(v & 0xFF))5152/* Use single digits for versions less that 10 to avoid octal. */53-#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 25)05455/* Library version as documented in hpi-api-versions.txt */56#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0)···204 exists on a destination node can be searched for using a source205 node value of either 0, or HPI_SOURCENODE_NONE */206 HPI_SOURCENODE_NONE = 100,207- /** \deprecated Use HPI_SOURCENODE_NONE instead. */208- HPI_SOURCENODE_BASE = 100,209 /** Out Stream (Play) node. */210 HPI_SOURCENODE_OSTREAM = 101,211 /** Line in node - could be analog, AES/EBU or network. */···234 exists on a source node can be searched for using a destination235 node value of either 0, or HPI_DESTNODE_NONE */236 HPI_DESTNODE_NONE = 200,237- /** \deprecated Use HPI_DESTNODE_NONE instead. */238- HPI_DESTNODE_BASE = 200,239 /** In Stream (Record) node. */240 HPI_DESTNODE_ISTREAM = 201,241 HPI_DESTNODE_LINEOUT = 202, /**< line out node. */···429Property 1 - adapter can do samplerate conversion (MRX)430Property 2 - adapter can do timestretch (TSX)431*/432- HPI_ADAPTER_PROPERTY_CAPS2 = 26900000000000433};434435/** Adapter mode commands···821/** The sampleclock output is derived from its local samplerate generator.822 The local samplerate may be set using HPI_SampleClock_SetLocalRate(). */823 HPI_SAMPLECLOCK_SOURCE_LOCAL = 1,824-/** \deprecated Use HPI_SAMPLECLOCK_SOURCE_LOCAL instead */825- HPI_SAMPLECLOCK_SOURCE_ADAPTER = 1,826/** The adapter is clocked from a dedicated AES/EBU SampleClock input.*/827 HPI_SAMPLECLOCK_SOURCE_AESEBU_SYNC = 2,828/** From external wordclock connector */···831 HPI_SAMPLECLOCK_SOURCE_SMPTE = 5,832/** One of the aesebu inputs */833 HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT = 6,834-/** \deprecated The first aesebu input with a valid signal835-Superseded by separate Auto enable flag836-*/837- HPI_SAMPLECLOCK_SOURCE_AESEBU_AUTO = 7,838/** From a network interface e.g. Cobranet or Livewire at either 48 or 96kHz */839 HPI_SAMPLECLOCK_SOURCE_NETWORK = 8,840/** From previous adjacent module (ASI2416 only)*/···1017 HPI_ERROR_CONTROL_DISABLED = 404,1018 /** I2C transaction failed due to a missing ACK. */1019 HPI_ERROR_CONTROL_I2C_MISSING_ACK = 405,1020- /** Control attribute is valid, but not supported by this hardware. */1021- HPI_ERROR_UNSUPPORTED_CONTROL_ATTRIBUTE = 406,1022 /** Control is busy, or coming out of1023 reset and cannot be accessed at this time. */1024 HPI_ERROR_CONTROL_NOT_READY = 407,···1827 Compressor Expander control1828*******************************/18291830-u16 hpi_compander_set(const struct hpi_hsubsys *ph_subsys, u32 h_control,1831- u16 attack, u16 decay, short ratio100, short threshold0_01dB,1832- short makeup_gain0_01dB);18331834-u16 hpi_compander_get(const struct hpi_hsubsys *ph_subsys, u32 h_control,1835- u16 *pw_attack, u16 *pw_decay, short *pw_ratio100,1836- short *pn_threshold0_01dB, short *pn_makeup_gain0_01dB);0000000000000000000000000000018371838/*******************************1839 Cobranet HMI control
···50#define HPI_VER_RELEASE(v) ((int)(v & 0xFF))5152/* Use single digits for versions less that 10 to avoid octal. */53+#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 4, 1)54+#define HPI_VER_STRING "4.04.01"5556/* Library version as documented in hpi-api-versions.txt */57#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0)···203 exists on a destination node can be searched for using a source204 node value of either 0, or HPI_SOURCENODE_NONE */205 HPI_SOURCENODE_NONE = 100,00206 /** Out Stream (Play) node. */207 HPI_SOURCENODE_OSTREAM = 101,208 /** Line in node - could be analog, AES/EBU or network. */···235 exists on a source node can be searched for using a destination236 node value of either 0, or HPI_DESTNODE_NONE */237 HPI_DESTNODE_NONE = 200,00238 /** In Stream (Record) node. */239 HPI_DESTNODE_ISTREAM = 201,240 HPI_DESTNODE_LINEOUT = 202, /**< line out node. */···432Property 1 - adapter can do samplerate conversion (MRX)433Property 2 - adapter can do timestretch (TSX)434*/435+ HPI_ADAPTER_PROPERTY_CAPS2 = 269,436+437+/** Readonly adapter sync header connection count.438+*/439+ HPI_ADAPTER_PROPERTY_SYNC_HEADER_CONNECTIONS = 270,440+/** Readonly supports SSX2 property.441+Indicates the adapter supports SSX2 in some mode setting. The442+return value is true (1) or false (0). If the current adapter443+mode is MONO SSX2 is disabled, even though this property will444+return true.445+*/446+ HPI_ADAPTER_PROPERTY_SUPPORTS_SSX2 = 271447};448449/** Adapter mode commands···813/** The sampleclock output is derived from its local samplerate generator.814 The local samplerate may be set using HPI_SampleClock_SetLocalRate(). */815 HPI_SAMPLECLOCK_SOURCE_LOCAL = 1,00816/** The adapter is clocked from a dedicated AES/EBU SampleClock input.*/817 HPI_SAMPLECLOCK_SOURCE_AESEBU_SYNC = 2,818/** From external wordclock connector */···825 HPI_SAMPLECLOCK_SOURCE_SMPTE = 5,826/** One of the aesebu inputs */827 HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT = 6,0000828/** From a network interface e.g. Cobranet or Livewire at either 48 or 96kHz */829 HPI_SAMPLECLOCK_SOURCE_NETWORK = 8,830/** From previous adjacent module (ASI2416 only)*/···1015 HPI_ERROR_CONTROL_DISABLED = 404,1016 /** I2C transaction failed due to a missing ACK. */1017 HPI_ERROR_CONTROL_I2C_MISSING_ACK = 405,001018 /** Control is busy, or coming out of1019 reset and cannot be accessed at this time. */1020 HPI_ERROR_CONTROL_NOT_READY = 407,···1827 Compressor Expander control1828*******************************/18291830+u16 hpi_compander_set_enable(const struct hpi_hsubsys *ph_subsys,1831+ u32 h_control, u32 on);018321833+u16 hpi_compander_get_enable(const struct hpi_hsubsys *ph_subsys,1834+ u32 h_control, u32 *pon);1835+1836+u16 hpi_compander_set_makeup_gain(const struct hpi_hsubsys *ph_subsys,1837+ u32 h_control, short makeup_gain0_01dB);1838+1839+u16 hpi_compander_get_makeup_gain(const struct hpi_hsubsys *ph_subsys,1840+ u32 h_control, short *pn_makeup_gain0_01dB);1841+1842+u16 hpi_compander_set_attack_time_constant(const struct hpi_hsubsys1843+ *ph_subsys, u32 h_control, u32 index, u32 attack);1844+1845+u16 hpi_compander_get_attack_time_constant(const struct hpi_hsubsys1846+ *ph_subsys, u32 h_control, u32 index, u32 *pw_attack);1847+1848+u16 hpi_compander_set_decay_time_constant(const struct hpi_hsubsys *ph_subsys,1849+ u32 h_control, u32 index, u32 decay);1850+1851+u16 hpi_compander_get_decay_time_constant(const struct hpi_hsubsys *ph_subsys,1852+ u32 h_control, u32 index, u32 *pw_decay);1853+1854+u16 hpi_compander_set_threshold(const struct hpi_hsubsys *ph_subsys,1855+ u32 h_control, u32 index, short threshold0_01dB);1856+1857+u16 hpi_compander_get_threshold(const struct hpi_hsubsys *ph_subsys,1858+ u32 h_control, u32 index, short *pn_threshold0_01dB);1859+1860+u16 hpi_compander_set_ratio(const struct hpi_hsubsys *ph_subsys,1861+ u32 h_control, u32 index, u32 ratio100);1862+1863+u16 hpi_compander_get_ratio(const struct hpi_hsubsys *ph_subsys,1864+ u32 h_control, u32 index, u32 *pw_ratio100);18651866/*******************************1867 Cobranet HMI control
+7
sound/pci/asihpi/hpi6000.c
···687 switch (pao->pci.subsys_device_id) {688 case 0x5100:689 case 0x5110: /* ASI5100 revB or higher with C6711D */0690 case 0x6100:691 case 0x6200:692 boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x6200);···1133 if (HPI_ADAPTER_FAMILY_ASI(pao->pci.1134 subsys_device_id) ==1135 HPI_ADAPTER_FAMILY_ASI(0x5100))0000001136 mask = 0x00000000L;1137 break;1138 case HPI_ADAPTER_FAMILY_ASI(0x8800):
···687 switch (pao->pci.subsys_device_id) {688 case 0x5100:689 case 0x5110: /* ASI5100 revB or higher with C6711D */690+ case 0x5200: /* ASI5200 PC_ie version of ASI5100 */691 case 0x6100:692 case 0x6200:693 boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x6200);···1132 if (HPI_ADAPTER_FAMILY_ASI(pao->pci.1133 subsys_device_id) ==1134 HPI_ADAPTER_FAMILY_ASI(0x5100))1135+ mask = 0x00000000L;1136+ /* ASI5200 uses AX6 code, */1137+ /* but has no PLD r/w register to test */1138+ if (HPI_ADAPTER_FAMILY_ASI(pao->pci.1139+ subsys_device_id) ==1140+ HPI_ADAPTER_FAMILY_ASI(0x5200))1141 mask = 0x00000000L;1142 break;1143 case HPI_ADAPTER_FAMILY_ASI(0x8800):
+22-18
sound/pci/asihpi/hpi_internal.h
···104#define STR_ROLE_FIELD_MAX 255U105106struct hpi_entity_str {107- uint16_t size;108- uint8_t type;109- uint8_t role;110};111112#if defined(_MSC_VER)···119#if ! defined(HPI_OS_DSP_C6000) || (defined(HPI_OS_DSP_C6000) && (__TI_COMPILER_VERSION__ > 6000008))120 /* DSP C6000 compiler v6.0.8 and lower121 do not support flexible array member */122- uint8_t value[];123#else124 /* NOTE! Using sizeof(struct hpi_entity) will give erroneous results */125#define HPI_INTERNAL_WARN_ABOUT_ENTITY_VALUE126- uint8_t value[1];127#endif128};129···142/******************************************* CONTROL ATTRIBUTES ****/143/* (in order of control type ID */144145- /* This allows for 255 control types, 256 unique attributes each */146#define HPI_CTL_ATTR(ctl, ai) (HPI_CONTROL_##ctl * 0x100 + ai)147148/* Get the sub-index of the attribute for a control type */149#define HPI_CTL_ATTR_INDEX(i) (i&0xff)000150151/* Generic control attributes. */152···314/* Microphone control attributes */315#define HPI_MICROPHONE_PHANTOM_POWER HPI_CTL_ATTR(MICROPHONE, 1)316317-/** Equalizer control attributes318-*/319/** Used to get number of filters in an EQ. (Can't set) */320#define HPI_EQUALIZER_NUM_FILTERS HPI_CTL_ATTR(EQUALIZER, 1)321/** Set/get the filter by type, freq, Q, gain */···322/** Get the biquad coefficients */323#define HPI_EQUALIZER_COEFFICIENTS HPI_CTL_ATTR(EQUALIZER, 3)324325-#define HPI_COMPANDER_PARAMS HPI_CTL_ATTR(COMPANDER, 1)000000326327-/* Cobranet control attributes.328- MUST be distinct from all other control attributes.329- This is so that host side processing can easily identify a Cobranet control330- and apply additional host side operations (like copying data) as required.331-*/332#define HPI_COBRANET_SET HPI_CTL_ATTR(COBRANET, 1)333#define HPI_COBRANET_GET HPI_CTL_ATTR(COBRANET, 2)334#define HPI_COBRANET_SET_DATA HPI_CTL_ATTR(COBRANET, 3)···1516 struct hpi_control_cache_info i;1517 union {1518 struct { /* volume */1519- u16 an_log[2];1520 } v;1521 struct { /* peak meter */1522- u16 an_log_peak[2];1523- u16 an_logRMS[2];1524 } p;1525 struct { /* channel mode */1526 u16 mode;···1530 u16 source_node_index;1531 } x;1532 struct { /* level/trim */1533- u16 an_log[2];1534 } l;1535 struct { /* tuner - partial caching.1536 some attributes go to the DSP. */
···104#define STR_ROLE_FIELD_MAX 255U105106struct hpi_entity_str {107+ u16 size;108+ u8 type;109+ u8 role;110};111112#if defined(_MSC_VER)···119#if ! defined(HPI_OS_DSP_C6000) || (defined(HPI_OS_DSP_C6000) && (__TI_COMPILER_VERSION__ > 6000008))120 /* DSP C6000 compiler v6.0.8 and lower121 do not support flexible array member */122+ u8 value[];123#else124 /* NOTE! Using sizeof(struct hpi_entity) will give erroneous results */125#define HPI_INTERNAL_WARN_ABOUT_ENTITY_VALUE126+ u8 value[1];127#endif128};129···142/******************************************* CONTROL ATTRIBUTES ****/143/* (in order of control type ID */144145+/* This allows for 255 control types, 256 unique attributes each */146#define HPI_CTL_ATTR(ctl, ai) (HPI_CONTROL_##ctl * 0x100 + ai)147148/* Get the sub-index of the attribute for a control type */149#define HPI_CTL_ATTR_INDEX(i) (i&0xff)150+151+/* Extract the control from the control attribute */152+#define HPI_CTL_ATTR_CONTROL(i) (i>>8)153154/* Generic control attributes. */155···311/* Microphone control attributes */312#define HPI_MICROPHONE_PHANTOM_POWER HPI_CTL_ATTR(MICROPHONE, 1)313314+/** Equalizer control attributes */0315/** Used to get number of filters in an EQ. (Can't set) */316#define HPI_EQUALIZER_NUM_FILTERS HPI_CTL_ATTR(EQUALIZER, 1)317/** Set/get the filter by type, freq, Q, gain */···320/** Get the biquad coefficients */321#define HPI_EQUALIZER_COEFFICIENTS HPI_CTL_ATTR(EQUALIZER, 3)322323+/* Note compander also uses HPI_GENERIC_ENABLE */324+#define HPI_COMPANDER_PARAMS HPI_CTL_ATTR(COMPANDER, 1)325+#define HPI_COMPANDER_MAKEUPGAIN HPI_CTL_ATTR(COMPANDER, 2)326+#define HPI_COMPANDER_THRESHOLD HPI_CTL_ATTR(COMPANDER, 3)327+#define HPI_COMPANDER_RATIO HPI_CTL_ATTR(COMPANDER, 4)328+#define HPI_COMPANDER_ATTACK HPI_CTL_ATTR(COMPANDER, 5)329+#define HPI_COMPANDER_DECAY HPI_CTL_ATTR(COMPANDER, 6)330331+/* Cobranet control attributes. */0000332#define HPI_COBRANET_SET HPI_CTL_ATTR(COBRANET, 1)333#define HPI_COBRANET_GET HPI_CTL_ATTR(COBRANET, 2)334#define HPI_COBRANET_SET_DATA HPI_CTL_ATTR(COBRANET, 3)···1512 struct hpi_control_cache_info i;1513 union {1514 struct { /* volume */1515+ short an_log[2];1516 } v;1517 struct { /* peak meter */1518+ short an_log_peak[2];1519+ short an_logRMS[2];1520 } p;1521 struct { /* channel mode */1522 u16 mode;···1526 u16 source_node_index;1527 } x;1528 struct { /* level/trim */1529+ short an_log[2];1530 } l;1531 struct { /* tuner - partial caching.1532 some attributes go to the DSP. */
···97#include <linux/gameport.h>98#include <linux/device.h>99#include <linux/firmware.h>0100#include <asm/io.h>101#include <sound/core.h>102#include <sound/info.h>···668 unsigned char c;669670 while (len) {00671 c = in[len - 1];672- if ((c >= '0') && (c <= '9'))673- sum += mult * (c - '0');674- else if ((c >= 'A') && (c <= 'F'))675- sum += mult * (c - ('A' - 10));676- else if ((c >= 'a') && (c <= 'f'))677- sum += mult * (c - ('a' - 10));678 mult *= 16;679 --len;680 }···16151616 chip->playback_substream[sub_num] = substream;1617 runtime->hw = snd_riptide_playback;01618 data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);001619 data->paths = lbus_play_paths[sub_num];1620 data->id = play_ids[sub_num];1621 data->source = play_sources[sub_num];···16381639 chip->capture_substream = substream;1640 runtime->hw = snd_riptide_capture;01641 data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);001642 data->paths = lbus_rec_path;1643 data->id = PADC;1644 data->source = ACLNK2PADC;
···97#include <linux/gameport.h>98#include <linux/device.h>99#include <linux/firmware.h>100+#include <linux/kernel.h>101#include <asm/io.h>102#include <sound/core.h>103#include <sound/info.h>···667 unsigned char c;668669 while (len) {670+ int value;671+672 c = in[len - 1];673+ value = hex_to_bin(c);674+ if (value >= 0)675+ sum += mult * value;000676 mult *= 16;677 --len;678 }···16151616 chip->playback_substream[sub_num] = substream;1617 runtime->hw = snd_riptide_playback;1618+1619 data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);1620+ if (data == NULL)1621+ return -ENOMEM;1622 data->paths = lbus_play_paths[sub_num];1623 data->id = play_ids[sub_num];1624 data->source = play_sources[sub_num];···16351636 chip->capture_substream = substream;1637 runtime->hw = snd_riptide_capture;1638+1639 data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);1640+ if (data == NULL)1641+ return -ENOMEM;1642 data->paths = lbus_rec_path;1643 data->id = PADC;1644 data->source = ACLNK2PADC;
+9-7
sound/pci/sis7019.c
···264 * if using small periods.265 *266 * If we're less than 9 samples behind, we're on target.00267 */268 if (sync > -9)269 voice->vperiod = voice->sync_period_size + 1;270 else271- voice->vperiod = voice->sync_period_size - 4;272273 if (voice->vperiod < voice->buffer_size) {274 sis_update_sso(voice, voice->vperiod);···738 period_size = buffer_size;739740 /* Initially, we want to interrupt just a bit behind the end of741- * the period we're clocking out. 10 samples seems to give a good742 * delay.743 *744 * We want to spread our interrupts throughout the virtual period,···749 *750 * This is all moot if we don't need to use virtual periods.751 */752- vperiod = runtime->period_size + 10;753 if (vperiod > period_size) {754 u16 tail = vperiod % period_size;755 u16 quarter_period = period_size / 4;···778 */779 timing->flags |= VOICE_SYNC_TIMING;780 timing->sync_base = voice->ctrl_base;781- timing->sync_cso = runtime->period_size - 1;782 timing->sync_period_size = runtime->period_size;783 timing->sync_buffer_size = runtime->buffer_size;784 timing->period_size = period_size;···1049 /* Reset the chip, and disable all interrputs.1050 */1051 outl(SIS_GCR_SOFTWARE_RESET, sis->ioport + SIS_GCR);1052- udelay(10);1053 outl(0, sis->ioport + SIS_GCR);1054 outl(0, sis->ioport + SIS_GIER);1055···1085 /* Reset the audio controller1086 */1087 outl(SIS_GCR_SOFTWARE_RESET, io + SIS_GCR);1088- udelay(10);1089 outl(0, io + SIS_GCR);10901091 /* Get the AC-link semaphore, and reset the codecs···1098 return -EIO;10991100 outl(SIS_AC97_CMD_CODEC_COLD_RESET, io + SIS_AC97_CMD);1101- udelay(10);11021103 count = 0xffff;1104 while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count)
···264 * if using small periods.265 *266 * If we're less than 9 samples behind, we're on target.267+ * Otherwise, shorten the next vperiod by the amount we've268+ * been delayed.269 */270 if (sync > -9)271 voice->vperiod = voice->sync_period_size + 1;272 else273+ voice->vperiod = voice->sync_period_size + sync + 10;274275 if (voice->vperiod < voice->buffer_size) {276 sis_update_sso(voice, voice->vperiod);···736 period_size = buffer_size;737738 /* Initially, we want to interrupt just a bit behind the end of739+ * the period we're clocking out. 12 samples seems to give a good740 * delay.741 *742 * We want to spread our interrupts throughout the virtual period,···747 *748 * This is all moot if we don't need to use virtual periods.749 */750+ vperiod = runtime->period_size + 12;751 if (vperiod > period_size) {752 u16 tail = vperiod % period_size;753 u16 quarter_period = period_size / 4;···776 */777 timing->flags |= VOICE_SYNC_TIMING;778 timing->sync_base = voice->ctrl_base;779+ timing->sync_cso = runtime->period_size;780 timing->sync_period_size = runtime->period_size;781 timing->sync_buffer_size = runtime->buffer_size;782 timing->period_size = period_size;···1047 /* Reset the chip, and disable all interrputs.1048 */1049 outl(SIS_GCR_SOFTWARE_RESET, sis->ioport + SIS_GCR);1050+ udelay(25);1051 outl(0, sis->ioport + SIS_GCR);1052 outl(0, sis->ioport + SIS_GIER);1053···1083 /* Reset the audio controller1084 */1085 outl(SIS_GCR_SOFTWARE_RESET, io + SIS_GCR);1086+ udelay(25);1087 outl(0, io + SIS_GCR);10881089 /* Get the AC-link semaphore, and reset the codecs···1096 return -EIO;10971098 outl(SIS_AC97_CMD_CODEC_COLD_RESET, io + SIS_AC97_CMD);1099+ udelay(250);11001101 count = 0xffff;1102 while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count)
+7-2
sound/pci/via82xx.c
···85static int ac97_clock = 48000;86static char *ac97_quirk;87static int dxs_support;088static int nodelay;8990module_param(index, int, 0444);···104MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");105module_param(dxs_support, int, 0444);106MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)");00107module_param(nodelay, int, 0444);108MODULE_PARM_DESC(nodelay, "Disable 500ms init delay");109···1248 return err;1249 stream = viadev->reg_offset / 0x10;1250 if (chip->dxs_controls[stream]) {1251- chip->playback_volume[stream][0] = 0;1252- chip->playback_volume[stream][1] = 0;001253 chip->dxs_controls[stream]->vd[0].access &=1254 ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;1255 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE |
···1920#include <linux/bitops.h>21#include <linux/init.h>22-#include <linux/list.h>23-#include <linux/slab.h>24#include <linux/string.h>25#include <linux/usb.h>26-#include <linux/moduleparam.h>27-#include <linux/mutex.h>28#include <linux/usb/audio.h>29#include <linux/usb/audio-v2.h>3031#include <sound/core.h>32#include <sound/info.h>33#include <sound/pcm.h>34-#include <sound/pcm_params.h>35-#include <sound/initval.h>3637#include "usbaudio.h"38#include "card.h"39-#include "midi.h"40-#include "mixer.h"41-#include "proc.h"42-#include "quirks.h"43-#include "endpoint.h"44#include "helper.h"45-#include "debug.h"46-#include "pcm.h"47-#include "urb.h"48-#include "format.h"4950static struct uac_clock_source_descriptor *51 snd_usb_find_clock_source(struct usb_host_interface *ctrl_iface,···120 return !!data;121}122123-/* Try to find the clock source ID of a given clock entity */124-125static int __uac_clock_find_source(struct snd_usb_audio *chip,126- struct usb_host_interface *host_iface,127 int entity_id, unsigned long *visited)128{129 struct uac_clock_source_descriptor *source;···137 }138139 /* first, see if the ID we're looking for is a clock source already */140- source = snd_usb_find_clock_source(host_iface, entity_id);141 if (source)142 return source->bClockID;143144- selector = snd_usb_find_clock_selector(host_iface, entity_id);145 if (selector) {146 int ret;147···151 if (ret < 0)152 return ret;15300154 if (ret > selector->bNrInPins || ret < 1) {155 printk(KERN_ERR156 "%s(): selector reported illegal value, id %d, ret %d\n",···161 return -EINVAL;162 }163164- return __uac_clock_find_source(chip, host_iface,165- selector->baCSourceID[ret-1],166 visited);167 }168169 /* FIXME: multipliers only act as pass-thru element for now */170- multiplier = snd_usb_find_clock_multiplier(host_iface, entity_id);171 if (multiplier)172- return __uac_clock_find_source(chip, host_iface,173- multiplier->bCSourceID, visited);174175 return -EINVAL;176}177178-int snd_usb_clock_find_source(struct snd_usb_audio *chip,179- struct usb_host_interface *host_iface,180- int entity_id)000000000181{182 DECLARE_BITMAP(visited, 256);183 memset(visited, 0, sizeof(visited));184- return __uac_clock_find_source(chip, host_iface, entity_id, visited);185}186187static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,···204 ep = get_endpoint(alts, 0)->bEndpointAddress;205206 /* if endpoint doesn't have sampling rate control, bail out */207- if (!(fmt->attributes & UAC_EP_CS_ATTR_SAMPLE_RATE)) {208- snd_printk(KERN_WARNING "%d:%d:%d: endpoint lacks sample rate attribute bit, cannot set.\n",209- dev->devnum, iface, fmt->altsetting);210 return 0;211- }212213 data[0] = rate;214 data[1] = rate >> 8;···244 struct usb_device *dev = chip->dev;245 unsigned char data[4];246 int err, crate;247- int clock = snd_usb_clock_find_source(chip, chip->ctrl_intf, fmt->clock);248249 if (clock < 0)250 return clock;251252 if (!uac_clock_source_is_valid(chip, clock)) {0253 snd_printk(KERN_ERR "%d:%d:%d: clock source %d is not valid, cannot use\n",254 dev->devnum, iface, fmt->altsetting, clock);255 return -ENXIO;
···1920#include <linux/bitops.h>21#include <linux/init.h>0022#include <linux/string.h>23#include <linux/usb.h>0024#include <linux/usb/audio.h>25#include <linux/usb/audio-v2.h>2627#include <sound/core.h>28#include <sound/info.h>29#include <sound/pcm.h>003031#include "usbaudio.h"32#include "card.h"0000033#include "helper.h"34+#include "clock.h"0003536static struct uac_clock_source_descriptor *37 snd_usb_find_clock_source(struct usb_host_interface *ctrl_iface,···134 return !!data;135}13600137static int __uac_clock_find_source(struct snd_usb_audio *chip,0138 int entity_id, unsigned long *visited)139{140 struct uac_clock_source_descriptor *source;···154 }155156 /* first, see if the ID we're looking for is a clock source already */157+ source = snd_usb_find_clock_source(chip->ctrl_intf, entity_id);158 if (source)159 return source->bClockID;160161+ selector = snd_usb_find_clock_selector(chip->ctrl_intf, entity_id);162 if (selector) {163 int ret;164···168 if (ret < 0)169 return ret;170171+ /* Selector values are one-based */172+173 if (ret > selector->bNrInPins || ret < 1) {174 printk(KERN_ERR175 "%s(): selector reported illegal value, id %d, ret %d\n",···176 return -EINVAL;177 }178179+ return __uac_clock_find_source(chip, selector->baCSourceID[ret-1],0180 visited);181 }182183 /* FIXME: multipliers only act as pass-thru element for now */184+ multiplier = snd_usb_find_clock_multiplier(chip->ctrl_intf, entity_id);185 if (multiplier)186+ return __uac_clock_find_source(chip, multiplier->bCSourceID,187+ visited);188189 return -EINVAL;190}191192+/*193+ * For all kinds of sample rate settings and other device queries,194+ * the clock source (end-leaf) must be used. However, clock selectors,195+ * clock multipliers and sample rate converters may be specified as196+ * clock source input to terminal. This functions walks the clock path197+ * to its end and tries to find the source.198+ *199+ * The 'visited' bitfield is used internally to detect recursive loops.200+ *201+ * Returns the clock source UnitID (>=0) on success, or an error.202+ */203+int snd_usb_clock_find_source(struct snd_usb_audio *chip, int entity_id)204{205 DECLARE_BITMAP(visited, 256);206 memset(visited, 0, sizeof(visited));207+ return __uac_clock_find_source(chip, entity_id, visited);208}209210static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface,···211 ep = get_endpoint(alts, 0)->bEndpointAddress;212213 /* if endpoint doesn't have sampling rate control, bail out */214+ if (!(fmt->attributes & UAC_EP_CS_ATTR_SAMPLE_RATE))00215 return 0;0216217 data[0] = rate;218 data[1] = rate >> 8;···254 struct usb_device *dev = chip->dev;255 unsigned char data[4];256 int err, crate;257+ int clock = snd_usb_clock_find_source(chip, fmt->clock);258259 if (clock < 0)260 return clock;261262 if (!uac_clock_source_is_valid(chip, clock)) {263+ /* TODO: should we try to find valid clock setups by ourself? */264 snd_printk(KERN_ERR "%d:%d:%d: clock source %d is not valid, cannot use\n",265 dev->devnum, iface, fmt->altsetting, clock);266 return -ENXIO;
+1-3
sound/usb/clock.h
···5 struct usb_host_interface *alts,6 struct audioformat *fmt, int rate);78-int snd_usb_clock_find_source(struct snd_usb_audio *chip,9- struct usb_host_interface *host_iface,10- int entity_id);1112#endif /* __USBAUDIO_CLOCK_H */
···5 struct usb_host_interface *alts,6 struct audioformat *fmt, int rate);78+int snd_usb_clock_find_source(struct snd_usb_audio *chip, int entity_id);00910#endif /* __USBAUDIO_CLOCK_H */
+3-2
sound/usb/endpoint.c
···33#include "pcm.h"34#include "helper.h"35#include "format.h"03637/*38 * free a substream···276 /* get audio formats */277 switch (protocol) {278 case UAC_VERSION_1: {279- struct uac_as_header_descriptor_v1 *as =280 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);281282 if (!as) {···298 case UAC_VERSION_2: {299 struct uac2_input_terminal_descriptor *input_term;300 struct uac2_output_terminal_descriptor *output_term;301- struct uac_as_header_descriptor_v2 *as =302 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);303304 if (!as) {
···33#include "pcm.h"34#include "helper.h"35#include "format.h"36+#include "clock.h"3738/*39 * free a substream···275 /* get audio formats */276 switch (protocol) {277 case UAC_VERSION_1: {278+ struct uac1_as_header_descriptor *as =279 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);280281 if (!as) {···297 case UAC_VERSION_2: {298 struct uac2_input_terminal_descriptor *input_term;299 struct uac2_output_terminal_descriptor *output_term;300+ struct uac2_as_header_descriptor *as =301 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);302303 if (!as) {
+4-5
sound/usb/format.c
···264 * on the audioformat table (audio class v2).265 */266static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,267- struct audioformat *fp,268- struct usb_host_interface *iface)269{270 struct usb_device *dev = chip->dev;271 unsigned char tmp[2], *data;272 int nr_triplets, data_size, ret = 0;273- int clock = snd_usb_clock_find_source(chip, chip->ctrl_intf, fp->clock);274275 if (clock < 0) {276 snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n",···390 break;391 case UAC_VERSION_2:392 /* fp->channels is already set in this case */393- ret = parse_audio_format_rates_v2(chip, fp, iface);394 break;395 }396···449 framesize = le16_to_cpu(fmt->wSamplesPerFrame);450 snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize);451 fp->frame_size = framesize;452- ret = parse_audio_format_rates_v2(chip, fp, iface);453 break;454 }455 }
···264 * on the audioformat table (audio class v2).265 */266static int parse_audio_format_rates_v2(struct snd_usb_audio *chip,267+ struct audioformat *fp)0268{269 struct usb_device *dev = chip->dev;270 unsigned char tmp[2], *data;271 int nr_triplets, data_size, ret = 0;272+ int clock = snd_usb_clock_find_source(chip, fp->clock);273274 if (clock < 0) {275 snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n",···391 break;392 case UAC_VERSION_2:393 /* fp->channels is already set in this case */394+ ret = parse_audio_format_rates_v2(chip, fp);395 break;396 }397···450 framesize = le16_to_cpu(fmt->wSamplesPerFrame);451 snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize);452 fp->frame_size = framesize;453+ ret = parse_audio_format_rates_v2(chip, fp);454 break;455 }456 }
+7-7
sound/usb/midi.c
···434 u8 cin = buffer[i] & 0x0f;435 struct usbmidi_in_port *port = &ep->ports[cable];436 int length;437-438 length = snd_usbmidi_cin_length[cin];439 if (cin == 0xf && buffer[i + 1] >= 0xf8)440 ; /* realtime msg: no running status change */···628629static struct usb_protocol_ops snd_usbmidi_midiman_ops = {630 .input = snd_usbmidi_midiman_input,631- .output = snd_usbmidi_standard_output, 632 .output_packet = snd_usbmidi_output_midiman_packet,633};634635static struct usb_protocol_ops snd_usbmidi_maudio_broken_running_status_ops = {636 .input = snd_usbmidi_maudio_broken_running_status_input,637- .output = snd_usbmidi_standard_output, 638 .output_packet = snd_usbmidi_output_standard_packet,639};640···1248 */1249static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi,1250 struct snd_usb_midi_endpoint_info* ep_info,1251- struct snd_usb_midi_endpoint* rep)1252{1253 struct snd_usb_midi_out_endpoint* ep;1254 unsigned int i;···1398}13991400static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi* umidi,1401- int stream, int number)1402{1403 struct list_head* list;1404···1811 snd_usbmidi_switch_roland_altsetting(umidi);18121813 if (endpoint[0].out_ep || endpoint[0].in_ep)1814- return 0; 18151816 intf = umidi->iface;1817 if (!intf || intf->num_altsetting < 1)···1849 struct snd_usb_midi_endpoint_info* endpoints)1850{1851 int err, i;1852-1853 err = snd_usbmidi_detect_endpoints(umidi, endpoints, MIDI_MAX_ENDPOINTS);1854 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {1855 if (endpoints[i].out_ep)
···434 u8 cin = buffer[i] & 0x0f;435 struct usbmidi_in_port *port = &ep->ports[cable];436 int length;437+438 length = snd_usbmidi_cin_length[cin];439 if (cin == 0xf && buffer[i + 1] >= 0xf8)440 ; /* realtime msg: no running status change */···628629static struct usb_protocol_ops snd_usbmidi_midiman_ops = {630 .input = snd_usbmidi_midiman_input,631+ .output = snd_usbmidi_standard_output,632 .output_packet = snd_usbmidi_output_midiman_packet,633};634635static struct usb_protocol_ops snd_usbmidi_maudio_broken_running_status_ops = {636 .input = snd_usbmidi_maudio_broken_running_status_input,637+ .output = snd_usbmidi_standard_output,638 .output_packet = snd_usbmidi_output_standard_packet,639};640···1248 */1249static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi,1250 struct snd_usb_midi_endpoint_info* ep_info,1251+ struct snd_usb_midi_endpoint* rep)1252{1253 struct snd_usb_midi_out_endpoint* ep;1254 unsigned int i;···1398}13991400static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi* umidi,1401+ int stream, int number)1402{1403 struct list_head* list;1404···1811 snd_usbmidi_switch_roland_altsetting(umidi);18121813 if (endpoint[0].out_ep || endpoint[0].in_ep)1814+ return 0;18151816 intf = umidi->iface;1817 if (!intf || intf->num_altsetting < 1)···1849 struct snd_usb_midi_endpoint_info* endpoints)1850{1851 int err, i;1852+1853 err = snd_usbmidi_detect_endpoints(umidi, endpoints, MIDI_MAX_ENDPOINTS);1854 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {1855 if (endpoints[i].out_ep)
+42-35
sound/usb/mixer.c
···26 *27 */28000000000000000029#include <linux/bitops.h>30#include <linux/init.h>31#include <linux/list.h>···291292static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)293{0294 unsigned char buf[2];295 int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;296 int timeout = 10;297298 while (timeout-- > 0) {299- if (snd_usb_ctl_msg(cval->mixer->chip->dev,300- usb_rcvctrlpipe(cval->mixer->chip->dev, 0),301- request,302 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,303- validx, cval->mixer->ctrlif | (cval->id << 8),304 buf, val_len, 100) >= val_len) {305 *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len));306 return 0;307 }308 }309 snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",310- request, validx, cval->mixer->ctrlif | (cval->id << 8), cval->val_type);311 return -EINVAL;312}313314static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)315{0316 unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */317 unsigned char *val;318 int ret, size;···328329 memset(buf, 0, sizeof(buf));330331- ret = snd_usb_ctl_msg(cval->mixer->chip->dev,332- usb_rcvctrlpipe(cval->mixer->chip->dev, 0),333- bRequest,334 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,335- validx, cval->mixer->ctrlif | (cval->id << 8),336 buf, size, 1000);337338 if (ret < 0) {339 snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",340- request, validx, cval->mixer->ctrlif | (cval->id << 8), cval->val_type);341 return ret;342 }343···411int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,412 int request, int validx, int value_set)413{0414 unsigned char buf[2];415 int val_len, timeout = 10;416···434 buf[0] = value_set & 0xff;435 buf[1] = (value_set >> 8) & 0xff;436 while (timeout-- > 0)437- if (snd_usb_ctl_msg(cval->mixer->chip->dev,438- usb_sndctrlpipe(cval->mixer->chip->dev, 0),439- request,440 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,441- validx, cval->mixer->ctrlif | (cval->id << 8),442 buf, val_len, 100) >= 0)443 return 0;444 snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n",445- request, validx, cval->mixer->ctrlif | (cval->id << 8), cval->val_type, buf[0], buf[1]);446 return -EINVAL;447}448···596 switch (iterm->type >> 16) {597 case UAC_SELECTOR_UNIT:598 strcpy(name, "Selector"); return 8;599- case UAC_PROCESSING_UNIT_V1:600 strcpy(name, "Process Unit"); return 12;601- case UAC_EXTENSION_UNIT_V1:602 strcpy(name, "Ext Unit"); return 8;603 case UAC_MIXER_UNIT:604 strcpy(name, "Mixer"); return 5;···686 term->name = uac_selector_unit_iSelector(d);687 return 0;688 }689- case UAC_PROCESSING_UNIT_V1:690- case UAC_EXTENSION_UNIT_V1: {691 struct uac_processing_unit_descriptor *d = p1;692 if (d->bNrInPins) {693 id = d->baSourceID[0];···759 */760static int get_min_max(struct usb_mixer_elem_info *cval, int default_min)761{00762 /* for failsafe */763 cval->min = default_min;764 cval->max = cval->min + 1;···783 if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 ||784 get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) {785 snd_printd(KERN_ERR "%d:%d: cannot get min/max values for control %d (id %d)\n",786- cval->id, cval->mixer->ctrlif, cval->control, cval->id);787 return -EINVAL;788 }789 if (get_ctl_value(cval, UAC_GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) {···1215 }1216 } else { /* UAC_VERSION_2 */1217 for (i = 0; i < 30/2; i++) {1218- /* From the USB Audio spec v2.0:1219- bmaControls() is a (ch+1)-element array of 4-byte bitmaps,1220- each containing a set of bit pairs. If a Control is present,1221- it must be Host readable. If a certain Control is not1222- present then the bit pair must be set to 0b00.1223- If a Control is present but read-only, the bit pair must be1224- set to 0b01. If a Control is also Host programmable, the bit1225- pair must be set to 0b11. The value 0b10 is not allowed. */1226 unsigned int ch_bits = 0;1227 unsigned int ch_read_only = 0;1228···1863 return parse_audio_selector_unit(state, unitid, p1);1864 case UAC_FEATURE_UNIT:1865 return parse_audio_feature_unit(state, unitid, p1);1866- case UAC_PROCESSING_UNIT_V1:1867 /* UAC2_EFFECT_UNIT has the same value */1868 if (state->mixer->protocol == UAC_VERSION_1)1869 return parse_audio_processing_unit(state, unitid, p1);1870 else1871 return 0; /* FIXME - effect units not implemented yet */1872- case UAC_EXTENSION_UNIT_V1:1873 /* UAC2_PROCESSING_UNIT_V2 has the same value */1874 if (state->mixer->protocol == UAC_VERSION_1)1875 return parse_audio_extension_unit(state, unitid, p1);···1913 struct usb_host_interface *hostif;1914 void *p;19151916- hostif = &usb_ifnum_to_if(mixer->chip->dev, mixer->ctrlif)->altsetting[0];1917 memset(&state, 0, sizeof(state));1918 state.chip = mixer->chip;1919 state.mixer = mixer;···1933 p = NULL;1934 while ((p = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, p, UAC_OUTPUT_TERMINAL)) != NULL) {1935 if (mixer->protocol == UAC_VERSION_1) {1936- struct uac_output_terminal_descriptor_v1 *desc = p;19371938 if (desc->bLength < sizeof(*desc))1939 continue; /* invalid descriptor? */···2005 list_for_each_entry(mixer, &chip->mixer_list, list) {2006 snd_iprintf(buffer,2007 "USB Mixer: usb_id=0x%08x, ctrlif=%i, ctlerr=%i\n",2008- chip->usb_id, mixer->ctrlif,2009 mixer->ignore_ctl_error);2010 snd_iprintf(buffer, "Card: %s\n", chip->card->longname);2011 for (unitid = 0; unitid < MAX_ID_ELEMS; unitid++) {···2123 int buffer_length;2124 unsigned int epnum;21252126- hostif = &usb_ifnum_to_if(mixer->chip->dev, mixer->ctrlif)->altsetting[0];2127 /* we need one interrupt input endpoint */2128 if (get_iface_desc(hostif)->bNumEndpoints < 1)2129 return 0;···2166 if (!mixer)2167 return -ENOMEM;2168 mixer->chip = chip;2169- mixer->ctrlif = ctrlif;2170 mixer->ignore_ctl_error = ignore_error;2171 mixer->id_elems = kcalloc(MAX_ID_ELEMS, sizeof(*mixer->id_elems),2172 GFP_KERNEL);
···26 *27 */2829+/*30+ * TODOs, for both the mixer and the streaming interfaces:31+ *32+ * - support for UAC2 effect units33+ * - support for graphical equalizers34+ * - RANGE and MEM set commands (UAC2)35+ * - RANGE and MEM interrupt dispatchers (UAC2)36+ * - audio channel clustering (UAC2)37+ * - audio sample rate converter units (UAC2)38+ * - proper handling of clock multipliers (UAC2)39+ * - dispatch clock change notifications (UAC2)40+ * - stop PCM streams which use a clock that became invalid41+ * - stop PCM streams which use a clock selector that has changed42+ * - parse available sample rates again when clock sources changed43+ */44+45#include <linux/bitops.h>46#include <linux/init.h>47#include <linux/list.h>···275276static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)277{278+ struct snd_usb_audio *chip = cval->mixer->chip;279 unsigned char buf[2];280 int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;281 int timeout = 10;282283 while (timeout-- > 0) {284+ if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request,00285 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,286+ validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),287 buf, val_len, 100) >= val_len) {288 *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len));289 return 0;290 }291 }292 snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",293+ request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type);294 return -EINVAL;295}296297static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)298{299+ struct snd_usb_audio *chip = cval->mixer->chip;300 unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */301 unsigned char *val;302 int ret, size;···312313 memset(buf, 0, sizeof(buf));314315+ ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,00316 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,317+ validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),318 buf, size, 1000);319320 if (ret < 0) {321 snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",322+ request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type);323 return ret;324 }325···397int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,398 int request, int validx, int value_set)399{400+ struct snd_usb_audio *chip = cval->mixer->chip;401 unsigned char buf[2];402 int val_len, timeout = 10;403···419 buf[0] = value_set & 0xff;420 buf[1] = (value_set >> 8) & 0xff;421 while (timeout-- > 0)422+ if (snd_usb_ctl_msg(chip->dev,423+ usb_sndctrlpipe(chip->dev, 0), request,0424 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,425+ validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),426 buf, val_len, 100) >= 0)427 return 0;428 snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n",429+ request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type, buf[0], buf[1]);430 return -EINVAL;431}432···582 switch (iterm->type >> 16) {583 case UAC_SELECTOR_UNIT:584 strcpy(name, "Selector"); return 8;585+ case UAC1_PROCESSING_UNIT:586 strcpy(name, "Process Unit"); return 12;587+ case UAC1_EXTENSION_UNIT:588 strcpy(name, "Ext Unit"); return 8;589 case UAC_MIXER_UNIT:590 strcpy(name, "Mixer"); return 5;···672 term->name = uac_selector_unit_iSelector(d);673 return 0;674 }675+ case UAC1_PROCESSING_UNIT:676+ case UAC1_EXTENSION_UNIT: {677 struct uac_processing_unit_descriptor *d = p1;678 if (d->bNrInPins) {679 id = d->baSourceID[0];···745 */746static int get_min_max(struct usb_mixer_elem_info *cval, int default_min)747{748+ struct snd_usb_audio *chip = cval->mixer->chip;749+750 /* for failsafe */751 cval->min = default_min;752 cval->max = cval->min + 1;···767 if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 ||768 get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) {769 snd_printd(KERN_ERR "%d:%d: cannot get min/max values for control %d (id %d)\n",770+ cval->id, snd_usb_ctrl_intf(chip), cval->control, cval->id);771 return -EINVAL;772 }773 if (get_ctl_value(cval, UAC_GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) {···1199 }1200 } else { /* UAC_VERSION_2 */1201 for (i = 0; i < 30/2; i++) {000000001202 unsigned int ch_bits = 0;1203 unsigned int ch_read_only = 0;1204···1855 return parse_audio_selector_unit(state, unitid, p1);1856 case UAC_FEATURE_UNIT:1857 return parse_audio_feature_unit(state, unitid, p1);1858+ case UAC1_PROCESSING_UNIT:1859 /* UAC2_EFFECT_UNIT has the same value */1860 if (state->mixer->protocol == UAC_VERSION_1)1861 return parse_audio_processing_unit(state, unitid, p1);1862 else1863 return 0; /* FIXME - effect units not implemented yet */1864+ case UAC1_EXTENSION_UNIT:1865 /* UAC2_PROCESSING_UNIT_V2 has the same value */1866 if (state->mixer->protocol == UAC_VERSION_1)1867 return parse_audio_extension_unit(state, unitid, p1);···1905 struct usb_host_interface *hostif;1906 void *p;19071908+ hostif = mixer->chip->ctrl_intf;1909 memset(&state, 0, sizeof(state));1910 state.chip = mixer->chip;1911 state.mixer = mixer;···1925 p = NULL;1926 while ((p = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, p, UAC_OUTPUT_TERMINAL)) != NULL) {1927 if (mixer->protocol == UAC_VERSION_1) {1928+ struct uac1_output_terminal_descriptor *desc = p;19291930 if (desc->bLength < sizeof(*desc))1931 continue; /* invalid descriptor? */···1997 list_for_each_entry(mixer, &chip->mixer_list, list) {1998 snd_iprintf(buffer,1999 "USB Mixer: usb_id=0x%08x, ctrlif=%i, ctlerr=%i\n",2000+ chip->usb_id, snd_usb_ctrl_intf(chip),2001 mixer->ignore_ctl_error);2002 snd_iprintf(buffer, "Card: %s\n", chip->card->longname);2003 for (unitid = 0; unitid < MAX_ID_ELEMS; unitid++) {···2115 int buffer_length;2116 unsigned int epnum;21172118+ hostif = mixer->chip->ctrl_intf;2119 /* we need one interrupt input endpoint */2120 if (get_iface_desc(hostif)->bNumEndpoints < 1)2121 return 0;···2158 if (!mixer)2159 return -ENOMEM;2160 mixer->chip = chip;02161 mixer->ignore_ctl_error = ignore_error;2162 mixer->id_elems = kcalloc(MAX_ID_ELEMS, sizeof(*mixer->id_elems),2163 GFP_KERNEL);
-1
sound/usb/mixer.h
···34struct usb_mixer_interface {5 struct snd_usb_audio *chip;6- unsigned int ctrlif;7 struct list_head list;8 unsigned int ignore_ctl_error;9 struct urb *urb;