USB: Remove unnecessary casts of void ptr returning alloc function return values
[linux-2.6/cjktty.git] / drivers / staging / intel_sst / intel_sst_ioctl.h
blob03b931619a3ed273f80b343333d94d5ba3f9e896
1 #ifndef __INTEL_SST_IOCTL_H__
2 #define __INTEL_SST_IOCTL_H__
3 /*
4 * intel_sst_ioctl.h - Intel SST Driver for audio engine
6 * Copyright (C) 2008-10 Intel Corporation
7 * Authors: Vinod Koul <vinod.koul@intel.com>
8 * Harsha Priya <priya.harsha@intel.com>
9 * Dharageswari R <dharageswari.r@intel.com>
10 * KP Jeeja <jeeja.kp@intel.com>
11 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; version 2 of the License.
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * General Public License for more details.
22 * You should have received a copy of the GNU General Public License along
23 * with this program; if not, write to the Free Software Foundation, Inc.,
24 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28 * This file defines all sst ioctls
31 /* codec and post/pre processing related info */
33 #include <linux/types.h>
35 enum sst_codec_types {
36 /* AUDIO/MUSIC CODEC Type Definitions */
37 SST_CODEC_TYPE_UNKNOWN = 0,
38 SST_CODEC_TYPE_PCM, /* Pass through Audio codec */
39 SST_CODEC_TYPE_MP3,
40 SST_CODEC_TYPE_MP24,
41 SST_CODEC_TYPE_AAC,
42 SST_CODEC_TYPE_AACP,
43 SST_CODEC_TYPE_eAACP,
44 SST_CODEC_TYPE_WMA9,
45 SST_CODEC_TYPE_WMA10,
46 SST_CODEC_TYPE_WMA10P,
47 SST_CODEC_TYPE_RA,
48 SST_CODEC_TYPE_DDAC3,
49 SST_CODEC_TYPE_STEREO_TRUE_HD,
50 SST_CODEC_TYPE_STEREO_HD_PLUS,
52 /* VOICE CODEC Type Definitions */
53 SST_CODEC_TYPE_VOICE_PCM = 0x21, /* Pass through voice codec */
56 enum sst_algo_types {
57 SST_CODEC_SRC = 0x64,
58 SST_CODEC_MIXER = 0x65,
59 SST_CODEC_DOWN_MIXER = 0x66,
60 SST_CODEC_VOLUME_CONTROL = 0x67,
61 SST_CODEC_OEM1 = 0xC8,
62 SST_CODEC_OEM2 = 0xC9,
65 enum snd_sst_stream_ops {
66 STREAM_OPS_PLAYBACK = 0, /* Decode */
67 STREAM_OPS_CAPTURE, /* Encode */
68 STREAM_OPS_PLAYBACK_DRM, /* Play Audio/Voice */
69 STREAM_OPS_PLAYBACK_ALERT, /* Play Audio/Voice */
70 STREAM_OPS_CAPTURE_VOICE_CALL, /* CSV Voice recording */
73 enum stream_mode {
74 SST_STREAM_MODE_NONE = 0,
75 SST_STREAM_MODE_DNR = 1,
76 SST_STREAM_MODE_FNF = 2,
77 SST_STREAM_MODE_CAPTURE = 3
80 enum stream_type {
81 SST_STREAM_TYPE_NONE = 0,
82 SST_STREAM_TYPE_MUSIC = 1,
83 SST_STREAM_TYPE_NORMAL = 2,
84 SST_STREAM_TYPE_LONG_PB = 3,
85 SST_STREAM_TYPE_LOW_LATENCY = 4,
88 enum snd_sst_audio_device_type {
89 SND_SST_DEVICE_HEADSET = 1,
90 SND_SST_DEVICE_IHF,
91 SND_SST_DEVICE_VIBRA,
92 SND_SST_DEVICE_HAPTIC,
93 SND_SST_DEVICE_CAPTURE,
96 /* Firmware Version info */
97 struct snd_sst_fw_version {
98 __u8 build; /* build number*/
99 __u8 minor; /* minor number*/
100 __u8 major; /* major number*/
101 __u8 type; /* build type */
104 /* Port info structure */
105 struct snd_sst_port_info {
106 __u16 port_type;
107 __u16 reserved;
110 /* Mixer info structure */
111 struct snd_sst_mix_info {
112 __u16 max_streams;
113 __u16 reserved;
116 /* PCM Parameters */
117 struct snd_pcm_params {
118 __u16 codec; /* codec type */
119 __u8 num_chan; /* 1=Mono, 2=Stereo */
120 __u8 pcm_wd_sz; /* 16/24 - bit*/
121 __u32 reserved; /* Bitrate in bits per second */
122 __u32 sfreq; /* Sampling rate in Hz */
123 __u32 ring_buffer_size;
124 __u32 period_count; /* period elapsed in samples*/
125 __u32 ring_buffer_addr;
128 /* MP3 Music Parameters Message */
129 struct snd_mp3_params {
130 __u16 codec;
131 __u8 num_chan; /* 1=Mono, 2=Stereo */
132 __u8 pcm_wd_sz; /* 16/24 - bit*/
133 __u32 brate; /* Use the hard coded value. */
134 __u32 sfreq; /* Sampling freq eg. 8000, 441000, 48000 */
135 __u8 crc_check; /* crc_check - disable (0) or enable (1) */
136 __u8 op_align; /* op align 0- 16 bit, 1- MSB, 2 LSB*/
137 __u16 reserved; /* Unused */
140 #define AAC_BIT_STREAM_ADTS 0
141 #define AAC_BIT_STREAM_ADIF 1
142 #define AAC_BIT_STREAM_RAW 2
144 /* AAC Music Parameters Message */
145 struct snd_aac_params {
146 __u16 codec;
147 __u8 num_chan; /* 1=Mono, 2=Stereo*/
148 __u8 pcm_wd_sz; /* 16/24 - bit*/
149 __u32 brate;
150 __u32 sfreq; /* Sampling freq eg. 8000, 441000, 48000 */
151 __u32 aac_srate; /* Plain AAC decoder operating sample rate */
152 __u8 mpg_id; /* 0=MPEG-2, 1=MPEG-4 */
153 __u8 bs_format; /* input bit stream format adts=0, adif=1, raw=2 */
154 __u8 aac_profile; /* 0=Main Profile, 1=LC profile, 3=SSR profile */
155 __u8 ext_chl; /* No.of external channels */
156 __u8 aot; /* Audio object type. 1=Main , 2=LC , 3=SSR, 4=SBR*/
157 __u8 op_align; /* output alignment 0=16 bit , 1=MSB, 2= LSB align */
158 __u8 brate_type; /* 0=CBR, 1=VBR */
159 __u8 crc_check; /* crc check 0= disable, 1=enable */
160 __s8 bit_stream_format[8]; /* input bit stream format adts/adif/raw */
161 __u8 jstereo; /* Joint stereo Flag */
162 __u8 sbr_present; /* 1 = SBR Present, 0 = SBR absent, for RAW */
163 __u8 downsample; /* 1 = Downsampling ON, 0 = Downsampling OFF */
164 __u8 num_syntc_elems; /* 1- Mono/stereo, 0 - Dual Mono, 0 - for raw */
165 __s8 syntc_id[2]; /* 0 for ID_SCE(Dula Mono), -1 for raw */
166 __s8 syntc_tag[2]; /* raw - -1 and 0 -16 for rest of the streams */
167 __u8 pce_present; /* Flag. 1- present 0 - not present, for RAW */
168 __u8 sbr_type; /* sbr_type: 0-plain aac, 1-aac-v1, 2-aac-v2 */
169 __u8 outchmode; /*0- mono, 1-stereo, 2-dual mono 3-Parametric stereo */
170 __u8 ps_present;
173 /* WMA Music Parameters Message */
174 struct snd_wma_params {
175 __u16 codec;
176 __u8 num_chan; /* 1=Mono, 2=Stereo */
177 __u8 pcm_wd_sz; /* 16/24 - bit*/
178 __u32 brate; /* Use the hard coded value. */
179 __u32 sfreq; /* Sampling freq eg. 8000, 441000, 48000 */
180 __u32 channel_mask; /* Channel Mask */
181 __u16 format_tag; /* Format Tag */
182 __u16 block_align; /* packet size */
183 __u16 wma_encode_opt;/* Encoder option */
184 __u8 op_align; /* op align 0- 16 bit, 1- MSB, 2 LSB */
185 __u8 pcm_src; /* input pcm bit width */
188 /* Pre processing param structure */
189 struct snd_prp_params {
190 __u32 reserved; /* No pre-processing defined yet */
193 struct snd_params_block {
194 __u32 type; /*Type of the parameter*/
195 __u32 size; /*size of the parameters in the block*/
196 __u8 params[0]; /*Parameters of the algorithm*/
199 /* Pre and post processing params structure */
200 struct snd_ppp_params {
201 enum sst_algo_types algo_id;/* Post/Pre processing algorithm ID */
202 __u8 str_id; /*Only 5 bits used 0 - 31 are valid*/
203 __u8 enable; /* 0= disable, 1= enable*/
204 __u8 reserved;
205 __u32 size; /*Size of parameters for all blocks*/
206 struct snd_params_block params[0];
209 struct snd_sst_postproc_info {
210 __u32 src_min; /* Supported SRC Min sampling freq */
211 __u32 src_max; /* Supported SRC Max sampling freq */
212 __u8 src; /* 0=Not supported, 1=Supported */
213 __u8 bass_boost; /* 0=Not Supported, 1=Supported */
214 __u8 stereo_widening; /* 0=Not Supported, 1=Supported */
215 __u8 volume_control; /* 0=Not Supported, 1=Supported */
216 __s16 min_vol; /* Minimum value of Volume in dB */
217 __s16 max_vol; /* Maximum value of Volume in dB */
218 __u8 mute_control; /* 0=No Mute, 1=Mute */
219 __u8 reserved1;
220 __u16 reserved2;
223 /* pre processing Capability info structure */
224 struct snd_sst_prp_info {
225 __s16 min_vol; /* Minimum value of Volume in dB */
226 __s16 max_vol; /* Maximum value of Volume in dB */
227 __u8 volume_control; /* 0=Not Supported, 1=Supported */
228 __u8 reserved1; /* for 32 bit alignment */
229 __u16 reserved2; /* for 32 bit alignment */
230 } __attribute__ ((packed));
232 /*Pre / Post processing algorithms support*/
233 struct snd_sst_ppp_info {
234 __u32 src:1; /* 0=Not supported, 1=Supported */
235 __u32 mixer:1; /* 0=Not supported, 1=Supported */
236 __u32 volume_control:1; /* 0=Not Supported, 1=Supported */
237 __u32 mute_control:1; /* 0=Not Supported, 1=Supported */
238 __u32 anc:1; /* 0=Not Supported, 1=Supported */
239 __u32 side_tone:1; /* 0=Not Supported, 1=Supported */
240 __u32 dc_removal:1; /* 0=Not Supported, 1=Supported */
241 __u32 equalizer:1; /* 0=Not Supported, 1=Supported */
242 __u32 spkr_prot:1; /* 0=Not Supported, 1=Supported */
243 __u32 bass_boost:1; /* 0=Not Supported, 1=Supported */
244 __u32 stereo_widening:1;/* 0=Not Supported, 1=Supported */
245 __u32 rsvd1:21;
246 __u32 rsvd2;
249 /* Firmware capabilities info */
250 struct snd_sst_fw_info {
251 struct snd_sst_fw_version fw_version; /* Firmware version */
252 __u8 audio_codecs_supported[8]; /* Codecs supported by FW */
253 __u32 recommend_min_duration; /* Min duration for Lowpower Playback */
254 __u8 max_pcm_streams_supported; /* Max num of PCM streams supported */
255 __u8 max_enc_streams_supported; /* Max number of Encoded streams */
256 __u16 reserved; /* 32 bit alignment*/
257 struct snd_sst_ppp_info ppp_info; /* pre_processing mod cap info */
258 struct snd_sst_postproc_info pop_info; /* Post processing cap info*/
259 struct snd_sst_port_info port_info[3]; /* Port info */
260 struct snd_sst_mix_info mix_info;/* Mixer info */
261 __u32 min_input_buf; /* minmum i/p buffer for decode */
264 /* Codec params struture */
265 union snd_sst_codec_params {
266 struct snd_pcm_params pcm_params;
267 struct snd_mp3_params mp3_params;
268 struct snd_aac_params aac_params;
269 struct snd_wma_params wma_params;
273 struct snd_sst_stream_params {
274 union snd_sst_codec_params uc;
275 } __attribute__ ((packed));
277 struct snd_sst_params {
278 __u32 result;
279 __u32 stream_id;
280 __u8 codec;
281 __u8 ops;
282 __u8 stream_type;
283 __u8 device_type;
284 struct snd_sst_stream_params sparams;
287 struct snd_sst_vol {
288 __u32 stream_id;
289 __s32 volume;
290 __u32 ramp_duration;
291 __u32 ramp_type; /* Ramp type, default=0 */
294 struct snd_sst_mute {
295 __u32 stream_id;
296 __u32 mute;
299 /* ioctl related stuff here */
300 struct snd_sst_pmic_config {
301 __u32 sfreq; /* Sampling rate in Hz */
302 __u16 num_chan; /* Mono =1 or Stereo =2 */
303 __u16 pcm_wd_sz; /* Number of bits per sample */
304 } __attribute__ ((packed));
306 struct snd_sst_get_stream_params {
307 struct snd_sst_params codec_params;
308 struct snd_sst_pmic_config pcm_params;
311 enum snd_sst_target_type {
312 SND_SST_TARGET_PMIC = 1,
313 SND_SST_TARGET_LPE,
314 SND_SST_TARGET_MODEM,
315 SND_SST_TARGET_BT,
316 SND_SST_TARGET_FM,
317 SND_SST_TARGET_NONE,
320 enum snd_sst_device_type {
321 SND_SST_DEVICE_SSP = 1,
322 SND_SST_DEVICE_PCM,
323 SND_SST_DEVICE_OTHER,
326 enum snd_sst_device_mode {
328 SND_SST_DEV_MODE_PCM_MODE1 = 1, /*(16-bit word, bit-length frame sync)*/
329 SND_SST_DEV_MODE_PCM_MODE2,
330 SND_SST_DEV_MODE_PCM_MODE3,
331 SND_SST_DEV_MODE_PCM_MODE4_RIGHT_JUSTIFIED,
332 SND_SST_DEV_MODE_PCM_MODE4_LEFT_JUSTIFIED,
333 SND_SST_DEV_MODE_PCM_MODE4_I2S, /*(I2S mode, 16-bit words)*/
334 SND_SST_DEV_MODE_PCM_MODE5,
335 SND_SST_DEV_MODE_PCM_MODE6,
338 enum snd_sst_port_action {
339 SND_SST_PORT_PREPARE = 1,
340 SND_SST_PORT_ACTIVATE,
343 /* Target selection per device structure */
344 struct snd_sst_slot_info {
345 __u8 mix_enable; /* Mixer enable or disable */
346 __u8 device_type;
347 __u8 device_instance; /* 0, 1, 2 */
348 __u8 target_device;
349 __u16 target_sink;
350 __u8 slot[2];
351 __u8 master;
352 __u8 action;
353 __u8 device_mode;
354 __u8 reserved;
355 struct snd_sst_pmic_config pcm_params;
356 } __attribute__ ((packed));
358 #define SST_MAX_TARGET_DEVICES 3
359 /* Target device list structure */
360 struct snd_sst_target_device {
361 __u32 device_route;
362 struct snd_sst_slot_info devices[SST_MAX_TARGET_DEVICES];
363 } __attribute__ ((packed));
365 struct snd_sst_driver_info {
366 __u32 version; /* Version of the driver */
367 __u32 active_pcm_streams;
368 __u32 active_enc_streams;
369 __u32 max_pcm_streams;
370 __u32 max_enc_streams;
371 __u32 buf_per_stream;
374 enum snd_sst_buff_type {
375 SST_BUF_USER = 1,
376 SST_BUF_MMAP,
377 SST_BUF_RAR,
380 struct snd_sst_mmap_buff_entry {
381 unsigned int offset;
382 unsigned int size;
385 struct snd_sst_mmap_buffs {
386 unsigned int entries;
387 enum snd_sst_buff_type type;
388 struct snd_sst_mmap_buff_entry *buff;
391 struct snd_sst_buff_entry {
392 void *buffer;
393 unsigned int size;
396 struct snd_sst_buffs {
397 unsigned int entries;
398 __u8 type;
399 struct snd_sst_buff_entry *buff_entry;
402 struct snd_sst_dbufs {
403 unsigned long long input_bytes_consumed;
404 unsigned long long output_bytes_produced;
405 struct snd_sst_buffs *ibufs;
406 struct snd_sst_buffs *obufs;
409 /*IOCTL defined here */
410 /*SST MMF IOCTLS only */
411 #define SNDRV_SST_STREAM_SET_PARAMS _IOR('L', 0x00, \
412 struct snd_sst_stream_params *)
413 #define SNDRV_SST_STREAM_GET_PARAMS _IOWR('L', 0x01, \
414 struct snd_sst_get_stream_params *)
415 #define SNDRV_SST_STREAM_GET_TSTAMP _IOWR('L', 0x02, __u64 *)
416 #define SNDRV_SST_STREAM_DECODE _IOWR('L', 0x03, struct snd_sst_dbufs *)
417 #define SNDRV_SST_STREAM_BYTES_DECODED _IOWR('L', 0x04, __u64 *)
418 #define SNDRV_SST_STREAM_START _IO('A', 0x42)
419 #define SNDRV_SST_STREAM_DROP _IO('A', 0x43)
420 #define SNDRV_SST_STREAM_DRAIN _IO('A', 0x44)
421 #define SNDRV_SST_STREAM_PAUSE _IOW('A', 0x45, int)
422 #define SNDRV_SST_STREAM_RESUME _IO('A', 0x47)
423 #define SNDRV_SST_MMAP_PLAY _IOW('L', 0x05, struct snd_sst_mmap_buffs *)
424 #define SNDRV_SST_MMAP_CAPTURE _IOW('L', 0x06, struct snd_sst_mmap_buffs *)
425 /*SST common ioctls */
426 #define SNDRV_SST_DRIVER_INFO _IOR('L', 0x10, struct snd_sst_driver_info *)
427 #define SNDRV_SST_SET_VOL _IOW('L', 0x11, struct snd_sst_vol *)
428 #define SNDRV_SST_GET_VOL _IOW('L', 0x12, struct snd_sst_vol *)
429 #define SNDRV_SST_MUTE _IOW('L', 0x13, struct snd_sst_mute *)
430 /*AM Ioctly only */
431 #define SNDRV_SST_FW_INFO _IOR('L', 0x20, struct snd_sst_fw_info *)
432 #define SNDRV_SST_SET_TARGET_DEVICE _IOW('L', 0x21, \
433 struct snd_sst_target_device *)
435 #endif /* __INTEL_SST_IOCTL_H__ */