Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'topic/misc' into for-linus

+2777 -915
+1 -1
Documentation/DocBook/writing-an-alsa-driver.tmpl
··· 404 404 /* SNDRV_CARDS: maximum number of cards supported by this module */ 405 405 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 406 406 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 407 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 407 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 408 408 409 409 /* definition of the chip-specific record */ 410 410 struct mychip {
+188
Documentation/sound/alsa/compress_offload.txt
··· 1 + compress_offload.txt 2 + ===================== 3 + Pierre-Louis.Bossart <pierre-louis.bossart@linux.intel.com> 4 + Vinod Koul <vinod.koul@linux.intel.com> 5 + 6 + Overview 7 + 8 + Since its early days, the ALSA API was defined with PCM support or 9 + constant bitrates payloads such as IEC61937 in mind. Arguments and 10 + returned values in frames are the norm, making it a challenge to 11 + extend the existing API to compressed data streams. 12 + 13 + In recent years, audio digital signal processors (DSP) were integrated 14 + in system-on-chip designs, and DSPs are also integrated in audio 15 + codecs. Processing compressed data on such DSPs results in a dramatic 16 + reduction of power consumption compared to host-based 17 + processing. Support for such hardware has not been very good in Linux, 18 + mostly because of a lack of a generic API available in the mainline 19 + kernel. 20 + 21 + Rather than requiring a compability break with an API change of the 22 + ALSA PCM interface, a new 'Compressed Data' API is introduced to 23 + provide a control and data-streaming interface for audio DSPs. 24 + 25 + The design of this API was inspired by the 2-year experience with the 26 + Intel Moorestown SOC, with many corrections required to upstream the 27 + API in the mainline kernel instead of the staging tree and make it 28 + usable by others. 29 + 30 + Requirements 31 + 32 + The main requirements are: 33 + 34 + - separation between byte counts and time. Compressed formats may have 35 + a header per file, per frame, or no header at all. The payload size 36 + may vary from frame-to-frame. As a result, it is not possible to 37 + estimate reliably the duration of audio buffers when handling 38 + compressed data. Dedicated mechanisms are required to allow for 39 + reliable audio-video synchronization, which requires precise 40 + reporting of the number of samples rendered at any given time. 41 + 42 + - Handling of multiple formats. PCM data only requires a specification 43 + of the sampling rate, number of channels and bits per sample. In 44 + contrast, compressed data comes in a variety of formats. Audio DSPs 45 + may also provide support for a limited number of audio encoders and 46 + decoders embedded in firmware, or may support more choices through 47 + dynamic download of libraries. 48 + 49 + - Focus on main formats. This API provides support for the most 50 + popular formats used for audio and video capture and playback. It is 51 + likely that as audio compression technology advances, new formats 52 + will be added. 53 + 54 + - Handling of multiple configurations. Even for a given format like 55 + AAC, some implementations may support AAC multichannel but HE-AAC 56 + stereo. Likewise WMA10 level M3 may require too much memory and cpu 57 + cycles. The new API needs to provide a generic way of listing these 58 + formats. 59 + 60 + - Rendering/Grabbing only. This API does not provide any means of 61 + hardware acceleration, where PCM samples are provided back to 62 + user-space for additional processing. This API focuses instead on 63 + streaming compressed data to a DSP, with the assumption that the 64 + decoded samples are routed to a physical output or logical back-end. 65 + 66 + - Complexity hiding. Existing user-space multimedia frameworks all 67 + have existing enums/structures for each compressed format. This new 68 + API assumes the existence of a platform-specific compatibility layer 69 + to expose, translate and make use of the capabilities of the audio 70 + DSP, eg. Android HAL or PulseAudio sinks. By construction, regular 71 + applications are not supposed to make use of this API. 72 + 73 + 74 + Design 75 + 76 + The new API shares a number of concepts with with the PCM API for flow 77 + control. Start, pause, resume, drain and stop commands have the same 78 + semantics no matter what the content is. 79 + 80 + The concept of memory ring buffer divided in a set of fragments is 81 + borrowed from the ALSA PCM API. However, only sizes in bytes can be 82 + specified. 83 + 84 + Seeks/trick modes are assumed to be handled by the host. 85 + 86 + The notion of rewinds/forwards is not supported. Data committed to the 87 + ring buffer cannot be invalidated, except when dropping all buffers. 88 + 89 + The Compressed Data API does not make any assumptions on how the data 90 + is transmitted to the audio DSP. DMA transfers from main memory to an 91 + embedded audio cluster or to a SPI interface for external DSPs are 92 + possible. As in the ALSA PCM case, a core set of routines is exposed; 93 + each driver implementer will have to write support for a set of 94 + mandatory routines and possibly make use of optional ones. 95 + 96 + The main additions are 97 + 98 + - get_caps 99 + This routine returns the list of audio formats supported. Querying the 100 + codecs on a capture stream will return encoders, decoders will be 101 + listed for playback streams. 102 + 103 + - get_codec_caps For each codec, this routine returns a list of 104 + capabilities. The intent is to make sure all the capabilities 105 + correspond to valid settings, and to minimize the risks of 106 + configuration failures. For example, for a complex codec such as AAC, 107 + the number of channels supported may depend on a specific profile. If 108 + the capabilities were exposed with a single descriptor, it may happen 109 + that a specific combination of profiles/channels/formats may not be 110 + supported. Likewise, embedded DSPs have limited memory and cpu cycles, 111 + it is likely that some implementations make the list of capabilities 112 + dynamic and dependent on existing workloads. In addition to codec 113 + settings, this routine returns the minimum buffer size handled by the 114 + implementation. This information can be a function of the DMA buffer 115 + sizes, the number of bytes required to synchronize, etc, and can be 116 + used by userspace to define how much needs to be written in the ring 117 + buffer before playback can start. 118 + 119 + - set_params 120 + This routine sets the configuration chosen for a specific codec. The 121 + most important field in the parameters is the codec type; in most 122 + cases decoders will ignore other fields, while encoders will strictly 123 + comply to the settings 124 + 125 + - get_params 126 + This routines returns the actual settings used by the DSP. Changes to 127 + the settings should remain the exception. 128 + 129 + - get_timestamp 130 + The timestamp becomes a multiple field structure. It lists the number 131 + of bytes transferred, the number of samples processed and the number 132 + of samples rendered/grabbed. All these values can be used to determine 133 + the avarage bitrate, figure out if the ring buffer needs to be 134 + refilled or the delay due to decoding/encoding/io on the DSP. 135 + 136 + Note that the list of codecs/profiles/modes was derived from the 137 + OpenMAX AL specification instead of reinventing the wheel. 138 + Modifications include: 139 + - Addition of FLAC and IEC formats 140 + - Merge of encoder/decoder capabilities 141 + - Profiles/modes listed as bitmasks to make descriptors more compact 142 + - Addition of set_params for decoders (missing in OpenMAX AL) 143 + - Addition of AMR/AMR-WB encoding modes (missing in OpenMAX AL) 144 + - Addition of format information for WMA 145 + - Addition of encoding options when required (derived from OpenMAX IL) 146 + - Addition of rateControlSupported (missing in OpenMAX AL) 147 + 148 + Not supported: 149 + 150 + - Support for VoIP/circuit-switched calls is not the target of this 151 + API. Support for dynamic bit-rate changes would require a tight 152 + coupling between the DSP and the host stack, limiting power savings. 153 + 154 + - Packet-loss concealment is not supported. This would require an 155 + additional interface to let the decoder synthesize data when frames 156 + are lost during transmission. This may be added in the future. 157 + 158 + - Volume control/routing is not handled by this API. Devices exposing a 159 + compressed data interface will be considered as regular ALSA devices; 160 + volume changes and routing information will be provided with regular 161 + ALSA kcontrols. 162 + 163 + - Embedded audio effects. Such effects should be enabled in the same 164 + manner, no matter if the input was PCM or compressed. 165 + 166 + - multichannel IEC encoding. Unclear if this is required. 167 + 168 + - Encoding/decoding acceleration is not supported as mentioned 169 + above. It is possible to route the output of a decoder to a capture 170 + stream, or even implement transcoding capabilities. This routing 171 + would be enabled with ALSA kcontrols. 172 + 173 + - Audio policy/resource management. This API does not provide any 174 + hooks to query the utilization of the audio DSP, nor any premption 175 + mechanisms. 176 + 177 + - No notion of underun/overrun. Since the bytes written are compressed 178 + in nature and data written/read doesn't translate directly to 179 + rendered output in time, this does not deal with underrun/overun and 180 + maybe dealt in user-library 181 + 182 + Credits: 183 + - Mark Brown and Liam Girdwood for discussions on the need for this API 184 + - Harsha Priya for her work on intel_sst compressed API 185 + - Rakesh Ughreja for valuable feedback 186 + - Sing Nallasellan, Sikkandar Madar and Prasanna Samaga for 187 + demonstrating and quantifying the benefits of audio offload on a 188 + real platform.
+2
include/sound/Kbuild
··· 6 6 header-y += hdspm.h 7 7 header-y += sb16_csp.h 8 8 header-y += sfnt_info.h 9 + header-y += compress_params.h 10 + header-y += compress_offload.h
+167
include/sound/compress_driver.h
··· 1 + /* 2 + * compress_driver.h - compress offload driver definations 3 + * 4 + * Copyright (C) 2011 Intel Corporation 5 + * Authors: Vinod Koul <vinod.koul@linux.intel.com> 6 + * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 7 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License as published by 11 + * the Free Software Foundation; version 2 of the License. 12 + * 13 + * This program is distributed in the hope that it will be useful, but 14 + * WITHOUT ANY WARRANTY; without even the implied warranty of 15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 + * General Public License for more details. 17 + * 18 + * You should have received a copy of the GNU General Public License along 19 + * with this program; if not, write to the Free Software Foundation, Inc., 20 + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 21 + * 22 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 23 + * 24 + */ 25 + #ifndef __COMPRESS_DRIVER_H 26 + #define __COMPRESS_DRIVER_H 27 + 28 + #include <linux/types.h> 29 + #include <linux/sched.h> 30 + #include <sound/compress_offload.h> 31 + #include <sound/asound.h> 32 + #include <sound/pcm.h> 33 + 34 + struct snd_compr_ops; 35 + 36 + /** 37 + * struct snd_compr_runtime: runtime stream description 38 + * @state: stream state 39 + * @ops: pointer to DSP callbacks 40 + * @buffer: pointer to kernel buffer, valid only when not in mmap mode or 41 + * DSP doesn't implement copy 42 + * @buffer_size: size of the above buffer 43 + * @fragment_size: size of buffer fragment in bytes 44 + * @fragments: number of such fragments 45 + * @hw_pointer: offset of last location in buffer where DSP copied data 46 + * @app_pointer: offset of last location in buffer where app wrote data 47 + * @total_bytes_available: cumulative number of bytes made available in 48 + * the ring buffer 49 + * @total_bytes_transferred: cumulative bytes transferred by offload DSP 50 + * @sleep: poll sleep 51 + */ 52 + struct snd_compr_runtime { 53 + snd_pcm_state_t state; 54 + struct snd_compr_ops *ops; 55 + void *buffer; 56 + u64 buffer_size; 57 + u32 fragment_size; 58 + u32 fragments; 59 + u64 hw_pointer; 60 + u64 app_pointer; 61 + u64 total_bytes_available; 62 + u64 total_bytes_transferred; 63 + wait_queue_head_t sleep; 64 + }; 65 + 66 + /** 67 + * struct snd_compr_stream: compressed stream 68 + * @name: device name 69 + * @ops: pointer to DSP callbacks 70 + * @runtime: pointer to runtime structure 71 + * @device: device pointer 72 + * @direction: stream direction, playback/recording 73 + * @private_data: pointer to DSP private data 74 + */ 75 + struct snd_compr_stream { 76 + const char *name; 77 + struct snd_compr_ops *ops; 78 + struct snd_compr_runtime *runtime; 79 + struct snd_compr *device; 80 + enum snd_compr_direction direction; 81 + void *private_data; 82 + }; 83 + 84 + /** 85 + * struct snd_compr_ops: compressed path DSP operations 86 + * @open: Open the compressed stream 87 + * This callback is mandatory and shall keep dsp ready to receive the stream 88 + * parameter 89 + * @free: Close the compressed stream, mandatory 90 + * @set_params: Sets the compressed stream parameters, mandatory 91 + * This can be called in during stream creation only to set codec params 92 + * and the stream properties 93 + * @get_params: retrieve the codec parameters, mandatory 94 + * @trigger: Trigger operations like start, pause, resume, drain, stop. 95 + * This callback is mandatory 96 + * @pointer: Retrieve current h/w pointer information. Mandatory 97 + * @copy: Copy the compressed data to/from userspace, Optional 98 + * Can't be implemented if DSP supports mmap 99 + * @mmap: DSP mmap method to mmap DSP memory 100 + * @ack: Ack for DSP when data is written to audio buffer, Optional 101 + * Not valid if copy is implemented 102 + * @get_caps: Retrieve DSP capabilities, mandatory 103 + * @get_codec_caps: Retrieve capabilities for a specific codec, mandatory 104 + */ 105 + struct snd_compr_ops { 106 + int (*open)(struct snd_compr_stream *stream); 107 + int (*free)(struct snd_compr_stream *stream); 108 + int (*set_params)(struct snd_compr_stream *stream, 109 + struct snd_compr_params *params); 110 + int (*get_params)(struct snd_compr_stream *stream, 111 + struct snd_codec *params); 112 + int (*trigger)(struct snd_compr_stream *stream, int cmd); 113 + int (*pointer)(struct snd_compr_stream *stream, 114 + struct snd_compr_tstamp *tstamp); 115 + int (*copy)(struct snd_compr_stream *stream, const char __user *buf, 116 + size_t count); 117 + int (*mmap)(struct snd_compr_stream *stream, 118 + struct vm_area_struct *vma); 119 + int (*ack)(struct snd_compr_stream *stream, size_t bytes); 120 + int (*get_caps) (struct snd_compr_stream *stream, 121 + struct snd_compr_caps *caps); 122 + int (*get_codec_caps) (struct snd_compr_stream *stream, 123 + struct snd_compr_codec_caps *codec); 124 + }; 125 + 126 + /** 127 + * struct snd_compr: Compressed device 128 + * @name: DSP device name 129 + * @dev: Device pointer 130 + * @ops: pointer to DSP callbacks 131 + * @private_data: pointer to DSP pvt data 132 + * @card: sound card pointer 133 + * @direction: Playback or capture direction 134 + * @lock: device lock 135 + * @device: device id 136 + */ 137 + struct snd_compr { 138 + const char *name; 139 + struct device *dev; 140 + struct snd_compr_ops *ops; 141 + void *private_data; 142 + struct snd_card *card; 143 + unsigned int direction; 144 + struct mutex lock; 145 + int device; 146 + }; 147 + 148 + /* compress device register APIs */ 149 + int snd_compress_register(struct snd_compr *device); 150 + int snd_compress_deregister(struct snd_compr *device); 151 + int snd_compress_new(struct snd_card *card, int device, 152 + int type, struct snd_compr *compr); 153 + 154 + /* dsp driver callback apis 155 + * For playback: driver should call snd_compress_fragment_elapsed() to let the 156 + * framework know that a fragment has been consumed from the ring buffer 157 + * 158 + * For recording: we want to know when a frame is available or when 159 + * at least one frame is available so snd_compress_frame_elapsed() 160 + * callback should be called when a encodeded frame is available 161 + */ 162 + static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream) 163 + { 164 + wake_up(&stream->runtime->sleep); 165 + } 166 + 167 + #endif
+161
include/sound/compress_offload.h
··· 1 + /* 2 + * compress_offload.h - compress offload header definations 3 + * 4 + * Copyright (C) 2011 Intel Corporation 5 + * Authors: Vinod Koul <vinod.koul@linux.intel.com> 6 + * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 7 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License as published by 11 + * the Free Software Foundation; version 2 of the License. 12 + * 13 + * This program is distributed in the hope that it will be useful, but 14 + * WITHOUT ANY WARRANTY; without even the implied warranty of 15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 + * General Public License for more details. 17 + * 18 + * You should have received a copy of the GNU General Public License along 19 + * with this program; if not, write to the Free Software Foundation, Inc., 20 + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 21 + * 22 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 23 + * 24 + */ 25 + #ifndef __COMPRESS_OFFLOAD_H 26 + #define __COMPRESS_OFFLOAD_H 27 + 28 + #include <linux/types.h> 29 + #include <sound/asound.h> 30 + #include <sound/compress_params.h> 31 + 32 + 33 + #define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 0) 34 + /** 35 + * struct snd_compressed_buffer: compressed buffer 36 + * @fragment_size: size of buffer fragment in bytes 37 + * @fragments: number of such fragments 38 + */ 39 + struct snd_compressed_buffer { 40 + __u32 fragment_size; 41 + __u32 fragments; 42 + }; 43 + 44 + /** 45 + * struct snd_compr_params: compressed stream params 46 + * @buffer: buffer description 47 + * @codec: codec parameters 48 + * @no_wake_mode: dont wake on fragment elapsed 49 + */ 50 + struct snd_compr_params { 51 + struct snd_compressed_buffer buffer; 52 + struct snd_codec codec; 53 + __u8 no_wake_mode; 54 + }; 55 + 56 + /** 57 + * struct snd_compr_tstamp: timestamp descriptor 58 + * @byte_offset: Byte offset in ring buffer to DSP 59 + * @copied_total: Total number of bytes copied from/to ring buffer to/by DSP 60 + * @pcm_frames: Frames decoded or encoded by DSP. This field will evolve by 61 + * large steps and should only be used to monitor encoding/decoding 62 + * progress. It shall not be used for timing estimates. 63 + * @pcm_io_frames: Frames rendered or received by DSP into a mixer or an audio 64 + * output/input. This field should be used for A/V sync or time estimates. 65 + * @sampling_rate: sampling rate of audio 66 + */ 67 + struct snd_compr_tstamp { 68 + __u32 byte_offset; 69 + __u32 copied_total; 70 + snd_pcm_uframes_t pcm_frames; 71 + snd_pcm_uframes_t pcm_io_frames; 72 + __u32 sampling_rate; 73 + }; 74 + 75 + /** 76 + * struct snd_compr_avail: avail descriptor 77 + * @avail: Number of bytes available in ring buffer for writing/reading 78 + * @tstamp: timestamp infomation 79 + */ 80 + struct snd_compr_avail { 81 + __u64 avail; 82 + struct snd_compr_tstamp tstamp; 83 + }; 84 + 85 + enum snd_compr_direction { 86 + SND_COMPRESS_PLAYBACK = 0, 87 + SND_COMPRESS_CAPTURE 88 + }; 89 + 90 + /** 91 + * struct snd_compr_caps: caps descriptor 92 + * @codecs: pointer to array of codecs 93 + * @direction: direction supported. Of type snd_compr_direction 94 + * @min_fragment_size: minimum fragment supported by DSP 95 + * @max_fragment_size: maximum fragment supported by DSP 96 + * @min_fragments: min fragments supported by DSP 97 + * @max_fragments: max fragments supported by DSP 98 + * @num_codecs: number of codecs supported 99 + * @reserved: reserved field 100 + */ 101 + struct snd_compr_caps { 102 + __u32 num_codecs; 103 + __u32 direction; 104 + __u32 min_fragment_size; 105 + __u32 max_fragment_size; 106 + __u32 min_fragments; 107 + __u32 max_fragments; 108 + __u32 codecs[MAX_NUM_CODECS]; 109 + __u32 reserved[11]; 110 + }; 111 + 112 + /** 113 + * struct snd_compr_codec_caps: query capability of codec 114 + * @codec: codec for which capability is queried 115 + * @num_descriptors: number of codec descriptors 116 + * @descriptor: array of codec capability descriptor 117 + */ 118 + struct snd_compr_codec_caps { 119 + __u32 codec; 120 + __u32 num_descriptors; 121 + struct snd_codec_desc descriptor[MAX_NUM_CODEC_DESCRIPTORS]; 122 + }; 123 + 124 + /** 125 + * compress path ioctl definitions 126 + * SNDRV_COMPRESS_GET_CAPS: Query capability of DSP 127 + * SNDRV_COMPRESS_GET_CODEC_CAPS: Query capability of a codec 128 + * SNDRV_COMPRESS_SET_PARAMS: Set codec and stream parameters 129 + * Note: only codec params can be changed runtime and stream params cant be 130 + * SNDRV_COMPRESS_GET_PARAMS: Query codec params 131 + * SNDRV_COMPRESS_TSTAMP: get the current timestamp value 132 + * SNDRV_COMPRESS_AVAIL: get the current buffer avail value. 133 + * This also queries the tstamp properties 134 + * SNDRV_COMPRESS_PAUSE: Pause the running stream 135 + * SNDRV_COMPRESS_RESUME: resume a paused stream 136 + * SNDRV_COMPRESS_START: Start a stream 137 + * SNDRV_COMPRESS_STOP: stop a running stream, discarding ring buffer content 138 + * and the buffers currently with DSP 139 + * SNDRV_COMPRESS_DRAIN: Play till end of buffers and stop after that 140 + * SNDRV_COMPRESS_IOCTL_VERSION: Query the API version 141 + */ 142 + #define SNDRV_COMPRESS_IOCTL_VERSION _IOR('C', 0x00, int) 143 + #define SNDRV_COMPRESS_GET_CAPS _IOWR('C', 0x10, struct snd_compr_caps) 144 + #define SNDRV_COMPRESS_GET_CODEC_CAPS _IOWR('C', 0x11,\ 145 + struct snd_compr_codec_caps) 146 + #define SNDRV_COMPRESS_SET_PARAMS _IOW('C', 0x12, struct snd_compr_params) 147 + #define SNDRV_COMPRESS_GET_PARAMS _IOR('C', 0x13, struct snd_codec) 148 + #define SNDRV_COMPRESS_TSTAMP _IOR('C', 0x20, struct snd_compr_tstamp) 149 + #define SNDRV_COMPRESS_AVAIL _IOR('C', 0x21, struct snd_compr_avail) 150 + #define SNDRV_COMPRESS_PAUSE _IO('C', 0x30) 151 + #define SNDRV_COMPRESS_RESUME _IO('C', 0x31) 152 + #define SNDRV_COMPRESS_START _IO('C', 0x32) 153 + #define SNDRV_COMPRESS_STOP _IO('C', 0x33) 154 + #define SNDRV_COMPRESS_DRAIN _IO('C', 0x34) 155 + /* 156 + * TODO 157 + * 1. add mmap support 158 + * 159 + */ 160 + #define SND_COMPR_TRIGGER_DRAIN 7 /*FIXME move this to pcm.h */ 161 + #endif
+397
include/sound/compress_params.h
··· 1 + /* 2 + * compress_params.h - codec types and parameters for compressed data 3 + * streaming interface 4 + * 5 + * Copyright (C) 2011 Intel Corporation 6 + * Authors: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 7 + * Vinod Koul <vinod.koul@linux.intel.com> 8 + * 9 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 10 + * 11 + * This program is free software; you can redistribute it and/or modify 12 + * it under the terms of the GNU General Public License as published by 13 + * the Free Software Foundation; version 2 of the License. 14 + * 15 + * This program is distributed in the hope that it will be useful, but 16 + * WITHOUT ANY WARRANTY; without even the implied warranty of 17 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18 + * General Public License for more details. 19 + * 20 + * You should have received a copy of the GNU General Public License along 21 + * with this program; if not, write to the Free Software Foundation, Inc., 22 + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 23 + * 24 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 + * 26 + * The definitions in this file are derived from the OpenMAX AL version 1.1 27 + * and OpenMAX IL v 1.1.2 header files which contain the copyright notice below. 28 + * 29 + * Copyright (c) 2007-2010 The Khronos Group Inc. 30 + * 31 + * Permission is hereby granted, free of charge, to any person obtaining 32 + * a copy of this software and/or associated documentation files (the 33 + * "Materials "), to deal in the Materials without restriction, including 34 + * without limitation the rights to use, copy, modify, merge, publish, 35 + * distribute, sublicense, and/or sell copies of the Materials, and to 36 + * permit persons to whom the Materials are furnished to do so, subject to 37 + * the following conditions: 38 + * 39 + * The above copyright notice and this permission notice shall be included 40 + * in all copies or substantial portions of the Materials. 41 + * 42 + * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 43 + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 44 + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 45 + * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 46 + * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 47 + * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 48 + * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 49 + * 50 + */ 51 + #ifndef __SND_COMPRESS_PARAMS_H 52 + #define __SND_COMPRESS_PARAMS_H 53 + 54 + /* AUDIO CODECS SUPPORTED */ 55 + #define MAX_NUM_CODECS 32 56 + #define MAX_NUM_CODEC_DESCRIPTORS 32 57 + #define MAX_NUM_BITRATES 32 58 + 59 + /* Codecs are listed linearly to allow for extensibility */ 60 + #define SND_AUDIOCODEC_PCM ((__u32) 0x00000001) 61 + #define SND_AUDIOCODEC_MP3 ((__u32) 0x00000002) 62 + #define SND_AUDIOCODEC_AMR ((__u32) 0x00000003) 63 + #define SND_AUDIOCODEC_AMRWB ((__u32) 0x00000004) 64 + #define SND_AUDIOCODEC_AMRWBPLUS ((__u32) 0x00000005) 65 + #define SND_AUDIOCODEC_AAC ((__u32) 0x00000006) 66 + #define SND_AUDIOCODEC_WMA ((__u32) 0x00000007) 67 + #define SND_AUDIOCODEC_REAL ((__u32) 0x00000008) 68 + #define SND_AUDIOCODEC_VORBIS ((__u32) 0x00000009) 69 + #define SND_AUDIOCODEC_FLAC ((__u32) 0x0000000A) 70 + #define SND_AUDIOCODEC_IEC61937 ((__u32) 0x0000000B) 71 + #define SND_AUDIOCODEC_G723_1 ((__u32) 0x0000000C) 72 + #define SND_AUDIOCODEC_G729 ((__u32) 0x0000000D) 73 + 74 + /* 75 + * Profile and modes are listed with bit masks. This allows for a 76 + * more compact representation of fields that will not evolve 77 + * (in contrast to the list of codecs) 78 + */ 79 + 80 + #define SND_AUDIOPROFILE_PCM ((__u32) 0x00000001) 81 + 82 + /* MP3 modes are only useful for encoders */ 83 + #define SND_AUDIOCHANMODE_MP3_MONO ((__u32) 0x00000001) 84 + #define SND_AUDIOCHANMODE_MP3_STEREO ((__u32) 0x00000002) 85 + #define SND_AUDIOCHANMODE_MP3_JOINTSTEREO ((__u32) 0x00000004) 86 + #define SND_AUDIOCHANMODE_MP3_DUAL ((__u32) 0x00000008) 87 + 88 + #define SND_AUDIOPROFILE_AMR ((__u32) 0x00000001) 89 + 90 + /* AMR modes are only useful for encoders */ 91 + #define SND_AUDIOMODE_AMR_DTX_OFF ((__u32) 0x00000001) 92 + #define SND_AUDIOMODE_AMR_VAD1 ((__u32) 0x00000002) 93 + #define SND_AUDIOMODE_AMR_VAD2 ((__u32) 0x00000004) 94 + 95 + #define SND_AUDIOSTREAMFORMAT_UNDEFINED ((__u32) 0x00000000) 96 + #define SND_AUDIOSTREAMFORMAT_CONFORMANCE ((__u32) 0x00000001) 97 + #define SND_AUDIOSTREAMFORMAT_IF1 ((__u32) 0x00000002) 98 + #define SND_AUDIOSTREAMFORMAT_IF2 ((__u32) 0x00000004) 99 + #define SND_AUDIOSTREAMFORMAT_FSF ((__u32) 0x00000008) 100 + #define SND_AUDIOSTREAMFORMAT_RTPPAYLOAD ((__u32) 0x00000010) 101 + #define SND_AUDIOSTREAMFORMAT_ITU ((__u32) 0x00000020) 102 + 103 + #define SND_AUDIOPROFILE_AMRWB ((__u32) 0x00000001) 104 + 105 + /* AMRWB modes are only useful for encoders */ 106 + #define SND_AUDIOMODE_AMRWB_DTX_OFF ((__u32) 0x00000001) 107 + #define SND_AUDIOMODE_AMRWB_VAD1 ((__u32) 0x00000002) 108 + #define SND_AUDIOMODE_AMRWB_VAD2 ((__u32) 0x00000004) 109 + 110 + #define SND_AUDIOPROFILE_AMRWBPLUS ((__u32) 0x00000001) 111 + 112 + #define SND_AUDIOPROFILE_AAC ((__u32) 0x00000001) 113 + 114 + /* AAC modes are required for encoders and decoders */ 115 + #define SND_AUDIOMODE_AAC_MAIN ((__u32) 0x00000001) 116 + #define SND_AUDIOMODE_AAC_LC ((__u32) 0x00000002) 117 + #define SND_AUDIOMODE_AAC_SSR ((__u32) 0x00000004) 118 + #define SND_AUDIOMODE_AAC_LTP ((__u32) 0x00000008) 119 + #define SND_AUDIOMODE_AAC_HE ((__u32) 0x00000010) 120 + #define SND_AUDIOMODE_AAC_SCALABLE ((__u32) 0x00000020) 121 + #define SND_AUDIOMODE_AAC_ERLC ((__u32) 0x00000040) 122 + #define SND_AUDIOMODE_AAC_LD ((__u32) 0x00000080) 123 + #define SND_AUDIOMODE_AAC_HE_PS ((__u32) 0x00000100) 124 + #define SND_AUDIOMODE_AAC_HE_MPS ((__u32) 0x00000200) 125 + 126 + /* AAC formats are required for encoders and decoders */ 127 + #define SND_AUDIOSTREAMFORMAT_MP2ADTS ((__u32) 0x00000001) 128 + #define SND_AUDIOSTREAMFORMAT_MP4ADTS ((__u32) 0x00000002) 129 + #define SND_AUDIOSTREAMFORMAT_MP4LOAS ((__u32) 0x00000004) 130 + #define SND_AUDIOSTREAMFORMAT_MP4LATM ((__u32) 0x00000008) 131 + #define SND_AUDIOSTREAMFORMAT_ADIF ((__u32) 0x00000010) 132 + #define SND_AUDIOSTREAMFORMAT_MP4FF ((__u32) 0x00000020) 133 + #define SND_AUDIOSTREAMFORMAT_RAW ((__u32) 0x00000040) 134 + 135 + #define SND_AUDIOPROFILE_WMA7 ((__u32) 0x00000001) 136 + #define SND_AUDIOPROFILE_WMA8 ((__u32) 0x00000002) 137 + #define SND_AUDIOPROFILE_WMA9 ((__u32) 0x00000004) 138 + #define SND_AUDIOPROFILE_WMA10 ((__u32) 0x00000008) 139 + 140 + #define SND_AUDIOMODE_WMA_LEVEL1 ((__u32) 0x00000001) 141 + #define SND_AUDIOMODE_WMA_LEVEL2 ((__u32) 0x00000002) 142 + #define SND_AUDIOMODE_WMA_LEVEL3 ((__u32) 0x00000004) 143 + #define SND_AUDIOMODE_WMA_LEVEL4 ((__u32) 0x00000008) 144 + #define SND_AUDIOMODE_WMAPRO_LEVELM0 ((__u32) 0x00000010) 145 + #define SND_AUDIOMODE_WMAPRO_LEVELM1 ((__u32) 0x00000020) 146 + #define SND_AUDIOMODE_WMAPRO_LEVELM2 ((__u32) 0x00000040) 147 + #define SND_AUDIOMODE_WMAPRO_LEVELM3 ((__u32) 0x00000080) 148 + 149 + #define SND_AUDIOSTREAMFORMAT_WMA_ASF ((__u32) 0x00000001) 150 + /* 151 + * Some implementations strip the ASF header and only send ASF packets 152 + * to the DSP 153 + */ 154 + #define SND_AUDIOSTREAMFORMAT_WMA_NOASF_HDR ((__u32) 0x00000002) 155 + 156 + #define SND_AUDIOPROFILE_REALAUDIO ((__u32) 0x00000001) 157 + 158 + #define SND_AUDIOMODE_REALAUDIO_G2 ((__u32) 0x00000001) 159 + #define SND_AUDIOMODE_REALAUDIO_8 ((__u32) 0x00000002) 160 + #define SND_AUDIOMODE_REALAUDIO_10 ((__u32) 0x00000004) 161 + #define SND_AUDIOMODE_REALAUDIO_SURROUND ((__u32) 0x00000008) 162 + 163 + #define SND_AUDIOPROFILE_VORBIS ((__u32) 0x00000001) 164 + 165 + #define SND_AUDIOMODE_VORBIS ((__u32) 0x00000001) 166 + 167 + #define SND_AUDIOPROFILE_FLAC ((__u32) 0x00000001) 168 + 169 + /* 170 + * Define quality levels for FLAC encoders, from LEVEL0 (fast) 171 + * to LEVEL8 (best) 172 + */ 173 + #define SND_AUDIOMODE_FLAC_LEVEL0 ((__u32) 0x00000001) 174 + #define SND_AUDIOMODE_FLAC_LEVEL1 ((__u32) 0x00000002) 175 + #define SND_AUDIOMODE_FLAC_LEVEL2 ((__u32) 0x00000004) 176 + #define SND_AUDIOMODE_FLAC_LEVEL3 ((__u32) 0x00000008) 177 + #define SND_AUDIOMODE_FLAC_LEVEL4 ((__u32) 0x00000010) 178 + #define SND_AUDIOMODE_FLAC_LEVEL5 ((__u32) 0x00000020) 179 + #define SND_AUDIOMODE_FLAC_LEVEL6 ((__u32) 0x00000040) 180 + #define SND_AUDIOMODE_FLAC_LEVEL7 ((__u32) 0x00000080) 181 + #define SND_AUDIOMODE_FLAC_LEVEL8 ((__u32) 0x00000100) 182 + 183 + #define SND_AUDIOSTREAMFORMAT_FLAC ((__u32) 0x00000001) 184 + #define SND_AUDIOSTREAMFORMAT_FLAC_OGG ((__u32) 0x00000002) 185 + 186 + /* IEC61937 payloads without CUVP and preambles */ 187 + #define SND_AUDIOPROFILE_IEC61937 ((__u32) 0x00000001) 188 + /* IEC61937 with S/PDIF preambles+CUVP bits in 32-bit containers */ 189 + #define SND_AUDIOPROFILE_IEC61937_SPDIF ((__u32) 0x00000002) 190 + 191 + /* 192 + * IEC modes are mandatory for decoders. Format autodetection 193 + * will only happen on the DSP side with mode 0. The PCM mode should 194 + * not be used, the PCM codec should be used instead. 195 + */ 196 + #define SND_AUDIOMODE_IEC_REF_STREAM_HEADER ((__u32) 0x00000000) 197 + #define SND_AUDIOMODE_IEC_LPCM ((__u32) 0x00000001) 198 + #define SND_AUDIOMODE_IEC_AC3 ((__u32) 0x00000002) 199 + #define SND_AUDIOMODE_IEC_MPEG1 ((__u32) 0x00000004) 200 + #define SND_AUDIOMODE_IEC_MP3 ((__u32) 0x00000008) 201 + #define SND_AUDIOMODE_IEC_MPEG2 ((__u32) 0x00000010) 202 + #define SND_AUDIOMODE_IEC_AACLC ((__u32) 0x00000020) 203 + #define SND_AUDIOMODE_IEC_DTS ((__u32) 0x00000040) 204 + #define SND_AUDIOMODE_IEC_ATRAC ((__u32) 0x00000080) 205 + #define SND_AUDIOMODE_IEC_SACD ((__u32) 0x00000100) 206 + #define SND_AUDIOMODE_IEC_EAC3 ((__u32) 0x00000200) 207 + #define SND_AUDIOMODE_IEC_DTS_HD ((__u32) 0x00000400) 208 + #define SND_AUDIOMODE_IEC_MLP ((__u32) 0x00000800) 209 + #define SND_AUDIOMODE_IEC_DST ((__u32) 0x00001000) 210 + #define SND_AUDIOMODE_IEC_WMAPRO ((__u32) 0x00002000) 211 + #define SND_AUDIOMODE_IEC_REF_CXT ((__u32) 0x00004000) 212 + #define SND_AUDIOMODE_IEC_HE_AAC ((__u32) 0x00008000) 213 + #define SND_AUDIOMODE_IEC_HE_AAC2 ((__u32) 0x00010000) 214 + #define SND_AUDIOMODE_IEC_MPEG_SURROUND ((__u32) 0x00020000) 215 + 216 + #define SND_AUDIOPROFILE_G723_1 ((__u32) 0x00000001) 217 + 218 + #define SND_AUDIOMODE_G723_1_ANNEX_A ((__u32) 0x00000001) 219 + #define SND_AUDIOMODE_G723_1_ANNEX_B ((__u32) 0x00000002) 220 + #define SND_AUDIOMODE_G723_1_ANNEX_C ((__u32) 0x00000004) 221 + 222 + #define SND_AUDIOPROFILE_G729 ((__u32) 0x00000001) 223 + 224 + #define SND_AUDIOMODE_G729_ANNEX_A ((__u32) 0x00000001) 225 + #define SND_AUDIOMODE_G729_ANNEX_B ((__u32) 0x00000002) 226 + 227 + /* <FIXME: multichannel encoders aren't supported for now. Would need 228 + an additional definition of channel arrangement> */ 229 + 230 + /* VBR/CBR definitions */ 231 + #define SND_RATECONTROLMODE_CONSTANTBITRATE ((__u32) 0x00000001) 232 + #define SND_RATECONTROLMODE_VARIABLEBITRATE ((__u32) 0x00000002) 233 + 234 + /* Encoder options */ 235 + 236 + struct snd_enc_wma { 237 + __u32 super_block_align; /* WMA Type-specific data */ 238 + }; 239 + 240 + 241 + /** 242 + * struct snd_enc_vorbis 243 + * @quality: Sets encoding quality to n, between -1 (low) and 10 (high). 244 + * In the default mode of operation, the quality level is 3. 245 + * Normal quality range is 0 - 10. 246 + * @managed: Boolean. Set bitrate management mode. This turns off the 247 + * normal VBR encoding, but allows hard or soft bitrate constraints to be 248 + * enforced by the encoder. This mode can be slower, and may also be 249 + * lower quality. It is primarily useful for streaming. 250 + * @max_bit_rate: Enabled only if managed is TRUE 251 + * @min_bit_rate: Enabled only if managed is TRUE 252 + * @downmix: Boolean. Downmix input from stereo to mono (has no effect on 253 + * non-stereo streams). Useful for lower-bitrate encoding. 254 + * 255 + * These options were extracted from the OpenMAX IL spec and Gstreamer vorbisenc 256 + * properties 257 + * 258 + * For best quality users should specify VBR mode and set quality levels. 259 + */ 260 + 261 + struct snd_enc_vorbis { 262 + __s32 quality; 263 + __u32 managed; 264 + __u32 max_bit_rate; 265 + __u32 min_bit_rate; 266 + __u32 downmix; 267 + }; 268 + 269 + 270 + /** 271 + * struct snd_enc_real 272 + * @quant_bits: number of coupling quantization bits in the stream 273 + * @start_region: coupling start region in the stream 274 + * @num_regions: number of regions value 275 + * 276 + * These options were extracted from the OpenMAX IL spec 277 + */ 278 + 279 + struct snd_enc_real { 280 + __u32 quant_bits; 281 + __u32 start_region; 282 + __u32 num_regions; 283 + }; 284 + 285 + /** 286 + * struct snd_enc_flac 287 + * @num: serial number, valid only for OGG formats 288 + * needs to be set by application 289 + * @gain: Add replay gain tags 290 + * 291 + * These options were extracted from the FLAC online documentation 292 + * at http://flac.sourceforge.net/documentation_tools_flac.html 293 + * 294 + * To make the API simpler, it is assumed that the user will select quality 295 + * profiles. Additional options that affect encoding quality and speed can 296 + * be added at a later stage if needed. 297 + * 298 + * By default the Subset format is used by encoders. 299 + * 300 + * TAGS such as pictures, etc, cannot be handled by an offloaded encoder and are 301 + * not supported in this API. 302 + */ 303 + 304 + struct snd_enc_flac { 305 + __u32 num; 306 + __u32 gain; 307 + }; 308 + 309 + struct snd_enc_generic { 310 + __u32 bw; /* encoder bandwidth */ 311 + __s32 reserved[15]; 312 + }; 313 + 314 + union snd_codec_options { 315 + struct snd_enc_wma wma; 316 + struct snd_enc_vorbis vorbis; 317 + struct snd_enc_real real; 318 + struct snd_enc_flac flac; 319 + struct snd_enc_generic generic; 320 + }; 321 + 322 + /** struct snd_codec_desc - description of codec capabilities 323 + * @max_ch: Maximum number of audio channels 324 + * @sample_rates: Sampling rates in Hz, use SNDRV_PCM_RATE_xxx for this 325 + * @bit_rate: Indexed array containing supported bit rates 326 + * @num_bitrates: Number of valid values in bit_rate array 327 + * @rate_control: value is specified by SND_RATECONTROLMODE defines. 328 + * @profiles: Supported profiles. See SND_AUDIOPROFILE defines. 329 + * @modes: Supported modes. See SND_AUDIOMODE defines 330 + * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines 331 + * @min_buffer: Minimum buffer size handled by codec implementation 332 + * @reserved: reserved for future use 333 + * 334 + * This structure provides a scalar value for profiles, modes and stream 335 + * format fields. 336 + * If an implementation supports multiple combinations, they will be listed as 337 + * codecs with different descriptors, for example there would be 2 descriptors 338 + * for AAC-RAW and AAC-ADTS. 339 + * This entails some redundancy but makes it easier to avoid invalid 340 + * configurations. 341 + * 342 + */ 343 + 344 + struct snd_codec_desc { 345 + __u32 max_ch; 346 + __u32 sample_rates; 347 + __u32 bit_rate[MAX_NUM_BITRATES]; 348 + __u32 num_bitrates; 349 + __u32 rate_control; 350 + __u32 profiles; 351 + __u32 modes; 352 + __u32 formats; 353 + __u32 min_buffer; 354 + __u32 reserved[15]; 355 + }; 356 + 357 + /** struct snd_codec 358 + * @id: Identifies the supported audio encoder/decoder. 359 + * See SND_AUDIOCODEC macros. 360 + * @ch_in: Number of input audio channels 361 + * @ch_out: Number of output channels. In case of contradiction between 362 + * this field and the channelMode field, the channelMode field 363 + * overrides. 364 + * @sample_rate: Audio sample rate of input data 365 + * @bit_rate: Bitrate of encoded data. May be ignored by decoders 366 + * @rate_control: Encoding rate control. See SND_RATECONTROLMODE defines. 367 + * Encoders may rely on profiles for quality levels. 368 + * May be ignored by decoders. 369 + * @profile: Mandatory for encoders, can be mandatory for specific 370 + * decoders as well. See SND_AUDIOPROFILE defines. 371 + * @level: Supported level (Only used by WMA at the moment) 372 + * @ch_mode: Channel mode for encoder. See SND_AUDIOCHANMODE defines 373 + * @format: Format of encoded bistream. Mandatory when defined. 374 + * See SND_AUDIOSTREAMFORMAT defines. 375 + * @align: Block alignment in bytes of an audio sample. 376 + * Only required for PCM or IEC formats. 377 + * @options: encoder-specific settings 378 + * @reserved: reserved for future use 379 + */ 380 + 381 + struct snd_codec { 382 + __u32 id; 383 + __u32 ch_in; 384 + __u32 ch_out; 385 + __u32 sample_rate; 386 + __u32 bit_rate; 387 + __u32 rate_control; 388 + __u32 profile; 389 + __u32 level; 390 + __u32 ch_mode; 391 + __u32 format; 392 + __u32 align; 393 + union snd_codec_options options; 394 + __u32 reserved[3]; 395 + }; 396 + 397 + #endif
+1
include/sound/core.h
··· 62 62 #define SNDRV_DEV_BUS ((__force snd_device_type_t) 0x1007) 63 63 #define SNDRV_DEV_CODEC ((__force snd_device_type_t) 0x1008) 64 64 #define SNDRV_DEV_JACK ((__force snd_device_type_t) 0x1009) 65 + #define SNDRV_DEV_COMPRESS ((__force snd_device_type_t) 0x100A) 65 66 #define SNDRV_DEV_LOWLEVEL ((__force snd_device_type_t) 0x2000) 66 67 67 68 typedef int __bitwise snd_device_state_t;
+3 -1
include/sound/minors.h
··· 35 35 #define SNDRV_MINOR_TIMER 33 /* SNDRV_MINOR_GLOBAL + 1 * 32 */ 36 36 37 37 #ifndef CONFIG_SND_DYNAMIC_MINORS 38 - /* 2 - 3 (reserved) */ 38 + #define SNDRV_MINOR_COMPRESS 2 /* 2 - 3 */ 39 39 #define SNDRV_MINOR_HWDEP 4 /* 4 - 7 */ 40 40 #define SNDRV_MINOR_RAWMIDI 8 /* 8 - 15 */ 41 41 #define SNDRV_MINOR_PCM_PLAYBACK 16 /* 16 - 23 */ ··· 49 49 #define SNDRV_DEVICE_TYPE_PCM_CAPTURE SNDRV_MINOR_PCM_CAPTURE 50 50 #define SNDRV_DEVICE_TYPE_SEQUENCER SNDRV_MINOR_SEQUENCER 51 51 #define SNDRV_DEVICE_TYPE_TIMER SNDRV_MINOR_TIMER 52 + #define SNDRV_DEVICE_TYPE_COMPRESS SNDRV_MINOR_COMPRESS 52 53 53 54 #else /* CONFIG_SND_DYNAMIC_MINORS */ 54 55 ··· 61 60 SNDRV_DEVICE_TYPE_RAWMIDI, 62 61 SNDRV_DEVICE_TYPE_PCM_PLAYBACK, 63 62 SNDRV_DEVICE_TYPE_PCM_CAPTURE, 63 + SNDRV_DEVICE_TYPE_COMPRESS, 64 64 }; 65 65 66 66 #endif /* CONFIG_SND_DYNAMIC_MINORS */
+1 -12
sound/arm/pxa2xx-ac97.c
··· 251 251 }, 252 252 }; 253 253 254 - static int __init pxa2xx_ac97_init(void) 255 - { 256 - return platform_driver_register(&pxa2xx_ac97_driver); 257 - } 258 - 259 - static void __exit pxa2xx_ac97_exit(void) 260 - { 261 - platform_driver_unregister(&pxa2xx_ac97_driver); 262 - } 263 - 264 - module_init(pxa2xx_ac97_init); 265 - module_exit(pxa2xx_ac97_exit); 254 + module_platform_driver(pxa2xx_ac97_driver); 266 255 267 256 MODULE_AUTHOR("Nicolas Pitre"); 268 257 MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip");
+10
sound/core/Kconfig
··· 155 155 156 156 If you are unsure about this, say N here. 157 157 158 + config SND_COMPRESS_OFFLOAD 159 + tristate "ALSA Compressed audio offload support" 160 + default n 161 + help 162 + If you want support for offloading compressed audio and have such 163 + a hardware, then you should say Y here and also to the DSP driver 164 + of your platform. 165 + 166 + If you are unsure about this, say N here. 167 + 158 168 config SND_SUPPORT_OLD_API 159 169 bool "Support old ALSA API" 160 170 default y
+4
sound/core/Makefile
··· 21 21 snd-rtctimer-objs := rtctimer.o 22 22 snd-hwdep-objs := hwdep.o 23 23 24 + snd-compress-objs := compress_offload.o 25 + 24 26 obj-$(CONFIG_SND) += snd.o 25 27 obj-$(CONFIG_SND_HWDEP) += snd-hwdep.o 26 28 obj-$(CONFIG_SND_TIMER) += snd-timer.o ··· 33 31 34 32 obj-$(CONFIG_SND_OSSEMUL) += oss/ 35 33 obj-$(CONFIG_SND_SEQUENCER) += seq/ 34 + 35 + obj-$(CONFIG_SND_COMPRESS_OFFLOAD) += snd-compress.o
+765
sound/core/compress_offload.c
··· 1 + /* 2 + * compress_core.c - compress offload core 3 + * 4 + * Copyright (C) 2011 Intel Corporation 5 + * Authors: Vinod Koul <vinod.koul@linux.intel.com> 6 + * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> 7 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 8 + * 9 + * This program is free software; you can redistribute it and/or modify 10 + * it under the terms of the GNU General Public License as published by 11 + * the Free Software Foundation; version 2 of the License. 12 + * 13 + * This program is distributed in the hope that it will be useful, but 14 + * WITHOUT ANY WARRANTY; without even the implied warranty of 15 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 + * General Public License for more details. 17 + * 18 + * You should have received a copy of the GNU General Public License along 19 + * with this program; if not, write to the Free Software Foundation, Inc., 20 + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. 21 + * 22 + * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 23 + * 24 + */ 25 + #define FORMAT(fmt) "%s: %d: " fmt, __func__, __LINE__ 26 + #define pr_fmt(fmt) KBUILD_MODNAME ": " FORMAT(fmt) 27 + 28 + #include <linux/file.h> 29 + #include <linux/fs.h> 30 + #include <linux/list.h> 31 + #include <linux/mm.h> 32 + #include <linux/mutex.h> 33 + #include <linux/poll.h> 34 + #include <linux/slab.h> 35 + #include <linux/sched.h> 36 + #include <linux/uio.h> 37 + #include <linux/uaccess.h> 38 + #include <linux/module.h> 39 + #include <sound/core.h> 40 + #include <sound/initval.h> 41 + #include <sound/compress_params.h> 42 + #include <sound/compress_offload.h> 43 + #include <sound/compress_driver.h> 44 + 45 + /* TODO: 46 + * - add substream support for multiple devices in case of 47 + * SND_DYNAMIC_MINORS is not used 48 + * - Multiple node representation 49 + * driver should be able to register multiple nodes 50 + */ 51 + 52 + static DEFINE_MUTEX(device_mutex); 53 + 54 + struct snd_compr_file { 55 + unsigned long caps; 56 + struct snd_compr_stream stream; 57 + }; 58 + 59 + /* 60 + * a note on stream states used: 61 + * we use follwing states in the compressed core 62 + * SNDRV_PCM_STATE_OPEN: When stream has been opened. 63 + * SNDRV_PCM_STATE_SETUP: When stream has been initialized. This is done by 64 + * calling SNDRV_COMPRESS_SET_PARAMS. running streams will come to this 65 + * state at stop by calling SNDRV_COMPRESS_STOP, or at end of drain. 66 + * SNDRV_PCM_STATE_RUNNING: When stream has been started and is 67 + * decoding/encoding and rendering/capturing data. 68 + * SNDRV_PCM_STATE_DRAINING: When stream is draining current data. This is done 69 + * by calling SNDRV_COMPRESS_DRAIN. 70 + * SNDRV_PCM_STATE_PAUSED: When stream is paused. This is done by calling 71 + * SNDRV_COMPRESS_PAUSE. It can be stopped or resumed by calling 72 + * SNDRV_COMPRESS_STOP or SNDRV_COMPRESS_RESUME respectively. 73 + */ 74 + static int snd_compr_open(struct inode *inode, struct file *f) 75 + { 76 + struct snd_compr *compr; 77 + struct snd_compr_file *data; 78 + struct snd_compr_runtime *runtime; 79 + enum snd_compr_direction dirn; 80 + int maj = imajor(inode); 81 + int ret; 82 + 83 + if (f->f_flags & O_WRONLY) 84 + dirn = SND_COMPRESS_PLAYBACK; 85 + else if (f->f_flags & O_RDONLY) 86 + dirn = SND_COMPRESS_CAPTURE; 87 + else { 88 + pr_err("invalid direction\n"); 89 + return -EINVAL; 90 + } 91 + 92 + if (maj == snd_major) 93 + compr = snd_lookup_minor_data(iminor(inode), 94 + SNDRV_DEVICE_TYPE_COMPRESS); 95 + else 96 + return -EBADFD; 97 + 98 + if (compr == NULL) { 99 + pr_err("no device data!!!\n"); 100 + return -ENODEV; 101 + } 102 + 103 + if (dirn != compr->direction) { 104 + pr_err("this device doesn't support this direction\n"); 105 + return -EINVAL; 106 + } 107 + 108 + data = kzalloc(sizeof(*data), GFP_KERNEL); 109 + if (!data) 110 + return -ENOMEM; 111 + data->stream.ops = compr->ops; 112 + data->stream.direction = dirn; 113 + data->stream.private_data = compr->private_data; 114 + data->stream.device = compr; 115 + runtime = kzalloc(sizeof(*runtime), GFP_KERNEL); 116 + if (!runtime) { 117 + kfree(data); 118 + return -ENOMEM; 119 + } 120 + runtime->state = SNDRV_PCM_STATE_OPEN; 121 + init_waitqueue_head(&runtime->sleep); 122 + data->stream.runtime = runtime; 123 + f->private_data = (void *)data; 124 + mutex_lock(&compr->lock); 125 + ret = compr->ops->open(&data->stream); 126 + mutex_unlock(&compr->lock); 127 + if (ret) { 128 + kfree(runtime); 129 + kfree(data); 130 + } 131 + return ret; 132 + } 133 + 134 + static int snd_compr_free(struct inode *inode, struct file *f) 135 + { 136 + struct snd_compr_file *data = f->private_data; 137 + data->stream.ops->free(&data->stream); 138 + kfree(data->stream.runtime->buffer); 139 + kfree(data->stream.runtime); 140 + kfree(data); 141 + return 0; 142 + } 143 + 144 + static void snd_compr_update_tstamp(struct snd_compr_stream *stream, 145 + struct snd_compr_tstamp *tstamp) 146 + { 147 + if (!stream->ops->pointer) 148 + return; 149 + stream->ops->pointer(stream, tstamp); 150 + pr_debug("dsp consumed till %d total %d bytes\n", 151 + tstamp->byte_offset, tstamp->copied_total); 152 + stream->runtime->hw_pointer = tstamp->byte_offset; 153 + stream->runtime->total_bytes_transferred = tstamp->copied_total; 154 + } 155 + 156 + static size_t snd_compr_calc_avail(struct snd_compr_stream *stream, 157 + struct snd_compr_avail *avail) 158 + { 159 + long avail_calc; /*this needs to be signed variable */ 160 + 161 + snd_compr_update_tstamp(stream, &avail->tstamp); 162 + 163 + /* FIXME: This needs to be different for capture stream, 164 + available is # of compressed data, for playback it's 165 + remainder of buffer */ 166 + 167 + if (stream->runtime->total_bytes_available == 0 && 168 + stream->runtime->state == SNDRV_PCM_STATE_SETUP) { 169 + pr_debug("detected init and someone forgot to do a write\n"); 170 + return stream->runtime->buffer_size; 171 + } 172 + pr_debug("app wrote %lld, DSP consumed %lld\n", 173 + stream->runtime->total_bytes_available, 174 + stream->runtime->total_bytes_transferred); 175 + if (stream->runtime->total_bytes_available == 176 + stream->runtime->total_bytes_transferred) { 177 + pr_debug("both pointers are same, returning full avail\n"); 178 + return stream->runtime->buffer_size; 179 + } 180 + 181 + /* FIXME: this routine isn't consistent, in one test we use 182 + * cumulative values and in the other byte offsets. Do we 183 + * really need the byte offsets if the cumulative values have 184 + * been updated? In the PCM interface app_ptr and hw_ptr are 185 + * already cumulative */ 186 + 187 + avail_calc = stream->runtime->buffer_size - 188 + (stream->runtime->app_pointer - stream->runtime->hw_pointer); 189 + pr_debug("calc avail as %ld, app_ptr %lld, hw+ptr %lld\n", avail_calc, 190 + stream->runtime->app_pointer, 191 + stream->runtime->hw_pointer); 192 + if (avail_calc >= stream->runtime->buffer_size) 193 + avail_calc -= stream->runtime->buffer_size; 194 + pr_debug("ret avail as %ld\n", avail_calc); 195 + avail->avail = avail_calc; 196 + return avail_calc; 197 + } 198 + 199 + static inline size_t snd_compr_get_avail(struct snd_compr_stream *stream) 200 + { 201 + struct snd_compr_avail avail; 202 + 203 + return snd_compr_calc_avail(stream, &avail); 204 + } 205 + 206 + static int 207 + snd_compr_ioctl_avail(struct snd_compr_stream *stream, unsigned long arg) 208 + { 209 + struct snd_compr_avail ioctl_avail; 210 + size_t avail; 211 + 212 + avail = snd_compr_calc_avail(stream, &ioctl_avail); 213 + ioctl_avail.avail = avail; 214 + 215 + if (copy_to_user((__u64 __user *)arg, 216 + &ioctl_avail, sizeof(ioctl_avail))) 217 + return -EFAULT; 218 + return 0; 219 + } 220 + 221 + static int snd_compr_write_data(struct snd_compr_stream *stream, 222 + const char __user *buf, size_t count) 223 + { 224 + void *dstn; 225 + size_t copy; 226 + struct snd_compr_runtime *runtime = stream->runtime; 227 + 228 + dstn = runtime->buffer + runtime->app_pointer; 229 + pr_debug("copying %ld at %lld\n", 230 + (unsigned long)count, runtime->app_pointer); 231 + if (count < runtime->buffer_size - runtime->app_pointer) { 232 + if (copy_from_user(dstn, buf, count)) 233 + return -EFAULT; 234 + runtime->app_pointer += count; 235 + } else { 236 + copy = runtime->buffer_size - runtime->app_pointer; 237 + if (copy_from_user(dstn, buf, copy)) 238 + return -EFAULT; 239 + if (copy_from_user(runtime->buffer, buf + copy, count - copy)) 240 + return -EFAULT; 241 + runtime->app_pointer = count - copy; 242 + } 243 + /* if DSP cares, let it know data has been written */ 244 + if (stream->ops->ack) 245 + stream->ops->ack(stream, count); 246 + return count; 247 + } 248 + 249 + static ssize_t snd_compr_write(struct file *f, const char __user *buf, 250 + size_t count, loff_t *offset) 251 + { 252 + struct snd_compr_file *data = f->private_data; 253 + struct snd_compr_stream *stream; 254 + size_t avail; 255 + int retval; 256 + 257 + if (snd_BUG_ON(!data)) 258 + return -EFAULT; 259 + 260 + stream = &data->stream; 261 + mutex_lock(&stream->device->lock); 262 + /* write is allowed when stream is running or has been steup */ 263 + if (stream->runtime->state != SNDRV_PCM_STATE_SETUP && 264 + stream->runtime->state != SNDRV_PCM_STATE_RUNNING) { 265 + mutex_unlock(&stream->device->lock); 266 + return -EBADFD; 267 + } 268 + 269 + avail = snd_compr_get_avail(stream); 270 + pr_debug("avail returned %ld\n", (unsigned long)avail); 271 + /* calculate how much we can write to buffer */ 272 + if (avail > count) 273 + avail = count; 274 + 275 + if (stream->ops->copy) 276 + retval = stream->ops->copy(stream, buf, avail); 277 + else 278 + retval = snd_compr_write_data(stream, buf, avail); 279 + if (retval > 0) 280 + stream->runtime->total_bytes_available += retval; 281 + 282 + /* while initiating the stream, write should be called before START 283 + * call, so in setup move state */ 284 + if (stream->runtime->state == SNDRV_PCM_STATE_SETUP) { 285 + stream->runtime->state = SNDRV_PCM_STATE_PREPARED; 286 + pr_debug("stream prepared, Houston we are good to go\n"); 287 + } 288 + 289 + mutex_unlock(&stream->device->lock); 290 + return retval; 291 + } 292 + 293 + 294 + static ssize_t snd_compr_read(struct file *f, char __user *buf, 295 + size_t count, loff_t *offset) 296 + { 297 + return -ENXIO; 298 + } 299 + 300 + static int snd_compr_mmap(struct file *f, struct vm_area_struct *vma) 301 + { 302 + return -ENXIO; 303 + } 304 + 305 + static inline int snd_compr_get_poll(struct snd_compr_stream *stream) 306 + { 307 + if (stream->direction == SND_COMPRESS_PLAYBACK) 308 + return POLLOUT | POLLWRNORM; 309 + else 310 + return POLLIN | POLLRDNORM; 311 + } 312 + 313 + static unsigned int snd_compr_poll(struct file *f, poll_table *wait) 314 + { 315 + struct snd_compr_file *data = f->private_data; 316 + struct snd_compr_stream *stream; 317 + size_t avail; 318 + int retval = 0; 319 + 320 + if (snd_BUG_ON(!data)) 321 + return -EFAULT; 322 + stream = &data->stream; 323 + if (snd_BUG_ON(!stream)) 324 + return -EFAULT; 325 + 326 + mutex_lock(&stream->device->lock); 327 + if (stream->runtime->state == SNDRV_PCM_STATE_PAUSED || 328 + stream->runtime->state == SNDRV_PCM_STATE_OPEN) { 329 + retval = -EBADFD; 330 + goto out; 331 + } 332 + poll_wait(f, &stream->runtime->sleep, wait); 333 + 334 + avail = snd_compr_get_avail(stream); 335 + pr_debug("avail is %ld\n", (unsigned long)avail); 336 + /* check if we have at least one fragment to fill */ 337 + switch (stream->runtime->state) { 338 + case SNDRV_PCM_STATE_DRAINING: 339 + /* stream has been woken up after drain is complete 340 + * draining done so set stream state to stopped 341 + */ 342 + retval = snd_compr_get_poll(stream); 343 + stream->runtime->state = SNDRV_PCM_STATE_SETUP; 344 + break; 345 + case SNDRV_PCM_STATE_RUNNING: 346 + case SNDRV_PCM_STATE_PREPARED: 347 + case SNDRV_PCM_STATE_PAUSED: 348 + if (avail >= stream->runtime->fragment_size) 349 + retval = snd_compr_get_poll(stream); 350 + break; 351 + default: 352 + if (stream->direction == SND_COMPRESS_PLAYBACK) 353 + retval = POLLOUT | POLLWRNORM | POLLERR; 354 + else 355 + retval = POLLIN | POLLRDNORM | POLLERR; 356 + break; 357 + } 358 + out: 359 + mutex_unlock(&stream->device->lock); 360 + return retval; 361 + } 362 + 363 + static int 364 + snd_compr_get_caps(struct snd_compr_stream *stream, unsigned long arg) 365 + { 366 + int retval; 367 + struct snd_compr_caps caps; 368 + 369 + if (!stream->ops->get_caps) 370 + return -ENXIO; 371 + 372 + retval = stream->ops->get_caps(stream, &caps); 373 + if (retval) 374 + goto out; 375 + if (copy_to_user((void __user *)arg, &caps, sizeof(caps))) 376 + retval = -EFAULT; 377 + out: 378 + return retval; 379 + } 380 + 381 + static int 382 + snd_compr_get_codec_caps(struct snd_compr_stream *stream, unsigned long arg) 383 + { 384 + int retval; 385 + struct snd_compr_codec_caps *caps; 386 + 387 + if (!stream->ops->get_codec_caps) 388 + return -ENXIO; 389 + 390 + caps = kmalloc(sizeof(*caps), GFP_KERNEL); 391 + if (!caps) 392 + return -ENOMEM; 393 + 394 + retval = stream->ops->get_codec_caps(stream, caps); 395 + if (retval) 396 + goto out; 397 + if (copy_to_user((void __user *)arg, caps, sizeof(*caps))) 398 + retval = -EFAULT; 399 + 400 + out: 401 + kfree(caps); 402 + return retval; 403 + } 404 + 405 + /* revisit this with snd_pcm_preallocate_xxx */ 406 + static int snd_compr_allocate_buffer(struct snd_compr_stream *stream, 407 + struct snd_compr_params *params) 408 + { 409 + unsigned int buffer_size; 410 + void *buffer; 411 + 412 + buffer_size = params->buffer.fragment_size * params->buffer.fragments; 413 + if (stream->ops->copy) { 414 + buffer = NULL; 415 + /* if copy is defined the driver will be required to copy 416 + * the data from core 417 + */ 418 + } else { 419 + buffer = kmalloc(buffer_size, GFP_KERNEL); 420 + if (!buffer) 421 + return -ENOMEM; 422 + } 423 + stream->runtime->fragment_size = params->buffer.fragment_size; 424 + stream->runtime->fragments = params->buffer.fragments; 425 + stream->runtime->buffer = buffer; 426 + stream->runtime->buffer_size = buffer_size; 427 + return 0; 428 + } 429 + 430 + static int 431 + snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg) 432 + { 433 + struct snd_compr_params *params; 434 + int retval; 435 + 436 + if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) { 437 + /* 438 + * we should allow parameter change only when stream has been 439 + * opened not in other cases 440 + */ 441 + params = kmalloc(sizeof(*params), GFP_KERNEL); 442 + if (!params) 443 + return -ENOMEM; 444 + if (copy_from_user(params, (void __user *)arg, sizeof(*params))) 445 + return -EFAULT; 446 + retval = snd_compr_allocate_buffer(stream, params); 447 + if (retval) { 448 + kfree(params); 449 + return -ENOMEM; 450 + } 451 + retval = stream->ops->set_params(stream, params); 452 + if (retval) 453 + goto out; 454 + stream->runtime->state = SNDRV_PCM_STATE_SETUP; 455 + } else 456 + return -EPERM; 457 + out: 458 + kfree(params); 459 + return retval; 460 + } 461 + 462 + static int 463 + snd_compr_get_params(struct snd_compr_stream *stream, unsigned long arg) 464 + { 465 + struct snd_codec *params; 466 + int retval; 467 + 468 + if (!stream->ops->get_params) 469 + return -EBADFD; 470 + 471 + params = kmalloc(sizeof(*params), GFP_KERNEL); 472 + if (!params) 473 + return -ENOMEM; 474 + retval = stream->ops->get_params(stream, params); 475 + if (retval) 476 + goto out; 477 + if (copy_to_user((char __user *)arg, params, sizeof(*params))) 478 + retval = -EFAULT; 479 + 480 + out: 481 + kfree(params); 482 + return retval; 483 + } 484 + 485 + static inline int 486 + snd_compr_tstamp(struct snd_compr_stream *stream, unsigned long arg) 487 + { 488 + struct snd_compr_tstamp tstamp; 489 + 490 + snd_compr_update_tstamp(stream, &tstamp); 491 + return copy_to_user((struct snd_compr_tstamp __user *)arg, 492 + &tstamp, sizeof(tstamp)) ? -EFAULT : 0; 493 + } 494 + 495 + static int snd_compr_pause(struct snd_compr_stream *stream) 496 + { 497 + int retval; 498 + 499 + if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING) 500 + return -EPERM; 501 + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_PUSH); 502 + if (!retval) { 503 + stream->runtime->state = SNDRV_PCM_STATE_PAUSED; 504 + wake_up(&stream->runtime->sleep); 505 + } 506 + return retval; 507 + } 508 + 509 + static int snd_compr_resume(struct snd_compr_stream *stream) 510 + { 511 + int retval; 512 + 513 + if (stream->runtime->state != SNDRV_PCM_STATE_PAUSED) 514 + return -EPERM; 515 + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_RELEASE); 516 + if (!retval) 517 + stream->runtime->state = SNDRV_PCM_STATE_RUNNING; 518 + return retval; 519 + } 520 + 521 + static int snd_compr_start(struct snd_compr_stream *stream) 522 + { 523 + int retval; 524 + 525 + if (stream->runtime->state != SNDRV_PCM_STATE_PREPARED) 526 + return -EPERM; 527 + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_START); 528 + if (!retval) 529 + stream->runtime->state = SNDRV_PCM_STATE_RUNNING; 530 + return retval; 531 + } 532 + 533 + static int snd_compr_stop(struct snd_compr_stream *stream) 534 + { 535 + int retval; 536 + 537 + if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED || 538 + stream->runtime->state == SNDRV_PCM_STATE_SETUP) 539 + return -EPERM; 540 + retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP); 541 + if (!retval) { 542 + stream->runtime->state = SNDRV_PCM_STATE_SETUP; 543 + wake_up(&stream->runtime->sleep); 544 + } 545 + return retval; 546 + } 547 + 548 + static int snd_compr_drain(struct snd_compr_stream *stream) 549 + { 550 + int retval; 551 + 552 + if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED || 553 + stream->runtime->state == SNDRV_PCM_STATE_SETUP) 554 + return -EPERM; 555 + retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_DRAIN); 556 + if (!retval) { 557 + stream->runtime->state = SNDRV_PCM_STATE_DRAINING; 558 + wake_up(&stream->runtime->sleep); 559 + } 560 + return retval; 561 + } 562 + 563 + static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg) 564 + { 565 + struct snd_compr_file *data = f->private_data; 566 + struct snd_compr_stream *stream; 567 + int retval = -ENOTTY; 568 + 569 + if (snd_BUG_ON(!data)) 570 + return -EFAULT; 571 + stream = &data->stream; 572 + if (snd_BUG_ON(!stream)) 573 + return -EFAULT; 574 + mutex_lock(&stream->device->lock); 575 + switch (_IOC_NR(cmd)) { 576 + case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION): 577 + put_user(SNDRV_COMPRESS_VERSION, 578 + (int __user *)arg) ? -EFAULT : 0; 579 + break; 580 + case _IOC_NR(SNDRV_COMPRESS_GET_CAPS): 581 + retval = snd_compr_get_caps(stream, arg); 582 + break; 583 + case _IOC_NR(SNDRV_COMPRESS_GET_CODEC_CAPS): 584 + retval = snd_compr_get_codec_caps(stream, arg); 585 + break; 586 + case _IOC_NR(SNDRV_COMPRESS_SET_PARAMS): 587 + retval = snd_compr_set_params(stream, arg); 588 + break; 589 + case _IOC_NR(SNDRV_COMPRESS_GET_PARAMS): 590 + retval = snd_compr_get_params(stream, arg); 591 + break; 592 + case _IOC_NR(SNDRV_COMPRESS_TSTAMP): 593 + retval = snd_compr_tstamp(stream, arg); 594 + break; 595 + case _IOC_NR(SNDRV_COMPRESS_AVAIL): 596 + retval = snd_compr_ioctl_avail(stream, arg); 597 + break; 598 + case _IOC_NR(SNDRV_COMPRESS_PAUSE): 599 + retval = snd_compr_pause(stream); 600 + break; 601 + case _IOC_NR(SNDRV_COMPRESS_RESUME): 602 + retval = snd_compr_resume(stream); 603 + break; 604 + case _IOC_NR(SNDRV_COMPRESS_START): 605 + retval = snd_compr_start(stream); 606 + break; 607 + case _IOC_NR(SNDRV_COMPRESS_STOP): 608 + retval = snd_compr_stop(stream); 609 + break; 610 + case _IOC_NR(SNDRV_COMPRESS_DRAIN): 611 + retval = snd_compr_drain(stream); 612 + break; 613 + } 614 + mutex_unlock(&stream->device->lock); 615 + return retval; 616 + } 617 + 618 + static const struct file_operations snd_compr_file_ops = { 619 + .owner = THIS_MODULE, 620 + .open = snd_compr_open, 621 + .release = snd_compr_free, 622 + .write = snd_compr_write, 623 + .read = snd_compr_read, 624 + .unlocked_ioctl = snd_compr_ioctl, 625 + .mmap = snd_compr_mmap, 626 + .poll = snd_compr_poll, 627 + }; 628 + 629 + static int snd_compress_dev_register(struct snd_device *device) 630 + { 631 + int ret = -EINVAL; 632 + char str[16]; 633 + struct snd_compr *compr; 634 + 635 + if (snd_BUG_ON(!device || !device->device_data)) 636 + return -EBADFD; 637 + compr = device->device_data; 638 + 639 + sprintf(str, "comprC%iD%i", compr->card->number, compr->device); 640 + pr_debug("reg %s for device %s, direction %d\n", str, compr->name, 641 + compr->direction); 642 + /* register compressed device */ 643 + ret = snd_register_device(SNDRV_DEVICE_TYPE_COMPRESS, compr->card, 644 + compr->device, &snd_compr_file_ops, compr, str); 645 + if (ret < 0) { 646 + pr_err("snd_register_device failed\n %d", ret); 647 + return ret; 648 + } 649 + return ret; 650 + 651 + } 652 + 653 + static int snd_compress_dev_disconnect(struct snd_device *device) 654 + { 655 + struct snd_compr *compr; 656 + 657 + compr = device->device_data; 658 + snd_unregister_device(compr->direction, compr->card, compr->device); 659 + return 0; 660 + } 661 + 662 + /* 663 + * snd_compress_new: create new compress device 664 + * @card: sound card pointer 665 + * @device: device number 666 + * @dirn: device direction, should be of type enum snd_compr_direction 667 + * @compr: compress device pointer 668 + */ 669 + int snd_compress_new(struct snd_card *card, int device, 670 + int dirn, struct snd_compr *compr) 671 + { 672 + static struct snd_device_ops ops = { 673 + .dev_free = NULL, 674 + .dev_register = snd_compress_dev_register, 675 + .dev_disconnect = snd_compress_dev_disconnect, 676 + }; 677 + 678 + compr->card = card; 679 + compr->device = device; 680 + compr->direction = dirn; 681 + return snd_device_new(card, SNDRV_DEV_COMPRESS, compr, &ops); 682 + } 683 + EXPORT_SYMBOL_GPL(snd_compress_new); 684 + 685 + static int snd_compress_add_device(struct snd_compr *device) 686 + { 687 + int ret; 688 + 689 + if (!device->card) 690 + return -EINVAL; 691 + 692 + /* register the card */ 693 + ret = snd_card_register(device->card); 694 + if (ret) 695 + goto out; 696 + return 0; 697 + 698 + out: 699 + pr_err("failed with %d\n", ret); 700 + return ret; 701 + 702 + } 703 + 704 + static int snd_compress_remove_device(struct snd_compr *device) 705 + { 706 + return snd_card_free(device->card); 707 + } 708 + 709 + /** 710 + * snd_compress_register - register compressed device 711 + * 712 + * @device: compressed device to register 713 + */ 714 + int snd_compress_register(struct snd_compr *device) 715 + { 716 + int retval; 717 + 718 + if (device->name == NULL || device->dev == NULL || device->ops == NULL) 719 + return -EINVAL; 720 + 721 + pr_debug("Registering compressed device %s\n", device->name); 722 + if (snd_BUG_ON(!device->ops->open)) 723 + return -EINVAL; 724 + if (snd_BUG_ON(!device->ops->free)) 725 + return -EINVAL; 726 + if (snd_BUG_ON(!device->ops->set_params)) 727 + return -EINVAL; 728 + if (snd_BUG_ON(!device->ops->trigger)) 729 + return -EINVAL; 730 + 731 + mutex_init(&device->lock); 732 + 733 + /* register a compressed card */ 734 + mutex_lock(&device_mutex); 735 + retval = snd_compress_add_device(device); 736 + mutex_unlock(&device_mutex); 737 + return retval; 738 + } 739 + EXPORT_SYMBOL_GPL(snd_compress_register); 740 + 741 + int snd_compress_deregister(struct snd_compr *device) 742 + { 743 + pr_debug("Removing compressed device %s\n", device->name); 744 + mutex_lock(&device_mutex); 745 + snd_compress_remove_device(device); 746 + mutex_unlock(&device_mutex); 747 + return 0; 748 + } 749 + EXPORT_SYMBOL_GPL(snd_compress_deregister); 750 + 751 + static int __init snd_compress_init(void) 752 + { 753 + return 0; 754 + } 755 + 756 + static void __exit snd_compress_exit(void) 757 + { 758 + } 759 + 760 + module_init(snd_compress_init); 761 + module_exit(snd_compress_exit); 762 + 763 + MODULE_DESCRIPTION("ALSA Compressed offload framework"); 764 + MODULE_AUTHOR("Vinod Koul <vinod.koul@linux.intel.com>"); 765 + MODULE_LICENSE("GPL v2");
+1 -1
sound/core/oss/pcm_oss.c
··· 47 47 48 48 static int dsp_map[SNDRV_CARDS]; 49 49 static int adsp_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 1}; 50 - static int nonblock_open = 1; 50 + static bool nonblock_open = 1; 51 51 52 52 MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Abramo Bagnara <abramo@alsa-project.org>"); 53 53 MODULE_DESCRIPTION("PCM OSS emulation for ALSA.");
+1 -1
sound/core/seq/seq_dummy.c
··· 65 65 MODULE_ALIAS("snd-seq-client-" __stringify(SNDRV_SEQ_CLIENT_DUMMY)); 66 66 67 67 static int ports = 1; 68 - static int duplex; 68 + static bool duplex; 69 69 70 70 module_param(ports, int, 0444); 71 71 MODULE_PARM_DESC(ports, "number of ports to be created");
+1
sound/core/sound.c
··· 229 229 case SNDRV_DEVICE_TYPE_RAWMIDI: 230 230 case SNDRV_DEVICE_TYPE_PCM_PLAYBACK: 231 231 case SNDRV_DEVICE_TYPE_PCM_CAPTURE: 232 + case SNDRV_DEVICE_TYPE_COMPRESS: 232 233 if (snd_BUG_ON(!card)) 233 234 return -EINVAL; 234 235 minor = SNDRV_MINOR(card->number, type + dev);
+1 -1
sound/drivers/aloop.c
··· 51 51 52 52 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 53 53 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 54 - static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; 54 + static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; 55 55 static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8}; 56 56 static int pcm_notify[SNDRV_CARDS]; 57 57
+3 -3
sound/drivers/dummy.c
··· 60 60 61 61 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 62 62 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 63 - static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; 63 + static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; 64 64 static char *model[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = NULL}; 65 65 static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 66 66 static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8}; 67 67 //static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 68 68 #ifdef CONFIG_HIGH_RES_TIMERS 69 - static int hrtimer = 1; 69 + static bool hrtimer = 1; 70 70 #endif 71 - static int fake_buffer = 1; 71 + static bool fake_buffer = 1; 72 72 73 73 module_param_array(index, int, NULL, 0444); 74 74 MODULE_PARM_DESC(index, "Index value for dummy soundcard.");
+2 -13
sound/drivers/ml403-ac97cr.c
··· 73 73 74 74 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 75 75 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 76 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 76 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 77 77 78 78 module_param_array(index, int, NULL, 0444); 79 79 MODULE_PARM_DESC(index, "Index value for ML403 AC97 Controller Reference."); ··· 1341 1341 }, 1342 1342 }; 1343 1343 1344 - static int __init alsa_card_ml403_ac97cr_init(void) 1345 - { 1346 - return platform_driver_register(&snd_ml403_ac97cr_driver); 1347 - } 1348 - 1349 - static void __exit alsa_card_ml403_ac97cr_exit(void) 1350 - { 1351 - platform_driver_unregister(&snd_ml403_ac97cr_driver); 1352 - } 1353 - 1354 - module_init(alsa_card_ml403_ac97cr_init) 1355 - module_exit(alsa_card_ml403_ac97cr_exit) 1344 + module_platform_driver(snd_ml403_ac97cr_driver);
+3 -3
sound/drivers/mpu401/mpu401.c
··· 35 35 36 36 static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* exclude the first card */ 37 37 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 38 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 38 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 39 39 #ifdef CONFIG_PNP 40 - static int pnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 40 + static bool pnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 41 41 #endif 42 42 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* MPU-401 port number */ 43 43 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* MPU-401 IRQ */ 44 - static int uart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 44 + static bool uart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 45 45 46 46 module_param_array(index, int, NULL, 0444); 47 47 MODULE_PARM_DESC(index, "Index value for MPU-401 device.");
+1 -1
sound/drivers/mts64.c
··· 36 36 37 37 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 38 38 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 39 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 39 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 40 40 41 41 static struct platform_device *platform_devices[SNDRV_CARDS]; 42 42 static int device_count;
+1 -1
sound/drivers/opl3/opl3_midi.c
··· 27 27 28 28 extern char snd_opl3_regmap[MAX_OPL2_VOICES][4]; 29 29 30 - extern int use_internal_drums; 30 + extern bool use_internal_drums; 31 31 32 32 static void snd_opl3_note_off_unsafe(void *p, int note, int vel, 33 33 struct snd_midi_channel *chan);
+1 -1
sound/drivers/opl3/opl3_seq.c
··· 32 32 MODULE_LICENSE("GPL"); 33 33 MODULE_DESCRIPTION("ALSA driver for OPL3 FM synth"); 34 34 35 - int use_internal_drums = 0; 35 + bool use_internal_drums = 0; 36 36 module_param(use_internal_drums, bool, 0444); 37 37 MODULE_PARM_DESC(use_internal_drums, "Enable internal OPL2/3 drums."); 38 38
+2 -2
sound/drivers/pcsp/pcsp.c
··· 25 25 26 26 static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 27 27 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 28 - static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ 29 - static int nopcm; /* Disable PCM capability of the driver */ 28 + static bool enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ 29 + static bool nopcm; /* Disable PCM capability of the driver */ 30 30 31 31 module_param(index, int, 0444); 32 32 MODULE_PARM_DESC(index, "Index value for pcsp soundcard.");
+1 -1
sound/drivers/pcsp/pcsp_lib.c
··· 14 14 #include <asm/io.h> 15 15 #include "pcsp.h" 16 16 17 - static int nforce_wa; 17 + static bool nforce_wa; 18 18 module_param(nforce_wa, bool, 0444); 19 19 MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround " 20 20 "(expect bad sound)");
+1 -1
sound/drivers/portman2x4.c
··· 55 55 56 56 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 57 57 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 58 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 58 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 59 59 60 60 static struct platform_device *platform_devices[SNDRV_CARDS]; 61 61 static int device_count;
+2 -2
sound/drivers/serial-u16550.c
··· 69 69 70 70 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 71 71 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 72 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 72 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 73 73 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x3f8,0x2f8,0x3e8,0x2e8 */ 74 74 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,4,5,7,9,10,11,14,15 */ 75 75 static int speed[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 38400}; /* 9600,19200,38400,57600,115200 */ ··· 77 77 static int outs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */ 78 78 static int ins[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */ 79 79 static int adaptor[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = SNDRV_SERIAL_SOUNDCANVAS}; 80 - static int droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF }; 80 + static bool droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF }; 81 81 82 82 module_param_array(index, int, NULL, 0444); 83 83 MODULE_PARM_DESC(index, "Index value for Serial MIDI.");
+1 -1
sound/drivers/virmidi.c
··· 63 63 64 64 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 65 65 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 66 - static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; 66 + static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; 67 67 static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4}; 68 68 69 69 module_param_array(index, int, NULL, 0444);
+1 -1
sound/isa/ad1816a/ad1816a.c
··· 44 44 45 45 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ 46 46 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 47 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 47 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 48 48 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 49 49 static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 50 50 static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
+2 -2
sound/isa/ad1848/ad1848.c
··· 43 43 44 44 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 45 45 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 46 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 46 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 47 47 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 48 48 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ 49 49 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 50 - static int thinkpad[SNDRV_CARDS]; /* Thinkpad special case */ 50 + static bool thinkpad[SNDRV_CARDS]; /* Thinkpad special case */ 51 51 52 52 module_param_array(index, int, NULL, 0444); 53 53 MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard.");
+1 -1
sound/isa/adlib.c
··· 18 18 19 19 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 20 20 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 21 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 21 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 22 22 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 23 23 24 24 module_param_array(index, int, NULL, 0444);
+1 -1
sound/isa/als100.c
··· 54 54 55 55 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 56 56 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 57 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 57 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 58 58 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 59 59 static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 60 60 static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
+1 -1
sound/isa/azt2320.c
··· 55 55 56 56 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 57 57 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 58 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 58 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 59 59 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 60 60 static long wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 61 61 static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
+2 -2
sound/isa/cmi8330.c
··· 69 69 70 70 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 71 71 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 72 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 72 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 73 73 #ifdef CONFIG_PNP 74 - static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 74 + static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 75 75 #endif 76 76 static long sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 77 77 static int sbirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
+1 -1
sound/isa/cs423x/cs4231.c
··· 41 41 42 42 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 43 43 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 44 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 44 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 45 45 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 46 46 static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 47 47 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */
+2 -2
sound/isa/cs423x/cs4236.c
··· 74 74 75 75 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 76 76 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 77 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 77 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 78 78 #ifdef CONFIG_PNP 79 - static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 79 + static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 80 80 #endif 81 81 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 82 82 static long cport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
+2 -2
sound/isa/es1688/es1688.c
··· 51 51 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 52 52 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 53 53 #ifdef CONFIG_PNP 54 - static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 54 + static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 55 55 #endif 56 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 56 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 57 57 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 58 58 static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* Usually 0x388 */ 59 59 static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
+2 -2
sound/isa/es18xx.c
··· 1964 1964 1965 1965 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 1966 1966 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 1967 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 1967 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 1968 1968 #ifdef CONFIG_PNP 1969 - static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 1969 + static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 1970 1970 #endif 1971 1971 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ 1972 1972 #ifndef CONFIG_PNP
+1 -1
sound/isa/galaxy/galaxy.c
··· 35 35 36 36 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 37 37 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 38 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 38 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 39 39 40 40 module_param_array(index, int, NULL, 0444); 41 41 MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard.");
+1 -1
sound/isa/gus/gusclassic.c
··· 42 42 43 43 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 44 44 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 45 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 45 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 46 46 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x230,0x240,0x250,0x260 */ 47 47 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,5,9,11,12,15 */ 48 48 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3,5,6,7 */
+1 -1
sound/isa/gus/gusextreme.c
··· 46 46 47 47 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 48 48 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 49 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 49 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 50 50 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 51 51 static long gf1_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x210,0x220,0x230,0x240,0x250,0x260,0x270 */ 52 52 static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x300,0x310,0x320 */
+1 -1
sound/isa/gus/gusmax.c
··· 40 40 41 41 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 42 42 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 43 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 43 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 44 44 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x230,0x240,0x250,0x260 */ 45 45 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 2,3,5,9,11,12,15 */ 46 46 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3,5,6,7 */
+2 -2
sound/isa/gus/interwave.c
··· 55 55 56 56 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 57 57 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 58 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 58 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 59 59 #ifdef CONFIG_PNP 60 - static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 60 + static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 61 61 #endif 62 62 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x210,0x220,0x230,0x240,0x250,0x260 */ 63 63 #ifdef SNDRV_STB
+1 -1
sound/isa/msnd/msnd_pinnacle.c
··· 785 785 static int calibrate_signal; 786 786 787 787 #ifdef CONFIG_PNP 788 - static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 788 + static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 789 789 module_param_array(isapnp, bool, NULL, 0444); 790 790 MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard."); 791 791 #define has_isapnp(x) isapnp[x]
+2 -2
sound/isa/opl3sa2.c
··· 46 46 47 47 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 48 48 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 49 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 49 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 50 50 #ifdef CONFIG_PNP 51 - static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 51 + static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 52 52 #endif 53 53 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0xf86,0x370,0x100 */ 54 54 static long sb_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */
+1 -1
sound/isa/opti9xx/miro.c
··· 61 61 static int wss; 62 62 static int ide; 63 63 #ifdef CONFIG_PNP 64 - static int isapnp = 1; /* Enable ISA PnP detection */ 64 + static bool isapnp = 1; /* Enable ISA PnP detection */ 65 65 #endif 66 66 67 67 module_param(index, int, 0444);
+1 -1
sound/isa/opti9xx/opti92x-ad1848.c
··· 63 63 64 64 static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 65 65 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 66 - //static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ 66 + //static bool enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ 67 67 #ifdef CONFIG_PNP 68 68 static int isapnp = 1; /* Enable ISA PnP detection */ 69 69 #endif
+1 -1
sound/isa/sb/jazz16.c
··· 36 36 37 37 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 38 38 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 39 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 39 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 40 40 static unsigned long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 41 41 static unsigned long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 42 42 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
+2 -2
sound/isa/sb/sb16.c
··· 68 68 69 69 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 70 70 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 71 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 71 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 72 72 #ifdef CONFIG_PNP 73 - static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 73 + static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 74 74 #endif 75 75 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ 76 76 static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x330,0x300 */
+1 -1
sound/isa/sb/sb8.c
··· 36 36 37 37 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 38 38 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 39 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 39 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 40 40 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 41 41 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */ 42 42 static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3 */
+1 -1
sound/isa/sc6000.c
··· 48 48 49 49 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 50 50 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 51 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 51 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 52 52 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220, 0x240 */ 53 53 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5, 7, 9, 10, 11 */ 54 54 static long mss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x530, 0xe80 */
+3 -3
sound/isa/wavefront/wavefront.c
··· 38 38 39 39 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 40 40 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 41 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 41 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 42 42 #ifdef CONFIG_PNP 43 - static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 43 + static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 44 44 #endif 45 45 static long cs4232_pcm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 46 46 static int cs4232_pcm_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ ··· 51 51 static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 52 52 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 53 53 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 54 - static int use_cs4232_midi[SNDRV_CARDS]; 54 + static bool use_cs4232_midi[SNDRV_CARDS]; 55 55 56 56 module_param_array(index, int, NULL, 0444); 57 57 MODULE_PARM_DESC(index, "Index value for WaveFront soundcard.");
+1 -12
sound/mips/hal2.c
··· 935 935 } 936 936 }; 937 937 938 - static int __init alsa_card_hal2_init(void) 939 - { 940 - return platform_driver_register(&hal2_driver); 941 - } 942 - 943 - static void __exit alsa_card_hal2_exit(void) 944 - { 945 - platform_driver_unregister(&hal2_driver); 946 - } 947 - 948 - module_init(alsa_card_hal2_init); 949 - module_exit(alsa_card_hal2_exit); 938 + module_platform_driver(hal2_driver);
+1 -12
sound/mips/sgio2audio.c
··· 976 976 } 977 977 }; 978 978 979 - static int __init alsa_card_sgio2audio_init(void) 980 - { 981 - return platform_driver_register(&sgio2audio_driver); 982 - } 983 - 984 - static void __exit alsa_card_sgio2audio_exit(void) 985 - { 986 - platform_driver_unregister(&sgio2audio_driver); 987 - } 988 - 989 - module_init(alsa_card_sgio2audio_init) 990 - module_exit(alsa_card_sgio2audio_exit) 979 + module_platform_driver(sgio2audio_driver);
+4 -4
sound/oss/ad1848.c
··· 119 119 static struct address_info cfg; 120 120 static int nr_ad1848_devs; 121 121 122 - static int deskpro_xl; 123 - static int deskpro_m; 124 - static int soundpro; 122 + static bool deskpro_xl; 123 + static bool deskpro_m; 124 + static bool soundpro; 125 125 126 126 static volatile signed char irq2dev[17] = { 127 127 -1, -1, -1, -1, -1, -1, -1, -1, ··· 177 177 #ifdef CONFIG_PNP 178 178 static int isapnp = 1; 179 179 static int isapnpjump; 180 - static int reverse; 180 + static bool reverse; 181 181 182 182 static int audio_activated; 183 183 #else
+1 -1
sound/oss/msnd_pinnacle.c
··· 1701 1701 #ifndef CONFIG_MSNDPIN_DIGITAL 1702 1702 # define CONFIG_MSNDPIN_DIGITAL 0 1703 1703 #endif 1704 - static int digital __initdata = CONFIG_MSNDPIN_DIGITAL; 1704 + static bool digital __initdata = CONFIG_MSNDPIN_DIGITAL; 1705 1705 1706 1706 #endif /* MSND_CLASSIC */ 1707 1707
+6 -6
sound/oss/pas2_card.c
··· 41 41 static int pas_sb_base; 42 42 DEFINE_SPINLOCK(pas_lock); 43 43 #ifndef CONFIG_PAS_JOYSTICK 44 - static int joystick; 44 + static bool joystick; 45 45 #else 46 - static int joystick = 1; 46 + static bool joystick = 1; 47 47 #endif 48 48 #ifdef SYMPHONY_PAS 49 - static int symphony = 1; 49 + static bool symphony = 1; 50 50 #else 51 - static int symphony; 51 + static bool symphony; 52 52 #endif 53 53 #ifdef BROKEN_BUS_CLOCK 54 - static int broken_bus_clock = 1; 54 + static bool broken_bus_clock = 1; 55 55 #else 56 - static int broken_bus_clock; 56 + static bool broken_bus_clock; 57 57 #endif 58 58 59 59 static struct address_info cfg;
+5 -5
sound/oss/pss.c
··· 117 117 118 118 /* If compiled into kernel, it enable or disable pss mixer */ 119 119 #ifdef CONFIG_PSS_MIXER 120 - static int pss_mixer = 1; 120 + static bool pss_mixer = 1; 121 121 #else 122 - static int pss_mixer; 122 + static bool pss_mixer; 123 123 #endif 124 124 125 125 ··· 147 147 static int pss_initialized; 148 148 static int nonstandard_microcode; 149 149 static int pss_cdrom_port = -1; /* Parameter for the PSS cdrom port */ 150 - static int pss_enable_joystick; /* Parameter for enabling the joystick */ 150 + static bool pss_enable_joystick; /* Parameter for enabling the joystick */ 151 151 static coproc_operations pss_coproc_operations; 152 152 153 153 static void pss_write(pss_confdata *devc, int data) ··· 1133 1133 static int mss_dma __initdata = -1; 1134 1134 static int mpu_io __initdata = -1; 1135 1135 static int mpu_irq __initdata = -1; 1136 - static int pss_no_sound = 0; /* Just configure non-sound components */ 1137 - static int pss_keep_settings = 1; /* Keep hardware settings at module exit */ 1136 + static bool pss_no_sound = 0; /* Just configure non-sound components */ 1137 + static bool pss_keep_settings = 1; /* Keep hardware settings at module exit */ 1138 1138 static char *pss_firmware = "/etc/sound/pss_synth"; 1139 1139 1140 1140 module_param(pss_io, int, 0);
+1 -1
sound/oss/trix.c
··· 31 31 32 32 static int mpu; 33 33 34 - static int joystick; 34 + static bool joystick; 35 35 36 36 static unsigned char trix_read(int addr) 37 37 {
+1 -1
sound/pci/ac97/ac97_codec.c
··· 42 42 MODULE_DESCRIPTION("Universal interface for Audio Codec '97"); 43 43 MODULE_LICENSE("GPL"); 44 44 45 - static int enable_loopback; 45 + static bool enable_loopback; 46 46 47 47 module_param(enable_loopback, bool, 0444); 48 48 MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control");
+1 -1
sound/pci/ad1889.c
··· 66 66 module_param_array(id, charp, NULL, 0444); 67 67 MODULE_PARM_DESC(id, "ID string for the AD1889 soundcard."); 68 68 69 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 69 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 70 70 module_param_array(enable, bool, NULL, 0444); 71 71 MODULE_PARM_DESC(enable, "Enable AD1889 soundcard."); 72 72
+2 -2
sound/pci/ali5451/ali5451.c
··· 48 48 static int index = SNDRV_DEFAULT_IDX1; /* Index */ 49 49 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 50 50 static int pcm_channels = 32; 51 - static int spdif; 51 + static bool spdif; 52 52 53 53 module_param(index, int, 0444); 54 54 MODULE_PARM_DESC(index, "Index value for ALI M5451 PCI Audio."); ··· 60 60 MODULE_PARM_DESC(spdif, "Support SPDIF I/O"); 61 61 62 62 /* just for backward compatibility */ 63 - static int enable; 63 + static bool enable; 64 64 module_param(enable, bool, 0444); 65 65 66 66
+8 -1
sound/pci/als300.c
··· 115 115 116 116 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 117 117 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 118 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 118 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 119 + 120 + module_param_array(index, int, NULL, 0444); 121 + MODULE_PARM_DESC(index, "Index value for ALS300 sound card."); 122 + module_param_array(id, charp, NULL, 0444); 123 + MODULE_PARM_DESC(id, "ID string for ALS300 sound card."); 124 + module_param_array(enable, bool, NULL, 0444); 125 + MODULE_PARM_DESC(enable, "Enable ALS300 sound card."); 119 126 120 127 struct snd_als300 { 121 128 unsigned long port;
+1 -1
sound/pci/als4000.c
··· 90 90 91 91 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 92 92 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 93 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 93 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 94 94 #ifdef SUPPORT_JOYSTICK 95 95 static int joystick_port[SNDRV_CARDS]; 96 96 #endif
+151 -141
sound/pci/asihpi/asihpi.c
··· 23 23 */ 24 24 25 25 #include "hpi_internal.h" 26 + #include "hpi_version.h" 26 27 #include "hpimsginit.h" 27 28 #include "hpioctl.h" 29 + #include "hpicmn.h" 30 + 28 31 29 32 #include <linux/pci.h> 30 33 #include <linux/init.h> ··· 47 44 48 45 MODULE_LICENSE("GPL"); 49 46 MODULE_AUTHOR("AudioScience inc. <support@audioscience.com>"); 50 - MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx"); 47 + MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx " 48 + HPI_VER_STRING); 51 49 52 50 #if defined CONFIG_SND_DEBUG_VERBOSE 53 51 /** ··· 67 63 68 64 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* index 0-MAX */ 69 65 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 70 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 71 - static int enable_hpi_hwdep = 1; 66 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 67 + static bool enable_hpi_hwdep = 1; 72 68 73 69 module_param_array(index, int, NULL, S_IRUGO); 74 70 MODULE_PARM_DESC(index, "ALSA index value for AudioScience soundcard."); ··· 123 119 struct snd_card_asihpi { 124 120 struct snd_card *card; 125 121 struct pci_dev *pci; 126 - u16 adapter_index; 127 - u32 serial_number; 128 - u16 type; 129 - u16 version; 130 - u16 num_outstreams; 131 - u16 num_instreams; 122 + struct hpi_adapter *hpi; 132 123 133 124 u32 h_mixer; 134 125 struct clk_cache cc; ··· 134 135 u16 update_interval_frames; 135 136 u16 in_max_chans; 136 137 u16 out_max_chans; 138 + u16 in_min_chans; 139 + u16 out_min_chans; 137 140 }; 138 141 139 142 /* Per stream data */ ··· 496 495 497 496 snd_printdd("stream_host_buffer_attach status 0x%x\n", 498 497 dpcm->hpi_buffer_attached); 498 + 499 499 } 500 500 bytes_per_sec = params_rate(params) * params_channels(params); 501 501 width = snd_pcm_format_width(params_format(params)); ··· 759 757 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { 760 758 pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail; 761 759 if (state == HPI_STATE_STOPPED) { 762 - if ((bytes_avail == 0) && 763 - (on_card_bytes < ds->pcm_buf_host_rw_ofs)) { 760 + if (bytes_avail == 0) { 764 761 hpi_handle_error(hpi_stream_start(ds->h_stream)); 765 762 snd_printdd("P%d start\n", s->number); 766 763 ds->drained_count = 0; ··· 768 767 snd_printd(KERN_WARNING "P%d drained\n", 769 768 s->number); 770 769 ds->drained_count++; 771 - if (ds->drained_count > 2) { 770 + if (ds->drained_count > 20) { 772 771 snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN); 773 772 continue; 774 773 } ··· 889 888 pd, xfer2)); 890 889 } 891 890 } 892 - ds->pcm_buf_host_rw_ofs = ds->pcm_buf_host_rw_ofs + xfercount; 893 - ds->pcm_buf_elapsed_dma_ofs = pcm_buf_dma_ofs; 891 + ds->pcm_buf_host_rw_ofs += xfercount; 892 + ds->pcm_buf_elapsed_dma_ofs += xfercount; 894 893 snd_pcm_period_elapsed(s); 895 894 } 896 895 } ··· 903 902 static int snd_card_asihpi_playback_ioctl(struct snd_pcm_substream *substream, 904 903 unsigned int cmd, void *arg) 905 904 { 906 - snd_printddd(KERN_INFO "P%d ioctl %d\n", substream->number, cmd); 905 + char name[16]; 906 + snd_pcm_debug_name(substream, name, sizeof(name)); 907 + snd_printddd(KERN_INFO "%s ioctl %d\n", name, cmd); 907 908 return snd_pcm_lib_ioctl(substream, cmd, arg); 908 909 } 909 910 ··· 930 927 struct snd_pcm_runtime *runtime = substream->runtime; 931 928 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; 932 929 snd_pcm_uframes_t ptr; 930 + char name[16]; 931 + snd_pcm_debug_name(substream, name, sizeof(name)); 933 932 934 933 ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); 935 - snd_printddd("P%d pointer = 0x%04lx\n", substream->number, (unsigned long)ptr); 934 + snd_printddd("%s pointer = 0x%04lx\n", name, (unsigned long)ptr); 936 935 return ptr; 937 936 } 938 937 939 - static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, 940 - u32 h_stream, 941 - struct snd_pcm_hardware *pcmhw) 938 + static u64 snd_card_asihpi_playback_formats(struct snd_card_asihpi *asihpi, 939 + u32 h_stream) 942 940 { 943 941 struct hpi_format hpi_format; 944 942 u16 format; 945 943 u16 err; 946 944 u32 h_control; 947 945 u32 sample_rate = 48000; 946 + u64 formats = 0; 948 947 949 948 /* on cards without SRC, must query at valid rate, 950 949 * maybe set by external sync ··· 961 956 962 957 for (format = HPI_FORMAT_PCM8_UNSIGNED; 963 958 format <= HPI_FORMAT_PCM24_SIGNED; format++) { 964 - err = hpi_format_create(&hpi_format, 965 - 2, format, sample_rate, 128000, 0); 959 + err = hpi_format_create(&hpi_format, asihpi->out_max_chans, 960 + format, sample_rate, 128000, 0); 966 961 if (!err) 967 - err = hpi_outstream_query_format(h_stream, 968 - &hpi_format); 962 + err = hpi_outstream_query_format(h_stream, &hpi_format); 969 963 if (!err && (hpi_to_alsa_formats[format] != -1)) 970 - pcmhw->formats |= 971 - (1ULL << hpi_to_alsa_formats[format]); 964 + formats |= (1ULL << hpi_to_alsa_formats[format]); 972 965 } 966 + return formats; 973 967 } 974 - 975 - static struct snd_pcm_hardware snd_card_asihpi_playback = { 976 - .channels_min = 1, 977 - .channels_max = 2, 978 - .buffer_bytes_max = BUFFER_BYTES_MAX, 979 - .period_bytes_min = PERIOD_BYTES_MIN, 980 - .period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN, 981 - .periods_min = PERIODS_MIN, 982 - .periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN, 983 - .fifo_size = 0, 984 - }; 985 968 986 969 static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) 987 970 { 988 971 struct snd_pcm_runtime *runtime = substream->runtime; 989 972 struct snd_card_asihpi_pcm *dpcm; 990 973 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); 974 + struct snd_pcm_hardware snd_card_asihpi_playback; 991 975 int err; 992 976 993 977 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); 994 978 if (dpcm == NULL) 995 979 return -ENOMEM; 996 980 997 - err = 998 - hpi_outstream_open(card->adapter_index, 981 + err = hpi_outstream_open(card->hpi->adapter->index, 999 982 substream->number, &dpcm->h_stream); 1000 983 hpi_handle_error(err); 1001 984 if (err) ··· 1005 1012 runtime->private_data = dpcm; 1006 1013 runtime->private_free = snd_card_asihpi_runtime_free; 1007 1014 1008 - snd_card_asihpi_playback.channels_max = card->out_max_chans; 1015 + memset(&snd_card_asihpi_playback, 0, sizeof(snd_card_asihpi_playback)); 1016 + snd_card_asihpi_playback.buffer_bytes_max = BUFFER_BYTES_MAX; 1017 + snd_card_asihpi_playback.period_bytes_min = PERIOD_BYTES_MIN; 1009 1018 /*?snd_card_asihpi_playback.period_bytes_min = 1010 1019 card->out_max_chans * 4096; */ 1011 - 1012 - snd_card_asihpi_playback_format(card, dpcm->h_stream, 1013 - &snd_card_asihpi_playback); 1020 + snd_card_asihpi_playback.period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN; 1021 + snd_card_asihpi_playback.periods_min = PERIODS_MIN; 1022 + snd_card_asihpi_playback.periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN; 1023 + /* snd_card_asihpi_playback.fifo_size = 0; */ 1024 + snd_card_asihpi_playback.channels_max = card->out_max_chans; 1025 + snd_card_asihpi_playback.channels_min = card->out_min_chans; 1026 + snd_card_asihpi_playback.formats = 1027 + snd_card_asihpi_playback_formats(card, dpcm->h_stream); 1014 1028 1015 1029 snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_playback); 1016 1030 ··· 1029 1029 SNDRV_PCM_INFO_MMAP | 1030 1030 SNDRV_PCM_INFO_MMAP_VALID; 1031 1031 1032 - if (card->support_grouping) 1032 + if (card->support_grouping) { 1033 1033 snd_card_asihpi_playback.info |= SNDRV_PCM_INFO_SYNC_START; 1034 + snd_pcm_set_sync(substream); 1035 + } 1034 1036 1035 1037 /* struct is copied, so can create initializer dynamically */ 1036 1038 runtime->hw = snd_card_asihpi_playback; ··· 1048 1046 1049 1047 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 1050 1048 card->update_interval_frames * 2, UINT_MAX); 1051 - 1052 - snd_pcm_set_sync(substream); 1053 1049 1054 1050 snd_printdd("playback open\n"); 1055 1051 ··· 1114 1114 1115 1115 1116 1116 1117 - static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, 1118 - u32 h_stream, 1119 - struct snd_pcm_hardware *pcmhw) 1117 + static u64 snd_card_asihpi_capture_formats(struct snd_card_asihpi *asihpi, 1118 + u32 h_stream) 1120 1119 { 1121 1120 struct hpi_format hpi_format; 1122 1121 u16 format; 1123 1122 u16 err; 1124 1123 u32 h_control; 1125 1124 u32 sample_rate = 48000; 1125 + u64 formats = 0; 1126 1126 1127 1127 /* on cards without SRC, must query at valid rate, 1128 1128 maybe set by external sync */ ··· 1137 1137 for (format = HPI_FORMAT_PCM8_UNSIGNED; 1138 1138 format <= HPI_FORMAT_PCM24_SIGNED; format++) { 1139 1139 1140 - err = hpi_format_create(&hpi_format, 2, format, 1141 - sample_rate, 128000, 0); 1140 + err = hpi_format_create(&hpi_format, asihpi->in_max_chans, 1141 + format, sample_rate, 128000, 0); 1142 1142 if (!err) 1143 - err = hpi_instream_query_format(h_stream, 1144 - &hpi_format); 1143 + err = hpi_instream_query_format(h_stream, &hpi_format); 1145 1144 if (!err) 1146 - pcmhw->formats |= 1147 - (1ULL << hpi_to_alsa_formats[format]); 1145 + formats |= (1ULL << hpi_to_alsa_formats[format]); 1148 1146 } 1147 + return formats; 1149 1148 } 1150 - 1151 - 1152 - static struct snd_pcm_hardware snd_card_asihpi_capture = { 1153 - .channels_min = 1, 1154 - .channels_max = 2, 1155 - .buffer_bytes_max = BUFFER_BYTES_MAX, 1156 - .period_bytes_min = PERIOD_BYTES_MIN, 1157 - .period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN, 1158 - .periods_min = PERIODS_MIN, 1159 - .periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN, 1160 - .fifo_size = 0, 1161 - }; 1162 1149 1163 1150 static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) 1164 1151 { 1165 1152 struct snd_pcm_runtime *runtime = substream->runtime; 1166 1153 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); 1167 1154 struct snd_card_asihpi_pcm *dpcm; 1155 + struct snd_pcm_hardware snd_card_asihpi_capture; 1168 1156 int err; 1169 1157 1170 1158 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); ··· 1160 1172 return -ENOMEM; 1161 1173 1162 1174 snd_printdd("capture open adapter %d stream %d\n", 1163 - card->adapter_index, substream->number); 1175 + card->hpi->adapter->index, substream->number); 1164 1176 1165 1177 err = hpi_handle_error( 1166 - hpi_instream_open(card->adapter_index, 1178 + hpi_instream_open(card->hpi->adapter->index, 1167 1179 substream->number, &dpcm->h_stream)); 1168 1180 if (err) 1169 1181 kfree(dpcm); ··· 1172 1184 if (err) 1173 1185 return -EIO; 1174 1186 1175 - 1176 1187 init_timer(&dpcm->timer); 1177 1188 dpcm->timer.data = (unsigned long) dpcm; 1178 1189 dpcm->timer.function = snd_card_asihpi_timer_function; ··· 1179 1192 runtime->private_data = dpcm; 1180 1193 runtime->private_free = snd_card_asihpi_runtime_free; 1181 1194 1195 + memset(&snd_card_asihpi_capture, 0, sizeof(snd_card_asihpi_capture)); 1196 + snd_card_asihpi_capture.buffer_bytes_max = BUFFER_BYTES_MAX; 1197 + snd_card_asihpi_capture.period_bytes_min = PERIOD_BYTES_MIN; 1198 + snd_card_asihpi_capture.period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN; 1199 + snd_card_asihpi_capture.periods_min = PERIODS_MIN; 1200 + snd_card_asihpi_capture.periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN; 1201 + /* snd_card_asihpi_capture.fifo_size = 0; */ 1182 1202 snd_card_asihpi_capture.channels_max = card->in_max_chans; 1183 - snd_card_asihpi_capture_format(card, dpcm->h_stream, 1184 - &snd_card_asihpi_capture); 1203 + snd_card_asihpi_capture.channels_min = card->in_min_chans; 1204 + snd_card_asihpi_capture.formats = 1205 + snd_card_asihpi_capture_formats(card, dpcm->h_stream); 1185 1206 snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_capture); 1186 1207 snd_card_asihpi_capture.info = SNDRV_PCM_INFO_INTERLEAVED | 1187 1208 SNDRV_PCM_INFO_MMAP | ··· 1235 1240 .pointer = snd_card_asihpi_capture_pointer, 1236 1241 }; 1237 1242 1238 - static int __devinit snd_card_asihpi_pcm_new(struct snd_card_asihpi *asihpi, 1239 - int device, int substreams) 1243 + static int __devinit snd_card_asihpi_pcm_new( 1244 + struct snd_card_asihpi *asihpi, int device) 1240 1245 { 1241 1246 struct snd_pcm *pcm; 1242 1247 int err; 1248 + u16 num_instreams, num_outstreams, x16; 1249 + u32 x32; 1250 + 1251 + err = hpi_adapter_get_info(asihpi->hpi->adapter->index, 1252 + &num_outstreams, &num_instreams, 1253 + &x16, &x32, &x16); 1243 1254 1244 1255 err = snd_pcm_new(asihpi->card, "Asihpi PCM", device, 1245 - asihpi->num_outstreams, asihpi->num_instreams, 1246 - &pcm); 1256 + num_outstreams, num_instreams, &pcm); 1247 1257 if (err < 0) 1248 1258 return err; 1249 1259 /* pointer to ops struct is stored, dont change ops afterwards! */ ··· 1314 1314 "Analog", 1315 1315 "Adapter", 1316 1316 "RTP", 1317 - "GPI", 1317 + "Internal" 1318 1318 }; 1319 1319 1320 1320 compile_time_assert( ··· 1332 1332 "Net", 1333 1333 "Analog", 1334 1334 "RTP", 1335 - "GPO", 1336 1335 }; 1337 1336 1338 1337 compile_time_assert( ··· 1409 1410 struct snd_ctl_elem_info *uinfo) 1410 1411 { 1411 1412 u32 h_control = kcontrol->private_value; 1413 + u32 count; 1412 1414 u16 err; 1413 1415 /* native gains are in millibels */ 1414 1416 short min_gain_mB; ··· 1424 1424 step_gain_mB = VOL_STEP_mB; 1425 1425 } 1426 1426 1427 + err = hpi_meter_query_channels(h_control, &count); 1428 + if (err) 1429 + count = HPI_MAX_CHANNELS; 1430 + 1427 1431 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1428 - uinfo->count = 2; 1432 + uinfo->count = count; 1429 1433 uinfo->value.integer.min = min_gain_mB / VOL_STEP_mB; 1430 1434 uinfo->value.integer.max = max_gain_mB / VOL_STEP_mB; 1431 1435 uinfo->value.integer.step = step_gain_mB / VOL_STEP_mB; ··· 2037 2033 static int snd_asihpi_meter_info(struct snd_kcontrol *kcontrol, 2038 2034 struct snd_ctl_elem_info *uinfo) 2039 2035 { 2036 + u32 h_control = kcontrol->private_value; 2037 + u32 count; 2038 + u16 err; 2039 + err = hpi_meter_query_channels(h_control, &count); 2040 + if (err) 2041 + count = HPI_MAX_CHANNELS; 2042 + 2040 2043 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2041 - uinfo->count = HPI_MAX_CHANNELS; 2044 + uinfo->count = count; 2042 2045 uinfo->value.integer.min = 0; 2043 2046 uinfo->value.integer.max = 0x7FFFFFFF; 2044 2047 return 0; ··· 2258 2247 mode_map[valid_modes] = mode; 2259 2248 valid_modes++; 2260 2249 } 2250 + 2251 + if (!valid_modes) 2252 + return -EINVAL; 2261 2253 2262 2254 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2263 2255 uinfo->count = 1; ··· 2561 2547 strcpy(card->mixername, "Asihpi Mixer"); 2562 2548 2563 2549 err = 2564 - hpi_mixer_open(asihpi->adapter_index, 2550 + hpi_mixer_open(asihpi->hpi->adapter->index, 2565 2551 &asihpi->h_mixer); 2566 2552 hpi_handle_error(err); 2567 2553 if (err) ··· 2679 2665 struct snd_info_buffer *buffer) 2680 2666 { 2681 2667 struct snd_card_asihpi *asihpi = entry->private_data; 2682 - u16 version; 2683 2668 u32 h_control; 2684 2669 u32 rate = 0; 2685 2670 u16 source = 0; 2671 + 2672 + u16 num_outstreams; 2673 + u16 num_instreams; 2674 + u16 version; 2675 + u32 serial_number; 2676 + u16 type; 2677 + 2686 2678 int err; 2687 2679 2688 2680 snd_iprintf(buffer, "ASIHPI driver proc file\n"); 2689 - snd_iprintf(buffer, 2690 - "adapter ID=%4X\n_index=%d\n" 2691 - "num_outstreams=%d\n_num_instreams=%d\n", 2692 - asihpi->type, asihpi->adapter_index, 2693 - asihpi->num_outstreams, asihpi->num_instreams); 2694 2681 2695 - version = asihpi->version; 2682 + hpi_handle_error(hpi_adapter_get_info(asihpi->hpi->adapter->index, 2683 + &num_outstreams, &num_instreams, 2684 + &version, &serial_number, &type)); 2685 + 2696 2686 snd_iprintf(buffer, 2697 - "serial#=%d\n_hw version %c%d\nDSP code version %03d\n", 2698 - asihpi->serial_number, ((version >> 3) & 0xf) + 'A', 2699 - version & 0x7, 2687 + "Adapter type ASI%4X\nHardware Index %d\n" 2688 + "%d outstreams\n%d instreams\n", 2689 + type, asihpi->hpi->adapter->index, 2690 + num_outstreams, num_instreams); 2691 + 2692 + snd_iprintf(buffer, 2693 + "Serial#%d\nHardware version %c%d\nDSP code version %03d\n", 2694 + serial_number, ((version >> 3) & 0xf) + 'A', version & 0x7, 2700 2695 ((version >> 13) * 100) + ((version >> 7) & 0x3f)); 2701 2696 2702 2697 err = hpi_mixer_get_control(asihpi->h_mixer, ··· 2713 2690 HPI_CONTROL_SAMPLECLOCK, &h_control); 2714 2691 2715 2692 if (!err) { 2716 - err = hpi_sample_clock_get_sample_rate( 2717 - h_control, &rate); 2693 + err = hpi_sample_clock_get_sample_rate(h_control, &rate); 2718 2694 err += hpi_sample_clock_get_source(h_control, &source); 2719 2695 2720 2696 if (!err) 2721 - snd_iprintf(buffer, "sample_clock=%d_hz, source %s\n", 2697 + snd_iprintf(buffer, "Sample Clock %dHz, source %s\n", 2722 2698 rate, sampleclock_sources[source]); 2723 2699 } 2724 - 2725 2700 } 2726 - 2727 2701 2728 2702 static void __devinit snd_asihpi_proc_init(struct snd_card_asihpi *asihpi) 2729 2703 { ··· 2793 2773 const struct pci_device_id *pci_id) 2794 2774 { 2795 2775 int err; 2796 - 2797 - u16 version; 2798 - int pcm_substreams; 2799 - 2800 - struct hpi_adapter *hpi_card; 2776 + struct hpi_adapter *hpi; 2801 2777 struct snd_card *card; 2802 2778 struct snd_card_asihpi *asihpi; 2803 2779 2804 2780 u32 h_control; 2805 2781 u32 h_stream; 2782 + u32 adapter_index; 2806 2783 2807 2784 static int dev; 2808 2785 if (dev >= SNDRV_CARDS) 2809 2786 return -ENODEV; 2810 2787 2811 - /* Should this be enable[hpi_card->index] ? */ 2788 + /* Should this be enable[hpi->index] ? */ 2812 2789 if (!enable[dev]) { 2813 2790 dev++; 2814 2791 return -ENOENT; 2815 2792 } 2816 2793 2794 + /* Initialise low-level HPI driver */ 2817 2795 err = asihpi_adapter_probe(pci_dev, pci_id); 2818 2796 if (err < 0) 2819 2797 return err; 2820 2798 2821 - hpi_card = pci_get_drvdata(pci_dev); 2799 + hpi = pci_get_drvdata(pci_dev); 2800 + adapter_index = hpi->adapter->index; 2822 2801 /* first try to give the card the same index as its hardware index */ 2823 - err = snd_card_create(hpi_card->index, 2824 - id[hpi_card->index], THIS_MODULE, 2802 + err = snd_card_create(adapter_index, 2803 + id[adapter_index], THIS_MODULE, 2825 2804 sizeof(struct snd_card_asihpi), 2826 2805 &card); 2827 2806 if (err < 0) { ··· 2834 2815 return err; 2835 2816 snd_printk(KERN_WARNING 2836 2817 "**** WARNING **** Adapter index %d->ALSA index %d\n", 2837 - hpi_card->index, card->number); 2818 + adapter_index, card->number); 2838 2819 } 2839 2820 2840 2821 snd_card_set_dev(card, &pci_dev->dev); 2841 2822 2842 - asihpi = (struct snd_card_asihpi *) card->private_data; 2823 + asihpi = card->private_data; 2843 2824 asihpi->card = card; 2844 2825 asihpi->pci = pci_dev; 2845 - asihpi->adapter_index = hpi_card->index; 2846 - hpi_handle_error(hpi_adapter_get_info( 2847 - asihpi->adapter_index, 2848 - &asihpi->num_outstreams, 2849 - &asihpi->num_instreams, 2850 - &asihpi->version, 2851 - &asihpi->serial_number, &asihpi->type)); 2826 + asihpi->hpi = hpi; 2852 2827 2853 - version = asihpi->version; 2854 - snd_printk(KERN_INFO "adapter ID=%4X index=%d num_outstreams=%d " 2855 - "num_instreams=%d S/N=%d\n" 2856 - "Hw Version %c%d DSP code version %03d\n", 2857 - asihpi->type, asihpi->adapter_index, 2858 - asihpi->num_outstreams, 2859 - asihpi->num_instreams, asihpi->serial_number, 2860 - ((version >> 3) & 0xf) + 'A', 2861 - version & 0x7, 2862 - ((version >> 13) * 100) + ((version >> 7) & 0x3f)); 2828 + snd_printk(KERN_INFO "adapter ID=%4X index=%d\n", 2829 + asihpi->hpi->adapter->type, adapter_index); 2863 2830 2864 - pcm_substreams = asihpi->num_outstreams; 2865 - if (pcm_substreams < asihpi->num_instreams) 2866 - pcm_substreams = asihpi->num_instreams; 2867 - 2868 - err = hpi_adapter_get_property(asihpi->adapter_index, 2831 + err = hpi_adapter_get_property(adapter_index, 2869 2832 HPI_ADAPTER_PROPERTY_CAPS1, 2870 2833 NULL, &asihpi->support_grouping); 2871 2834 if (err) 2872 2835 asihpi->support_grouping = 0; 2873 2836 2874 - err = hpi_adapter_get_property(asihpi->adapter_index, 2837 + err = hpi_adapter_get_property(adapter_index, 2875 2838 HPI_ADAPTER_PROPERTY_CAPS2, 2876 2839 &asihpi->support_mrx, NULL); 2877 2840 if (err) 2878 2841 asihpi->support_mrx = 0; 2879 2842 2880 - err = hpi_adapter_get_property(asihpi->adapter_index, 2843 + err = hpi_adapter_get_property(adapter_index, 2881 2844 HPI_ADAPTER_PROPERTY_INTERVAL, 2882 2845 NULL, &asihpi->update_interval_frames); 2883 2846 if (err) ··· 2868 2867 if (!asihpi->can_dma) 2869 2868 asihpi->update_interval_frames *= 2; 2870 2869 2871 - hpi_handle_error(hpi_instream_open(asihpi->adapter_index, 2870 + hpi_handle_error(hpi_instream_open(adapter_index, 2872 2871 0, &h_stream)); 2873 2872 2874 2873 err = hpi_instream_host_buffer_free(h_stream); ··· 2876 2875 2877 2876 hpi_handle_error(hpi_instream_close(h_stream)); 2878 2877 2879 - err = hpi_adapter_get_property(asihpi->adapter_index, 2878 + err = hpi_adapter_get_property(adapter_index, 2880 2879 HPI_ADAPTER_PROPERTY_CURCHANNELS, 2881 2880 &asihpi->in_max_chans, &asihpi->out_max_chans); 2882 2881 if (err) { ··· 2884 2883 asihpi->out_max_chans = 2; 2885 2884 } 2886 2885 2887 - snd_printk(KERN_INFO "has dma:%d, grouping:%d, mrx:%d\n", 2886 + if (asihpi->out_max_chans > 2) { /* assume LL mode */ 2887 + asihpi->out_min_chans = asihpi->out_max_chans; 2888 + asihpi->in_min_chans = asihpi->in_max_chans; 2889 + asihpi->support_grouping = 0; 2890 + } else { 2891 + asihpi->out_min_chans = 1; 2892 + asihpi->in_min_chans = 1; 2893 + } 2894 + 2895 + snd_printk(KERN_INFO "Has dma:%d, grouping:%d, mrx:%d\n", 2888 2896 asihpi->can_dma, 2889 2897 asihpi->support_grouping, 2890 2898 asihpi->support_mrx 2891 2899 ); 2892 2900 2893 - err = snd_card_asihpi_pcm_new(asihpi, 0, pcm_substreams); 2901 + err = snd_card_asihpi_pcm_new(asihpi, 0); 2894 2902 if (err < 0) { 2895 2903 snd_printk(KERN_ERR "pcm_new failed\n"); 2896 2904 goto __nodev; ··· 2926 2916 2927 2917 strcpy(card->driver, "ASIHPI"); 2928 2918 2929 - sprintf(card->shortname, "AudioScience ASI%4X", asihpi->type); 2919 + sprintf(card->shortname, "AudioScience ASI%4X", 2920 + asihpi->hpi->adapter->type); 2930 2921 sprintf(card->longname, "%s %i", 2931 - card->shortname, asihpi->adapter_index); 2922 + card->shortname, adapter_index); 2932 2923 err = snd_card_register(card); 2933 2924 2934 2925 if (!err) { 2935 - hpi_card->snd_card_asihpi = card; 2926 + hpi->snd_card = card; 2936 2927 dev++; 2937 2928 return 0; 2938 2929 } ··· 2946 2935 2947 2936 static void __devexit snd_asihpi_remove(struct pci_dev *pci_dev) 2948 2937 { 2949 - struct hpi_adapter *hpi_card = pci_get_drvdata(pci_dev); 2950 - 2951 - snd_card_free(hpi_card->snd_card_asihpi); 2952 - hpi_card->snd_card_asihpi = NULL; 2938 + struct hpi_adapter *hpi = pci_get_drvdata(pci_dev); 2939 + snd_card_free(hpi->snd_card); 2940 + hpi->snd_card = NULL; 2953 2941 asihpi_adapter_remove(pci_dev); 2954 2942 } 2955 2943
+39 -35
sound/pci/asihpi/hpi.h
··· 30 30 31 31 #ifndef _HPI_H_ 32 32 #define _HPI_H_ 33 - /* HPI Version 34 - If HPI_VER_MINOR is odd then its a development release not intended for the 35 - public. If HPI_VER_MINOR is even then is a release version 36 - i.e 3.05.02 is a development version 37 - */ 38 - #define HPI_VERSION_CONSTRUCTOR(maj, min, rel) \ 39 - ((maj << 16) + (min << 8) + rel) 40 - 41 - #define HPI_VER_MAJOR(v) ((int)(v >> 16)) 42 - #define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF)) 43 - #define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) 44 - 45 - #define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 8, 0) 46 - #define HPI_VER_STRING "4.08.00" 47 - 48 - /* Library version as documented in hpi-api-versions.txt */ 49 - #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(10, 0, 0) 50 33 51 34 #include <linux/types.h> 52 - #define HPI_BUILD_EXCLUDE_DEPRECATED 53 35 #define HPI_BUILD_KERNEL_MODE 54 36 55 37 /******************************************************************************/ ··· 195 213 /** RTP stream input node - This node is a destination for 196 214 packets of RTP audio samples from other devices. */ 197 215 HPI_SOURCENODE_RTP_DESTINATION = 112, 198 - HPI_SOURCENODE_GP_IN = 113, /**< general purpose input. */ 216 + HPI_SOURCENODE_INTERNAL = 113, /**< node internal to the device. */ 199 217 /* !!!Update this AND hpidebug.h if you add a new sourcenode type!!! */ 200 218 HPI_SOURCENODE_LAST_INDEX = 113 /**< largest ID */ 201 219 /* AX6 max sourcenode types = 15 */ ··· 224 242 /** RTP stream output node - This node is a source for 225 243 packets of RTP audio samples that are sent to other devices. */ 226 244 HPI_DESTNODE_RTP_SOURCE = 208, 227 - HPI_DESTNODE_GP_OUT = 209, /**< general purpose output node. */ 228 245 /* !!!Update this AND hpidebug.h if you add a new destnode type!!! */ 229 - HPI_DESTNODE_LAST_INDEX = 209 /**< largest ID */ 246 + HPI_DESTNODE_LAST_INDEX = 208 /**< largest ID */ 230 247 /* AX6 max destnode types = 15 */ 231 248 }; 232 249 ··· 431 450 across the host bus. Note, this does not imply that interrupts are 432 451 enabled. Instead it indicates that they can be enabled. 433 452 */ 434 - HPI_ADAPTER_PROPERTY_SUPPORTS_IRQ = 272 453 + HPI_ADAPTER_PROPERTY_SUPPORTS_IRQ = 272, 454 + /** Readonly supports firmware updating. 455 + Indicates that the adapter implements an interface to update firmware 456 + on the adapter. 457 + */ 458 + HPI_ADAPTER_PROPERTY_SUPPORTS_FW_UPDATE = 273, 459 + /** Readonly Firmware IDs 460 + Identifiy firmware independent of individual adapter type. 461 + May be used as a filter for firmware update images. 462 + Property 1 = Bootloader ID 463 + Property 2 = Main program ID 464 + */ 465 + HPI_ADAPTER_PROPERTY_FIRMWARE_ID = 274 435 466 }; 436 467 437 468 /** Adapter mode commands ··· 631 638 HPI_MIXER_STORE_ENABLE = 4, 632 639 /** Disable auto storage of some control settings. */ 633 640 HPI_MIXER_STORE_DISABLE = 5, 634 - /** Save the attributes of a single control. */ 641 + /** Unimplemented - save the attributes of a single control. */ 635 642 HPI_MIXER_STORE_SAVE_SINGLE = 6 636 643 }; 637 644 ··· 934 941 HPI_ERROR_BAD_ADAPTER_NUMBER = 202, 935 942 /** 2 adapters with the same adapter number. */ 936 943 HPI_ERROR_DUPLICATE_ADAPTER_NUMBER = 203, 937 - /** DSP code failed to bootload. (unused?) */ 944 + /** DSP code failed to bootload. Usually a DSP memory test failure. */ 938 945 HPI_ERROR_DSP_BOOTLOAD = 204, 939 946 /** Couldn't find or open the DSP code file. */ 940 947 HPI_ERROR_DSP_FILE_NOT_FOUND = 206, ··· 971 978 HPI_ERROR_FLASH_VERIFY = 225, 972 979 HPI_ERROR_FLASH_TYPE = 226, 973 980 HPI_ERROR_FLASH_START = 227, 981 + HPI_ERROR_FLASH_READ = 228, 982 + HPI_ERROR_FLASH_READ_NO_FILE = 229, 983 + HPI_ERROR_FLASH_SIZE = 230, 974 984 975 985 /** Reserved for OEMs. */ 976 986 HPI_ERROR_RESERVED_1 = 290, ··· 1016 1020 HPI_ERROR_NO_INTERDSP_GROUPS = 315, 1017 1021 /** Stream wait cancelled before threshold reached. */ 1018 1022 HPI_ERROR_WAIT_CANCELLED = 316, 1023 + /** A character string is invalid. */ 1024 + HPI_ERROR_INVALID_STRING = 317, 1019 1025 1020 1026 /** Invalid mixer node for this adapter. */ 1021 1027 HPI_ERROR_INVALID_NODE = 400, ··· 1044 1046 /** I2C */ 1045 1047 HPI_ERROR_I2C_BAD_ADR = 460, 1046 1048 1047 - /** Entity errors */ 1049 + /** Entity type did not match requested type */ 1048 1050 HPI_ERROR_ENTITY_TYPE_MISMATCH = 470, 1051 + /** Entity item count did not match requested count */ 1049 1052 HPI_ERROR_ENTITY_ITEM_COUNT = 471, 1053 + /** Entity type is not one of the valid types */ 1050 1054 HPI_ERROR_ENTITY_TYPE_INVALID = 472, 1055 + /** Entity role is not one of the valid roles */ 1051 1056 HPI_ERROR_ENTITY_ROLE_INVALID = 473, 1057 + /** Entity size doesn't match target size */ 1052 1058 HPI_ERROR_ENTITY_SIZE_MISMATCH = 474, 1053 1059 1054 1060 /* AES18 specific errors were 500..507 */ ··· 1080 1078 /** \defgroup maximums HPI maximum values 1081 1079 \{ 1082 1080 */ 1083 - /** Maximum number of adapters per HPI sub-system 1084 - WARNING: modifying this value changes the response structure size.*/ 1081 + /** Maximum number of PCI HPI adapters */ 1085 1082 #define HPI_MAX_ADAPTERS 20 1086 1083 /** Maximum number of in or out streams per adapter */ 1087 1084 #define HPI_MAX_STREAMS 16 ··· 1090 1089 /** maximum number of ancillary bytes per MPEG frame */ 1091 1090 #define HPI_MAX_ANC_BYTES_PER_FRAME (64) 1092 1091 #define HPI_STRING_LEN 16 1092 + 1093 + /** Networked adapters have index >= 100 */ 1094 + #define HPI_MIN_NETWORK_ADAPTER_IDX 100 1093 1095 1094 1096 /** Velocity units */ 1095 1097 #define HPI_OSTREAM_VELOCITY_UNITS 4096 ··· 1115 1111 struct hpi_format { 1116 1112 u32 sample_rate; 1117 1113 /**< 11025, 32000, 44100 ... */ 1118 - u32 bit_rate; /**< for MPEG */ 1114 + u32 bit_rate; /**< for MPEG */ 1119 1115 u32 attributes; 1120 1116 /**< Stereo/JointStereo/Mono */ 1121 1117 u16 mode_legacy; 1122 1118 /**< Legacy ancillary mode or idle bit */ 1123 - u16 unused; /**< Unused */ 1124 - u16 channels; /**< 1,2..., (or ancillary mode or idle bit */ 1125 - u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see #HPI_FORMATS. */ 1119 + u16 unused; /**< Unused */ 1120 + u16 channels; /**< 1,2..., (or ancillary mode or idle bit */ 1121 + u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see #HPI_FORMATS. */ 1126 1122 }; 1127 1123 1128 1124 struct hpi_anc_frame { ··· 1147 1143 } control; 1148 1144 } u; 1149 1145 }; 1150 - 1151 - /* skip host side function declarations for 1152 - DSP compile and documentation extraction */ 1153 1146 1154 1147 #ifndef DISABLE_PRAGMA_PACK1 1155 1148 #pragma pack(pop) ··· 1358 1357 u16 hpi_volume_query_range(u32 h_control, short *min_gain_01dB, 1359 1358 short *max_gain_01dB, short *step_gain_01dB); 1360 1359 1361 - u16 hpi_volume_query_channels(const u32 h_volume, u32 *p_channels); 1360 + u16 hpi_volume_query_channels(const u32 h_control, u32 *p_channels); 1362 1361 1363 1362 u16 hpi_volume_auto_fade(u32 h_control, 1364 1363 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms); ··· 1366 1365 u16 hpi_volume_auto_fade_profile(u32 h_control, 1367 1366 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms, 1368 1367 u16 profile); 1368 + 1369 + u16 hpi_volume_query_auto_fade_profile(const u32 h_control, const u32 i, 1370 + u16 *profile); 1369 1371 1370 1372 /*****************/ 1371 1373 /* Level control */
+30 -31
sound/pci/asihpi/hpi6000.c
··· 1 1 /****************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as ··· 231 231 static void control_message(struct hpi_adapter_obj *pao, 232 232 struct hpi_message *phm, struct hpi_response *phr) 233 233 { 234 + struct hpi_hw_obj *phw = pao->priv; 235 + 234 236 switch (phm->function) { 235 237 case HPI_CONTROL_GET_STATE: 236 238 if (pao->has_control_cache) { ··· 250 248 break; 251 249 } 252 250 253 - if (hpi_check_control_cache(((struct hpi_hw_obj *) 254 - pao->priv)->p_cache, phm, 255 - phr)) 251 + if (hpi_check_control_cache(phw->p_cache, phm, phr)) 256 252 break; 257 253 } 258 254 hw_message(pao, phm, phr); 259 255 break; 260 256 case HPI_CONTROL_SET_STATE: 261 257 hw_message(pao, phm, phr); 262 - hpi_cmn_control_cache_sync_to_msg(((struct hpi_hw_obj *)pao-> 263 - priv)->p_cache, phm, phr); 258 + hpi_cmn_control_cache_sync_to_msg(phw->p_cache, phm, phr); 264 259 break; 265 260 266 261 case HPI_CONTROL_GET_INFO: ··· 450 451 } 451 452 452 453 for (dsp_index = 0; dsp_index < MAX_DSPS; dsp_index++) { 453 - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 454 + struct hpi_hw_obj *phw = pao->priv; 454 455 phw->ado[dsp_index].pa_parent_adapter = pao; 455 456 } 456 457 457 - phr->u.s.adapter_type = ao.adapter_type; 458 + phr->u.s.adapter_type = ao.type; 458 459 phr->u.s.adapter_index = ao.index; 459 460 phr->error = 0; 460 461 } ··· 475 476 u32 dsp_index = 0; 476 477 u32 control_cache_size = 0; 477 478 u32 control_cache_count = 0; 478 - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 479 + struct hpi_hw_obj *phw = pao->priv; 479 480 480 481 /* The PCI2040 has the following address map */ 481 482 /* BAR0 - 4K = HPI control and status registers on PCI2040 (HPI CSR) */ ··· 558 559 if (error) 559 560 return error; 560 561 } 561 - pao->adapter_type = hr0.u.ax.info.adapter_type; 562 + pao->type = hr0.u.ax.info.adapter_type; 562 563 pao->index = hr0.u.ax.info.adapter_index; 563 564 } 564 565 ··· 583 584 pao->has_control_cache = 1; 584 585 } 585 586 586 - HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", 587 - pao->adapter_type, pao->index); 588 - pao->open = 0; /* upon creation the adapter is closed */ 587 + HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", pao->type, 588 + pao->index); 589 589 590 590 if (phw->p_cache) 591 591 phw->p_cache->adap_idx = pao->index; ··· 594 596 595 597 static void delete_adapter_obj(struct hpi_adapter_obj *pao) 596 598 { 597 - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 599 + struct hpi_hw_obj *phw = pao->priv; 598 600 599 601 if (pao->has_control_cache) 600 602 hpi_free_control_cache(phw->p_cache); ··· 637 639 static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao, 638 640 u32 *pos_error_code) 639 641 { 640 - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 642 + struct hpi_hw_obj *phw = pao->priv; 641 643 short error; 642 644 u32 timeout; 643 645 u32 read = 0; ··· 1218 1220 static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao, 1219 1221 u16 dsp_index, u32 hpi_address, u32 *source, u32 count) 1220 1222 { 1221 - struct dsp_obj *pdo = 1222 - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1223 + struct hpi_hw_obj *phw = pao->priv; 1224 + struct dsp_obj *pdo = &phw->ado[dsp_index]; 1223 1225 u32 time_out = PCI_TIMEOUT; 1224 1226 int c6711_burst_size = 128; 1225 1227 u32 local_hpi_address = hpi_address; ··· 1256 1258 static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao, 1257 1259 u16 dsp_index, u32 hpi_address, u32 *dest, u32 count) 1258 1260 { 1259 - struct dsp_obj *pdo = 1260 - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1261 + struct hpi_hw_obj *phw = pao->priv; 1262 + struct dsp_obj *pdo = &phw->ado[dsp_index]; 1261 1263 u32 time_out = PCI_TIMEOUT; 1262 1264 int c6711_burst_size = 16; 1263 1265 u32 local_hpi_address = hpi_address; ··· 1296 1298 static short hpi6000_message_response_sequence(struct hpi_adapter_obj *pao, 1297 1299 u16 dsp_index, struct hpi_message *phm, struct hpi_response *phr) 1298 1300 { 1299 - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 1301 + struct hpi_hw_obj *phw = pao->priv; 1300 1302 struct dsp_obj *pdo = &phw->ado[dsp_index]; 1301 1303 u32 timeout; 1302 1304 u16 ack; ··· 1412 1414 static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index, 1413 1415 struct hpi_message *phm, struct hpi_response *phr) 1414 1416 { 1415 - struct dsp_obj *pdo = 1416 - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1417 + struct hpi_hw_obj *phw = pao->priv; 1418 + struct dsp_obj *pdo = &phw->ado[dsp_index]; 1417 1419 u32 data_sent = 0; 1418 1420 u16 ack; 1419 1421 u32 length, address; ··· 1485 1487 static short hpi6000_get_data(struct hpi_adapter_obj *pao, u16 dsp_index, 1486 1488 struct hpi_message *phm, struct hpi_response *phr) 1487 1489 { 1488 - struct dsp_obj *pdo = 1489 - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1490 + struct hpi_hw_obj *phw = pao->priv; 1491 + struct dsp_obj *pdo = &phw->ado[dsp_index]; 1490 1492 u32 data_got = 0; 1491 1493 u16 ack; 1492 1494 u32 length, address; ··· 1549 1551 static short hpi6000_send_host_command(struct hpi_adapter_obj *pao, 1550 1552 u16 dsp_index, u32 host_cmd) 1551 1553 { 1552 - struct dsp_obj *pdo = 1553 - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1554 + struct hpi_hw_obj *phw = pao->priv; 1555 + struct dsp_obj *pdo = &phw->ado[dsp_index]; 1554 1556 u32 timeout = TIMEOUT; 1555 1557 1556 1558 /* set command */ ··· 1575 1577 { 1576 1578 u32 hPI_error; 1577 1579 1578 - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 1580 + struct hpi_hw_obj *phw = pao->priv; 1579 1581 1580 1582 /* read the error bits from the PCI2040 */ 1581 1583 hPI_error = ioread32(phw->dw2040_HPICSR + HPI_ERROR_REPORT); ··· 1595 1597 static short hpi6000_wait_dsp_ack(struct hpi_adapter_obj *pao, u16 dsp_index, 1596 1598 u32 ack_value) 1597 1599 { 1598 - struct dsp_obj *pdo = 1599 - &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1600 + struct hpi_hw_obj *phw = pao->priv; 1601 + struct dsp_obj *pdo = &phw->ado[dsp_index]; 1600 1602 u32 ack = 0L; 1601 1603 u32 timeout; 1602 1604 u32 hPIC = 0L; ··· 1638 1640 struct hpi_message *phm) 1639 1641 { 1640 1642 const u16 dsp_index = 0; 1641 - struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 1643 + struct hpi_hw_obj *phw = pao->priv; 1642 1644 struct dsp_obj *pdo = &phw->ado[dsp_index]; 1643 1645 u32 timeout; 1644 1646 u32 cache_dirty_flag; ··· 1738 1740 { 1739 1741 u16 error = 0; 1740 1742 u16 dsp_index = 0; 1741 - u16 num_dsp = ((struct hpi_hw_obj *)pao->priv)->num_dsp; 1743 + struct hpi_hw_obj *phw = pao->priv; 1744 + u16 num_dsp = phw->num_dsp; 1742 1745 1743 1746 if (num_dsp < 2) 1744 1747 dsp_index = 0;
+1 -1
sound/pci/asihpi/hpi6000.h
··· 1 1 /***************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as
+29 -28
sound/pci/asihpi/hpi6205.c
··· 1 1 /****************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as ··· 45 45 #define HPI6205_ERROR_MSG_RESP_TIMEOUT 1016 46 46 47 47 /* initialization/bootload errors */ 48 - #define HPI6205_ERROR_6205_NO_IRQ 1002 49 - #define HPI6205_ERROR_6205_INIT_FAILED 1003 50 - #define HPI6205_ERROR_6205_REG 1006 51 - #define HPI6205_ERROR_6205_DSPPAGE 1007 52 - #define HPI6205_ERROR_C6713_HPIC 1009 53 - #define HPI6205_ERROR_C6713_HPIA 1010 54 - #define HPI6205_ERROR_C6713_PLL 1011 55 - #define HPI6205_ERROR_DSP_INTMEM 1012 56 - #define HPI6205_ERROR_DSP_EXTMEM 1013 57 - #define HPI6205_ERROR_DSP_PLD 1014 58 - #define HPI6205_ERROR_6205_EEPROM 1017 59 - #define HPI6205_ERROR_DSP_EMIF 1018 48 + #define HPI6205_ERROR_6205_NO_IRQ 1002 49 + #define HPI6205_ERROR_6205_INIT_FAILED 1003 50 + #define HPI6205_ERROR_6205_REG 1006 51 + #define HPI6205_ERROR_6205_DSPPAGE 1007 52 + #define HPI6205_ERROR_C6713_HPIC 1009 53 + #define HPI6205_ERROR_C6713_HPIA 1010 54 + #define HPI6205_ERROR_C6713_PLL 1011 55 + #define HPI6205_ERROR_DSP_INTMEM 1012 56 + #define HPI6205_ERROR_DSP_EXTMEM 1013 57 + #define HPI6205_ERROR_DSP_PLD 1014 58 + #define HPI6205_ERROR_6205_EEPROM 1017 59 + #define HPI6205_ERROR_DSP_EMIF1 1018 60 + #define HPI6205_ERROR_DSP_EMIF2 1019 61 + #define HPI6205_ERROR_DSP_EMIF3 1020 62 + #define HPI6205_ERROR_DSP_EMIF4 1021 60 63 61 64 /*****************************************************************************/ 62 65 /* for C6205 PCI i/f */ ··· 491 488 return; 492 489 } 493 490 494 - phr->u.s.adapter_type = ao.adapter_type; 491 + phr->u.s.adapter_type = ao.type; 495 492 phr->u.s.adapter_index = ao.index; 496 493 phr->error = 0; 497 494 } ··· 506 503 phr->error = HPI_ERROR_INVALID_OBJ_INDEX; 507 504 return; 508 505 } 509 - phw = (struct hpi_hw_obj *)pao->priv; 506 + phw = pao->priv; 510 507 /* reset adapter h/w */ 511 508 /* Reset C6713 #1 */ 512 509 boot_loader_write_mem32(pao, 0, C6205_BAR0_TIMER1_CTL, 0); ··· 655 652 if (hr.error) 656 653 return hr.error; 657 654 658 - pao->adapter_type = hr.u.ax.info.adapter_type; 655 + pao->type = hr.u.ax.info.adapter_type; 659 656 pao->index = hr.u.ax.info.adapter_index; 660 657 661 658 max_streams = ··· 667 664 hr.u.ax.info.adapter_type, hr.u.ax.info.adapter_index, 668 665 hr.u.ax.info.serial_number); 669 666 } 670 - 671 - pao->open = 0; /* upon creation the adapter is closed */ 672 667 673 668 if (phw->p_cache) 674 669 phw->p_cache->adap_idx = pao->index; ··· 804 803 obj_index]; 805 804 status->samples_processed = 0; 806 805 status->stream_state = HPI_STATE_STOPPED; 807 - status->dSP_index = 0; 808 - status->host_index = status->dSP_index; 806 + status->dsp_index = 0; 807 + status->host_index = status->dsp_index; 809 808 status->size_in_bytes = phm->u.d.u.buffer.buffer_size; 810 809 status->auxiliary_data_available = 0; 811 810 ··· 879 878 static u32 outstream_get_space_available(struct hpi_hostbuffer_status *status) 880 879 { 881 880 return status->size_in_bytes - (status->host_index - 882 - status->dSP_index); 881 + status->dsp_index); 883 882 } 884 883 885 884 static void outstream_write(struct hpi_adapter_obj *pao, ··· 1081 1080 obj_index]; 1082 1081 status->samples_processed = 0; 1083 1082 status->stream_state = HPI_STATE_STOPPED; 1084 - status->dSP_index = 0; 1085 - status->host_index = status->dSP_index; 1083 + status->dsp_index = 0; 1084 + status->host_index = status->dsp_index; 1086 1085 status->size_in_bytes = phm->u.d.u.buffer.buffer_size; 1087 1086 status->auxiliary_data_available = 0; 1088 1087 ··· 1163 1162 1164 1163 static u32 instream_get_bytes_available(struct hpi_hostbuffer_status *status) 1165 1164 { 1166 - return status->dSP_index - status->host_index; 1165 + return status->dsp_index - status->host_index; 1167 1166 } 1168 1167 1169 1168 static void instream_read(struct hpi_adapter_obj *pao, ··· 1615 1614 boot_loader_write_mem32(pao, dsp_index, 0x01800008, setting); 1616 1615 if (setting != boot_loader_read_mem32(pao, dsp_index, 1617 1616 0x01800008)) 1618 - return HPI6205_ERROR_DSP_EMIF; 1617 + return HPI6205_ERROR_DSP_EMIF1; 1619 1618 1620 1619 /* EMIF CE1 setup - 32 bit async. This is 6713 #1 HPI, */ 1621 1620 /* which occupies D15..0. 6713 starts at 27MHz, so need */ ··· 1628 1627 boot_loader_write_mem32(pao, dsp_index, 0x01800004, setting); 1629 1628 if (setting != boot_loader_read_mem32(pao, dsp_index, 1630 1629 0x01800004)) 1631 - return HPI6205_ERROR_DSP_EMIF; 1630 + return HPI6205_ERROR_DSP_EMIF2; 1632 1631 1633 1632 /* EMIF CE2 setup - 32 bit async. This is 6713 #2 HPI, */ 1634 1633 /* which occupies D15..0. 6713 starts at 27MHz, so need */ ··· 1640 1639 boot_loader_write_mem32(pao, dsp_index, 0x01800010, setting); 1641 1640 if (setting != boot_loader_read_mem32(pao, dsp_index, 1642 1641 0x01800010)) 1643 - return HPI6205_ERROR_DSP_EMIF; 1642 + return HPI6205_ERROR_DSP_EMIF3; 1644 1643 1645 1644 /* EMIF CE3 setup - 32 bit async. */ 1646 1645 /* This is the PLD on the ASI5000 cards only */ ··· 1651 1650 boot_loader_write_mem32(pao, dsp_index, 0x01800014, setting); 1652 1651 if (setting != boot_loader_read_mem32(pao, dsp_index, 1653 1652 0x01800014)) 1654 - return HPI6205_ERROR_DSP_EMIF; 1653 + return HPI6205_ERROR_DSP_EMIF4; 1655 1654 1656 1655 /* set EMIF SDRAM control for 2Mx32 SDRAM (512x32x4 bank) */ 1657 1656 /* need to use this else DSP code crashes? */
+15 -100
sound/pci/asihpi/hpi_internal.h
··· 25 25 #define _HPI_INTERNAL_H_ 26 26 27 27 #include "hpi.h" 28 + 28 29 /** maximum number of memory regions mapped to an adapter */ 29 30 #define HPI_MAX_ADAPTER_MEM_SPACES (2) 30 31 ··· 221 220 222 221 HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1), 223 222 HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2), 224 - /*HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), */ 225 - /*HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), */ 226 223 HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5), 227 224 HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6), 228 225 HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7), ··· 240 241 HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5), 241 242 HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6), 242 243 HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7), 243 - HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8) 244 + HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8), 245 + 246 + HPI_UNIVERSAL_ENTITY = HPI_CTL_ATTR(UNIVERSAL, 1) 244 247 }; 245 248 246 249 #define HPI_POLARITY_POSITIVE 0 ··· 394 393 HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1), 395 394 HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2), 396 395 HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3), 397 - /* HPI_SUBSYS_FIND_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 4), */ 398 396 HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5), 399 397 HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6), 400 - /* HPI_SUBSYS_DELETE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 7), */ 401 398 HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8), 402 399 HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9), 403 - /* HPI_SUBSYS_READ_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 10), */ 404 - /* HPI_SUBSYS_WRITE_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 11), */ 405 400 HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12), 406 401 HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13), 407 402 HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14), ··· 427 430 HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19), 428 431 HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20), 429 432 HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21), 430 - #define HPI_ADAPTER_FUNCTION_COUNT 21 433 + HPI_ADAPTER_READ_FLASH = HPI_FUNC_ID(ADAPTER, 22), 434 + HPI_ADAPTER_END_FLASH = HPI_FUNC_ID(ADAPTER, 23), 435 + HPI_ADAPTER_FILESTORE_DELETE_ALL = HPI_FUNC_ID(ADAPTER, 24), 436 + #define HPI_ADAPTER_FUNCTION_COUNT 24 431 437 432 438 HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1), 433 439 HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2), ··· 495 495 HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10), 496 496 HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11), 497 497 HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12), 498 - #define HPI_MIXER_FUNCTION_COUNT 12 498 + HPI_MIXER_GET_BLOCK_HANDLE = HPI_FUNC_ID(MIXER, 13), 499 + HPI_MIXER_GET_PARAMETER_HANDLE = HPI_FUNC_ID(MIXER, 14), 500 + #define HPI_MIXER_FUNCTION_COUNT 14 499 501 500 502 HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1), 501 503 HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2), ··· 620 618 u32 auxiliary_data_available; 621 619 u32 stream_state; 622 620 /* DSP index in to the host bus master buffer. */ 623 - u32 dSP_index; 621 + u32 dsp_index; 624 622 /* Host index in to the host bus master buffer. */ 625 623 u32 host_index; 626 624 u32 size_in_bytes; ··· 663 661 u16 index; 664 662 } module_info; 665 663 struct { 666 - u32 checksum; 667 - u16 sequence; 668 - u16 length; 669 - u16 offset; /**< offset from start of msg to data */ 670 - u16 unused; 671 - } program_flash; 672 - struct { 673 664 u16 index; 674 665 u16 what; 675 666 u16 property_index; ··· 673 678 u16 parameter2; 674 679 } property_set; 675 680 struct { 676 - u32 offset; 677 - } query_flash; 678 - struct { 679 681 u32 pad32; 680 682 u16 key1; 681 683 u16 key2; 682 684 } restart; 683 - struct { 684 - u32 offset; 685 - u32 length; 686 - u32 key; 687 - } start_flash; 688 685 struct { 689 686 u32 pad32; 690 687 u16 value; ··· 684 697 struct { 685 698 u32 yes; 686 699 } irq_query; 700 + u32 pad[3]; 687 701 }; 688 702 689 703 struct hpi_adapter_res { ··· 712 724 u32 adapter_mode; 713 725 } mode; 714 726 struct { 715 - u16 sequence; 716 - } program_flash; 717 - struct { 718 727 u16 parameter1; 719 728 u16 parameter2; 720 729 } property_get; 721 - struct { 722 - u32 checksum; 723 - u32 length; 724 - u32 version; 725 - } query_flash; 726 730 struct { 727 731 u32 yes; 728 732 } irq_query; ··· 1130 1150 struct hpi_adapter_res p; 1131 1151 }; 1132 1152 1133 - /* padding is so these are same size as v0 hpi_message */ 1134 - struct hpi_msg_adapter_query_flash { 1135 - struct hpi_message_header h; 1136 - u32 offset; 1137 - u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */ 1138 - sizeof(struct hpi_message_header) - 1 * sizeof(u32)]; 1139 - }; 1140 - 1141 - /* padding is so these are same size as v0 hpi_response */ 1142 - struct hpi_res_adapter_query_flash { 1143 - struct hpi_response_header h; 1144 - u32 checksum; 1145 - u32 length; 1146 - u32 version; 1147 - u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ 1148 - sizeof(struct hpi_response_header) - 3 * sizeof(u32)]; 1149 - }; 1150 - 1151 - struct hpi_msg_adapter_start_flash { 1152 - struct hpi_message_header h; 1153 - u32 offset; 1154 - u32 length; 1155 - u32 key; 1156 - u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */ 1157 - sizeof(struct hpi_message_header) - 3 * sizeof(u32)]; 1158 - }; 1159 - 1160 - struct hpi_res_adapter_start_flash { 1161 - struct hpi_response_header h; 1162 - u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ 1163 - sizeof(struct hpi_response_header)]; 1164 - }; 1165 - 1166 - struct hpi_msg_adapter_program_flash_payload { 1167 - u32 checksum; 1168 - u16 sequence; 1169 - u16 length; 1170 - u16 offset; /**< offset from start of msg to data */ 1171 - u16 unused; 1172 - /* ensure sizeof(header + payload) == sizeof(hpi_message_V0) 1173 - because old firmware expects data after message of this size */ 1174 - u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 message */ 1175 - sizeof(struct hpi_message_header) - sizeof(u32) - 1176 - 4 * sizeof(u16)]; 1177 - }; 1178 - 1179 - struct hpi_msg_adapter_program_flash { 1180 - struct hpi_message_header h; 1181 - struct hpi_msg_adapter_program_flash_payload p; 1182 - u32 data[256]; 1183 - }; 1184 - 1185 - struct hpi_res_adapter_program_flash { 1186 - struct hpi_response_header h; 1187 - u16 sequence; 1188 - u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */ 1189 - sizeof(struct hpi_response_header) - sizeof(u16)]; 1190 - }; 1191 - 1192 - struct hpi_msg_adapter_debug_read { 1193 - struct hpi_message_header h; 1194 - u32 dsp_address; 1195 - u32 count_bytes; 1196 - }; 1197 - 1198 1153 struct hpi_res_adapter_debug_read { 1199 1154 struct hpi_response_header h; 1200 - u8 bytes[256]; 1155 + u8 bytes[1024]; 1201 1156 }; 1202 1157 1203 1158 struct hpi_msg_cobranet_hmi { ··· 1376 1461 /* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */ 1377 1462 struct hpi_fifo_buffer { 1378 1463 u32 size; 1379 - u32 dSP_index; 1464 + u32 dsp_index; 1380 1465 u32 host_index; 1381 1466 }; 1382 1467
+32
sound/pci/asihpi/hpi_version.h
··· 1 + /** HPI Version Definitions 2 + Development releases have odd minor version. 3 + Production releases have even minor version. 4 + 5 + \file hpi_version.h 6 + */ 7 + 8 + #ifndef _HPI_VERSION_H 9 + #define _HPI_VERSION_H 10 + 11 + /* Use single digits for versions less that 10 to avoid octal. */ 12 + /* *** HPI_VER is the only edit required to update version *** */ 13 + /** HPI version */ 14 + #define HPI_VER HPI_VERSION_CONSTRUCTOR(4, 10, 1) 15 + 16 + /** HPI version string in dotted decimal format */ 17 + #define HPI_VER_STRING "4.10.01" 18 + 19 + /** Library version as documented in hpi-api-versions.txt */ 20 + #define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(10, 2, 0) 21 + 22 + /** Construct hpi version number from major, minor, release numbers */ 23 + #define HPI_VERSION_CONSTRUCTOR(maj, min, r) ((maj << 16) + (min << 8) + r) 24 + 25 + /** Extract major version from hpi version number */ 26 + #define HPI_VER_MAJOR(v) ((int)(v >> 16)) 27 + /** Extract minor version from hpi version number */ 28 + #define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF)) 29 + /** Extract release from hpi version number */ 30 + #define HPI_VER_RELEASE(v) ((int)(v & 0xFF)) 31 + 32 + #endif
+19 -13
sound/pci/asihpi/hpicmn.c
··· 1 1 /****************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as ··· 68 68 u16 hpi_add_adapter(struct hpi_adapter_obj *pao) 69 69 { 70 70 u16 retval = 0; 71 - /*HPI_ASSERT(pao->wAdapterType); */ 71 + /*HPI_ASSERT(pao->type); */ 72 72 73 73 hpios_alistlock_lock(&adapters); 74 74 ··· 77 77 goto unlock; 78 78 } 79 79 80 - if (adapters.adapter[pao->index].adapter_type) { 80 + if (adapters.adapter[pao->index].type) { 81 81 int a; 82 82 for (a = HPI_MAX_ADAPTERS - 1; a >= 0; a--) { 83 - if (!adapters.adapter[a].adapter_type) { 83 + if (!adapters.adapter[a].type) { 84 84 HPI_DEBUG_LOG(WARNING, 85 85 "ASI%X duplicate index %d moved to %d\n", 86 - pao->adapter_type, pao->index, a); 86 + pao->type, pao->index, a); 87 87 pao->index = a; 88 88 break; 89 89 } ··· 104 104 105 105 void hpi_delete_adapter(struct hpi_adapter_obj *pao) 106 106 { 107 - if (!pao->adapter_type) { 107 + if (!pao->type) { 108 108 HPI_DEBUG_LOG(ERROR, "removing null adapter?\n"); 109 109 return; 110 110 } 111 111 112 112 hpios_alistlock_lock(&adapters); 113 - if (adapters.adapter[pao->index].adapter_type) 113 + if (adapters.adapter[pao->index].type) 114 114 adapters.gw_num_adapters--; 115 115 memset(&adapters.adapter[pao->index], 0, sizeof(adapters.adapter[0])); 116 116 hpios_alistlock_unlock(&adapters); ··· 132 132 } 133 133 134 134 pao = &adapters.adapter[adapter_index]; 135 - if (pao->adapter_type != 0) { 135 + if (pao->type != 0) { 136 136 /* 137 137 HPI_DEBUG_LOG(VERBOSE, "Found adapter index %d\n", 138 138 wAdapterIndex); ··· 165 165 166 166 /* find the nCount'th nonzero adapter in array */ 167 167 for (index = 0; index < HPI_MAX_ADAPTERS; index++) { 168 - if (adapters.adapter[index].adapter_type) { 168 + if (adapters.adapter[index].type) { 169 169 if (!count) 170 170 break; 171 171 count--; ··· 174 174 175 175 if (index < HPI_MAX_ADAPTERS) { 176 176 phr->u.s.adapter_index = adapters.adapter[index].index; 177 - phr->u.s.adapter_type = adapters.adapter[index].adapter_type; 177 + phr->u.s.adapter_type = adapters.adapter[index].type; 178 178 } else { 179 179 phr->u.s.adapter_index = 0; 180 180 phr->u.s.adapter_type = 0; 181 - phr->error = HPI_ERROR_BAD_ADAPTER_NUMBER; 181 + phr->error = HPI_ERROR_INVALID_OBJ_INDEX; 182 182 } 183 183 } 184 184 ··· 324 324 } 325 325 326 326 phr->error = 0; 327 + phr->specific_error = 0; 328 + phr->version = 0; 327 329 328 330 /* set the default response size */ 329 331 response_size = ··· 533 531 found ? "Cached" : "Uncached", phm->adapter_index, 534 532 pI->control_index, pI->control_type, phm->u.c.attribute); 535 533 536 - if (found) 534 + if (found) { 537 535 phr->size = (u16)response_size; 536 + phr->type = HPI_TYPE_RESPONSE; 537 + phr->object = phm->object; 538 + phr->function = phm->function; 539 + } 538 540 539 541 return found; 540 542 } ··· 637 631 if (!p_cache) 638 632 return NULL; 639 633 640 - p_cache->p_info = kzalloc(sizeof(*p_cache->p_info) * control_count, 634 + p_cache->p_info = kcalloc(control_count, sizeof(*p_cache->p_info), 641 635 GFP_KERNEL); 642 636 if (!p_cache->p_info) { 643 637 kfree(p_cache);
+8 -5
sound/pci/asihpi/hpicmn.h
··· 1 1 /** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as ··· 18 18 19 19 */ 20 20 21 + struct hpi_adapter_obj; 22 + 23 + /* a function that takes an adapter obj and returns an int */ 24 + typedef int adapter_int_func(struct hpi_adapter_obj *pao); 25 + 21 26 struct hpi_adapter_obj { 22 27 struct hpi_pci pci; /* PCI info - bus#,dev#,address etc */ 23 - u16 adapter_type; /* ASI6701 etc */ 24 - u16 index; /* */ 25 - u16 open; /* =1 when adapter open */ 26 - u16 mixer_open; 28 + u16 type; /* 0x6644 == ASI6644 etc */ 29 + u16 index; 27 30 28 31 struct hpios_spinlock dsp_lock; 29 32
+1 -1
sound/pci/asihpi/hpidebug.c
··· 1 1 /************************************************************************ 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as
+1 -1
sound/pci/asihpi/hpidebug.h
··· 1 1 /***************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as
+14 -16
sound/pci/asihpi/hpidspcd.c
··· 25 25 #define SOURCEFILE_NAME "hpidspcd.c" 26 26 #include "hpidspcd.h" 27 27 #include "hpidebug.h" 28 + #include "hpi_version.h" 28 29 29 30 struct dsp_code_private { 30 31 /** Firmware descriptor */ 31 32 const struct firmware *firmware; 32 33 struct pci_dev *dev; 33 34 }; 34 - 35 - #define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \ 36 - HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER))) 37 35 38 36 /*-------------------------------------------------------------------*/ 39 37 short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code, ··· 64 66 if ((header.type != 0x45444F43) || /* "CODE" */ 65 67 (header.adapter != adapter) 66 68 || (header.size != firmware->size)) { 67 - dev_printk(KERN_ERR, &dev->dev, "Invalid firmware file\n"); 69 + dev_printk(KERN_ERR, &dev->dev, 70 + "Invalid firmware header size %d != file %zd\n", 71 + header.size, firmware->size); 68 72 goto error2; 69 73 } 70 74 71 - if ((header.version / 100 & ~1) != (HPI_VER_DECIMAL / 100 & ~1)) { 75 + if ((header.version >> 9) != (HPI_VER >> 9)) { 76 + /* Consider even and subsequent odd minor versions to be compatible */ 72 77 dev_printk(KERN_ERR, &dev->dev, 73 78 "Incompatible firmware version " 74 - "DSP image %d != Driver %d\n", header.version, 75 - HPI_VER_DECIMAL); 79 + "DSP image %X != Driver %X\n", header.version, 80 + HPI_VER); 76 81 goto error2; 77 82 } 78 83 79 - if (header.version != HPI_VER_DECIMAL) { 80 - dev_printk(KERN_WARNING, &dev->dev, 81 - "Firmware: release version mismatch DSP image %d != Driver %d\n", 82 - header.version, HPI_VER_DECIMAL); 84 + if (header.version != HPI_VER) { 85 + dev_printk(KERN_INFO, &dev->dev, 86 + "Firmware: release version mismatch DSP image %X != Driver %X\n", 87 + header.version, HPI_VER); 83 88 } 84 89 85 90 HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name); ··· 109 108 /*-------------------------------------------------------------------*/ 110 109 void hpi_dsp_code_close(struct dsp_code *dsp_code) 111 110 { 112 - if (dsp_code->pvt->firmware) { 113 - HPI_DEBUG_LOG(DEBUG, "dsp code closed\n"); 114 - release_firmware(dsp_code->pvt->firmware); 115 - dsp_code->pvt->firmware = NULL; 116 - } 111 + HPI_DEBUG_LOG(DEBUG, "dsp code closed\n"); 112 + release_firmware(dsp_code->pvt->firmware); 117 113 kfree(dsp_code->pvt); 118 114 } 119 115
-4
sound/pci/asihpi/hpidspcd.h
··· 27 27 28 28 #include "hpi_internal.h" 29 29 30 - /** Code header version is decimal encoded e.g. 4.06.10 is 40601 */ 31 - #define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \ 32 - HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER))) 33 - 34 30 /** Header structure for dsp firmware file 35 31 This structure must match that used in s2bin.c for generation of asidsp.bin 36 32 */
+10
sound/pci/asihpi/hpifunc.c
··· 2826 2826 duration_ms, HPI_VOLUME_AUTOFADE_LOG); 2827 2827 } 2828 2828 2829 + u16 hpi_volume_query_auto_fade_profile(const u32 h_volume, const u32 i, 2830 + u16 *profile) 2831 + { 2832 + u16 e; 2833 + u32 u; 2834 + e = hpi_control_query(h_volume, HPI_VOLUME_AUTOFADE, i, 0, &u); 2835 + *profile = (u16)u; 2836 + return e; 2837 + } 2838 + 2829 2839 u16 hpi_vox_set_threshold(u32 h_control, short an_gain0_01dB) 2830 2840 { 2831 2841 struct hpi_message hm;
+1 -1
sound/pci/asihpi/hpimsginit.c
··· 1 1 /****************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as
+1 -1
sound/pci/asihpi/hpimsginit.h
··· 1 1 /****************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as
+2 -1
sound/pci/asihpi/hpimsgx.c
··· 1 1 /****************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as ··· 22 22 *****************************************************************************/ 23 23 #define SOURCEFILE_NAME "hpimsgx.c" 24 24 #include "hpi_internal.h" 25 + #include "hpi_version.h" 25 26 #include "hpimsginit.h" 26 27 #include "hpicmn.h" 27 28 #include "hpimsgx.h"
+1 -1
sound/pci/asihpi/hpimsgx.h
··· 1 1 /****************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as
+27 -36
sound/pci/asihpi/hpioctl.c
··· 21 21 #define SOURCEFILE_NAME "hpioctl.c" 22 22 23 23 #include "hpi_internal.h" 24 + #include "hpi_version.h" 24 25 #include "hpimsginit.h" 25 26 #include "hpidebug.h" 26 27 #include "hpimsgx.h" ··· 66 65 static void hpi_send_recv_f(struct hpi_message *phm, struct hpi_response *phr, 67 66 struct file *file) 68 67 { 69 - int adapter = phm->adapter_index; 70 - 71 - if ((adapter >= HPI_MAX_ADAPTERS || adapter < 0) 68 + if ((phm->adapter_index >= HPI_MAX_ADAPTERS) 72 69 && (phm->object != HPI_OBJ_SUBSYSTEM)) 73 70 phr->error = HPI_ERROR_INVALID_OBJ_INDEX; 74 71 else ··· 177 178 } else { 178 179 u16 __user *ptr = NULL; 179 180 u32 size = 0; 180 - u32 adapter_present; 181 181 /* -1=no data 0=read from user mem, 1=write to user mem */ 182 182 int wrflag = -1; 183 - struct hpi_adapter *pa; 183 + struct hpi_adapter *pa = NULL; 184 184 185 - if (hm->h.adapter_index < HPI_MAX_ADAPTERS) { 185 + if (hm->h.adapter_index < ARRAY_SIZE(adapters)) 186 186 pa = &adapters[hm->h.adapter_index]; 187 - adapter_present = pa->type; 188 - } else { 189 - adapter_present = 0; 190 - } 191 187 192 - if (!adapter_present) { 188 + if (!pa || !pa->adapter || !pa->adapter->type) { 193 189 hpi_init_response(&hr->r0, hm->h.object, 194 190 hm->h.function, HPI_ERROR_BAD_ADAPTER_NUMBER); 195 191 ··· 311 317 const struct pci_device_id *pci_id) 312 318 { 313 319 int idx, nm; 320 + int adapter_index; 314 321 unsigned int memlen; 315 322 struct hpi_message hm; 316 323 struct hpi_response hr; ··· 340 345 341 346 hm.adapter_index = HPI_ADAPTER_INDEX_INVALID; 342 347 343 - adapter.pci = pci_dev; 344 - 345 348 nm = HPI_MAX_ADAPTER_MEM_SPACES; 346 349 347 350 for (idx = 0; idx < nm; idx++) { ··· 348 355 349 356 if (pci_resource_flags(pci_dev, idx) & IORESOURCE_MEM) { 350 357 memlen = pci_resource_len(pci_dev, idx); 351 - adapter.ap_remapped_mem_base[idx] = 358 + pci.ap_mem_base[idx] = 352 359 ioremap(pci_resource_start(pci_dev, idx), 353 360 memlen); 354 - if (!adapter.ap_remapped_mem_base[idx]) { 361 + if (!pci.ap_mem_base[idx]) { 355 362 HPI_DEBUG_LOG(ERROR, 356 363 "ioremap failed, aborting\n"); 357 364 /* unmap previously mapped pci mem space */ 358 365 goto err; 359 366 } 360 367 } 361 - 362 - pci.ap_mem_base[idx] = adapter.ap_remapped_mem_base[idx]; 363 368 } 364 369 365 370 pci.pci_dev = pci_dev; ··· 368 377 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); 369 378 if (hr.error) 370 379 goto err; 380 + 381 + adapter_index = hr.u.s.adapter_index; 382 + adapter.adapter = hpi_find_adapter(adapter_index); 371 383 372 384 if (prealloc_stream_buf) { 373 385 adapter.p_buffer = vmalloc(prealloc_stream_buf); ··· 383 389 } 384 390 } 385 391 386 - adapter.index = hr.u.s.adapter_index; 387 - adapter.type = hr.u.s.adapter_type; 388 - 389 392 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, 390 393 HPI_ADAPTER_OPEN); 391 - hm.adapter_index = adapter.index; 394 + hm.adapter_index = adapter.adapter->index; 392 395 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); 393 396 394 397 if (hr.error) 395 398 goto err; 396 399 397 - adapter.snd_card_asihpi = NULL; 398 400 /* WARNING can't init mutex in 'adapter' 399 401 * and then copy it to adapters[] ?!?! 400 402 */ 401 - adapters[adapter.index] = adapter; 402 - mutex_init(&adapters[adapter.index].mutex); 403 - pci_set_drvdata(pci_dev, &adapters[adapter.index]); 403 + adapters[adapter_index] = adapter; 404 + mutex_init(&adapters[adapter_index].mutex); 405 + pci_set_drvdata(pci_dev, &adapters[adapter_index]); 404 406 405 407 dev_printk(KERN_INFO, &pci_dev->dev, 406 - "probe succeeded for ASI%04X HPI index %d\n", adapter.type, 407 - adapter.index); 408 + "probe succeeded for ASI%04X HPI index %d\n", 409 + adapter.adapter->type, adapter_index); 408 410 409 411 return 0; 410 412 411 413 err: 412 414 for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { 413 - if (adapter.ap_remapped_mem_base[idx]) { 414 - iounmap(adapter.ap_remapped_mem_base[idx]); 415 - adapter.ap_remapped_mem_base[idx] = NULL; 415 + if (pci.ap_mem_base[idx]) { 416 + iounmap(pci.ap_mem_base[idx]); 417 + pci.ap_mem_base[idx] = NULL; 416 418 } 417 419 } 418 420 ··· 427 437 struct hpi_message hm; 428 438 struct hpi_response hr; 429 439 struct hpi_adapter *pa; 440 + struct hpi_pci pci; 441 + 430 442 pa = pci_get_drvdata(pci_dev); 443 + pci = pa->adapter->pci; 431 444 432 445 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, 433 446 HPI_ADAPTER_DELETE); 434 - hm.adapter_index = pa->index; 447 + hm.adapter_index = pa->adapter->index; 435 448 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); 436 449 437 450 /* unmap PCI memory space, mapped during device init. */ 438 451 for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { 439 - if (pa->ap_remapped_mem_base[idx]) { 440 - iounmap(pa->ap_remapped_mem_base[idx]); 441 - pa->ap_remapped_mem_base[idx] = NULL; 442 - } 452 + if (pci.ap_mem_base[idx]) 453 + iounmap(pci.ap_mem_base[idx]); 443 454 } 444 455 445 456 if (pa->p_buffer) ··· 452 461 "remove %04x:%04x,%04x:%04x,%04x," " HPI index %d.\n", 453 462 pci_dev->vendor, pci_dev->device, 454 463 pci_dev->subsystem_vendor, pci_dev->subsystem_device, 455 - pci_dev->devfn, pa->index); 464 + pci_dev->devfn, pa->adapter->index); 456 465 457 466 memset(pa, 0, sizeof(*pa)); 458 467 }
+1 -1
sound/pci/asihpi/hpioctl.h
··· 1 1 /******************************************************************************* 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as
+1 -1
sound/pci/asihpi/hpios.c
··· 1 1 /****************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as
+7 -9
sound/pci/asihpi/hpios.h
··· 1 1 /****************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as ··· 149 149 #define hpios_alistlock_lock(obj) spin_lock(&((obj)->list_lock.lock)) 150 150 #define hpios_alistlock_unlock(obj) spin_unlock(&((obj)->list_lock.lock)) 151 151 152 + struct snd_card; 153 + 154 + /** pci drvdata points to an instance of this struct */ 152 155 struct hpi_adapter { 156 + struct hpi_adapter_obj *adapter; 157 + struct snd_card *snd_card; 158 + 153 159 /* mutex prevents contention for one card 154 160 between multiple user programs (via ioctl) */ 155 161 struct mutex mutex; 156 - u16 index; 157 - u16 type; 158 - 159 - /* ALSA card structure */ 160 - void *snd_card_asihpi; 161 - 162 162 char *p_buffer; 163 163 size_t buffer_size; 164 - struct pci_dev *pci; 165 - void __iomem *ap_remapped_mem_base[HPI_MAX_ADAPTER_MEM_SPACES]; 166 164 }; 167 165 168 166 #endif
+1 -1
sound/pci/asihpi/hpipcida.h
··· 1 1 /****************************************************************************** 2 2 3 3 AudioScience HPI driver 4 - Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 + Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com> 5 5 6 6 This program is free software; you can redistribute it and/or modify 7 7 it under the terms of version 2 of the GNU General Public License as
+2 -2
sound/pci/atiixp.c
··· 43 43 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 44 44 static int ac97_clock = 48000; 45 45 static char *ac97_quirk; 46 - static int spdif_aclink = 1; 46 + static bool spdif_aclink = 1; 47 47 static int ac97_codec = -1; 48 48 49 49 module_param(index, int, 0444); ··· 60 60 MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link."); 61 61 62 62 /* just for backward compatibility */ 63 - static int enable; 63 + static bool enable; 64 64 module_param(enable, bool, 0444); 65 65 66 66
+1 -1
sound/pci/atiixp_modem.c
··· 51 51 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); 52 52 53 53 /* just for backward compatibility */ 54 - static int enable; 54 + static bool enable; 55 55 module_param(enable, bool, 0444); 56 56 57 57
+1 -1
sound/pci/au88x0/au88x0.c
··· 26 26 // module parameters (see "Module Parameters") 27 27 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 28 28 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 29 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 29 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 30 30 static int pcifix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 255 }; 31 31 32 32 module_param_array(index, int, NULL, 0444);
+4 -6
sound/pci/au88x0/au88x0_core.c
··· 805 805 } 806 806 807 807 static void 808 - vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int b, int priority, 808 + vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int stereo, int priority, 809 809 int empty, int valid, int f) 810 810 { 811 811 int temp, lifeboat = 0; ··· 837 837 #else 838 838 temp = (this_4 & 0x3f) << 0xc; 839 839 #endif 840 - temp = (temp & 0xfffffffd) | ((b & 1) << 1); 840 + temp = (temp & 0xfffffffd) | ((stereo & 1) << 1); 841 841 temp = (temp & 0xfffffff3) | ((priority & 3) << 2); 842 842 temp = (temp & 0xffffffef) | ((valid & 1) << 4); 843 843 temp |= FIFO_U1; ··· 1148 1148 1149 1149 static void 1150 1150 vortex_adbdma_setmode(vortex_t * vortex, int adbdma, int ie, int dir, 1151 - int fmt, int d, u32 offset) 1151 + int fmt, int stereo, u32 offset) 1152 1152 { 1153 1153 stream_t *dma = &vortex->dma_adb[adbdma]; 1154 1154 1155 - dma->dma_unknown = d; 1155 + dma->dma_unknown = stereo; 1156 1156 dma->dma_ctrl = 1157 1157 ((offset & OFFSET_MASK) | (dma->dma_ctrl & ~OFFSET_MASK)); 1158 1158 /* Enable PCMOUT interrupts. */ ··· 1336 1336 dma->fifo_status = FIFO_PAUSE; 1337 1337 } 1338 1338 1339 - #if 0 // Using pause instead 1340 1339 static void vortex_adbdma_stopfifo(vortex_t * vortex, int adbdma) 1341 1340 { 1342 1341 stream_t *dma = &vortex->dma_adb[adbdma]; ··· 1350 1351 dma->fifo_enabled = 0; 1351 1352 } 1352 1353 1353 - #endif 1354 1354 /* WTDMA */ 1355 1355 1356 1356 #ifndef CHIP_AU8810
+3 -4
sound/pci/au88x0/au88x0_pcm.c
··· 307 307 fmt = vortex_alsafmt_aspfmt(runtime->format); 308 308 spin_lock_irq(&chip->lock); 309 309 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) { 310 - vortex_adbdma_setmode(chip, dma, 1, dir, fmt, 0 /*? */ , 311 - 0); 310 + vortex_adbdma_setmode(chip, dma, 1, dir, fmt, 311 + runtime->channels == 1 ? 0 : 1, 0); 312 312 vortex_adbdma_setstartbuffer(chip, dma, 0); 313 313 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_SPDIF) 314 314 vortex_adb_setsrc(chip, dma, runtime->rate, dir); ··· 353 353 //printk(KERN_INFO "vortex: stop %d\n", dma); 354 354 stream->fifo_enabled = 0; 355 355 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) 356 - vortex_adbdma_pausefifo(chip, dma); 357 - //vortex_adbdma_stopfifo(chip, dma); 356 + vortex_adbdma_stopfifo(chip, dma); 358 357 #ifndef CHIP_AU8810 359 358 else { 360 359 printk(KERN_INFO "vortex: wt stop %d\n", dma);
+88 -63
sound/pci/au88x0/au88x0_xtalk.c
··· 48 48 static unsigned short const wXtalkNarrowRightDelay = 0x7; 49 49 50 50 static xtalk_gains_t const asXtalkGainsDefault = { 51 - 0x4000, 0x4000, 4000, 0x4000, 4000, 0x4000, 4000, 0x4000, 4000, 52 - 0x4000 51 + 0x4000, 0x4000, 0x4000, 0x4000, 0x4000, 52 + 0x4000, 0x4000, 0x4000, 0x4000, 0x4000 53 53 }; 54 54 55 55 static xtalk_gains_t const asXtalkGainsTest = { 56 - 0x8000, 0x7FFF, 0, 0xFFFF, 0x0001, 0xC000, 0x4000, 0xFFFE, 0x0002, 57 - 0 56 + 0x7fff, 0x8000, 0x0000, 0x0000, 0x0001, 57 + 0xffff, 0x4000, 0xc000, 0x0002, 0xfffe 58 58 }; 59 + 59 60 static xtalk_gains_t const asXtalkGains1Chan = { 60 - 0x7FFF, 0, 0, 0, 0x7FFF, 0, 0, 0, 0, 0 61 + 0x7FFF, 0, 0, 0, 0, 62 + 0x7FFF, 0, 0, 0, 0, 61 63 }; 62 64 63 65 // Input gain for 4 A3D slices. One possible input pair is left zero. 64 66 static xtalk_gains_t const asXtalkGainsAllChan = { 65 - 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 66 - 0 67 - //0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7fff,0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7fff 67 + 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0, 68 + 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0 68 69 }; 69 - static xtalk_gains_t const asXtalkGainsZeros; 70 70 71 - static xtalk_dline_t const alXtalkDlineZeros; 71 + static xtalk_gains_t const asXtalkGainsZeros = { 72 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 73 + }; 74 + 75 + static xtalk_dline_t const alXtalkDlineZeros = { 76 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 78 + }; 72 79 static xtalk_dline_t const alXtalkDlineTest = { 73 - 0xFC18, 0x03E8FFFF, 0x186A0, 0x7960FFFE, 1, 0xFFFFFFFF, 74 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80 + 0x0000fc18, 0xfff03e8, 0x000186a0, 0xfffe7960, 1, 0xffffffff, 0, 0, 81 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82 + 0, 0, 0, 0, 0, 0, 0, 0 83 + }; 84 + 85 + static xtalk_instate_t const asXtalkInStateZeros = { 75 86 0, 0, 0, 0 76 87 }; 77 88 78 - static xtalk_instate_t const asXtalkInStateZeros; 79 - static xtalk_instate_t const asXtalkInStateTest = 80 - { 0xFF80, 0x0080, 0xFFFF, 0x0001 }; 81 - static xtalk_state_t const asXtalkOutStateZeros; 89 + static xtalk_instate_t const asXtalkInStateTest = { 90 + 0x0080, 0xff80, 0x0001, 0xffff 91 + }; 92 + 93 + static xtalk_state_t const asXtalkOutStateZeros = { 94 + {0, 0, 0, 0}, 95 + {0, 0, 0, 0}, 96 + {0, 0, 0, 0}, 97 + {0, 0, 0, 0}, 98 + {0, 0, 0, 0} 99 + }; 82 100 83 101 static short const sDiamondKLeftEq = 0x401d; 84 102 static short const sDiamondKRightEq = 0x401d; 85 103 static short const sDiamondKLeftXt = 0xF90E; 86 104 static short const sDiamondKRightXt = 0xF90E; 87 - static short const sDiamondShiftLeftEq = 1; /* 0xF90E Is this a bug ??? */ 105 + static short const sDiamondShiftLeftEq = 1; 88 106 static short const sDiamondShiftRightEq = 1; 89 107 static short const sDiamondShiftLeftXt = 0; 90 108 static short const sDiamondShiftRightXt = 0; ··· 112 94 static xtalk_coefs_t const asXtalkWideCoefsLeftEq = { 113 95 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0}, 114 96 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0}, 115 - {0x340B, 0xf504, 0x6CE8, 0x0D23, 0x00E4}, 116 - {0xD500, 0x8D76, 0xACC7, 0x5B05, 0x00FA}, 97 + {0x340B, 0xe8f5, 0x236c, 0xe40d, 0}, 98 + {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0}, 117 99 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0} 118 100 }; 119 101 static xtalk_coefs_t const asXtalkWideCoefsRightEq = { 120 102 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0}, 121 103 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0}, 122 - {0x340B, 0xF504, 0x6CE8, 0x0D23, 0x00E4}, 123 - {0xD500, 0x8D76, 0xACC7, 0x5B05, 0x00FA}, 104 + {0x340B, 0xe8f5, 0x236c, 0xe40d, 0}, 105 + {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0}, 124 106 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0} 125 107 }; 126 108 static xtalk_coefs_t const asXtalkWideCoefsLeftXt = { 127 - {0x86C3, 0x7B55, 0x89C3, 0x005B, 0x0047}, 128 - {0x6000, 0x206A, 0xC6CA, 0x40FF, 0}, 129 - {0x1100, 0x1164, 0xA1D7, 0x90FC, 0x0001}, 130 - {0xDC00, 0x9E77, 0xB8C7, 0x0AFF, 0}, 109 + {0x55c6, 0xc97b, 0x005b, 0x0047, 0}, 110 + {0x6a60, 0xca20, 0xffc6, 0x0040, 0}, 111 + {0x6411, 0xd711, 0xfca1, 0x0190, 0}, 112 + {0x77dc, 0xc79e, 0xffb8, 0x000a, 0}, 131 113 {0, 0, 0, 0, 0} 132 114 }; 133 115 static xtalk_coefs_t const asXtalkWideCoefsRightXt = { 134 - {0x86C3, 0x7B55, 0x89C3, 0x005B, 0x0047}, 135 - {0x6000, 0x206A, 0xC6CA, 0x40FF, 0}, 136 - {0x1100, 0x1164, 0xA1D7, 0x90FC, 0x0001}, 137 - {0xDC00, 0x9E77, 0xB8C7, 0x0AFF, 0}, 116 + {0x55c6, 0xc97b, 0x005b, 0x0047, 0}, 117 + {0x6a60, 0xca20, 0xffc6, 0x0040, 0}, 118 + {0x6411, 0xd711, 0xfca1, 0x0190, 0}, 119 + {0x77dc, 0xc79e, 0xffb8, 0x000a, 0}, 138 120 {0, 0, 0, 0, 0} 139 121 }; 140 122 static xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = { ··· 169 151 {0, 0, 0, 0, 0} 170 152 }; 171 153 172 - static xtalk_coefs_t const asXtalkCoefsZeros; 154 + static xtalk_coefs_t const asXtalkCoefsZeros = { 155 + {0, 0, 0, 0, 0}, 156 + {0, 0, 0, 0, 0}, 157 + {0, 0, 0, 0, 0}, 158 + {0, 0, 0, 0, 0}, 159 + {0, 0, 0, 0, 0} 160 + }; 161 + 173 162 static xtalk_coefs_t const asXtalkCoefsPipe = { 174 163 {0, 0, 0x0FA0, 0, 0}, 175 164 {0, 0, 0x0FA0, 0, 0}, ··· 211 186 static xtalk_state_t const asXtalkOutStateTest = { 212 187 {0x7FFF, 0x0004, 0xFFFC, 0}, 213 188 {0xFE00, 0x0008, 0xFFF8, 0x4000}, 214 - {0x200, 0x0010, 0xFFF0, 0xC000}, 189 + {0x0200, 0x0010, 0xFFF0, 0xC000}, 215 190 {0x8000, 0x0020, 0xFFE0, 0}, 216 191 {0, 0, 0, 0} 217 192 }; ··· 331 306 hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]); 332 307 hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]); 333 308 } 334 - hwwrite(vortex->mmio, 0x244F8 + i * 0x24, arg_0[0]); 335 - hwwrite(vortex->mmio, 0x244FC + i * 0x24, arg_0[1]); 336 - hwwrite(vortex->mmio, 0x24500 + i * 0x24, arg_0[2]); 337 - hwwrite(vortex->mmio, 0x24504 + i * 0x24, arg_0[3]); 309 + hwwrite(vortex->mmio, 0x244F8, arg_0[0]); 310 + hwwrite(vortex->mmio, 0x244FC, arg_0[1]); 311 + hwwrite(vortex->mmio, 0x24500, arg_0[2]); 312 + hwwrite(vortex->mmio, 0x24504, arg_0[3]); 338 313 } 339 314 340 315 static void ··· 350 325 hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]); 351 326 hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]); 352 327 } 353 - hwwrite(vortex->mmio, 0x24508 + i * 0x24, arg_0[0]); 354 - hwwrite(vortex->mmio, 0x2450C + i * 0x24, arg_0[1]); 355 - hwwrite(vortex->mmio, 0x24510 + i * 0x24, arg_0[2]); 356 - hwwrite(vortex->mmio, 0x24514 + i * 0x24, arg_0[3]); 328 + hwwrite(vortex->mmio, 0x24508, arg_0[0]); 329 + hwwrite(vortex->mmio, 0x2450C, arg_0[1]); 330 + hwwrite(vortex->mmio, 0x24510, arg_0[2]); 331 + hwwrite(vortex->mmio, 0x24514, arg_0[3]); 357 332 } 358 333 359 334 static void ··· 369 344 hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]); 370 345 hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]); 371 346 } 372 - hwwrite(vortex->mmio, 0x24518 + i * 0x24, arg_0[0]); 373 - hwwrite(vortex->mmio, 0x2451C + i * 0x24, arg_0[1]); 374 - hwwrite(vortex->mmio, 0x24520 + i * 0x24, arg_0[2]); 375 - hwwrite(vortex->mmio, 0x24524 + i * 0x24, arg_0[3]); 347 + hwwrite(vortex->mmio, 0x24518, arg_0[0]); 348 + hwwrite(vortex->mmio, 0x2451C, arg_0[1]); 349 + hwwrite(vortex->mmio, 0x24520, arg_0[2]); 350 + hwwrite(vortex->mmio, 0x24524, arg_0[3]); 376 351 } 377 352 378 353 static void ··· 388 363 hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]); 389 364 hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]); 390 365 } 391 - hwwrite(vortex->mmio, 0x24528 + i * 0x24, arg_0[0]); 392 - hwwrite(vortex->mmio, 0x2452C + i * 0x24, arg_0[1]); 393 - hwwrite(vortex->mmio, 0x24530 + i * 0x24, arg_0[2]); 394 - hwwrite(vortex->mmio, 0x24534 + i * 0x24, arg_0[3]); 366 + hwwrite(vortex->mmio, 0x24528, arg_0[0]); 367 + hwwrite(vortex->mmio, 0x2452C, arg_0[1]); 368 + hwwrite(vortex->mmio, 0x24530, arg_0[2]); 369 + hwwrite(vortex->mmio, 0x24534, arg_0[3]); 395 370 } 396 371 397 372 #if 0 ··· 475 450 coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24); 476 451 coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24); 477 452 } 478 - arg_0[0] = hwread(vortex->mmio, 0x244F8 + i * 0x24); 479 - arg_0[1] = hwread(vortex->mmio, 0x244FC + i * 0x24); 480 - arg_0[2] = hwread(vortex->mmio, 0x24500 + i * 0x24); 481 - arg_0[3] = hwread(vortex->mmio, 0x24504 + i * 0x24); 453 + arg_0[0] = hwread(vortex->mmio, 0x244F8); 454 + arg_0[1] = hwread(vortex->mmio, 0x244FC); 455 + arg_0[2] = hwread(vortex->mmio, 0x24500); 456 + arg_0[3] = hwread(vortex->mmio, 0x24504); 482 457 } 483 458 484 459 static void ··· 493 468 coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24); 494 469 coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24); 495 470 } 496 - arg_0[0] = hwread(vortex->mmio, 0x24508 + i * 0x24); 497 - arg_0[1] = hwread(vortex->mmio, 0x2450C + i * 0x24); 498 - arg_0[2] = hwread(vortex->mmio, 0x24510 + i * 0x24); 499 - arg_0[3] = hwread(vortex->mmio, 0x24514 + i * 0x24); 471 + arg_0[0] = hwread(vortex->mmio, 0x24508); 472 + arg_0[1] = hwread(vortex->mmio, 0x2450C); 473 + arg_0[2] = hwread(vortex->mmio, 0x24510); 474 + arg_0[3] = hwread(vortex->mmio, 0x24514); 500 475 } 501 476 502 477 static void ··· 511 486 coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24); 512 487 coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24); 513 488 } 514 - arg_0[0] = hwread(vortex->mmio, 0x24518 + i * 0x24); 515 - arg_0[1] = hwread(vortex->mmio, 0x2451C + i * 0x24); 516 - arg_0[2] = hwread(vortex->mmio, 0x24520 + i * 0x24); 517 - arg_0[3] = hwread(vortex->mmio, 0x24524 + i * 0x24); 489 + arg_0[0] = hwread(vortex->mmio, 0x24518); 490 + arg_0[1] = hwread(vortex->mmio, 0x2451C); 491 + arg_0[2] = hwread(vortex->mmio, 0x24520); 492 + arg_0[3] = hwread(vortex->mmio, 0x24524); 518 493 } 519 494 520 495 static void ··· 529 504 coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24); 530 505 coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24); 531 506 } 532 - arg_0[0] = hwread(vortex->mmio, 0x24528 + i * 0x24); 533 - arg_0[1] = hwread(vortex->mmio, 0x2452C + i * 0x24); 534 - arg_0[2] = hwread(vortex->mmio, 0x24530 + i * 0x24); 535 - arg_0[3] = hwread(vortex->mmio, 0x24534 + i * 0x24); 507 + arg_0[0] = hwread(vortex->mmio, 0x24528); 508 + arg_0[1] = hwread(vortex->mmio, 0x2452C); 509 + arg_0[2] = hwread(vortex->mmio, 0x24530); 510 + arg_0[3] = hwread(vortex->mmio, 0x24534); 536 511 } 537 512 538 513 #endif
+1 -1
sound/pci/aw2/aw2-alsa.c
··· 153 153 ********************************/ 154 154 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 155 155 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 156 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 156 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 157 157 158 158 module_param_array(index, int, NULL, 0444); 159 159 MODULE_PARM_DESC(index, "Index value for Audiowerk2 soundcard.");
+1 -1
sound/pci/azt3328.c
··· 301 301 module_param_array(id, charp, NULL, 0444); 302 302 MODULE_PARM_DESC(id, "ID string for AZF3328 soundcard."); 303 303 304 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 304 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 305 305 module_param_array(enable, bool, NULL, 0444); 306 306 MODULE_PARM_DESC(enable, "Enable AZF3328 soundcard."); 307 307
+2 -2
sound/pci/bt87x.c
··· 42 42 43 43 static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ 44 44 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 45 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 45 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 46 46 static int digital_rate[SNDRV_CARDS]; /* digital input rate */ 47 - static int load_all; /* allow to load the non-whitelisted cards */ 47 + static bool load_all; /* allow to load the non-whitelisted cards */ 48 48 49 49 module_param_array(index, int, NULL, 0444); 50 50 MODULE_PARM_DESC(index, "Index value for Bt87x soundcard");
+1 -1
sound/pci/ca0106/ca0106_main.c
··· 156 156 // module parameters (see "Module Parameters") 157 157 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 158 158 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 159 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 159 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 160 160 static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */ 161 161 162 162 module_param_array(index, int, NULL, 0444);
+2 -2
sound/pci/cmipci.c
··· 54 54 55 55 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 56 56 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 57 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 57 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 58 58 static long mpu_port[SNDRV_CARDS]; 59 59 static long fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; 60 - static int soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; 60 + static bool soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; 61 61 #ifdef SUPPORT_JOYSTICK 62 62 static int joystick_port[SNDRV_CARDS]; 63 63 #endif
+2 -2
sound/pci/cs4281.c
··· 44 44 45 45 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 46 46 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 47 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 48 - static int dual_codec[SNDRV_CARDS]; /* dual codec */ 47 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 48 + static bool dual_codec[SNDRV_CARDS]; /* dual codec */ 49 49 50 50 module_param_array(index, int, NULL, 0444); 51 51 MODULE_PARM_DESC(index, "Index value for CS4281 soundcard.");
+4 -4
sound/pci/cs46xx/cs46xx.c
··· 46 46 47 47 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 48 48 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 49 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 50 - static int external_amp[SNDRV_CARDS]; 51 - static int thinkpad[SNDRV_CARDS]; 52 - static int mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 49 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 50 + static bool external_amp[SNDRV_CARDS]; 51 + static bool thinkpad[SNDRV_CARDS]; 52 + static bool mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 53 53 54 54 module_param_array(index, int, NULL, 0444); 55 55 MODULE_PARM_DESC(index, "Index value for the CS46xx soundcard.");
+8 -1
sound/pci/cs5530.c
··· 50 50 51 51 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 52 52 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 53 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 53 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 54 + 55 + module_param_array(index, int, NULL, 0444); 56 + MODULE_PARM_DESC(index, "Index value for CS5530 Audio driver."); 57 + module_param_array(id, charp, NULL, 0444); 58 + MODULE_PARM_DESC(id, "ID string for CS5530 Audio driver."); 59 + module_param_array(enable, bool, NULL, 0444); 60 + MODULE_PARM_DESC(enable, "Enable CS5530 Audio driver."); 54 61 55 62 struct snd_cs5530 { 56 63 struct snd_card *card;
+1 -1
sound/pci/cs5535audio/cs5535audio.c
··· 57 57 58 58 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 59 59 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 60 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 60 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 61 61 62 62 module_param_array(index, int, NULL, 0444); 63 63 MODULE_PARM_DESC(index, "Index value for " DRIVER_NAME);
+1 -1
sound/pci/cs5535audio/cs5535audio_pcm.c
··· 148 148 struct cs5535audio_dma_desc *desc = 149 149 &((struct cs5535audio_dma_desc *) dma->desc_buf.area)[i]; 150 150 desc->addr = cpu_to_le32(addr); 151 - desc->size = cpu_to_le32(period_bytes); 151 + desc->size = cpu_to_le16(period_bytes); 152 152 desc->ctlreserved = cpu_to_le16(PRD_EOP); 153 153 desc_addr += sizeof(struct cs5535audio_dma_desc); 154 154 addr += period_bytes;
+1 -1
sound/pci/ctxfi/ctsrc.c
··· 437 437 438 438 /* Allocate mem for master src resource */ 439 439 if (MEMRD == desc->mode) 440 - src = kzalloc(sizeof(*src)*desc->multi, GFP_KERNEL); 440 + src = kcalloc(desc->multi, sizeof(*src), GFP_KERNEL); 441 441 else 442 442 src = kzalloc(sizeof(*src), GFP_KERNEL); 443 443
+2 -2
sound/pci/ctxfi/cttimer.c
··· 15 15 #include "cthardware.h" 16 16 #include "cttimer.h" 17 17 18 - static int use_system_timer; 19 - MODULE_PARM_DESC(use_system_timer, "Foce to use system-timer"); 18 + static bool use_system_timer; 19 + MODULE_PARM_DESC(use_system_timer, "Force to use system-timer"); 20 20 module_param(use_system_timer, bool, S_IRUGO); 21 21 22 22 struct ct_timer_ops {
+1 -1
sound/pci/ctxfi/xfi.c
··· 32 32 33 33 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 34 34 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 35 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 35 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 36 36 static unsigned int subsystem[SNDRV_CARDS]; 37 37 38 38 module_param_array(index, int, NULL, 0444);
+1 -1
sound/pci/echoaudio/echoaudio.c
··· 26 26 27 27 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 28 28 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 29 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 29 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 30 30 31 31 module_param_array(index, int, NULL, 0444); 32 32 MODULE_PARM_DESC(index, "Index value for " ECHOCARD_NAME " soundcard.");
+2 -2
sound/pci/emu10k1/emu10k1.c
··· 44 44 45 45 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 46 46 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 47 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 47 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 48 48 static int extin[SNDRV_CARDS]; 49 49 static int extout[SNDRV_CARDS]; 50 50 static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4}; 51 51 static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64}; 52 52 static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; 53 - static int enable_ir[SNDRV_CARDS]; 53 + static bool enable_ir[SNDRV_CARDS]; 54 54 static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */ 55 55 static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 56 56
+12
sound/pci/emu10k1/emu10k1_main.c
··· 1480 1480 .spdif_bug = 1, 1481 1481 .invert_shared_spdif = 1, /* digital/analog switch swapped */ 1482 1482 .ac97_chip = 1} , 1483 + /* 0x20051102 also has SB0350 written on it, treated as Audigy 2 ZS by 1484 + Creative's Windows driver */ 1485 + {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20051102, 1486 + .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350a]", 1487 + .id = "Audigy2", 1488 + .emu10k2_chip = 1, 1489 + .ca0102_chip = 1, 1490 + .ca0151_chip = 1, 1491 + .spk71 = 1, 1492 + .spdif_bug = 1, 1493 + .invert_shared_spdif = 1, /* digital/analog switch swapped */ 1494 + .ac97_chip = 1} , 1483 1495 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102, 1484 1496 .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350]", 1485 1497 .id = "Audigy2",
+1 -1
sound/pci/emu10k1/emu10k1x.c
··· 50 50 // module parameters (see "Module Parameters") 51 51 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 52 52 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 53 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 53 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 54 54 55 55 module_param_array(index, int, NULL, 0444); 56 56 MODULE_PARM_DESC(index, "Index value for the EMU10K1X soundcard.");
+2 -2
sound/pci/ens1370.c
··· 83 83 84 84 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 85 85 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 86 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 86 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 87 87 #ifdef SUPPORT_JOYSTICK 88 88 #ifdef CHIP1371 89 89 static int joystick_port[SNDRV_CARDS]; 90 90 #else 91 - static int joystick[SNDRV_CARDS]; 91 + static bool joystick[SNDRV_CARDS]; 92 92 #endif 93 93 #endif 94 94 #ifdef CHIP1371
+1 -1
sound/pci/es1938.c
··· 79 79 80 80 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 81 81 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 82 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 82 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 83 83 84 84 module_param_array(index, int, NULL, 0444); 85 85 MODULE_PARM_DESC(index, "Index value for ESS Solo-1 soundcard.");
+2 -2
sound/pci/es1968.c
··· 132 132 133 133 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ 134 134 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 135 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 135 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 136 136 static int total_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1024 }; 137 137 static int pcm_substreams_p[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4 }; 138 138 static int pcm_substreams_c[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 }; ··· 140 140 static int use_pm[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 141 141 static int enable_mpu[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 142 142 #ifdef SUPPORT_JOYSTICK 143 - static int joystick[SNDRV_CARDS]; 143 + static bool joystick[SNDRV_CARDS]; 144 144 #endif 145 145 146 146 module_param_array(index, int, NULL, 0444);
+1 -1
sound/pci/fm801.c
··· 48 48 49 49 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 50 50 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 51 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 51 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 52 52 /* 53 53 * Enable TEA575x tuner 54 54 * 1 = MediaForte 256-PCS
+3 -3
sound/pci/hda/hda_codec.c
··· 4046 4046 4047 4047 /* Search for codec ID */ 4048 4048 for (q = tbl; q->subvendor; q++) { 4049 - unsigned long vendorid = (q->subdevice) | (q->subvendor << 16); 4050 - 4051 - if (vendorid == codec->subsystem_id) 4049 + unsigned int mask = 0xffff0000 | q->subdevice_mask; 4050 + unsigned int id = (q->subdevice | (q->subvendor << 16)) & mask; 4051 + if ((codec->subsystem_id & mask) == id) 4052 4052 break; 4053 4053 } 4054 4054
+19 -9
sound/pci/hda/hda_eld.c
··· 347 347 348 348 for (i = 0; i < size; i++) { 349 349 unsigned int val = hdmi_get_eld_data(codec, nid, i); 350 + /* 351 + * Graphics driver might be writing to ELD buffer right now. 352 + * Just abort. The caller will repoll after a while. 353 + */ 350 354 if (!(val & AC_ELDD_ELD_VALID)) { 351 - if (!i) { 352 - snd_printd(KERN_INFO 353 - "HDMI: invalid ELD data\n"); 354 - ret = -EINVAL; 355 - goto error; 356 - } 357 355 snd_printd(KERN_INFO 358 356 "HDMI: invalid ELD data byte %d\n", i); 359 - val = 0; 360 - } else 361 - val &= AC_ELDD_ELD_DATA; 357 + ret = -EINVAL; 358 + goto error; 359 + } 360 + val &= AC_ELDD_ELD_DATA; 361 + /* 362 + * The first byte cannot be zero. This can happen on some DVI 363 + * connections. Some Intel chips may also need some 250ms delay 364 + * to return non-zero ELD data, even when the graphics driver 365 + * correctly writes ELD content before setting ELD_valid bit. 366 + */ 367 + if (!val && !i) { 368 + snd_printdd(KERN_INFO "HDMI: 0 ELD data\n"); 369 + ret = -EINVAL; 370 + goto error; 371 + } 362 372 buf[i] = val; 363 373 } 364 374
+4 -5
sound/pci/hda/hda_intel.c
··· 58 58 59 59 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 60 60 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 61 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 61 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 62 62 static char *model[SNDRV_CARDS]; 63 63 static int position_fix[SNDRV_CARDS]; 64 64 static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 65 65 static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 66 66 static int probe_only[SNDRV_CARDS]; 67 - static int single_cmd; 67 + static bool single_cmd; 68 68 static int enable_msi = -1; 69 69 #ifdef CONFIG_SND_HDA_PATCH_LOADER 70 70 static char *patch[SNDRV_CARDS]; ··· 116 116 * this may give more power-saving, but will take longer time to 117 117 * wake up. 118 118 */ 119 - static int power_save_controller = 1; 119 + static bool power_save_controller = 1; 120 120 module_param(power_save_controller, bool, 0644); 121 121 MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); 122 122 #endif 123 123 124 - static int align_buffer_size = 1; 124 + static bool align_buffer_size = 1; 125 125 module_param(align_buffer_size, bool, 0644); 126 126 MODULE_PARM_DESC(align_buffer_size, 127 127 "Force buffer and period sizes to be multiple of 128 bytes."); ··· 2508 2508 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), 2509 2509 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), 2510 2510 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), 2511 - SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), 2512 2511 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), 2513 2512 SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), 2514 2513 SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
+23 -9
sound/pci/hda/patch_cirrus.c
··· 58 58 unsigned int gpio_mask; 59 59 unsigned int gpio_dir; 60 60 unsigned int gpio_data; 61 + unsigned int gpio_eapd_hp; /* EAPD GPIO bit for headphones */ 62 + unsigned int gpio_eapd_speaker; /* EAPD GPIO bit for speakers */ 61 63 62 64 struct hda_pcm pcm_rec[2]; /* PCM information */ 63 65 ··· 78 76 CS420X_MBP53, 79 77 CS420X_MBP55, 80 78 CS420X_IMAC27, 79 + CS420X_APPLE, 81 80 CS420X_AUTO, 82 81 CS420X_MODELS 83 82 }; ··· 931 928 spdif_present ? 0 : PIN_OUT); 932 929 } 933 930 } 934 - if (spec->board_config == CS420X_MBP53 || 935 - spec->board_config == CS420X_MBP55 || 936 - spec->board_config == CS420X_IMAC27) { 937 - unsigned int gpio = hp_present ? 0x02 : 0x08; 931 + if (spec->gpio_eapd_hp) { 932 + unsigned int gpio = hp_present ? 933 + spec->gpio_eapd_hp : spec->gpio_eapd_speaker; 938 934 snd_hda_codec_write(codec, 0x01, 0, 939 935 AC_VERB_SET_GPIO_DATA, gpio); 940 936 } ··· 1278 1276 [CS420X_MBP53] = "mbp53", 1279 1277 [CS420X_MBP55] = "mbp55", 1280 1278 [CS420X_IMAC27] = "imac27", 1279 + [CS420X_APPLE] = "apple", 1281 1280 [CS420X_AUTO] = "auto", 1282 1281 }; 1283 1282 ··· 1288 1285 SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), 1289 1286 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), 1290 1287 SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), 1291 - SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27), 1288 + /* this conflicts with too many other models */ 1289 + /*SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),*/ 1290 + {} /* terminator */ 1291 + }; 1292 + 1293 + static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = { 1294 + SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), 1292 1295 {} /* terminator */ 1293 1296 }; 1294 1297 ··· 1376 1367 spec->board_config = 1377 1368 snd_hda_check_board_config(codec, CS420X_MODELS, 1378 1369 cs420x_models, cs420x_cfg_tbl); 1370 + if (spec->board_config < 0) 1371 + spec->board_config = 1372 + snd_hda_check_board_codec_sid_config(codec, 1373 + CS420X_MODELS, NULL, cs420x_codec_cfg_tbl); 1379 1374 if (spec->board_config >= 0) 1380 1375 fix_pincfg(codec, spec->board_config, cs_pincfgs); 1381 1376 ··· 1387 1374 case CS420X_IMAC27: 1388 1375 case CS420X_MBP53: 1389 1376 case CS420X_MBP55: 1390 - /* GPIO1 = headphones */ 1391 - /* GPIO3 = speakers */ 1392 - spec->gpio_mask = 0x0a; 1393 - spec->gpio_dir = 0x0a; 1377 + case CS420X_APPLE: 1378 + spec->gpio_eapd_hp = 2; /* GPIO1 = headphones */ 1379 + spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */ 1380 + spec->gpio_mask = spec->gpio_dir = 1381 + spec->gpio_eapd_hp | spec->gpio_eapd_speaker; 1394 1382 break; 1395 1383 } 1396 1384
+10 -6
sound/pci/hda/patch_hdmi.c
··· 69 69 struct hda_codec *codec; 70 70 struct hdmi_eld sink_eld; 71 71 struct delayed_work work; 72 + int repoll_count; 72 73 }; 73 74 74 75 struct hdmi_spec { ··· 749 748 * Unsolicited events 750 749 */ 751 750 752 - static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry); 751 + static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll); 753 752 754 753 static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) 755 754 { ··· 767 766 if (pin_idx < 0) 768 767 return; 769 768 770 - hdmi_present_sense(&spec->pins[pin_idx], true); 769 + hdmi_present_sense(&spec->pins[pin_idx], 1); 771 770 } 772 771 773 772 static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) ··· 961 960 return 0; 962 961 } 963 962 964 - static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, bool retry) 963 + static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll) 965 964 { 966 965 struct hda_codec *codec = per_pin->codec; 967 966 struct hdmi_eld *eld = &per_pin->sink_eld; ··· 990 989 if (eld_valid) { 991 990 if (!snd_hdmi_get_eld(eld, codec, pin_nid)) 992 991 snd_hdmi_show_eld(eld); 993 - else if (retry) { 992 + else if (repoll) { 994 993 queue_delayed_work(codec->bus->workq, 995 994 &per_pin->work, 996 995 msecs_to_jiffies(300)); ··· 1005 1004 struct hdmi_spec_per_pin *per_pin = 1006 1005 container_of(to_delayed_work(work), struct hdmi_spec_per_pin, work); 1007 1006 1008 - hdmi_present_sense(per_pin, false); 1007 + if (per_pin->repoll_count++ > 6) 1008 + per_pin->repoll_count = 0; 1009 + 1010 + hdmi_present_sense(per_pin, per_pin->repoll_count); 1009 1011 } 1010 1012 1011 1013 static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid) ··· 1239 1235 if (err < 0) 1240 1236 return err; 1241 1237 1242 - hdmi_present_sense(per_pin, false); 1238 + hdmi_present_sense(per_pin, 0); 1243 1239 return 0; 1244 1240 } 1245 1241
+23 -11
sound/pci/hda/patch_realtek.c
··· 277 277 return false; 278 278 } 279 279 280 + static inline hda_nid_t get_capsrc(struct alc_spec *spec, int idx) 281 + { 282 + return spec->capsrc_nids ? 283 + spec->capsrc_nids[idx] : spec->adc_nids[idx]; 284 + } 285 + 280 286 /* select the given imux item; either unmute exclusively or select the route */ 281 287 static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, 282 288 unsigned int idx, bool force) ··· 309 303 adc_idx = spec->dyn_adc_idx[idx]; 310 304 } 311 305 312 - nid = spec->capsrc_nids ? 313 - spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; 306 + nid = get_capsrc(spec, adc_idx); 314 307 315 308 /* no selection? */ 316 309 num_conns = snd_hda_get_conn_list(codec, nid, NULL); ··· 1059 1054 spec->imux_pins[2] = spec->dock_mic_pin; 1060 1055 for (i = 0; i < 3; i++) { 1061 1056 strcpy(imux->items[i].label, texts[i]); 1062 - if (spec->imux_pins[i]) 1057 + if (spec->imux_pins[i]) { 1058 + hda_nid_t pin = spec->imux_pins[i]; 1059 + int c; 1060 + for (c = 0; c < spec->num_adc_nids; c++) { 1061 + hda_nid_t cap = get_capsrc(spec, c); 1062 + int idx = get_connection_index(codec, cap, pin); 1063 + if (idx >= 0) { 1064 + imux->items[i].index = idx; 1065 + break; 1066 + } 1067 + } 1063 1068 imux->num_items = i + 1; 1069 + } 1064 1070 } 1065 1071 spec->num_mux_defs = 1; 1066 1072 spec->input_mux = imux; ··· 1973 1957 if (!kctl) 1974 1958 kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); 1975 1959 for (i = 0; kctl && i < kctl->count; i++) { 1976 - const hda_nid_t *nids = spec->capsrc_nids; 1977 - if (!nids) 1978 - nids = spec->adc_nids; 1979 - err = snd_hda_add_nid(codec, kctl, i, nids[i]); 1960 + err = snd_hda_add_nid(codec, kctl, i, 1961 + get_capsrc(spec, i)); 1980 1962 if (err < 0) 1981 1963 return err; 1982 1964 } ··· 2761 2747 } 2762 2748 2763 2749 for (c = 0; c < num_adcs; c++) { 2764 - hda_nid_t cap = spec->capsrc_nids ? 2765 - spec->capsrc_nids[c] : spec->adc_nids[c]; 2750 + hda_nid_t cap = get_capsrc(spec, c); 2766 2751 idx = get_connection_index(codec, cap, pin); 2767 2752 if (idx >= 0) { 2768 2753 spec->imux_pins[imux->num_items] = pin; ··· 3707 3694 if (!pin) 3708 3695 return 0; 3709 3696 for (i = 0; i < spec->num_adc_nids; i++) { 3710 - hda_nid_t cap = spec->capsrc_nids ? 3711 - spec->capsrc_nids[i] : spec->adc_nids[i]; 3697 + hda_nid_t cap = get_capsrc(spec, i); 3712 3698 int idx; 3713 3699 3714 3700 idx = get_connection_index(codec, cap, pin);
+5 -19
sound/pci/hda/patch_sigmatel.c
··· 1641 1641 "Alienware M17x", STAC_ALIENWARE_M17X), 1642 1642 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, 1643 1643 "Alienware M17x", STAC_ALIENWARE_M17X), 1644 + SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0490, 1645 + "Alienware M17x", STAC_ALIENWARE_M17X), 1644 1646 {} /* terminator */ 1645 1647 }; 1646 1648 ··· 4441 4439 int pinctl, def_conf; 4442 4440 4443 4441 /* power on when no jack detection is available */ 4444 - if (!spec->hp_detect) { 4442 + /* or when the VREF is used for controlling LED */ 4443 + if (!spec->hp_detect || 4444 + (spec->gpio_led > 8 && spec->gpio_led == nid)) { 4445 4445 stac_toggle_power_map(codec, nid, 1); 4446 4446 continue; 4447 4447 } ··· 5057 5053 return 0; 5058 5054 } 5059 5055 5060 - static int stac92xx_post_suspend(struct hda_codec *codec) 5061 - { 5062 - struct sigmatel_spec *spec = codec->spec; 5063 - if (spec->gpio_led > 8) { 5064 - /* with vref-out pin used for mute led control 5065 - * codec AFG is prevented from D3 state, but on 5066 - * system suspend it can (and should) be used 5067 - */ 5068 - snd_hda_codec_read(codec, codec->afg, 0, 5069 - AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 5070 - } 5071 - return 0; 5072 - } 5073 - 5074 5056 static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg, 5075 5057 unsigned int power_state) 5076 5058 { ··· 5656 5666 } else { 5657 5667 codec->patch_ops.set_power_state = 5658 5668 stac92xx_set_power_state; 5659 - codec->patch_ops.post_suspend = 5660 - stac92xx_post_suspend; 5661 5669 } 5662 5670 codec->patch_ops.pre_resume = stac92xx_pre_resume; 5663 5671 codec->patch_ops.check_power_status = ··· 5969 5981 } else { 5970 5982 codec->patch_ops.set_power_state = 5971 5983 stac92xx_set_power_state; 5972 - codec->patch_ops.post_suspend = 5973 - stac92xx_post_suspend; 5974 5984 } 5975 5985 codec->patch_ops.pre_resume = stac92xx_pre_resume; 5976 5986 codec->patch_ops.check_power_status =
+45 -35
sound/pci/hda/patch_via.c
··· 208 208 /* work to check hp jack state */ 209 209 struct hda_codec *codec; 210 210 struct delayed_work vt1708_hp_work; 211 + int hp_work_active; 211 212 int vt1708_jack_detect; 212 213 int vt1708_hp_present; 213 214 ··· 306 305 static void analog_low_current_mode(struct hda_codec *codec); 307 306 static bool is_aa_path_mute(struct hda_codec *codec); 308 307 309 - static void vt1708_start_hp_work(struct via_spec *spec) 310 - { 311 - if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) 312 - return; 313 - snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 314 - !spec->vt1708_jack_detect); 315 - if (!delayed_work_pending(&spec->vt1708_hp_work)) 316 - schedule_delayed_work(&spec->vt1708_hp_work, 317 - msecs_to_jiffies(100)); 318 - } 308 + #define hp_detect_with_aa(codec) \ 309 + (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1 && \ 310 + !is_aa_path_mute(codec)) 319 311 320 312 static void vt1708_stop_hp_work(struct via_spec *spec) 321 313 { 322 314 if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) 323 315 return; 324 - if (snd_hda_get_bool_hint(spec->codec, "analog_loopback_hp_detect") == 1 325 - && !is_aa_path_mute(spec->codec)) 316 + if (spec->hp_work_active) { 317 + snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 1); 318 + cancel_delayed_work_sync(&spec->vt1708_hp_work); 319 + spec->hp_work_active = 0; 320 + } 321 + } 322 + 323 + static void vt1708_update_hp_work(struct via_spec *spec) 324 + { 325 + if (spec->codec_type != VT1708 || spec->autocfg.hp_pins[0] == 0) 326 326 return; 327 - snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 328 - !spec->vt1708_jack_detect); 329 - cancel_delayed_work_sync(&spec->vt1708_hp_work); 327 + if (spec->vt1708_jack_detect && 328 + (spec->active_streams || hp_detect_with_aa(spec->codec))) { 329 + if (!spec->hp_work_active) { 330 + snd_hda_codec_write(spec->codec, 0x1, 0, 0xf81, 0); 331 + schedule_delayed_work(&spec->vt1708_hp_work, 332 + msecs_to_jiffies(100)); 333 + spec->hp_work_active = 1; 334 + } 335 + } else if (!hp_detect_with_aa(spec->codec)) 336 + vt1708_stop_hp_work(spec); 330 337 } 331 338 332 339 static void set_widgets_power_state(struct hda_codec *codec) ··· 352 343 353 344 set_widgets_power_state(codec); 354 345 analog_low_current_mode(snd_kcontrol_chip(kcontrol)); 355 - if (snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") == 1) { 356 - if (is_aa_path_mute(codec)) 357 - vt1708_start_hp_work(codec->spec); 358 - else 359 - vt1708_stop_hp_work(codec->spec); 360 - } 346 + vt1708_update_hp_work(codec->spec); 361 347 return change; 362 348 } 363 349 ··· 1158 1154 spec->cur_dac_stream_tag = stream_tag; 1159 1155 spec->cur_dac_format = format; 1160 1156 mutex_unlock(&spec->config_mutex); 1161 - vt1708_start_hp_work(spec); 1157 + vt1708_update_hp_work(spec); 1162 1158 return 0; 1163 1159 } 1164 1160 ··· 1178 1174 spec->cur_hp_stream_tag = stream_tag; 1179 1175 spec->cur_hp_format = format; 1180 1176 mutex_unlock(&spec->config_mutex); 1181 - vt1708_start_hp_work(spec); 1177 + vt1708_update_hp_work(spec); 1182 1178 return 0; 1183 1179 } 1184 1180 ··· 1192 1188 snd_hda_multi_out_analog_cleanup(codec, &spec->multiout); 1193 1189 spec->active_streams &= ~STREAM_MULTI_OUT; 1194 1190 mutex_unlock(&spec->config_mutex); 1195 - vt1708_stop_hp_work(spec); 1191 + vt1708_update_hp_work(spec); 1196 1192 return 0; 1197 1193 } 1198 1194 ··· 1207 1203 snd_hda_codec_setup_stream(codec, spec->hp_dac_nid, 0, 0, 0); 1208 1204 spec->active_streams &= ~STREAM_INDEP_HP; 1209 1205 mutex_unlock(&spec->config_mutex); 1210 - vt1708_stop_hp_work(spec); 1206 + vt1708_update_hp_work(spec); 1211 1207 return 0; 1212 1208 } 1213 1209 ··· 1649 1645 int nums; 1650 1646 struct via_spec *spec = codec->spec; 1651 1647 1652 - if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0]) 1648 + if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] && 1649 + (spec->codec_type != VT1708 || spec->vt1708_jack_detect)) 1653 1650 present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); 1654 1651 1655 1652 if (spec->smart51_enabled) ··· 2617 2612 2618 2613 if (spec->codec_type != VT1708) 2619 2614 return 0; 2620 - spec->vt1708_jack_detect = 2621 - !((snd_hda_codec_read(codec, 0x1, 0, 0xf84, 0) >> 8) & 0x1); 2622 2615 ucontrol->value.integer.value[0] = spec->vt1708_jack_detect; 2623 2616 return 0; 2624 2617 } ··· 2626 2623 { 2627 2624 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2628 2625 struct via_spec *spec = codec->spec; 2629 - int change; 2626 + int val; 2630 2627 2631 2628 if (spec->codec_type != VT1708) 2632 2629 return 0; 2633 - spec->vt1708_jack_detect = ucontrol->value.integer.value[0]; 2634 - change = (0x1 & (snd_hda_codec_read(codec, 0x1, 0, 0xf84, 0) >> 8)) 2635 - == !spec->vt1708_jack_detect; 2636 - if (spec->vt1708_jack_detect) { 2630 + val = !!ucontrol->value.integer.value[0]; 2631 + if (spec->vt1708_jack_detect == val) 2632 + return 0; 2633 + spec->vt1708_jack_detect = val; 2634 + if (spec->vt1708_jack_detect && 2635 + snd_hda_get_bool_hint(codec, "analog_loopback_hp_detect") != 1) { 2637 2636 mute_aa_path(codec, 1); 2638 2637 notify_aa_path_ctls(codec); 2639 2638 } 2640 - return change; 2639 + via_hp_automute(codec); 2640 + vt1708_update_hp_work(spec); 2641 + return 1; 2641 2642 } 2642 2643 2643 2644 static const struct snd_kcontrol_new vt1708_jack_detect_ctl = { ··· 2778 2771 via_auto_init_unsol_event(codec); 2779 2772 2780 2773 via_hp_automute(codec); 2774 + vt1708_update_hp_work(spec); 2781 2775 2782 2776 return 0; 2783 2777 } ··· 2795 2787 spec->vt1708_hp_present ^= 1; 2796 2788 via_hp_automute(spec->codec); 2797 2789 } 2798 - vt1708_start_hp_work(spec); 2790 + if (spec->vt1708_jack_detect) 2791 + schedule_delayed_work(&spec->vt1708_hp_work, 2792 + msecs_to_jiffies(100)); 2799 2793 } 2800 2794 2801 2795 static int get_mux_nids(struct hda_codec *codec)
+5 -2
sound/pci/ice1712/amp.c
··· 68 68 69 69 static int __devinit snd_vt1724_amp_add_controls(struct snd_ice1712 *ice) 70 70 { 71 - /* we use pins 39 and 41 of the VT1616 for left and right read outputs */ 72 - snd_ac97_write_cache(ice->ac97, 0x5a, snd_ac97_read(ice->ac97, 0x5a) & ~0x8000); 71 + if (ice->ac97) 72 + /* we use pins 39 and 41 of the VT1616 for left and right 73 + read outputs */ 74 + snd_ac97_write_cache(ice->ac97, 0x5a, 75 + snd_ac97_read(ice->ac97, 0x5a) & ~0x8000); 73 76 return 0; 74 77 } 75 78
+1
sound/pci/ice1712/envy24ht.h
··· 66 66 #define VT1724_CFG_CLOCK384 0x40 /* 16.9344Mhz, 44.1kHz*384 */ 67 67 #define VT1724_CFG_MPU401 0x20 /* MPU401 UARTs */ 68 68 #define VT1724_CFG_ADC_MASK 0x0c /* one, two or one and S/PDIF, stereo ADCs */ 69 + #define VT1724_CFG_ADC_NONE 0x0c /* no ADCs */ 69 70 #define VT1724_CFG_DAC_MASK 0x03 /* one, two, three, four stereo DACs */ 70 71 71 72 #define VT1724_REG_AC97_CFG 0x05 /* byte */
+2 -2
sound/pci/ice1712/ice1712.c
··· 84 84 85 85 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 86 86 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 87 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 87 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 88 88 static char *model[SNDRV_CARDS]; 89 - static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ 89 + static bool omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ 90 90 static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transceiver reset timeout value in msec */ 91 91 static int dxr_enable[SNDRV_CARDS]; /* DXR enable for DMX6FIRE */ 92 92
+57 -8
sound/pci/ice1712/ice1724.c
··· 80 80 81 81 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 82 82 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 83 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 83 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 84 84 static char *model[SNDRV_CARDS]; 85 85 86 86 module_param_array(index, int, NULL, 0444); ··· 1117 1117 static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device) 1118 1118 { 1119 1119 struct snd_pcm *pcm; 1120 - int err; 1120 + int capt, err; 1121 1121 1122 - err = snd_pcm_new(ice->card, "ICE1724", device, 1, 1, &pcm); 1122 + if ((ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_ADC_MASK) == 1123 + VT1724_CFG_ADC_NONE) 1124 + capt = 0; 1125 + else 1126 + capt = 1; 1127 + err = snd_pcm_new(ice->card, "ICE1724", device, 1, capt, &pcm); 1123 1128 if (err < 0) 1124 1129 return err; 1125 1130 1126 1131 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_vt1724_playback_pro_ops); 1127 - snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_vt1724_capture_pro_ops); 1132 + if (capt) 1133 + snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, 1134 + &snd_vt1724_capture_pro_ops); 1128 1135 1129 1136 pcm->private_data = ice; 1130 1137 pcm->info_flags = 0; ··· 1832 1825 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1833 1826 uinfo->count = 1; 1834 1827 1835 - uinfo->value.enumerated.items = hw_rates_count + ice->ext_clock_count; 1828 + /* internal clocks */ 1829 + uinfo->value.enumerated.items = hw_rates_count; 1830 + /* external clocks */ 1831 + if (ice->force_rdma1 || 1832 + (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_IN)) 1833 + uinfo->value.enumerated.items += ice->ext_clock_count; 1836 1834 /* upper limit - keep at top */ 1837 1835 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 1838 1836 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; ··· 2185 2173 2186 2174 static struct snd_ice1712_card_info no_matched __devinitdata; 2187 2175 2176 + 2177 + /* 2178 + ooAoo cards with no controls 2179 + */ 2180 + static unsigned char ooaoo_sq210_eeprom[] __devinitdata = { 2181 + [ICE_EEP2_SYSCONF] = 0x4c, /* 49MHz crystal, no mpu401, no ADC, 2182 + 1xDACs */ 2183 + [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 2184 + [ICE_EEP2_I2S] = 0x78, /* no volume, 96k, 24bit, 192k */ 2185 + [ICE_EEP2_SPDIF] = 0xc1, /* out-en, out-int, out-ext */ 2186 + [ICE_EEP2_GPIO_DIR] = 0x00, /* no GPIOs are used */ 2187 + [ICE_EEP2_GPIO_DIR1] = 0x00, 2188 + [ICE_EEP2_GPIO_DIR2] = 0x00, 2189 + [ICE_EEP2_GPIO_MASK] = 0xff, 2190 + [ICE_EEP2_GPIO_MASK1] = 0xff, 2191 + [ICE_EEP2_GPIO_MASK2] = 0xff, 2192 + 2193 + [ICE_EEP2_GPIO_STATE] = 0x00, /* inputs */ 2194 + [ICE_EEP2_GPIO_STATE1] = 0x00, /* all 1, but GPIO_CPLD_RW 2195 + and GPIO15 always zero */ 2196 + [ICE_EEP2_GPIO_STATE2] = 0x00, /* inputs */ 2197 + }; 2198 + 2199 + 2200 + struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] __devinitdata = { 2201 + { 2202 + .name = "ooAoo SQ210a", 2203 + .model = "sq210a", 2204 + .eeprom_size = sizeof(ooaoo_sq210_eeprom), 2205 + .eeprom_data = ooaoo_sq210_eeprom, 2206 + }, 2207 + { } /* terminator */ 2208 + }; 2209 + 2188 2210 static struct snd_ice1712_card_info *card_tables[] __devinitdata = { 2189 2211 snd_vt1724_revo_cards, 2190 2212 snd_vt1724_amp_cards, ··· 2233 2187 snd_vt1724_wtm_cards, 2234 2188 snd_vt1724_se_cards, 2235 2189 snd_vt1724_qtet_cards, 2190 + snd_vt1724_ooaoo_cards, 2236 2191 NULL, 2237 2192 }; 2238 2193 ··· 2317 2270 } 2318 2271 } 2319 2272 for (tbl = card_tables; *tbl; tbl++) { 2320 - for (c = *tbl; c->subvendor; c++) { 2273 + for (c = *tbl; c->name; c++) { 2321 2274 if (modelname && c->model && 2322 2275 !strcmp(modelname, c->model)) { 2323 2276 printk(KERN_INFO "ice1724: Using board model %s\n", ··· 2626 2579 ice->ext_clock_count = 0; 2627 2580 2628 2581 for (tbl = card_tables; *tbl; tbl++) { 2629 - for (c = *tbl; c->subvendor; c++) { 2630 - if (c->subvendor == ice->eeprom.subvendor) { 2582 + for (c = *tbl; c->name; c++) { 2583 + if ((model[dev] && c->model && 2584 + !strcmp(model[dev], c->model)) || 2585 + (c->subvendor == ice->eeprom.subvendor)) { 2631 2586 strcpy(card->shortname, c->name); 2632 2587 if (c->driver) /* specific driver? */ 2633 2588 strcpy(card->driver, c->driver);
+3 -3
sound/pci/intel8x0.c
··· 79 79 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 80 80 static int ac97_clock; 81 81 static char *ac97_quirk; 82 - static int buggy_semaphore; 82 + static bool buggy_semaphore; 83 83 static int buggy_irq = -1; /* auto-check */ 84 - static int xbox; 84 + static bool xbox; 85 85 static int spdif_aclink = -1; 86 86 static int inside_vm = -1; 87 87 ··· 105 105 MODULE_PARM_DESC(inside_vm, "KVM/Parallels optimization."); 106 106 107 107 /* just for backward compatibility */ 108 - static int enable; 108 + static bool enable; 109 109 module_param(enable, bool, 0444); 110 110 static int joystick; 111 111 module_param(joystick, int, 0444);
+1 -1
sound/pci/intel8x0m.c
··· 68 68 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); 69 69 70 70 /* just for backward compatibility */ 71 - static int enable; 71 + static bool enable; 72 72 module_param(enable, bool, 0444); 73 73 74 74 /*
+1 -1
sound/pci/korg1212/korg1212.c
··· 408 408 409 409 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 410 410 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 411 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 411 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 412 412 413 413 module_param_array(index, int, NULL, 0444); 414 414 MODULE_PARM_DESC(index, "Index value for Korg 1212 soundcard.");
+1 -1
sound/pci/lola/lola.c
··· 35 35 /* Standard options */ 36 36 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 37 37 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 38 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 38 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 39 39 40 40 module_param_array(index, int, NULL, 0444); 41 41 MODULE_PARM_DESC(index, "Index value for Digigram Lola driver.");
+1 -1
sound/pci/lx6464es/lx6464es.c
··· 42 42 43 43 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 44 44 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 45 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 45 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 46 46 47 47 module_param_array(index, int, NULL, 0444); 48 48 MODULE_PARM_DESC(index, "Index value for Digigram LX6464ES interface.");
+16 -7
sound/pci/lx6464es/lx_core.c
··· 78 78 return ioread32(address); 79 79 } 80 80 81 - void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, u32 len) 81 + static void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, 82 + u32 len) 82 83 { 83 - void __iomem *address = lx_dsp_register(chip, port); 84 - memcpy_fromio(data, address, len*sizeof(u32)); 84 + u32 __iomem *address = lx_dsp_register(chip, port); 85 + int i; 86 + 87 + /* we cannot use memcpy_fromio */ 88 + for (i = 0; i != len; ++i) 89 + data[i] = ioread32(address + i); 85 90 } 86 91 87 92 ··· 96 91 iowrite32(data, address); 97 92 } 98 93 99 - void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, const u32 *data, 100 - u32 len) 94 + static void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, 95 + const u32 *data, u32 len) 101 96 { 102 - void __iomem *address = lx_dsp_register(chip, port); 103 - memcpy_toio(address, data, len*sizeof(u32)); 97 + u32 __iomem *address = lx_dsp_register(chip, port); 98 + int i; 99 + 100 + /* we cannot use memcpy_to */ 101 + for (i = 0; i != len; ++i) 102 + iowrite32(data[i], address + i); 104 103 } 105 104 106 105
-3
sound/pci/lx6464es/lx_core.h
··· 72 72 }; 73 73 74 74 unsigned long lx_dsp_reg_read(struct lx6464es *chip, int port); 75 - void lx_dsp_reg_readbuf(struct lx6464es *chip, int port, u32 *data, u32 len); 76 75 void lx_dsp_reg_write(struct lx6464es *chip, int port, unsigned data); 77 - void lx_dsp_reg_writebuf(struct lx6464es *chip, int port, const u32 *data, 78 - u32 len); 79 76 80 77 /* plx register access */ 81 78 enum {
+2 -2
sound/pci/maestro3.c
··· 64 64 65 65 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 66 66 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 67 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */ 68 - static int external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 67 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */ 68 + static bool external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 69 69 static int amp_gpio[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1}; 70 70 71 71 module_param_array(index, int, NULL, 0444);
+1 -1
sound/pci/mixart/mixart.c
··· 49 49 50 50 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 51 51 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 52 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 52 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 53 53 54 54 module_param_array(index, int, NULL, 0444); 55 55 MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard.");
+6 -6
sound/pci/nm256/nm256.c
··· 57 57 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 58 58 static int playback_bufsize = 16; 59 59 static int capture_bufsize = 16; 60 - static int force_ac97; /* disabled as default */ 60 + static bool force_ac97; /* disabled as default */ 61 61 static int buffer_top; /* not specified */ 62 - static int use_cache; /* disabled */ 63 - static int vaio_hack; /* disabled */ 64 - static int reset_workaround; 65 - static int reset_workaround_2; 62 + static bool use_cache; /* disabled */ 63 + static bool vaio_hack; /* disabled */ 64 + static bool reset_workaround; 65 + static bool reset_workaround_2; 66 66 67 67 module_param(index, int, 0444); 68 68 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); ··· 86 86 MODULE_PARM_DESC(reset_workaround_2, "Enable extended AC97 RESET workaround for some other laptops."); 87 87 88 88 /* just for backward compatibility */ 89 - static int enable; 89 + static bool enable; 90 90 module_param(enable, bool, 0444); 91 91 92 92
+1 -1
sound/pci/oxygen/oxygen.c
··· 74 74 75 75 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 76 76 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 77 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 77 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 78 78 79 79 module_param_array(index, int, NULL, 0444); 80 80 MODULE_PARM_DESC(index, "card index");
+1 -1
sound/pci/oxygen/virtuoso.c
··· 32 32 33 33 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 34 34 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 35 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 35 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 36 36 37 37 module_param_array(index, int, NULL, 0444); 38 38 MODULE_PARM_DESC(index, "card index");
+1
sound/pci/oxygen/xonar_cs43xx.c
··· 418 418 .device_config = PLAYBACK_0_TO_I2S | 419 419 PLAYBACK_1_TO_SPDIF | 420 420 CAPTURE_0_FROM_I2S_2 | 421 + CAPTURE_1_FROM_SPDIF | 421 422 AC97_FMIC_SWITCH, 422 423 .dac_channels_pcm = 8, 423 424 .dac_channels_mixer = 8,
+2 -1
sound/pci/oxygen/xonar_dg.c
··· 597 597 .model_data_size = sizeof(struct dg), 598 598 .device_config = PLAYBACK_0_TO_I2S | 599 599 PLAYBACK_1_TO_SPDIF | 600 - CAPTURE_0_FROM_I2S_2, 600 + CAPTURE_0_FROM_I2S_2 | 601 + CAPTURE_1_FROM_SPDIF, 601 602 .dac_channels_pcm = 6, 602 603 .dac_channels_mixer = 0, 603 604 .function_flags = OXYGEN_FUNCTION_SPI,
+4 -2
sound/pci/oxygen/xonar_wm87x6.c
··· 1274 1274 .model_data_size = sizeof(struct xonar_wm87x6), 1275 1275 .device_config = PLAYBACK_0_TO_I2S | 1276 1276 PLAYBACK_1_TO_SPDIF | 1277 - CAPTURE_0_FROM_I2S_1, 1277 + CAPTURE_0_FROM_I2S_1 | 1278 + CAPTURE_1_FROM_SPDIF, 1278 1279 .dac_channels_pcm = 8, 1279 1280 .dac_channels_mixer = 8, 1280 1281 .dac_volume_min = 255 - 2*60, ··· 1307 1306 .model_data_size = sizeof(struct xonar_wm87x6), 1308 1307 .device_config = PLAYBACK_0_TO_I2S | 1309 1308 PLAYBACK_1_TO_SPDIF | 1310 - CAPTURE_0_FROM_I2S_1, 1309 + CAPTURE_0_FROM_I2S_1 | 1310 + CAPTURE_1_FROM_SPDIF, 1311 1311 .dac_channels_pcm = 8, 1312 1312 .dac_channels_mixer = 2, 1313 1313 .dac_volume_min = 255 - 2*60,
+2 -2
sound/pci/pcxhr/pcxhr.c
··· 52 52 53 53 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 54 54 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 55 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 56 - static int mono[SNDRV_CARDS]; /* capture mono only */ 55 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 56 + static bool mono[SNDRV_CARDS]; /* capture mono only */ 57 57 58 58 module_param_array(index, int, NULL, 0444); 59 59 MODULE_PARM_DESC(index, "Index value for Digigram " DRIVER_NAME " soundcard");
+1 -1
sound/pci/riptide/riptide.c
··· 122 122 123 123 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 124 124 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 125 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 125 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 126 126 127 127 #ifdef SUPPORT_JOYSTICK 128 128 static int joystick_port[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS - 1)] = 0x200 };
+2 -2
sound/pci/rme32.c
··· 89 89 90 90 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 91 91 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 92 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 93 - static int fullduplex[SNDRV_CARDS]; // = {[0 ... (SNDRV_CARDS - 1)] = 1}; 92 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 93 + static bool fullduplex[SNDRV_CARDS]; // = {[0 ... (SNDRV_CARDS - 1)] = 1}; 94 94 95 95 module_param_array(index, int, NULL, 0444); 96 96 MODULE_PARM_DESC(index, "Index value for RME Digi32 soundcard.");
+1 -1
sound/pci/rme96.c
··· 53 53 54 54 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 55 55 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 56 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 56 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 57 57 58 58 module_param_array(index, int, NULL, 0444); 59 59 MODULE_PARM_DESC(index, "Index value for RME Digi96 soundcard.");
+2 -3
sound/pci/rme9652/hdsp.c
··· 45 45 46 46 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 47 47 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 48 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 48 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 49 49 50 50 module_param_array(index, int, NULL, 0444); 51 51 MODULE_PARM_DESC(index, "Index value for RME Hammerfall DSP interface."); ··· 2640 2640 uinfo->value.enumerated.items = 3; 2641 2641 break; 2642 2642 default: 2643 - uinfo->value.enumerated.items = 0; 2644 - break; 2643 + return -EINVAL; 2645 2644 } 2646 2645 2647 2646 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
+27 -7
sound/pci/rme9652/hdspm.c
··· 61 61 62 62 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 63 63 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 64 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 64 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 65 65 66 66 module_param_array(index, int, NULL, 0444); 67 67 MODULE_PARM_DESC(index, "Index value for RME HDSPM interface."); ··· 940 940 int texts_autosync_items; 941 941 942 942 cycles_t last_interrupt; 943 + 944 + unsigned int serial; 943 945 944 946 struct hdspm_peak_rms peak_rms; 945 947 }; ··· 4696 4694 4697 4695 snd_iprintf(buffer, "HW Serial: 0x%06x%06x\n", 4698 4696 (hdspm_read(hdspm, HDSPM_midiStatusIn1)>>8) & 0xFFFFFF, 4699 - (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF); 4697 + hdspm->serial); 4700 4698 4701 4699 snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n", 4702 4700 hdspm->irq, hdspm->port, (unsigned long)hdspm->iobase); ··· 6268 6266 hdspm_version.card_type = hdspm->io_type; 6269 6267 strncpy(hdspm_version.cardname, hdspm->card_name, 6270 6268 sizeof(hdspm_version.cardname)); 6271 - hdspm_version.serial = (hdspm_read(hdspm, 6272 - HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; 6269 + hdspm_version.serial = hdspm->serial; 6273 6270 hdspm_version.firmware_rev = hdspm->firmware_rev; 6274 6271 hdspm_version.addons = 0; 6275 6272 if (hdspm->tco) ··· 6519 6518 hdspm->io_type = AES32; 6520 6519 hdspm->card_name = "RME AES32"; 6521 6520 hdspm->midiPorts = 2; 6522 - } else if ((hdspm->firmware_rev == 0xd5) || 6521 + } else if ((hdspm->firmware_rev == 0xd2) || 6523 6522 ((hdspm->firmware_rev >= 0xc8) && 6524 6523 (hdspm->firmware_rev <= 0xcf))) { 6525 6524 hdspm->io_type = MADI; ··· 6783 6782 tasklet_init(&hdspm->midi_tasklet, 6784 6783 hdspm_midi_tasklet, (unsigned long) hdspm); 6785 6784 6785 + 6786 + if (hdspm->io_type != MADIface) { 6787 + hdspm->serial = (hdspm_read(hdspm, 6788 + HDSPM_midiStatusIn0)>>8) & 0xFFFFFF; 6789 + /* id contains either a user-provided value or the default 6790 + * NULL. If it's the default, we're safe to 6791 + * fill card->id with the serial number. 6792 + * 6793 + * If the serial number is 0xFFFFFF, then we're dealing with 6794 + * an old PCI revision that comes without a sane number. In 6795 + * this case, we don't set card->id to avoid collisions 6796 + * when running with multiple cards. 6797 + */ 6798 + if (NULL == id[hdspm->dev] && hdspm->serial != 0xFFFFFF) { 6799 + sprintf(card->id, "HDSPMx%06x", hdspm->serial); 6800 + snd_card_set_id(card, card->id); 6801 + } 6802 + } 6803 + 6786 6804 snd_printdd("create alsa devices.\n"); 6787 6805 err = snd_hdspm_create_alsa_devices(card, hdspm); 6788 6806 if (err < 0) ··· 6888 6868 if (hdspm->io_type != MADIface) { 6889 6869 sprintf(card->shortname, "%s_%x", 6890 6870 hdspm->card_name, 6891 - (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF); 6871 + hdspm->serial); 6892 6872 sprintf(card->longname, "%s S/N 0x%x at 0x%lx, irq %d", 6893 6873 hdspm->card_name, 6894 - (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF, 6874 + hdspm->serial, 6895 6875 hdspm->port, hdspm->irq); 6896 6876 } else { 6897 6877 sprintf(card->shortname, "%s", hdspm->card_name);
+2 -2
sound/pci/rme9652/rme9652.c
··· 38 38 39 39 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 40 40 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 41 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 42 - static int precise_ptr[SNDRV_CARDS]; /* Enable precise pointer */ 41 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 42 + static bool precise_ptr[SNDRV_CARDS]; /* Enable precise pointer */ 43 43 44 44 module_param_array(index, int, NULL, 0444); 45 45 MODULE_PARM_DESC(index, "Index value for RME Digi9652 (Hammerfall) soundcard.");
+66 -25
sound/pci/sis7019.c
··· 40 40 41 41 static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 42 42 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 43 - static int enable = 1; 43 + static bool enable = 1; 44 + static int codecs = 1; 44 45 45 46 module_param(index, int, 0444); 46 47 MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator."); ··· 49 48 MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator."); 50 49 module_param(enable, bool, 0444); 51 50 MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator."); 51 + module_param(codecs, int, 0444); 52 + MODULE_PARM_DESC(codecs, "Set bit to indicate that codec number is expected to be present (default 1)"); 52 53 53 54 static DEFINE_PCI_DEVICE_TABLE(snd_sis7019_ids) = { 54 55 { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) }, ··· 143 140 dma_addr_t silence_dma_addr; 144 141 }; 145 142 143 + /* These values are also used by the module param 'codecs' to indicate 144 + * which codecs should be present. 145 + */ 146 146 #define SIS_PRIMARY_CODEC_PRESENT 0x0001 147 147 #define SIS_SECONDARY_CODEC_PRESENT 0x0002 148 148 #define SIS_TERTIARY_CODEC_PRESENT 0x0004 ··· 983 977 mutex_unlock(&sis->ac97_mutex); 984 978 985 979 if (!count) { 986 - printk(KERN_ERR "sis7019: ac97 codec %d timeout cmd 0x%08x\n", 980 + dev_err(&sis->pci->dev, "ac97 codec %d timeout cmd 0x%08x\n", 987 981 codec, cmd); 988 982 } 989 983 ··· 1084 1078 { 1085 1079 unsigned long io = sis->ioport; 1086 1080 void __iomem *ioaddr = sis->ioaddr; 1081 + unsigned long timeout; 1087 1082 u16 status; 1088 1083 int count; 1089 1084 int i; ··· 1111 1104 while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count) 1112 1105 udelay(1); 1113 1106 1114 - /* Now that we've finished the reset, find out what's attached. 1115 - */ 1116 - status = inl(io + SIS_AC97_STATUS); 1117 - if (status & SIS_AC97_STATUS_CODEC_READY) 1118 - sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT; 1119 - if (status & SIS_AC97_STATUS_CODEC2_READY) 1120 - sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT; 1121 - if (status & SIS_AC97_STATUS_CODEC3_READY) 1122 - sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT; 1123 - 1124 - /* All done, let go of the semaphore, and check for errors 1107 + /* Command complete, we can let go of the semaphore now. 1125 1108 */ 1126 1109 outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA); 1127 - if (!sis->codecs_present || !count) 1110 + if (!count) 1128 1111 return -EIO; 1112 + 1113 + /* Now that we've finished the reset, find out what's attached. 1114 + * There are some codec/board combinations that take an extremely 1115 + * long time to come up. 350+ ms has been observed in the field, 1116 + * so we'll give them up to 500ms. 1117 + */ 1118 + sis->codecs_present = 0; 1119 + timeout = msecs_to_jiffies(500) + jiffies; 1120 + while (time_before_eq(jiffies, timeout)) { 1121 + status = inl(io + SIS_AC97_STATUS); 1122 + if (status & SIS_AC97_STATUS_CODEC_READY) 1123 + sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT; 1124 + if (status & SIS_AC97_STATUS_CODEC2_READY) 1125 + sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT; 1126 + if (status & SIS_AC97_STATUS_CODEC3_READY) 1127 + sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT; 1128 + 1129 + if (sis->codecs_present == codecs) 1130 + break; 1131 + 1132 + msleep(1); 1133 + } 1134 + 1135 + /* All done, check for errors. 1136 + */ 1137 + if (!sis->codecs_present) { 1138 + dev_err(&sis->pci->dev, "could not find any codecs\n"); 1139 + return -EIO; 1140 + } 1141 + 1142 + if (sis->codecs_present != codecs) { 1143 + dev_warn(&sis->pci->dev, "missing codecs, found %0x, expected %0x\n", 1144 + sis->codecs_present, codecs); 1145 + } 1129 1146 1130 1147 /* Let the hardware know that the audio driver is alive, 1131 1148 * and enable PCM slots on the AC-link for L/R playback (3 & 4) and ··· 1256 1225 pci_restore_state(pci); 1257 1226 1258 1227 if (pci_enable_device(pci) < 0) { 1259 - printk(KERN_ERR "sis7019: unable to re-enable device\n"); 1228 + dev_err(&pci->dev, "unable to re-enable device\n"); 1260 1229 goto error; 1261 1230 } 1262 1231 1263 1232 if (sis_chip_init(sis)) { 1264 - printk(KERN_ERR "sis7019: unable to re-init controller\n"); 1233 + dev_err(&pci->dev, "unable to re-init controller\n"); 1265 1234 goto error; 1266 1235 } 1267 1236 1268 1237 if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, 1269 1238 KBUILD_MODNAME, sis)) { 1270 - printk(KERN_ERR "sis7019: unable to regain IRQ %d\n", pci->irq); 1239 + dev_err(&pci->dev, "unable to regain IRQ %d\n", pci->irq); 1271 1240 goto error; 1272 1241 } 1273 1242 ··· 1335 1304 goto error_out; 1336 1305 1337 1306 if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0) { 1338 - printk(KERN_ERR "sis7019: architecture does not support " 1339 - "30-bit PCI busmaster DMA"); 1307 + dev_err(&pci->dev, "architecture does not support 30-bit PCI busmaster DMA"); 1340 1308 goto error_out_enabled; 1341 1309 } 1342 1310 ··· 1349 1319 1350 1320 rc = pci_request_regions(pci, "SiS7019"); 1351 1321 if (rc) { 1352 - printk(KERN_ERR "sis7019: unable request regions\n"); 1322 + dev_err(&pci->dev, "unable request regions\n"); 1353 1323 goto error_out_enabled; 1354 1324 } 1355 1325 1356 1326 rc = -EIO; 1357 1327 sis->ioaddr = ioremap_nocache(pci_resource_start(pci, 1), 0x4000); 1358 1328 if (!sis->ioaddr) { 1359 - printk(KERN_ERR "sis7019: unable to remap MMIO, aborting\n"); 1329 + dev_err(&pci->dev, "unable to remap MMIO, aborting\n"); 1360 1330 goto error_out_cleanup; 1361 1331 } 1362 1332 1363 1333 rc = sis_alloc_suspend(sis); 1364 1334 if (rc < 0) { 1365 - printk(KERN_ERR "sis7019: unable to allocate state storage\n"); 1335 + dev_err(&pci->dev, "unable to allocate state storage\n"); 1366 1336 goto error_out_cleanup; 1367 1337 } 1368 1338 ··· 1370 1340 if (rc) 1371 1341 goto error_out_cleanup; 1372 1342 1373 - if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, 1374 - KBUILD_MODNAME, sis)) { 1375 - printk(KERN_ERR "unable to allocate irq %d\n", sis->irq); 1343 + if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, KBUILD_MODNAME, 1344 + sis)) { 1345 + dev_err(&pci->dev, "unable to allocate irq %d\n", sis->irq); 1376 1346 goto error_out_cleanup; 1377 1347 } 1378 1348 ··· 1419 1389 rc = -ENOENT; 1420 1390 if (!enable) 1421 1391 goto error_out; 1392 + 1393 + /* The user can specify which codecs should be present so that we 1394 + * can wait for them to show up if they are slow to recover from 1395 + * the AC97 cold reset. We default to a single codec, the primary. 1396 + * 1397 + * We assume that SIS_PRIMARY_*_PRESENT matches bits 0-2. 1398 + */ 1399 + codecs &= SIS_PRIMARY_CODEC_PRESENT | SIS_SECONDARY_CODEC_PRESENT | 1400 + SIS_TERTIARY_CODEC_PRESENT; 1401 + if (!codecs) 1402 + codecs = SIS_PRIMARY_CODEC_PRESENT; 1422 1403 1423 1404 rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card); 1424 1405 if (rc < 0)
+3 -3
sound/pci/sonicvibes.c
··· 52 52 53 53 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 54 54 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 55 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 56 - static int reverb[SNDRV_CARDS]; 57 - static int mge[SNDRV_CARDS]; 55 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 56 + static bool reverb[SNDRV_CARDS]; 57 + static bool mge[SNDRV_CARDS]; 58 58 static unsigned int dmaio = 0x7a00; /* DDMA i/o address */ 59 59 60 60 module_param_array(index, int, NULL, 0444);
+1 -1
sound/pci/trident/trident.c
··· 47 47 48 48 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 49 49 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 50 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 50 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 51 51 static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32}; 52 52 static int wavetable_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8192}; 53 53
+2 -2
sound/pci/via82xx.c
··· 80 80 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 81 81 static long mpu_port; 82 82 #ifdef SUPPORT_JOYSTICK 83 - static int joystick; 83 + static bool joystick; 84 84 #endif 85 85 static int ac97_clock = 48000; 86 86 static char *ac97_quirk; ··· 110 110 MODULE_PARM_DESC(nodelay, "Disable 500ms init delay"); 111 111 112 112 /* just for backward compatibility */ 113 - static int enable; 113 + static bool enable; 114 114 module_param(enable, bool, 0444); 115 115 116 116
+1 -1
sound/pci/via82xx_modem.c
··· 66 66 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); 67 67 68 68 /* just for backward compatibility */ 69 - static int enable; 69 + static bool enable; 70 70 module_param(enable, bool, 0444); 71 71 72 72
+2 -2
sound/pci/vx222/vx222.c
··· 37 37 38 38 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 39 39 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 40 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 41 - static int mic[SNDRV_CARDS]; /* microphone */ 40 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 41 + static bool mic[SNDRV_CARDS]; /* microphone */ 42 42 static int ibl[SNDRV_CARDS]; /* microphone */ 43 43 44 44 module_param_array(index, int, NULL, 0444);
+2 -2
sound/pci/ymfpci/ymfpci.c
··· 41 41 42 42 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 43 43 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 44 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 44 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 45 45 static long fm_port[SNDRV_CARDS]; 46 46 static long mpu_port[SNDRV_CARDS]; 47 47 #ifdef SUPPORT_JOYSTICK 48 48 static long joystick_port[SNDRV_CARDS]; 49 49 #endif 50 - static int rear_switch[SNDRV_CARDS]; 50 + static bool rear_switch[SNDRV_CARDS]; 51 51 52 52 module_param_array(index, int, NULL, 0444); 53 53 MODULE_PARM_DESC(index, "Index value for the Yamaha DS-1 PCI soundcard.");
+1 -1
sound/pcmcia/pdaudiocf/pdaudiocf.c
··· 39 39 40 40 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 41 41 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 42 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 42 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 43 43 44 44 module_param_array(index, int, NULL, 0444); 45 45 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
+1 -1
sound/pcmcia/vx/vxpocket.c
··· 39 39 40 40 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 41 41 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 42 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 42 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 43 43 static int ibl[SNDRV_CARDS]; 44 44 45 45 module_param_array(index, int, NULL, 0444);
+1 -1
sound/ppc/powermac.c
··· 36 36 37 37 static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 38 38 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 39 - static int enable_beep = 1; 39 + static bool enable_beep = 1; 40 40 41 41 module_param(index, int, 0444); 42 42 MODULE_PARM_DESC(index, "Index value for " CHIP_NAME " soundchip.");
+1 -1
sound/sh/aica.c
··· 55 55 #define CARD_NAME "AICA" 56 56 static int index = -1; 57 57 static char *id; 58 - static int enable = 1; 58 + static bool enable = 1; 59 59 module_param(index, int, 0444); 60 60 MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); 61 61 module_param(id, charp, 0444);
+1 -12
sound/sh/sh_dac_audio.c
··· 441 441 }, 442 442 }; 443 443 444 - static int __init sh_dac_init(void) 445 - { 446 - return platform_driver_register(&driver); 447 - } 448 - 449 - static void __exit sh_dac_exit(void) 450 - { 451 - platform_driver_unregister(&driver); 452 - } 453 - 454 - module_init(sh_dac_init); 455 - module_exit(sh_dac_exit); 444 + module_platform_driver(driver);
+1 -1
sound/sparc/amd7930.c
··· 50 50 51 51 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 52 52 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 53 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 53 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 54 54 55 55 module_param_array(index, int, NULL, 0444); 56 56 MODULE_PARM_DESC(index, "Index value for Sun AMD7930 soundcard.");
+2 -13
sound/sparc/cs4231.c
··· 40 40 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 41 41 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 42 42 /* Enable this card */ 43 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 43 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 44 44 45 45 module_param_array(index, int, NULL, 0444); 46 46 MODULE_PARM_DESC(index, "Index value for Sun CS4231 soundcard."); ··· 2118 2118 .remove = __devexit_p(cs4231_remove), 2119 2119 }; 2120 2120 2121 - static int __init cs4231_init(void) 2122 - { 2123 - return platform_driver_register(&cs4231_driver); 2124 - } 2125 - 2126 - static void __exit cs4231_exit(void) 2127 - { 2128 - platform_driver_unregister(&cs4231_driver); 2129 - } 2130 - 2131 - module_init(cs4231_init); 2132 - module_exit(cs4231_exit); 2121 + module_platform_driver(cs4231_driver);
+2 -14
sound/sparc/dbri.c
··· 80 80 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 81 81 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 82 82 /* Enable this card */ 83 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 83 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 84 84 85 85 module_param_array(index, int, NULL, 0444); 86 86 MODULE_PARM_DESC(index, "Index value for Sun DBRI soundcard."); ··· 2697 2697 .remove = __devexit_p(dbri_remove), 2698 2698 }; 2699 2699 2700 - /* Probe for the dbri chip and then attach the driver. */ 2701 - static int __init dbri_init(void) 2702 - { 2703 - return platform_driver_register(&dbri_sbus_driver); 2704 - } 2705 - 2706 - static void __exit dbri_exit(void) 2707 - { 2708 - platform_driver_unregister(&dbri_sbus_driver); 2709 - } 2710 - 2711 - module_init(dbri_init); 2712 - module_exit(dbri_exit); 2700 + module_platform_driver(dbri_sbus_driver);
+1 -1
sound/usb/6fire/chip.c
··· 35 35 36 36 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 37 37 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for card */ 38 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable card */ 38 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable card */ 39 39 static struct sfire_chip *chips[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 40 40 static struct usb_device *devices[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 41 41
+1 -1
sound/usb/caiaq/device.c
··· 55 55 56 56 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 57 57 static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ 58 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 58 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 59 59 static int snd_card_used[SNDRV_CARDS]; 60 60 61 61 module_param_array(index, int, NULL, 0444);
+3 -3
sound/usb/card.c
··· 78 78 79 79 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 80 80 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 81 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 81 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 82 82 /* Vendor/product IDs for this card */ 83 83 static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; 84 84 static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; 85 85 static int nrpacks = 8; /* max. number of packets per urb */ 86 - static int async_unlink = 1; 86 + static bool async_unlink = 1; 87 87 static int device_setup[SNDRV_CARDS]; /* device parameter for this card */ 88 - static int ignore_ctl_error; 88 + static bool ignore_ctl_error; 89 89 90 90 module_param_array(index, int, NULL, 0444); 91 91 MODULE_PARM_DESC(index, "Index value for the USB audio adapter.");
+3 -2
sound/usb/endpoint.c
··· 17 17 18 18 #include <linux/gfp.h> 19 19 #include <linux/init.h> 20 + #include <linux/ratelimit.h> 20 21 #include <linux/usb.h> 21 22 #include <linux/usb/audio.h> 22 23 ··· 459 458 460 459 for (i = 0; i < urb->number_of_packets; i++) { 461 460 cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset; 462 - if (urb->iso_frame_desc[i].status) { 463 - snd_printd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status); 461 + if (urb->iso_frame_desc[i].status && printk_ratelimit()) { 462 + snd_printdd("frame %d active: %d\n", i, urb->iso_frame_desc[i].status); 464 463 // continue; 465 464 } 466 465 bytes = urb->iso_frame_desc[i].actual_length;
+7 -1
sound/usb/format.c
··· 209 209 return 0; 210 210 } 211 211 212 + #define MAX_UAC2_NR_RATES 1024 213 + 212 214 /* 213 215 * Helper function to walk the array of sample rate triplets reported by 214 216 * the device. The problem is that we need to parse whole array first to ··· 228 226 int min = combine_quad(&data[2 + 12 * i]); 229 227 int max = combine_quad(&data[6 + 12 * i]); 230 228 int res = combine_quad(&data[10 + 12 * i]); 231 - int rate; 229 + unsigned int rate; 232 230 233 231 if ((max < 0) || (min < 0) || (res < 0) || (max < min)) 234 232 continue; ··· 255 253 fp->rates |= snd_pcm_rate_to_rate_bit(rate); 256 254 257 255 nr_rates++; 256 + if (nr_rates >= MAX_UAC2_NR_RATES) { 257 + snd_printk(KERN_ERR "invalid uac2 rates\n"); 258 + break; 259 + } 258 260 259 261 /* avoid endless loop */ 260 262 if (res == 0)
+1 -1
sound/usb/misc/ua101.c
··· 52 52 53 53 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 54 54 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 55 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 55 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 56 56 static unsigned int queue_length = 21; 57 57 58 58 module_param_array(index, int, NULL, 0444);
+67
sound/usb/quirks-table.h
··· 269 269 YAMAHA_DEVICE(0x105b, NULL), 270 270 YAMAHA_DEVICE(0x105c, NULL), 271 271 YAMAHA_DEVICE(0x105d, NULL), 272 + { 273 + USB_DEVICE(0x0499, 0x1503), 274 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 275 + /* .vendor_name = "Yamaha", */ 276 + /* .product_name = "MOX6/MOX8", */ 277 + .ifnum = QUIRK_ANY_INTERFACE, 278 + .type = QUIRK_COMPOSITE, 279 + .data = (const struct snd_usb_audio_quirk[]) { 280 + { 281 + .ifnum = 1, 282 + .type = QUIRK_AUDIO_STANDARD_INTERFACE 283 + }, 284 + { 285 + .ifnum = 2, 286 + .type = QUIRK_AUDIO_STANDARD_INTERFACE 287 + }, 288 + { 289 + .ifnum = 3, 290 + .type = QUIRK_MIDI_YAMAHA 291 + }, 292 + { 293 + .ifnum = -1 294 + } 295 + } 296 + } 297 + }, 272 298 YAMAHA_DEVICE(0x2000, "DGP-7"), 273 299 YAMAHA_DEVICE(0x2001, "DGP-5"), 274 300 YAMAHA_DEVICE(0x2002, NULL), ··· 1659 1633 } 1660 1634 }, 1661 1635 { 1636 + /* Roland GAIA SH-01 */ 1637 + USB_DEVICE(0x0582, 0x0111), 1638 + .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { 1639 + .vendor_name = "Roland", 1640 + .product_name = "GAIA", 1641 + .ifnum = QUIRK_ANY_INTERFACE, 1642 + .type = QUIRK_COMPOSITE, 1643 + .data = (const struct snd_usb_audio_quirk[]) { 1644 + { 1645 + .ifnum = 0, 1646 + .type = QUIRK_AUDIO_STANDARD_INTERFACE 1647 + }, 1648 + { 1649 + .ifnum = 1, 1650 + .type = QUIRK_AUDIO_STANDARD_INTERFACE 1651 + }, 1652 + { 1653 + .ifnum = 2, 1654 + .type = QUIRK_MIDI_FIXED_ENDPOINT, 1655 + .data = &(const struct snd_usb_midi_endpoint_info) { 1656 + .out_cables = 0x0003, 1657 + .in_cables = 0x0003 1658 + } 1659 + }, 1660 + { 1661 + .ifnum = -1 1662 + } 1663 + } 1664 + } 1665 + }, 1666 + { 1662 1667 USB_DEVICE(0x0582, 0x0113), 1663 1668 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1664 1669 /* .vendor_name = "BOSS", */ ··· 2357 2300 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 2358 2301 .vendor_name = "KORG, Inc.", 2359 2302 /* .product_name = "PANDORA PX5D", */ 2303 + .ifnum = 3, 2304 + .type = QUIRK_MIDI_STANDARD_INTERFACE, 2305 + } 2306 + }, 2307 + 2308 + { 2309 + USB_DEVICE_VENDOR_SPEC(0x0944, 0x0201), 2310 + .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 2311 + .vendor_name = "KORG, Inc.", 2312 + /* .product_name = "ToneLab ST", */ 2360 2313 .ifnum = 3, 2361 2314 .type = QUIRK_MIDI_STANDARD_INTERFACE, 2362 2315 }
+1 -1
sound/usb/usx2y/us122l.c
··· 37 37 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 38 38 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ 39 39 /* Enable this card */ 40 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 40 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 41 41 42 42 module_param_array(index, int, NULL, 0444); 43 43 MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS".");
+2 -4
sound/usb/usx2y/usb_stream.c
··· 674 674 inurb->transfer_buffer_length = 675 675 inurb->number_of_packets * 676 676 inurb->iso_frame_desc[0].length; 677 - preempt_disable(); 677 + 678 678 if (u == 0) { 679 679 int now; 680 680 struct usb_device *dev = inurb->dev; ··· 686 686 } 687 687 err = usb_submit_urb(inurb, GFP_ATOMIC); 688 688 if (err < 0) { 689 - preempt_enable(); 690 689 snd_printk(KERN_ERR"usb_submit_urb(sk->inurb[%i])" 691 690 " returned %i\n", u, err); 692 691 return err; 693 692 } 694 693 err = usb_submit_urb(outurb, GFP_ATOMIC); 695 694 if (err < 0) { 696 - preempt_enable(); 697 695 snd_printk(KERN_ERR"usb_submit_urb(sk->outurb[%i])" 698 696 " returned %i\n", u, err); 699 697 return err; 700 698 } 701 - preempt_enable(); 699 + 702 700 if (inurb->start_frame != outurb->start_frame) { 703 701 snd_printd(KERN_DEBUG 704 702 "u[%i] start_frames differ in:%u out:%u\n",
+1 -1
sound/usb/usx2y/usbusx2y.c
··· 154 154 155 155 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 156 156 static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ 157 - static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 157 + static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 158 158 159 159 module_param_array(index, int, NULL, 0444); 160 160 MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS".");