1 #ifndef __INTEL_SST_IOCTL_H__ 2 #define __INTEL_SST_IOCTL_H__ 3 4 enum sst_codec_types { 5 /* AUDIO/MUSIC CODEC Type Definitions */ 6 SST_CODEC_TYPE_UNKNOWN = 0, 7 SST_CODEC_TYPE_PCM, /* Pass through Audio codec */ 8 SST_CODEC_TYPE_MP3, 9 SST_CODEC_TYPE_MP24, 10 SST_CODEC_TYPE_AAC, 11 SST_CODEC_TYPE_AACP, 12 SST_CODEC_TYPE_eAACP, 13 SST_CODEC_TYPE_WMA9, 14 SST_CODEC_TYPE_WMA10, 15 SST_CODEC_TYPE_WMA10P, 16 SST_CODEC_TYPE_RA, 17 SST_CODEC_TYPE_DDAC3, 18 SST_CODEC_TYPE_STEREO_TRUE_HD, 19 SST_CODEC_TYPE_STEREO_HD_PLUS, 20 21 /* VOICE CODEC Type Definitions */ 22 SST_CODEC_TYPE_VOICE_PCM = 0x21, /* Pass through voice codec */ 23 SST_CODEC_SRC = 0x64, 24 SST_CODEC_MIXER = 0x65, 25 SST_CODEC_DOWN_MIXER = 0x66, 26 SST_CODEC_VOLUME_CONTROL = 0x67, 27 SST_CODEC_OEM1 = 0xC8, 28 SST_CODEC_OEM2 = 0xC9, 29 }; 30 31 enum snd_sst_stream_ops { 32 STREAM_OPS_PLAYBACK = 0, /* Decode */ 33 STREAM_OPS_CAPTURE, /* Encode */ 34 STREAM_OPS_PLAYBACK_DRM, /* Play Audio/Voice */ 35 STREAM_OPS_PLAYBACK_ALERT, /* Play Audio/Voice */ 36 STREAM_OPS_CAPTURE_VOICE_CALL, /* CSV Voice recording */ 37 }; 38 39 enum stream_type { 40 STREAM_TYPE_MUSIC = 1, 41 STREAM_TYPE_VOICE 42 }; 43 44 /* Firmware Version info */ 45 struct snd_sst_fw_version { 46 __u8 build; /* build number*/ 47 __u8 minor; /* minor number*/ 48 __u8 major; /* major number*/ 49 __u8 type; /* build type*/ 50 }; 51 52 /* Port info structure */ 53 struct snd_sst_port_info { 54 __u16 port_type; 55 __u16 reserved; 56 }; 57 58 /* Mixer info structure */ 59 struct snd_sst_mix_info { 60 __u16 max_streams; 61 __u16 reserved; 62 }; 63 64 /* PCM Parameters */ 65 struct snd_pcm_params { 66 __u16 codec; /* codec type */ 67 __u8 num_chan; /* 1=Mono, 2=Stereo */ 68 __u8 pcm_wd_sz; /* 16/24 - bit*/ 69 __u32 brate; /* Bitrate in bits per second */ 70 __u32 sfreq; /* Sampling rate in Hz */ 71 __u16 frame_size; 72 __u16 samples_per_frame; /* Frame size num samples per frame */ 73 __u32 period_count; /* period elapsed time count, in samples,*/ 74 }; 75 76 /* MP3 Music Parameters Message */ 77 struct snd_mp3_params { 78 __u16 codec; 79 __u8 num_chan; /* 1=Mono, 2=Stereo */ 80 __u8 pcm_wd_sz; /* 16/24 - bit*/ 81 __u32 brate; /* Use the hard coded value. */ 82 __u32 sfreq; /* Sampling freq eg. 8000, 441000, 48000 */ 83 __u8 crc_check; /* crc_check - disable (0) or enable (1) */ 84 __u8 op_align; /* op align 0- 16 bit, 1- MSB, 2 LSB*/ 85 __u16 reserved; /* Unused */ 86 }; 87 88 #define AAC_BIT_STREAM_ADTS 0 89 #define AAC_BIT_STREAM_ADIF 1 90 #define AAC_BIT_STREAM_RAW 2 91 92 /* AAC Music Parameters Message */ 93 struct snd_aac_params { 94 __u16 codec; 95 __u8 num_chan; /* 1=Mono, 2=Stereo*/ 96 __u8 pcm_wd_sz; /* 16/24 - bit*/ 97 __u32 brate; 98 __u32 sfreq; /* Sampling freq eg. 8000, 441000, 48000 */ 99 __u32 aac_srate; /* Plain AAC decoder operating sample rate */ 100 __u8 mpg_id; /* 0=MPEG-2, 1=MPEG-4 */ 101 __u8 bs_format; /* input bit stream format adts=0, adif=1, raw=2 */ 102 __u8 aac_profile; /* 0=Main Profile, 1=LC profile, 3=SSR profile */ 103 __u8 ext_chl; /* No.of external channels */ 104 __u8 aot; /* Audio object type. 1=Main , 2=LC , 3=SSR, 4=SBR*/ 105 __u8 op_align; /* output alignment 0=16 bit , 1=MSB, 2= LSB align */ 106 __u8 brate_type; /* 0=CBR, 1=VBR */ 107 __u8 crc_check; /* crc check 0= disable, 1=enable */ 108 __s8 bit_stream_format[8]; /* input bit stream format adts/adif/raw */ 109 __u8 jstereo; /* Joint stereo Flag */ 110 __u8 sbr_present; /* 1 = SBR Present, 0 = SBR absent, for RAW */ 111 __u8 downsample; /* 1 = Downsampling ON, 0 = Downsampling OFF */ 112 __u8 num_syntc_elems; /* 1- Mono/stereo, 0 - Dual Mono, 0 - for raw */ 113 __s8 syntc_id[2]; /* 0 for ID_SCE(Dula Mono), -1 for raw */ 114 __s8 syntc_tag[2]; /* raw - -1 and 0 -16 for rest of the streams */ 115 __u8 pce_present; /* Flag. 1- present 0 - not present, for RAW */ 116 __u8 reserved; 117 __u16 reserved1; 118 119 }; 120 121 /* WMA Music Parameters Message */ 122 struct snd_wma_params { 123 __u16 codec; 124 __u8 num_chan; /* 1=Mono, 2=Stereo */ 125 __u8 pcm_wd_sz; /* 16/24 - bit*/ 126 __u32 brate; /* Use the hard coded value. */ 127 __u32 sfreq; /* Sampling freq eg. 8000, 441000, 48000 */ 128 __u32 channel_mask; /* Channel Mask */ 129 __u16 format_tag; /* Format Tag */ 130 __u16 block_align; /* packet size */ 131 __u16 wma_encode_opt;/* Encoder option */ 132 __u8 op_align; /* op align 0- 16 bit, 1- MSB, 2 LSB*/ 133 __u8 pcm_src; /* input pcm bit width*/ 134 }; 135 136 /* Pre processing param structure */ 137 struct snd_prp_params { 138 __u32 reserved; /* No pre-processing defined yet */ 139 }; 140 141 /* Post processing Capability info structure */ 142 struct snd_sst_postproc_info { 143 __u32 src_min; /* Supported SRC Min sampling freq */ 144 __u32 src_max; /* Supported SRC Max sampling freq */ 145 __u8 src; /* 0=Not supported, 1=Supported */ 146 __u8 bass_boost; /* 0=Not Supported, 1=Supported */ 147 __u8 stereo_widening; /* 0=Not Supported, 1=Supported */ 148 __u8 volume_control; /* 0=Not Supported, 1=Supported */ 149 __s16 min_vol; /* Minimum value of Volume in dB */ 150 __s16 max_vol; /* Maximum value of Volume in dB */ 151 __u8 mute_control; /*0=No Mute, 1=Mute*/ 152 __u8 reserved1; 153 __u16 reserved2; 154 }; 155 156 /* pre processing Capability info structure */ 157 struct snd_sst_prp_info { 158 __s16 min_vol; /* Minimum value of Volume in dB */ 159 __s16 max_vol; /* Maximum value of Volume in dB */ 160 __u8 volume_control; /* 0=Not Supported, 1=Supported */ 161 __u8 reserved1; /* for 32 bit alignment */ 162 __u16 reserved2; /* for 32 bit alignment */ 163 } __attribute__ ((packed)); 164 165 /* Firmware capabilities info */ 166 struct snd_sst_fw_info { 167 struct snd_sst_fw_version fw_version; /* Firmware version */ 168 __u8 audio_codecs_supported[8]; /* Codecs supported by FW */ 169 __u32 recommend_min_duration; /* Min duration for Low power Playback*/ 170 __u8 max_pcm_streams_supported; /*Max number of PCM streams supported */ 171 __u8 max_enc_streams_supported; /*Max number of Encoded streams */ 172 __u16 reserved; /* 32 bit alignment*/ 173 struct snd_sst_postproc_info pop_info; /* Post processing capability*/ 174 struct snd_sst_prp_info prp_info; /* pre_processing mod cap info */ 175 struct snd_sst_port_info port_info[2]; /* Port info */ 176 struct snd_sst_mix_info mix_info; /* Mixer info */ 177 __u32 min_input_buf; /*minmum i/p buffer for decode*/ 178 }; 179 180 /* Add the codec parameter structures for new codecs to be supported */ 181 #define CODEC_PARAM_STRUCTURES \ 182 struct snd_pcm_params pcm_params; \ 183 struct snd_mp3_params mp3_params; \ 184 struct snd_aac_params aac_params; \ 185 struct snd_wma_params wma_params; 186 187 /* Pre and Post Processing param structures */ 188 #define PPP_PARAM_STRUCTURES \ 189 struct snd_prp_params prp_params; 190 191 /* Codec params struture */ 192 union snd_sst_codec_params { 193 CODEC_PARAM_STRUCTURES; 194 }; 195 196 /* Pre-processing params struture */ 197 union snd_sst_ppp_params{ 198 PPP_PARAM_STRUCTURES; 199 }; 200 201 struct snd_sst_stream_params { 202 union snd_sst_codec_params uc; 203 } __attribute__ ((packed)); 204 205 struct snd_sst_params { 206 __u32 result; 207 __u32 stream_id; 208 __u8 codec; 209 __u8 ops; 210 __u8 stream_type; 211 struct snd_sst_stream_params sparams; 212 }; 213 214 /*ioctl related stuff here*/ 215 struct snd_sst_pmic_config { 216 __u32 sfreq; /* Sampling rate in Hz */ 217 __u16 num_chan; /* Mono =1 or Stereo =2 */ 218 __u16 pcm_wd_sz; /* Number of bits per sample */ 219 } __attribute__ ((packed)); 220 221 struct snd_sst_get_stream_params { 222 struct snd_sst_params codec_params; 223 struct snd_sst_pmic_config pcm_params; 224 }; 225 226 enum snd_sst_target_type { 227 SND_SST_TARGET_PMIC = 1, 228 SND_SST_TARGET_OTHER, 229 }; 230 231 enum snd_sst_port_action { 232 SND_SST_PORT_PREPARE = 1, 233 SND_SST_PORT_ACTIVATE, 234 }; 235 236 /* Target selection per device structure */ 237 struct snd_sst_slot_info { 238 __u8 mix_enable; /* Mixer enable or disable */ 239 __u8 device_type; 240 __u8 device_instance; /* 0, 1, 2 */ 241 __u8 target_type; 242 __u16 slot[2]; 243 __u8 master; 244 __u8 action; 245 __u16 reserved; 246 struct snd_sst_pmic_config pcm_params; 247 } __attribute__ ((packed)); 248 249 /* Target device list structure */ 250 struct snd_sst_target_device { 251 __u32 device_route; 252 struct snd_sst_slot_info devices[2]; 253 } __attribute__ ((packed)); 254 255 struct snd_sst_driver_info { 256 __u32 version; /* Version of the driver */ 257 __u32 active_pcm_streams; 258 __u32 active_enc_streams; 259 __u32 max_pcm_streams; 260 __u32 max_enc_streams; 261 __u32 buf_per_stream; 262 }; 263 264 struct snd_sst_vol { 265 __u32 stream_id; 266 __s32 volume; 267 __u32 ramp_duration; 268 __u32 ramp_type; /* Ramp type, default=0 */ 269 }; 270 271 struct snd_sst_mute { 272 __u32 stream_id; 273 __u32 mute; 274 }; 275 276 enum snd_sst_buff_type { 277 SST_BUF_USER = 1, 278 SST_BUF_MMAP, 279 SST_BUF_RAR, 280 }; 281 282 struct snd_sst_mmap_buff_entry { 283 unsigned int offset; 284 unsigned int size; 285 }; 286 287 struct snd_sst_mmap_buffs { 288 unsigned int entries; 289 enum snd_sst_buff_type type; 290 struct snd_sst_mmap_buff_entry *buff; 291 }; 292 293 struct snd_sst_buff_entry { 294 void *buffer; 295 unsigned int size; 296 }; 297 298 struct snd_sst_buffs { 299 unsigned int entries; 300 __u8 type; 301 struct snd_sst_buff_entry *buff_entry; 302 }; 303 304 struct snd_sst_dbufs { 305 unsigned long long input_bytes_consumed; 306 unsigned long long output_bytes_produced; 307 struct snd_sst_buffs *ibufs; 308 struct snd_sst_buffs *obufs; 309 }; 310 311 /*IOCTL defined here*/ 312 /*SST MMF IOCTLS only*/ 313 #define SNDRV_SST_STREAM_SET_PARAMS _IOR('L', 0x00, \ 314 struct snd_sst_stream_params *) 315 #define SNDRV_SST_STREAM_GET_PARAMS _IOWR('L', 0x01, \ 316 struct snd_sst_get_stream_params *) 317 #define SNDRV_SST_STREAM_GET_TSTAMP _IOWR('L', 0x02, __u64 *) 318 #define SNDRV_SST_STREAM_DECODE _IOWR('L', 0x03, struct snd_sst_dbufs *) 319 #define SNDRV_SST_STREAM_BYTES_DECODED _IOWR('L', 0x04, __u64 *) 320 #define SNDRV_SST_STREAM_START _IO('A', 0x42) 321 #define SNDRV_SST_STREAM_DROP _IO('A', 0x43) 322 #define SNDRV_SST_STREAM_DRAIN _IO('A', 0x44) 323 #define SNDRV_SST_STREAM_PAUSE _IOW('A', 0x45, int) 324 #define SNDRV_SST_STREAM_RESUME _IO('A', 0x47) 325 #define SNDRV_SST_MMAP_PLAY _IOW('L', 0x05, struct snd_sst_mmap_buffs *) 326 #define SNDRV_SST_MMAP_CAPTURE _IOW('L', 0x06, struct snd_sst_mmap_buffs *) 327 /*SST common ioctls */ 328 #define SNDRV_SST_DRIVER_INFO _IOR('L', 0x10, struct snd_sst_driver_info *) 329 #define SNDRV_SST_SET_VOL _IOW('L', 0x11, struct snd_sst_vol *) 330 #define SNDRV_SST_GET_VOL _IOW('L', 0x12, struct snd_sst_vol *) 331 #define SNDRV_SST_MUTE _IOW('L', 0x13, struct snd_sst_mute *) 332 /*AM Ioctly only*/ 333 #define SNDRV_SST_FW_INFO _IOR('L', 0x20, struct snd_sst_fw_info *) 334 #define SNDRV_SST_SET_TARGET_DEVICE _IOW('L', 0x21, \ 335 struct snd_sst_target_device *) 336 337 #endif /*__INTEL_SST_IOCTL_H__*/ 338