Commit | Line | Data |
---|---|---|
a52932b4 MR |
1 | /* |
2 | * Empiatech em28x1 audio extension | |
3 | * | |
4 | * Copyright (C) 2006 Markus Rechberger <mrechberger@gmail.com> | |
5 | * | |
f5f894d1 | 6 | * Copyright (C) 2007-2014 Mauro Carvalho Chehab |
6d79468d | 7 | * - Port to work with the in-kernel driver |
4f83e7b3 | 8 | * - Cleanups, fixes, alsa-controls, etc. |
6d79468d | 9 | * |
a52932b4 MR |
10 | * This driver is based on my previous au600 usb pstn audio driver |
11 | * and inherits all the copyrights | |
12 | * | |
13 | * This program is free software; you can redistribute it and/or modify | |
14 | * it under the terms of the GNU General Public License as published by | |
15 | * the Free Software Foundation; either version 2 of the License, or | |
16 | * (at your option) any later version. | |
17 | * | |
18 | * This program is distributed in the hope that it will be useful, | |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | * GNU General Public License for more details. | |
22 | * | |
23 | * You should have received a copy of the GNU General Public License | |
24 | * along with this program; if not, write to the Free Software | |
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
26 | */ | |
27 | ||
28 | #include <linux/kernel.h> | |
29 | #include <linux/usb.h> | |
30 | #include <linux/init.h> | |
31 | #include <linux/sound.h> | |
32 | #include <linux/spinlock.h> | |
33 | #include <linux/soundcard.h> | |
34 | #include <linux/slab.h> | |
35 | #include <linux/vmalloc.h> | |
36 | #include <linux/proc_fs.h> | |
6d79468d | 37 | #include <linux/module.h> |
a52932b4 MR |
38 | #include <sound/core.h> |
39 | #include <sound/pcm.h> | |
40 | #include <sound/pcm_params.h> | |
41 | #include <sound/info.h> | |
42 | #include <sound/initval.h> | |
43 | #include <sound/control.h> | |
850d24a5 | 44 | #include <sound/tlv.h> |
67b8d033 | 45 | #include <sound/ac97_codec.h> |
a52932b4 MR |
46 | #include <media/v4l2-common.h> |
47 | #include "em28xx.h" | |
48 | ||
6d79468d MCC |
49 | static int debug; |
50 | module_param(debug, int, 0644); | |
51 | MODULE_PARM_DESC(debug, "activates debug info"); | |
a52932b4 | 52 | |
1b3fd2d3 MCC |
53 | #define EM28XX_MAX_AUDIO_BUFS 5 |
54 | #define EM28XX_MIN_AUDIO_PACKETS 64 | |
49677aef | 55 | |
6d79468d MCC |
56 | #define dprintk(fmt, arg...) do { \ |
57 | if (debug) \ | |
58 | printk(KERN_INFO "em28xx-audio %s: " fmt, \ | |
d80e134d | 59 | __func__, ##arg); \ |
6d79468d | 60 | } while (0) |
a52932b4 | 61 | |
6d79468d | 62 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; |
a52932b4 | 63 | |
aa5a1821 | 64 | static int em28xx_deinit_isoc_audio(struct em28xx *dev) |
a52932b4 | 65 | { |
6d79468d | 66 | int i; |
a52932b4 | 67 | |
6d79468d | 68 | dprintk("Stopping isoc\n"); |
1b3fd2d3 | 69 | for (i = 0; i < dev->adev.num_urb; i++) { |
46c704d7 MCC |
70 | struct urb *urb = dev->adev.urb[i]; |
71 | ||
9c06210b | 72 | if (!irqs_disabled()) |
46c704d7 | 73 | usb_kill_urb(urb); |
9c06210b | 74 | else |
46c704d7 | 75 | usb_unlink_urb(urb); |
a52932b4 | 76 | } |
a52932b4 | 77 | |
a52932b4 MR |
78 | return 0; |
79 | } | |
80 | ||
a52932b4 MR |
81 | static void em28xx_audio_isocirq(struct urb *urb) |
82 | { | |
6d79468d MCC |
83 | struct em28xx *dev = urb->context; |
84 | int i; | |
85 | unsigned int oldptr; | |
6d79468d MCC |
86 | int period_elapsed = 0; |
87 | int status; | |
88 | unsigned char *cp; | |
89 | unsigned int stride; | |
a52932b4 | 90 | struct snd_pcm_substream *substream; |
6d79468d | 91 | struct snd_pcm_runtime *runtime; |
aa5a1821 | 92 | |
8b1fa579 MCC |
93 | if (dev->disconnected) { |
94 | dprintk("device disconnected while streaming. URB status=%d.\n", urb->status); | |
95 | atomic_set(&dev->stream_started, 0); | |
96 | return; | |
97 | } | |
98 | ||
aa5a1821 RK |
99 | switch (urb->status) { |
100 | case 0: /* success */ | |
101 | case -ETIMEDOUT: /* NAK */ | |
102 | break; | |
103 | case -ECONNRESET: /* kill */ | |
104 | case -ENOENT: | |
105 | case -ESHUTDOWN: | |
106 | return; | |
107 | default: /* error */ | |
108 | dprintk("urb completition error %d.\n", urb->status); | |
109 | break; | |
110 | } | |
111 | ||
39a96b4c MCC |
112 | if (atomic_read(&dev->stream_started) == 0) |
113 | return; | |
114 | ||
9baed99e MCC |
115 | if (dev->adev.capture_pcm_substream) { |
116 | substream = dev->adev.capture_pcm_substream; | |
1a6f11e0 | 117 | runtime = substream->runtime; |
a52932b4 | 118 | stride = runtime->frame_bits >> 3; |
6d79468d | 119 | |
1a6f11e0 MCC |
120 | for (i = 0; i < urb->number_of_packets; i++) { |
121 | int length = | |
122 | urb->iso_frame_desc[i].actual_length / stride; | |
123 | cp = (unsigned char *)urb->transfer_buffer + | |
124 | urb->iso_frame_desc[i].offset; | |
a52932b4 | 125 | |
1a6f11e0 | 126 | if (!length) |
a52932b4 MR |
127 | continue; |
128 | ||
9baed99e | 129 | oldptr = dev->adev.hwptr_done_capture; |
50f3beb5 MCC |
130 | if (oldptr + length >= runtime->buffer_size) { |
131 | unsigned int cnt = | |
132 | runtime->buffer_size - oldptr; | |
133 | memcpy(runtime->dma_area + oldptr * stride, cp, | |
134 | cnt * stride); | |
135 | memcpy(runtime->dma_area, cp + cnt * stride, | |
136 | length * stride - cnt * stride); | |
137 | } else { | |
138 | memcpy(runtime->dma_area + oldptr * stride, cp, | |
139 | length * stride); | |
140 | } | |
141 | ||
50f3beb5 | 142 | snd_pcm_stream_lock(substream); |
50f3beb5 | 143 | |
9baed99e MCC |
144 | dev->adev.hwptr_done_capture += length; |
145 | if (dev->adev.hwptr_done_capture >= | |
1a6f11e0 | 146 | runtime->buffer_size) |
9baed99e | 147 | dev->adev.hwptr_done_capture -= |
1a6f11e0 | 148 | runtime->buffer_size; |
a52932b4 | 149 | |
9baed99e MCC |
150 | dev->adev.capture_transfer_done += length; |
151 | if (dev->adev.capture_transfer_done >= | |
1a6f11e0 | 152 | runtime->period_size) { |
9baed99e | 153 | dev->adev.capture_transfer_done -= |
1a6f11e0 MCC |
154 | runtime->period_size; |
155 | period_elapsed = 1; | |
a52932b4 | 156 | } |
6d79468d | 157 | |
50f3beb5 | 158 | snd_pcm_stream_unlock(substream); |
a52932b4 | 159 | } |
6d79468d | 160 | if (period_elapsed) |
a52932b4 | 161 | snd_pcm_period_elapsed(substream); |
a52932b4 MR |
162 | } |
163 | urb->status = 0; | |
1a6f11e0 | 164 | |
6d79468d MCC |
165 | status = usb_submit_urb(urb, GFP_ATOMIC); |
166 | if (status < 0) { | |
1a6f11e0 MCC |
167 | em28xx_errdev("resubmit of audio urb failed (error=%i)\n", |
168 | status); | |
a52932b4 MR |
169 | } |
170 | return; | |
171 | } | |
172 | ||
a52932b4 MR |
173 | static int em28xx_init_audio_isoc(struct em28xx *dev) |
174 | { | |
6d79468d | 175 | int i, errCode; |
6d79468d MCC |
176 | |
177 | dprintk("Starting isoc transfers\n"); | |
a52932b4 | 178 | |
f5f894d1 | 179 | /* Start streaming */ |
1b3fd2d3 | 180 | for (i = 0; i < dev->adev.num_urb; i++) { |
f5f894d1 MCC |
181 | memset(dev->adev.transfer_buffer[i], 0x80, |
182 | dev->adev.urb[i]->transfer_buffer_length); | |
6d79468d | 183 | |
9baed99e | 184 | errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC); |
1a6f11e0 | 185 | if (errCode) { |
debb7241 | 186 | em28xx_errdev("submit of audio urb failed\n"); |
aa5a1821 | 187 | em28xx_deinit_isoc_audio(dev); |
debb7241 | 188 | atomic_set(&dev->stream_started, 0); |
a52932b4 MR |
189 | return errCode; |
190 | } | |
debb7241 | 191 | |
a52932b4 | 192 | } |
6d79468d | 193 | |
a52932b4 MR |
194 | return 0; |
195 | } | |
196 | ||
6d79468d MCC |
197 | static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, |
198 | size_t size) | |
199 | { | |
200 | struct snd_pcm_runtime *runtime = subs->runtime; | |
201 | ||
a1a6ee74 | 202 | dprintk("Allocating vbuffer\n"); |
6d79468d MCC |
203 | if (runtime->dma_area) { |
204 | if (runtime->dma_bytes > size) | |
205 | return 0; | |
206 | ||
207 | vfree(runtime->dma_area); | |
208 | } | |
209 | runtime->dma_area = vmalloc(size); | |
210 | if (!runtime->dma_area) | |
211 | return -ENOMEM; | |
212 | ||
213 | runtime->dma_bytes = size; | |
214 | ||
215 | return 0; | |
216 | } | |
217 | ||
218 | static struct snd_pcm_hardware snd_em28xx_hw_capture = { | |
219 | .info = SNDRV_PCM_INFO_BLOCK_TRANSFER | | |
220 | SNDRV_PCM_INFO_MMAP | | |
221 | SNDRV_PCM_INFO_INTERLEAVED | | |
dff0f8c2 | 222 | SNDRV_PCM_INFO_BATCH | |
6d79468d MCC |
223 | SNDRV_PCM_INFO_MMAP_VALID, |
224 | ||
225 | .formats = SNDRV_PCM_FMTBIT_S16_LE, | |
226 | ||
49677aef | 227 | .rates = SNDRV_PCM_RATE_48000, |
6d79468d MCC |
228 | |
229 | .rate_min = 48000, | |
230 | .rate_max = 48000, | |
231 | .channels_min = 2, | |
232 | .channels_max = 2, | |
233 | .buffer_bytes_max = 62720 * 8, /* just about the value in usbaudio.c */ | |
49677aef MCC |
234 | |
235 | ||
236 | /* | |
237 | * The period is 12.288 bytes. Allow a 10% of variation along its | |
238 | * value, in order to avoid overruns/underruns due to some clock | |
239 | * drift. | |
240 | * | |
241 | * FIXME: This period assumes 64 packets, and a 48000 PCM rate. | |
242 | * Calculate it dynamically. | |
243 | */ | |
244 | .period_bytes_min = 11059, | |
245 | .period_bytes_max = 13516, | |
246 | ||
6d79468d MCC |
247 | .periods_min = 2, |
248 | .periods_max = 98, /* 12544, */ | |
249 | }; | |
250 | ||
251 | static int snd_em28xx_capture_open(struct snd_pcm_substream *substream) | |
252 | { | |
253 | struct em28xx *dev = snd_pcm_substream_chip(substream); | |
254 | struct snd_pcm_runtime *runtime = substream->runtime; | |
255 | int ret = 0; | |
256 | ||
83ee87a3 | 257 | if (!dev) { |
0bc23083 | 258 | em28xx_err("BUG: em28xx can't find device struct." |
83ee87a3 MCC |
259 | " Can't proceed with open\n"); |
260 | return -ENODEV; | |
261 | } | |
262 | ||
8b1fa579 MCC |
263 | if (dev->disconnected) |
264 | return -ENODEV; | |
265 | ||
266 | dprintk("opening device and trying to acquire exclusive lock\n"); | |
267 | ||
4f83e7b3 MCC |
268 | runtime->hw = snd_em28xx_hw_capture; |
269 | if ((dev->alt == 0 || dev->audio_ifnum) && dev->adev.users == 0) { | |
34906633 MCC |
270 | int nonblock = !!(substream->f_flags & O_NONBLOCK); |
271 | ||
272 | if (nonblock) { | |
273 | if (!mutex_trylock(&dev->lock)) | |
274 | return -EAGAIN; | |
275 | } else | |
276 | mutex_lock(&dev->lock); | |
4f83e7b3 MCC |
277 | if (dev->audio_ifnum) |
278 | dev->alt = 1; | |
279 | else | |
280 | dev->alt = 7; | |
92ea42f4 | 281 | |
4f83e7b3 MCC |
282 | dprintk("changing alternate number on interface %d to %d\n", |
283 | dev->audio_ifnum, dev->alt); | |
284 | usb_set_interface(dev->udev, dev->audio_ifnum, dev->alt); | |
6d79468d | 285 | |
4f83e7b3 MCC |
286 | /* Sets volume, mute, etc */ |
287 | dev->mute = 0; | |
4f83e7b3 MCC |
288 | ret = em28xx_audio_analog_set(dev); |
289 | if (ret < 0) | |
290 | goto err; | |
6d79468d | 291 | |
4f83e7b3 MCC |
292 | dev->adev.users++; |
293 | mutex_unlock(&dev->lock); | |
294 | } | |
6d79468d | 295 | |
a02b9c23 | 296 | /* Dynamically adjust the period size */ |
6d79468d | 297 | snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); |
a02b9c23 MCC |
298 | snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, |
299 | dev->adev.period * 95 / 100, | |
300 | dev->adev.period * 105 / 100); | |
301 | ||
9baed99e | 302 | dev->adev.capture_pcm_substream = substream; |
6d79468d MCC |
303 | |
304 | return 0; | |
305 | err: | |
39a96b4c MCC |
306 | mutex_unlock(&dev->lock); |
307 | ||
0bc23083 | 308 | em28xx_err("Error while configuring em28xx mixer\n"); |
6d79468d MCC |
309 | return ret; |
310 | } | |
311 | ||
312 | static int snd_em28xx_pcm_close(struct snd_pcm_substream *substream) | |
313 | { | |
314 | struct em28xx *dev = snd_pcm_substream_chip(substream); | |
6d79468d MCC |
315 | |
316 | dprintk("closing device\n"); | |
317 | ||
318 | dev->mute = 1; | |
92ea42f4 | 319 | mutex_lock(&dev->lock); |
bf510ac3 | 320 | dev->adev.users--; |
39a96b4c MCC |
321 | if (atomic_read(&dev->stream_started) > 0) { |
322 | atomic_set(&dev->stream_started, 0); | |
323 | schedule_work(&dev->wq_trigger); | |
324 | } | |
325 | ||
6d79468d | 326 | em28xx_audio_analog_set(dev); |
75c74d1c RK |
327 | if (substream->runtime->dma_area) { |
328 | dprintk("freeing\n"); | |
329 | vfree(substream->runtime->dma_area); | |
330 | substream->runtime->dma_area = NULL; | |
331 | } | |
92ea42f4 | 332 | mutex_unlock(&dev->lock); |
6d79468d | 333 | |
6d79468d MCC |
334 | return 0; |
335 | } | |
336 | ||
337 | static int snd_em28xx_hw_capture_params(struct snd_pcm_substream *substream, | |
338 | struct snd_pcm_hw_params *hw_params) | |
339 | { | |
6d79468d | 340 | int ret; |
8b1fa579 MCC |
341 | struct em28xx *dev = snd_pcm_substream_chip(substream); |
342 | ||
343 | if (dev->disconnected) | |
344 | return -ENODEV; | |
6d79468d MCC |
345 | |
346 | dprintk("Setting capture parameters\n"); | |
347 | ||
348 | ret = snd_pcm_alloc_vmalloc_buffer(substream, | |
349 | params_buffer_bytes(hw_params)); | |
00d2e7ad MCC |
350 | if (ret < 0) |
351 | return ret; | |
e92ba283 HV |
352 | #if 0 |
353 | /* TODO: set up em28xx audio chip to deliver the correct audio format, | |
354 | current default is 48000hz multiplexed => 96000hz mono | |
355 | which shouldn't matter since analogue TV only supports mono */ | |
356 | unsigned int channels, rate, format; | |
357 | ||
6d79468d MCC |
358 | format = params_format(hw_params); |
359 | rate = params_rate(hw_params); | |
360 | channels = params_channels(hw_params); | |
e92ba283 | 361 | #endif |
6d79468d | 362 | |
6d79468d MCC |
363 | return 0; |
364 | } | |
365 | ||
366 | static int snd_em28xx_hw_capture_free(struct snd_pcm_substream *substream) | |
367 | { | |
368 | struct em28xx *dev = snd_pcm_substream_chip(substream); | |
369 | ||
370 | dprintk("Stop capture, if needed\n"); | |
371 | ||
39a96b4c MCC |
372 | if (atomic_read(&dev->stream_started) > 0) { |
373 | atomic_set(&dev->stream_started, 0); | |
374 | schedule_work(&dev->wq_trigger); | |
375 | } | |
6d79468d MCC |
376 | |
377 | return 0; | |
378 | } | |
379 | ||
380 | static int snd_em28xx_prepare(struct snd_pcm_substream *substream) | |
381 | { | |
96fbf771 DH |
382 | struct em28xx *dev = snd_pcm_substream_chip(substream); |
383 | ||
8b1fa579 MCC |
384 | if (dev->disconnected) |
385 | return -ENODEV; | |
386 | ||
96fbf771 DH |
387 | dev->adev.hwptr_done_capture = 0; |
388 | dev->adev.capture_transfer_done = 0; | |
389 | ||
6d79468d MCC |
390 | return 0; |
391 | } | |
392 | ||
39a96b4c MCC |
393 | static void audio_trigger(struct work_struct *work) |
394 | { | |
395 | struct em28xx *dev = container_of(work, struct em28xx, wq_trigger); | |
396 | ||
397 | if (atomic_read(&dev->stream_started)) { | |
398 | dprintk("starting capture"); | |
399 | em28xx_init_audio_isoc(dev); | |
400 | } else { | |
401 | dprintk("stopping capture"); | |
402 | em28xx_deinit_isoc_audio(dev); | |
403 | } | |
404 | } | |
405 | ||
6d79468d MCC |
406 | static int snd_em28xx_capture_trigger(struct snd_pcm_substream *substream, |
407 | int cmd) | |
408 | { | |
409 | struct em28xx *dev = snd_pcm_substream_chip(substream); | |
00d2e7ad | 410 | int retval = 0; |
6d79468d | 411 | |
8b1fa579 MCC |
412 | if (dev->disconnected) |
413 | return -ENODEV; | |
414 | ||
6d79468d | 415 | switch (cmd) { |
dff0f8c2 MCC |
416 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */ |
417 | case SNDRV_PCM_TRIGGER_RESUME: /* fall through */ | |
6d79468d | 418 | case SNDRV_PCM_TRIGGER_START: |
39a96b4c | 419 | atomic_set(&dev->stream_started, 1); |
df39ca64 | 420 | break; |
dff0f8c2 MCC |
421 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */ |
422 | case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */ | |
6d79468d | 423 | case SNDRV_PCM_TRIGGER_STOP: |
dff0f8c2 | 424 | atomic_set(&dev->stream_started, 0); |
df39ca64 | 425 | break; |
6d79468d | 426 | default: |
df39ca64 | 427 | retval = -EINVAL; |
6d79468d | 428 | } |
39a96b4c | 429 | schedule_work(&dev->wq_trigger); |
00d2e7ad | 430 | return retval; |
6d79468d MCC |
431 | } |
432 | ||
1a6f11e0 MCC |
433 | static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream |
434 | *substream) | |
a52932b4 | 435 | { |
a1a6ee74 | 436 | unsigned long flags; |
53d12e5a | 437 | struct em28xx *dev; |
a52932b4 | 438 | snd_pcm_uframes_t hwptr_done; |
53d12e5a | 439 | |
a52932b4 | 440 | dev = snd_pcm_substream_chip(substream); |
8b1fa579 | 441 | if (dev->disconnected) |
229295f1 | 442 | return SNDRV_PCM_POS_XRUN; |
8b1fa579 | 443 | |
00bc0645 | 444 | spin_lock_irqsave(&dev->adev.slock, flags); |
9baed99e | 445 | hwptr_done = dev->adev.hwptr_done_capture; |
00bc0645 | 446 | spin_unlock_irqrestore(&dev->adev.slock, flags); |
6d79468d | 447 | |
a52932b4 MR |
448 | return hwptr_done; |
449 | } | |
450 | ||
451 | static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, | |
452 | unsigned long offset) | |
453 | { | |
454 | void *pageptr = subs->runtime->dma_area + offset; | |
6d79468d | 455 | |
a52932b4 MR |
456 | return vmalloc_to_page(pageptr); |
457 | } | |
458 | ||
850d24a5 MCC |
459 | /* |
460 | * AC97 volume control support | |
461 | */ | |
462 | static int em28xx_vol_info(struct snd_kcontrol *kcontrol, | |
463 | struct snd_ctl_elem_info *info) | |
464 | { | |
8b1fa579 MCC |
465 | struct em28xx *dev = snd_kcontrol_chip(kcontrol); |
466 | ||
467 | if (dev->disconnected) | |
468 | return -ENODEV; | |
469 | ||
850d24a5 MCC |
470 | info->type = SNDRV_CTL_ELEM_TYPE_INTEGER; |
471 | info->count = 2; | |
472 | info->value.integer.min = 0; | |
473 | info->value.integer.max = 0x1f; | |
474 | ||
475 | return 0; | |
476 | } | |
477 | ||
850d24a5 MCC |
478 | static int em28xx_vol_put(struct snd_kcontrol *kcontrol, |
479 | struct snd_ctl_elem_value *value) | |
480 | { | |
481 | struct em28xx *dev = snd_kcontrol_chip(kcontrol); | |
34906633 | 482 | struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream; |
71d7d83e MCC |
483 | u16 val = (0x1f - (value->value.integer.value[0] & 0x1f)) | |
484 | (0x1f - (value->value.integer.value[1] & 0x1f)) << 8; | |
34906633 | 485 | int nonblock = 0; |
850d24a5 MCC |
486 | int rc; |
487 | ||
8b1fa579 MCC |
488 | if (dev->disconnected) |
489 | return -ENODEV; | |
490 | ||
34906633 MCC |
491 | if (substream) |
492 | nonblock = !!(substream->f_flags & O_NONBLOCK); | |
493 | if (nonblock) { | |
494 | if (!mutex_trylock(&dev->lock)) | |
495 | return -EAGAIN; | |
496 | } else | |
497 | mutex_lock(&dev->lock); | |
850d24a5 MCC |
498 | rc = em28xx_read_ac97(dev, kcontrol->private_value); |
499 | if (rc < 0) | |
500 | goto err; | |
501 | ||
43131a2c | 502 | val |= rc & 0x8000; /* Preserve the mute flag */ |
850d24a5 MCC |
503 | |
504 | rc = em28xx_write_ac97(dev, kcontrol->private_value, val); | |
66cb6957 MCC |
505 | if (rc < 0) |
506 | goto err; | |
507 | ||
508 | dprintk("%sleft vol %d, right vol %d (0x%04x) to ac97 volume control 0x%04x\n", | |
509 | (val & 0x8000) ? "muted " : "", | |
510 | 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), | |
511 | val, (int)kcontrol->private_value); | |
850d24a5 MCC |
512 | |
513 | err: | |
514 | mutex_unlock(&dev->lock); | |
515 | return rc; | |
516 | } | |
517 | ||
518 | static int em28xx_vol_get(struct snd_kcontrol *kcontrol, | |
519 | struct snd_ctl_elem_value *value) | |
520 | { | |
521 | struct em28xx *dev = snd_kcontrol_chip(kcontrol); | |
34906633 MCC |
522 | struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream; |
523 | int nonblock = 0; | |
850d24a5 MCC |
524 | int val; |
525 | ||
8b1fa579 MCC |
526 | if (dev->disconnected) |
527 | return -ENODEV; | |
528 | ||
34906633 MCC |
529 | if (substream) |
530 | nonblock = !!(substream->f_flags & O_NONBLOCK); | |
531 | if (nonblock) { | |
532 | if (!mutex_trylock(&dev->lock)) | |
533 | return -EAGAIN; | |
534 | } else | |
535 | mutex_lock(&dev->lock); | |
850d24a5 MCC |
536 | val = em28xx_read_ac97(dev, kcontrol->private_value); |
537 | mutex_unlock(&dev->lock); | |
538 | if (val < 0) | |
539 | return val; | |
540 | ||
66cb6957 MCC |
541 | dprintk("%sleft vol %d, right vol %d (0x%04x) from ac97 volume control 0x%04x\n", |
542 | (val & 0x8000) ? "muted " : "", | |
543 | 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), | |
544 | val, (int)kcontrol->private_value); | |
545 | ||
71d7d83e MCC |
546 | value->value.integer.value[0] = 0x1f - (val & 0x1f); |
547 | value->value.integer.value[1] = 0x1f - ((val << 8) & 0x1f); | |
850d24a5 MCC |
548 | |
549 | return 0; | |
550 | } | |
551 | ||
43131a2c MCC |
552 | static int em28xx_vol_put_mute(struct snd_kcontrol *kcontrol, |
553 | struct snd_ctl_elem_value *value) | |
554 | { | |
555 | struct em28xx *dev = snd_kcontrol_chip(kcontrol); | |
556 | u16 val = value->value.integer.value[0]; | |
34906633 MCC |
557 | struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream; |
558 | int nonblock = 0; | |
43131a2c MCC |
559 | int rc; |
560 | ||
8b1fa579 MCC |
561 | if (dev->disconnected) |
562 | return -ENODEV; | |
563 | ||
34906633 MCC |
564 | if (substream) |
565 | nonblock = !!(substream->f_flags & O_NONBLOCK); | |
566 | if (nonblock) { | |
567 | if (!mutex_trylock(&dev->lock)) | |
568 | return -EAGAIN; | |
569 | } else | |
570 | mutex_lock(&dev->lock); | |
43131a2c MCC |
571 | rc = em28xx_read_ac97(dev, kcontrol->private_value); |
572 | if (rc < 0) | |
573 | goto err; | |
574 | ||
575 | if (val) | |
71d7d83e | 576 | rc &= 0x1f1f; |
43131a2c | 577 | else |
71d7d83e | 578 | rc |= 0x8000; |
43131a2c MCC |
579 | |
580 | rc = em28xx_write_ac97(dev, kcontrol->private_value, rc); | |
66cb6957 MCC |
581 | if (rc < 0) |
582 | goto err; | |
583 | ||
584 | dprintk("%sleft vol %d, right vol %d (0x%04x) to ac97 volume control 0x%04x\n", | |
585 | (val & 0x8000) ? "muted " : "", | |
586 | 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), | |
587 | val, (int)kcontrol->private_value); | |
43131a2c MCC |
588 | |
589 | err: | |
590 | mutex_unlock(&dev->lock); | |
591 | return rc; | |
592 | } | |
593 | ||
594 | static int em28xx_vol_get_mute(struct snd_kcontrol *kcontrol, | |
595 | struct snd_ctl_elem_value *value) | |
596 | { | |
597 | struct em28xx *dev = snd_kcontrol_chip(kcontrol); | |
34906633 MCC |
598 | struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream; |
599 | int nonblock = 0; | |
43131a2c MCC |
600 | int val; |
601 | ||
8b1fa579 MCC |
602 | if (dev->disconnected) |
603 | return -ENODEV; | |
604 | ||
34906633 MCC |
605 | if (substream) |
606 | nonblock = !!(substream->f_flags & O_NONBLOCK); | |
607 | if (nonblock) { | |
608 | if (!mutex_trylock(&dev->lock)) | |
609 | return -EAGAIN; | |
610 | } else | |
611 | mutex_lock(&dev->lock); | |
43131a2c MCC |
612 | val = em28xx_read_ac97(dev, kcontrol->private_value); |
613 | mutex_unlock(&dev->lock); | |
614 | if (val < 0) | |
615 | return val; | |
616 | ||
617 | if (val & 0x8000) | |
43131a2c | 618 | value->value.integer.value[0] = 0; |
71d7d83e MCC |
619 | else |
620 | value->value.integer.value[0] = 1; | |
43131a2c | 621 | |
66cb6957 MCC |
622 | dprintk("%sleft vol %d, right vol %d (0x%04x) from ac97 volume control 0x%04x\n", |
623 | (val & 0x8000) ? "muted " : "", | |
624 | 0x1f - ((val >> 8) & 0x1f), 0x1f - (val & 0x1f), | |
625 | val, (int)kcontrol->private_value); | |
626 | ||
43131a2c MCC |
627 | return 0; |
628 | } | |
629 | ||
850d24a5 MCC |
630 | static const DECLARE_TLV_DB_SCALE(em28xx_db_scale, -3450, 150, 0); |
631 | ||
632 | static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev, | |
633 | char *name, int id) | |
634 | { | |
635 | int err; | |
43131a2c | 636 | char ctl_name[44]; |
850d24a5 | 637 | struct snd_kcontrol *kctl; |
43131a2c MCC |
638 | struct snd_kcontrol_new tmp; |
639 | ||
640 | memset (&tmp, 0, sizeof(tmp)); | |
641 | tmp.iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
642 | tmp.private_value = id, | |
643 | tmp.name = ctl_name, | |
644 | ||
645 | /* Add Mute Control */ | |
646 | sprintf(ctl_name, "%s Switch", name); | |
647 | tmp.get = em28xx_vol_get_mute; | |
648 | tmp.put = em28xx_vol_put_mute; | |
649 | tmp.info = snd_ctl_boolean_mono_info; | |
850d24a5 | 650 | kctl = snd_ctl_new1(&tmp, dev); |
43131a2c MCC |
651 | err = snd_ctl_add(card, kctl); |
652 | if (err < 0) | |
653 | return err; | |
66cb6957 MCC |
654 | dprintk("Added control %s for ac97 volume control 0x%04x\n", |
655 | ctl_name, id); | |
850d24a5 | 656 | |
43131a2c MCC |
657 | memset (&tmp, 0, sizeof(tmp)); |
658 | tmp.iface = SNDRV_CTL_ELEM_IFACE_MIXER, | |
659 | tmp.private_value = id, | |
660 | tmp.name = ctl_name, | |
661 | ||
662 | /* Add Volume Control */ | |
663 | sprintf(ctl_name, "%s Volume", name); | |
664 | tmp.get = em28xx_vol_get; | |
665 | tmp.put = em28xx_vol_put; | |
666 | tmp.info = em28xx_vol_info; | |
667 | tmp.tlv.p = em28xx_db_scale, | |
668 | kctl = snd_ctl_new1(&tmp, dev); | |
850d24a5 MCC |
669 | err = snd_ctl_add(card, kctl); |
670 | if (err < 0) | |
671 | return err; | |
66cb6957 MCC |
672 | dprintk("Added control %s for ac97 volume control 0x%04x\n", |
673 | ctl_name, id); | |
850d24a5 MCC |
674 | |
675 | return 0; | |
676 | } | |
677 | ||
850d24a5 MCC |
678 | /* |
679 | * register/unregister code and data | |
680 | */ | |
a52932b4 | 681 | static struct snd_pcm_ops snd_em28xx_pcm_capture = { |
6d79468d MCC |
682 | .open = snd_em28xx_capture_open, |
683 | .close = snd_em28xx_pcm_close, | |
684 | .ioctl = snd_pcm_lib_ioctl, | |
a52932b4 | 685 | .hw_params = snd_em28xx_hw_capture_params, |
6d79468d MCC |
686 | .hw_free = snd_em28xx_hw_capture_free, |
687 | .prepare = snd_em28xx_prepare, | |
688 | .trigger = snd_em28xx_capture_trigger, | |
689 | .pointer = snd_em28xx_capture_pointer, | |
690 | .page = snd_pcm_get_vmalloc_page, | |
a52932b4 MR |
691 | }; |
692 | ||
f5f894d1 MCC |
693 | static void em28xx_audio_free_urb(struct em28xx *dev) |
694 | { | |
695 | int i; | |
696 | ||
1b3fd2d3 | 697 | for (i = 0; i < dev->adev.num_urb; i++) { |
f5f894d1 MCC |
698 | struct urb *urb = dev->adev.urb[i]; |
699 | ||
1b3fd2d3 | 700 | if (!urb) |
f5f894d1 MCC |
701 | continue; |
702 | ||
1b3fd2d3 MCC |
703 | if (dev->adev.transfer_buffer[i]) |
704 | usb_free_coherent(dev->udev, | |
705 | urb->transfer_buffer_length, | |
706 | dev->adev.transfer_buffer[i], | |
707 | urb->transfer_dma); | |
f5f894d1 MCC |
708 | |
709 | usb_free_urb(urb); | |
f5f894d1 | 710 | } |
1b3fd2d3 MCC |
711 | kfree(dev->adev.urb); |
712 | kfree(dev->adev.transfer_buffer); | |
713 | dev->adev.num_urb = 0; | |
714 | } | |
715 | ||
716 | /* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */ | |
717 | static int em28xx_audio_ep_packet_size(struct usb_device *udev, | |
718 | struct usb_endpoint_descriptor *e) | |
719 | { | |
720 | int size = le16_to_cpu(e->wMaxPacketSize); | |
721 | ||
722 | if (udev->speed == USB_SPEED_HIGH) | |
723 | return (size & 0x7ff) * (1 + (((size) >> 11) & 0x03)); | |
724 | ||
725 | return size & 0x7ff; | |
f5f894d1 MCC |
726 | } |
727 | ||
966f4163 | 728 | static int em28xx_audio_urb_init(struct em28xx *dev) |
a52932b4 | 729 | { |
d2849fa5 MCC |
730 | struct usb_interface *intf; |
731 | struct usb_endpoint_descriptor *e, *ep = NULL; | |
966f4163 | 732 | int i, ep_size, interval, num_urb, npackets; |
1b3fd2d3 | 733 | int urb_size, bytes_per_transfer; |
d2849fa5 | 734 | u8 alt; |
6d79468d | 735 | |
d2849fa5 MCC |
736 | if (dev->audio_ifnum) |
737 | alt = 1; | |
738 | else | |
739 | alt = 7; | |
740 | ||
741 | intf = usb_ifnum_to_if(dev->udev, dev->audio_ifnum); | |
742 | ||
743 | if (intf->num_altsetting <= alt) { | |
744 | em28xx_errdev("alt %d doesn't exist on interface %d\n", | |
745 | dev->audio_ifnum, alt); | |
746 | return -ENODEV; | |
747 | } | |
748 | ||
749 | for (i = 0; i < intf->altsetting[alt].desc.bNumEndpoints; i++) { | |
750 | e = &intf->altsetting[alt].endpoint[i].desc; | |
751 | if (!usb_endpoint_dir_in(e)) | |
752 | continue; | |
753 | if (e->bEndpointAddress == EM28XX_EP_AUDIO) { | |
754 | ep = e; | |
755 | break; | |
756 | } | |
757 | } | |
758 | ||
759 | if (!ep) { | |
760 | em28xx_errdev("Couldn't find an audio endpoint"); | |
761 | return -ENODEV; | |
762 | } | |
763 | ||
1b3fd2d3 MCC |
764 | ep_size = em28xx_audio_ep_packet_size(dev->udev, ep); |
765 | interval = 1 << (ep->bInterval - 1); | |
766 | ||
767 | em28xx_info("Endpoint 0x%02x %s on intf %d alt %d interval = %d, size %d\n", | |
768 | EM28XX_EP_AUDIO, usb_speed_string(dev->udev->speed), | |
769 | dev->audio_ifnum, alt, | |
770 | interval, | |
771 | ep_size); | |
772 | ||
773 | /* Calculate the number and size of URBs to better fit the audio samples */ | |
774 | ||
775 | /* | |
776 | * Estimate the number of bytes per DMA transfer. | |
777 | * | |
778 | * This is given by the bit rate (for now, only 48000 Hz) multiplied | |
779 | * by 2 channels and 2 bytes/sample divided by the number of microframe | |
780 | * intervals and by the microframe rate (125 us) | |
781 | */ | |
782 | bytes_per_transfer = DIV_ROUND_UP(48000 * 2 * 2, 125 * interval); | |
783 | ||
784 | /* | |
785 | * Estimate the number of transfer URBs. Don't let it go past the | |
786 | * maximum number of URBs that is known to be supported by the device. | |
787 | */ | |
788 | num_urb = DIV_ROUND_UP(bytes_per_transfer, ep_size); | |
789 | if (num_urb > EM28XX_MAX_AUDIO_BUFS) | |
790 | num_urb = EM28XX_MAX_AUDIO_BUFS; | |
791 | ||
792 | /* | |
793 | * Now that we know the number of bytes per transfer and the number of | |
794 | * URBs, estimate the typical size of an URB, in order to adjust the | |
795 | * minimal number of packets. | |
796 | */ | |
797 | urb_size = bytes_per_transfer / num_urb; | |
798 | ||
799 | /* | |
800 | * Now, calculate the amount of audio packets to be filled on each | |
801 | * URB. In order to preserve the old behaviour, use a minimal | |
802 | * threshold for this value. | |
803 | */ | |
804 | npackets = EM28XX_MIN_AUDIO_PACKETS; | |
805 | if (urb_size > ep_size * npackets) | |
806 | npackets = DIV_ROUND_UP(urb_size, ep_size); | |
807 | ||
808 | em28xx_info("Number of URBs: %d, with %d packets and %d size", | |
809 | num_urb, npackets, urb_size); | |
810 | ||
a02b9c23 MCC |
811 | /* Estimate the bytes per period */ |
812 | dev->adev.period = urb_size * npackets; | |
813 | ||
1b3fd2d3 MCC |
814 | /* Allocate space to store the number of URBs to be used */ |
815 | ||
816 | dev->adev.transfer_buffer = kcalloc(num_urb, | |
817 | sizeof(*dev->adev.transfer_buffer), | |
818 | GFP_ATOMIC); | |
819 | if (!dev->adev.transfer_buffer) { | |
1b3fd2d3 MCC |
820 | return -ENOMEM; |
821 | } | |
822 | ||
823 | dev->adev.urb = kcalloc(num_urb, sizeof(*dev->adev.urb), GFP_ATOMIC); | |
824 | if (!dev->adev.urb) { | |
1b3fd2d3 MCC |
825 | kfree(dev->adev.transfer_buffer); |
826 | return -ENOMEM; | |
827 | } | |
828 | ||
829 | /* Alloc memory for each URB and for each transfer buffer */ | |
830 | dev->adev.num_urb = num_urb; | |
831 | for (i = 0; i < num_urb; i++) { | |
f5f894d1 MCC |
832 | struct urb *urb; |
833 | int j, k; | |
834 | void *buf; | |
835 | ||
1b3fd2d3 | 836 | urb = usb_alloc_urb(npackets, GFP_ATOMIC); |
f5f894d1 MCC |
837 | if (!urb) { |
838 | em28xx_errdev("usb_alloc_urb failed!\n"); | |
839 | em28xx_audio_free_urb(dev); | |
840 | return -ENOMEM; | |
841 | } | |
842 | dev->adev.urb[i] = urb; | |
843 | ||
1b3fd2d3 | 844 | buf = usb_alloc_coherent(dev->udev, npackets * ep_size, GFP_ATOMIC, |
f5f894d1 MCC |
845 | &urb->transfer_dma); |
846 | if (!buf) { | |
847 | em28xx_errdev("usb_alloc_coherent failed!\n"); | |
848 | em28xx_audio_free_urb(dev); | |
849 | return -ENOMEM; | |
850 | } | |
851 | dev->adev.transfer_buffer[i] = buf; | |
852 | ||
853 | urb->dev = dev->udev; | |
854 | urb->context = dev; | |
855 | urb->pipe = usb_rcvisocpipe(dev->udev, EM28XX_EP_AUDIO); | |
856 | urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; | |
1b3fd2d3 MCC |
857 | urb->transfer_buffer = buf; |
858 | urb->interval = interval; | |
f5f894d1 | 859 | urb->complete = em28xx_audio_isocirq; |
1b3fd2d3 MCC |
860 | urb->number_of_packets = npackets; |
861 | urb->transfer_buffer_length = ep_size * npackets; | |
d2849fa5 | 862 | |
1b3fd2d3 | 863 | for (j = k = 0; j < npackets; j++, k += ep_size) { |
f5f894d1 | 864 | urb->iso_frame_desc[j].offset = k; |
1b3fd2d3 | 865 | urb->iso_frame_desc[j].length = ep_size; |
f5f894d1 MCC |
866 | } |
867 | } | |
868 | ||
966f4163 MCC |
869 | return 0; |
870 | } | |
871 | ||
872 | static int em28xx_audio_init(struct em28xx *dev) | |
873 | { | |
874 | struct em28xx_audio *adev = &dev->adev; | |
875 | struct snd_pcm *pcm; | |
876 | struct snd_card *card; | |
877 | static int devnr; | |
878 | int err; | |
879 | ||
880 | if (!dev->has_alsa_audio || dev->audio_ifnum < 0) { | |
881 | /* This device does not support the extension (in this case | |
882 | the device is expecting the snd-usb-audio module or | |
883 | doesn't have analog audio support at all) */ | |
884 | return 0; | |
885 | } | |
886 | ||
887 | em28xx_info("Binding audio extension\n"); | |
888 | ||
889 | printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " | |
890 | "Rechberger\n"); | |
891 | printk(KERN_INFO | |
892 | "em28xx-audio.c: Copyright (C) 2007-2014 Mauro Carvalho Chehab\n"); | |
893 | ||
894 | err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0, | |
895 | &card); | |
896 | if (err < 0) | |
897 | return err; | |
898 | ||
899 | spin_lock_init(&adev->slock); | |
900 | adev->sndcard = card; | |
901 | adev->udev = dev->udev; | |
902 | ||
903 | err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); | |
0cd03a0c MCC |
904 | if (err < 0) |
905 | goto card_free; | |
966f4163 MCC |
906 | |
907 | snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_em28xx_pcm_capture); | |
908 | pcm->info_flags = 0; | |
909 | pcm->private_data = dev; | |
910 | strcpy(pcm->name, "Empia 28xx Capture"); | |
911 | ||
912 | snd_card_set_dev(card, &dev->udev->dev); | |
913 | strcpy(card->driver, "Em28xx-Audio"); | |
914 | strcpy(card->shortname, "Em28xx Audio"); | |
915 | strcpy(card->longname, "Empia Em28xx Audio"); | |
916 | ||
917 | INIT_WORK(&dev->wq_trigger, audio_trigger); | |
918 | ||
919 | if (dev->audio_mode.ac97 != EM28XX_NO_AC97) { | |
920 | em28xx_cvol_new(card, dev, "Video", AC97_VIDEO); | |
921 | em28xx_cvol_new(card, dev, "Line In", AC97_LINE); | |
922 | em28xx_cvol_new(card, dev, "Phone", AC97_PHONE); | |
923 | em28xx_cvol_new(card, dev, "Microphone", AC97_MIC); | |
924 | em28xx_cvol_new(card, dev, "CD", AC97_CD); | |
925 | em28xx_cvol_new(card, dev, "AUX", AC97_AUX); | |
926 | em28xx_cvol_new(card, dev, "PCM", AC97_PCM); | |
927 | ||
928 | em28xx_cvol_new(card, dev, "Master", AC97_MASTER); | |
929 | em28xx_cvol_new(card, dev, "Line", AC97_HEADPHONE); | |
930 | em28xx_cvol_new(card, dev, "Mono", AC97_MASTER_MONO); | |
931 | em28xx_cvol_new(card, dev, "LFE", AC97_CENTER_LFE_MASTER); | |
932 | em28xx_cvol_new(card, dev, "Surround", AC97_SURROUND_MASTER); | |
933 | } | |
934 | ||
935 | err = em28xx_audio_urb_init(dev); | |
0cd03a0c MCC |
936 | if (err) |
937 | goto card_free; | |
966f4163 | 938 | |
6d79468d | 939 | err = snd_card_register(card); |
0cd03a0c MCC |
940 | if (err < 0) |
941 | goto urb_free; | |
6d79468d | 942 | |
9634614f | 943 | em28xx_info("Audio extension successfully initialized\n"); |
a52932b4 | 944 | return 0; |
0cd03a0c MCC |
945 | |
946 | urb_free: | |
947 | em28xx_audio_free_urb(dev); | |
948 | ||
949 | card_free: | |
950 | snd_card_free(card); | |
951 | ||
952 | return err; | |
a52932b4 MR |
953 | } |
954 | ||
955 | static int em28xx_audio_fini(struct em28xx *dev) | |
956 | { | |
1a6f11e0 | 957 | if (dev == NULL) |
a52932b4 | 958 | return 0; |
6d79468d | 959 | |
24a613e4 | 960 | if (dev->has_alsa_audio != 1) { |
df619181 | 961 | /* This device does not support the extension (in this case |
24a613e4 DH |
962 | the device is expecting the snd-usb-audio module or |
963 | doesn't have analog audio support at all) */ | |
df619181 DH |
964 | return 0; |
965 | } | |
966 | ||
aa929ad7 MCC |
967 | em28xx_info("Closing audio extension"); |
968 | ||
1fe2e3bf | 969 | snd_card_disconnect(dev->adev.sndcard); |
f5f894d1 MCC |
970 | em28xx_audio_free_urb(dev); |
971 | ||
9baed99e MCC |
972 | if (dev->adev.sndcard) { |
973 | snd_card_free(dev->adev.sndcard); | |
974 | dev->adev.sndcard = NULL; | |
a52932b4 | 975 | } |
6d79468d | 976 | |
a52932b4 MR |
977 | return 0; |
978 | } | |
979 | ||
980 | static struct em28xx_ops audio_ops = { | |
6d79468d | 981 | .id = EM28XX_AUDIO, |
1a6f11e0 MCC |
982 | .name = "Em28xx Audio Extension", |
983 | .init = em28xx_audio_init, | |
984 | .fini = em28xx_audio_fini, | |
a52932b4 MR |
985 | }; |
986 | ||
987 | static int __init em28xx_alsa_register(void) | |
988 | { | |
a52932b4 MR |
989 | return em28xx_register_extension(&audio_ops); |
990 | } | |
991 | ||
992 | static void __exit em28xx_alsa_unregister(void) | |
993 | { | |
994 | em28xx_unregister_extension(&audio_ops); | |
995 | } | |
996 | ||
997 | MODULE_LICENSE("GPL"); | |
998 | MODULE_AUTHOR("Markus Rechberger <mrechberger@gmail.com>"); | |
4f83e7b3 | 999 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); |
d8992b09 MCC |
1000 | MODULE_DESCRIPTION(DRIVER_DESC " - audio interface"); |
1001 | MODULE_VERSION(EM28XX_VERSION); | |
a52932b4 MR |
1002 | |
1003 | module_init(em28xx_alsa_register); | |
1004 | module_exit(em28xx_alsa_unregister); |