]>
Commit | Line | Data |
---|---|---|
8486c274 | 1 | --- btsco.old/kernel/btsco.c 2006-10-28 16:39:27.000000000 +0200 |
0a56e2f3 | 2 | +++ btsco-0.5/kernel/btsco.c 2007-07-12 22:13:13.000000000 +0200 |
3 | @@ -54,9 +54,18 @@ | |
203d2b2c | 4 | #include <linux/file.h> |
5 | #include <linux/completion.h> | |
6 | #include <linux/smp_lock.h> | |
0a56e2f3 | 7 | +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,19) |
8 | +#include <linux/freezer.h> | |
9 | +#endif | |
10 | #include <net/sock.h> | |
11 | #include <net/bluetooth/bluetooth.h> | |
12 | ||
13 | +// this was ostensibly for newer kernels but fails on 2.6.19.2 | |
14 | +#if 0 | |
15 | +#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,18) | |
16 | +#include <sound/typedefs.h> | |
17 | +#endif | |
18 | +#endif | |
19 | #include <sound/core.h> | |
20 | #include <sound/control.h> | |
21 | #include <sound/pcm.h> | |
22 | @@ -90,7 +99,7 @@ | |
23 | MODULE_LICENSE("GPL"); | |
24 | MODULE_SUPPORTED_DEVICE("{{ALSA,Bluetooth SCO Soundcard}}"); | |
25 | ||
26 | -static char *mod_revision = "$Revision$"; | |
27 | +static char *mod_revision = "$Revision$"; | |
28 | ||
29 | static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ | |
30 | ||
31 | @@ -124,13 +133,13 @@ | |
8486c274 | 32 | } snd_card_bt_sco_info_t; |
33 | ||
34 | typedef struct snd_card_bt_sco { | |
35 | - snd_card_t *card; | |
0a56e2f3 | 36 | + struct snd_card *card; |
8486c274 | 37 | spinlock_t mixer_lock; |
38 | int mixer_volume[MIXER_ADDR_LAST + 1]; | |
39 | #ifdef DYNAMIC_COMPRESSION | |
40 | - snd_kcontrol_t *mixer_controls[MIXER_ADDR_LAST + 2 + 1]; /* also loopback and agc */ | |
0a56e2f3 | 41 | + struct snd_kcontrol *mixer_controls[MIXER_ADDR_LAST + 2 + 1]; /* also loopback and agc */ |
8486c274 | 42 | #else |
43 | - snd_kcontrol_t *mixer_controls[MIXER_ADDR_LAST + 2 ]; /* also loopback */ | |
0a56e2f3 | 44 | + struct snd_kcontrol *mixer_controls[MIXER_ADDR_LAST + 2 ]; /* also loopback */ |
8486c274 | 45 | #endif |
46 | volatile int loopback; | |
47 | #ifdef DYNAMIC_COMPRESSION | |
0a56e2f3 | 48 | @@ -168,15 +177,15 @@ |
8486c274 | 49 | unsigned int pcm_bps; /* bytes per second */ |
50 | unsigned int pcm_irq_pos; /* IRQ position */ | |
51 | unsigned int pcm_buf_pos; /* position in buffer */ | |
52 | - snd_pcm_substream_t *substream; | |
8d662e2b | 53 | + struct snd_pcm_substream *substream; |
8486c274 | 54 | } snd_card_bt_sco_pcm_t; |
55 | ||
56 | -static snd_card_t *snd_bt_sco_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; | |
0a56e2f3 | 57 | +static struct snd_card *snd_bt_sco_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; |
8486c274 | 58 | |
59 | -static int snd_card_bt_sco_playback_trigger(snd_pcm_substream_t * | |
8d662e2b | 60 | +static int snd_card_bt_sco_playback_trigger(struct snd_pcm_substream * |
8486c274 | 61 | substream, int cmd) |
62 | { | |
63 | - snd_pcm_runtime_t *runtime = substream->runtime; | |
8d662e2b | 64 | + struct snd_pcm_runtime *runtime = substream->runtime; |
65 | snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; | |
66 | snd_card_bt_sco_t *bt_sco = snd_pcm_substream_chip(substream); | |
8486c274 | 67 | |
0a56e2f3 | 68 | @@ -194,10 +203,10 @@ |
8d662e2b | 69 | return 0; |
70 | } | |
8486c274 | 71 | |
8d662e2b | 72 | -static int snd_card_bt_sco_capture_trigger(snd_pcm_substream_t * |
73 | +static int snd_card_bt_sco_capture_trigger(struct snd_pcm_substream * | |
74 | substream, int cmd) | |
75 | { | |
76 | - snd_pcm_runtime_t *runtime = substream->runtime; | |
77 | + struct snd_pcm_runtime *runtime = substream->runtime; | |
78 | snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; | |
79 | snd_card_bt_sco_t *bt_sco = snd_pcm_substream_chip(substream); | |
80 | ||
0a56e2f3 | 81 | @@ -215,9 +224,9 @@ |
8d662e2b | 82 | return 0; |
83 | } | |
84 | ||
85 | -static int snd_card_bt_sco_pcm_prepare(snd_pcm_substream_t * substream) | |
86 | +static int snd_card_bt_sco_pcm_prepare(struct snd_pcm_substream * substream) | |
87 | { | |
88 | - snd_pcm_runtime_t *runtime = substream->runtime; | |
89 | + struct snd_pcm_runtime *runtime = substream->runtime; | |
90 | snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; | |
91 | unsigned int bps; | |
92 | ||
0a56e2f3 | 93 | @@ -236,12 +245,12 @@ |
8d662e2b | 94 | return 0; |
95 | } | |
96 | ||
97 | -static int snd_card_bt_sco_playback_prepare(snd_pcm_substream_t * substream) | |
98 | +static int snd_card_bt_sco_playback_prepare(struct snd_pcm_substream * substream) | |
99 | { | |
100 | return snd_card_bt_sco_pcm_prepare(substream); | |
101 | } | |
102 | ||
103 | -static int snd_card_bt_sco_capture_prepare(snd_pcm_substream_t * substream) | |
104 | +static int snd_card_bt_sco_capture_prepare(struct snd_pcm_substream * substream) | |
105 | { | |
106 | dprintk("capture_prepare\n"); | |
107 | return snd_card_bt_sco_pcm_prepare(substream); | |
0a56e2f3 | 108 | @@ -311,24 +320,24 @@ |
8d662e2b | 109 | } |
110 | ||
111 | static snd_pcm_uframes_t | |
112 | -snd_card_bt_sco_playback_pointer(snd_pcm_substream_t * substream) | |
113 | +snd_card_bt_sco_playback_pointer(struct snd_pcm_substream * substream) | |
114 | { | |
115 | - snd_pcm_runtime_t *runtime = substream->runtime; | |
116 | + struct snd_pcm_runtime *runtime = substream->runtime; | |
117 | snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; | |
118 | ||
119 | return bytes_to_frames(runtime, bspcm->pcm_buf_pos); | |
120 | } | |
121 | ||
122 | static snd_pcm_uframes_t | |
123 | -snd_card_bt_sco_capture_pointer(snd_pcm_substream_t * substream) | |
124 | +snd_card_bt_sco_capture_pointer(struct snd_pcm_substream * substream) | |
125 | { | |
126 | - snd_pcm_runtime_t *runtime = substream->runtime; | |
127 | + struct snd_pcm_runtime *runtime = substream->runtime; | |
128 | snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; | |
129 | ||
130 | return bytes_to_frames(runtime, bspcm->pcm_buf_pos); | |
131 | } | |
132 | ||
133 | -static snd_pcm_hardware_t snd_card_bt_sco_playback = { | |
134 | +static struct snd_pcm_hardware snd_card_bt_sco_playback = { | |
135 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | |
136 | SNDRV_PCM_INFO_MMAP_VALID), | |
137 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | |
0a56e2f3 | 138 | @@ -345,7 +354,7 @@ |
8d662e2b | 139 | .fifo_size = 0, |
140 | }; | |
141 | ||
142 | -static snd_pcm_hardware_t snd_card_bt_sco_capture = { | |
143 | +static struct snd_pcm_hardware snd_card_bt_sco_capture = { | |
144 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | |
145 | SNDRV_PCM_INFO_MMAP_VALID), | |
146 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | |
0a56e2f3 | 147 | @@ -362,15 +371,15 @@ |
8d662e2b | 148 | .fifo_size = 0, |
149 | }; | |
150 | ||
151 | -static void snd_card_bt_sco_runtime_free(snd_pcm_runtime_t * runtime) | |
152 | +static void snd_card_bt_sco_runtime_free(struct snd_pcm_runtime * runtime) | |
153 | { | |
154 | snd_card_bt_sco_pcm_t *bspcm = runtime->private_data; | |
155 | kfree(bspcm); | |
156 | } | |
157 | ||
158 | -static int snd_card_bt_sco_playback_open(snd_pcm_substream_t * substream) | |
159 | +static int snd_card_bt_sco_playback_open(struct snd_pcm_substream * substream) | |
160 | { | |
161 | - snd_pcm_runtime_t *runtime = substream->runtime; | |
162 | + struct snd_pcm_runtime *runtime = substream->runtime; | |
163 | snd_card_bt_sco_pcm_t *bspcm; | |
164 | snd_card_bt_sco_t *bt_sco = snd_pcm_substream_chip(substream); | |
165 | ||
0a56e2f3 | 166 | @@ -401,9 +410,9 @@ |
8d662e2b | 167 | return 0; |
168 | } | |
169 | ||
170 | -static int snd_card_bt_sco_capture_open(snd_pcm_substream_t * substream) | |
171 | +static int snd_card_bt_sco_capture_open(struct snd_pcm_substream * substream) | |
172 | { | |
173 | - snd_pcm_runtime_t *runtime = substream->runtime; | |
174 | + struct snd_pcm_runtime *runtime = substream->runtime; | |
175 | snd_card_bt_sco_pcm_t *bspcm; | |
176 | snd_card_bt_sco_t *bt_sco = snd_pcm_substream_chip(substream); | |
177 | ||
0a56e2f3 | 178 | @@ -435,9 +444,9 @@ |
8d662e2b | 179 | return 0; |
180 | } | |
181 | ||
182 | -static int snd_card_bt_sco_playback_close(snd_pcm_substream_t * substream) | |
183 | +static int snd_card_bt_sco_playback_close(struct snd_pcm_substream * substream) | |
184 | { | |
185 | - snd_pcm_runtime_t *runtime = substream->runtime; | |
186 | + struct snd_pcm_runtime *runtime = substream->runtime; | |
187 | snd_card_bt_sco_t *bt_sco = snd_pcm_substream_chip(substream); | |
188 | ||
189 | snd_assert(bt_sco->playback == NULL,; | |
0a56e2f3 | 190 | @@ -457,9 +466,9 @@ |
8d662e2b | 191 | return 0; |
192 | } | |
193 | ||
194 | -static int snd_card_bt_sco_capture_close(snd_pcm_substream_t * substream) | |
195 | +static int snd_card_bt_sco_capture_close(struct snd_pcm_substream * substream) | |
196 | { | |
197 | - snd_pcm_runtime_t *runtime = substream->runtime; | |
198 | + struct snd_pcm_runtime *runtime = substream->runtime; | |
199 | struct snd_card_bt_sco *bt_sco = | |
200 | (struct snd_card_bt_sco *)substream->private_data; | |
201 | ||
0a56e2f3 | 202 | @@ -480,7 +489,7 @@ |
8d662e2b | 203 | return 0; |
204 | } | |
205 | ||
206 | -static snd_pcm_ops_t snd_card_bt_sco_playback_ops = { | |
207 | +static struct snd_pcm_ops snd_card_bt_sco_playback_ops = { | |
208 | .open = snd_card_bt_sco_playback_open, | |
209 | .close = snd_card_bt_sco_playback_close, | |
210 | .ioctl = snd_pcm_lib_ioctl, | |
0a56e2f3 | 211 | @@ -489,7 +498,7 @@ |
8d662e2b | 212 | .pointer = snd_card_bt_sco_playback_pointer, |
213 | }; | |
214 | ||
215 | -static snd_pcm_ops_t snd_card_bt_sco_capture_ops = { | |
216 | +static struct snd_pcm_ops snd_card_bt_sco_capture_ops = { | |
217 | .open = snd_card_bt_sco_capture_open, | |
218 | .close = snd_card_bt_sco_capture_close, | |
219 | .ioctl = snd_pcm_lib_ioctl, | |
0a56e2f3 | 220 | @@ -500,7 +509,7 @@ |
8d662e2b | 221 | |
222 | static int __init snd_card_bt_sco_pcm(snd_card_bt_sco_t * bt_sco) | |
223 | { | |
224 | - snd_pcm_t *pcm; | |
65efec07 | 225 | + struct snd_pcm *pcm; |
8d662e2b | 226 | int err; |
227 | ||
228 | if ((err = | |
0a56e2f3 | 229 | @@ -522,8 +531,8 @@ |
65efec07 | 230 | .get = snd_bt_sco_volume_get, .put = snd_bt_sco_volume_put, \ |
231 | .private_value = addr } | |
232 | ||
233 | -static int snd_bt_sco_volume_info(snd_kcontrol_t * kcontrol, | |
234 | - snd_ctl_elem_info_t * uinfo) | |
235 | +static int snd_bt_sco_volume_info(struct snd_kcontrol * kcontrol, | |
236 | + struct snd_ctl_elem_info * uinfo) | |
237 | { | |
238 | uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; | |
239 | uinfo->count = 1; | |
0a56e2f3 | 240 | @@ -532,8 +541,8 @@ |
65efec07 | 241 | return 0; |
242 | } | |
243 | ||
244 | -static int snd_bt_sco_volume_get(snd_kcontrol_t * kcontrol, | |
245 | - snd_ctl_elem_value_t * ucontrol) | |
246 | +static int snd_bt_sco_volume_get(struct snd_kcontrol * kcontrol, | |
247 | + struct snd_ctl_elem_value * ucontrol) | |
248 | { | |
249 | snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); | |
250 | unsigned long flags; | |
0a56e2f3 | 251 | @@ -545,8 +554,8 @@ |
65efec07 | 252 | return 0; |
253 | } | |
254 | ||
255 | -static int snd_bt_sco_volume_put(snd_kcontrol_t * kcontrol, | |
256 | - snd_ctl_elem_value_t * ucontrol) | |
257 | +static int snd_bt_sco_volume_put(struct snd_kcontrol * kcontrol, | |
258 | + struct snd_ctl_elem_value * ucontrol) | |
259 | { | |
260 | snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); | |
261 | unsigned long flags; | |
0a56e2f3 | 262 | @@ -571,8 +580,8 @@ |
65efec07 | 263 | return changed; |
264 | } | |
265 | ||
266 | -static int snd_bt_sco_boolean_info(snd_kcontrol_t * kcontrol, | |
267 | - snd_ctl_elem_info_t * uinfo) | |
268 | +static int snd_bt_sco_boolean_info(struct snd_kcontrol * kcontrol, | |
269 | + struct snd_ctl_elem_info * uinfo) | |
270 | { | |
271 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | |
272 | uinfo->count = 1; | |
0a56e2f3 | 273 | @@ -581,8 +590,8 @@ |
65efec07 | 274 | return 0; |
275 | } | |
276 | ||
277 | -static int snd_bt_sco_loopback_get(snd_kcontrol_t * kcontrol, | |
278 | - snd_ctl_elem_value_t * ucontrol) | |
279 | +static int snd_bt_sco_loopback_get(struct snd_kcontrol * kcontrol, | |
280 | + struct snd_ctl_elem_value * ucontrol) | |
281 | { | |
282 | snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); | |
283 | unsigned long flags; | |
0a56e2f3 | 284 | @@ -593,8 +602,8 @@ |
65efec07 | 285 | return 0; |
286 | } | |
287 | ||
288 | -static int snd_bt_sco_loopback_put(snd_kcontrol_t * kcontrol, | |
289 | - snd_ctl_elem_value_t * ucontrol) | |
290 | +static int snd_bt_sco_loopback_put(struct snd_kcontrol * kcontrol, | |
291 | + struct snd_ctl_elem_value * ucontrol) | |
292 | { | |
293 | snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); | |
294 | unsigned long flags; | |
0a56e2f3 | 295 | @@ -611,8 +620,8 @@ |
65efec07 | 296 | } |
297 | ||
298 | #ifdef DYNAMIC_COMPRESSION | |
299 | -static int snd_bt_sco_agc_get(snd_kcontrol_t * kcontrol, | |
300 | - snd_ctl_elem_value_t * ucontrol) | |
301 | +static int snd_bt_sco_agc_get(struct snd_kcontrol * kcontrol, | |
302 | + struct snd_ctl_elem_value * ucontrol) | |
303 | { | |
304 | snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); | |
305 | unsigned long flags; | |
0a56e2f3 | 306 | @@ -623,8 +632,8 @@ |
65efec07 | 307 | return 0; |
308 | } | |
309 | ||
310 | -static int snd_bt_sco_agc_put(snd_kcontrol_t * kcontrol, | |
311 | - snd_ctl_elem_value_t * ucontrol) | |
312 | +static int snd_bt_sco_agc_put(struct snd_kcontrol * kcontrol, | |
313 | + struct snd_ctl_elem_value * ucontrol) | |
314 | { | |
315 | snd_card_bt_sco_t *bt_sco = snd_kcontrol_chip(kcontrol); | |
316 | unsigned long flags; | |
0a56e2f3 | 317 | @@ -641,9 +650,9 @@ |
65efec07 | 318 | } |
319 | #endif | |
320 | ||
321 | -#define BT_SCO_CONTROLS (sizeof(snd_bt_sco_controls)/sizeof(snd_kcontrol_new_t)) | |
0a56e2f3 | 322 | +#define BT_SCO_CONTROLS (sizeof(snd_bt_sco_controls)/sizeof(struct snd_kcontrol_new)) |
65efec07 | 323 | |
324 | -static snd_kcontrol_new_t snd_bt_sco_controls[] = { | |
325 | +static struct snd_kcontrol_new snd_bt_sco_controls[] = { | |
326 | BT_SCO_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER), | |
327 | BT_SCO_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC), | |
328 | {.iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
0a56e2f3 | 329 | @@ -667,7 +676,7 @@ |
65efec07 | 330 | |
331 | int __init snd_card_bt_sco_new_mixer(snd_card_bt_sco_t * bt_sco) | |
332 | { | |
333 | - snd_card_t *card = bt_sco->card; | |
334 | + struct snd_card *card = bt_sco->card; | |
335 | ||
336 | unsigned int idx; | |
337 | int err; | |
0a56e2f3 | 338 | @@ -686,17 +695,17 @@ |
65efec07 | 339 | return 0; |
340 | } | |
341 | ||
342 | -static int snd_card_bt_open(snd_hwdep_t * hw, struct file *file) | |
343 | +static int snd_card_bt_open(struct snd_hwdep * hw, struct file *file) | |
344 | { | |
345 | return 0; | |
346 | } | |
347 | ||
348 | -static int snd_card_bt_release(snd_hwdep_t * hw, struct file *file) | |
349 | +static int snd_card_bt_release(struct snd_hwdep * hw, struct file *file) | |
350 | { | |
351 | return 0; | |
352 | } | |
353 | ||
354 | -static int snd_card_bt_ioctl(snd_hwdep_t * hw, struct file *file, | |
355 | +static int snd_card_bt_ioctl(struct snd_hwdep * hw, struct file *file, | |
356 | unsigned int cmd, unsigned long arg) | |
357 | { | |
358 | snd_card_bt_sco_t *bt_sco = hw->card->private_data; | |
0a56e2f3 | 359 | @@ -750,7 +759,7 @@ |
65efec07 | 360 | return err; |
361 | } | |
362 | ||
363 | -static long snd_card_bt_write(snd_hwdep_t * hw, const char *buf, long count, | |
364 | +static long snd_card_bt_write(struct snd_hwdep * hw, const char *buf, long count, | |
365 | loff_t * offset) | |
366 | { | |
0a56e2f3 | 367 | snd_card_bt_sco_t *bt_sco = hw->card->private_data; |
368 | @@ -785,7 +794,7 @@ | |
65efec07 | 369 | return retval; |
370 | } | |
371 | ||
372 | -static long snd_card_bt_read(snd_hwdep_t * hw, char *buf, long count, | |
373 | +static long snd_card_bt_read(struct snd_hwdep * hw, char *buf, long count, | |
374 | loff_t * offset) | |
375 | { | |
376 | snd_card_bt_sco_t *bt_sco = hw->card->private_data; | |
0a56e2f3 | 377 | @@ -839,7 +848,7 @@ |
65efec07 | 378 | return retval; |
379 | } | |
380 | ||
381 | -static unsigned int snd_card_bt_poll(snd_hwdep_t * hw, | |
382 | +static unsigned int snd_card_bt_poll(struct snd_hwdep * hw, | |
383 | struct file *file, poll_table * wait) | |
384 | { | |
385 | snd_card_bt_sco_t *bt_sco = hw->card->private_data; | |
0a56e2f3 | 386 | @@ -863,7 +872,7 @@ |
65efec07 | 387 | |
388 | static int snd_card_bt_sco_thread(void *data) | |
389 | { | |
390 | - snd_card_t *card = (snd_card_t *) data; | |
0a56e2f3 | 391 | + struct snd_card *card = (struct snd_card *) data; |
65efec07 | 392 | snd_card_bt_sco_t *bt_sco = card->private_data; |
393 | struct socket *sock; | |
394 | int len; | |
0a56e2f3 | 395 | @@ -1117,7 +1126,7 @@ |
65efec07 | 396 | complete_and_exit(&bt_sco->thread_done, 0); |
397 | } | |
398 | ||
399 | -static void snd_card_bt_private_free(snd_card_t * card) | |
400 | +static void snd_card_bt_private_free(struct snd_card * card) | |
401 | { | |
402 | snd_card_bt_sco_t *bt_sco = card->private_data; | |
403 | ||
0a56e2f3 | 404 | @@ -1139,10 +1148,10 @@ |
65efec07 | 405 | |
406 | static int __init snd_card_bt_sco_probe(int dev) | |
407 | { | |
408 | - snd_card_t *card; | |
409 | + struct snd_card *card; | |
410 | snd_card_bt_sco_t *bt_sco; | |
411 | int err; | |
412 | - snd_hwdep_t *hw; | |
413 | + struct snd_hwdep *hw; | |
414 | ||
415 | card = | |
416 | snd_card_new(index[dev], SNDRV_DEFAULT_STR1, |