aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound/pcm.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/sound/pcm.h')
-rw-r--r--include/sound/pcm.h52
1 files changed, 15 insertions, 37 deletions
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 6f3e10ca0e32..e862497f7556 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -183,6 +183,7 @@ struct snd_pcm_ops {
183#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B) 183#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B)
184#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8) 184#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8)
185#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE) 185#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE)
186#define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE)
186 187
187#ifdef SNDRV_LITTLE_ENDIAN 188#ifdef SNDRV_LITTLE_ENDIAN
188#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE 189#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
@@ -365,6 +366,7 @@ struct snd_pcm_runtime {
365 366
366struct snd_pcm_group { /* keep linked substreams */ 367struct snd_pcm_group { /* keep linked substreams */
367 spinlock_t lock; 368 spinlock_t lock;
369 struct mutex mutex;
368 struct list_head substreams; 370 struct list_head substreams;
369 int count; 371 int count;
370}; 372};
@@ -460,6 +462,7 @@ struct snd_pcm {
460 void (*private_free) (struct snd_pcm *pcm); 462 void (*private_free) (struct snd_pcm *pcm);
461 struct device *dev; /* actual hw device this belongs to */ 463 struct device *dev; /* actual hw device this belongs to */
462 bool internal; /* pcm is for internal use only */ 464 bool internal; /* pcm is for internal use only */
465 bool nonatomic; /* whole PCM operations are in non-atomic context */
463#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 466#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
464 struct snd_pcm_oss oss; 467 struct snd_pcm_oss oss;
465#endif 468#endif
@@ -492,8 +495,6 @@ int snd_pcm_notify(struct snd_pcm_notify *notify, int nfree);
492 * Native I/O 495 * Native I/O
493 */ 496 */
494 497
495extern rwlock_t snd_pcm_link_rwlock;
496
497int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info); 498int snd_pcm_info(struct snd_pcm_substream *substream, struct snd_pcm_info *info);
498int snd_pcm_info_user(struct snd_pcm_substream *substream, 499int snd_pcm_info_user(struct snd_pcm_substream *substream,
499 struct snd_pcm_info __user *info); 500 struct snd_pcm_info __user *info);
@@ -537,41 +538,18 @@ static inline int snd_pcm_stream_linked(struct snd_pcm_substream *substream)
537 return substream->group != &substream->self_group; 538 return substream->group != &substream->self_group;
538} 539}
539 540
540static inline void snd_pcm_stream_lock(struct snd_pcm_substream *substream) 541void snd_pcm_stream_lock(struct snd_pcm_substream *substream);
541{ 542void snd_pcm_stream_unlock(struct snd_pcm_substream *substream);
542 read_lock(&snd_pcm_link_rwlock); 543void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);
543 spin_lock(&substream->self_group.lock); 544void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
544} 545unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
545 546#define snd_pcm_stream_lock_irqsave(substream, flags) \
546static inline void snd_pcm_stream_unlock(struct snd_pcm_substream *substream) 547 do { \
547{ 548 typecheck(unsigned long, flags); \
548 spin_unlock(&substream->self_group.lock); 549 flags = _snd_pcm_stream_lock_irqsave(substream); \
549 read_unlock(&snd_pcm_link_rwlock); 550 } while (0)
550} 551void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
551 552 unsigned long flags);
552static inline void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream)
553{
554 read_lock_irq(&snd_pcm_link_rwlock);
555 spin_lock(&substream->self_group.lock);
556}
557
558static inline void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream)
559{
560 spin_unlock(&substream->self_group.lock);
561 read_unlock_irq(&snd_pcm_link_rwlock);
562}
563
564#define snd_pcm_stream_lock_irqsave(substream, flags) \
565do { \
566 read_lock_irqsave(&snd_pcm_link_rwlock, (flags)); \
567 spin_lock(&substream->self_group.lock); \
568} while (0)
569
570#define snd_pcm_stream_unlock_irqrestore(substream, flags) \
571do { \
572 spin_unlock(&substream->self_group.lock); \
573 read_unlock_irqrestore(&snd_pcm_link_rwlock, (flags)); \
574} while (0)
575 553
576#define snd_pcm_group_for_each_entry(s, substream) \ 554#define snd_pcm_group_for_each_entry(s, substream) \
577 list_for_each_entry(s, &substream->group->substreams, link_list) 555 list_for_each_entry(s, &substream->group->substreams, link_list)