Merge branch 'topic/misc' into for-linus

+1071 -692
+6 -161
Documentation/kernel-parameters.txt
··· 280 280 no: ACPI OperationRegions are not marked as reserved, 281 281 no further checks are performed. 282 282 283 - ad1848= [HW,OSS] 284 - Format: <io>,<irq>,<dma>,<dma2>,<type> 285 - 286 283 add_efi_memmap [EFI; X86] Include EFI memory map in 287 284 kernel's map of available physical RAM. 288 285 289 286 advansys= [HW,SCSI] 290 287 See header of drivers/scsi/advansys.c. 291 - 292 - aedsp16= [HW,OSS] Audio Excel DSP 16 293 - Format: <io>,<irq>,<dma>,<mss_io>,<mpu_io>,<mpu_irq> 294 - See also header of sound/oss/aedsp16.c. 295 288 296 289 agp= [AGP] 297 290 { off | try_unsupported } ··· 303 310 304 311 aic79xx= [HW,SCSI] 305 312 See Documentation/scsi/aic79xx.txt. 313 + 314 + ALSA [HW,ALSA] 315 + See Documentation/sound/alsa/alsa-parameters.txt 306 316 307 317 alignment= [KNL,ARM] 308 318 Allow the default userspace alignment fault handler ··· 650 654 disable_timer_pin_1 [X86] 651 655 Disable PIN 1 of APIC timer 652 656 Can be useful to work around chipset bugs. 653 - 654 - dmasound= [HW,OSS] Sound subsystem buffers 655 657 656 658 dma_debug=off If the kernel is compiled with DMA_API_DEBUG support, 657 659 this option disables the debugging code at boot. ··· 1517 1523 that the amount of memory usable for all allocations 1518 1524 is not too small. 1519 1525 1520 - mpu401= [HW,OSS] 1521 - Format: <io>,<irq> 1522 - 1523 1526 MTD_Partition= [MTD] 1524 1527 Format: <name>,<region-number>,<size>,<offset> 1525 1528 ··· 1840 1849 For example, to override I2C bus2: 1841 1850 omap_mux=i2c2_scl.i2c2_scl=0x100,i2c2_sda.i2c2_sda=0x100 1842 1851 1843 - opl3= [HW,OSS] 1844 - Format: <io> 1845 - 1846 1852 oprofile.timer= [HW] 1847 1853 Use timer interrupt instead of performance counters 1848 1854 ··· 1850 1862 arch_perfmon: [X86] Force use of architectural 1851 1863 perfmon on Intel CPUs instead of the 1852 1864 CPU specific event set. 1865 + 1866 + OSS [HW,OSS] 1867 + See Documentation/sound/oss/oss-parameters.txt 1853 1868 1854 1869 osst= [HW,SCSI] SCSI Tape Driver 1855 1870 Format: <buffer_size>,<write_threshold> ··· 1889 1898 up parallel port mode and sets it to spp. 1890 1899 Currently this function knows 686a and 8231 chips. 1891 1900 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> 1895 1901 1896 1902 pas16= [HW,SCSI] 1897 1903 See header of drivers/scsi/pas16.c. ··· 2159 2171 [HW,MOUSE] Controls Logitech smartscroll autorepeat. 2160 2172 0 = disabled, 1 = enabled (default). 2161 2173 2162 - pss= [HW,OSS] Personal Sound System (ECHO ESC614) 2163 - Format: 2164 - <io>,<mss_io>,<mss_irq>,<mss_dma>,<mpu_io>,<mpu_irq> 2165 - 2166 2174 pt. [PARIDE] 2167 2175 See Documentation/blockdev/paride.txt. 2168 2176 ··· 2367 2383 1: Fast pin select (default) 2368 2384 2: ATC IRMode 2369 2385 2370 - 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 2386 softlockup_panic= 2493 2387 [KNL] Should the soft-lockup detector generate panics. 2494 2388 ··· 2380 2518 spia_fio_base= 2381 2519 spia_pedr= 2382 2520 spia_peddr= 2383 - 2384 - sscape= [HW,OSS] 2385 - Format: <io>,<irq>,<dma>,<mpu_io>,<mpu_irq> 2386 2521 2387 2522 st= [HW,SCSI] SCSI tape parameters (buffers, etc.) 2388 2523 See Documentation/scsi/st.txt. ··· 2520 2661 to facilitate early boot debugging. 2521 2662 See also Documentation/trace/events.txt 2522 2663 2523 - trix= [HW,OSS] MediaTrix AudioTrix Pro 2524 - Format: 2525 - <io>,<irq>,<dma>,<dma2>,<sb_io>,<sb_irq>,<sb_dma>,<mpu_io>,<mpu_irq> 2526 - 2527 2664 tsc= Disable clocksource-must-verify flag for TSC. 2528 2665 Format: <string> 2529 2666 [x86] reliable: mark tsc clocksource as reliable, this ··· 2535 2680 2536 2681 u14-34f= [HW,SCSI] UltraStor 14F/34F SCSI host adapter 2537 2682 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> 2544 2683 2545 2684 uhash_entries= [KNL,NET] 2546 2685 Set number of hash buckets for UDP/UDP-Lite connections ··· 2701 2852 overridden by individual drivers. 0 will hide 2702 2853 cursors, 1 will display them. 2703 2854 2704 - waveartist= [HW,OSS] 2705 - Format: <io>,<irq>,<dma>,<dma2> 2706 - 2707 2855 wd33c93= [HW,SCSI] 2708 2856 See header of drivers/scsi/wd33c93.c. 2709 2857 ··· 2733 2887 2734 2888 TODO: 2735 2889 2736 - Add documentation for ALSA options. 2737 2890 Add more DRM drivers.
+8
Documentation/sound/alsa/Procfile.txt
··· 103 103 bit 2 = Enable additional jiffies check 104 104 bit 3 = Log hwptr update at each period interrupt 105 105 bit 4 = Log hwptr update at each snd_pcm_update_hw_ptr() 106 + bit 5 = Show last 10 positions on error 107 + bit 6 = Do above only once 106 108 107 109 When the bit 0 is set, the driver will show the messages to 108 110 kernel log when an xrun is detected. The debug message is ··· 123 121 124 122 Bits 3 and 4 are for logging the hwptr records. Note that 125 123 these will give flood of kernel messages. 124 + 125 + When bit 5 is set, the driver logs the last 10 xrun errors and 126 + 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. 126 130 127 131 card*/pcm*/sub*/info 128 132 The general information of this PCM sub-stream.
+135
Documentation/sound/alsa/alsa-parameters.txt
··· 1 + ALSA Kernel Parameters 2 + ~~~~~~~~~~~~~~~~~~~~~~ 3 + 4 + See Documentation/kernel-parameters.txt for general information on 5 + specifying module parameters. 6 + 7 + This document may not be entirely up to date and comprehensive. The command 8 + "modinfo -p ${modulename}" shows a current list of all parameters of a loadable 9 + module. Loadable modules, after being loaded into the running kernel, also 10 + reveal their parameters in /sys/module/${modulename}/parameters/. Some of these 11 + parameters may be changed at runtime by the command 12 + "echo -n ${value} > /sys/module/${modulename}/parameters/${parm}". 13 + 14 + 15 + snd-ad1816a= [HW,ALSA] 16 + 17 + snd-ad1848= [HW,ALSA] 18 + 19 + snd-ali5451= [HW,ALSA] 20 + 21 + snd-als100= [HW,ALSA] 22 + 23 + snd-als4000= [HW,ALSA] 24 + 25 + snd-azt2320= [HW,ALSA] 26 + 27 + snd-cmi8330= [HW,ALSA] 28 + 29 + snd-cmipci= [HW,ALSA] 30 + 31 + snd-cs4231= [HW,ALSA] 32 + 33 + snd-cs4232= [HW,ALSA] 34 + 35 + snd-cs4236= [HW,ALSA] 36 + 37 + snd-cs4281= [HW,ALSA] 38 + 39 + snd-cs46xx= [HW,ALSA] 40 + 41 + snd-dt019x= [HW,ALSA] 42 + 43 + snd-dummy= [HW,ALSA] 44 + 45 + snd-emu10k1= [HW,ALSA] 46 + 47 + snd-ens1370= [HW,ALSA] 48 + 49 + snd-ens1371= [HW,ALSA] 50 + 51 + snd-es968= [HW,ALSA] 52 + 53 + snd-es1688= [HW,ALSA] 54 + 55 + snd-es18xx= [HW,ALSA] 56 + 57 + snd-es1938= [HW,ALSA] 58 + 59 + snd-es1968= [HW,ALSA] 60 + 61 + snd-fm801= [HW,ALSA] 62 + 63 + snd-gusclassic= [HW,ALSA] 64 + 65 + snd-gusextreme= [HW,ALSA] 66 + 67 + snd-gusmax= [HW,ALSA] 68 + 69 + snd-hdsp= [HW,ALSA] 70 + 71 + snd-ice1712= [HW,ALSA] 72 + 73 + snd-intel8x0= [HW,ALSA] 74 + 75 + snd-interwave= [HW,ALSA] 76 + 77 + snd-interwave-stb= 78 + [HW,ALSA] 79 + 80 + snd-korg1212= [HW,ALSA] 81 + 82 + snd-maestro3= [HW,ALSA] 83 + 84 + snd-mpu401= [HW,ALSA] 85 + 86 + snd-mtpav= [HW,ALSA] 87 + 88 + snd-nm256= [HW,ALSA] 89 + 90 + snd-opl3sa2= [HW,ALSA] 91 + 92 + snd-opti92x-ad1848= 93 + [HW,ALSA] 94 + 95 + snd-opti92x-cs4231= 96 + [HW,ALSA] 97 + 98 + snd-opti93x= [HW,ALSA] 99 + 100 + snd-pmac= [HW,ALSA] 101 + 102 + snd-rme32= [HW,ALSA] 103 + 104 + snd-rme96= [HW,ALSA] 105 + 106 + snd-rme9652= [HW,ALSA] 107 + 108 + snd-sb8= [HW,ALSA] 109 + 110 + snd-sb16= [HW,ALSA] 111 + 112 + snd-sbawe= [HW,ALSA] 113 + 114 + snd-serial= [HW,ALSA] 115 + 116 + snd-sgalaxy= [HW,ALSA] 117 + 118 + snd-sonicvibes= [HW,ALSA] 119 + 120 + snd-sun-amd7930= 121 + [HW,ALSA] 122 + 123 + snd-sun-cs4231= [HW,ALSA] 124 + 125 + snd-trident= [HW,ALSA] 126 + 127 + snd-usb-audio= [HW,ALSA,USB] 128 + 129 + snd-via82xx= [HW,ALSA] 130 + 131 + snd-virmidi= [HW,ALSA] 132 + 133 + snd-wavefront= [HW,ALSA] 134 + 135 + snd-ymfpci= [HW,ALSA]
+51
Documentation/sound/oss/oss-parameters.txt
··· 1 + OSS Kernel Parameters 2 + ~~~~~~~~~~~~~~~~~~~~~ 3 + 4 + See Documentation/kernel-parameters.txt for general information on 5 + specifying module parameters. 6 + 7 + This document may not be entirely up to date and comprehensive. The command 8 + "modinfo -p ${modulename}" shows a current list of all parameters of a loadable 9 + module. Loadable modules, after being loaded into the running kernel, also 10 + reveal their parameters in /sys/module/${modulename}/parameters/. Some of these 11 + parameters may be changed at runtime by the command 12 + "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 16 19 + 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 buffers 23 + 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 Pro 41 + 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 8 #include "linux/slab.h" 9 9 #include "linux/sound.h" 10 10 #include "linux/soundcard.h" 11 + #include "linux/smp_lock.h" 11 12 #include "asm/uaccess.h" 12 13 #include "init.h" 13 14 #include "os.h" ··· 199 198 if (file->f_mode & FMODE_WRITE) 200 199 w = 1; 201 200 201 + lock_kernel(); 202 202 ret = os_open_file(dsp, of_set_rw(OPENFLAGS(), r, w), 0); 203 + unlock_kernel(); 204 + 203 205 if (ret < 0) { 204 206 kfree(state); 205 207 return ret; ··· 258 254 if (file->f_mode & FMODE_WRITE) 259 255 w = 1; 260 256 257 + lock_kernel(); 261 258 ret = os_open_file(mixer, of_set_rw(OPENFLAGS(), r, w), 0); 259 + unlock_kernel(); 262 260 263 261 if (ret < 0) { 264 262 printk(KERN_ERR "hostaudio_open_mixdev failed to open '%s', "
+3 -3
drivers/usb/gadget/f_audio.c
··· 61 61 #define UAC_DT_TOTAL_LENGTH (UAC_DT_AC_HEADER_LENGTH + UAC_DT_INPUT_TERMINAL_SIZE \ 62 62 + UAC_DT_OUTPUT_TERMINAL_SIZE + UAC_DT_FEATURE_UNIT_SIZE(0)) 63 63 /* B.3.2 Class-Specific AC Interface Descriptor */ 64 - static struct uac_ac_header_descriptor_v1_2 ac_header_desc = { 64 + static struct uac1_ac_header_descriptor_2 ac_header_desc = { 65 65 .bLength = UAC_DT_AC_HEADER_LENGTH, 66 66 .bDescriptorType = USB_DT_CS_INTERFACE, 67 67 .bDescriptorSubtype = UAC_HEADER, ··· 125 125 }; 126 126 127 127 #define OUTPUT_TERMINAL_ID 3 128 - static struct uac_output_terminal_descriptor_v1 output_terminal_desc = { 128 + static struct uac1_output_terminal_descriptor output_terminal_desc = { 129 129 .bLength = UAC_DT_OUTPUT_TERMINAL_SIZE, 130 130 .bDescriptorType = USB_DT_CS_INTERFACE, 131 131 .bDescriptorSubtype = UAC_OUTPUT_TERMINAL, ··· 155 155 }; 156 156 157 157 /* B.4.2 Class-Specific AS Interface Descriptor */ 158 - static struct uac_as_header_descriptor_v1 as_header_desc = { 158 + static struct uac1_as_header_descriptor as_header_desc = { 159 159 .bLength = UAC_DT_AS_HEADER_SIZE, 160 160 .bDescriptorType = USB_DT_CS_INTERFACE, 161 161 .bDescriptorSubtype = UAC_AS_GENERAL,
+1 -1
drivers/usb/gadget/gmidi.c
··· 238 238 }; 239 239 240 240 /* B.3.2 Class-Specific AC Interface Descriptor */ 241 - static const struct uac_ac_header_descriptor_v1_1 ac_header_desc = { 241 + static const struct uac1_ac_header_descriptor_1 ac_header_desc = { 242 242 .bLength = UAC_DT_AC_HEADER_SIZE(1), 243 243 .bDescriptorType = USB_DT_CS_INTERFACE, 244 244 .bDescriptorSubtype = USB_MS_HEADER,
+16 -1
include/linux/usb/audio-v2.h
··· 18 18 /* v1.0 and v2.0 of this standard have many things in common. For the rest 19 19 * of the definitions, please refer to audio.h */ 20 20 21 + /* 22 + * bmControl field decoders 23 + * 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 not 29 + * present then the bit pair must be set to 0b00. 30 + * If a Control is present but read-only, the bit pair must be 31 + * set to 0b01. If a Control is also Host programmable, the bit 32 + * pair must be set to 0b11. The value 0b10 is not allowed. 33 + * 34 + */ 35 + 21 36 static inline bool uac2_control_is_readable(u32 bmControls, u8 control) 22 37 { 23 38 return (bmControls >> (control * 2)) & 0x1; ··· 136 121 137 122 /* 4.9.2 Class-Specific AS Interface Descriptor */ 138 123 139 - struct uac_as_header_descriptor_v2 { 124 + struct uac2_as_header_descriptor { 140 125 __u8 bLength; 141 126 __u8 bDescriptorType; 142 127 __u8 bDescriptorSubtype;
+6 -6
include/linux/usb/audio.h
··· 39 39 #define UAC_MIXER_UNIT 0x04 40 40 #define UAC_SELECTOR_UNIT 0x05 41 41 #define UAC_FEATURE_UNIT 0x06 42 - #define UAC_PROCESSING_UNIT_V1 0x07 43 - #define UAC_EXTENSION_UNIT_V1 0x08 42 + #define UAC1_PROCESSING_UNIT 0x07 43 + #define UAC1_EXTENSION_UNIT 0x08 44 44 45 45 /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ 46 46 #define UAC_AS_GENERAL 0x01 ··· 151 151 152 152 /* Terminal Control Selectors */ 153 153 /* 4.3.2 Class-Specific AC Interface Descriptor */ 154 - struct uac_ac_header_descriptor_v1 { 154 + struct uac1_ac_header_descriptor { 155 155 __u8 bLength; /* 8 + n */ 156 156 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 157 157 __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ ··· 165 165 166 166 /* As above, but more useful for defining your own descriptors: */ 167 167 #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ 168 - struct uac_ac_header_descriptor_v1_##n { \ 168 + struct uac1_ac_header_descriptor_##n { \ 169 169 __u8 bLength; \ 170 170 __u8 bDescriptorType; \ 171 171 __u8 bDescriptorSubtype; \ ··· 205 205 #define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01 206 206 207 207 /* 4.3.2.2 Output Terminal Descriptor */ 208 - struct uac_output_terminal_descriptor_v1 { 208 + struct uac1_output_terminal_descriptor { 209 209 __u8 bLength; /* in bytes: 9 */ 210 210 __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ 211 211 __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ ··· 395 395 } 396 396 397 397 /* 4.5.2 Class-Specific AS Interface Descriptor */ 398 - struct uac_as_header_descriptor_v1 { 398 + struct uac1_as_header_descriptor { 399 399 __u8 bLength; /* in bytes: 7 */ 400 400 __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ 401 401 __u8 bDescriptorSubtype; /* AS_GENERAL */
+5 -1
include/sound/asound.h
··· 212 212 #define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */ 213 213 #define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */ 214 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_3BE 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_1B 216 220 217 221 #ifdef SNDRV_LITTLE_ENDIAN 218 222 #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE
+5 -1
include/sound/pcm.h
··· 174 174 #define SNDRV_PCM_FMTBIT_U18_3LE (1ULL << SNDRV_PCM_FORMAT_U18_3LE) 175 175 #define SNDRV_PCM_FMTBIT_S18_3BE (1ULL << SNDRV_PCM_FORMAT_S18_3BE) 176 176 #define SNDRV_PCM_FMTBIT_U18_3BE (1ULL << SNDRV_PCM_FORMAT_U18_3BE) 177 + #define SNDRV_PCM_FMTBIT_G723_24 (1ULL << SNDRV_PCM_FORMAT_G723_24) 178 + #define SNDRV_PCM_FMTBIT_G723_24_1B (1ULL << SNDRV_PCM_FORMAT_G723_24_1B) 179 + #define SNDRV_PCM_FMTBIT_G723_40 (1ULL << SNDRV_PCM_FORMAT_G723_40) 180 + #define SNDRV_PCM_FMTBIT_G723_40_1B (1ULL << SNDRV_PCM_FORMAT_G723_40_1B) 177 181 178 182 #ifdef SNDRV_LITTLE_ENDIAN 179 183 #define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE ··· 317 313 struct snd_pcm_mmap_control *control; 318 314 319 315 /* -- locking / scheduling -- */ 320 - unsigned int twake: 1; /* do transfer (!poll) wakeup */ 316 + snd_pcm_uframes_t twake; /* do transfer (!poll) wakeup if non-zero */ 321 317 wait_queue_head_t sleep; /* poll sleep */ 322 318 wait_queue_head_t tsleep; /* transfer sleep */ 323 319 struct fasync_struct *fasync;
+17 -8
sound/core/pcm_lib.c
··· 67 67 } else { 68 68 if (new_hw_ptr == ULONG_MAX) { /* initialization */ 69 69 snd_pcm_sframes_t avail = snd_pcm_playback_hw_avail(runtime); 70 + if (avail > runtime->buffer_size) 71 + avail = runtime->buffer_size; 70 72 runtime->silence_filled = avail > 0 ? avail : 0; 71 73 runtime->silence_start = (runtime->status->hw_ptr + 72 74 runtime->silence_filled) % ··· 289 287 return -EPIPE; 290 288 } 291 289 } 292 - if (avail >= runtime->control->avail_min) 293 - wake_up(runtime->twake ? &runtime->tsleep : &runtime->sleep); 290 + if (runtime->twake) { 291 + if (avail >= runtime->twake) 292 + wake_up(&runtime->tsleep); 293 + } else if (avail >= runtime->control->avail_min) 294 + wake_up(&runtime->sleep); 294 295 return 0; 295 296 } 296 297 ··· 1712 1707 * The available space is stored on availp. When err = 0 and avail = 0 1713 1708 * on the capture stream, it indicates the stream is in DRAINING state. 1714 1709 */ 1715 - static int wait_for_avail_min(struct snd_pcm_substream *substream, 1710 + static int wait_for_avail(struct snd_pcm_substream *substream, 1716 1711 snd_pcm_uframes_t *availp) 1717 1712 { 1718 1713 struct snd_pcm_runtime *runtime = substream->runtime; ··· 1762 1757 avail = snd_pcm_playback_avail(runtime); 1763 1758 else 1764 1759 avail = snd_pcm_capture_avail(runtime); 1765 - if (avail >= runtime->control->avail_min) 1760 + if (avail >= runtime->twake) 1766 1761 break; 1767 1762 } 1768 1763 _endloop: ··· 1825 1820 goto _end_unlock; 1826 1821 } 1827 1822 1828 - runtime->twake = 1; 1823 + runtime->twake = runtime->control->avail_min ? : 1; 1829 1824 while (size > 0) { 1830 1825 snd_pcm_uframes_t frames, appl_ptr, appl_ofs; 1831 1826 snd_pcm_uframes_t avail; ··· 1838 1833 err = -EAGAIN; 1839 1834 goto _end_unlock; 1840 1835 } 1841 - err = wait_for_avail_min(substream, &avail); 1836 + runtime->twake = min_t(snd_pcm_uframes_t, size, 1837 + runtime->control->avail_min ? : 1); 1838 + err = wait_for_avail(substream, &avail); 1842 1839 if (err < 0) 1843 1840 goto _end_unlock; 1844 1841 } ··· 2049 2042 goto _end_unlock; 2050 2043 } 2051 2044 2052 - runtime->twake = 1; 2045 + runtime->twake = runtime->control->avail_min ? : 1; 2053 2046 while (size > 0) { 2054 2047 snd_pcm_uframes_t frames, appl_ptr, appl_ofs; 2055 2048 snd_pcm_uframes_t avail; ··· 2067 2060 err = -EAGAIN; 2068 2061 goto _end_unlock; 2069 2062 } 2070 - err = wait_for_avail_min(substream, &avail); 2063 + runtime->twake = min_t(snd_pcm_uframes_t, size, 2064 + runtime->control->avail_min ? : 1); 2065 + err = wait_for_avail(substream, &avail); 2071 2066 if (err < 0) 2072 2067 goto _end_unlock; 2073 2068 if (!avail)
+16
sound/core/pcm_misc.c
··· 128 128 .width = 4, .phys = 4, .le = -1, .signd = -1, 129 129 .silence = {}, 130 130 }, 131 + [SNDRV_PCM_FORMAT_G723_24] = { 132 + .width = 3, .phys = 3, .le = -1, .signd = -1, 133 + .silence = {}, 134 + }, 135 + [SNDRV_PCM_FORMAT_G723_40] = { 136 + .width = 5, .phys = 5, .le = -1, .signd = -1, 137 + .silence = {}, 138 + }, 131 139 /* FIXME: the following three formats are not defined properly yet */ 132 140 [SNDRV_PCM_FORMAT_MPEG] = { 133 141 .le = -1, .signd = -1, ··· 193 185 [SNDRV_PCM_FORMAT_U18_3BE] = { 194 186 .width = 18, .phys = 24, .le = 0, .signd = 0, 195 187 .silence = { 0x02, 0x00, 0x00 }, 188 + }, 189 + [SNDRV_PCM_FORMAT_G723_24_1B] = { 190 + .width = 3, .phys = 8, .le = -1, .signd = -1, 191 + .silence = {}, 192 + }, 193 + [SNDRV_PCM_FORMAT_G723_40_1B] = { 194 + .width = 5, .phys = 8, .le = -1, .signd = -1, 195 + .silence = {}, 196 196 }, 197 197 }; 198 198
+21 -3
sound/drivers/Kconfig
··· 170 170 AC97 codecs. In this mode, the power-mode is dynamically 171 171 controlled at each open/close. 172 172 173 - The mode is activated by passing power_save=1 option to 174 - snd-ac97-codec driver. You can toggle it dynamically over 175 - sysfs, too. 173 + The mode is activated by passing 'power_save=X' to the 174 + snd-ac97-codec driver module, where 'X' is the time-out 175 + value, a nonnegative integer that specifies how many 176 + seconds of idle time the driver must count before it may 177 + 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_save 184 + 185 + In this case, the time-out is set to 10 seconds; setting 186 + the time-out to 1 second (the minimum activation value) 187 + isn't recommended because many applications try to reopen 188 + the device frequently. A value of 10 seconds would be a 189 + good choice for normal operations. 190 + 191 + See Documentation/sound/alsa/powersave.txt for more details. 176 192 177 193 config SND_AC97_POWER_SAVE_DEFAULT 178 194 int "Default time-out for AC97 power-save mode" ··· 197 181 help 198 182 The default time-out value in seconds for AC97 automatic 199 183 power-save mode. 0 means to disable the power-save mode. 184 + 185 + See SND_AC97_POWER_SAVE for more details. 200 186 201 187 endif # SND_DRIVERS
+4 -1
sound/isa/msnd/msnd_pinnacle.c
··· 549 549 printk(KERN_ERR LOGNAME ": Couldn't grab IRQ %d\n", chip->irq); 550 550 return err; 551 551 } 552 - request_region(chip->io, DSP_NUMIO, card->shortname); 552 + if (request_region(chip->io, DSP_NUMIO, card->shortname) == NULL) { 553 + free_irq(chip->irq, chip); 554 + return -EBUSY; 555 + } 553 556 554 557 if (!request_mem_region(chip->base, BUFFSIZE, card->shortname)) { 555 558 printk(KERN_ERR LOGNAME
+6 -3
sound/isa/sb/emu8000_pcm.c
··· 433 433 while (count > 0) { 434 434 unsigned short sval; 435 435 CHECK_SCHEDULER(); 436 - get_user(sval, buf); 436 + if (get_user(sval, buf)) 437 + return -EFAULT; 437 438 EMU8000_SMLD_WRITE(emu, sval); 438 439 buf++; 439 440 count--; ··· 526 525 while (count-- > 0) { 527 526 unsigned short sval; 528 527 CHECK_SCHEDULER(); 529 - get_user(sval, buf); 528 + if (get_user(sval, buf)) 529 + return -EFAULT; 530 530 EMU8000_SMLD_WRITE(emu, sval); 531 531 buf++; 532 532 if (rec->voices > 1) { 533 533 CHECK_SCHEDULER(); 534 - get_user(sval, buf); 534 + if (get_user(sval, buf)) 535 + return -EFAULT; 535 536 EMU8000_SMRD_WRITE(emu, sval); 536 537 buf++; 537 538 }
+52 -39
sound/oss/au1550_ac97.c
··· 43 43 #include <linux/sound.h> 44 44 #include <linux/slab.h> 45 45 #include <linux/soundcard.h> 46 + #include <linux/smp_lock.h> 46 47 #include <linux/init.h> 47 48 #include <linux/interrupt.h> 48 49 #include <linux/kernel.h> ··· 163 162 static void 164 163 au1550_delay(int msec) 165 164 { 166 - unsigned long tmo; 167 - signed long tmo2; 168 - 169 165 if (in_interrupt()) 170 166 return; 171 167 172 - tmo = jiffies + (msec * HZ) / 1000; 173 - for (;;) { 174 - tmo2 = tmo - jiffies; 175 - if (tmo2 <= 0) 176 - break; 177 - schedule_timeout(tmo2); 178 - } 168 + schedule_timeout_uninterruptible(msecs_to_jiffies(msec)); 179 169 } 180 170 181 171 static u16 ··· 799 807 static int 800 808 au1550_open_mixdev(struct inode *inode, struct file *file) 801 809 { 810 + lock_kernel(); 802 811 file->private_data = &au1550_state; 812 + unlock_kernel(); 803 813 return 0; 804 814 } 805 815 ··· 818 824 return codec->mixer_ioctl(codec, cmd, arg); 819 825 } 820 826 821 - static int 822 - au1550_ioctl_mixdev(struct inode *inode, struct file *file, 823 - unsigned int cmd, unsigned long arg) 827 + static long 828 + au1550_ioctl_mixdev(struct file *file, unsigned int cmd, unsigned long arg) 824 829 { 825 830 struct au1550_state *s = (struct au1550_state *)file->private_data; 826 831 struct ac97_codec *codec = s->codec; 832 + int ret; 827 833 828 - return mixdev_ioctl(codec, cmd, arg); 834 + lock_kernel(); 835 + ret = mixdev_ioctl(codec, cmd, arg); 836 + unlock_kernel(); 837 + 838 + return ret; 829 839 } 830 840 831 841 static /*const */ struct file_operations au1550_mixer_fops = { 832 - owner:THIS_MODULE, 833 - llseek:au1550_llseek, 834 - ioctl:au1550_ioctl_mixdev, 835 - open:au1550_open_mixdev, 836 - release:au1550_release_mixdev, 842 + .owner = THIS_MODULE, 843 + .llseek = au1550_llseek, 844 + .unlocked_ioctl = au1550_ioctl_mixdev, 845 + .open = au1550_open_mixdev, 846 + .release = au1550_release_mixdev, 837 847 }; 838 848 839 849 static int ··· 1341 1343 1342 1344 1343 1345 static int 1344 - au1550_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 1345 - unsigned long arg) 1346 + au1550_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 1346 1347 { 1347 1348 struct au1550_state *s = (struct au1550_state *)file->private_data; 1348 1349 unsigned long flags; ··· 1777 1780 return mixdev_ioctl(s->codec, cmd, arg); 1778 1781 } 1779 1782 1783 + static long 1784 + au1550_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 1785 + { 1786 + int ret; 1787 + 1788 + lock_kernel(); 1789 + ret = au1550_ioctl(file, cmd, arg); 1790 + unlock_kernel(); 1791 + 1792 + return ret; 1793 + } 1780 1794 1781 1795 static int 1782 1796 au1550_open(struct inode *inode, struct file *file) ··· 1805 1797 #endif 1806 1798 1807 1799 file->private_data = s; 1800 + lock_kernel(); 1808 1801 /* wait for device to become free */ 1809 1802 mutex_lock(&s->open_mutex); 1810 1803 while (s->open_mode & file->f_mode) { 1811 - if (file->f_flags & O_NONBLOCK) { 1812 - mutex_unlock(&s->open_mutex); 1813 - return -EBUSY; 1814 - } 1804 + ret = -EBUSY; 1805 + if (file->f_flags & O_NONBLOCK) 1806 + goto out; 1815 1807 add_wait_queue(&s->open_wait, &wait); 1816 1808 __set_current_state(TASK_INTERRUPTIBLE); 1817 1809 mutex_unlock(&s->open_mutex); 1818 1810 schedule(); 1819 1811 remove_wait_queue(&s->open_wait, &wait); 1820 1812 set_current_state(TASK_RUNNING); 1813 + ret = -ERESTARTSYS; 1821 1814 if (signal_pending(current)) 1822 - return -ERESTARTSYS; 1815 + goto out2; 1823 1816 mutex_lock(&s->open_mutex); 1824 1817 } 1825 1818 ··· 1849 1840 1850 1841 if (file->f_mode & FMODE_READ) { 1851 1842 if ((ret = prog_dmabuf_adc(s))) 1852 - return ret; 1843 + goto out; 1853 1844 } 1854 1845 if (file->f_mode & FMODE_WRITE) { 1855 1846 if ((ret = prog_dmabuf_dac(s))) 1856 - return ret; 1847 + goto out; 1857 1848 } 1858 1849 1859 1850 s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE); 1860 - mutex_unlock(&s->open_mutex); 1861 1851 mutex_init(&s->sem); 1862 - return 0; 1852 + ret = 0; 1853 + out: 1854 + mutex_unlock(&s->open_mutex); 1855 + out2: 1856 + unlock_kernel(); 1857 + return ret; 1863 1858 } 1864 1859 1865 1860 static int ··· 1898 1885 } 1899 1886 1900 1887 static /*const */ struct file_operations au1550_audio_fops = { 1901 - owner: THIS_MODULE, 1902 - llseek: au1550_llseek, 1903 - read: au1550_read, 1904 - write: au1550_write, 1905 - poll: au1550_poll, 1906 - ioctl: au1550_ioctl, 1907 - mmap: au1550_mmap, 1908 - open: au1550_open, 1909 - release: au1550_release, 1888 + .owner = THIS_MODULE, 1889 + .llseek = au1550_llseek, 1890 + .read = au1550_read, 1891 + .write = au1550_write, 1892 + .poll = au1550_poll, 1893 + .unlocked_ioctl = au1550_unlocked_ioctl, 1894 + .mmap = au1550_mmap, 1895 + .open = au1550_open, 1896 + .release = au1550_release, 1910 1897 }; 1911 1898 1912 1899 MODULE_AUTHOR("Advanced Micro Devices (AMD), dan@embeddededge.com");
+50 -13
sound/oss/dmasound/dmasound_core.c
··· 323 323 324 324 static int mixer_open(struct inode *inode, struct file *file) 325 325 { 326 - if (!try_module_get(dmasound.mach.owner)) 326 + lock_kernel(); 327 + if (!try_module_get(dmasound.mach.owner)) { 328 + unlock_kernel(); 327 329 return -ENODEV; 330 + } 328 331 mixer.busy = 1; 332 + unlock_kernel(); 329 333 return 0; 330 334 } 331 335 ··· 341 337 unlock_kernel(); 342 338 return 0; 343 339 } 344 - static int mixer_ioctl(struct inode *inode, struct file *file, u_int cmd, 345 - u_long arg) 340 + 341 + static int mixer_ioctl(struct file *file, u_int cmd, u_long arg) 346 342 { 347 343 if (_SIOC_DIR(cmd) & _SIOC_WRITE) 348 344 mixer.modify_counter++; ··· 366 362 return -EINVAL; 367 363 } 368 364 365 + static long mixer_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) 366 + { 367 + int ret; 368 + 369 + lock_kernel(); 370 + ret = mixer_ioctl(file, cmd, arg); 371 + unlock_kernel(); 372 + 373 + return ret; 374 + } 375 + 369 376 static const struct file_operations mixer_fops = 370 377 { 371 378 .owner = THIS_MODULE, 372 379 .llseek = no_llseek, 373 - .ioctl = mixer_ioctl, 380 + .unlocked_ioctl = mixer_unlocked_ioctl, 374 381 .open = mixer_open, 375 382 .release = mixer_release, 376 383 }; ··· 752 737 { 753 738 int rc; 754 739 755 - if (!try_module_get(dmasound.mach.owner)) 740 + lock_kernel(); 741 + if (!try_module_get(dmasound.mach.owner)) { 742 + unlock_kernel(); 756 743 return -ENODEV; 744 + } 757 745 758 746 rc = write_sq_open(file); /* checks the f_mode */ 759 747 if (rc) ··· 799 781 sound_set_format(AFMT_MU_LAW); 800 782 } 801 783 #endif 802 - 784 + unlock_kernel(); 803 785 return 0; 804 786 out: 805 787 module_put(dmasound.mach.owner); 788 + unlock_kernel(); 806 789 return rc; 807 790 } 808 791 ··· 974 955 return 0 ; 975 956 } 976 957 977 - static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd, 978 - u_long arg) 958 + static int sq_ioctl(struct file *file, u_int cmd, u_long arg) 979 959 { 980 960 int val, result; 981 961 u_long fmt; ··· 1132 1114 return IOCTL_OUT(arg,val); 1133 1115 1134 1116 default: 1135 - return mixer_ioctl(inode, file, cmd, arg); 1117 + return mixer_ioctl(file, cmd, arg); 1136 1118 } 1137 1119 return -EINVAL; 1120 + } 1121 + 1122 + static long sq_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) 1123 + { 1124 + int ret; 1125 + 1126 + lock_kernel(); 1127 + ret = sq_ioctl(file, cmd, arg); 1128 + unlock_kernel(); 1129 + 1130 + return ret; 1138 1131 } 1139 1132 1140 1133 static const struct file_operations sq_fops = ··· 1154 1125 .llseek = no_llseek, 1155 1126 .write = sq_write, 1156 1127 .poll = sq_poll, 1157 - .ioctl = sq_ioctl, 1128 + .unlocked_ioctl = sq_unlocked_ioctl, 1158 1129 .open = sq_open, 1159 1130 .release = sq_release, 1160 1131 }; ··· 1255 1226 { 1256 1227 char *buffer = state.buf; 1257 1228 int len = 0; 1229 + int ret; 1258 1230 1231 + lock_kernel(); 1232 + ret = -EBUSY; 1259 1233 if (state.busy) 1260 - return -EBUSY; 1234 + goto out; 1261 1235 1236 + ret = -ENODEV; 1262 1237 if (!try_module_get(dmasound.mach.owner)) 1263 - return -ENODEV; 1238 + goto out; 1239 + 1264 1240 state.ptr = 0; 1265 1241 state.busy = 1; 1266 1242 ··· 1327 1293 printk(KERN_ERR "dmasound_core: stat buffer overflowed!\n"); 1328 1294 1329 1295 state.len = len; 1330 - return 0; 1296 + ret = 0; 1297 + out: 1298 + unlock_kernel(); 1299 + return ret; 1331 1300 } 1332 1301 1333 1302 static int state_release(struct inode *inode, struct file *file)
+3 -1
sound/oss/midi_synth.c
··· 523 523 { 524 524 unsigned char data; 525 525 526 - get_user(*(unsigned char *) &data, (unsigned char __user *) &((addr)[hdr_size + i])); 526 + if (get_user(data, 527 + (unsigned char __user *)(addr + hdr_size + i))) 528 + return -EFAULT; 527 529 528 530 eox_seen = (i > 0 && data & 0x80); /* End of sysex */ 529 531
+26 -13
sound/oss/msnd_pinnacle.c
··· 639 639 return -EINVAL; 640 640 } 641 641 642 - static int dev_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 642 + static long dev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) 643 643 { 644 - int minor = iminor(inode); 644 + int minor = iminor(file->f_path.dentry->d_inode); 645 + int ret; 645 646 646 647 if (cmd == OSS_GETVERSION) { 647 648 int sound_version = SOUND_VERSION; 648 649 return put_user(sound_version, (int __user *)arg); 649 650 } 650 651 651 - if (minor == dev.dsp_minor) 652 - return dsp_ioctl(file, cmd, arg); 653 - else if (minor == dev.mixer_minor) 654 - return mixer_ioctl(cmd, arg); 652 + ret = -EINVAL; 655 653 656 - return -EINVAL; 654 + lock_kernel(); 655 + if (minor == dev.dsp_minor) 656 + ret = dsp_ioctl(file, cmd, arg); 657 + else if (minor == dev.mixer_minor) 658 + ret = mixer_ioctl(cmd, arg); 659 + unlock_kernel(); 660 + 661 + return ret; 657 662 } 658 663 659 664 static void dsp_write_flush(void) ··· 761 756 int minor = iminor(inode); 762 757 int err = 0; 763 758 759 + lock_kernel(); 764 760 if (minor == dev.dsp_minor) { 765 761 if ((file->f_mode & FMODE_WRITE && 766 762 test_bit(F_AUDIO_WRITE_INUSE, &dev.flags)) || 767 763 (file->f_mode & FMODE_READ && 768 - test_bit(F_AUDIO_READ_INUSE, &dev.flags))) 769 - return -EBUSY; 764 + test_bit(F_AUDIO_READ_INUSE, &dev.flags))) { 765 + err = -EBUSY; 766 + goto out; 767 + } 770 768 771 769 if ((err = dsp_open(file)) >= 0) { 772 770 dev.nresets = 0; ··· 790 782 /* nothing */ 791 783 } else 792 784 err = -EINVAL; 793 - 785 + out: 786 + unlock_kernel(); 794 787 return err; 795 788 } 796 789 ··· 1114 1105 .owner = THIS_MODULE, 1115 1106 .read = dev_read, 1116 1107 .write = dev_write, 1117 - .ioctl = dev_ioctl, 1108 + .unlocked_ioctl = dev_ioctl, 1118 1109 .open = dev_open, 1119 1110 .release = dev_release, 1120 1111 }; ··· 1400 1391 printk(KERN_ERR LOGNAME ": Couldn't grab IRQ %d\n", dev.irq); 1401 1392 return err; 1402 1393 } 1403 - request_region(dev.io, dev.numio, dev.name); 1394 + if (request_region(dev.io, dev.numio, dev.name) == NULL) { 1395 + free_irq(dev.irq, &dev); 1396 + return -EBUSY; 1397 + } 1404 1398 1405 - if ((err = dsp_full_reset()) < 0) { 1399 + err = dsp_full_reset(); 1400 + if (err < 0) { 1406 1401 release_region(dev.io, dev.numio); 1407 1402 free_irq(dev.irq, &dev); 1408 1403 return err;
+22 -5
sound/oss/sh_dac_audio.c
··· 15 15 #include <linux/linkage.h> 16 16 #include <linux/slab.h> 17 17 #include <linux/fs.h> 18 + #include <linux/smp_lock.h> 18 19 #include <linux/sound.h> 20 + #include <linux/smp_lock.h> 19 21 #include <linux/soundcard.h> 20 22 #include <linux/interrupt.h> 21 23 #include <linux/hrtimer.h> ··· 94 92 wakeups_per_second = ktime_set(0, 1000000000 / rate); 95 93 } 96 94 97 - static int dac_audio_ioctl(struct inode *inode, struct file *file, 95 + static int dac_audio_ioctl(struct file *file, 98 96 unsigned int cmd, unsigned long arg) 99 97 { 100 98 int val; ··· 160 158 return -EINVAL; 161 159 } 162 160 161 + static long dac_audio_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) 162 + { 163 + int ret; 164 + 165 + lock_kernel(); 166 + ret = dac_audio_ioctl(file, cmd, arg); 167 + unlock_kernel(); 168 + 169 + return ret; 170 + } 171 + 163 172 static ssize_t dac_audio_write(struct file *file, const char *buf, size_t count, 164 173 loff_t * ppos) 165 174 { ··· 229 216 { 230 217 if (file->f_mode & FMODE_READ) 231 218 return -ENODEV; 232 - if (in_use) 219 + 220 + lock_kernel(); 221 + if (in_use) { 222 + unlock_kernel(); 233 223 return -EBUSY; 224 + } 234 225 235 226 in_use = 1; 236 227 237 228 dac_audio_start(); 238 - 229 + unlock_kernel(); 239 230 return 0; 240 231 } 241 232 ··· 254 237 255 238 const struct file_operations dac_audio_fops = { 256 239 .read = dac_audio_read, 257 - .write = dac_audio_write, 258 - .ioctl = dac_audio_ioctl, 240 + .write = dac_audio_write, 241 + .unlocked_ioctl = dac_audio_unlocked_ioctl, 259 242 .open = dac_audio_open, 260 243 .release = dac_audio_release, 261 244 };
+11 -9
sound/oss/soundcard.c
··· 210 210 printk(KERN_ERR "Invalid minor device %d\n", dev); 211 211 return -ENXIO; 212 212 } 213 + lock_kernel(); 213 214 switch (dev & 0x0f) { 214 215 case SND_DEV_CTL: 215 216 dev >>= 4; 216 217 if (dev >= 0 && dev < MAX_MIXER_DEV && mixer_devs[dev] == NULL) { 217 218 request_module("mixer%d", dev); 218 219 } 220 + retval = -ENXIO; 219 221 if (dev && (dev >= num_mixers || mixer_devs[dev] == NULL)) 220 - return -ENXIO; 222 + break; 221 223 222 224 if (!try_module_get(mixer_devs[dev]->owner)) 223 - return -ENXIO; 225 + break; 226 + 227 + retval = 0; 224 228 break; 225 229 226 230 case SND_DEV_SEQ: 227 231 case SND_DEV_SEQ2: 228 - if ((retval = sequencer_open(dev, file)) < 0) 229 - return retval; 232 + retval = sequencer_open(dev, file); 230 233 break; 231 234 232 235 case SND_DEV_MIDIN: 233 - if ((retval = MIDIbuf_open(dev, file)) < 0) 234 - return retval; 236 + retval = MIDIbuf_open(dev, file); 235 237 break; 236 238 237 239 case SND_DEV_DSP: 238 240 case SND_DEV_DSP16: 239 241 case SND_DEV_AUDIO: 240 - if ((retval = audio_open(dev, file)) < 0) 241 - return retval; 242 + retval = audio_open(dev, file); 242 243 break; 243 244 244 245 default: 245 246 printk(KERN_ERR "Invalid minor device %d\n", dev); 246 - return -ENXIO; 247 + retval = -ENXIO; 247 248 } 248 249 250 + unlock_kernel(); 249 251 return 0; 250 252 } 251 253
+35 -6
sound/oss/swarm_cs4297a.c
··· 68 68 #include <linux/delay.h> 69 69 #include <linux/sound.h> 70 70 #include <linux/slab.h> 71 + #include <linux/smp_lock.h> 71 72 #include <linux/soundcard.h> 72 73 #include <linux/ac97_codec.h> 73 74 #include <linux/pci.h> ··· 1535 1534 CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, 1536 1535 printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()+\n")); 1537 1536 1537 + lock_kernel(); 1538 1538 list_for_each(entry, &cs4297a_devs) 1539 1539 { 1540 1540 s = list_entry(entry, struct cs4297a_state, list); ··· 1546 1544 { 1547 1545 CS_DBGOUT(CS_FUNCTION | CS_OPEN | CS_ERROR, 2, 1548 1546 printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- -ENODEV\n")); 1547 + 1548 + unlock_kernel(); 1549 1549 return -ENODEV; 1550 1550 } 1551 1551 VALIDATE_STATE(s); ··· 1555 1551 1556 1552 CS_DBGOUT(CS_FUNCTION | CS_OPEN, 4, 1557 1553 printk(KERN_INFO "cs4297a: cs4297a_open_mixdev()- 0\n")); 1554 + unlock_kernel(); 1558 1555 1559 1556 return nonseekable_open(inode, file); 1560 1557 } ··· 1571 1566 } 1572 1567 1573 1568 1574 - static int cs4297a_ioctl_mixdev(struct inode *inode, struct file *file, 1569 + static int cs4297a_ioctl_mixdev(struct file *file, 1575 1570 unsigned int cmd, unsigned long arg) 1576 1571 { 1577 - return mixer_ioctl((struct cs4297a_state *) file->private_data, cmd, 1572 + int ret; 1573 + lock_kernel(); 1574 + ret = mixer_ioctl((struct cs4297a_state *) file->private_data, cmd, 1578 1575 arg); 1576 + unlock_kernel(); 1577 + return ret; 1579 1578 } 1580 1579 1581 1580 ··· 1589 1580 static const struct file_operations cs4297a_mixer_fops = { 1590 1581 .owner = THIS_MODULE, 1591 1582 .llseek = no_llseek, 1592 - .ioctl = cs4297a_ioctl_mixdev, 1583 + .unlocked_ioctl = cs4297a_ioctl_mixdev, 1593 1584 .open = cs4297a_open_mixdev, 1594 1585 .release = cs4297a_release_mixdev, 1595 1586 }; ··· 1953 1944 } 1954 1945 1955 1946 1956 - static int cs4297a_ioctl(struct inode *inode, struct file *file, 1947 + static int cs4297a_ioctl(struct file *file, 1957 1948 unsigned int cmd, unsigned long arg) 1958 1949 { 1959 1950 struct cs4297a_state *s = ··· 2346 2337 return mixer_ioctl(s, cmd, arg); 2347 2338 } 2348 2339 2340 + static long cs4297a_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) 2341 + { 2342 + int ret; 2343 + 2344 + lock_kernel(); 2345 + ret = cs4297a_ioctl(file, cmd, arg); 2346 + unlock_kernel(); 2347 + 2348 + return ret; 2349 + } 2349 2350 2350 2351 static int cs4297a_release(struct inode *inode, struct file *file) 2351 2352 { ··· 2388 2369 return 0; 2389 2370 } 2390 2371 2391 - static int cs4297a_open(struct inode *inode, struct file *file) 2372 + static int cs4297a_locked_open(struct inode *inode, struct file *file) 2392 2373 { 2393 2374 int minor = iminor(inode); 2394 2375 struct cs4297a_state *s=NULL; ··· 2505 2486 return nonseekable_open(inode, file); 2506 2487 } 2507 2488 2489 + static int cs4297a_open(struct inode *inode, struct file *file) 2490 + { 2491 + int ret; 2492 + 2493 + lock_kernel(); 2494 + ret = cs4297a_open(inode, file); 2495 + unlock_kernel(); 2496 + 2497 + return ret; 2498 + } 2508 2499 2509 2500 // ****************************************************************************************** 2510 2501 // Wave (audio) file operations struct. ··· 2525 2496 .read = cs4297a_read, 2526 2497 .write = cs4297a_write, 2527 2498 .poll = cs4297a_poll, 2528 - .ioctl = cs4297a_ioctl, 2499 + .unlocked_ioctl = cs4297a_unlocked_ioctl, 2529 2500 .mmap = cs4297a_mmap, 2530 2501 .open = cs4297a_open, 2531 2502 .release = cs4297a_release,
-3
sound/oss/vidc.c
··· 491 491 vidc_adev = adev; 492 492 vidc_mixer_set(SOUND_MIXER_VOLUME, (85 | 85 << 8)); 493 493 494 - #if defined(CONFIG_SOUND_SOFTOSS) || defined(CONFIG_SOUND_SOFTOSS_MODULE) 495 - softoss_dev = adev; 496 - #endif 497 494 return; 498 495 499 496 irq_failed:
+21 -11
sound/oss/vwsnd.c
··· 2429 2429 return mask; 2430 2430 } 2431 2431 2432 - static int vwsnd_audio_do_ioctl(struct inode *inode, 2433 - struct file *file, 2432 + static int vwsnd_audio_do_ioctl(struct file *file, 2434 2433 unsigned int cmd, 2435 2434 unsigned long arg) 2436 2435 { ··· 2445 2446 int ival; 2446 2447 2447 2448 2448 - DBGEV("(inode=0x%p, file=0x%p, cmd=0x%x, arg=0x%lx)\n", 2449 - inode, file, cmd, arg); 2449 + DBGEV("(file=0x%p, cmd=0x%x, arg=0x%lx)\n", 2450 + file, cmd, arg); 2450 2451 switch (cmd) { 2451 2452 case OSS_GETVERSION: /* _SIOR ('M', 118, int) */ 2452 2453 DBGX("OSS_GETVERSION\n"); ··· 2884 2885 return -EINVAL; 2885 2886 } 2886 2887 2887 - static int vwsnd_audio_ioctl(struct inode *inode, 2888 - struct file *file, 2888 + static long vwsnd_audio_ioctl(struct file *file, 2889 2889 unsigned int cmd, 2890 2890 unsigned long arg) 2891 2891 { 2892 2892 vwsnd_dev_t *devc = (vwsnd_dev_t *) file->private_data; 2893 2893 int ret; 2894 2894 2895 + lock_kernel(); 2895 2896 mutex_lock(&devc->io_mutex); 2896 - ret = vwsnd_audio_do_ioctl(inode, file, cmd, arg); 2897 + ret = vwsnd_audio_do_ioctl(file, cmd, arg); 2897 2898 mutex_unlock(&devc->io_mutex); 2899 + unlock_kernel(); 2900 + 2898 2901 return ret; 2899 2902 } 2900 2903 ··· 2922 2921 2923 2922 DBGE("(inode=0x%p, file=0x%p)\n", inode, file); 2924 2923 2924 + lock_kernel(); 2925 2925 INC_USE_COUNT; 2926 2926 for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) 2927 2927 if ((devc->audio_minor & ~0x0F) == (minor & ~0x0F)) ··· 2930 2928 2931 2929 if (devc == NULL) { 2932 2930 DEC_USE_COUNT; 2931 + unlock_kernel(); 2933 2932 return -ENODEV; 2934 2933 } 2935 2934 ··· 2939 2936 mutex_unlock(&devc->open_mutex); 2940 2937 if (file->f_flags & O_NONBLOCK) { 2941 2938 DEC_USE_COUNT; 2939 + unlock_kernel(); 2942 2940 return -EBUSY; 2943 2941 } 2944 2942 interruptible_sleep_on(&devc->open_wait); 2945 2943 if (signal_pending(current)) { 2946 2944 DEC_USE_COUNT; 2945 + unlock_kernel(); 2947 2946 return -ERESTARTSYS; 2948 2947 } 2949 2948 mutex_lock(&devc->open_mutex); ··· 2998 2993 2999 2994 file->private_data = devc; 3000 2995 DBGRV(); 2996 + unlock_kernel(); 3001 2997 return 0; 3002 2998 } 3003 2999 ··· 3050 3044 .read = vwsnd_audio_read, 3051 3045 .write = vwsnd_audio_write, 3052 3046 .poll = vwsnd_audio_poll, 3053 - .ioctl = vwsnd_audio_ioctl, 3047 + .unlocked_ioctl = vwsnd_audio_ioctl, 3054 3048 .mmap = vwsnd_audio_mmap, 3055 3049 .open = vwsnd_audio_open, 3056 3050 .release = vwsnd_audio_release, ··· 3068 3062 DBGEV("(inode=0x%p, file=0x%p)\n", inode, file); 3069 3063 3070 3064 INC_USE_COUNT; 3065 + lock_kernel(); 3071 3066 for (devc = vwsnd_dev_list; devc; devc = devc->next_dev) 3072 3067 if (devc->mixer_minor == iminor(inode)) 3073 3068 break; 3074 3069 3075 3070 if (devc == NULL) { 3076 3071 DEC_USE_COUNT; 3072 + unlock_kernel(); 3077 3073 return -ENODEV; 3078 3074 } 3079 3075 file->private_data = devc; 3076 + unlock_kernel(); 3080 3077 return 0; 3081 3078 } 3082 3079 ··· 3212 3203 3213 3204 /* This is the ioctl entry to the mixer driver. */ 3214 3205 3215 - static int vwsnd_mixer_ioctl(struct inode *ioctl, 3216 - struct file *file, 3206 + static long vwsnd_mixer_ioctl(struct file *file, 3217 3207 unsigned int cmd, 3218 3208 unsigned long arg) 3219 3209 { ··· 3223 3215 3224 3216 DBGEV("(devc=0x%p, cmd=0x%x, arg=0x%lx)\n", devc, cmd, arg); 3225 3217 3218 + lock_kernel(); 3226 3219 mutex_lock(&devc->mix_mutex); 3227 3220 { 3228 3221 if ((cmd & ~nrmask) == MIXER_READ(0)) ··· 3234 3225 retval = -EINVAL; 3235 3226 } 3236 3227 mutex_unlock(&devc->mix_mutex); 3228 + unlock_kernel(); 3237 3229 return retval; 3238 3230 } 3239 3231 3240 3232 static const struct file_operations vwsnd_mixer_fops = { 3241 3233 .owner = THIS_MODULE, 3242 3234 .llseek = no_llseek, 3243 - .ioctl = vwsnd_mixer_ioctl, 3235 + .unlocked_ioctl = vwsnd_mixer_ioctl, 3244 3236 .open = vwsnd_mixer_open, 3245 3237 .release = vwsnd_mixer_release, 3246 3238 };
+2 -8
sound/oss/waveartist.c
··· 184 184 static inline int 185 185 waveartist_sleep(int timeout_ms) 186 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; 187 + unsigned int timeout = msecs_to_jiffies(timeout_ms*100); 188 + return schedule_timeout_interruptible(timeout); 195 189 } 196 190 197 191 static int
+2 -2
sound/pci/als4000.c
··· 763 763 /* SPECS_PAGE: 39 */ 764 764 for (i = ALS4K_GCR91_DMA0_ADDR; i <= ALS4K_GCR96_DMA3_MODE_COUNT; ++i) 765 765 snd_als4k_gcr_write(chip, i, 0); 766 - 766 + /* enable burst mode to prevent dropouts during high PCI bus usage */ 767 767 snd_als4k_gcr_write(chip, ALS4K_GCR99_DMA_EMULATION_CTRL, 768 - snd_als4k_gcr_read(chip, ALS4K_GCR99_DMA_EMULATION_CTRL)); 768 + (snd_als4k_gcr_read(chip, ALS4K_GCR99_DMA_EMULATION_CTRL) & ~0x07) | 0x04); 769 769 spin_unlock_irq(&chip->reg_lock); 770 770 } 771 771
+9 -7
sound/pci/asihpi/asihpi.c
··· 460 460 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); 461 461 int err; 462 462 u16 format; 463 + int width; 463 464 unsigned int bytes_per_sec; 464 465 465 466 print_hwparams(params); ··· 513 512 dpcm->hpi_buffer_attached); 514 513 } 515 514 bytes_per_sec = params_rate(params) * params_channels(params); 516 - bytes_per_sec *= snd_pcm_format_width(params_format(params)); 515 + width = snd_pcm_format_width(params_format(params)); 516 + bytes_per_sec *= width; 517 517 bytes_per_sec /= 8; 518 - if (bytes_per_sec <= 0) 518 + if (width < 0 || bytes_per_sec == 0) 519 519 return -EINVAL; 520 520 521 521 dpcm->bytes_per_sec = bytes_per_sec; ··· 1385 1383 1386 1384 compile_time_assert( 1387 1385 (ARRAY_SIZE(asihpi_src_names) == 1388 - (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_BASE+1)), 1386 + (HPI_SOURCENODE_LAST_INDEX-HPI_SOURCENODE_NONE+1)), 1389 1387 assert_src_names_size); 1390 1388 1391 1389 #if ASI_STYLE_NAMES ··· 1416 1414 1417 1415 compile_time_assert( 1418 1416 (ARRAY_SIZE(asihpi_dst_names) == 1419 - (HPI_DESTNODE_LAST_INDEX-HPI_DESTNODE_BASE+1)), 1417 + (HPI_DESTNODE_LAST_INDEX-HPI_DESTNODE_NONE+1)), 1420 1418 assert_dst_names_size); 1421 1419 1422 1420 static inline int ctl_add(struct snd_card *card, struct snd_kcontrol_new *ctl, ··· 2173 2171 &src_node_type, &src_node_index); 2174 2172 2175 2173 sprintf(uinfo->value.enumerated.name, "%s %d", 2176 - asihpi_src_names[src_node_type - HPI_SOURCENODE_BASE], 2174 + asihpi_src_names[src_node_type - HPI_SOURCENODE_NONE], 2177 2175 src_node_index); 2178 2176 return 0; 2179 2177 } ··· 2605 2603 2606 2604 } 2607 2605 2608 - hpi_ctl.src_node_type -= HPI_SOURCENODE_BASE; 2609 - hpi_ctl.dst_node_type -= HPI_DESTNODE_BASE; 2606 + hpi_ctl.src_node_type -= HPI_SOURCENODE_NONE; 2607 + hpi_ctl.dst_node_type -= HPI_DESTNODE_NONE; 2610 2608 2611 2609 /* ASI50xx in SSX mode has multiple meters on the same node. 2612 2610 Use subindex to create distinct ALSA controls
+48 -20
sound/pci/asihpi/hpi.h
··· 50 50 #define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) 51 51 52 52 /* Use single digits for versions less that 10 to avoid octal. */ 53 - #define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 3, 25) 53 + #define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 4, 1) 54 + #define HPI_VER_STRING "4.04.01" 54 55 55 56 /* Library version as documented in hpi-api-versions.txt */ 56 57 #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(9, 0, 0) ··· 204 203 exists on a destination node can be searched for using a source 205 204 node value of either 0, or HPI_SOURCENODE_NONE */ 206 205 HPI_SOURCENODE_NONE = 100, 207 - /** \deprecated Use HPI_SOURCENODE_NONE instead. */ 208 - HPI_SOURCENODE_BASE = 100, 209 206 /** Out Stream (Play) node. */ 210 207 HPI_SOURCENODE_OSTREAM = 101, 211 208 /** Line in node - could be analog, AES/EBU or network. */ ··· 234 235 exists on a source node can be searched for using a destination 235 236 node value of either 0, or HPI_DESTNODE_NONE */ 236 237 HPI_DESTNODE_NONE = 200, 237 - /** \deprecated Use HPI_DESTNODE_NONE instead. */ 238 - HPI_DESTNODE_BASE = 200, 239 238 /** In Stream (Record) node. */ 240 239 HPI_DESTNODE_ISTREAM = 201, 241 240 HPI_DESTNODE_LINEOUT = 202, /**< line out node. */ ··· 429 432 Property 1 - adapter can do samplerate conversion (MRX) 430 433 Property 2 - adapter can do timestretch (TSX) 431 434 */ 432 - HPI_ADAPTER_PROPERTY_CAPS2 = 269 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. The 442 + return value is true (1) or false (0). If the current adapter 443 + mode is MONO SSX2 is disabled, even though this property will 444 + return true. 445 + */ 446 + HPI_ADAPTER_PROPERTY_SUPPORTS_SSX2 = 271 433 447 }; 434 448 435 449 /** Adapter mode commands ··· 821 813 /** The sampleclock output is derived from its local samplerate generator. 822 814 The local samplerate may be set using HPI_SampleClock_SetLocalRate(). */ 823 815 HPI_SAMPLECLOCK_SOURCE_LOCAL = 1, 824 - /** \deprecated Use HPI_SAMPLECLOCK_SOURCE_LOCAL instead */ 825 - HPI_SAMPLECLOCK_SOURCE_ADAPTER = 1, 826 816 /** The adapter is clocked from a dedicated AES/EBU SampleClock input.*/ 827 817 HPI_SAMPLECLOCK_SOURCE_AESEBU_SYNC = 2, 828 818 /** From external wordclock connector */ ··· 831 825 HPI_SAMPLECLOCK_SOURCE_SMPTE = 5, 832 826 /** One of the aesebu inputs */ 833 827 HPI_SAMPLECLOCK_SOURCE_AESEBU_INPUT = 6, 834 - /** \deprecated The first aesebu input with a valid signal 835 - Superseded by separate Auto enable flag 836 - */ 837 - HPI_SAMPLECLOCK_SOURCE_AESEBU_AUTO = 7, 838 828 /** From a network interface e.g. Cobranet or Livewire at either 48 or 96kHz */ 839 829 HPI_SAMPLECLOCK_SOURCE_NETWORK = 8, 840 830 /** From previous adjacent module (ASI2416 only)*/ ··· 1017 1015 HPI_ERROR_CONTROL_DISABLED = 404, 1018 1016 /** I2C transaction failed due to a missing ACK. */ 1019 1017 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 1018 /** Control is busy, or coming out of 1023 1019 reset and cannot be accessed at this time. */ 1024 1020 HPI_ERROR_CONTROL_NOT_READY = 407, ··· 1827 1827 Compressor Expander control 1828 1828 *******************************/ 1829 1829 1830 - 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); 1830 + u16 hpi_compander_set_enable(const struct hpi_hsubsys *ph_subsys, 1831 + u32 h_control, u32 on); 1833 1832 1834 - 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); 1833 + 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_hsubsys 1843 + *ph_subsys, u32 h_control, u32 index, u32 attack); 1844 + 1845 + u16 hpi_compander_get_attack_time_constant(const struct hpi_hsubsys 1846 + *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); 1837 1865 1838 1866 /******************************* 1839 1867 Cobranet HMI control
+7
sound/pci/asihpi/hpi6000.c
··· 687 687 switch (pao->pci.subsys_device_id) { 688 688 case 0x5100: 689 689 case 0x5110: /* ASI5100 revB or higher with C6711D */ 690 + case 0x5200: /* ASI5200 PC_ie version of ASI5100 */ 690 691 case 0x6100: 691 692 case 0x6200: 692 693 boot_load_family = HPI_ADAPTER_FAMILY_ASI(0x6200); ··· 1133 1132 if (HPI_ADAPTER_FAMILY_ASI(pao->pci. 1134 1133 subsys_device_id) == 1135 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)) 1136 1141 mask = 0x00000000L; 1137 1142 break; 1138 1143 case HPI_ADAPTER_FAMILY_ASI(0x8800):
+22 -18
sound/pci/asihpi/hpi_internal.h
··· 104 104 #define STR_ROLE_FIELD_MAX 255U 105 105 106 106 struct hpi_entity_str { 107 - uint16_t size; 108 - uint8_t type; 109 - uint8_t role; 107 + u16 size; 108 + u8 type; 109 + u8 role; 110 110 }; 111 111 112 112 #if defined(_MSC_VER) ··· 119 119 #if ! defined(HPI_OS_DSP_C6000) || (defined(HPI_OS_DSP_C6000) && (__TI_COMPILER_VERSION__ > 6000008)) 120 120 /* DSP C6000 compiler v6.0.8 and lower 121 121 do not support flexible array member */ 122 - uint8_t value[]; 122 + u8 value[]; 123 123 #else 124 124 /* NOTE! Using sizeof(struct hpi_entity) will give erroneous results */ 125 125 #define HPI_INTERNAL_WARN_ABOUT_ENTITY_VALUE 126 - uint8_t value[1]; 126 + u8 value[1]; 127 127 #endif 128 128 }; 129 129 ··· 142 142 /******************************************* CONTROL ATTRIBUTES ****/ 143 143 /* (in order of control type ID */ 144 144 145 - /* This allows for 255 control types, 256 unique attributes each */ 145 + /* This allows for 255 control types, 256 unique attributes each */ 146 146 #define HPI_CTL_ATTR(ctl, ai) (HPI_CONTROL_##ctl * 0x100 + ai) 147 147 148 148 /* Get the sub-index of the attribute for a control type */ 149 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) 150 153 151 154 /* Generic control attributes. */ 152 155 ··· 314 311 /* Microphone control attributes */ 315 312 #define HPI_MICROPHONE_PHANTOM_POWER HPI_CTL_ATTR(MICROPHONE, 1) 316 313 317 - /** Equalizer control attributes 318 - */ 314 + /** Equalizer control attributes */ 319 315 /** Used to get number of filters in an EQ. (Can't set) */ 320 316 #define HPI_EQUALIZER_NUM_FILTERS HPI_CTL_ATTR(EQUALIZER, 1) 321 317 /** Set/get the filter by type, freq, Q, gain */ ··· 322 320 /** Get the biquad coefficients */ 323 321 #define HPI_EQUALIZER_COEFFICIENTS HPI_CTL_ATTR(EQUALIZER, 3) 324 322 325 - #define HPI_COMPANDER_PARAMS HPI_CTL_ATTR(COMPANDER, 1) 323 + /* 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) 326 330 327 - /* 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 control 330 - and apply additional host side operations (like copying data) as required. 331 - */ 331 + /* Cobranet control attributes. */ 332 332 #define HPI_COBRANET_SET HPI_CTL_ATTR(COBRANET, 1) 333 333 #define HPI_COBRANET_GET HPI_CTL_ATTR(COBRANET, 2) 334 334 #define HPI_COBRANET_SET_DATA HPI_CTL_ATTR(COBRANET, 3) ··· 1516 1512 struct hpi_control_cache_info i; 1517 1513 union { 1518 1514 struct { /* volume */ 1519 - u16 an_log[2]; 1515 + short an_log[2]; 1520 1516 } v; 1521 1517 struct { /* peak meter */ 1522 - u16 an_log_peak[2]; 1523 - u16 an_logRMS[2]; 1518 + short an_log_peak[2]; 1519 + short an_logRMS[2]; 1524 1520 } p; 1525 1521 struct { /* channel mode */ 1526 1522 u16 mode; ··· 1530 1526 u16 source_node_index; 1531 1527 } x; 1532 1528 struct { /* level/trim */ 1533 - u16 an_log[2]; 1529 + short an_log[2]; 1534 1530 } l; 1535 1531 struct { /* tuner - partial caching. 1536 1532 some attributes go to the DSP. */
+8 -2
sound/pci/asihpi/hpicmn.c
··· 353 353 phr->u.c.param1 = pC->u.t.band; 354 354 else if ((phm->u.c.attribute == HPI_TUNER_LEVEL) 355 355 && (phm->u.c.param1 == HPI_TUNER_LEVEL_AVERAGE)) 356 - phr->u.c.param1 = pC->u.t.level; 356 + if (pC->u.t.level == HPI_ERROR_ILLEGAL_CACHE_VALUE) { 357 + phr->u.c.param1 = 0; 358 + phr->error = 359 + HPI_ERROR_INVALID_CONTROL_ATTRIBUTE; 360 + } else 361 + phr->u.c.param1 = pC->u.t.level; 357 362 else 358 363 found = 0; 359 364 break; ··· 402 397 if (pC->u.clk.source_index == 403 398 HPI_ERROR_ILLEGAL_CACHE_VALUE) { 404 399 phr->u.c.param1 = 0; 405 - phr->error = HPI_ERROR_INVALID_OPERATION; 400 + phr->error = 401 + HPI_ERROR_INVALID_CONTROL_ATTRIBUTE; 406 402 } else 407 403 phr->u.c.param1 = pC->u.clk.source_index; 408 404 } else if (phm->u.c.attribute == HPI_SAMPLECLOCK_SAMPLERATE)
+1 -1
sound/pci/asihpi/hpidebug.c
··· 111 111 &hpi_profile_strings,\ 112 112 &hpi_control_strings, \ 113 113 &hpi_asyncevent_strings \ 114 - }; 114 + } 115 115 make_treenode_from_array(hpi_function_strings, HPI_FUNCTION_STRINGS) 116 116 117 117 compile_time_assert(HPI_OBJ_MAXINDEX == 14, obj_list_doesnt_match);
+2 -2
sound/pci/asihpi/hpidebug.h
··· 356 356 "HPI_SOURCENODE_ADAPTER" \ 357 357 } 358 358 359 - compile_time_assert((HPI_SOURCENODE_LAST_INDEX - HPI_SOURCENODE_BASE + 1) == 359 + compile_time_assert((HPI_SOURCENODE_LAST_INDEX - HPI_SOURCENODE_NONE + 1) == 360 360 (12), sourcenode_strings_match_defs); 361 361 362 362 #define HPI_DESTNODE_STRINGS \ ··· 370 370 "HPI_DESTNODE_COBRANET", \ 371 371 "HPI_DESTNODE_ANALOG" \ 372 372 } 373 - compile_time_assert((HPI_DESTNODE_LAST_INDEX - HPI_DESTNODE_BASE + 1) == (8), 373 + compile_time_assert((HPI_DESTNODE_LAST_INDEX - HPI_DESTNODE_NONE + 1) == (8), 374 374 destnode_strings_match_defs); 375 375 376 376 #define HPI_CONTROL_CHANNEL_MODE_STRINGS \
+196 -133
sound/pci/asihpi/hpifunc.c
··· 96 96 97 97 static struct hpi_hsubsys gh_subsys; 98 98 99 - struct hpi_hsubsys *hpi_subsys_create(void 100 - ) 99 + struct hpi_hsubsys *hpi_subsys_create(void) 101 100 { 102 101 struct hpi_message hm; 103 102 struct hpi_response hr; ··· 301 302 { 302 303 struct hpi_message hm; 303 304 struct hpi_response hr; 305 + 304 306 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, 305 307 HPI_ADAPTER_SET_MODE); 306 308 hm.adapter_index = adapter_index; ··· 510 510 hm.adapter_index = adapter_index; 511 511 hm.u.ax.debug_read.dsp_address = dsp_address; 512 512 513 - if (*count_bytes > sizeof(hr.u.bytes)) 513 + if (*count_bytes > (int)sizeof(hr.u.bytes)) 514 514 *count_bytes = sizeof(hr.u.bytes); 515 515 516 516 hm.u.ax.debug_read.count_bytes = *count_bytes; ··· 976 976 { 977 977 struct hpi_message hm; 978 978 struct hpi_response hr; 979 + 979 980 hpi_init_message_response(&hm, &hr, HPI_OBJ_OSTREAM, 980 981 HPI_OSTREAM_ANC_READ); 981 982 u32TOINDEXES(h_outstream, &hm.adapter_index, &hm.obj_index); ··· 1582 1581 { 1583 1582 struct hpi_message hm; 1584 1583 struct hpi_response hr; 1584 + 1585 1585 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 1586 1586 HPI_CONTROL_SET_STATE); 1587 1587 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); 1588 1588 hm.u.c.attribute = attrib; 1589 1589 hm.u.c.param1 = param1; 1590 1590 hm.u.c.param2 = param2; 1591 + hpi_send_recv(&hm, &hr); 1592 + return hr.error; 1593 + } 1594 + 1595 + static u16 hpi_control_log_set2(u32 h_control, u16 attrib, short sv0, 1596 + short sv1) 1597 + { 1598 + struct hpi_message hm; 1599 + struct hpi_response hr; 1600 + 1601 + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 1602 + HPI_CONTROL_SET_STATE); 1603 + u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); 1604 + hm.u.c.attribute = attrib; 1605 + hm.u.c.an_log_value[0] = sv0; 1606 + hm.u.c.an_log_value[1] = sv1; 1591 1607 hpi_send_recv(&hm, &hr); 1592 1608 return hr.error; 1593 1609 } ··· 1616 1598 { 1617 1599 struct hpi_message hm; 1618 1600 struct hpi_response hr; 1601 + 1619 1602 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 1620 1603 HPI_CONTROL_GET_STATE); 1621 1604 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 1624 1605 hm.u.c.param1 = param1; 1625 1606 hm.u.c.param2 = param2; 1626 1607 hpi_send_recv(&hm, &hr); 1627 - if (pparam1) 1628 - *pparam1 = hr.u.c.param1; 1608 + 1609 + *pparam1 = hr.u.c.param1; 1629 1610 if (pparam2) 1630 1611 *pparam2 = hr.u.c.param2; 1631 1612 ··· 1636 1617 hpi_control_param_get(s, h, a, 0, 0, p1, NULL) 1637 1618 #define hpi_control_param2_get(s, h, a, p1, p2) \ 1638 1619 hpi_control_param_get(s, h, a, 0, 0, p1, p2) 1639 - #define hpi_control_ex_param1_get(s, h, a, p1) \ 1640 - hpi_control_ex_param_get(s, h, a, 0, 0, p1, NULL) 1641 - #define hpi_control_ex_param2_get(s, h, a, p1, p2) \ 1642 - hpi_control_ex_param_get(s, h, a, 0, 0, p1, p2) 1620 + 1621 + static u16 hpi_control_log_get2(const struct hpi_hsubsys *ph_subsys, 1622 + u32 h_control, u16 attrib, short *sv0, short *sv1) 1623 + { 1624 + struct hpi_message hm; 1625 + struct hpi_response hr; 1626 + hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 1627 + HPI_CONTROL_GET_STATE); 1628 + u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); 1629 + hm.u.c.attribute = attrib; 1630 + 1631 + hpi_send_recv(&hm, &hr); 1632 + *sv0 = hr.u.c.an_log_value[0]; 1633 + if (sv1) 1634 + *sv1 = hr.u.c.an_log_value[1]; 1635 + return hr.error; 1636 + } 1643 1637 1644 1638 static 1645 1639 u16 hpi_control_query(const struct hpi_hsubsys *ph_subsys, ··· 1661 1629 { 1662 1630 struct hpi_message hm; 1663 1631 struct hpi_response hr; 1632 + 1664 1633 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 1665 1634 HPI_CONTROL_GET_INFO); 1666 1635 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 1676 1643 return hr.error; 1677 1644 } 1678 1645 1679 - static u16 hpi_control_get_string(const struct hpi_hsubsys *ph_subsys, 1680 - const u32 h_control, const u16 attribute, char *psz_string, 1681 - const u32 string_length) 1646 + static u16 hpi_control_get_string(const u32 h_control, const u16 attribute, 1647 + char *psz_string, const u32 string_length) 1682 1648 { 1683 1649 unsigned int sub_string_index = 0, j = 0; 1684 1650 char c = 0; ··· 1948 1916 { 1949 1917 struct hpi_message hm; 1950 1918 struct hpi_response hr; 1919 + 1951 1920 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, 1952 1921 HPI_CONTROL_SET_STATE); 1953 1922 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 1974 1941 { 1975 1942 struct hpi_message hm; 1976 1943 struct hpi_response hr; 1944 + 1977 1945 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, 1978 1946 HPI_CONTROL_GET_STATE); 1979 1947 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 2014 1980 { 2015 1981 struct hpi_message hm; 2016 1982 struct hpi_response hr; 1983 + 2017 1984 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROLEX, 2018 1985 HPI_CONTROL_GET_STATE); 2019 1986 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 2041 2006 u32 byte_count; 2042 2007 u32 iP; 2043 2008 u16 error; 2009 + 2044 2010 error = hpi_cobranet_hmi_read(ph_subsys, h_control, 2045 2011 HPI_COBRANET_HMI_cobra_ip_mon_currentIP, 4, &byte_count, 2046 2012 (u8 *)&iP); ··· 2118 2082 u32 byte_count; 2119 2083 u16 error; 2120 2084 u32 mAC; 2085 + 2121 2086 error = hpi_cobranet_hmi_read(ph_subsys, h_control, 2122 2087 HPI_COBRANET_HMI_cobra_if_phy_address, 4, &byte_count, 2123 2088 (u8 *)&mAC); ··· 2140 2103 return error; 2141 2104 } 2142 2105 2143 - u16 hpi_compander_set(const struct hpi_hsubsys *ph_subsys, u32 h_control, 2144 - u16 attack, u16 decay, short ratio100, short threshold0_01dB, 2145 - short makeup_gain0_01dB) 2106 + u16 hpi_compander_set_enable(const struct hpi_hsubsys *ph_subsys, 2107 + u32 h_control, u32 enable) 2108 + { 2109 + return hpi_control_param_set(ph_subsys, h_control, HPI_GENERIC_ENABLE, 2110 + enable, 0); 2111 + } 2112 + 2113 + u16 hpi_compander_get_enable(const struct hpi_hsubsys *ph_subsys, 2114 + u32 h_control, u32 *enable) 2115 + { 2116 + return hpi_control_param1_get(ph_subsys, h_control, 2117 + HPI_GENERIC_ENABLE, enable); 2118 + } 2119 + 2120 + u16 hpi_compander_set_makeup_gain(const struct hpi_hsubsys *ph_subsys, 2121 + u32 h_control, short makeup_gain0_01dB) 2122 + { 2123 + return hpi_control_log_set2(h_control, HPI_COMPANDER_MAKEUPGAIN, 2124 + makeup_gain0_01dB, 0); 2125 + } 2126 + 2127 + u16 hpi_compander_get_makeup_gain(const struct hpi_hsubsys *ph_subsys, 2128 + u32 h_control, short *makeup_gain0_01dB) 2129 + { 2130 + return hpi_control_log_get2(ph_subsys, h_control, 2131 + HPI_COMPANDER_MAKEUPGAIN, makeup_gain0_01dB, NULL); 2132 + } 2133 + 2134 + u16 hpi_compander_set_attack_time_constant(const struct hpi_hsubsys 2135 + *ph_subsys, u32 h_control, unsigned int index, u32 attack) 2136 + { 2137 + return hpi_control_param_set(ph_subsys, h_control, 2138 + HPI_COMPANDER_ATTACK, attack, index); 2139 + } 2140 + 2141 + u16 hpi_compander_get_attack_time_constant(const struct hpi_hsubsys 2142 + *ph_subsys, u32 h_control, unsigned int index, u32 *attack) 2143 + { 2144 + return hpi_control_param_get(ph_subsys, h_control, 2145 + HPI_COMPANDER_ATTACK, 0, index, attack, NULL); 2146 + } 2147 + 2148 + u16 hpi_compander_set_decay_time_constant(const struct hpi_hsubsys *ph_subsys, 2149 + u32 h_control, unsigned int index, u32 decay) 2150 + { 2151 + return hpi_control_param_set(ph_subsys, h_control, 2152 + HPI_COMPANDER_DECAY, decay, index); 2153 + } 2154 + 2155 + u16 hpi_compander_get_decay_time_constant(const struct hpi_hsubsys *ph_subsys, 2156 + u32 h_control, unsigned int index, u32 *decay) 2157 + { 2158 + return hpi_control_param_get(ph_subsys, h_control, 2159 + HPI_COMPANDER_DECAY, 0, index, decay, NULL); 2160 + 2161 + } 2162 + 2163 + u16 hpi_compander_set_threshold(const struct hpi_hsubsys *ph_subsys, 2164 + u32 h_control, unsigned int index, short threshold0_01dB) 2146 2165 { 2147 2166 struct hpi_message hm; 2148 2167 struct hpi_response hr; 2168 + 2149 2169 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 2150 2170 HPI_CONTROL_SET_STATE); 2151 2171 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); 2152 - 2153 - hm.u.c.param1 = attack + ((u32)ratio100 << 16); 2154 - hm.u.c.param2 = (decay & 0xFFFFL); 2172 + hm.u.c.attribute = HPI_COMPANDER_THRESHOLD; 2173 + hm.u.c.param2 = index; 2155 2174 hm.u.c.an_log_value[0] = threshold0_01dB; 2156 - hm.u.c.an_log_value[1] = makeup_gain0_01dB; 2157 - hm.u.c.attribute = HPI_COMPANDER_PARAMS; 2158 2175 2159 2176 hpi_send_recv(&hm, &hr); 2160 2177 2161 2178 return hr.error; 2162 2179 } 2163 2180 2164 - u16 hpi_compander_get(const struct hpi_hsubsys *ph_subsys, u32 h_control, 2165 - u16 *pw_attack, u16 *pw_decay, short *pw_ratio100, 2166 - short *pn_threshold0_01dB, short *pn_makeup_gain0_01dB) 2181 + u16 hpi_compander_get_threshold(const struct hpi_hsubsys *ph_subsys, 2182 + u32 h_control, unsigned int index, short *threshold0_01dB) 2167 2183 { 2168 2184 struct hpi_message hm; 2169 2185 struct hpi_response hr; 2186 + 2170 2187 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 2171 2188 HPI_CONTROL_GET_STATE); 2172 2189 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); 2173 - hm.u.c.attribute = HPI_COMPANDER_PARAMS; 2190 + hm.u.c.attribute = HPI_COMPANDER_THRESHOLD; 2191 + hm.u.c.param2 = index; 2174 2192 2175 2193 hpi_send_recv(&hm, &hr); 2176 - 2177 - if (pw_attack) 2178 - *pw_attack = (short)(hr.u.c.param1 & 0xFFFF); 2179 - if (pw_decay) 2180 - *pw_decay = (short)(hr.u.c.param2 & 0xFFFF); 2181 - if (pw_ratio100) 2182 - *pw_ratio100 = (short)(hr.u.c.param1 >> 16); 2183 - 2184 - if (pn_threshold0_01dB) 2185 - *pn_threshold0_01dB = hr.u.c.an_log_value[0]; 2186 - if (pn_makeup_gain0_01dB) 2187 - *pn_makeup_gain0_01dB = hr.u.c.an_log_value[1]; 2194 + *threshold0_01dB = hr.u.c.an_log_value[0]; 2188 2195 2189 2196 return hr.error; 2197 + } 2198 + 2199 + u16 hpi_compander_set_ratio(const struct hpi_hsubsys *ph_subsys, 2200 + u32 h_control, u32 index, u32 ratio100) 2201 + { 2202 + return hpi_control_param_set(ph_subsys, h_control, 2203 + HPI_COMPANDER_RATIO, ratio100, index); 2204 + } 2205 + 2206 + u16 hpi_compander_get_ratio(const struct hpi_hsubsys *ph_subsys, 2207 + u32 h_control, u32 index, u32 *ratio100) 2208 + { 2209 + return hpi_control_param_get(ph_subsys, h_control, 2210 + HPI_COMPANDER_RATIO, 0, index, ratio100, NULL); 2190 2211 } 2191 2212 2192 2213 u16 hpi_level_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, ··· 2252 2157 { 2253 2158 struct hpi_message hm; 2254 2159 struct hpi_response hr; 2160 + 2255 2161 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 2256 2162 HPI_CONTROL_GET_STATE); 2257 2163 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 2277 2181 short an_gain0_01dB[HPI_MAX_CHANNELS] 2278 2182 ) 2279 2183 { 2280 - struct hpi_message hm; 2281 - struct hpi_response hr; 2282 - 2283 - hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 2284 - HPI_CONTROL_SET_STATE); 2285 - u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); 2286 - memcpy(hm.u.c.an_log_value, an_gain0_01dB, 2287 - sizeof(short) * HPI_MAX_CHANNELS); 2288 - hm.u.c.attribute = HPI_LEVEL_GAIN; 2289 - 2290 - hpi_send_recv(&hm, &hr); 2291 - 2292 - return hr.error; 2184 + return hpi_control_log_set2(h_control, HPI_LEVEL_GAIN, 2185 + an_gain0_01dB[0], an_gain0_01dB[1]); 2293 2186 } 2294 2187 2295 2188 u16 hpi_level_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, 2296 2189 short an_gain0_01dB[HPI_MAX_CHANNELS] 2297 2190 ) 2298 2191 { 2299 - struct hpi_message hm; 2300 - struct hpi_response hr; 2301 - hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 2302 - HPI_CONTROL_GET_STATE); 2303 - u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); 2304 - hm.u.c.attribute = HPI_LEVEL_GAIN; 2305 - 2306 - hpi_send_recv(&hm, &hr); 2307 - 2308 - memcpy(an_gain0_01dB, hr.u.c.an_log_value, 2309 - sizeof(short) * HPI_MAX_CHANNELS); 2310 - return hr.error; 2192 + return hpi_control_log_get2(ph_subsys, h_control, HPI_LEVEL_GAIN, 2193 + &an_gain0_01dB[0], &an_gain0_01dB[1]); 2311 2194 } 2312 2195 2313 2196 u16 hpi_meter_query_channels(const struct hpi_hsubsys *ph_subsys, ··· 2488 2413 { 2489 2414 struct hpi_message hm; 2490 2415 struct hpi_response hr; 2416 + 2491 2417 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 2492 2418 HPI_CONTROL_GET_STATE); 2493 2419 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 2515 2439 { 2516 2440 struct hpi_message hm; 2517 2441 struct hpi_response hr; 2442 + 2518 2443 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 2519 2444 HPI_CONTROL_SET_STATE); 2520 2445 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 2537 2460 { 2538 2461 struct hpi_message hm; 2539 2462 struct hpi_response hr; 2463 + 2540 2464 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 2541 2465 HPI_CONTROL_GET_STATE); 2542 2466 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 2701 2623 u16 hpi_tone_detector_get_state(const struct hpi_hsubsys *ph_subsys, 2702 2624 u32 h_control, u32 *state) 2703 2625 { 2704 - return hpi_control_param_get(ph_subsys, h_control, 2705 - HPI_TONEDETECTOR_STATE, 0, 0, (u32 *)state, NULL); 2626 + return hpi_control_param1_get(ph_subsys, h_control, 2627 + HPI_TONEDETECTOR_STATE, state); 2706 2628 } 2707 2629 2708 2630 u16 hpi_tone_detector_set_enable(const struct hpi_hsubsys *ph_subsys, ··· 2715 2637 u16 hpi_tone_detector_get_enable(const struct hpi_hsubsys *ph_subsys, 2716 2638 u32 h_control, u32 *enable) 2717 2639 { 2718 - return hpi_control_param_get(ph_subsys, h_control, HPI_GENERIC_ENABLE, 2719 - 0, 0, (u32 *)enable, NULL); 2640 + return hpi_control_param1_get(ph_subsys, h_control, 2641 + HPI_GENERIC_ENABLE, enable); 2720 2642 } 2721 2643 2722 2644 u16 hpi_tone_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, ··· 2729 2651 u16 hpi_tone_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys, 2730 2652 u32 h_control, u32 *event_enable) 2731 2653 { 2732 - return hpi_control_param_get(ph_subsys, h_control, 2733 - HPI_GENERIC_EVENT_ENABLE, 0, 0, (u32 *)event_enable, NULL); 2654 + return hpi_control_param1_get(ph_subsys, h_control, 2655 + HPI_GENERIC_EVENT_ENABLE, event_enable); 2734 2656 } 2735 2657 2736 2658 u16 hpi_tone_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, ··· 2743 2665 u16 hpi_tone_detector_get_threshold(const struct hpi_hsubsys *ph_subsys, 2744 2666 u32 h_control, int *threshold) 2745 2667 { 2746 - return hpi_control_param_get(ph_subsys, h_control, 2747 - HPI_TONEDETECTOR_THRESHOLD, 0, 0, (u32 *)threshold, NULL); 2668 + return hpi_control_param1_get(ph_subsys, h_control, 2669 + HPI_TONEDETECTOR_THRESHOLD, (u32 *)threshold); 2748 2670 } 2749 2671 2750 2672 u16 hpi_silence_detector_get_state(const struct hpi_hsubsys *ph_subsys, 2751 2673 u32 h_control, u32 *state) 2752 2674 { 2753 - return hpi_control_param_get(ph_subsys, h_control, 2754 - HPI_SILENCEDETECTOR_STATE, 0, 0, (u32 *)state, NULL); 2675 + return hpi_control_param1_get(ph_subsys, h_control, 2676 + HPI_SILENCEDETECTOR_STATE, state); 2755 2677 } 2756 2678 2757 2679 u16 hpi_silence_detector_set_enable(const struct hpi_hsubsys *ph_subsys, ··· 2764 2686 u16 hpi_silence_detector_get_enable(const struct hpi_hsubsys *ph_subsys, 2765 2687 u32 h_control, u32 *enable) 2766 2688 { 2767 - return hpi_control_param_get(ph_subsys, h_control, HPI_GENERIC_ENABLE, 2768 - 0, 0, (u32 *)enable, NULL); 2689 + return hpi_control_param1_get(ph_subsys, h_control, 2690 + HPI_GENERIC_ENABLE, enable); 2769 2691 } 2770 2692 2771 2693 u16 hpi_silence_detector_set_event_enable(const struct hpi_hsubsys *ph_subsys, 2772 2694 u32 h_control, u32 event_enable) 2773 2695 { 2774 2696 return hpi_control_param_set(ph_subsys, h_control, 2775 - HPI_GENERIC_EVENT_ENABLE, (u32)event_enable, 0); 2697 + HPI_GENERIC_EVENT_ENABLE, event_enable, 0); 2776 2698 } 2777 2699 2778 2700 u16 hpi_silence_detector_get_event_enable(const struct hpi_hsubsys *ph_subsys, 2779 2701 u32 h_control, u32 *event_enable) 2780 2702 { 2781 - return hpi_control_param_get(ph_subsys, h_control, 2782 - HPI_GENERIC_EVENT_ENABLE, 0, 0, (u32 *)event_enable, NULL); 2703 + return hpi_control_param1_get(ph_subsys, h_control, 2704 + HPI_GENERIC_EVENT_ENABLE, event_enable); 2783 2705 } 2784 2706 2785 2707 u16 hpi_silence_detector_set_delay(const struct hpi_hsubsys *ph_subsys, 2786 2708 u32 h_control, u32 delay) 2787 2709 { 2788 2710 return hpi_control_param_set(ph_subsys, h_control, 2789 - HPI_SILENCEDETECTOR_DELAY, (u32)delay, 0); 2711 + HPI_SILENCEDETECTOR_DELAY, delay, 0); 2790 2712 } 2791 2713 2792 2714 u16 hpi_silence_detector_get_delay(const struct hpi_hsubsys *ph_subsys, 2793 2715 u32 h_control, u32 *delay) 2794 2716 { 2795 - return hpi_control_param_get(ph_subsys, h_control, 2796 - HPI_SILENCEDETECTOR_DELAY, 0, 0, (u32 *)delay, NULL); 2717 + return hpi_control_param1_get(ph_subsys, h_control, 2718 + HPI_SILENCEDETECTOR_DELAY, delay); 2797 2719 } 2798 2720 2799 2721 u16 hpi_silence_detector_set_threshold(const struct hpi_hsubsys *ph_subsys, 2800 2722 u32 h_control, int threshold) 2801 2723 { 2802 2724 return hpi_control_param_set(ph_subsys, h_control, 2803 - HPI_SILENCEDETECTOR_THRESHOLD, (u32)threshold, 0); 2725 + HPI_SILENCEDETECTOR_THRESHOLD, threshold, 0); 2804 2726 } 2805 2727 2806 2728 u16 hpi_silence_detector_get_threshold(const struct hpi_hsubsys *ph_subsys, 2807 2729 u32 h_control, int *threshold) 2808 2730 { 2809 - return hpi_control_param_get(ph_subsys, h_control, 2810 - HPI_SILENCEDETECTOR_THRESHOLD, 0, 0, (u32 *)threshold, NULL); 2731 + return hpi_control_param1_get(ph_subsys, h_control, 2732 + HPI_SILENCEDETECTOR_THRESHOLD, (u32 *)threshold); 2811 2733 } 2812 2734 2813 2735 u16 hpi_tuner_query_band(const struct hpi_hsubsys *ph_subsys, ··· 2900 2822 { 2901 2823 struct hpi_message hm; 2902 2824 struct hpi_response hr; 2825 + 2903 2826 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 2904 2827 HPI_CONTROL_GET_STATE); 2905 2828 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 2917 2838 { 2918 2839 struct hpi_message hm; 2919 2840 struct hpi_response hr; 2841 + 2920 2842 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 2921 2843 HPI_CONTROL_GET_STATE); 2922 2844 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 2974 2894 u16 hpi_tuner_get_hd_radio_dsp_version(const struct hpi_hsubsys *ph_subsys, 2975 2895 u32 h_control, char *psz_dsp_version, const u32 string_size) 2976 2896 { 2977 - return hpi_control_get_string(ph_subsys, h_control, 2897 + return hpi_control_get_string(h_control, 2978 2898 HPI_TUNER_HDRADIO_DSP_VERSION, psz_dsp_version, string_size); 2979 2899 } 2980 2900 2981 2901 u16 hpi_tuner_get_hd_radio_sdk_version(const struct hpi_hsubsys *ph_subsys, 2982 2902 u32 h_control, char *psz_sdk_version, const u32 string_size) 2983 2903 { 2984 - return hpi_control_get_string(ph_subsys, h_control, 2904 + return hpi_control_get_string(h_control, 2985 2905 HPI_TUNER_HDRADIO_SDK_VERSION, psz_sdk_version, string_size); 2986 2906 } 2987 2907 ··· 3022 2942 u16 hpi_tuner_get_hd_radio_signal_quality(const struct hpi_hsubsys *ph_subsys, 3023 2943 u32 h_control, u32 *pquality) 3024 2944 { 3025 - return hpi_control_param_get(ph_subsys, h_control, 3026 - HPI_TUNER_HDRADIO_SIGNAL_QUALITY, 0, 0, pquality, NULL); 2945 + return hpi_control_param1_get(ph_subsys, h_control, 2946 + HPI_TUNER_HDRADIO_SIGNAL_QUALITY, pquality); 3027 2947 } 3028 2948 3029 2949 u16 hpi_tuner_get_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, 3030 2950 u32 h_control, u32 *pblend) 3031 2951 { 3032 - return hpi_control_param_get(ph_subsys, h_control, 3033 - HPI_TUNER_HDRADIO_BLEND, 0, 0, pblend, NULL); 2952 + return hpi_control_param1_get(ph_subsys, h_control, 2953 + HPI_TUNER_HDRADIO_BLEND, pblend); 3034 2954 } 3035 2955 3036 2956 u16 hpi_tuner_set_hd_radio_signal_blend(const struct hpi_hsubsys *ph_subsys, ··· 3045 2965 { 3046 2966 struct hpi_message hm; 3047 2967 struct hpi_response hr; 2968 + 3048 2969 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 3049 2970 HPI_CONTROL_GET_STATE); 3050 2971 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 3062 2981 u16 HPI_PAD__get_channel_name(const struct hpi_hsubsys *ph_subsys, 3063 2982 u32 h_control, char *psz_string, const u32 data_length) 3064 2983 { 3065 - return hpi_control_get_string(ph_subsys, h_control, 3066 - HPI_PAD_CHANNEL_NAME, psz_string, data_length); 2984 + return hpi_control_get_string(h_control, HPI_PAD_CHANNEL_NAME, 2985 + psz_string, data_length); 3067 2986 } 3068 2987 3069 2988 u16 HPI_PAD__get_artist(const struct hpi_hsubsys *ph_subsys, u32 h_control, 3070 2989 char *psz_string, const u32 data_length) 3071 2990 { 3072 - return hpi_control_get_string(ph_subsys, h_control, HPI_PAD_ARTIST, 3073 - psz_string, data_length); 2991 + return hpi_control_get_string(h_control, HPI_PAD_ARTIST, psz_string, 2992 + data_length); 3074 2993 } 3075 2994 3076 2995 u16 HPI_PAD__get_title(const struct hpi_hsubsys *ph_subsys, u32 h_control, 3077 2996 char *psz_string, const u32 data_length) 3078 2997 { 3079 - return hpi_control_get_string(ph_subsys, h_control, HPI_PAD_TITLE, 3080 - psz_string, data_length); 2998 + return hpi_control_get_string(h_control, HPI_PAD_TITLE, psz_string, 2999 + data_length); 3081 3000 } 3082 3001 3083 3002 u16 HPI_PAD__get_comment(const struct hpi_hsubsys *ph_subsys, u32 h_control, 3084 3003 char *psz_string, const u32 data_length) 3085 3004 { 3086 - return hpi_control_get_string(ph_subsys, h_control, HPI_PAD_COMMENT, 3087 - psz_string, data_length); 3005 + return hpi_control_get_string(h_control, HPI_PAD_COMMENT, psz_string, 3006 + data_length); 3088 3007 } 3089 3008 3090 3009 u16 HPI_PAD__get_program_type(const struct hpi_hsubsys *ph_subsys, 3091 3010 u32 h_control, u32 *ppTY) 3092 3011 { 3093 - return hpi_control_param_get(ph_subsys, h_control, 3094 - HPI_PAD_PROGRAM_TYPE, 0, 0, ppTY, NULL); 3012 + return hpi_control_param1_get(ph_subsys, h_control, 3013 + HPI_PAD_PROGRAM_TYPE, ppTY); 3095 3014 } 3096 3015 3097 3016 u16 HPI_PAD__get_rdsPI(const struct hpi_hsubsys *ph_subsys, u32 h_control, 3098 3017 u32 *ppI) 3099 3018 { 3100 - return hpi_control_param_get(ph_subsys, h_control, HPI_PAD_PROGRAM_ID, 3101 - 0, 0, ppI, NULL); 3019 + return hpi_control_param1_get(ph_subsys, h_control, 3020 + HPI_PAD_PROGRAM_ID, ppI); 3102 3021 } 3103 3022 3104 3023 u16 hpi_volume_query_channels(const struct hpi_hsubsys *ph_subsys, ··· 3112 3031 short an_log_gain[HPI_MAX_CHANNELS] 3113 3032 ) 3114 3033 { 3115 - struct hpi_message hm; 3116 - struct hpi_response hr; 3117 - hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 3118 - HPI_CONTROL_SET_STATE); 3119 - u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); 3120 - memcpy(hm.u.c.an_log_value, an_log_gain, 3121 - sizeof(short) * HPI_MAX_CHANNELS); 3122 - hm.u.c.attribute = HPI_VOLUME_GAIN; 3123 - 3124 - hpi_send_recv(&hm, &hr); 3125 - 3126 - return hr.error; 3034 + return hpi_control_log_set2(h_control, HPI_VOLUME_GAIN, 3035 + an_log_gain[0], an_log_gain[1]); 3127 3036 } 3128 3037 3129 3038 u16 hpi_volume_get_gain(const struct hpi_hsubsys *ph_subsys, u32 h_control, 3130 3039 short an_log_gain[HPI_MAX_CHANNELS] 3131 3040 ) 3132 3041 { 3133 - struct hpi_message hm; 3134 - struct hpi_response hr; 3135 - hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 3136 - HPI_CONTROL_GET_STATE); 3137 - u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); 3138 - hm.u.c.attribute = HPI_VOLUME_GAIN; 3139 - 3140 - hpi_send_recv(&hm, &hr); 3141 - 3142 - memcpy(an_log_gain, hr.u.c.an_log_value, 3143 - sizeof(short) * HPI_MAX_CHANNELS); 3144 - return hr.error; 3042 + return hpi_control_log_get2(ph_subsys, h_control, HPI_VOLUME_GAIN, 3043 + &an_log_gain[0], &an_log_gain[1]); 3145 3044 } 3146 3045 3147 3046 u16 hpi_volume_query_range(const struct hpi_hsubsys *ph_subsys, u32 h_control, ··· 3129 3068 { 3130 3069 struct hpi_message hm; 3131 3070 struct hpi_response hr; 3071 + 3132 3072 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 3133 3073 HPI_CONTROL_GET_STATE); 3134 3074 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 3156 3094 { 3157 3095 struct hpi_message hm; 3158 3096 struct hpi_response hr; 3097 + 3159 3098 hpi_init_message_response(&hm, &hr, HPI_OBJ_CONTROL, 3160 3099 HPI_CONTROL_SET_STATE); 3161 3100 u32TOINDEXES(h_control, &hm.adapter_index, &hm.obj_index); ··· 3233 3170 6 * sizeof(char), 3234 3171 }; 3235 3172 3236 - inline size_t hpi_entity_size(struct hpi_entity *entity_ptr) 3173 + static inline size_t hpi_entity_size(struct hpi_entity *entity_ptr) 3237 3174 { 3238 3175 return entity_ptr->header.size; 3239 3176 } 3240 3177 3241 - inline size_t hpi_entity_header_size(struct hpi_entity *entity_ptr) 3178 + static inline size_t hpi_entity_header_size(struct hpi_entity *entity_ptr) 3242 3179 { 3243 3180 return sizeof(entity_ptr->header); 3244 3181 } 3245 3182 3246 - inline size_t hpi_entity_value_size(struct hpi_entity *entity_ptr) 3183 + static inline size_t hpi_entity_value_size(struct hpi_entity *entity_ptr) 3247 3184 { 3248 3185 return hpi_entity_size(entity_ptr) - 3249 3186 hpi_entity_header_size(entity_ptr); 3250 3187 } 3251 3188 3252 - inline size_t hpi_entity_item_count(struct hpi_entity *entity_ptr) 3189 + static inline size_t hpi_entity_item_count(struct hpi_entity *entity_ptr) 3253 3190 { 3254 3191 return hpi_entity_value_size(entity_ptr) / 3255 3192 entity_type_to_size[entity_ptr->header.type]; 3256 3193 } 3257 3194 3258 - inline struct hpi_entity *hpi_entity_ptr_to_next(struct hpi_entity 3195 + static inline struct hpi_entity *hpi_entity_ptr_to_next(struct hpi_entity 3259 3196 *entity_ptr) 3260 3197 { 3261 - return (void *)(((uint8_t *) entity_ptr) + 3262 - hpi_entity_size(entity_ptr)); 3198 + return (void *)(((u8 *)entity_ptr) + hpi_entity_size(entity_ptr)); 3263 3199 } 3264 3200 3265 - inline u16 hpi_entity_check_type(const enum e_entity_type t) 3201 + static inline u16 hpi_entity_check_type(const enum e_entity_type t) 3266 3202 { 3267 3203 if (t >= 0 && t < STR_TYPE_FIELD_MAX) 3268 3204 return 0; 3269 3205 return HPI_ERROR_ENTITY_TYPE_INVALID; 3270 3206 } 3271 3207 3272 - inline u16 hpi_entity_check_role(const enum e_entity_role r) 3208 + static inline u16 hpi_entity_check_role(const enum e_entity_role r) 3273 3209 { 3274 3210 if (r >= 0 && r < STR_ROLE_FIELD_MAX) 3275 3211 return 0; ··· 3686 3624 u16 maximum_events, struct hpi_async_event *p_events, 3687 3625 u16 *pw_number_returned) 3688 3626 { 3627 + 3689 3628 return 0; 3690 3629 } 3691 3630
+1 -1
sound/pci/asihpi/hpimsgx.c
··· 741 741 hpi_init_response(&hr, HPI_OBJ_SUBSYSTEM, 742 742 HPI_SUBSYS_FIND_ADAPTERS, 0); 743 743 memcpy(&gRESP_HPI_SUBSYS_FIND_ADAPTERS, &hr, 744 - sizeof(&gRESP_HPI_SUBSYS_FIND_ADAPTERS)); 744 + sizeof(gRESP_HPI_SUBSYS_FIND_ADAPTERS)); 745 745 746 746 for (adapter = 0; adapter < HPI_MAX_ADAPTERS; adapter++) { 747 747
+14 -7
sound/pci/asihpi/hpioctl.c
··· 121 121 phpi_ioctl_data = (struct hpi_ioctl_linux __user *)arg; 122 122 123 123 /* Read the message and response pointers from user space. */ 124 - get_user(puhm, &phpi_ioctl_data->phm); 125 - get_user(puhr, &phpi_ioctl_data->phr); 124 + if (get_user(puhm, &phpi_ioctl_data->phm) || 125 + get_user(puhr, &phpi_ioctl_data->phr)) { 126 + err = -EFAULT; 127 + goto out; 128 + } 126 129 127 130 /* Now read the message size and data from user space. */ 128 - get_user(hm->h.size, (u16 __user *)puhm); 131 + if (get_user(hm->h.size, (u16 __user *)puhm)) { 132 + err = -EFAULT; 133 + goto out; 134 + } 129 135 if (hm->h.size > sizeof(*hm)) 130 136 hm->h.size = sizeof(*hm); 131 137 ··· 144 138 goto out; 145 139 } 146 140 147 - get_user(res_max_size, (u16 __user *)puhr); 141 + if (get_user(res_max_size, (u16 __user *)puhr)) { 142 + err = -EFAULT; 143 + goto out; 144 + } 148 145 /* printk(KERN_INFO "user response size %d\n", res_max_size); */ 149 146 if (res_max_size < sizeof(struct hpi_response_header)) { 150 147 HPI_DEBUG_LOG(WARNING, "small res size %d\n", res_max_size); ··· 473 464 474 465 memset(adapters, 0, sizeof(adapters)); 475 466 476 - printk(KERN_INFO "ASIHPI driver %d.%02d.%02d\n", 477 - HPI_VER_MAJOR(HPI_VER), HPI_VER_MINOR(HPI_VER), 478 - HPI_VER_RELEASE(HPI_VER)); 467 + printk(KERN_INFO "ASIHPI driver " HPI_VER_STRING "\n"); 479 468 480 469 hpi_init_message_response(&hm, &hr, HPI_OBJ_SUBSYSTEM, 481 470 HPI_SUBSYS_DRIVER_LOAD);
+2
sound/pci/echoaudio/echoaudio.c
··· 2250 2250 DE_INIT(("resume start\n")); 2251 2251 pci_restore_state(pci); 2252 2252 commpage_bak = kmalloc(sizeof(struct echoaudio), GFP_KERNEL); 2253 + if (commpage_bak == NULL) 2254 + return -ENOMEM; 2253 2255 commpage = chip->comm_page; 2254 2256 memcpy(commpage_bak, commpage, sizeof(struct comm_page)); 2255 2257
+6 -4
sound/pci/hda/hda_codec.c
··· 733 733 total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); 734 734 for (i = 0; i < total_nodes; i++, nid++) { 735 735 function_id = snd_hda_param_read(codec, nid, 736 - AC_PAR_FUNCTION_TYPE) & 0xff; 737 - switch (function_id) { 736 + AC_PAR_FUNCTION_TYPE); 737 + switch (function_id & 0xff) { 738 738 case AC_GRP_AUDIO_FUNCTION: 739 739 codec->afg = nid; 740 - codec->function_id = function_id; 740 + codec->afg_function_id = function_id & 0xff; 741 + codec->afg_unsol = (function_id >> 8) & 1; 741 742 break; 742 743 case AC_GRP_MODEM_FUNCTION: 743 744 codec->mfg = nid; 744 - codec->function_id = function_id; 745 + codec->mfg_function_id = function_id & 0xff; 746 + codec->mfg_unsol = (function_id >> 8) & 1; 745 747 break; 746 748 default: 747 749 break;
+4 -1
sound/pci/hda/hda_codec.h
··· 784 784 hda_nid_t mfg; /* MFG node id */ 785 785 786 786 /* ids */ 787 - u32 function_id; 787 + u8 afg_function_id; 788 + u8 mfg_function_id; 789 + u8 afg_unsol; 790 + u8 mfg_unsol; 788 791 u32 vendor_id; 789 792 u32 subsystem_id; 790 793 u32 revision_id;
+6 -1
sound/pci/hda/hda_proc.c
··· 557 557 else 558 558 snd_iprintf(buffer, "Not Set\n"); 559 559 snd_iprintf(buffer, "Address: %d\n", codec->addr); 560 - snd_iprintf(buffer, "Function Id: 0x%x\n", codec->function_id); 560 + if (codec->afg) 561 + snd_iprintf(buffer, "AFG Function Id: 0x%x (unsol %u)\n", 562 + codec->afg_function_id, codec->afg_unsol); 563 + if (codec->mfg) 564 + snd_iprintf(buffer, "MFG Function Id: 0x%x (unsol %u)\n", 565 + codec->mfg_function_id, codec->mfg_unsol); 561 566 snd_iprintf(buffer, "Vendor Id: 0x%08x\n", codec->vendor_id); 562 567 snd_iprintf(buffer, "Subsystem Id: 0x%08x\n", codec->subsystem_id); 563 568 snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id);
+12 -6
sound/pci/riptide/riptide.c
··· 97 97 #include <linux/gameport.h> 98 98 #include <linux/device.h> 99 99 #include <linux/firmware.h> 100 + #include <linux/kernel.h> 100 101 #include <asm/io.h> 101 102 #include <sound/core.h> 102 103 #include <sound/info.h> ··· 668 667 unsigned char c; 669 668 670 669 while (len) { 670 + int value; 671 + 671 672 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)); 673 + value = hex_to_bin(c); 674 + if (value >= 0) 675 + sum += mult * value; 678 676 mult *= 16; 679 677 --len; 680 678 } ··· 1615 1615 1616 1616 chip->playback_substream[sub_num] = substream; 1617 1617 runtime->hw = snd_riptide_playback; 1618 + 1618 1619 data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL); 1620 + if (data == NULL) 1621 + return -ENOMEM; 1619 1622 data->paths = lbus_play_paths[sub_num]; 1620 1623 data->id = play_ids[sub_num]; 1621 1624 data->source = play_sources[sub_num]; ··· 1638 1635 1639 1636 chip->capture_substream = substream; 1640 1637 runtime->hw = snd_riptide_capture; 1638 + 1641 1639 data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL); 1640 + if (data == NULL) 1641 + return -ENOMEM; 1642 1642 data->paths = lbus_rec_path; 1643 1643 data->id = PADC; 1644 1644 data->source = ACLNK2PADC;
+9 -7
sound/pci/sis7019.c
··· 264 264 * if using small periods. 265 265 * 266 266 * If we're less than 9 samples behind, we're on target. 267 + * Otherwise, shorten the next vperiod by the amount we've 268 + * been delayed. 267 269 */ 268 270 if (sync > -9) 269 271 voice->vperiod = voice->sync_period_size + 1; 270 272 else 271 - voice->vperiod = voice->sync_period_size - 4; 273 + voice->vperiod = voice->sync_period_size + sync + 10; 272 274 273 275 if (voice->vperiod < voice->buffer_size) { 274 276 sis_update_sso(voice, voice->vperiod); ··· 738 736 period_size = buffer_size; 739 737 740 738 /* Initially, we want to interrupt just a bit behind the end of 741 - * the period we're clocking out. 10 samples seems to give a good 739 + * the period we're clocking out. 12 samples seems to give a good 742 740 * delay. 743 741 * 744 742 * We want to spread our interrupts throughout the virtual period, ··· 749 747 * 750 748 * This is all moot if we don't need to use virtual periods. 751 749 */ 752 - vperiod = runtime->period_size + 10; 750 + vperiod = runtime->period_size + 12; 753 751 if (vperiod > period_size) { 754 752 u16 tail = vperiod % period_size; 755 753 u16 quarter_period = period_size / 4; ··· 778 776 */ 779 777 timing->flags |= VOICE_SYNC_TIMING; 780 778 timing->sync_base = voice->ctrl_base; 781 - timing->sync_cso = runtime->period_size - 1; 779 + timing->sync_cso = runtime->period_size; 782 780 timing->sync_period_size = runtime->period_size; 783 781 timing->sync_buffer_size = runtime->buffer_size; 784 782 timing->period_size = period_size; ··· 1049 1047 /* Reset the chip, and disable all interrputs. 1050 1048 */ 1051 1049 outl(SIS_GCR_SOFTWARE_RESET, sis->ioport + SIS_GCR); 1052 - udelay(10); 1050 + udelay(25); 1053 1051 outl(0, sis->ioport + SIS_GCR); 1054 1052 outl(0, sis->ioport + SIS_GIER); 1055 1053 ··· 1085 1083 /* Reset the audio controller 1086 1084 */ 1087 1085 outl(SIS_GCR_SOFTWARE_RESET, io + SIS_GCR); 1088 - udelay(10); 1086 + udelay(25); 1089 1087 outl(0, io + SIS_GCR); 1090 1088 1091 1089 /* Get the AC-link semaphore, and reset the codecs ··· 1098 1096 return -EIO; 1099 1097 1100 1098 outl(SIS_AC97_CMD_CODEC_COLD_RESET, io + SIS_AC97_CMD); 1101 - udelay(10); 1099 + udelay(250); 1102 1100 1103 1101 count = 0xffff; 1104 1102 while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count)
+7 -2
sound/pci/via82xx.c
··· 85 85 static int ac97_clock = 48000; 86 86 static char *ac97_quirk; 87 87 static int dxs_support; 88 + static int dxs_init_volume = 31; 88 89 static int nodelay; 89 90 90 91 module_param(index, int, 0444); ··· 104 103 MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); 105 104 module_param(dxs_support, int, 0444); 106 105 MODULE_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)"); 106 + module_param(dxs_init_volume, int, 0644); 107 + MODULE_PARM_DESC(dxs_init_volume, "initial DXS volume (0-31)"); 107 108 module_param(nodelay, int, 0444); 108 109 MODULE_PARM_DESC(nodelay, "Disable 500ms init delay"); 109 110 ··· 1248 1245 return err; 1249 1246 stream = viadev->reg_offset / 0x10; 1250 1247 if (chip->dxs_controls[stream]) { 1251 - chip->playback_volume[stream][0] = 0; 1252 - chip->playback_volume[stream][1] = 0; 1248 + chip->playback_volume[stream][0] = 1249 + VIA_DXS_MAX_VOLUME - (dxs_init_volume & 31); 1250 + chip->playback_volume[stream][1] = 1251 + VIA_DXS_MAX_VOLUME - (dxs_init_volume & 31); 1253 1252 chip->dxs_controls[stream]->vd[0].access &= 1254 1253 ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; 1255 1254 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE |
+4 -5
sound/sound_core.c
··· 576 576 struct sound_unit *s; 577 577 const struct file_operations *new_fops = NULL; 578 578 579 - lock_kernel (); 580 - 581 579 chain=unit&0x0F; 582 580 if(chain==4 || chain==5) /* dsp/audio/dsp16 */ 583 581 { ··· 628 630 const struct file_operations *old_fops = file->f_op; 629 631 file->f_op = new_fops; 630 632 spin_unlock(&sound_loader_lock); 631 - if(file->f_op->open) 633 + 634 + if (file->f_op->open) 632 635 err = file->f_op->open(inode,file); 636 + 633 637 if (err) { 634 638 fops_put(file->f_op); 635 639 file->f_op = fops_get(old_fops); 636 640 } 641 + 637 642 fops_put(old_fops); 638 - unlock_kernel(); 639 643 return err; 640 644 } 641 645 spin_unlock(&sound_loader_lock); 642 - unlock_kernel(); 643 646 return -ENODEV; 644 647 } 645 648
+1 -1
sound/usb/card.c
··· 217 217 218 218 switch (protocol) { 219 219 case UAC_VERSION_1: { 220 - struct uac_ac_header_descriptor_v1 *h1 = control_header; 220 + struct uac1_ac_header_descriptor *h1 = control_header; 221 221 222 222 if (!h1->bInCollection) { 223 223 snd_printk(KERN_INFO "skipping empty audio interface (v1)\n");
+25 -34
sound/usb/clock.c
··· 19 19 20 20 #include <linux/bitops.h> 21 21 #include <linux/init.h> 22 - #include <linux/list.h> 23 - #include <linux/slab.h> 24 22 #include <linux/string.h> 25 23 #include <linux/usb.h> 26 - #include <linux/moduleparam.h> 27 - #include <linux/mutex.h> 28 24 #include <linux/usb/audio.h> 29 25 #include <linux/usb/audio-v2.h> 30 26 31 27 #include <sound/core.h> 32 28 #include <sound/info.h> 33 29 #include <sound/pcm.h> 34 - #include <sound/pcm_params.h> 35 - #include <sound/initval.h> 36 30 37 31 #include "usbaudio.h" 38 32 #include "card.h" 39 - #include "midi.h" 40 - #include "mixer.h" 41 - #include "proc.h" 42 - #include "quirks.h" 43 - #include "endpoint.h" 44 33 #include "helper.h" 45 - #include "debug.h" 46 - #include "pcm.h" 47 - #include "urb.h" 48 - #include "format.h" 34 + #include "clock.h" 49 35 50 36 static struct uac_clock_source_descriptor * 51 37 snd_usb_find_clock_source(struct usb_host_interface *ctrl_iface, ··· 120 134 return !!data; 121 135 } 122 136 123 - /* Try to find the clock source ID of a given clock entity */ 124 - 125 137 static int __uac_clock_find_source(struct snd_usb_audio *chip, 126 - struct usb_host_interface *host_iface, 127 138 int entity_id, unsigned long *visited) 128 139 { 129 140 struct uac_clock_source_descriptor *source; ··· 137 154 } 138 155 139 156 /* 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); 157 + source = snd_usb_find_clock_source(chip->ctrl_intf, entity_id); 141 158 if (source) 142 159 return source->bClockID; 143 160 144 - selector = snd_usb_find_clock_selector(host_iface, entity_id); 161 + selector = snd_usb_find_clock_selector(chip->ctrl_intf, entity_id); 145 162 if (selector) { 146 163 int ret; 147 164 ··· 151 168 if (ret < 0) 152 169 return ret; 153 170 171 + /* Selector values are one-based */ 172 + 154 173 if (ret > selector->bNrInPins || ret < 1) { 155 174 printk(KERN_ERR 156 175 "%s(): selector reported illegal value, id %d, ret %d\n", ··· 161 176 return -EINVAL; 162 177 } 163 178 164 - return __uac_clock_find_source(chip, host_iface, 165 - selector->baCSourceID[ret-1], 179 + return __uac_clock_find_source(chip, selector->baCSourceID[ret-1], 166 180 visited); 167 181 } 168 182 169 183 /* FIXME: multipliers only act as pass-thru element for now */ 170 - multiplier = snd_usb_find_clock_multiplier(host_iface, entity_id); 184 + multiplier = snd_usb_find_clock_multiplier(chip->ctrl_intf, entity_id); 171 185 if (multiplier) 172 - return __uac_clock_find_source(chip, host_iface, 173 - multiplier->bCSourceID, visited); 186 + return __uac_clock_find_source(chip, multiplier->bCSourceID, 187 + visited); 174 188 175 189 return -EINVAL; 176 190 } 177 191 178 - int snd_usb_clock_find_source(struct snd_usb_audio *chip, 179 - struct usb_host_interface *host_iface, 180 - int entity_id) 192 + /* 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 as 196 + * clock source input to terminal. This functions walks the clock path 197 + * 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) 181 204 { 182 205 DECLARE_BITMAP(visited, 256); 183 206 memset(visited, 0, sizeof(visited)); 184 - return __uac_clock_find_source(chip, host_iface, entity_id, visited); 207 + return __uac_clock_find_source(chip, entity_id, visited); 185 208 } 186 209 187 210 static int set_sample_rate_v1(struct snd_usb_audio *chip, int iface, ··· 204 211 ep = get_endpoint(alts, 0)->bEndpointAddress; 205 212 206 213 /* 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); 214 + if (!(fmt->attributes & UAC_EP_CS_ATTR_SAMPLE_RATE)) 210 215 return 0; 211 - } 212 216 213 217 data[0] = rate; 214 218 data[1] = rate >> 8; ··· 244 254 struct usb_device *dev = chip->dev; 245 255 unsigned char data[4]; 246 256 int err, crate; 247 - int clock = snd_usb_clock_find_source(chip, chip->ctrl_intf, fmt->clock); 257 + int clock = snd_usb_clock_find_source(chip, fmt->clock); 248 258 249 259 if (clock < 0) 250 260 return clock; 251 261 252 262 if (!uac_clock_source_is_valid(chip, clock)) { 263 + /* TODO: should we try to find valid clock setups by ourself? */ 253 264 snd_printk(KERN_ERR "%d:%d:%d: clock source %d is not valid, cannot use\n", 254 265 dev->devnum, iface, fmt->altsetting, clock); 255 266 return -ENXIO;
+1 -3
sound/usb/clock.h
··· 5 5 struct usb_host_interface *alts, 6 6 struct audioformat *fmt, int rate); 7 7 8 - int snd_usb_clock_find_source(struct snd_usb_audio *chip, 9 - struct usb_host_interface *host_iface, 10 - int entity_id); 8 + int snd_usb_clock_find_source(struct snd_usb_audio *chip, int entity_id); 11 9 12 10 #endif /* __USBAUDIO_CLOCK_H */
+3 -2
sound/usb/endpoint.c
··· 33 33 #include "pcm.h" 34 34 #include "helper.h" 35 35 #include "format.h" 36 + #include "clock.h" 36 37 37 38 /* 38 39 * free a substream ··· 276 275 /* get audio formats */ 277 276 switch (protocol) { 278 277 case UAC_VERSION_1: { 279 - struct uac_as_header_descriptor_v1 *as = 278 + struct uac1_as_header_descriptor *as = 280 279 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); 281 280 282 281 if (!as) { ··· 298 297 case UAC_VERSION_2: { 299 298 struct uac2_input_terminal_descriptor *input_term; 300 299 struct uac2_output_terminal_descriptor *output_term; 301 - struct uac_as_header_descriptor_v2 *as = 300 + struct uac2_as_header_descriptor *as = 302 301 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); 303 302 304 303 if (!as) {
+4 -5
sound/usb/format.c
··· 264 264 * on the audioformat table (audio class v2). 265 265 */ 266 266 static int parse_audio_format_rates_v2(struct snd_usb_audio *chip, 267 - struct audioformat *fp, 268 - struct usb_host_interface *iface) 267 + struct audioformat *fp) 269 268 { 270 269 struct usb_device *dev = chip->dev; 271 270 unsigned char tmp[2], *data; 272 271 int nr_triplets, data_size, ret = 0; 273 - int clock = snd_usb_clock_find_source(chip, chip->ctrl_intf, fp->clock); 272 + int clock = snd_usb_clock_find_source(chip, fp->clock); 274 273 275 274 if (clock < 0) { 276 275 snd_printk(KERN_ERR "%s(): unable to find clock source (clock %d)\n", ··· 390 391 break; 391 392 case UAC_VERSION_2: 392 393 /* fp->channels is already set in this case */ 393 - ret = parse_audio_format_rates_v2(chip, fp, iface); 394 + ret = parse_audio_format_rates_v2(chip, fp); 394 395 break; 395 396 } 396 397 ··· 449 450 framesize = le16_to_cpu(fmt->wSamplesPerFrame); 450 451 snd_printd(KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n", brate, framesize); 451 452 fp->frame_size = framesize; 452 - ret = parse_audio_format_rates_v2(chip, fp, iface); 453 + ret = parse_audio_format_rates_v2(chip, fp); 453 454 break; 454 455 } 455 456 }
+7 -7
sound/usb/midi.c
··· 434 434 u8 cin = buffer[i] & 0x0f; 435 435 struct usbmidi_in_port *port = &ep->ports[cable]; 436 436 int length; 437 - 437 + 438 438 length = snd_usbmidi_cin_length[cin]; 439 439 if (cin == 0xf && buffer[i + 1] >= 0xf8) 440 440 ; /* realtime msg: no running status change */ ··· 628 628 629 629 static struct usb_protocol_ops snd_usbmidi_midiman_ops = { 630 630 .input = snd_usbmidi_midiman_input, 631 - .output = snd_usbmidi_standard_output, 631 + .output = snd_usbmidi_standard_output, 632 632 .output_packet = snd_usbmidi_output_midiman_packet, 633 633 }; 634 634 635 635 static struct usb_protocol_ops snd_usbmidi_maudio_broken_running_status_ops = { 636 636 .input = snd_usbmidi_maudio_broken_running_status_input, 637 - .output = snd_usbmidi_standard_output, 637 + .output = snd_usbmidi_standard_output, 638 638 .output_packet = snd_usbmidi_output_standard_packet, 639 639 }; 640 640 ··· 1248 1248 */ 1249 1249 static int snd_usbmidi_out_endpoint_create(struct snd_usb_midi* umidi, 1250 1250 struct snd_usb_midi_endpoint_info* ep_info, 1251 - struct snd_usb_midi_endpoint* rep) 1251 + struct snd_usb_midi_endpoint* rep) 1252 1252 { 1253 1253 struct snd_usb_midi_out_endpoint* ep; 1254 1254 unsigned int i; ··· 1398 1398 } 1399 1399 1400 1400 static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_midi* umidi, 1401 - int stream, int number) 1401 + int stream, int number) 1402 1402 { 1403 1403 struct list_head* list; 1404 1404 ··· 1811 1811 snd_usbmidi_switch_roland_altsetting(umidi); 1812 1812 1813 1813 if (endpoint[0].out_ep || endpoint[0].in_ep) 1814 - return 0; 1814 + return 0; 1815 1815 1816 1816 intf = umidi->iface; 1817 1817 if (!intf || intf->num_altsetting < 1) ··· 1849 1849 struct snd_usb_midi_endpoint_info* endpoints) 1850 1850 { 1851 1851 int err, i; 1852 - 1852 + 1853 1853 err = snd_usbmidi_detect_endpoints(umidi, endpoints, MIDI_MAX_ENDPOINTS); 1854 1854 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { 1855 1855 if (endpoints[i].out_ep)
+42 -35
sound/usb/mixer.c
··· 26 26 * 27 27 */ 28 28 29 + /* 30 + * TODOs, for both the mixer and the streaming interfaces: 31 + * 32 + * - support for UAC2 effect units 33 + * - support for graphical equalizers 34 + * - 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 invalid 41 + * - stop PCM streams which use a clock selector that has changed 42 + * - parse available sample rates again when clock sources changed 43 + */ 44 + 29 45 #include <linux/bitops.h> 30 46 #include <linux/init.h> 31 47 #include <linux/list.h> ··· 291 275 292 276 static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) 293 277 { 278 + struct snd_usb_audio *chip = cval->mixer->chip; 294 279 unsigned char buf[2]; 295 280 int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; 296 281 int timeout = 10; 297 282 298 283 while (timeout-- > 0) { 299 - if (snd_usb_ctl_msg(cval->mixer->chip->dev, 300 - usb_rcvctrlpipe(cval->mixer->chip->dev, 0), 301 - request, 284 + if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request, 302 285 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, 303 - validx, cval->mixer->ctrlif | (cval->id << 8), 286 + validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), 304 287 buf, val_len, 100) >= val_len) { 305 288 *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len)); 306 289 return 0; 307 290 } 308 291 } 309 292 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); 293 + request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type); 311 294 return -EINVAL; 312 295 } 313 296 314 297 static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) 315 298 { 299 + struct snd_usb_audio *chip = cval->mixer->chip; 316 300 unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */ 317 301 unsigned char *val; 318 302 int ret, size; ··· 328 312 329 313 memset(buf, 0, sizeof(buf)); 330 314 331 - ret = snd_usb_ctl_msg(cval->mixer->chip->dev, 332 - usb_rcvctrlpipe(cval->mixer->chip->dev, 0), 333 - bRequest, 315 + ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest, 334 316 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN, 335 - validx, cval->mixer->ctrlif | (cval->id << 8), 317 + validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), 336 318 buf, size, 1000); 337 319 338 320 if (ret < 0) { 339 321 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); 322 + request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type); 341 323 return ret; 342 324 } 343 325 ··· 411 397 int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, 412 398 int request, int validx, int value_set) 413 399 { 400 + struct snd_usb_audio *chip = cval->mixer->chip; 414 401 unsigned char buf[2]; 415 402 int val_len, timeout = 10; 416 403 ··· 434 419 buf[0] = value_set & 0xff; 435 420 buf[1] = (value_set >> 8) & 0xff; 436 421 while (timeout-- > 0) 437 - if (snd_usb_ctl_msg(cval->mixer->chip->dev, 438 - usb_sndctrlpipe(cval->mixer->chip->dev, 0), 439 - request, 422 + if (snd_usb_ctl_msg(chip->dev, 423 + usb_sndctrlpipe(chip->dev, 0), request, 440 424 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT, 441 - validx, cval->mixer->ctrlif | (cval->id << 8), 425 + validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), 442 426 buf, val_len, 100) >= 0) 443 427 return 0; 444 428 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]); 429 + request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type, buf[0], buf[1]); 446 430 return -EINVAL; 447 431 } 448 432 ··· 596 582 switch (iterm->type >> 16) { 597 583 case UAC_SELECTOR_UNIT: 598 584 strcpy(name, "Selector"); return 8; 599 - case UAC_PROCESSING_UNIT_V1: 585 + case UAC1_PROCESSING_UNIT: 600 586 strcpy(name, "Process Unit"); return 12; 601 - case UAC_EXTENSION_UNIT_V1: 587 + case UAC1_EXTENSION_UNIT: 602 588 strcpy(name, "Ext Unit"); return 8; 603 589 case UAC_MIXER_UNIT: 604 590 strcpy(name, "Mixer"); return 5; ··· 686 672 term->name = uac_selector_unit_iSelector(d); 687 673 return 0; 688 674 } 689 - case UAC_PROCESSING_UNIT_V1: 690 - case UAC_EXTENSION_UNIT_V1: { 675 + case UAC1_PROCESSING_UNIT: 676 + case UAC1_EXTENSION_UNIT: { 691 677 struct uac_processing_unit_descriptor *d = p1; 692 678 if (d->bNrInPins) { 693 679 id = d->baSourceID[0]; ··· 759 745 */ 760 746 static int get_min_max(struct usb_mixer_elem_info *cval, int default_min) 761 747 { 748 + struct snd_usb_audio *chip = cval->mixer->chip; 749 + 762 750 /* for failsafe */ 763 751 cval->min = default_min; 764 752 cval->max = cval->min + 1; ··· 783 767 if (get_ctl_value(cval, UAC_GET_MAX, (cval->control << 8) | minchn, &cval->max) < 0 || 784 768 get_ctl_value(cval, UAC_GET_MIN, (cval->control << 8) | minchn, &cval->min) < 0) { 785 769 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); 770 + cval->id, snd_usb_ctrl_intf(chip), cval->control, cval->id); 787 771 return -EINVAL; 788 772 } 789 773 if (get_ctl_value(cval, UAC_GET_RES, (cval->control << 8) | minchn, &cval->res) < 0) { ··· 1215 1199 } 1216 1200 } else { /* UAC_VERSION_2 */ 1217 1201 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 not 1222 - present then the bit pair must be set to 0b00. 1223 - If a Control is present but read-only, the bit pair must be 1224 - set to 0b01. If a Control is also Host programmable, the bit 1225 - pair must be set to 0b11. The value 0b10 is not allowed. */ 1226 1202 unsigned int ch_bits = 0; 1227 1203 unsigned int ch_read_only = 0; 1228 1204 ··· 1863 1855 return parse_audio_selector_unit(state, unitid, p1); 1864 1856 case UAC_FEATURE_UNIT: 1865 1857 return parse_audio_feature_unit(state, unitid, p1); 1866 - case UAC_PROCESSING_UNIT_V1: 1858 + case UAC1_PROCESSING_UNIT: 1867 1859 /* UAC2_EFFECT_UNIT has the same value */ 1868 1860 if (state->mixer->protocol == UAC_VERSION_1) 1869 1861 return parse_audio_processing_unit(state, unitid, p1); 1870 1862 else 1871 1863 return 0; /* FIXME - effect units not implemented yet */ 1872 - case UAC_EXTENSION_UNIT_V1: 1864 + case UAC1_EXTENSION_UNIT: 1873 1865 /* UAC2_PROCESSING_UNIT_V2 has the same value */ 1874 1866 if (state->mixer->protocol == UAC_VERSION_1) 1875 1867 return parse_audio_extension_unit(state, unitid, p1); ··· 1913 1905 struct usb_host_interface *hostif; 1914 1906 void *p; 1915 1907 1916 - hostif = &usb_ifnum_to_if(mixer->chip->dev, mixer->ctrlif)->altsetting[0]; 1908 + hostif = mixer->chip->ctrl_intf; 1917 1909 memset(&state, 0, sizeof(state)); 1918 1910 state.chip = mixer->chip; 1919 1911 state.mixer = mixer; ··· 1933 1925 p = NULL; 1934 1926 while ((p = snd_usb_find_csint_desc(hostif->extra, hostif->extralen, p, UAC_OUTPUT_TERMINAL)) != NULL) { 1935 1927 if (mixer->protocol == UAC_VERSION_1) { 1936 - struct uac_output_terminal_descriptor_v1 *desc = p; 1928 + struct uac1_output_terminal_descriptor *desc = p; 1937 1929 1938 1930 if (desc->bLength < sizeof(*desc)) 1939 1931 continue; /* invalid descriptor? */ ··· 2005 1997 list_for_each_entry(mixer, &chip->mixer_list, list) { 2006 1998 snd_iprintf(buffer, 2007 1999 "USB Mixer: usb_id=0x%08x, ctrlif=%i, ctlerr=%i\n", 2008 - chip->usb_id, mixer->ctrlif, 2000 + chip->usb_id, snd_usb_ctrl_intf(chip), 2009 2001 mixer->ignore_ctl_error); 2010 2002 snd_iprintf(buffer, "Card: %s\n", chip->card->longname); 2011 2003 for (unitid = 0; unitid < MAX_ID_ELEMS; unitid++) { ··· 2123 2115 int buffer_length; 2124 2116 unsigned int epnum; 2125 2117 2126 - hostif = &usb_ifnum_to_if(mixer->chip->dev, mixer->ctrlif)->altsetting[0]; 2118 + hostif = mixer->chip->ctrl_intf; 2127 2119 /* we need one interrupt input endpoint */ 2128 2120 if (get_iface_desc(hostif)->bNumEndpoints < 1) 2129 2121 return 0; ··· 2166 2158 if (!mixer) 2167 2159 return -ENOMEM; 2168 2160 mixer->chip = chip; 2169 - mixer->ctrlif = ctrlif; 2170 2161 mixer->ignore_ctl_error = ignore_error; 2171 2162 mixer->id_elems = kcalloc(MAX_ID_ELEMS, sizeof(*mixer->id_elems), 2172 2163 GFP_KERNEL);
-1
sound/usb/mixer.h
··· 3 3 4 4 struct usb_mixer_interface { 5 5 struct snd_usb_audio *chip; 6 - unsigned int ctrlif; 7 6 struct list_head list; 8 7 unsigned int ignore_ctl_error; 9 8 struct urb *urb;
-3
sound/usb/pcm.h
··· 7 7 struct usb_host_interface *alts, 8 8 struct audioformat *fmt); 9 9 10 - int snd_usb_init_sample_rate(struct snd_usb_audio *chip, int iface, 11 - struct usb_host_interface *alts, 12 - struct audioformat *fmt, int rate); 13 10 14 11 #endif /* __USBAUDIO_PCM_H */
+99 -85
sound/usb/quirks-table.h
··· 2152 2152 } 2153 2153 }, 2154 2154 { 2155 - USB_DEVICE_VENDOR_SPEC(0x2040, 0x7201), 2156 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2157 - USB_DEVICE_ID_MATCH_INT_CLASS | 2158 - USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2159 - .bInterfaceClass = USB_CLASS_AUDIO, 2160 - .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2161 - .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2162 - .vendor_name = "Hauppauge", 2163 - .product_name = "HVR-950Q", 2164 - .ifnum = QUIRK_ANY_INTERFACE, 2165 - .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2166 - } 2167 - }, 2168 - { 2169 - USB_DEVICE_VENDOR_SPEC(0x2040, 0x7202), 2170 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2171 - USB_DEVICE_ID_MATCH_INT_CLASS | 2172 - USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2173 - .bInterfaceClass = USB_CLASS_AUDIO, 2174 - .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2175 - .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2176 - .vendor_name = "Hauppauge", 2177 - .product_name = "HVR-950Q", 2178 - .ifnum = QUIRK_ANY_INTERFACE, 2179 - .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2180 - } 2181 - }, 2182 - { 2183 - USB_DEVICE_VENDOR_SPEC(0x2040, 0x7203), 2184 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2185 - USB_DEVICE_ID_MATCH_INT_CLASS | 2186 - USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2187 - .bInterfaceClass = USB_CLASS_AUDIO, 2188 - .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2189 - .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2190 - .vendor_name = "Hauppauge", 2191 - .product_name = "HVR-950Q", 2192 - .ifnum = QUIRK_ANY_INTERFACE, 2193 - .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2194 - } 2195 - }, 2196 - { 2197 - USB_DEVICE_VENDOR_SPEC(0x2040, 0x7204), 2198 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2199 - USB_DEVICE_ID_MATCH_INT_CLASS | 2200 - USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2201 - .bInterfaceClass = USB_CLASS_AUDIO, 2202 - .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2203 - .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2204 - .vendor_name = "Hauppauge", 2205 - .product_name = "HVR-950Q", 2206 - .ifnum = QUIRK_ANY_INTERFACE, 2207 - .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2208 - } 2209 - }, 2210 - { 2211 - USB_DEVICE_VENDOR_SPEC(0x2040, 0x7205), 2212 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2213 - USB_DEVICE_ID_MATCH_INT_CLASS | 2214 - USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2215 - .bInterfaceClass = USB_CLASS_AUDIO, 2216 - .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2217 - .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2218 - .vendor_name = "Hauppauge", 2219 - .product_name = "HVR-950Q", 2220 - .ifnum = QUIRK_ANY_INTERFACE, 2221 - .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2222 - } 2223 - }, 2224 - { 2225 - USB_DEVICE_VENDOR_SPEC(0x2040, 0x7250), 2226 - .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2227 - USB_DEVICE_ID_MATCH_INT_CLASS | 2228 - USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2229 - .bInterfaceClass = USB_CLASS_AUDIO, 2230 - .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2231 - .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2232 - .vendor_name = "Hauppauge", 2233 - .product_name = "HVR-950Q", 2234 - .ifnum = QUIRK_ANY_INTERFACE, 2235 - .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2236 - } 2237 - }, 2238 - { 2239 - USB_DEVICE_VENDOR_SPEC(0x2040, 0x7230), 2155 + USB_DEVICE_VENDOR_SPEC(0x2040, 0x7240), 2240 2156 .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2241 2157 USB_DEVICE_ID_MATCH_INT_CLASS | 2242 2158 USB_DEVICE_ID_MATCH_INT_SUBCLASS, ··· 2161 2245 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2162 2246 .vendor_name = "Hauppauge", 2163 2247 .product_name = "HVR-850", 2248 + .ifnum = QUIRK_ANY_INTERFACE, 2249 + .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2250 + } 2251 + }, 2252 + { 2253 + USB_DEVICE_VENDOR_SPEC(0x2040, 0x7210), 2254 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2255 + USB_DEVICE_ID_MATCH_INT_CLASS | 2256 + USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2257 + .bInterfaceClass = USB_CLASS_AUDIO, 2258 + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2259 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2260 + .vendor_name = "Hauppauge", 2261 + .product_name = "HVR-950Q", 2262 + .ifnum = QUIRK_ANY_INTERFACE, 2263 + .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2264 + } 2265 + }, 2266 + { 2267 + USB_DEVICE_VENDOR_SPEC(0x2040, 0x7217), 2268 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2269 + USB_DEVICE_ID_MATCH_INT_CLASS | 2270 + USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2271 + .bInterfaceClass = USB_CLASS_AUDIO, 2272 + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2273 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2274 + .vendor_name = "Hauppauge", 2275 + .product_name = "HVR-950Q", 2276 + .ifnum = QUIRK_ANY_INTERFACE, 2277 + .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2278 + } 2279 + }, 2280 + { 2281 + USB_DEVICE_VENDOR_SPEC(0x2040, 0x721b), 2282 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2283 + USB_DEVICE_ID_MATCH_INT_CLASS | 2284 + USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2285 + .bInterfaceClass = USB_CLASS_AUDIO, 2286 + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2287 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2288 + .vendor_name = "Hauppauge", 2289 + .product_name = "HVR-950Q", 2290 + .ifnum = QUIRK_ANY_INTERFACE, 2291 + .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2292 + } 2293 + }, 2294 + { 2295 + USB_DEVICE_VENDOR_SPEC(0x2040, 0x721e), 2296 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2297 + USB_DEVICE_ID_MATCH_INT_CLASS | 2298 + USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2299 + .bInterfaceClass = USB_CLASS_AUDIO, 2300 + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2301 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2302 + .vendor_name = "Hauppauge", 2303 + .product_name = "HVR-950Q", 2304 + .ifnum = QUIRK_ANY_INTERFACE, 2305 + .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2306 + } 2307 + }, 2308 + { 2309 + USB_DEVICE_VENDOR_SPEC(0x2040, 0x721f), 2310 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2311 + USB_DEVICE_ID_MATCH_INT_CLASS | 2312 + USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2313 + .bInterfaceClass = USB_CLASS_AUDIO, 2314 + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2315 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2316 + .vendor_name = "Hauppauge", 2317 + .product_name = "HVR-950Q", 2318 + .ifnum = QUIRK_ANY_INTERFACE, 2319 + .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2320 + } 2321 + }, 2322 + { 2323 + USB_DEVICE_VENDOR_SPEC(0x2040, 0x7280), 2324 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2325 + USB_DEVICE_ID_MATCH_INT_CLASS | 2326 + USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2327 + .bInterfaceClass = USB_CLASS_AUDIO, 2328 + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2329 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2330 + .vendor_name = "Hauppauge", 2331 + .product_name = "HVR-950Q", 2332 + .ifnum = QUIRK_ANY_INTERFACE, 2333 + .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2334 + } 2335 + }, 2336 + { 2337 + USB_DEVICE_VENDOR_SPEC(0x0fd9, 0x0008), 2338 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE | 2339 + USB_DEVICE_ID_MATCH_INT_CLASS | 2340 + USB_DEVICE_ID_MATCH_INT_SUBCLASS, 2341 + .bInterfaceClass = USB_CLASS_AUDIO, 2342 + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, 2343 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 2344 + .vendor_name = "Hauppauge", 2345 + .product_name = "HVR-950Q", 2164 2346 .ifnum = QUIRK_ANY_INTERFACE, 2165 2347 .type = QUIRK_AUDIO_ALIGN_TRANSFER, 2166 2348 }
+1
sound/usb/quirks.c
··· 32 32 #include "helper.h" 33 33 #include "endpoint.h" 34 34 #include "pcm.h" 35 + #include "clock.h" 35 36 36 37 /* 37 38 * handle the quirks for the contained interfaces