.. | .. |
---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
---|
1 | 2 | #ifndef __SOUND_PCM_H |
---|
2 | 3 | #define __SOUND_PCM_H |
---|
3 | 4 | |
---|
.. | .. |
---|
5 | 6 | * Digital Audio (PCM) abstract layer |
---|
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 modify |
---|
11 | | - * it under the terms of the GNU General Public License as published by |
---|
12 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
13 | | - * (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 of |
---|
17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | | - * GNU General Public License for more details. |
---|
19 | | - * |
---|
20 | | - * You should have received a copy of the GNU General Public License |
---|
21 | | - * along with this program; if not, write to the Free Software |
---|
22 | | - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
23 | | - * |
---|
24 | 9 | */ |
---|
25 | 10 | |
---|
26 | 11 | #include <sound/asound.h> |
---|
.. | .. |
---|
30 | 15 | #include <linux/mm.h> |
---|
31 | 16 | #include <linux/bitops.h> |
---|
32 | 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) |
---|
.. | .. |
---|
58 | 44 | size_t fifo_size; /* fifo size in bytes */ |
---|
59 | 45 | }; |
---|
60 | 46 | |
---|
| 47 | +struct snd_pcm_status64; |
---|
61 | 48 | struct snd_pcm_substream; |
---|
62 | 49 | |
---|
63 | 50 | struct snd_pcm_audio_tstamp_config; /* definitions further down */ |
---|
.. | .. |
---|
68 | 55 | int (*close)(struct snd_pcm_substream *substream); |
---|
69 | 56 | int (*ioctl)(struct snd_pcm_substream * substream, |
---|
70 | 57 | unsigned int cmd, void *arg); |
---|
71 | | - int (*compat_ioctl)(struct snd_pcm_substream *substream, |
---|
72 | | - unsigned int cmd, void *arg); |
---|
73 | 58 | int (*hw_params)(struct snd_pcm_substream *substream, |
---|
74 | 59 | struct snd_pcm_hw_params *params); |
---|
75 | 60 | int (*hw_free)(struct snd_pcm_substream *substream); |
---|
76 | 61 | int (*prepare)(struct snd_pcm_substream *substream); |
---|
77 | 62 | int (*trigger)(struct snd_pcm_substream *substream, int cmd); |
---|
| 63 | + int (*sync_stop)(struct snd_pcm_substream *substream); |
---|
78 | 64 | snd_pcm_uframes_t (*pointer)(struct snd_pcm_substream *substream); |
---|
79 | 65 | int (*get_time_info)(struct snd_pcm_substream *substream, |
---|
80 | | - struct timespec *system_ts, struct timespec *audio_ts, |
---|
| 66 | + struct timespec64 *system_ts, struct timespec64 *audio_ts, |
---|
81 | 67 | struct snd_pcm_audio_tstamp_config *audio_tstamp_config, |
---|
82 | 68 | struct snd_pcm_audio_tstamp_report *audio_tstamp_report); |
---|
83 | | - int (*delay_blk)(struct snd_pcm_substream *substream); |
---|
84 | | - int (*wall_clock)(struct snd_pcm_substream *substream, |
---|
85 | | - struct timespec *audio_ts); |
---|
86 | 69 | int (*fill_silence)(struct snd_pcm_substream *substream, int channel, |
---|
87 | 70 | unsigned long pos, unsigned long bytes); |
---|
88 | 71 | int (*copy_user)(struct snd_pcm_substream *substream, int channel, |
---|
.. | .. |
---|
94 | 77 | unsigned long offset); |
---|
95 | 78 | int (*mmap)(struct snd_pcm_substream *substream, struct vm_area_struct *vma); |
---|
96 | 79 | int (*ack)(struct snd_pcm_substream *substream); |
---|
97 | | - int (*restart)(struct snd_pcm_substream *substream); |
---|
98 | 80 | }; |
---|
99 | 81 | |
---|
100 | 82 | /* |
---|
.. | .. |
---|
122 | 104 | #define SNDRV_PCM_TRIGGER_DRAIN 7 |
---|
123 | 105 | |
---|
124 | 106 | #define SNDRV_PCM_POS_XRUN ((snd_pcm_uframes_t)-1) |
---|
125 | | - |
---|
126 | | -#define SNDRV_DMA_MODE (0) |
---|
127 | | -#define SNDRV_NON_DMA_MODE (1 << 0) |
---|
128 | | -#define SNDRV_RENDER_STOPPED (1 << 1) |
---|
129 | | -#define SNDRV_RENDER_RUNNING (1 << 2) |
---|
130 | 107 | |
---|
131 | 108 | /* If you change this don't forget to change rates[] table in pcm_native.c */ |
---|
132 | 109 | #define SNDRV_PCM_RATE_5512 (1<<0) /* 5512Hz */ |
---|
.. | .. |
---|
367 | 344 | struct snd_pcm_runtime { |
---|
368 | 345 | /* -- Status -- */ |
---|
369 | 346 | struct snd_pcm_substream *trigger_master; |
---|
370 | | - struct timespec trigger_tstamp; /* trigger timestamp */ |
---|
| 347 | + struct timespec64 trigger_tstamp; /* trigger timestamp */ |
---|
371 | 348 | bool trigger_tstamp_latched; /* trigger timestamp latched in low-level driver/hardware */ |
---|
372 | 349 | int overrange; |
---|
373 | 350 | snd_pcm_uframes_t avail_max; |
---|
.. | .. |
---|
395 | 372 | unsigned int rate_num; |
---|
396 | 373 | unsigned int rate_den; |
---|
397 | 374 | unsigned int no_period_wakeup: 1; |
---|
398 | | - unsigned int render_flag; |
---|
399 | 375 | |
---|
400 | 376 | /* -- SW params -- */ |
---|
401 | 377 | int tstamp_mode; /* mmap timestamp is updated */ |
---|
.. | .. |
---|
421 | 397 | wait_queue_head_t sleep; /* poll sleep */ |
---|
422 | 398 | wait_queue_head_t tsleep; /* transfer sleep */ |
---|
423 | 399 | struct fasync_struct *fasync; |
---|
| 400 | + bool stop_operating; /* sync_stop will be called */ |
---|
424 | 401 | |
---|
425 | 402 | /* -- private section -- */ |
---|
426 | 403 | void *private_data; |
---|
.. | .. |
---|
440 | 417 | size_t dma_bytes; /* size of DMA area */ |
---|
441 | 418 | |
---|
442 | 419 | struct snd_dma_buffer *dma_buffer_p; /* allocated buffer */ |
---|
| 420 | + unsigned int buffer_changed:1; /* buffer allocation changed; set only in managed mode */ |
---|
443 | 421 | |
---|
444 | 422 | /* -- audio timestamp config -- */ |
---|
445 | 423 | struct snd_pcm_audio_tstamp_config audio_tstamp_config; |
---|
446 | 424 | struct snd_pcm_audio_tstamp_report audio_tstamp_report; |
---|
447 | | - struct timespec driver_tstamp; |
---|
| 425 | + struct timespec64 driver_tstamp; |
---|
448 | 426 | |
---|
449 | 427 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
---|
450 | 428 | /* -- OSS things -- */ |
---|
451 | 429 | struct snd_pcm_oss_runtime oss; |
---|
| 430 | +#endif |
---|
| 431 | +#ifndef __GENKSYMS__ |
---|
| 432 | + struct mutex buffer_mutex; /* protect for buffer changes */ |
---|
| 433 | + atomic_t buffer_accessing; /* >0: in r/w operation, <0: blocked */ |
---|
452 | 434 | #endif |
---|
453 | 435 | }; |
---|
454 | 436 | |
---|
.. | .. |
---|
456 | 438 | spinlock_t lock; |
---|
457 | 439 | struct mutex mutex; |
---|
458 | 440 | struct list_head substreams; |
---|
459 | | - int count; |
---|
| 441 | + refcount_t refs; |
---|
460 | 442 | }; |
---|
461 | 443 | |
---|
462 | 444 | struct pid; |
---|
.. | .. |
---|
476 | 458 | const struct snd_pcm_ops *ops; |
---|
477 | 459 | /* -- runtime information -- */ |
---|
478 | 460 | struct snd_pcm_runtime *runtime; |
---|
479 | | - spinlock_t runtime_lock; |
---|
480 | 461 | /* -- timer section -- */ |
---|
481 | 462 | struct snd_timer *timer; /* timer */ |
---|
482 | 463 | unsigned timer_running: 1; /* time is running */ |
---|
.. | .. |
---|
488 | 469 | struct snd_pcm_group self_group; /* fake group for non linked substream (with substream lock inside) */ |
---|
489 | 470 | struct snd_pcm_group *group; /* pointer to current group */ |
---|
490 | 471 | /* -- assigned files -- */ |
---|
491 | | - void *file; |
---|
492 | 472 | int ref_count; |
---|
493 | 473 | atomic_t mmap_count; |
---|
494 | 474 | unsigned int f_flags; |
---|
.. | .. |
---|
500 | 480 | #endif |
---|
501 | 481 | #ifdef CONFIG_SND_VERBOSE_PROCFS |
---|
502 | 482 | struct snd_info_entry *proc_root; |
---|
503 | | - struct snd_info_entry *proc_info_entry; |
---|
504 | | - struct snd_info_entry *proc_hw_params_entry; |
---|
505 | | - struct snd_info_entry *proc_sw_params_entry; |
---|
506 | | - struct snd_info_entry *proc_status_entry; |
---|
507 | | - struct snd_info_entry *proc_prealloc_entry; |
---|
508 | | - struct snd_info_entry *proc_prealloc_max_entry; |
---|
509 | | -#ifdef CONFIG_SND_PCM_XRUN_DEBUG |
---|
510 | | - struct snd_info_entry *proc_xrun_injection_entry; |
---|
511 | | -#endif |
---|
512 | 483 | #endif /* CONFIG_SND_VERBOSE_PROCFS */ |
---|
513 | 484 | /* misc flags */ |
---|
514 | 485 | unsigned int hw_opened: 1; |
---|
515 | | - unsigned int hw_no_buffer: 1; /* substream may not have a buffer */ |
---|
| 486 | + unsigned int managed_buffer_alloc:1; |
---|
516 | 487 | }; |
---|
517 | 488 | |
---|
518 | 489 | #define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0) |
---|
.. | .. |
---|
531 | 502 | #endif |
---|
532 | 503 | #ifdef CONFIG_SND_VERBOSE_PROCFS |
---|
533 | 504 | struct snd_info_entry *proc_root; |
---|
534 | | - struct snd_info_entry *proc_info_entry; |
---|
535 | 505 | #ifdef CONFIG_SND_PCM_XRUN_DEBUG |
---|
536 | 506 | unsigned int xrun_debug; /* 0 = disabled, 1 = verbose, 2 = stacktrace */ |
---|
537 | | - struct snd_info_entry *proc_xrun_debug_entry; |
---|
538 | 507 | #endif |
---|
539 | 508 | #endif |
---|
540 | 509 | struct snd_kcontrol *chmap_kctl; /* channel-mapping controls */ |
---|
541 | | - struct snd_kcontrol *vol_kctl; /* volume controls */ |
---|
542 | | - struct snd_kcontrol *usr_kctl; /* user controls */ |
---|
543 | 510 | struct device dev; |
---|
544 | 511 | }; |
---|
545 | 512 | |
---|
.. | .. |
---|
559 | 526 | void (*private_free) (struct snd_pcm *pcm); |
---|
560 | 527 | bool internal; /* pcm is for internal use only */ |
---|
561 | 528 | bool nonatomic; /* whole PCM operations are in non-atomic context */ |
---|
| 529 | + bool no_device_suspend; /* don't invoke device PM suspend */ |
---|
562 | 530 | #if IS_ENABLED(CONFIG_SND_PCM_OSS) |
---|
563 | 531 | struct snd_pcm_oss oss; |
---|
564 | 532 | #endif |
---|
.. | .. |
---|
595 | 563 | int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info); |
---|
596 | 564 | int snd_pcm_info_user(struct snd_pcm_substream *substream, |
---|
597 | 565 | struct snd_pcm_info __user *info); |
---|
598 | | -int snd_pcm_status(struct snd_pcm_substream *substream, |
---|
599 | | - struct snd_pcm_status *status); |
---|
| 566 | +int snd_pcm_status64(struct snd_pcm_substream *substream, |
---|
| 567 | + struct snd_pcm_status64 *status); |
---|
600 | 568 | int snd_pcm_start(struct snd_pcm_substream *substream); |
---|
601 | 569 | int snd_pcm_stop(struct snd_pcm_substream *substream, snd_pcm_state_t status); |
---|
602 | 570 | int snd_pcm_drain_done(struct snd_pcm_substream *substream); |
---|
603 | 571 | int snd_pcm_stop_xrun(struct snd_pcm_substream *substream); |
---|
604 | 572 | #ifdef CONFIG_PM |
---|
605 | | -int snd_pcm_suspend(struct snd_pcm_substream *substream); |
---|
606 | 573 | int snd_pcm_suspend_all(struct snd_pcm *pcm); |
---|
607 | 574 | #else |
---|
608 | | -static inline int snd_pcm_suspend(struct snd_pcm_substream *substream) |
---|
609 | | -{ |
---|
610 | | - return 0; |
---|
611 | | -} |
---|
612 | 575 | static inline int snd_pcm_suspend_all(struct snd_pcm *pcm) |
---|
613 | 576 | { |
---|
614 | 577 | return 0; |
---|
.. | .. |
---|
684 | 647 | */ |
---|
685 | 648 | #define snd_pcm_group_for_each_entry(s, substream) \ |
---|
686 | 649 | list_for_each_entry(s, &substream->group->substreams, link_list) |
---|
| 650 | + |
---|
| 651 | +#define for_each_pcm_streams(stream) \ |
---|
| 652 | + for (stream = SNDRV_PCM_STREAM_PLAYBACK; \ |
---|
| 653 | + stream <= SNDRV_PCM_STREAM_LAST; \ |
---|
| 654 | + stream++) |
---|
687 | 655 | |
---|
688 | 656 | /** |
---|
689 | 657 | * snd_pcm_running - Check whether the substream is in a running state |
---|
.. | .. |
---|
786 | 754 | } |
---|
787 | 755 | |
---|
788 | 756 | /** |
---|
789 | | - * snd_pcm_playback_avail - Get the available (readable) space for capture |
---|
| 757 | + * snd_pcm_capture_avail - Get the available (readable) space for capture |
---|
790 | 758 | * @runtime: PCM runtime instance |
---|
791 | 759 | * |
---|
792 | 760 | * Result is between 0 ... (boundary - 1) |
---|
.. | .. |
---|
1163 | 1131 | return __snd_pcm_lib_xfer(substream, bufs, false, frames, true); |
---|
1164 | 1132 | } |
---|
1165 | 1133 | |
---|
1166 | | -int snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime); |
---|
| 1134 | +int snd_pcm_hw_limit_rates(struct snd_pcm_hardware *hw); |
---|
| 1135 | + |
---|
| 1136 | +static inline int |
---|
| 1137 | +snd_pcm_limit_hw_rates(struct snd_pcm_runtime *runtime) |
---|
| 1138 | +{ |
---|
| 1139 | + return snd_pcm_hw_limit_rates(&runtime->hw); |
---|
| 1140 | +} |
---|
| 1141 | + |
---|
1167 | 1142 | unsigned int snd_pcm_rate_to_rate_bit(unsigned int rate); |
---|
1168 | 1143 | unsigned int snd_pcm_rate_bit_to_rate(unsigned int rate_bit); |
---|
1169 | 1144 | unsigned int snd_pcm_rate_mask_intersect(unsigned int rates_a, |
---|
.. | .. |
---|
1197 | 1172 | } |
---|
1198 | 1173 | |
---|
1199 | 1174 | /** |
---|
1200 | | - * snd_pcm_gettime - Fill the timespec depending on the timestamp mode |
---|
| 1175 | + * snd_pcm_gettime - Fill the timespec64 depending on the timestamp mode |
---|
1201 | 1176 | * @runtime: PCM runtime instance |
---|
1202 | | - * @tv: timespec to fill |
---|
| 1177 | + * @tv: timespec64 to fill |
---|
1203 | 1178 | */ |
---|
1204 | 1179 | static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, |
---|
1205 | | - struct timespec *tv) |
---|
| 1180 | + struct timespec64 *tv) |
---|
1206 | 1181 | { |
---|
1207 | 1182 | switch (runtime->tstamp_type) { |
---|
1208 | 1183 | case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC: |
---|
1209 | | - ktime_get_ts(tv); |
---|
| 1184 | + ktime_get_ts64(tv); |
---|
1210 | 1185 | break; |
---|
1211 | 1186 | case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW: |
---|
1212 | | - getrawmonotonic(tv); |
---|
| 1187 | + ktime_get_raw_ts64(tv); |
---|
1213 | 1188 | break; |
---|
1214 | 1189 | default: |
---|
1215 | | - getnstimeofday(tv); |
---|
| 1190 | + ktime_get_real_ts64(tv); |
---|
1216 | 1191 | break; |
---|
1217 | 1192 | } |
---|
1218 | 1193 | } |
---|
.. | .. |
---|
1221 | 1196 | * Memory |
---|
1222 | 1197 | */ |
---|
1223 | 1198 | |
---|
1224 | | -int snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream); |
---|
1225 | | -int snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm); |
---|
1226 | | -int snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, |
---|
| 1199 | +void snd_pcm_lib_preallocate_free(struct snd_pcm_substream *substream); |
---|
| 1200 | +void snd_pcm_lib_preallocate_free_for_all(struct snd_pcm *pcm); |
---|
| 1201 | +void snd_pcm_lib_preallocate_pages(struct snd_pcm_substream *substream, |
---|
1227 | 1202 | int type, struct device *data, |
---|
1228 | 1203 | size_t size, size_t max); |
---|
1229 | | -int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, |
---|
| 1204 | +void snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm, |
---|
1230 | 1205 | int type, void *data, |
---|
1231 | 1206 | size_t size, size_t max); |
---|
1232 | 1207 | int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size); |
---|
1233 | 1208 | int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream); |
---|
| 1209 | + |
---|
| 1210 | +void snd_pcm_set_managed_buffer(struct snd_pcm_substream *substream, int type, |
---|
| 1211 | + struct device *data, size_t size, size_t max); |
---|
| 1212 | +void snd_pcm_set_managed_buffer_all(struct snd_pcm *pcm, int type, |
---|
| 1213 | + struct device *data, |
---|
| 1214 | + size_t size, size_t max); |
---|
1234 | 1215 | |
---|
1235 | 1216 | int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, |
---|
1236 | 1217 | size_t size, gfp_t gfp_flags); |
---|
.. | .. |
---|
1282 | 1263 | */ |
---|
1283 | 1264 | #define snd_pcm_substream_sgbuf(substream) \ |
---|
1284 | 1265 | snd_pcm_get_dma_buf(substream)->private_data |
---|
1285 | | - |
---|
1286 | | -struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, |
---|
1287 | | - unsigned long offset); |
---|
1288 | | -#else /* !SND_DMA_SGBUF */ |
---|
1289 | | -/* |
---|
1290 | | - * fake using a continuous buffer |
---|
1291 | | - */ |
---|
1292 | | -#define snd_pcm_sgbuf_ops_page NULL |
---|
1293 | 1266 | #endif /* SND_DMA_SGBUF */ |
---|
1294 | 1267 | |
---|
1295 | 1268 | /** |
---|
.. | .. |
---|
1315 | 1288 | } |
---|
1316 | 1289 | |
---|
1317 | 1290 | /** |
---|
1318 | | - * snd_pcm_sgbuf_chunk_size - Compute the max size that fits within the contig. |
---|
1319 | | - * page from the given size |
---|
| 1291 | + * snd_pcm_sgbuf_get_chunk_size - Compute the max size that fits within the |
---|
| 1292 | + * contig. page from the given size |
---|
1320 | 1293 | * @substream: PCM substream |
---|
1321 | 1294 | * @ofs: byte offset |
---|
1322 | 1295 | * @size: byte size to examine |
---|
.. | .. |
---|
1381 | 1354 | (IEC958_AES1_CON_ORIGINAL<<8)|\ |
---|
1382 | 1355 | (IEC958_AES1_CON_PCM_CODER<<8)|\ |
---|
1383 | 1356 | (IEC958_AES3_CON_FS_48000<<24)) |
---|
1384 | | - |
---|
1385 | | -#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime) |
---|
1386 | 1357 | |
---|
1387 | 1358 | const char *snd_pcm_format_name(snd_pcm_format_t format); |
---|
1388 | 1359 | |
---|
.. | .. |
---|
1460 | 1431 | return 1ULL << (__force int) pcm_format; |
---|
1461 | 1432 | } |
---|
1462 | 1433 | |
---|
1463 | | -/* |
---|
1464 | | - * PCM Volume control API |
---|
| 1434 | +/** |
---|
| 1435 | + * pcm_for_each_format - helper to iterate for each format type |
---|
| 1436 | + * @f: the iterator variable in snd_pcm_format_t type |
---|
1465 | 1437 | */ |
---|
1466 | | -/* array element of volume */ |
---|
1467 | | -struct snd_pcm_volume_elem { |
---|
1468 | | - int volume; |
---|
1469 | | -}; |
---|
| 1438 | +#define pcm_for_each_format(f) \ |
---|
| 1439 | + for ((f) = SNDRV_PCM_FORMAT_FIRST; \ |
---|
| 1440 | + (__force int)(f) <= (__force int)SNDRV_PCM_FORMAT_LAST; \ |
---|
| 1441 | + (f) = (__force snd_pcm_format_t)((__force int)(f) + 1)) |
---|
1470 | 1442 | |
---|
1471 | | -/* pp information; retrieved via snd_kcontrol_chip() */ |
---|
1472 | | -struct snd_pcm_volume { |
---|
1473 | | - struct snd_pcm *pcm; /* assigned PCM instance */ |
---|
1474 | | - int stream; /* PLAYBACK or CAPTURE */ |
---|
1475 | | - struct snd_kcontrol *kctl; |
---|
1476 | | - const struct snd_pcm_volume_elem *volume; |
---|
1477 | | - int max_length; |
---|
1478 | | - void *private_data; /* optional: private data pointer */ |
---|
1479 | | -}; |
---|
1480 | | - |
---|
1481 | | -int snd_pcm_add_volume_ctls(struct snd_pcm *pcm, int stream, |
---|
1482 | | - const struct snd_pcm_volume_elem *volume, |
---|
1483 | | - int max_length, |
---|
1484 | | - unsigned long private_value, |
---|
1485 | | - struct snd_pcm_volume **info_ret); |
---|
1486 | | - |
---|
1487 | | -/* |
---|
1488 | | - * PCM User control API |
---|
1489 | | - */ |
---|
1490 | | -/* array element of usr elem */ |
---|
1491 | | -struct snd_pcm_usr_elem { |
---|
1492 | | - int val[128]; |
---|
1493 | | -}; |
---|
1494 | | - |
---|
1495 | | -/* pp information; retrieved via snd_kcontrol_chip() */ |
---|
1496 | | -struct snd_pcm_usr { |
---|
1497 | | - struct snd_pcm *pcm; /* assigned PCM instance */ |
---|
1498 | | - int stream; /* PLAYBACK or CAPTURE */ |
---|
1499 | | - struct snd_kcontrol *kctl; |
---|
1500 | | - const struct snd_pcm_usr_elem *usr; |
---|
1501 | | - int max_length; |
---|
1502 | | - void *private_data; /* optional: private data pointer */ |
---|
1503 | | -}; |
---|
1504 | | - |
---|
1505 | | -int snd_pcm_add_usr_ctls(struct snd_pcm *pcm, int stream, |
---|
1506 | | - const struct snd_pcm_usr_elem *usr, |
---|
1507 | | - int max_length, int max_control_str_len, |
---|
1508 | | - unsigned long private_value, |
---|
1509 | | - struct snd_pcm_usr **info_ret); |
---|
1510 | | - |
---|
1511 | | -#ifdef CONFIG_SND_SOC_ROCKCHIP_VAD |
---|
| 1443 | +#if IS_ENABLED(CONFIG_SND_SOC_ROCKCHIP_VAD) |
---|
1512 | 1444 | /** |
---|
1513 | 1445 | * snd_pcm_vad_read - Read raw pcm data from vad buffer |
---|
1514 | 1446 | * @substream: PCM substream instance |
---|
.. | .. |
---|
1562 | 1494 | #define pcm_dbg(pcm, fmt, args...) \ |
---|
1563 | 1495 | dev_dbg((pcm)->card->dev, fmt, ##args) |
---|
1564 | 1496 | |
---|
| 1497 | +struct snd_pcm_status64 { |
---|
| 1498 | + snd_pcm_state_t state; /* stream state */ |
---|
| 1499 | + u8 rsvd[4]; |
---|
| 1500 | + s64 trigger_tstamp_sec; /* time when stream was started/stopped/paused */ |
---|
| 1501 | + s64 trigger_tstamp_nsec; |
---|
| 1502 | + s64 tstamp_sec; /* reference timestamp */ |
---|
| 1503 | + s64 tstamp_nsec; |
---|
| 1504 | + snd_pcm_uframes_t appl_ptr; /* appl ptr */ |
---|
| 1505 | + snd_pcm_uframes_t hw_ptr; /* hw ptr */ |
---|
| 1506 | + snd_pcm_sframes_t delay; /* current delay in frames */ |
---|
| 1507 | + snd_pcm_uframes_t avail; /* number of frames available */ |
---|
| 1508 | + snd_pcm_uframes_t avail_max; /* max frames available on hw since last status */ |
---|
| 1509 | + snd_pcm_uframes_t overrange; /* count of ADC (capture) overrange detections from last status */ |
---|
| 1510 | + snd_pcm_state_t suspended_state; /* suspended stream state */ |
---|
| 1511 | + __u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ |
---|
| 1512 | + s64 audio_tstamp_sec; /* sample counter, wall clock, PHC or on-demand sync'ed */ |
---|
| 1513 | + s64 audio_tstamp_nsec; |
---|
| 1514 | + s64 driver_tstamp_sec; /* useful in case reference system tstamp is reported with delay */ |
---|
| 1515 | + s64 driver_tstamp_nsec; |
---|
| 1516 | + __u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ |
---|
| 1517 | + unsigned char reserved[52-4*sizeof(s64)]; /* must be filled with zero */ |
---|
| 1518 | +}; |
---|
| 1519 | + |
---|
| 1520 | +#define SNDRV_PCM_IOCTL_STATUS64 _IOR('A', 0x20, struct snd_pcm_status64) |
---|
| 1521 | +#define SNDRV_PCM_IOCTL_STATUS_EXT64 _IOWR('A', 0x24, struct snd_pcm_status64) |
---|
| 1522 | + |
---|
| 1523 | +struct snd_pcm_status32 { |
---|
| 1524 | + snd_pcm_state_t state; /* stream state */ |
---|
| 1525 | + s32 trigger_tstamp_sec; /* time when stream was started/stopped/paused */ |
---|
| 1526 | + s32 trigger_tstamp_nsec; |
---|
| 1527 | + s32 tstamp_sec; /* reference timestamp */ |
---|
| 1528 | + s32 tstamp_nsec; |
---|
| 1529 | + u32 appl_ptr; /* appl ptr */ |
---|
| 1530 | + u32 hw_ptr; /* hw ptr */ |
---|
| 1531 | + s32 delay; /* current delay in frames */ |
---|
| 1532 | + u32 avail; /* number of frames available */ |
---|
| 1533 | + u32 avail_max; /* max frames available on hw since last status */ |
---|
| 1534 | + u32 overrange; /* count of ADC (capture) overrange detections from last status */ |
---|
| 1535 | + snd_pcm_state_t suspended_state; /* suspended stream state */ |
---|
| 1536 | + u32 audio_tstamp_data; /* needed for 64-bit alignment, used for configs/report to/from userspace */ |
---|
| 1537 | + s32 audio_tstamp_sec; /* sample counter, wall clock, PHC or on-demand sync'ed */ |
---|
| 1538 | + s32 audio_tstamp_nsec; |
---|
| 1539 | + s32 driver_tstamp_sec; /* useful in case reference system tstamp is reported with delay */ |
---|
| 1540 | + s32 driver_tstamp_nsec; |
---|
| 1541 | + u32 audio_tstamp_accuracy; /* in ns units, only valid if indicated in audio_tstamp_data */ |
---|
| 1542 | + unsigned char reserved[52-4*sizeof(s32)]; /* must be filled with zero */ |
---|
| 1543 | +}; |
---|
| 1544 | + |
---|
| 1545 | +#define SNDRV_PCM_IOCTL_STATUS32 _IOR('A', 0x20, struct snd_pcm_status32) |
---|
| 1546 | +#define SNDRV_PCM_IOCTL_STATUS_EXT32 _IOWR('A', 0x24, struct snd_pcm_status32) |
---|
| 1547 | + |
---|
1565 | 1548 | #endif /* __SOUND_PCM_H */ |
---|