sh_eth: fix EESIPR values for SH77{34|63}
[linux/fpc-iii.git] / drivers / media / pci / cx25821 / cx25821-audio-upstream.c
blob7c8edb6181ec888d233faa96eb59187d832aa310
1 /*
2 * Driver for the Conexant CX25821 PCIe bridge
4 * Copyright (C) 2009 Conexant Systems Inc.
5 * Authors <hiep.huynh@conexant.com>, <shu.lin@conexant.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * 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 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
25 #include "cx25821-video.h"
26 #include "cx25821-audio-upstream.h"
28 #include <linux/fs.h>
29 #include <linux/errno.h>
30 #include <linux/kernel.h>
31 #include <linux/init.h>
32 #include <linux/module.h>
33 #include <linux/syscalls.h>
34 #include <linux/file.h>
35 #include <linux/fcntl.h>
36 #include <linux/delay.h>
37 #include <linux/slab.h>
38 #include <linux/uaccess.h>
40 MODULE_DESCRIPTION("v4l2 driver module for cx25821 based TV cards");
41 MODULE_AUTHOR("Hiep Huynh <hiep.huynh@conexant.com>");
42 MODULE_LICENSE("GPL");
44 static int _intr_msk = FLD_AUD_SRC_RISCI1 | FLD_AUD_SRC_OF |
45 FLD_AUD_SRC_SYNC | FLD_AUD_SRC_OPC_ERR;
47 static int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev,
48 const struct sram_channel *ch,
49 unsigned int bpl, u32 risc)
51 unsigned int i, lines;
52 u32 cdt;
54 if (ch->cmds_start == 0) {
55 cx_write(ch->ptr1_reg, 0);
56 cx_write(ch->ptr2_reg, 0);
57 cx_write(ch->cnt2_reg, 0);
58 cx_write(ch->cnt1_reg, 0);
59 return 0;
62 bpl = (bpl + 7) & ~7; /* alignment */
63 cdt = ch->cdt;
64 lines = ch->fifo_size / bpl;
66 if (lines > 3)
67 lines = 3;
69 BUG_ON(lines < 2);
71 /* write CDT */
72 for (i = 0; i < lines; i++) {
73 cx_write(cdt + 16 * i, ch->fifo_start + bpl * i);
74 cx_write(cdt + 16 * i + 4, 0);
75 cx_write(cdt + 16 * i + 8, 0);
76 cx_write(cdt + 16 * i + 12, 0);
79 /* write CMDS */
80 cx_write(ch->cmds_start + 0, risc);
82 cx_write(ch->cmds_start + 4, 0);
83 cx_write(ch->cmds_start + 8, cdt);
84 cx_write(ch->cmds_start + 12, AUDIO_CDT_SIZE_QW);
85 cx_write(ch->cmds_start + 16, ch->ctrl_start);
87 /* IQ size */
88 cx_write(ch->cmds_start + 20, AUDIO_IQ_SIZE_DW);
90 for (i = 24; i < 80; i += 4)
91 cx_write(ch->cmds_start + i, 0);
93 /* fill registers */
94 cx_write(ch->ptr1_reg, ch->fifo_start);
95 cx_write(ch->ptr2_reg, cdt);
96 cx_write(ch->cnt2_reg, AUDIO_CDT_SIZE_QW);
97 cx_write(ch->cnt1_reg, AUDIO_CLUSTER_SIZE_QW - 1);
99 return 0;
102 static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev,
103 __le32 *rp,
104 dma_addr_t databuf_phys_addr,
105 unsigned int bpl,
106 int fifo_enable)
108 unsigned int line;
109 const struct sram_channel *sram_ch =
110 dev->channels[dev->_audio_upstream_channel].sram_channels;
111 int offset = 0;
113 /* scan lines */
114 for (line = 0; line < LINES_PER_AUDIO_BUFFER; line++) {
115 *(rp++) = cpu_to_le32(RISC_READ | RISC_SOL | RISC_EOL | bpl);
116 *(rp++) = cpu_to_le32(databuf_phys_addr + offset);
117 *(rp++) = cpu_to_le32(0); /* bits 63-32 */
119 /* Check if we need to enable the FIFO
120 * after the first 3 lines.
121 * For the upstream audio channel,
122 * the risc engine will enable the FIFO */
123 if (fifo_enable && line == 2) {
124 *(rp++) = RISC_WRITECR;
125 *(rp++) = sram_ch->dma_ctl;
126 *(rp++) = sram_ch->fld_aud_fifo_en;
127 *(rp++) = 0x00000020;
130 offset += AUDIO_LINE_SIZE;
133 return rp;
136 static int cx25821_risc_buffer_upstream_audio(struct cx25821_dev *dev,
137 struct pci_dev *pci,
138 unsigned int bpl, unsigned int lines)
140 __le32 *rp;
141 int fifo_enable = 0;
142 int frame = 0, i = 0;
143 int frame_size = AUDIO_DATA_BUF_SZ;
144 int databuf_offset = 0;
145 int risc_flag = RISC_CNT_INC;
146 dma_addr_t risc_phys_jump_addr;
148 /* Virtual address of Risc buffer program */
149 rp = dev->_risc_virt_addr;
151 /* sync instruction */
152 *(rp++) = cpu_to_le32(RISC_RESYNC | AUDIO_SYNC_LINE);
154 for (frame = 0; frame < NUM_AUDIO_FRAMES; frame++) {
155 databuf_offset = frame_size * frame;
157 if (frame == 0) {
158 fifo_enable = 1;
159 risc_flag = RISC_CNT_RESET;
160 } else {
161 fifo_enable = 0;
162 risc_flag = RISC_CNT_INC;
165 /* Calculate physical jump address */
166 if ((frame + 1) == NUM_AUDIO_FRAMES) {
167 risc_phys_jump_addr =
168 dev->_risc_phys_start_addr +
169 RISC_SYNC_INSTRUCTION_SIZE;
170 } else {
171 risc_phys_jump_addr =
172 dev->_risc_phys_start_addr +
173 RISC_SYNC_INSTRUCTION_SIZE +
174 AUDIO_RISC_DMA_BUF_SIZE * (frame + 1);
177 rp = cx25821_risc_field_upstream_audio(dev, rp,
178 dev->_audiodata_buf_phys_addr + databuf_offset,
179 bpl, fifo_enable);
181 if (USE_RISC_NOOP_AUDIO) {
182 for (i = 0; i < NUM_NO_OPS; i++)
183 *(rp++) = cpu_to_le32(RISC_NOOP);
186 /* Loop to (Nth)FrameRISC or to Start of Risc program &
187 * generate IRQ */
188 *(rp++) = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | risc_flag);
189 *(rp++) = cpu_to_le32(risc_phys_jump_addr);
190 *(rp++) = cpu_to_le32(0);
192 /* Recalculate virtual address based on frame index */
193 rp = dev->_risc_virt_addr + RISC_SYNC_INSTRUCTION_SIZE / 4 +
194 (AUDIO_RISC_DMA_BUF_SIZE * (frame + 1) / 4);
197 return 0;
200 static void cx25821_free_memory_audio(struct cx25821_dev *dev)
202 if (dev->_risc_virt_addr) {
203 pci_free_consistent(dev->pci, dev->_audiorisc_size,
204 dev->_risc_virt_addr, dev->_risc_phys_addr);
205 dev->_risc_virt_addr = NULL;
208 if (dev->_audiodata_buf_virt_addr) {
209 pci_free_consistent(dev->pci, dev->_audiodata_buf_size,
210 dev->_audiodata_buf_virt_addr,
211 dev->_audiodata_buf_phys_addr);
212 dev->_audiodata_buf_virt_addr = NULL;
216 void cx25821_stop_upstream_audio(struct cx25821_dev *dev)
218 const struct sram_channel *sram_ch =
219 dev->channels[AUDIO_UPSTREAM_SRAM_CHANNEL_B].sram_channels;
220 u32 tmp = 0;
222 if (!dev->_audio_is_running) {
223 printk(KERN_DEBUG
224 pr_fmt("No audio file is currently running so return!\n"));
225 return;
227 /* Disable RISC interrupts */
228 cx_write(sram_ch->int_msk, 0);
230 /* Turn OFF risc and fifo enable in AUD_DMA_CNTRL */
231 tmp = cx_read(sram_ch->dma_ctl);
232 cx_write(sram_ch->dma_ctl,
233 tmp & ~(sram_ch->fld_aud_fifo_en | sram_ch->fld_aud_risc_en));
235 /* Clear data buffer memory */
236 if (dev->_audiodata_buf_virt_addr)
237 memset(dev->_audiodata_buf_virt_addr, 0,
238 dev->_audiodata_buf_size);
240 dev->_audio_is_running = 0;
241 dev->_is_first_audio_frame = 0;
242 dev->_audioframe_count = 0;
243 dev->_audiofile_status = END_OF_FILE;
245 flush_work(&dev->_audio_work_entry);
247 kfree(dev->_audiofilename);
250 void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev)
252 if (dev->_audio_is_running)
253 cx25821_stop_upstream_audio(dev);
255 cx25821_free_memory_audio(dev);
258 static int cx25821_get_audio_data(struct cx25821_dev *dev,
259 const struct sram_channel *sram_ch)
261 struct file *file;
262 int frame_index_temp = dev->_audioframe_index;
263 int i = 0;
264 int frame_size = AUDIO_DATA_BUF_SZ;
265 int frame_offset = frame_size * frame_index_temp;
266 char mybuf[AUDIO_LINE_SIZE];
267 loff_t file_offset = dev->_audioframe_count * frame_size;
268 char *p = NULL;
270 if (dev->_audiofile_status == END_OF_FILE)
271 return 0;
273 file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0);
274 if (IS_ERR(file)) {
275 pr_err("%s(): ERROR opening file(%s) with errno = %ld!\n",
276 __func__, dev->_audiofilename, -PTR_ERR(file));
277 return PTR_ERR(file);
280 if (dev->_audiodata_buf_virt_addr)
281 p = (char *)dev->_audiodata_buf_virt_addr + frame_offset;
283 for (i = 0; i < dev->_audio_lines_count; i++) {
284 int n = kernel_read(file, file_offset, mybuf, AUDIO_LINE_SIZE);
285 if (n < AUDIO_LINE_SIZE) {
286 pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
287 __func__);
288 dev->_audiofile_status = END_OF_FILE;
289 fput(file);
290 return 0;
292 dev->_audiofile_status = IN_PROGRESS;
293 if (p) {
294 memcpy(p, mybuf, n);
295 p += n;
297 file_offset += n;
299 dev->_audioframe_count++;
300 fput(file);
302 return 0;
305 static void cx25821_audioups_handler(struct work_struct *work)
307 struct cx25821_dev *dev = container_of(work, struct cx25821_dev,
308 _audio_work_entry);
310 if (!dev) {
311 pr_err("ERROR %s(): since container_of(work_struct) FAILED!\n",
312 __func__);
313 return;
316 cx25821_get_audio_data(dev, dev->channels[dev->_audio_upstream_channel].
317 sram_channels);
320 static int cx25821_openfile_audio(struct cx25821_dev *dev,
321 const struct sram_channel *sram_ch)
323 char *p = (void *)dev->_audiodata_buf_virt_addr;
324 struct file *file;
325 loff_t offset;
326 int i, j;
328 file = filp_open(dev->_audiofilename, O_RDONLY | O_LARGEFILE, 0);
329 if (IS_ERR(file)) {
330 pr_err("%s(): ERROR opening file(%s) with errno = %ld!\n",
331 __func__, dev->_audiofilename, PTR_ERR(file));
332 return PTR_ERR(file);
335 for (j = 0, offset = 0; j < NUM_AUDIO_FRAMES; j++) {
336 for (i = 0; i < dev->_audio_lines_count; i++) {
337 char buf[AUDIO_LINE_SIZE];
338 int n = kernel_read(file, offset, buf,
339 AUDIO_LINE_SIZE);
341 if (n < AUDIO_LINE_SIZE) {
342 pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
343 __func__);
344 dev->_audiofile_status = END_OF_FILE;
345 fput(file);
346 return 0;
349 if (p)
350 memcpy(p + offset, buf, n);
352 offset += n;
354 dev->_audioframe_count++;
356 dev->_audiofile_status = IN_PROGRESS;
357 fput(file);
358 return 0;
361 static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev,
362 const struct sram_channel *sram_ch,
363 int bpl)
365 int ret = 0;
366 dma_addr_t dma_addr;
367 dma_addr_t data_dma_addr;
369 cx25821_free_memory_audio(dev);
371 dev->_risc_virt_addr = pci_alloc_consistent(dev->pci,
372 dev->audio_upstream_riscbuf_size, &dma_addr);
373 dev->_risc_virt_start_addr = dev->_risc_virt_addr;
374 dev->_risc_phys_start_addr = dma_addr;
375 dev->_risc_phys_addr = dma_addr;
376 dev->_audiorisc_size = dev->audio_upstream_riscbuf_size;
378 if (!dev->_risc_virt_addr) {
379 printk(KERN_DEBUG
380 pr_fmt("ERROR: pci_alloc_consistent() FAILED to allocate memory for RISC program! Returning\n"));
381 return -ENOMEM;
383 /* Clear out memory at address */
384 memset(dev->_risc_virt_addr, 0, dev->_audiorisc_size);
386 /* For Audio Data buffer allocation */
387 dev->_audiodata_buf_virt_addr = pci_alloc_consistent(dev->pci,
388 dev->audio_upstream_databuf_size, &data_dma_addr);
389 dev->_audiodata_buf_phys_addr = data_dma_addr;
390 dev->_audiodata_buf_size = dev->audio_upstream_databuf_size;
392 if (!dev->_audiodata_buf_virt_addr) {
393 printk(KERN_DEBUG
394 pr_fmt("ERROR: pci_alloc_consistent() FAILED to allocate memory for data buffer! Returning\n"));
395 return -ENOMEM;
397 /* Clear out memory at address */
398 memset(dev->_audiodata_buf_virt_addr, 0, dev->_audiodata_buf_size);
400 ret = cx25821_openfile_audio(dev, sram_ch);
401 if (ret < 0)
402 return ret;
404 /* Creating RISC programs */
405 ret = cx25821_risc_buffer_upstream_audio(dev, dev->pci, bpl,
406 dev->_audio_lines_count);
407 if (ret < 0) {
408 printk(KERN_DEBUG
409 pr_fmt("ERROR creating audio upstream RISC programs!\n"));
410 goto error;
413 return 0;
415 error:
416 return ret;
419 static int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num,
420 u32 status)
422 int i = 0;
423 u32 int_msk_tmp;
424 const struct sram_channel *channel = dev->channels[chan_num].sram_channels;
425 dma_addr_t risc_phys_jump_addr;
426 __le32 *rp;
428 if (status & FLD_AUD_SRC_RISCI1) {
429 /* Get interrupt_index of the program that interrupted */
430 u32 prog_cnt = cx_read(channel->gpcnt);
432 /* Since we've identified our IRQ, clear our bits from the
433 * interrupt mask and interrupt status registers */
434 cx_write(channel->int_msk, 0);
435 cx_write(channel->int_stat, cx_read(channel->int_stat));
437 spin_lock(&dev->slock);
439 while (prog_cnt != dev->_last_index_irq) {
440 /* Update _last_index_irq */
441 if (dev->_last_index_irq < (NUMBER_OF_PROGRAMS - 1))
442 dev->_last_index_irq++;
443 else
444 dev->_last_index_irq = 0;
446 dev->_audioframe_index = dev->_last_index_irq;
448 schedule_work(&dev->_audio_work_entry);
451 if (dev->_is_first_audio_frame) {
452 dev->_is_first_audio_frame = 0;
454 if (dev->_risc_virt_start_addr != NULL) {
455 risc_phys_jump_addr =
456 dev->_risc_phys_start_addr +
457 RISC_SYNC_INSTRUCTION_SIZE +
458 AUDIO_RISC_DMA_BUF_SIZE;
460 rp = cx25821_risc_field_upstream_audio(dev,
461 dev->_risc_virt_start_addr + 1,
462 dev->_audiodata_buf_phys_addr,
463 AUDIO_LINE_SIZE, FIFO_DISABLE);
465 if (USE_RISC_NOOP_AUDIO) {
466 for (i = 0; i < NUM_NO_OPS; i++) {
467 *(rp++) =
468 cpu_to_le32(RISC_NOOP);
471 /* Jump to 2nd Audio Frame */
472 *(rp++) = cpu_to_le32(RISC_JUMP | RISC_IRQ1 |
473 RISC_CNT_RESET);
474 *(rp++) = cpu_to_le32(risc_phys_jump_addr);
475 *(rp++) = cpu_to_le32(0);
479 spin_unlock(&dev->slock);
480 } else {
481 if (status & FLD_AUD_SRC_OF)
482 pr_warn("%s(): Audio Received Overflow Error Interrupt!\n",
483 __func__);
485 if (status & FLD_AUD_SRC_SYNC)
486 pr_warn("%s(): Audio Received Sync Error Interrupt!\n",
487 __func__);
489 if (status & FLD_AUD_SRC_OPC_ERR)
490 pr_warn("%s(): Audio Received OpCode Error Interrupt!\n",
491 __func__);
493 /* Read and write back the interrupt status register to clear
494 * our bits */
495 cx_write(channel->int_stat, cx_read(channel->int_stat));
498 if (dev->_audiofile_status == END_OF_FILE) {
499 pr_warn("EOF Channel Audio Framecount = %d\n",
500 dev->_audioframe_count);
501 return -1;
503 /* ElSE, set the interrupt mask register, re-enable irq. */
504 int_msk_tmp = cx_read(channel->int_msk);
505 cx_write(channel->int_msk, int_msk_tmp |= _intr_msk);
507 return 0;
510 static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id)
512 struct cx25821_dev *dev = dev_id;
513 u32 audio_status;
514 int handled = 0;
515 const struct sram_channel *sram_ch;
517 if (!dev)
518 return -1;
520 sram_ch = dev->channels[dev->_audio_upstream_channel].sram_channels;
522 audio_status = cx_read(sram_ch->int_stat);
524 /* Only deal with our interrupt */
525 if (audio_status) {
526 handled = cx25821_audio_upstream_irq(dev,
527 dev->_audio_upstream_channel, audio_status);
530 if (handled < 0)
531 cx25821_stop_upstream_audio(dev);
532 else
533 handled += handled;
535 return IRQ_RETVAL(handled);
538 static void cx25821_wait_fifo_enable(struct cx25821_dev *dev,
539 const struct sram_channel *sram_ch)
541 int count = 0;
542 u32 tmp;
544 do {
545 /* Wait 10 microsecond before checking to see if the FIFO is
546 * turned ON. */
547 udelay(10);
549 tmp = cx_read(sram_ch->dma_ctl);
551 /* 10 millisecond timeout */
552 if (count++ > 1000) {
553 pr_err("ERROR: %s() fifo is NOT turned on. Timeout!\n",
554 __func__);
555 return;
558 } while (!(tmp & sram_ch->fld_aud_fifo_en));
562 static int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev,
563 const struct sram_channel *sram_ch)
565 u32 tmp = 0;
566 int err = 0;
568 /* Set the physical start address of the RISC program in the initial
569 * program counter(IPC) member of the CMDS. */
570 cx_write(sram_ch->cmds_start + 0, dev->_risc_phys_addr);
571 /* Risc IPC High 64 bits 63-32 */
572 cx_write(sram_ch->cmds_start + 4, 0);
574 /* reset counter */
575 cx_write(sram_ch->gpcnt_ctl, 3);
577 /* Set the line length (It looks like we do not need to set the
578 * line length) */
579 cx_write(sram_ch->aud_length, AUDIO_LINE_SIZE & FLD_AUD_DST_LN_LNGTH);
581 /* Set the input mode to 16-bit */
582 tmp = cx_read(sram_ch->aud_cfg);
583 tmp |= FLD_AUD_SRC_ENABLE | FLD_AUD_DST_PK_MODE | FLD_AUD_CLK_ENABLE |
584 FLD_AUD_MASTER_MODE | FLD_AUD_CLK_SELECT_PLL_D |
585 FLD_AUD_SONY_MODE;
586 cx_write(sram_ch->aud_cfg, tmp);
588 /* Read and write back the interrupt status register to clear it */
589 tmp = cx_read(sram_ch->int_stat);
590 cx_write(sram_ch->int_stat, tmp);
592 /* Clear our bits from the interrupt status register. */
593 cx_write(sram_ch->int_stat, _intr_msk);
595 /* Set the interrupt mask register, enable irq. */
596 cx_set(PCI_INT_MSK, cx_read(PCI_INT_MSK) | (1 << sram_ch->irq_bit));
597 tmp = cx_read(sram_ch->int_msk);
598 cx_write(sram_ch->int_msk, tmp |= _intr_msk);
600 err = request_irq(dev->pci->irq, cx25821_upstream_irq_audio,
601 IRQF_SHARED, dev->name, dev);
602 if (err < 0) {
603 pr_err("%s: can't get upstream IRQ %d\n", dev->name,
604 dev->pci->irq);
605 goto fail_irq;
608 /* Start the DMA engine */
609 tmp = cx_read(sram_ch->dma_ctl);
610 cx_set(sram_ch->dma_ctl, tmp | sram_ch->fld_aud_risc_en);
612 dev->_audio_is_running = 1;
613 dev->_is_first_audio_frame = 1;
615 /* The fifo_en bit turns on by the first Risc program */
616 cx25821_wait_fifo_enable(dev, sram_ch);
618 return 0;
620 fail_irq:
621 cx25821_dev_unregister(dev);
622 return err;
625 int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
627 const struct sram_channel *sram_ch;
628 int err = 0;
630 if (dev->_audio_is_running) {
631 pr_warn("Audio Channel is still running so return!\n");
632 return 0;
635 dev->_audio_upstream_channel = channel_select;
636 sram_ch = dev->channels[channel_select].sram_channels;
638 /* Work queue */
639 INIT_WORK(&dev->_audio_work_entry, cx25821_audioups_handler);
641 dev->_last_index_irq = 0;
642 dev->_audio_is_running = 0;
643 dev->_audioframe_count = 0;
644 dev->_audiofile_status = RESET_STATUS;
645 dev->_audio_lines_count = LINES_PER_AUDIO_BUFFER;
646 _line_size = AUDIO_LINE_SIZE;
648 if ((dev->input_audiofilename) &&
649 (strcmp(dev->input_audiofilename, "") != 0))
650 dev->_audiofilename = kstrdup(dev->input_audiofilename,
651 GFP_KERNEL);
652 else
653 dev->_audiofilename = kstrdup(_defaultAudioName,
654 GFP_KERNEL);
656 if (!dev->_audiofilename) {
657 err = -ENOMEM;
658 goto error;
661 cx25821_sram_channel_setup_upstream_audio(dev, sram_ch,
662 _line_size, 0);
664 dev->audio_upstream_riscbuf_size =
665 AUDIO_RISC_DMA_BUF_SIZE * NUM_AUDIO_PROGS +
666 RISC_SYNC_INSTRUCTION_SIZE;
667 dev->audio_upstream_databuf_size = AUDIO_DATA_BUF_SZ * NUM_AUDIO_PROGS;
669 /* Allocating buffers and prepare RISC program */
670 err = cx25821_audio_upstream_buffer_prepare(dev, sram_ch,
671 _line_size);
672 if (err < 0) {
673 pr_err("%s: Failed to set up Audio upstream buffers!\n",
674 dev->name);
675 goto error;
677 /* Start RISC engine */
678 cx25821_start_audio_dma_upstream(dev, sram_ch);
680 return 0;
682 error:
683 cx25821_dev_unregister(dev);
685 return err;