sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / drivers / media / usb / cx231xx / cx231xx-audio.c
blob8263c4b0610b4e44457f6c867a387e3a9a89d06d
1 /*
2 * Conexant Cx231xx audio extension
4 * Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
5 * Based on em28xx driver
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 #include "cx231xx.h"
24 #include <linux/kernel.h>
25 #include <linux/init.h>
26 #include <linux/sound.h>
27 #include <linux/spinlock.h>
28 #include <linux/soundcard.h>
29 #include <linux/slab.h>
30 #include <linux/vmalloc.h>
31 #include <linux/proc_fs.h>
32 #include <linux/module.h>
33 #include <sound/core.h>
34 #include <sound/pcm.h>
35 #include <sound/pcm_params.h>
36 #include <sound/info.h>
37 #include <sound/initval.h>
38 #include <sound/control.h>
39 #include <media/v4l2-common.h>
41 static int debug;
42 module_param(debug, int, 0644);
43 MODULE_PARM_DESC(debug, "activates debug info");
45 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
47 static int cx231xx_isoc_audio_deinit(struct cx231xx *dev)
49 int i;
51 dev_dbg(dev->dev, "Stopping isoc\n");
53 for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
54 if (dev->adev.urb[i]) {
55 if (!irqs_disabled())
56 usb_kill_urb(dev->adev.urb[i]);
57 else
58 usb_unlink_urb(dev->adev.urb[i]);
60 usb_free_urb(dev->adev.urb[i]);
61 dev->adev.urb[i] = NULL;
63 kfree(dev->adev.transfer_buffer[i]);
64 dev->adev.transfer_buffer[i] = NULL;
68 return 0;
71 static int cx231xx_bulk_audio_deinit(struct cx231xx *dev)
73 int i;
75 dev_dbg(dev->dev, "Stopping bulk\n");
77 for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
78 if (dev->adev.urb[i]) {
79 if (!irqs_disabled())
80 usb_kill_urb(dev->adev.urb[i]);
81 else
82 usb_unlink_urb(dev->adev.urb[i]);
84 usb_free_urb(dev->adev.urb[i]);
85 dev->adev.urb[i] = NULL;
87 kfree(dev->adev.transfer_buffer[i]);
88 dev->adev.transfer_buffer[i] = NULL;
92 return 0;
95 static void cx231xx_audio_isocirq(struct urb *urb)
97 struct cx231xx *dev = urb->context;
98 int i;
99 unsigned int oldptr;
100 int period_elapsed = 0;
101 int status;
102 unsigned char *cp;
103 unsigned int stride;
104 struct snd_pcm_substream *substream;
105 struct snd_pcm_runtime *runtime;
107 if (dev->state & DEV_DISCONNECTED)
108 return;
110 switch (urb->status) {
111 case 0: /* success */
112 case -ETIMEDOUT: /* NAK */
113 break;
114 case -ECONNRESET: /* kill */
115 case -ENOENT:
116 case -ESHUTDOWN:
117 return;
118 default: /* error */
119 dev_dbg(dev->dev, "urb completition error %d.\n",
120 urb->status);
121 break;
124 if (atomic_read(&dev->stream_started) == 0)
125 return;
127 if (dev->adev.capture_pcm_substream) {
128 substream = dev->adev.capture_pcm_substream;
129 runtime = substream->runtime;
130 stride = runtime->frame_bits >> 3;
132 for (i = 0; i < urb->number_of_packets; i++) {
133 int length = urb->iso_frame_desc[i].actual_length /
134 stride;
135 cp = (unsigned char *)urb->transfer_buffer +
136 urb->iso_frame_desc[i].offset;
138 if (!length)
139 continue;
141 oldptr = dev->adev.hwptr_done_capture;
142 if (oldptr + length >= runtime->buffer_size) {
143 unsigned int cnt;
145 cnt = runtime->buffer_size - oldptr;
146 memcpy(runtime->dma_area + oldptr * stride, cp,
147 cnt * stride);
148 memcpy(runtime->dma_area, cp + cnt * stride,
149 length * stride - cnt * stride);
150 } else {
151 memcpy(runtime->dma_area + oldptr * stride, cp,
152 length * stride);
155 snd_pcm_stream_lock(substream);
157 dev->adev.hwptr_done_capture += length;
158 if (dev->adev.hwptr_done_capture >=
159 runtime->buffer_size)
160 dev->adev.hwptr_done_capture -=
161 runtime->buffer_size;
163 dev->adev.capture_transfer_done += length;
164 if (dev->adev.capture_transfer_done >=
165 runtime->period_size) {
166 dev->adev.capture_transfer_done -=
167 runtime->period_size;
168 period_elapsed = 1;
170 snd_pcm_stream_unlock(substream);
172 if (period_elapsed)
173 snd_pcm_period_elapsed(substream);
175 urb->status = 0;
177 status = usb_submit_urb(urb, GFP_ATOMIC);
178 if (status < 0) {
179 dev_err(dev->dev,
180 "resubmit of audio urb failed (error=%i)\n",
181 status);
183 return;
186 static void cx231xx_audio_bulkirq(struct urb *urb)
188 struct cx231xx *dev = urb->context;
189 unsigned int oldptr;
190 int period_elapsed = 0;
191 int status;
192 unsigned char *cp;
193 unsigned int stride;
194 struct snd_pcm_substream *substream;
195 struct snd_pcm_runtime *runtime;
197 if (dev->state & DEV_DISCONNECTED)
198 return;
200 switch (urb->status) {
201 case 0: /* success */
202 case -ETIMEDOUT: /* NAK */
203 break;
204 case -ECONNRESET: /* kill */
205 case -ENOENT:
206 case -ESHUTDOWN:
207 return;
208 default: /* error */
209 dev_dbg(dev->dev, "urb completition error %d.\n",
210 urb->status);
211 break;
214 if (atomic_read(&dev->stream_started) == 0)
215 return;
217 if (dev->adev.capture_pcm_substream) {
218 substream = dev->adev.capture_pcm_substream;
219 runtime = substream->runtime;
220 stride = runtime->frame_bits >> 3;
222 if (1) {
223 int length = urb->actual_length /
224 stride;
225 cp = (unsigned char *)urb->transfer_buffer;
227 oldptr = dev->adev.hwptr_done_capture;
228 if (oldptr + length >= runtime->buffer_size) {
229 unsigned int cnt;
231 cnt = runtime->buffer_size - oldptr;
232 memcpy(runtime->dma_area + oldptr * stride, cp,
233 cnt * stride);
234 memcpy(runtime->dma_area, cp + cnt * stride,
235 length * stride - cnt * stride);
236 } else {
237 memcpy(runtime->dma_area + oldptr * stride, cp,
238 length * stride);
241 snd_pcm_stream_lock(substream);
243 dev->adev.hwptr_done_capture += length;
244 if (dev->adev.hwptr_done_capture >=
245 runtime->buffer_size)
246 dev->adev.hwptr_done_capture -=
247 runtime->buffer_size;
249 dev->adev.capture_transfer_done += length;
250 if (dev->adev.capture_transfer_done >=
251 runtime->period_size) {
252 dev->adev.capture_transfer_done -=
253 runtime->period_size;
254 period_elapsed = 1;
256 snd_pcm_stream_unlock(substream);
258 if (period_elapsed)
259 snd_pcm_period_elapsed(substream);
261 urb->status = 0;
263 status = usb_submit_urb(urb, GFP_ATOMIC);
264 if (status < 0) {
265 dev_err(dev->dev,
266 "resubmit of audio urb failed (error=%i)\n",
267 status);
269 return;
272 static int cx231xx_init_audio_isoc(struct cx231xx *dev)
274 int i, errCode;
275 int sb_size;
277 dev_dbg(dev->dev,
278 "%s: Starting ISO AUDIO transfers\n", __func__);
280 if (dev->state & DEV_DISCONNECTED)
281 return -ENODEV;
283 sb_size = CX231XX_ISO_NUM_AUDIO_PACKETS * dev->adev.max_pkt_size;
285 for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
286 struct urb *urb;
287 int j, k;
289 dev->adev.transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC);
290 if (!dev->adev.transfer_buffer[i])
291 return -ENOMEM;
293 memset(dev->adev.transfer_buffer[i], 0x80, sb_size);
294 urb = usb_alloc_urb(CX231XX_ISO_NUM_AUDIO_PACKETS, GFP_ATOMIC);
295 if (!urb) {
296 for (j = 0; j < i; j++) {
297 usb_free_urb(dev->adev.urb[j]);
298 kfree(dev->adev.transfer_buffer[j]);
300 return -ENOMEM;
303 urb->dev = dev->udev;
304 urb->context = dev;
305 urb->pipe = usb_rcvisocpipe(dev->udev,
306 dev->adev.end_point_addr);
307 urb->transfer_flags = URB_ISO_ASAP;
308 urb->transfer_buffer = dev->adev.transfer_buffer[i];
309 urb->interval = 1;
310 urb->complete = cx231xx_audio_isocirq;
311 urb->number_of_packets = CX231XX_ISO_NUM_AUDIO_PACKETS;
312 urb->transfer_buffer_length = sb_size;
314 for (j = k = 0; j < CX231XX_ISO_NUM_AUDIO_PACKETS;
315 j++, k += dev->adev.max_pkt_size) {
316 urb->iso_frame_desc[j].offset = k;
317 urb->iso_frame_desc[j].length = dev->adev.max_pkt_size;
319 dev->adev.urb[i] = urb;
322 for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
323 errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
324 if (errCode < 0) {
325 cx231xx_isoc_audio_deinit(dev);
326 return errCode;
330 return errCode;
333 static int cx231xx_init_audio_bulk(struct cx231xx *dev)
335 int i, errCode;
336 int sb_size;
338 dev_dbg(dev->dev,
339 "%s: Starting BULK AUDIO transfers\n", __func__);
341 if (dev->state & DEV_DISCONNECTED)
342 return -ENODEV;
344 sb_size = CX231XX_NUM_AUDIO_PACKETS * dev->adev.max_pkt_size;
346 for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
347 struct urb *urb;
348 int j;
350 dev->adev.transfer_buffer[i] = kmalloc(sb_size, GFP_ATOMIC);
351 if (!dev->adev.transfer_buffer[i])
352 return -ENOMEM;
354 memset(dev->adev.transfer_buffer[i], 0x80, sb_size);
355 urb = usb_alloc_urb(CX231XX_NUM_AUDIO_PACKETS, GFP_ATOMIC);
356 if (!urb) {
357 for (j = 0; j < i; j++) {
358 usb_free_urb(dev->adev.urb[j]);
359 kfree(dev->adev.transfer_buffer[j]);
361 return -ENOMEM;
364 urb->dev = dev->udev;
365 urb->context = dev;
366 urb->pipe = usb_rcvbulkpipe(dev->udev,
367 dev->adev.end_point_addr);
368 urb->transfer_flags = 0;
369 urb->transfer_buffer = dev->adev.transfer_buffer[i];
370 urb->complete = cx231xx_audio_bulkirq;
371 urb->transfer_buffer_length = sb_size;
373 dev->adev.urb[i] = urb;
377 for (i = 0; i < CX231XX_AUDIO_BUFS; i++) {
378 errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
379 if (errCode < 0) {
380 cx231xx_bulk_audio_deinit(dev);
381 return errCode;
385 return errCode;
388 static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs,
389 size_t size)
391 struct snd_pcm_runtime *runtime = subs->runtime;
392 struct cx231xx *dev = snd_pcm_substream_chip(subs);
394 dev_dbg(dev->dev, "Allocating vbuffer\n");
395 if (runtime->dma_area) {
396 if (runtime->dma_bytes > size)
397 return 0;
399 vfree(runtime->dma_area);
401 runtime->dma_area = vmalloc(size);
402 if (!runtime->dma_area)
403 return -ENOMEM;
405 runtime->dma_bytes = size;
407 return 0;
410 static struct snd_pcm_hardware snd_cx231xx_hw_capture = {
411 .info = SNDRV_PCM_INFO_BLOCK_TRANSFER |
412 SNDRV_PCM_INFO_MMAP |
413 SNDRV_PCM_INFO_INTERLEAVED |
414 SNDRV_PCM_INFO_MMAP_VALID,
416 .formats = SNDRV_PCM_FMTBIT_S16_LE,
418 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_KNOT,
420 .rate_min = 48000,
421 .rate_max = 48000,
422 .channels_min = 2,
423 .channels_max = 2,
424 .buffer_bytes_max = 62720 * 8, /* just about the value in usbaudio.c */
425 .period_bytes_min = 64, /* 12544/2, */
426 .period_bytes_max = 12544,
427 .periods_min = 2,
428 .periods_max = 98, /* 12544, */
431 static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)
433 struct cx231xx *dev = snd_pcm_substream_chip(substream);
434 struct snd_pcm_runtime *runtime = substream->runtime;
435 int ret = 0;
437 dev_dbg(dev->dev,
438 "opening device and trying to acquire exclusive lock\n");
440 if (dev->state & DEV_DISCONNECTED) {
441 dev_err(dev->dev,
442 "Can't open. the device was removed.\n");
443 return -ENODEV;
446 /* set alternate setting for audio interface */
447 /* 1 - 48000 samples per sec */
448 mutex_lock(&dev->lock);
449 if (dev->USE_ISO)
450 ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1);
451 else
452 ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0);
453 mutex_unlock(&dev->lock);
454 if (ret < 0) {
455 dev_err(dev->dev,
456 "failed to set alternate setting !\n");
458 return ret;
461 runtime->hw = snd_cx231xx_hw_capture;
463 mutex_lock(&dev->lock);
464 /* inform hardware to start streaming */
465 ret = cx231xx_capture_start(dev, 1, Audio);
467 dev->adev.users++;
468 mutex_unlock(&dev->lock);
470 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
471 dev->adev.capture_pcm_substream = substream;
472 runtime->private_data = dev;
474 return 0;
477 static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)
479 int ret;
480 struct cx231xx *dev = snd_pcm_substream_chip(substream);
482 dev_dbg(dev->dev, "closing device\n");
484 /* inform hardware to stop streaming */
485 mutex_lock(&dev->lock);
486 ret = cx231xx_capture_start(dev, 0, Audio);
488 /* set alternate setting for audio interface */
489 /* 1 - 48000 samples per sec */
490 ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0);
491 if (ret < 0) {
492 dev_err(dev->dev,
493 "failed to set alternate setting !\n");
495 mutex_unlock(&dev->lock);
496 return ret;
499 dev->adev.users--;
500 if (substream->runtime->dma_area) {
501 dev_dbg(dev->dev, "freeing\n");
502 vfree(substream->runtime->dma_area);
503 substream->runtime->dma_area = NULL;
505 mutex_unlock(&dev->lock);
507 if (dev->adev.users == 0 && dev->adev.shutdown == 1) {
508 dev_dbg(dev->dev, "audio users: %d\n", dev->adev.users);
509 dev_dbg(dev->dev, "disabling audio stream!\n");
510 dev->adev.shutdown = 0;
511 dev_dbg(dev->dev, "released lock\n");
512 if (atomic_read(&dev->stream_started) > 0) {
513 atomic_set(&dev->stream_started, 0);
514 schedule_work(&dev->wq_trigger);
517 return 0;
520 static int snd_cx231xx_hw_capture_params(struct snd_pcm_substream *substream,
521 struct snd_pcm_hw_params *hw_params)
523 struct cx231xx *dev = snd_pcm_substream_chip(substream);
524 int ret;
526 dev_dbg(dev->dev, "Setting capture parameters\n");
528 ret = snd_pcm_alloc_vmalloc_buffer(substream,
529 params_buffer_bytes(hw_params));
530 #if 0
531 /* TODO: set up cx231xx audio chip to deliver the correct audio format,
532 current default is 48000hz multiplexed => 96000hz mono
533 which shouldn't matter since analogue TV only supports mono */
534 unsigned int channels, rate, format;
536 format = params_format(hw_params);
537 rate = params_rate(hw_params);
538 channels = params_channels(hw_params);
539 #endif
541 return ret;
544 static int snd_cx231xx_hw_capture_free(struct snd_pcm_substream *substream)
546 struct cx231xx *dev = snd_pcm_substream_chip(substream);
548 dev_dbg(dev->dev, "Stop capture, if needed\n");
550 if (atomic_read(&dev->stream_started) > 0) {
551 atomic_set(&dev->stream_started, 0);
552 schedule_work(&dev->wq_trigger);
555 return 0;
558 static int snd_cx231xx_prepare(struct snd_pcm_substream *substream)
560 struct cx231xx *dev = snd_pcm_substream_chip(substream);
562 dev->adev.hwptr_done_capture = 0;
563 dev->adev.capture_transfer_done = 0;
565 return 0;
568 static void audio_trigger(struct work_struct *work)
570 struct cx231xx *dev = container_of(work, struct cx231xx, wq_trigger);
572 if (atomic_read(&dev->stream_started)) {
573 dev_dbg(dev->dev, "starting capture");
574 if (is_fw_load(dev) == 0)
575 cx25840_call(dev, core, load_fw);
576 if (dev->USE_ISO)
577 cx231xx_init_audio_isoc(dev);
578 else
579 cx231xx_init_audio_bulk(dev);
580 } else {
581 dev_dbg(dev->dev, "stopping capture");
582 cx231xx_isoc_audio_deinit(dev);
586 static int snd_cx231xx_capture_trigger(struct snd_pcm_substream *substream,
587 int cmd)
589 struct cx231xx *dev = snd_pcm_substream_chip(substream);
590 int retval = 0;
592 if (dev->state & DEV_DISCONNECTED)
593 return -ENODEV;
595 spin_lock(&dev->adev.slock);
596 switch (cmd) {
597 case SNDRV_PCM_TRIGGER_START:
598 atomic_set(&dev->stream_started, 1);
599 break;
600 case SNDRV_PCM_TRIGGER_STOP:
601 atomic_set(&dev->stream_started, 0);
602 break;
603 default:
604 retval = -EINVAL;
605 break;
607 spin_unlock(&dev->adev.slock);
609 schedule_work(&dev->wq_trigger);
611 return retval;
614 static snd_pcm_uframes_t snd_cx231xx_capture_pointer(struct snd_pcm_substream
615 *substream)
617 struct cx231xx *dev;
618 unsigned long flags;
619 snd_pcm_uframes_t hwptr_done;
621 dev = snd_pcm_substream_chip(substream);
623 spin_lock_irqsave(&dev->adev.slock, flags);
624 hwptr_done = dev->adev.hwptr_done_capture;
625 spin_unlock_irqrestore(&dev->adev.slock, flags);
627 return hwptr_done;
630 static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs,
631 unsigned long offset)
633 void *pageptr = subs->runtime->dma_area + offset;
635 return vmalloc_to_page(pageptr);
638 static const struct snd_pcm_ops snd_cx231xx_pcm_capture = {
639 .open = snd_cx231xx_capture_open,
640 .close = snd_cx231xx_pcm_close,
641 .ioctl = snd_pcm_lib_ioctl,
642 .hw_params = snd_cx231xx_hw_capture_params,
643 .hw_free = snd_cx231xx_hw_capture_free,
644 .prepare = snd_cx231xx_prepare,
645 .trigger = snd_cx231xx_capture_trigger,
646 .pointer = snd_cx231xx_capture_pointer,
647 .page = snd_pcm_get_vmalloc_page,
650 static int cx231xx_audio_init(struct cx231xx *dev)
652 struct cx231xx_audio *adev = &dev->adev;
653 struct snd_pcm *pcm;
654 struct snd_card *card;
655 static int devnr;
656 int err;
657 struct usb_interface *uif;
658 int i, isoc_pipe = 0;
660 if (dev->has_alsa_audio != 1) {
661 /* This device does not support the extension (in this case
662 the device is expecting the snd-usb-audio module or
663 doesn't have analog audio support at all) */
664 return 0;
667 dev_dbg(dev->dev,
668 "probing for cx231xx non standard usbaudio\n");
670 err = snd_card_new(dev->dev, index[devnr], "Cx231xx Audio",
671 THIS_MODULE, 0, &card);
672 if (err < 0)
673 return err;
675 spin_lock_init(&adev->slock);
676 err = snd_pcm_new(card, "Cx231xx Audio", 0, 0, 1, &pcm);
677 if (err < 0) {
678 snd_card_free(card);
679 return err;
682 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
683 &snd_cx231xx_pcm_capture);
684 pcm->info_flags = 0;
685 pcm->private_data = dev;
686 strcpy(pcm->name, "Conexant cx231xx Capture");
687 strcpy(card->driver, "Cx231xx-Audio");
688 strcpy(card->shortname, "Cx231xx Audio");
689 strcpy(card->longname, "Conexant cx231xx Audio");
691 INIT_WORK(&dev->wq_trigger, audio_trigger);
693 err = snd_card_register(card);
694 if (err < 0) {
695 snd_card_free(card);
696 return err;
698 adev->sndcard = card;
699 adev->udev = dev->udev;
701 /* compute alternate max packet sizes for Audio */
702 uif =
703 dev->udev->actconfig->interface[dev->current_pcb_config.
704 hs_config_info[0].interface_info.
705 audio_index + 1];
707 adev->end_point_addr =
708 uif->altsetting[0].endpoint[isoc_pipe].desc.
709 bEndpointAddress;
711 adev->num_alt = uif->num_altsetting;
712 dev_info(dev->dev,
713 "audio EndPoint Addr 0x%x, Alternate settings: %i\n",
714 adev->end_point_addr, adev->num_alt);
715 adev->alt_max_pkt_size = kmalloc(32 * adev->num_alt, GFP_KERNEL);
717 if (adev->alt_max_pkt_size == NULL)
718 return -ENOMEM;
720 for (i = 0; i < adev->num_alt; i++) {
721 u16 tmp =
722 le16_to_cpu(uif->altsetting[i].endpoint[isoc_pipe].desc.
723 wMaxPacketSize);
724 adev->alt_max_pkt_size[i] =
725 (tmp & 0x07ff) * (((tmp & 0x1800) >> 11) + 1);
726 dev_dbg(dev->dev,
727 "audio alternate setting %i, max size= %i\n", i,
728 adev->alt_max_pkt_size[i]);
731 return 0;
734 static int cx231xx_audio_fini(struct cx231xx *dev)
736 if (dev == NULL)
737 return 0;
739 if (dev->has_alsa_audio != 1) {
740 /* This device does not support the extension (in this case
741 the device is expecting the snd-usb-audio module or
742 doesn't have analog audio support at all) */
743 return 0;
746 if (dev->adev.sndcard) {
747 snd_card_free(dev->adev.sndcard);
748 kfree(dev->adev.alt_max_pkt_size);
749 dev->adev.sndcard = NULL;
752 return 0;
755 static struct cx231xx_ops audio_ops = {
756 .id = CX231XX_AUDIO,
757 .name = "Cx231xx Audio Extension",
758 .init = cx231xx_audio_init,
759 .fini = cx231xx_audio_fini,
762 static int __init cx231xx_alsa_register(void)
764 return cx231xx_register_extension(&audio_ops);
767 static void __exit cx231xx_alsa_unregister(void)
769 cx231xx_unregister_extension(&audio_ops);
772 MODULE_LICENSE("GPL");
773 MODULE_AUTHOR("Srinivasa Deevi <srinivasa.deevi@conexant.com>");
774 MODULE_DESCRIPTION("Cx231xx Audio driver");
776 module_init(cx231xx_alsa_register);
777 module_exit(cx231xx_alsa_unregister);