Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
compress_driver.h
Go to the documentation of this file.
1 /*
2  * compress_driver.h - compress offload driver definations
3  *
4  * Copyright (C) 2011 Intel Corporation
5  * Authors: Vinod Koul <[email protected]>
6  * Pierre-Louis Bossart <[email protected]>
7  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; version 2 of the License.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License along
19  * with this program; if not, write to the Free Software Foundation, Inc.,
20  * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21  *
22  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23  *
24  */
25 #ifndef __COMPRESS_DRIVER_H
26 #define __COMPRESS_DRIVER_H
27 
28 #include <linux/types.h>
29 #include <linux/sched.h>
30 #include <sound/compress_offload.h>
31 #include <sound/asound.h>
32 #include <sound/pcm.h>
33 
34 struct snd_compr_ops;
35 
54  struct snd_compr_ops *ops;
55  void *buffer;
64  void *private_data;
65 };
66 
77  const char *name;
78  struct snd_compr_ops *ops;
80  struct snd_compr *device;
82  void *private_data;
83 };
84 
110  struct snd_compr_params *params);
112  struct snd_codec *params);
115  struct snd_compr_tstamp *tstamp);
116  int (*copy)(struct snd_compr_stream *stream, const char __user *buf,
117  size_t count);
119  struct vm_area_struct *vma);
120  int (*ack)(struct snd_compr_stream *stream, size_t bytes);
122  struct snd_compr_caps *caps);
124  struct snd_compr_codec_caps *codec);
125 };
126 
138 struct snd_compr {
139  const char *name;
140  struct device *dev;
143  struct snd_card *card;
144  unsigned int direction;
145  struct mutex lock;
146  int device;
147 };
148 
149 /* compress device register APIs */
152 int snd_compress_new(struct snd_card *card, int device,
153  int type, struct snd_compr *compr);
154 
155 /* dsp driver callback apis
156  * For playback: driver should call snd_compress_fragment_elapsed() to let the
157  * framework know that a fragment has been consumed from the ring buffer
158  *
159  * For recording: we want to know when a frame is available or when
160  * at least one frame is available so snd_compress_frame_elapsed()
161  * callback should be called when a encodeded frame is available
162  */
163 static inline void snd_compr_fragment_elapsed(struct snd_compr_stream *stream)
164 {
165  wake_up(&stream->runtime->sleep);
166 }
167 
168 #endif