Changeset 679 for GPL/trunk/alsa-kernel/include/sound/pcm.h
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/include/sound/pcm.h
r598 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __SOUND_PCM_H 2 3 #define __SOUND_PCM_H … … 6 7 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 7 8 * Abramo Bagnara <abramo@alsa-project.org> 8 *9 *10 * This program is free software; you can redistribute it and/or modify11 * it under the terms of the GNU General Public License as published by12 * the Free Software Foundation; either version 2 of the License, or13 * (at your option) any later version.14 *15 * This program is distributed in the hope that it will be useful,16 * but WITHOUT ANY WARRANTY; without even the implied warranty of17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 * GNU General Public License for more details.19 *20 * You should have received a copy of the GNU General Public License21 * along with this program; if not, write to the Free Software22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 *24 9 */ 25 10 … … 30 15 #include <linux/mm.h> 31 16 #include <linux/bitops.h> 32 #include <linux/pm_qos_params.h> 17 #include <linux/pm_qos.h> 18 #include <linux/refcount.h> 33 19 34 20 #define snd_pcm_substream_chip(substream) ((substream)->private_data) 35 21 #define snd_pcm_chip(pcm) ((pcm)->private_data) 36 22 37 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)38 #include "pcm_oss.h"23 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 24 #include <sound/pcm_oss.h> 39 25 #endif 40 26 … … 59 45 }; 60 46 47 struct snd_pcm_status64; 61 48 struct snd_pcm_substream; 49 50 struct snd_pcm_audio_tstamp_config; /* definitions further down */ 51 struct snd_pcm_audio_tstamp_report; 62 52 63 53 struct snd_pcm_ops { … … 71 61 int (*prepare)(struct snd_pcm_substream *substream); 72 62 int (*trigger)(struct snd_pcm_substream *substream, int cmd); 63 int (*sync_stop)(struct snd_pcm_substream *substream); 73 64 snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); 74 int (*copy)(struct snd_pcm_substream *substream, int channel, 75 snd_pcm_uframes_t pos, 76 void __user *buf, snd_pcm_uframes_t count); 77 int (*silence)(struct snd_pcm_substream *substream, int channel, 78 snd_pcm_uframes_t pos, snd_pcm_uframes_t count); 65 int (*get_time_info)(struct snd_pcm_substream *substream, 66 struct timespec64 *system_ts, struct timespec64 *audio_ts, 67 struct snd_pcm_audio_tstamp_config *audio_tstamp_config, 68 struct snd_pcm_audio_tstamp_report *audio_tstamp_report); 69 int (*fill_silence)(struct snd_pcm_substream *substream, int channel, 70 unsigned long pos, unsigned long bytes); 71 int (*copy_user)(struct snd_pcm_substream *substream, int channel, 72 unsigned long pos, void __user *buf, 73 unsigned long bytes); 74 int (*copy_kernel)(struct snd_pcm_substream *substream, int channel, 75 unsigned long pos, void *buf, unsigned long bytes); 79 76 struct page *(*page)(struct snd_pcm_substream *substream, 80 77 unsigned long offset); … … 93 90 #endif 94 91 95 #define SNDRV_PCM_IOCTL1_FALSE ((void *)0)96 #define SNDRV_PCM_IOCTL1_TRUE ((void *)1)97 98 92 #define SNDRV_PCM_IOCTL1_RESET 0 99 #define SNDRV_PCM_IOCTL1_INFO 1 93 /* 1 is absent slot. */ 100 94 #define SNDRV_PCM_IOCTL1_CHANNEL_INFO 2 101 #define SNDRV_PCM_IOCTL1_GSTATE 3 95 /* 3 is absent slot. */ 102 96 #define SNDRV_PCM_IOCTL1_FIFO_SIZE 4 103 97 … … 108 102 #define SNDRV_PCM_TRIGGER_SUSPEND 5 109 103 #define SNDRV_PCM_TRIGGER_RESUME 6 104 #define SNDRV_PCM_TRIGGER_DRAIN 7 110 105 111 106 #define SNDRV_PCM_POS_XRUN ((snd_pcm_uframes_t)-1) … … 125 120 #define SNDRV_PCM_RATE_176400 (1<<11) /* 176400Hz */ 126 121 #define SNDRV_PCM_RATE_192000 (1<<12) /* 192000Hz */ 122 #define SNDRV_PCM_RATE_352800 (1<<13) /* 352800Hz */ 123 #define SNDRV_PCM_RATE_384000 (1<<14) /* 384000Hz */ 127 124 128 125 #define SNDRV_PCM_RATE_CONTINUOUS (1<<30) /* continuous range */ … … 137 134 #define SNDRV_PCM_RATE_8000_192000 (SNDRV_PCM_RATE_8000_96000|SNDRV_PCM_RATE_176400|\ 138 135 SNDRV_PCM_RATE_192000) 139 #define SNDRV_PCM_FMTBIT_S8 (1ULL << SNDRV_PCM_FORMAT_S8) 140 #define SNDRV_PCM_FMTBIT_U8 (1ULL << SNDRV_PCM_FORMAT_U8) 141 #define SNDRV_PCM_FMTBIT_S16_LE (1ULL << SNDRV_PCM_FORMAT_S16_LE) 142 #define SNDRV_PCM_FMTBIT_S16_BE (1ULL << SNDRV_PCM_FORMAT_S16_BE) 143 #define SNDRV_PCM_FMTBIT_U16_LE (1ULL << SNDRV_PCM_FORMAT_U16_LE) 144 #define SNDRV_PCM_FMTBIT_U16_BE (1ULL << SNDRV_PCM_FORMAT_U16_BE) 145 #define SNDRV_PCM_FMTBIT_S24_LE (1ULL << SNDRV_PCM_FORMAT_S24_LE) 146 #define SNDRV_PCM_FMTBIT_S24_BE (1ULL << SNDRV_PCM_FORMAT_S24_BE) 147 #define SNDRV_PCM_FMTBIT_U24_LE (1ULL << SNDRV_PCM_FORMAT_U24_LE) 148 #define SNDRV_PCM_FMTBIT_U24_BE (1ULL << SNDRV_PCM_FORMAT_U24_BE) 149 #define SNDRV_PCM_FMTBIT_S32_LE (1ULL << SNDRV_PCM_FORMAT_S32_LE) 150 #define SNDRV_PCM_FMTBIT_S32_BE (1ULL << SNDRV_PCM_FORMAT_S32_BE) 151 #define SNDRV_PCM_FMTBIT_U32_LE (1ULL << SNDRV_PCM_FORMAT_U32_LE) 152 #define SNDRV_PCM_FMTBIT_U32_BE (1ULL << SNDRV_PCM_FORMAT_U32_BE) 153 #define SNDRV_PCM_FMTBIT_FLOAT_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT_LE) 154 #define SNDRV_PCM_FMTBIT_FLOAT_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT_BE) 155 #define SNDRV_PCM_FMTBIT_FLOAT64_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_LE) 156 #define SNDRV_PCM_FMTBIT_FLOAT64_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_BE) 157 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE) 158 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE) 159 #define SNDRV_PCM_FMTBIT_MU_LAW (1ULL << SNDRV_PCM_FORMAT_MU_LAW) 160 #define SNDRV_PCM_FMTBIT_A_LAW (1ULL << SNDRV_PCM_FORMAT_A_LAW) 161 #define SNDRV_PCM_FMTBIT_IMA_ADPCM (1ULL << SNDRV_PCM_FORMAT_IMA_ADPCM) 162 #define SNDRV_PCM_FMTBIT_MPEG (1ULL << SNDRV_PCM_FORMAT_MPEG) 163 #define SNDRV_PCM_FMTBIT_GSM (1ULL << SNDRV_PCM_FORMAT_GSM) 164 #define SNDRV_PCM_FMTBIT_SPECIAL (1ULL << SNDRV_PCM_FORMAT_SPECIAL) 165 #define SNDRV_PCM_FMTBIT_S24_3LE (1ULL << SNDRV_PCM_FORMAT_S24_3LE) 166 #define SNDRV_PCM_FMTBIT_U24_3LE (1ULL << SNDRV_PCM_FORMAT_U24_3LE) 167 #define SNDRV_PCM_FMTBIT_S24_3BE (1ULL << SNDRV_PCM_FORMAT_S24_3BE) 168 #define SNDRV_PCM_FMTBIT_U24_3BE (1ULL << SNDRV_PCM_FORMAT_U24_3BE) 169 #define SNDRV_PCM_FMTBIT_S20_3LE (1ULL << SNDRV_PCM_FORMAT_S20_3LE) 170 #define SNDRV_PCM_FMTBIT_U20_3LE (1ULL << SNDRV_PCM_FORMAT_U20_3LE) 171 #define SNDRV_PCM_FMTBIT_S20_3BE (1ULL << SNDRV_PCM_FORMAT_S20_3BE) 172 #define SNDRV_PCM_FMTBIT_U20_3BE (1ULL << SNDRV_PCM_FORMAT_U20_3BE) 173 #define SNDRV_PCM_FMTBIT_S18_3LE (1ULL << SNDRV_PCM_FORMAT_S18_3LE) 174 #define SNDRV_PCM_FMTBIT_U18_3LE (1ULL << SNDRV_PCM_FORMAT_U18_3LE) 175 #define SNDRV_PCM_FMTBIT_S18_3BE (1ULL << SNDRV_PCM_FORMAT_S18_3BE) 176 #define SNDRV_PCM_FMTBIT_U18_3BE (1ULL << SNDRV_PCM_FORMAT_U18_3BE) 177 #define SNDRV_PCM_FMTBIT_G723_24 (1ULL << SNDRV_PCM_FORMAT_G723_24) 178 #define SNDRV_PCM_FMTBIT_G723_24_1B (1ULL << SNDRV_PCM_FORMAT_G723_24_1B) 179 #define SNDRV_PCM_FMTBIT_G723_40 (1ULL << SNDRV_PCM_FORMAT_G723_40) 180 #define SNDRV_PCM_FMTBIT_G723_40_1B (1ULL << SNDRV_PCM_FORMAT_G723_40_1B) 136 #define SNDRV_PCM_RATE_8000_384000 (SNDRV_PCM_RATE_8000_192000|\ 137 SNDRV_PCM_RATE_352800|\ 138 SNDRV_PCM_RATE_384000) 139 #define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt) 140 #define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8) 141 #define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8) 142 #define SNDRV_PCM_FMTBIT_S16_LE _SNDRV_PCM_FMTBIT(S16_LE) 143 #define SNDRV_PCM_FMTBIT_S16_BE _SNDRV_PCM_FMTBIT(S16_BE) 144 #define SNDRV_PCM_FMTBIT_U16_LE _SNDRV_PCM_FMTBIT(U16_LE) 145 #define SNDRV_PCM_FMTBIT_U16_BE _SNDRV_PCM_FMTBIT(U16_BE) 146 #define SNDRV_PCM_FMTBIT_S24_LE _SNDRV_PCM_FMTBIT(S24_LE) 147 #define SNDRV_PCM_FMTBIT_S24_BE _SNDRV_PCM_FMTBIT(S24_BE) 148 #define SNDRV_PCM_FMTBIT_U24_LE _SNDRV_PCM_FMTBIT(U24_LE) 149 #define SNDRV_PCM_FMTBIT_U24_BE _SNDRV_PCM_FMTBIT(U24_BE) 150 #define SNDRV_PCM_FMTBIT_S32_LE _SNDRV_PCM_FMTBIT(S32_LE) 151 #define SNDRV_PCM_FMTBIT_S32_BE _SNDRV_PCM_FMTBIT(S32_BE) 152 #define SNDRV_PCM_FMTBIT_U32_LE _SNDRV_PCM_FMTBIT(U32_LE) 153 #define SNDRV_PCM_FMTBIT_U32_BE _SNDRV_PCM_FMTBIT(U32_BE) 154 #define SNDRV_PCM_FMTBIT_FLOAT_LE _SNDRV_PCM_FMTBIT(FLOAT_LE) 155 #define SNDRV_PCM_FMTBIT_FLOAT_BE _SNDRV_PCM_FMTBIT(FLOAT_BE) 156 #define SNDRV_PCM_FMTBIT_FLOAT64_LE _SNDRV_PCM_FMTBIT(FLOAT64_LE) 157 #define SNDRV_PCM_FMTBIT_FLOAT64_BE _SNDRV_PCM_FMTBIT(FLOAT64_BE) 158 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_LE) 159 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_BE) 160 #define SNDRV_PCM_FMTBIT_MU_LAW _SNDRV_PCM_FMTBIT(MU_LAW) 161 #define SNDRV_PCM_FMTBIT_A_LAW _SNDRV_PCM_FMTBIT(A_LAW) 162 #define SNDRV_PCM_FMTBIT_IMA_ADPCM _SNDRV_PCM_FMTBIT(IMA_ADPCM) 163 #define SNDRV_PCM_FMTBIT_MPEG _SNDRV_PCM_FMTBIT(MPEG) 164 #define SNDRV_PCM_FMTBIT_GSM _SNDRV_PCM_FMTBIT(GSM) 165 #define SNDRV_PCM_FMTBIT_S20_LE _SNDRV_PCM_FMTBIT(S20_LE) 166 #define SNDRV_PCM_FMTBIT_U20_LE _SNDRV_PCM_FMTBIT(U20_LE) 167 #define SNDRV_PCM_FMTBIT_S20_BE _SNDRV_PCM_FMTBIT(S20_BE) 168 #define SNDRV_PCM_FMTBIT_U20_BE _SNDRV_PCM_FMTBIT(U20_BE) 169 #define SNDRV_PCM_FMTBIT_SPECIAL _SNDRV_PCM_FMTBIT(SPECIAL) 170 #define SNDRV_PCM_FMTBIT_S24_3LE _SNDRV_PCM_FMTBIT(S24_3LE) 171 #define SNDRV_PCM_FMTBIT_U24_3LE _SNDRV_PCM_FMTBIT(U24_3LE) 172 #define SNDRV_PCM_FMTBIT_S24_3BE _SNDRV_PCM_FMTBIT(S24_3BE) 173 #define SNDRV_PCM_FMTBIT_U24_3BE _SNDRV_PCM_FMTBIT(U24_3BE) 174 #define SNDRV_PCM_FMTBIT_S20_3LE _SNDRV_PCM_FMTBIT(S20_3LE) 175 #define SNDRV_PCM_FMTBIT_U20_3LE _SNDRV_PCM_FMTBIT(U20_3LE) 176 #define SNDRV_PCM_FMTBIT_S20_3BE _SNDRV_PCM_FMTBIT(S20_3BE) 177 #define SNDRV_PCM_FMTBIT_U20_3BE _SNDRV_PCM_FMTBIT(U20_3BE) 178 #define SNDRV_PCM_FMTBIT_S18_3LE _SNDRV_PCM_FMTBIT(S18_3LE) 179 #define SNDRV_PCM_FMTBIT_U18_3LE _SNDRV_PCM_FMTBIT(U18_3LE) 180 #define SNDRV_PCM_FMTBIT_S18_3BE _SNDRV_PCM_FMTBIT(S18_3BE) 181 #define SNDRV_PCM_FMTBIT_U18_3BE _SNDRV_PCM_FMTBIT(U18_3BE) 182 #define SNDRV_PCM_FMTBIT_G723_24 _SNDRV_PCM_FMTBIT(G723_24) 183 #define SNDRV_PCM_FMTBIT_G723_24_1B _SNDRV_PCM_FMTBIT(G723_24_1B) 184 #define SNDRV_PCM_FMTBIT_G723_40 _SNDRV_PCM_FMTBIT(G723_40) 185 #define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B) 186 #define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) 187 #define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) 188 #define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE) 189 #define SNDRV_PCM_FMTBIT_DSD_U16_BE _SNDRV_PCM_FMTBIT(DSD_U16_BE) 190 #define SNDRV_PCM_FMTBIT_DSD_U32_BE _SNDRV_PCM_FMTBIT(DSD_U32_BE) 181 191 182 192 #ifdef SNDRV_LITTLE_ENDIAN … … 190 200 #define SNDRV_PCM_FMTBIT_FLOAT64 SNDRV_PCM_FMTBIT_FLOAT64_LE 191 201 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE 202 #define SNDRV_PCM_FMTBIT_S20 SNDRV_PCM_FMTBIT_S20_LE 203 #define SNDRV_PCM_FMTBIT_U20 SNDRV_PCM_FMTBIT_U20_LE 192 204 #endif 193 205 #ifdef SNDRV_BIG_ENDIAN … … 201 213 #define SNDRV_PCM_FMTBIT_FLOAT64 SNDRV_PCM_FMTBIT_FLOAT64_BE 202 214 #define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE 215 #define SNDRV_PCM_FMTBIT_S20 SNDRV_PCM_FMTBIT_S20_BE 216 #define SNDRV_PCM_FMTBIT_U20 SNDRV_PCM_FMTBIT_U20_BE 203 217 #endif 204 218 … … 206 220 struct snd_pcm_substream *substream; 207 221 int no_compat_mmap; 222 unsigned int user_pversion; /* supported protocol version */ 208 223 }; 209 224 … … 214 229 struct snd_pcm_hw_rule { 215 230 unsigned int cond; 216 snd_pcm_hw_rule_func_t func;217 231 int var; 218 232 int deps[4]; 233 234 snd_pcm_hw_rule_func_t func; 219 235 void *private; 220 236 }; … … 254 270 struct snd_pcm_hw_constraint_ratnums { 255 271 int nrats; 256 struct snd_ratnum *rats;272 const struct snd_ratnum *rats; 257 273 }; 258 274 259 275 struct snd_pcm_hw_constraint_ratdens { 260 276 int nrats; 261 struct snd_ratden *rats;277 const struct snd_ratden *rats; 262 278 }; 263 279 264 280 struct snd_pcm_hw_constraint_list { 281 const unsigned int *list; 265 282 unsigned int count; 266 unsigned int *list;267 283 unsigned int mask; 268 284 }; 269 285 270 struct snd_pcm_hwptr_log; 286 struct snd_pcm_hw_constraint_ranges { 287 unsigned int count; 288 const struct snd_interval *ranges; 289 unsigned int mask; 290 }; 291 292 /* 293 * userspace-provided audio timestamp config to kernel, 294 * structure is for internal use only and filled with dedicated unpack routine 295 */ 296 struct snd_pcm_audio_tstamp_config { 297 /* 5 of max 16 bits used */ 298 u32 type_requested:4; 299 u32 report_delay:1; /* add total delay to A/D or D/A */ 300 }; 301 302 static inline void snd_pcm_unpack_audio_tstamp_config(__u32 data, 303 struct snd_pcm_audio_tstamp_config *config) 304 { 305 config->type_requested = data & 0xF; 306 config->report_delay = (data >> 4) & 1; 307 } 308 309 /* 310 * kernel-provided audio timestamp report to user-space 311 * structure is for internal use only and read by dedicated pack routine 312 */ 313 struct snd_pcm_audio_tstamp_report { 314 /* 6 of max 16 bits used for bit-fields */ 315 316 /* for backwards compatibility */ 317 u32 valid:1; 318 319 /* actual type if hardware could not support requested timestamp */ 320 u32 actual_type:4; 321 322 /* accuracy represented in ns units */ 323 u32 accuracy_report:1; /* 0 if accuracy unknown, 1 if accuracy field is valid */ 324 u32 accuracy; /* up to 4.29s, will be packed in separate field */ 325 }; 326 327 static inline void snd_pcm_pack_audio_tstamp_report(__u32 *data, __u32 *accuracy, 328 const struct snd_pcm_audio_tstamp_report *report) 329 { 330 u32 tmp; 331 332 tmp = report->accuracy_report; 333 tmp <<= 4; 334 tmp |= report->actual_type; 335 tmp <<= 1; 336 tmp |= report->valid; 337 338 *data &= 0xffff; /* zero-clear MSBs */ 339 *data |= (tmp << 16); 340 *accuracy = report->accuracy; 341 } 342 271 343 272 344 struct snd_pcm_runtime { 273 345 /* -- Status -- */ 274 346 struct snd_pcm_substream *trigger_master; 275 struct timespec trigger_tstamp; /* trigger timestamp */ 347 struct timespec64 trigger_tstamp; /* trigger timestamp */ 348 bool trigger_tstamp_latched; /* trigger timestamp latched in low-level driver/hardware */ 276 349 int overrange; 277 350 snd_pcm_uframes_t avail_max; … … 281 354 unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */ 282 355 snd_pcm_sframes_t delay; /* extra delay; typically FIFO size */ 356 u64 hw_ptr_wrap; /* offset for hw_ptr due to boundary wrap-around */ 283 357 284 358 /* -- HW params -- */ … … 324 398 wait_queue_head_t tsleep; /* transfer sleep */ 325 399 struct fasync_struct *fasync; 400 bool stop_operating; /* sync_stop will be called */ 326 401 327 402 /* -- private section -- */ … … 332 407 struct snd_pcm_hardware hw; 333 408 struct snd_pcm_hw_constraints hw_constraints; 334 335 /* -- interrupt callbacks -- */336 void (*transfer_ack_begin)(struct snd_pcm_substream *substream);337 void (*transfer_ack_end)(struct snd_pcm_substream *substream);338 409 339 410 /* -- timer -- */ … … 347 418 348 419 struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */ 349 350 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 420 unsigned int buffer_changed:1; /* buffer allocation changed; set only in managed mode */ 421 422 /* -- audio timestamp config -- */ 423 struct snd_pcm_audio_tstamp_config audio_tstamp_config; 424 struct snd_pcm_audio_tstamp_report audio_tstamp_report; 425 struct timespec64 driver_tstamp; 426 427 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 351 428 /* -- OSS things -- */ 352 429 struct snd_pcm_oss_runtime oss; 353 430 #endif 354 355 #ifdef CONFIG_SND_PCM_XRUN_DEBUG356 struct snd_pcm_hwptr_log *hwptr_log;357 #endif358 431 }; 359 432 360 433 struct snd_pcm_group { /* keep linked substreams */ 361 434 spinlock_t lock; 435 struct mutex mutex; 362 436 struct list_head substreams; 363 int count;437 refcount_t refs; 364 438 }; 365 439 … … 373 447 char name[32]; /* substream name */ 374 448 int stream; /* stream (direction) */ 375 #ifndef TARGET_OS2 376 struct pm_qos_request_list latency_pm_qos_req; /* pm_qos request */ 377 #else 378 char latency_id[20]; 379 #endif 449 struct pm_qos_request latency_pm_qos_req; /* pm_qos request */ 380 450 size_t buffer_bytes_max; /* limit ring buffer size */ 381 451 struct snd_dma_buffer dma_buffer; 382 unsigned int dma_buf_id;383 452 size_t dma_max; 384 453 /* -- hardware operations -- */ 385 struct snd_pcm_ops *ops;454 const struct snd_pcm_ops *ops; 386 455 /* -- runtime information -- */ 387 456 struct snd_pcm_runtime *runtime; … … 389 458 struct snd_timer *timer; /* timer */ 390 459 unsigned timer_running: 1; /* time is running */ 460 long wait_time; /* time in ms for R/W to wait for avail */ 391 461 /* -- next substream -- */ 392 462 struct snd_pcm_substream *next; … … 396 466 struct snd_pcm_group *group; /* pointer to current group */ 397 467 /* -- assigned files -- */ 398 void *file;399 468 int ref_count; 400 469 atomic_t mmap_count; … … 402 471 void (*pcm_release)(struct snd_pcm_substream *); 403 472 struct pid *pid; 404 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)473 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 405 474 /* -- OSS things -- */ 406 475 struct snd_pcm_oss_substream oss; … … 408 477 #ifdef CONFIG_SND_VERBOSE_PROCFS 409 478 struct snd_info_entry *proc_root; 410 struct snd_info_entry *proc_info_entry; 411 struct snd_info_entry *proc_hw_params_entry; 412 struct snd_info_entry *proc_sw_params_entry; 413 struct snd_info_entry *proc_status_entry; 414 struct snd_info_entry *proc_prealloc_entry; 415 struct snd_info_entry *proc_prealloc_max_entry; 416 #endif 479 #endif /* CONFIG_SND_VERBOSE_PROCFS */ 417 480 /* misc flags */ 418 481 unsigned int hw_opened: 1; 482 unsigned int managed_buffer_alloc:1; 419 483 }; 420 484 … … 429 493 unsigned int substream_opened; 430 494 struct snd_pcm_substream *substream; 431 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)495 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 432 496 /* -- OSS things -- */ 433 497 struct snd_pcm_oss_stream oss; … … 435 499 #ifdef CONFIG_SND_VERBOSE_PROCFS 436 500 struct snd_info_entry *proc_root; 437 struct snd_info_entry *proc_info_entry;438 501 #ifdef CONFIG_SND_PCM_XRUN_DEBUG 439 502 unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */ 440 struct snd_info_entry *proc_xrun_debug_entry; 441 #endif 442 #endif 503 #endif 504 #endif 505 struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */ 506 struct device dev; 443 507 }; 444 508 … … 457 521 void *private_data; 458 522 void (*private_free) (struct snd_pcm *pcm); 459 struct device *dev; /* actual hw device this belongs to */ 460 #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 523 bool internal; /* pcm is for internal use only */ 524 bool nonatomic; /* whole PCM operations are in non-atomic context */ 525 bool no_device_suspend; /* don't invoke device PM suspend */ 526 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 461 527 struct snd_pcm_oss oss; 462 528 #endif 463 529 }; 464 530 531 /* 532 * Registering 533 */ 534 535 extern const struct file_operations snd_pcm_f_ops[2]; 536 537 int snd_pcm_new(struct snd_card *card, const char *id, int device, 538 int playback_count, int capture_count, 539 struct snd_pcm **rpcm); 540 int snd_pcm_new_internal(struct snd_card *card, const char *id, int device, 541 int playback_count, int capture_count, 542 struct snd_pcm **rpcm); 543 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count); 544 545 #if IS_ENABLED(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS) 465 546 struct snd_pcm_notify { 466 547 int (*n_register) (struct snd_pcm * pcm); … … 469 550 struct list_head list; 470 551 }; 471 472 /*473 * Registering474 */475 476 #ifndef TARGET_OS2477 extern const struct file_operations snd_pcm_f_ops[2];478 #else479 extern struct file_operations snd_pcm_f_ops[2];480 #endif481 482 int snd_pcm_new(struct snd_card *card, const char *id, int device,483 int playback_count, int capture_count,484 struct snd_pcm **rpcm);485 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);486 487 552 int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree); 553 #endif 488 554 489 555 /* 490 556 * Native I/O 491 557 */ 492 493 extern rwlock_t snd_pcm_link_rwlock;494 558 495 559 int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info); 496 560 int snd_pcm_info_user(struct snd_pcm_substream *substream, 497 561 struct snd_pcm_info __user *info); 498 int snd_pcm_status (struct snd_pcm_substream *substream,499 struct snd_pcm_status*status);562 int snd_pcm_status64(struct snd_pcm_substream *substream, 563 struct snd_pcm_status64 *status); 500 564 int snd_pcm_start(struct snd_pcm_substream *substream); 501 int snd_pcm_stop(struct snd_pcm_substream *substream, int status);565 int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status); 502 566 int snd_pcm_drain_done(struct snd_pcm_substream *substream); 567 int snd_pcm_stop_xrun(struct snd_pcm_substream *substream); 503 568 #ifdef CONFIG_PM 504 int snd_pcm_suspend(struct snd_pcm_substream *substream);505 569 int snd_pcm_suspend_all(struct snd_pcm *pcm); 570 #else 571 static inline int snd_pcm_suspend_all(struct snd_pcm *pcm) 572 { 573 return 0; 574 } 506 575 #endif 507 576 int snd_pcm_kernel_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg); … … 512 581 struct snd_pcm_substream **rsubstream); 513 582 void snd_pcm_detach_substream(struct snd_pcm_substream *substream); 514 void snd_pcm_vma_notify_data(void *client, void *data);515 583 int snd_pcm_mmap_data(struct snd_pcm_substream *substream, struct file *file, struct vm_area_struct *area); 584 585 586 #ifdef CONFIG_SND_DEBUG 587 void snd_pcm_debug_name(struct snd_pcm_substream *substream, 588 char *name, size_t len); 589 #else 590 static inline void 591 snd_pcm_debug_name(struct snd_pcm_substream *substream, char *buf, size_t size) 592 { 593 *buf = 0; 594 } 595 #endif 516 596 517 597 /* … … 519 599 */ 520 600 601 /** 602 * snd_pcm_stream_linked - Check whether the substream is linked with others 603 * @substream: substream to check 604 * 605 * Returns true if the given substream is being linked with others. 606 */ 521 607 static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream) 522 608 { … … 524 610 } 525 611 526 static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream) 527 { 528 read_lock(&snd_pcm_link_rwlock); 529 spin_lock(&substream->self_group.lock); 530 } 531 532 static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) 533 { 534 spin_unlock(&substream->self_group.lock); 535 read_unlock(&snd_pcm_link_rwlock); 536 } 537 538 static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream) 539 { 540 read_lock_irq(&snd_pcm_link_rwlock); 541 spin_lock(&substream->self_group.lock); 542 } 543 544 static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream) 545 { 546 spin_unlock(&substream->self_group.lock); 547 read_unlock_irq(&snd_pcm_link_rwlock); 548 } 549 550 #define snd_pcm_stream_lock_irqsave(substream, flags) \ 551 do { \ 552 read_lock_irqsave(&snd_pcm_link_rwlock, (flags)); \ 553 spin_lock(&substream->self_group.lock); \ 554 } while (0) 555 556 #define snd_pcm_stream_unlock_irqrestore(substream, flags) \ 557 do { \ 558 spin_unlock(&substream->self_group.lock); \ 559 read_unlock_irqrestore(&snd_pcm_link_rwlock, (flags)); \ 560 } while (0) 561 612 void snd_pcm_stream_lock(struct snd_pcm_substream *substream); 613 void snd_pcm_stream_unlock(struct snd_pcm_substream *substream); 614 void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream); 615 void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream); 616 unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream); 617 618 /** 619 * snd_pcm_stream_lock_irqsave - Lock the PCM stream 620 * @substream: PCM substream 621 * @flags: irq flags 622 * 623 * This locks the PCM stream like snd_pcm_stream_lock() but with the local 624 * IRQ (only when nonatomic is false). In nonatomic case, this is identical 625 * as snd_pcm_stream_lock(). 626 */ 627 #ifndef TARGET_OS2 628 #define snd_pcm_stream_lock_irqsave(substream, flags) \ 629 do { \ 630 typecheck(unsigned long, flags); \ 631 flags = _snd_pcm_stream_lock_irqsave(substream); \ 632 } while (0) 633 #else 634 #define snd_pcm_stream_lock_irqsave(substream, flags) \ 635 do { \ 636 flags = _snd_pcm_stream_lock_irqsave(substream); \ 637 } while (0) 638 #endif 639 void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream, 640 unsigned long flags); 641 642 /** 643 * snd_pcm_group_for_each_entry - iterate over the linked substreams 644 * @s: the iterator 645 * @substream: the substream 646 * 647 * Iterate over the all linked substreams to the given @substream. 648 * When @substream isn't linked with any others, this gives returns @substream 649 * itself once. 650 */ 562 651 #define snd_pcm_group_for_each_entry(s, substream) \ 563 652 list_for_each_entry(s, &substream->group->substreams, link_list, struct snd_pcm_substream) 564 653 654 #define for_each_pcm_streams(stream) \ 655 for (stream = SNDRV_PCM_STREAM_PLAYBACK; \ 656 stream <= SNDRV_PCM_STREAM_LAST; \ 657 stream++) 658 659 /** 660 * snd_pcm_running - Check whether the substream is in a running state 661 * @substream: substream to check 662 * 663 * Returns true if the given substream is in the state RUNNING, or in the 664 * state DRAINING for playback. 665 */ 565 666 static inline int snd_pcm_running(struct snd_pcm_substream *substream) 566 667 { … … 570 671 } 571 672 673 /** 674 * bytes_to_samples - Unit conversion of the size from bytes to samples 675 * @runtime: PCM runtime instance 676 * @size: size in bytes 677 */ 572 678 static inline ssize_t bytes_to_samples(struct snd_pcm_runtime *runtime, ssize_t size) 573 679 { … … 575 681 } 576 682 683 /** 684 * bytes_to_frames - Unit conversion of the size from bytes to frames 685 * @runtime: PCM runtime instance 686 * @size: size in bytes 687 */ 577 688 static inline snd_pcm_sframes_t bytes_to_frames(struct snd_pcm_runtime *runtime, ssize_t size) 578 689 { … … 580 691 } 581 692 693 /** 694 * samples_to_bytes - Unit conversion of the size from samples to bytes 695 * @runtime: PCM runtime instance 696 * @size: size in samples 697 */ 582 698 static inline ssize_t samples_to_bytes(struct snd_pcm_runtime *runtime, ssize_t size) 583 699 { … … 585 701 } 586 702 703 /** 704 * frames_to_bytes - Unit conversion of the size from frames to bytes 705 * @runtime: PCM runtime instance 706 * @size: size in frames 707 */ 587 708 static inline ssize_t frames_to_bytes(struct snd_pcm_runtime *runtime, snd_pcm_sframes_t size) 588 709 { … … 590 711 } 591 712 713 /** 714 * frame_aligned - Check whether the byte size is aligned to frames 715 * @runtime: PCM runtime instance 716 * @bytes: size in bytes 717 */ 592 718 static inline int frame_aligned(struct snd_pcm_runtime *runtime, ssize_t bytes) 593 719 { … … 595 721 } 596 722 723 /** 724 * snd_pcm_lib_buffer_bytes - Get the buffer size of the current PCM in bytes 725 * @substream: PCM substream 726 */ 597 727 static inline size_t snd_pcm_lib_buffer_bytes(struct snd_pcm_substream *substream) 598 728 { … … 601 731 } 602 732 733 /** 734 * snd_pcm_lib_period_bytes - Get the period size of the current PCM in bytes 735 * @substream: PCM substream 736 */ 603 737 static inline size_t snd_pcm_lib_period_bytes(struct snd_pcm_substream *substream) 604 738 { … … 607 741 } 608 742 609 /* 610 * result is: 0 ... (boundary - 1) 743 /** 744 * snd_pcm_playback_avail - Get the available (writable) space for playback 745 * @runtime: PCM runtime instance 746 * 747 * Result is between 0 ... (boundary - 1) 611 748 */ 612 749 static inline snd_pcm_uframes_t snd_pcm_playback_avail(struct snd_pcm_runtime *runtime) … … 633 770 } 634 771 635 /* 636 * result is: 0 ... (boundary - 1) 772 /** 773 * snd_pcm_capture_avail - Get the available (readable) space for capture 774 * @runtime: PCM runtime instance 775 * 776 * Result is between 0 ... (boundary - 1) 637 777 */ 638 778 static inline snd_pcm_uframes_t snd_pcm_capture_avail(struct snd_pcm_runtime *runtime) … … 644 784 } 645 785 786 /** 787 * snd_pcm_playback_hw_avail - Get the queued space for playback 788 * @runtime: PCM runtime instance 789 */ 646 790 static inline snd_pcm_sframes_t snd_pcm_playback_hw_avail(struct snd_pcm_runtime *runtime) 647 791 { … … 649 793 } 650 794 795 /** 796 * snd_pcm_capture_hw_avail - Get the free space for capture 797 * @runtime: PCM runtime instance 798 */ 651 799 static inline snd_pcm_sframes_t snd_pcm_capture_hw_avail(struct snd_pcm_runtime *runtime) 652 800 { … … 660 808 * Checks whether enough free space is available on the playback buffer. 661 809 * 662 * Return s non-zero if available, or zero if not.810 * Return: Non-zero if available, or zero if not. 663 811 */ 664 812 static inline int snd_pcm_playback_ready(struct snd_pcm_substream *substream) … … 674 822 * Checks whether enough capture data is available on the capture buffer. 675 823 * 676 * Return s non-zero if available, or zero if not.824 * Return: Non-zero if available, or zero if not. 677 825 */ 678 826 static inline int snd_pcm_capture_ready(struct snd_pcm_substream *substream) … … 686 834 * @substream: the pcm substream instance 687 835 * 688 * Checks whether any data exists on the playback buffer. If stop_threshold 836 * Checks whether any data exists on the playback buffer. 837 * 838 * Return: Non-zero if any data exists, or zero if not. If stop_threshold 689 839 * is bigger or equal to boundary, then this function returns always non-zero. 690 *691 * Returns non-zero if exists, or zero if not.692 840 */ 693 841 static inline int snd_pcm_playback_data(struct snd_pcm_substream *substream) … … 706 854 * Checks whether the playback buffer is empty. 707 855 * 708 * Return s non-zero if empty, or zero if not.856 * Return: Non-zero if empty, or zero if not. 709 857 */ 710 858 static inline int snd_pcm_playback_empty(struct snd_pcm_substream *substream) … … 720 868 * Checks whether the capture buffer is empty. 721 869 * 722 * Return s non-zero if empty, or zero if not.870 * Return: Non-zero if empty, or zero if not. 723 871 */ 724 872 static inline int snd_pcm_capture_empty(struct snd_pcm_substream *substream) … … 728 876 } 729 877 878 /** 879 * snd_pcm_trigger_done - Mark the master substream 880 * @substream: the pcm substream instance 881 * @master: the linked master substream 882 * 883 * When multiple substreams of the same card are linked and the hardware 884 * supports the single-shot operation, the driver calls this in the loop 885 * in snd_pcm_group_for_each_entry() for marking the substream as "done". 886 * Then most of trigger operations are performed only to the given master 887 * substream. 888 * 889 * The trigger_master mark is cleared at timestamp updates at the end 890 * of trigger operations. 891 */ 730 892 static inline void snd_pcm_trigger_done(struct snd_pcm_substream *substream, 731 893 struct snd_pcm_substream *master) … … 770 932 } 771 933 772 #define params_access(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_ACCESS)) 773 #define params_format(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_FORMAT)) 774 #define params_subformat(p) snd_mask_min(hw_param_mask((p), SNDRV_PCM_HW_PARAM_SUBFORMAT)) 775 #define params_channels(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_CHANNELS)->min 776 #define params_rate(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_RATE)->min 777 #define params_period_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min 778 #define params_period_bytes(p) ((params_period_size(p)*snd_pcm_format_physical_width(params_format(p))*params_channels(p))/8) 779 #define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min 780 #define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min 781 #define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min 782 934 /** 935 * params_channels - Get the number of channels from the hw params 936 * @p: hw params 937 */ 938 static inline unsigned int params_channels(const struct snd_pcm_hw_params *p) 939 { 940 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_CHANNELS)->min; 941 } 942 943 /** 944 * params_rate - Get the sample rate from the hw params 945 * @p: hw params 946 */ 947 static inline unsigned int params_rate(const struct snd_pcm_hw_params *p) 948 { 949 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_RATE)->min; 950 } 951 952 /** 953 * params_period_size - Get the period size (in frames) from the hw params 954 * @p: hw params 955 */ 956 static inline unsigned int params_period_size(const struct snd_pcm_hw_params *p) 957 { 958 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIOD_SIZE)->min; 959 } 960 961 /** 962 * params_periods - Get the number of periods from the hw params 963 * @p: hw params 964 */ 965 static inline unsigned int params_periods(const struct snd_pcm_hw_params *p) 966 { 967 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_PERIODS)->min; 968 } 969 970 /** 971 * params_buffer_size - Get the buffer size (in frames) from the hw params 972 * @p: hw params 973 */ 974 static inline unsigned int params_buffer_size(const struct snd_pcm_hw_params *p) 975 { 976 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min; 977 } 978 979 /** 980 * params_buffer_bytes - Get the buffer size (in bytes) from the hw params 981 * @p: hw params 982 */ 983 static inline unsigned int params_buffer_bytes(const struct snd_pcm_hw_params *p) 984 { 985 return hw_param_interval_c(p, SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min; 986 } 783 987 784 988 int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v); 785 void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); 786 void snd_interval_div(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c); 787 void snd_interval_muldivk(const struct snd_interval *a, const struct snd_interval *b, 788 unsigned int k, struct snd_interval *c); 789 void snd_interval_mulkdiv(const struct snd_interval *a, unsigned int k, 790 const struct snd_interval *b, struct snd_interval *c); 791 int snd_interval_list(struct snd_interval *i, unsigned int count, unsigned int *list, unsigned int mask); 989 int snd_interval_list(struct snd_interval *i, unsigned int count, 990 const unsigned int *list, unsigned int mask); 991 int snd_interval_ranges(struct snd_interval *i, unsigned int count, 992 const struct snd_interval *list, unsigned int mask); 792 993 int snd_interval_ratnum(struct snd_interval *i, 793 unsigned int rats_count, struct snd_ratnum *rats,994 unsigned int rats_count, const struct snd_ratnum *rats, 794 995 unsigned int *nump, unsigned int *denp); 795 996 796 997 void _snd_pcm_hw_params_any(struct snd_pcm_hw_params *params); 797 998 void _snd_pcm_hw_param_setempty(struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var); 798 int snd_pcm_hw_params_choose(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params);799 999 800 1000 int snd_pcm_hw_refine(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params); 801 1001 802 int snd_pcm_hw_constraints_init(struct snd_pcm_substream *substream);803 int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream);804 805 int snd_pcm_hw_constraint_mask(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var,806 u_int32_t mask);807 1002 int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, 808 1003 u_int64_t mask); … … 813 1008 unsigned int cond, 814 1009 snd_pcm_hw_param_t var, 815 struct snd_pcm_hw_constraint_list *l); 1010 const struct snd_pcm_hw_constraint_list *l); 1011 int snd_pcm_hw_constraint_ranges(struct snd_pcm_runtime *runtime, 1012 unsigned int cond, 1013 snd_pcm_hw_param_t var, 1014 const struct snd_pcm_hw_constraint_ranges *r); 816 1015 int snd_pcm_hw_constraint_ratnums(struct snd_pcm_runtime *runtime, 817 1016 unsigned int cond, 818 1017 snd_pcm_hw_param_t var, 819 struct snd_pcm_hw_constraint_ratnums *r);1018 const struct snd_pcm_hw_constraint_ratnums *r); 820 1019 int snd_pcm_hw_constraint_ratdens(struct snd_pcm_runtime *runtime, 821 1020 unsigned int cond, 822 1021 snd_pcm_hw_param_t var, 823 struct snd_pcm_hw_constraint_ratdens *r);1022 const struct snd_pcm_hw_constraint_ratdens *r); 824 1023 int snd_pcm_hw_constraint_msbits(struct snd_pcm_runtime *runtime, 825 1024 unsigned int cond, … … 833 1032 unsigned int cond, 834 1033 snd_pcm_hw_param_t var); 1034 int snd_pcm_hw_rule_noresample(struct snd_pcm_runtime *runtime, 1035 unsigned int base_rate); 835 1036 int snd_pcm_hw_rule_add(struct snd_pcm_runtime *runtime, 836 1037 unsigned int cond, … … 839 1040 int dep, ...); 840 1041 1042 /** 1043 * snd_pcm_hw_constraint_single() - Constrain parameter to a single value 1044 * @runtime: PCM runtime instance 1045 * @var: The hw_params variable to constrain 1046 * @val: The value to constrain to 1047 * 1048 * Return: Positive if the value is changed, zero if it's not changed, or a 1049 * negative error code. 1050 */ 1051 static inline int snd_pcm_hw_constraint_single( 1052 struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, 1053 unsigned int val) 1054 { 1055 return snd_pcm_hw_constraint_minmax(runtime, var, val, val); 1056 } 1057 841 1058 int snd_pcm_format_signed(snd_pcm_format_t format); 842 1059 int snd_pcm_format_unsigned(snd_pcm_format_t format); … … 844 1061 int snd_pcm_format_little_endian(snd_pcm_format_t format); 845 1062 int snd_pcm_format_big_endian(snd_pcm_format_t format); 846 #if 0 /* just for DocBook*/1063 #if 0 /* just for kernel-doc */ 847 1064 /** 848 1065 * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian 849 1066 * @format: the format to check 850 1067 * 851 * Return s1 if the given PCM format is CPU-endian, 0 if1068 * Return: 1 if the given PCM format is CPU-endian, 0 if 852 1069 * opposite, or a negative error code if endian not specified. 853 1070 */ … … 864 1081 const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format); 865 1082 int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int frames); 866 snd_pcm_format_t snd_pcm_build_linear_format(int width, int unsignd, int big_endian); 867 868 void snd_pcm_set_ops(struct snd_pcm * pcm, int direction,struct snd_pcm_ops *ops);1083 1084 void snd_pcm_set_ops(struct snd_pcm * pcm, int direction, 1085 const struct snd_pcm_ops *ops); 869 1086 void snd_pcm_set_sync(struct snd_pcm_substream *substream); 870 int snd_pcm_lib_interleave_len(struct snd_pcm_substream *substream);871 1087 int snd_pcm_lib_ioctl(struct snd_pcm_substream *substream, 872 1088 unsigned int cmd, void *arg); 873 int snd_pcm_update_state(struct snd_pcm_substream *substream,874 struct snd_pcm_runtime *runtime);875 int snd_pcm_update_hw_ptr(struct snd_pcm_substream *substream);876 int snd_pcm_playback_xrun_check(struct snd_pcm_substream *substream);877 int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);878 int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);879 int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream);880 void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);881 1089 void snd_pcm_period_elapsed(struct snd_pcm_substream *substream); 882 snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream, 883 const void __user *buf, 884 snd_pcm_uframes_t frames); 885 snd_pcm_sframes_t snd_pcm_lib_read(struct snd_pcm_substream *substream, 886 void __user *buf, snd_pcm_uframes_t frames); 887 snd_pcm_sframes_t snd_pcm_lib_writev(struct snd_pcm_substream *substream, 888 void __user **bufs, snd_pcm_uframes_t frames); 889 snd_pcm_sframes_t snd_pcm_lib_readv(struct snd_pcm_substream *substream, 890 void __user **bufs, snd_pcm_uframes_t frames); 891 892 extern const struct snd_pcm_hw_constraint_list snd_pcm_known_rates; 893 894 int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); 1090 snd_pcm_sframes_t __snd_pcm_lib_xfer(struct snd_pcm_substream *substream, 1091 void *buf, bool interleaved, 1092 snd_pcm_uframes_t frames, bool in_kernel); 1093 1094 static inline snd_pcm_sframes_t 1095 snd_pcm_lib_write(struct snd_pcm_substream *substream, 1096 const void __user *buf, snd_pcm_uframes_t frames) 1097 { 1098 return __snd_pcm_lib_xfer(substream, (void __force *)buf, true, frames, false); 1099 } 1100 1101 static inline snd_pcm_sframes_t 1102 snd_pcm_lib_read(struct snd_pcm_substream *substream, 1103 void __user *buf, snd_pcm_uframes_t frames) 1104 { 1105 return __snd_pcm_lib_xfer(substream, (void __force *)buf, true, frames, false); 1106 } 1107 1108 static inline snd_pcm_sframes_t 1109 snd_pcm_lib_writev(struct snd_pcm_substream *substream, 1110 void __user **bufs, snd_pcm_uframes_t frames) 1111 { 1112 return __snd_pcm_lib_xfer(substream, (void *)bufs, false, frames, false); 1113 } 1114 1115 static inline snd_pcm_sframes_t 1116 snd_pcm_lib_readv(struct snd_pcm_substream *substream, 1117 void __user **bufs, snd_pcm_uframes_t frames) 1118 { 1119 return __snd_pcm_lib_xfer(substream, (void *)bufs, false, frames, false); 1120 } 1121 1122 static inline snd_pcm_sframes_t 1123 snd_pcm_kernel_write(struct snd_pcm_substream *substream, 1124 const void *buf, snd_pcm_uframes_t frames) 1125 { 1126 return __snd_pcm_lib_xfer(substream, (void *)buf, true, frames, true); 1127 } 1128 1129 static inline snd_pcm_sframes_t 1130 snd_pcm_kernel_read(struct snd_pcm_substream *substream, 1131 void *buf, snd_pcm_uframes_t frames) 1132 { 1133 return __snd_pcm_lib_xfer(substream, buf, true, frames, true); 1134 } 1135 1136 static inline snd_pcm_sframes_t 1137 snd_pcm_kernel_writev(struct snd_pcm_substream *substream, 1138 void **bufs, snd_pcm_uframes_t frames) 1139 { 1140 return __snd_pcm_lib_xfer(substream, bufs, false, frames, true); 1141 } 1142 1143 static inline snd_pcm_sframes_t 1144 snd_pcm_kernel_readv(struct snd_pcm_substream *substream, 1145 void **bufs, snd_pcm_uframes_t frames) 1146 { 1147 return __snd_pcm_lib_xfer(substream, bufs, false, frames, true); 1148 } 1149 1150 int snd_pcm_hw_limit_rates(struct snd_pcm_hardware *hw); 1151 1152 static inline int 1153 snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime) 1154 { 1155 return snd_pcm_hw_limit_rates(&runtime->hw); 1156 } 1157 895 1158 unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate); 896 1159 unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit); 1160 unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a, 1161 unsigned int rates_b); 1162 unsigned int snd_pcm_rate_range_to_bits(unsigned int rate_min, 1163 unsigned int rate_max); 1164 1165 /** 1166 * snd_pcm_set_runtime_buffer - Set the PCM runtime buffer 1167 * @substream: PCM substream to set 1168 * @bufp: the buffer information, NULL to clear 1169 * 1170 * Copy the buffer information to runtime->dma_buffer when @bufp is non-NULL. 1171 * Otherwise it clears the current buffer information. 1172 */ 897 1173 static inline void snd_pcm_set_runtime_buffer(struct snd_pcm_substream *substream, 898 1174 struct snd_dma_buffer *bufp) … … 912 1188 } 913 1189 914 /* 915 * Timer interface 916 */ 917 918 void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream); 919 void snd_pcm_timer_init(struct snd_pcm_substream *substream); 920 void snd_pcm_timer_done(struct snd_pcm_substream *substream); 921 1190 /** 1191 * snd_pcm_gettime - Fill the timespec64 depending on the timestamp mode 1192 * @runtime: PCM runtime instance 1193 * @tv: timespec64 to fill 1194 */ 922 1195 static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, 923 struct timespec *tv) 924 { 925 if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC) 926 do_posix_clock_monotonic_gettime(tv); 927 else 928 getnstimeofday(tv); 1196 struct timespec64 *tv) 1197 { 1198 switch (runtime->tstamp_type) { 1199 case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC: 1200 ktime_get_ts64(tv); 1201 break; 1202 case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW: 1203 ktime_get_raw_ts64(tv); 1204 break; 1205 default: 1206 ktime_get_real_ts64(tv); 1207 break; 1208 } 929 1209 } 930 1210 … … 933 1213 */ 934 1214 935 intsnd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream);936 intsnd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm);937 intsnd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream,1215 void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream); 1216 void snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm); 1217 void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, 938 1218 int type, struct device *data, 939 1219 size_t size, size_t max); 940 intsnd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,1220 void snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, 941 1221 int type, void *data, 942 1222 size_t size, size_t max); 943 1223 int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); 944 1224 int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); 1225 1226 void snd_pcm_set_managed_buffer(struct snd_pcm_substream *substream, int type, 1227 struct device *data, size_t size, size_t max); 1228 void snd_pcm_set_managed_buffer_all(struct snd_pcm *pcm, int type, 1229 struct device *data, 1230 size_t size, size_t max); 945 1231 946 1232 int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, … … 949 1235 struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, 950 1236 unsigned long offset); 951 #if 0 /* for kernel-doc */952 1237 /** 953 1238 * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer … … 959 1244 * if the buffer is accessed by kernel code but not by device DMA. 960 1245 * 961 * Return s1 if the buffer was changed, 0 if not changed, or a negative error1246 * Return: 1 if the buffer was changed, 0 if not changed, or a negative error 962 1247 * code. 963 1248 */ 964 static int snd_pcm_lib_alloc_vmalloc_buffer 965 (struct snd_pcm_substream *substream, size_t size); 1249 static inline int snd_pcm_lib_alloc_vmalloc_buffer 1250 (struct snd_pcm_substream *substream, size_t size) 1251 { 1252 return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, 1253 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); 1254 } 1255 966 1256 /** 967 1257 * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer … … 971 1261 * This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses 972 1262 * vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory. 973 */ 974 static int snd_pcm_lib_alloc_vmalloc_32_buffer 975 (struct snd_pcm_substream *substream, size_t size); 976 #endif 977 #define snd_pcm_lib_alloc_vmalloc_buffer(subs, size) \ 978 _snd_pcm_lib_alloc_vmalloc_buffer \ 979 (subs, size, GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO) 980 #define snd_pcm_lib_alloc_vmalloc_32_buffer(subs, size) \ 981 _snd_pcm_lib_alloc_vmalloc_buffer \ 982 (subs, size, GFP_KERNEL | GFP_DMA32 | __GFP_ZERO) 1263 * 1264 * Return: 1 if the buffer was changed, 0 if not changed, or a negative error 1265 * code. 1266 */ 1267 static inline int snd_pcm_lib_alloc_vmalloc_32_buffer 1268 (struct snd_pcm_substream *substream, size_t size) 1269 { 1270 return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, 1271 GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); 1272 } 1273 1274 #define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p) 983 1275 984 1276 #ifdef CONFIG_SND_DMA_SGBUF … … 987 1279 */ 988 1280 #define snd_pcm_substream_sgbuf(substream) \ 989 ((substream)->runtime->dma_buffer_p->private_data) 990 1281 snd_pcm_get_dma_buf(substream)->private_data 1282 #endif /* SND_DMA_SGBUF */ 1283 1284 /** 1285 * snd_pcm_sgbuf_get_addr - Get the DMA address at the corresponding offset 1286 * @substream: PCM substream 1287 * @ofs: byte offset 1288 */ 991 1289 static inline dma_addr_t 992 1290 snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) 993 1291 { 994 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream); 995 return snd_sgbuf_get_addr(sg, ofs); 996 } 997 1292 return snd_sgbuf_get_addr(snd_pcm_get_dma_buf(substream), ofs); 1293 } 1294 1295 /** 1296 * snd_pcm_sgbuf_get_ptr - Get the virtual address at the corresponding offset 1297 * @substream: PCM substream 1298 * @ofs: byte offset 1299 */ 998 1300 static inline void * 999 1301 snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) 1000 1302 { 1001 struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream); 1002 return snd_sgbuf_get_ptr(sg, ofs); 1003 } 1004 1005 struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, 1006 unsigned long offset); 1007 unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, 1008 unsigned int ofs, unsigned int size); 1009 1010 #else /* !SND_DMA_SGBUF */ 1011 /* 1012 * fake using a continuous buffer 1013 */ 1014 static inline dma_addr_t 1015 snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs) 1016 { 1017 return substream->runtime->dma_addr + ofs; 1018 } 1019 1020 static inline void * 1021 snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs) 1022 { 1023 return substream->runtime->dma_area + ofs; 1024 } 1025 1026 #define snd_pcm_sgbuf_ops_page NULL 1027 1028 #define snd_pcm_sgbuf_get_chunk_size(subs, ofs, size) (size) 1029 1030 #endif /* SND_DMA_SGBUF */ 1031 1032 /* handle mmap counter - PCM mmap callback should handle this counter properly */ 1303 return snd_sgbuf_get_ptr(snd_pcm_get_dma_buf(substream), ofs); 1304 } 1305 1306 /** 1307 * snd_pcm_sgbuf_get_chunk_size - Compute the max size that fits within the 1308 * contig. page from the given size 1309 * @substream: PCM substream 1310 * @ofs: byte offset 1311 * @size: byte size to examine 1312 */ 1313 static inline unsigned int 1314 snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream, 1315 unsigned int ofs, unsigned int size) 1316 { 1317 return snd_sgbuf_get_chunk_size(snd_pcm_get_dma_buf(substream), ofs, size); 1318 } 1319 1320 /** 1321 * snd_pcm_mmap_data_open - increase the mmap counter 1322 * @area: VMA 1323 * 1324 * PCM mmap callback should handle this counter properly 1325 */ 1033 1326 static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area) 1034 1327 { … … 1037 1330 } 1038 1331 1332 /** 1333 * snd_pcm_mmap_data_close - decrease the mmap counter 1334 * @area: VMA 1335 * 1336 * PCM mmap callback should handle this counter properly 1337 */ 1039 1338 static inline void snd_pcm_mmap_data_close(struct vm_area_struct *area) 1040 1339 { … … 1043 1342 } 1044 1343 1344 int snd_pcm_lib_default_mmap(struct snd_pcm_substream *substream, 1345 struct vm_area_struct *area); 1045 1346 /* mmap for io-memory area */ 1046 1347 #if defined(CONFIG_X86) || defined(CONFIG_PPC) || defined(CONFIG_ALPHA) … … 1052 1353 #endif 1053 1354 1054 int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream, 1055 struct vm_area_struct *area); 1056 #define snd_pcm_lib_mmap_vmalloc snd_pcm_lib_mmap_noncached 1057 1355 /** 1356 * snd_pcm_limit_isa_dma_size - Get the max size fitting with ISA DMA transfer 1357 * @dma: DMA number 1358 * @max: pointer to store the max size 1359 */ 1058 1360 static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max) 1059 1361 { … … 1070 1372 (IEC958_AES3_CON_FS_48000<<24)) 1071 1373 1072 #define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)1073 1074 1374 const char *snd_pcm_format_name(snd_pcm_format_t format); 1075 1375 1376 /** 1377 * snd_pcm_stream_str - Get a string naming the direction of a stream 1378 * @substream: the pcm substream instance 1379 * 1380 * Return: A string naming the direction of the stream. 1381 */ 1382 static inline const char *snd_pcm_stream_str(struct snd_pcm_substream *substream) 1383 { 1384 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 1385 return "Playback"; 1386 else 1387 return "Capture"; 1388 } 1389 1390 /* 1391 * PCM channel-mapping control API 1392 */ 1393 /* array element of channel maps */ 1394 struct snd_pcm_chmap_elem { 1395 unsigned char channels; 1396 unsigned char map[15]; 1397 }; 1398 1399 /* channel map information; retrieved via snd_kcontrol_chip() */ 1400 struct snd_pcm_chmap { 1401 struct snd_pcm *pcm; /* assigned PCM instance */ 1402 int stream; /* PLAYBACK or CAPTURE */ 1403 struct snd_kcontrol *kctl; 1404 const struct snd_pcm_chmap_elem *chmap; 1405 unsigned int max_channels; 1406 unsigned int channel_mask; /* optional: active channels bitmask */ 1407 void *private_data; /* optional: private data pointer */ 1408 }; 1409 1410 /** 1411 * snd_pcm_chmap_substream - get the PCM substream assigned to the given chmap info 1412 * @info: chmap information 1413 * @idx: the substream number index 1414 */ 1415 static inline struct snd_pcm_substream * 1416 snd_pcm_chmap_substream(struct snd_pcm_chmap *info, unsigned int idx) 1417 { 1418 struct snd_pcm_substream *s; 1419 for (s = info->pcm->streams[info->stream].substream; s; s = s->next) 1420 if (s->number == idx) 1421 return s; 1422 return NULL; 1423 } 1424 1425 /* ALSA-standard channel maps (RL/RR prior to C/LFE) */ 1426 extern const struct snd_pcm_chmap_elem snd_pcm_std_chmaps[]; 1427 /* Other world's standard channel maps (C/LFE prior to RL/RR) */ 1428 extern const struct snd_pcm_chmap_elem snd_pcm_alt_chmaps[]; 1429 1430 /* bit masks to be passed to snd_pcm_chmap.channel_mask field */ 1431 #define SND_PCM_CHMAP_MASK_24 ((1U << 2) | (1U << 4)) 1432 #define SND_PCM_CHMAP_MASK_246 (SND_PCM_CHMAP_MASK_24 | (1U << 6)) 1433 #define SND_PCM_CHMAP_MASK_2468 (SND_PCM_CHMAP_MASK_246 | (1U << 8)) 1434 1435 int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream, 1436 const struct snd_pcm_chmap_elem *chmap, 1437 int max_channels, 1438 unsigned long private_value, 1439 struct snd_pcm_chmap **info_ret); 1440 1441 /** 1442 * pcm_format_to_bits - Strong-typed conversion of pcm_format to bitwise 1443 * @pcm_format: PCM format 1444 */ 1445 static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format) 1446 { 1447 return 1ULL << (__force int) pcm_format; 1448 } 1449 1450 /** 1451 * pcm_for_each_format - helper to iterate for each format type 1452 * @f: the iterator variable in snd_pcm_format_t type 1453 */ 1454 #define pcm_for_each_format(f) \ 1455 for ((f) = SNDRV_PCM_FORMAT_FIRST; \ 1456 (__force int)(f) <= (__force int)SNDRV_PCM_FORMAT_LAST; \ 1457 (f) = (__force snd_pcm_format_t)((__force int)(f) + 1)) 1458 1459 /* printk helpers */ 1460 #ifndef TARGET_OS2 1461 #define pcm_err(pcm, fmt, args...) \ 1462 dev_err((pcm)->card->dev, fmt, ##args) 1463 #define pcm_warn(pcm, fmt, args...) \ 1464 dev_warn((pcm)->card->dev, fmt, ##args) 1465 #define pcm_dbg(pcm, fmt, args...) \ 1466 dev_dbg((pcm)->card->dev, fmt, ##args) 1467 #else 1468 #define pcm_err pcm_dbg 1469 #define pcm_warn pcm_dbg 1470 int pcm_dbg(struct snd_pcm *dev, const char *fmt, ...); 1471 #endif 1472 1473 struct snd_pcm_status64 { 1474 snd_pcm_state_t state; /* stream state */ 1475 u8 rsvd[4]; 1476 s64 trigger_tstamp_sec; /* time when stream was started/stopped/paused */ 1477 s64 trigger_tstamp_nsec; 1478 s64 tstamp_sec; /* reference timestamp */ 1479 s64 tstamp_nsec; 1480 snd_pcm_uframes_t appl_ptr; /* appl ptr */ 1481 snd_pcm_uframes_t hw_ptr; /* hw ptr */ 1482 snd_pcm_sframes_t delay; /* current delay in frames */ 1483 snd_pcm_uframes_t avail; /* number of frames available */ 1484 snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ 1485 snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ 1486 snd_pcm_state_t suspended_state; /* suspended stream state */ 1487 __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ 1488 s64 audio_tstamp_sec; /* sample counter, wall clock, PHC or on-demand sync'ed */ 1489 s64 audio_tstamp_nsec; 1490 s64 driver_tstamp_sec; /* useful in case reference system tstamp is reported with delay */ 1491 s64 driver_tstamp_nsec; 1492 __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ 1493 unsigned char reserved[52-4*sizeof(s64)]; /* must be filled with zero */ 1494 }; 1495 1496 #define SNDRV_PCM_IOCTL_STATUS64 _IOR('A', 0x20, struct snd_pcm_status64) 1497 #define SNDRV_PCM_IOCTL_STATUS_EXT64 _IOWR('A', 0x24, struct snd_pcm_status64) 1498 1499 struct snd_pcm_status32 { 1500 snd_pcm_state_t state; /* stream state */ 1501 s32 trigger_tstamp_sec; /* time when stream was started/stopped/paused */ 1502 s32 trigger_tstamp_nsec; 1503 s32 tstamp_sec; /* reference timestamp */ 1504 s32 tstamp_nsec; 1505 u32 appl_ptr; /* appl ptr */ 1506 u32 hw_ptr; /* hw ptr */ 1507 s32 delay; /* current delay in frames */ 1508 u32 avail; /* number of frames available */ 1509 u32 avail_max; /* max frames available on hw since last status */ 1510 u32 overrange; /* count of ADC (capture) overrange detections from last status */ 1511 snd_pcm_state_t suspended_state; /* suspended stream state */ 1512 u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ 1513 s32 audio_tstamp_sec; /* sample counter, wall clock, PHC or on-demand sync'ed */ 1514 s32 audio_tstamp_nsec; 1515 s32 driver_tstamp_sec; /* useful in case reference system tstamp is reported with delay */ 1516 s32 driver_tstamp_nsec; 1517 u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ 1518 unsigned char reserved[52-4*sizeof(s32)]; /* must be filled with zero */ 1519 }; 1520 1521 #define SNDRV_PCM_IOCTL_STATUS32 _IOR('A', 0x20, struct snd_pcm_status32) 1522 #define SNDRV_PCM_IOCTL_STATUS_EXT32 _IOWR('A', 0x24, struct snd_pcm_status32) 1523 1076 1524 #endif /* __SOUND_PCM_H */
Note:
See TracChangeset
for help on using the changeset viewer.