nfsd: track last inode only in use_wgather case
[safe/jmp/linux-2.6] / include / sound / pcm.h
index 76b34b5..c172968 100644 (file)
@@ -3,7 +3,7 @@
 
 /*
  *  Digital Audio (PCM) abstract layer
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  *                   Abramo Bagnara <abramo@alsa-project.org>
  *
  *
@@ -25,6 +25,7 @@
 
 #include <sound/asound.h>
 #include <sound/memalloc.h>
+#include <sound/minors.h>
 #include <linux/poll.h>
 #include <linux/mm.h>
 #include <linux/bitops.h>
@@ -84,7 +85,11 @@ struct snd_pcm_ops {
  *
  */
 
-#define SNDRV_PCM_DEVICES              8
+#if defined(CONFIG_SND_DYNAMIC_MINORS)
+#define SNDRV_PCM_DEVICES      (SNDRV_OS_MINORS-2)
+#else
+#define SNDRV_PCM_DEVICES      8
+#endif
 
 #define SNDRV_PCM_IOCTL1_FALSE         ((void *)0)
 #define SNDRV_PCM_IOCTL1_TRUE          ((void *)1)
@@ -263,7 +268,8 @@ struct snd_pcm_runtime {
        int overrange;
        snd_pcm_uframes_t avail_max;
        snd_pcm_uframes_t hw_ptr_base;  /* Position at buffer restart */
-       snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time*/
+       snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */
+       unsigned long hw_ptr_jiffies;   /* Time when hw_ptr is updated */
 
        /* -- HW params -- */
        snd_pcm_access_t access;        /* access mode */
@@ -274,7 +280,6 @@ struct snd_pcm_runtime {
        snd_pcm_uframes_t period_size;  /* period size */
        unsigned int periods;           /* periods */
        snd_pcm_uframes_t buffer_size;  /* buffer size */
-       unsigned int tick_time;         /* tick time */
        snd_pcm_uframes_t min_align;    /* Min alignment for the format */
        size_t byte_align;
        unsigned int frame_bits;
@@ -286,8 +291,6 @@ struct snd_pcm_runtime {
        /* -- SW params -- */
        int tstamp_mode;                /* mmap timestamp is updated */
        unsigned int period_step;
-       unsigned int sleep_min;         /* min ticks to sleep */
-       snd_pcm_uframes_t xfer_align;   /* xfer size need to be a multiple */
        snd_pcm_uframes_t start_threshold;
        snd_pcm_uframes_t stop_threshold;
        snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
@@ -301,12 +304,11 @@ struct snd_pcm_runtime {
        union snd_pcm_sync_id sync;     /* hardware synchronization ID */
 
        /* -- mmap -- */
-       volatile struct snd_pcm_mmap_status *status;
-       volatile struct snd_pcm_mmap_control *control;
+       struct snd_pcm_mmap_status *status;
+       struct snd_pcm_mmap_control *control;
 
        /* -- locking / scheduling -- */
        wait_queue_head_t sleep;
-       struct timer_list tick_timer;
        struct fasync_struct *fasync;
 
        /* -- private section -- */
@@ -323,6 +325,7 @@ struct snd_pcm_runtime {
 
        /* -- timer -- */
        unsigned int timer_resolution;  /* timer resolution */
+       int tstamp_type;                /* timestamp type */
 
        /* -- DMA -- */           
        unsigned char *dma_area;        /* DMA area */
@@ -362,7 +365,6 @@ struct snd_pcm_substream {
         /* -- timer section -- */
        struct snd_timer *timer;                /* timer */
        unsigned timer_running: 1;      /* time is running */
-       spinlock_t timer_lock;
        /* -- next substream -- */
        struct snd_pcm_substream *next;
        /* -- linked substreams -- */
@@ -419,7 +421,7 @@ struct snd_pcm_str {
 struct snd_pcm {
        struct snd_card *card;
        struct list_head list;
-       unsigned int device;    /* device number */
+       int device; /* device number */
        unsigned int info_flags;
        unsigned short dev_class;
        unsigned short dev_subclass;
@@ -449,7 +451,7 @@ struct snd_pcm_notify {
 
 extern const struct file_operations snd_pcm_f_ops[2];
 
-int snd_pcm_new(struct snd_card *card, char *id, int device,
+int snd_pcm_new(struct snd_card *card, const char *id, int device,
                int playback_count, int capture_count,
                struct snd_pcm **rpcm);
 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
@@ -810,7 +812,6 @@ static inline const struct snd_interval *hw_param_interval_c(const struct snd_pc
 #define params_periods(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_PERIODS)->min
 #define params_buffer_size(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_SIZE)->min
 #define params_buffer_bytes(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_BUFFER_BYTES)->min
-#define params_tick_time(p) hw_param_interval((p), SNDRV_PCM_HW_PARAM_TICK_TIME)->min
 
 
 int snd_interval_refine(struct snd_interval *i, const struct snd_interval *v);
@@ -908,9 +909,6 @@ int snd_pcm_capture_xrun_check(struct snd_pcm_substream *substream);
 int snd_pcm_playback_xrun_asap(struct snd_pcm_substream *substream);
 int snd_pcm_capture_xrun_asap(struct snd_pcm_substream *substream);
 void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_uframes_t new_hw_ptr);
-void snd_pcm_tick_prepare(struct snd_pcm_substream *substream);
-void snd_pcm_tick_set(struct snd_pcm_substream *substream, unsigned long ticks);
-void snd_pcm_tick_elapsed(struct snd_pcm_substream *substream);
 void snd_pcm_period_elapsed(struct snd_pcm_substream *substream);
 snd_pcm_sframes_t snd_pcm_lib_write(struct snd_pcm_substream *substream,
                                    const void __user *buf,
@@ -952,6 +950,15 @@ void snd_pcm_timer_resolution_change(struct snd_pcm_substream *substream);
 void snd_pcm_timer_init(struct snd_pcm_substream *substream);
 void snd_pcm_timer_done(struct snd_pcm_substream *substream);
 
+static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime,
+                                  struct timespec *tv)
+{
+       if (runtime->tstamp_type == SNDRV_PCM_TSTAMP_TYPE_MONOTONIC)
+               do_posix_clock_monotonic_gettime(tv);
+       else
+               getnstimeofday(tv);
+}
+
 /*
  *  Memory
  */
@@ -967,10 +974,30 @@ int snd_pcm_lib_preallocate_pages_for_all(struct snd_pcm *pcm,
 int snd_pcm_lib_malloc_pages(struct snd_pcm_substream *substream, size_t size);
 int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream);
 
-#define snd_pcm_substream_sgbuf(substream) ((substream)->runtime->dma_buffer_p->private_data)
-#define snd_pcm_sgbuf_pages(size) snd_sgbuf_aligned_pages(size)
-#define snd_pcm_sgbuf_get_addr(sgbuf,ofs) snd_sgbuf_get_addr(sgbuf,ofs)
-struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream, unsigned long offset);
+/*
+ * SG-buffer handling
+ */
+#define snd_pcm_substream_sgbuf(substream) \
+       ((substream)->runtime->dma_buffer_p->private_data)
+
+static inline dma_addr_t
+snd_pcm_sgbuf_get_addr(struct snd_pcm_substream *substream, unsigned int ofs)
+{
+       struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
+       return snd_sgbuf_get_addr(sg, ofs);
+}
+
+static inline void *
+snd_pcm_sgbuf_get_ptr(struct snd_pcm_substream *substream, unsigned int ofs)
+{
+       struct snd_sg_buf *sg = snd_pcm_substream_sgbuf(substream);
+       return snd_sgbuf_get_ptr(sg, ofs);
+}
+
+struct page *snd_pcm_sgbuf_ops_page(struct snd_pcm_substream *substream,
+                                   unsigned long offset);
+unsigned int snd_pcm_sgbuf_get_chunk_size(struct snd_pcm_substream *substream,
+                                         unsigned int ofs, unsigned int size);
 
 /* handle mmap counter - PCM mmap callback should handle this counter properly */
 static inline void snd_pcm_mmap_data_open(struct vm_area_struct *area)
@@ -1008,4 +1035,6 @@ static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
                                         (IEC958_AES1_CON_PCM_CODER<<8)|\
                                         (IEC958_AES3_CON_FS_48000<<24))
 
+#define PCM_RUNTIME_CHECK(sub) snd_BUG_ON(!(sub) || !(sub)->runtime)
+
 #endif /* __SOUND_PCM_H */