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 #include "cx25821-video.h"
24 #include "cx25821-audio-upstream.h"
27 #include <linux/errno.h>
28 #include <linux/kernel.h>
29 #include <linux/init.h>
30 #include <linux/module.h>
31 #include <linux/syscalls.h>
32 #include <linux/file.h>
33 #include <linux/fcntl.h>
34 #include <linux/delay.h>
35 #include <linux/slab.h>
36 #include <linux/uaccess.h>
38 MODULE_DESCRIPTION("v4l2 driver module for cx25821 based TV cards");
39 MODULE_AUTHOR("Hiep Huynh <hiep.huynh@conexant.com>");
40 MODULE_LICENSE("GPL");
42 static int _intr_msk
=
43 FLD_AUD_SRC_RISCI1
| FLD_AUD_SRC_OF
| FLD_AUD_SRC_SYNC
|
46 int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev
*dev
,
47 struct sram_channel
*ch
,
48 unsigned int bpl
, u32 risc
)
50 unsigned int i
, lines
;
53 if (ch
->cmds_start
== 0) {
54 cx_write(ch
->ptr1_reg
, 0);
55 cx_write(ch
->ptr2_reg
, 0);
56 cx_write(ch
->cnt2_reg
, 0);
57 cx_write(ch
->cnt1_reg
, 0);
61 bpl
= (bpl
+ 7) & ~7; /* alignment */
63 lines
= ch
->fifo_size
/ bpl
;
71 for (i
= 0; i
< lines
; i
++) {
72 cx_write(cdt
+ 16 * i
, ch
->fifo_start
+ bpl
* i
);
73 cx_write(cdt
+ 16 * i
+ 4, 0);
74 cx_write(cdt
+ 16 * i
+ 8, 0);
75 cx_write(cdt
+ 16 * i
+ 12, 0);
79 cx_write(ch
->cmds_start
+ 0, risc
);
81 cx_write(ch
->cmds_start
+ 4, 0);
82 cx_write(ch
->cmds_start
+ 8, cdt
);
83 cx_write(ch
->cmds_start
+ 12, AUDIO_CDT_SIZE_QW
);
84 cx_write(ch
->cmds_start
+ 16, ch
->ctrl_start
);
87 cx_write(ch
->cmds_start
+ 20, AUDIO_IQ_SIZE_DW
);
89 for (i
= 24; i
< 80; i
+= 4)
90 cx_write(ch
->cmds_start
+ i
, 0);
93 cx_write(ch
->ptr1_reg
, ch
->fifo_start
);
94 cx_write(ch
->ptr2_reg
, cdt
);
95 cx_write(ch
->cnt2_reg
, AUDIO_CDT_SIZE_QW
);
96 cx_write(ch
->cnt1_reg
, AUDIO_CLUSTER_SIZE_QW
- 1);
101 static __le32
*cx25821_risc_field_upstream_audio(struct cx25821_dev
*dev
,
103 dma_addr_t databuf_phys_addr
,
108 struct sram_channel
*sram_ch
=
109 &dev
->sram_channels
[dev
->_audio_upstream_channel_select
];
113 for (line
= 0; line
< LINES_PER_AUDIO_BUFFER
; line
++) {
114 *(rp
++) = cpu_to_le32(RISC_READ
| RISC_SOL
| RISC_EOL
| bpl
);
115 *(rp
++) = cpu_to_le32(databuf_phys_addr
+ offset
);
116 *(rp
++) = cpu_to_le32(0); /* bits 63-32 */
118 /* Check if we need to enable the FIFO
119 * after the first 3 lines.
120 * For the upstream audio channel,
121 * the risc engine will enable the FIFO */
122 if (fifo_enable
&& line
== 2) {
123 *(rp
++) = RISC_WRITECR
;
124 *(rp
++) = sram_ch
->dma_ctl
;
125 *(rp
++) = sram_ch
->fld_aud_fifo_en
;
126 *(rp
++) = 0x00000020;
129 offset
+= AUDIO_LINE_SIZE
;
135 int cx25821_risc_buffer_upstream_audio(struct cx25821_dev
*dev
,
137 unsigned int bpl
, unsigned int lines
)
141 int frame
= 0, i
= 0;
142 int frame_size
= AUDIO_DATA_BUF_SZ
;
143 int databuf_offset
= 0;
144 int risc_flag
= RISC_CNT_INC
;
145 dma_addr_t risc_phys_jump_addr
;
147 /* Virtual address of Risc buffer program */
148 rp
= dev
->_risc_virt_addr
;
150 /* sync instruction */
151 *(rp
++) = cpu_to_le32(RISC_RESYNC
| AUDIO_SYNC_LINE
);
153 for (frame
= 0; frame
< NUM_AUDIO_FRAMES
; frame
++) {
154 databuf_offset
= frame_size
* frame
;
158 risc_flag
= RISC_CNT_RESET
;
161 risc_flag
= RISC_CNT_INC
;
164 /* Calculate physical jump address */
165 if ((frame
+ 1) == NUM_AUDIO_FRAMES
) {
166 risc_phys_jump_addr
=
167 dev
->_risc_phys_start_addr
+
168 RISC_SYNC_INSTRUCTION_SIZE
;
170 risc_phys_jump_addr
=
171 dev
->_risc_phys_start_addr
+
172 RISC_SYNC_INSTRUCTION_SIZE
+
173 AUDIO_RISC_DMA_BUF_SIZE
* (frame
+ 1);
176 rp
= cx25821_risc_field_upstream_audio(dev
, rp
,
178 _audiodata_buf_phys_addr
179 + databuf_offset
, bpl
,
182 if (USE_RISC_NOOP_AUDIO
) {
183 for (i
= 0; i
< NUM_NO_OPS
; i
++)
184 *(rp
++) = cpu_to_le32(RISC_NOOP
);
187 /* Loop to (Nth)FrameRISC or to Start of Risc program &
189 *(rp
++) = cpu_to_le32(RISC_JUMP
| RISC_IRQ1
| risc_flag
);
190 *(rp
++) = cpu_to_le32(risc_phys_jump_addr
);
191 *(rp
++) = cpu_to_le32(0);
193 /* Recalculate virtual address based on frame index */
194 rp
= dev
->_risc_virt_addr
+ RISC_SYNC_INSTRUCTION_SIZE
/ 4 +
195 (AUDIO_RISC_DMA_BUF_SIZE
* (frame
+ 1) / 4);
201 void cx25821_free_memory_audio(struct cx25821_dev
*dev
)
203 if (dev
->_risc_virt_addr
) {
204 pci_free_consistent(dev
->pci
, dev
->_audiorisc_size
,
205 dev
->_risc_virt_addr
, dev
->_risc_phys_addr
);
206 dev
->_risc_virt_addr
= NULL
;
209 if (dev
->_audiodata_buf_virt_addr
) {
210 pci_free_consistent(dev
->pci
, dev
->_audiodata_buf_size
,
211 dev
->_audiodata_buf_virt_addr
,
212 dev
->_audiodata_buf_phys_addr
);
213 dev
->_audiodata_buf_virt_addr
= NULL
;
217 void cx25821_stop_upstream_audio(struct cx25821_dev
*dev
)
219 struct sram_channel
*sram_ch
=
220 &dev
->sram_channels
[AUDIO_UPSTREAM_SRAM_CHANNEL_B
];
223 if (!dev
->_audio_is_running
) {
225 "cx25821: No audio file is currently running so return!\n");
228 /* Disable RISC interrupts */
229 cx_write(sram_ch
->int_msk
, 0);
231 /* Turn OFF risc and fifo enable in AUD_DMA_CNTRL */
232 tmp
= cx_read(sram_ch
->dma_ctl
);
233 cx_write(sram_ch
->dma_ctl
,
234 tmp
& ~(sram_ch
->fld_aud_fifo_en
| sram_ch
->fld_aud_risc_en
));
236 /* Clear data buffer memory */
237 if (dev
->_audiodata_buf_virt_addr
)
238 memset(dev
->_audiodata_buf_virt_addr
, 0,
239 dev
->_audiodata_buf_size
);
241 dev
->_audio_is_running
= 0;
242 dev
->_is_first_audio_frame
= 0;
243 dev
->_audioframe_count
= 0;
244 dev
->_audiofile_status
= END_OF_FILE
;
246 if (dev
->_irq_audio_queues
) {
247 kfree(dev
->_irq_audio_queues
);
248 dev
->_irq_audio_queues
= NULL
;
251 if (dev
->_audiofilename
!= NULL
)
252 kfree(dev
->_audiofilename
);
255 void cx25821_free_mem_upstream_audio(struct cx25821_dev
*dev
)
257 if (dev
->_audio_is_running
)
258 cx25821_stop_upstream_audio(dev
);
260 cx25821_free_memory_audio(dev
);
263 int cx25821_get_audio_data(struct cx25821_dev
*dev
,
264 struct sram_channel
*sram_ch
)
267 int frame_index_temp
= dev
->_audioframe_index
;
269 int line_size
= AUDIO_LINE_SIZE
;
270 int frame_size
= AUDIO_DATA_BUF_SZ
;
271 int frame_offset
= frame_size
* frame_index_temp
;
272 ssize_t vfs_read_retval
= 0;
273 char mybuf
[line_size
];
274 loff_t file_offset
= dev
->_audioframe_count
* frame_size
;
278 if (dev
->_audiofile_status
== END_OF_FILE
)
281 myfile
= filp_open(dev
->_audiofilename
, O_RDONLY
| O_LARGEFILE
, 0);
283 if (IS_ERR(myfile
)) {
284 const int open_errno
= -PTR_ERR(myfile
);
285 printk(KERN_ERR
"%s(): ERROR opening file(%s) with errno = %d!\n",
286 __func__
, dev
->_audiofilename
, open_errno
);
287 return PTR_ERR(myfile
);
289 if (!(myfile
->f_op
)) {
290 printk("%s: File has no file operations registered!\n",
292 filp_close(myfile
, NULL
);
296 if (!myfile
->f_op
->read
) {
297 printk("%s: File has no READ operations registered!\n",
299 filp_close(myfile
, NULL
);
307 for (i
= 0; i
< dev
->_audio_lines_count
; i
++) {
311 vfs_read(myfile
, mybuf
, line_size
, &pos
);
313 if (vfs_read_retval
> 0 && vfs_read_retval
== line_size
314 && dev
->_audiodata_buf_virt_addr
!= NULL
) {
315 memcpy((void *)(dev
->_audiodata_buf_virt_addr
+
316 frame_offset
/ 4), mybuf
,
320 file_offset
+= vfs_read_retval
;
321 frame_offset
+= vfs_read_retval
;
323 if (vfs_read_retval
< line_size
) {
325 "Done: exit %s() since no more bytes to read from Audio file.\n",
332 dev
->_audioframe_count
++;
334 dev
->_audiofile_status
=
335 (vfs_read_retval
== line_size
) ? IN_PROGRESS
: END_OF_FILE
;
338 filp_close(myfile
, NULL
);
344 static void cx25821_audioups_handler(struct work_struct
*work
)
346 struct cx25821_dev
*dev
=
347 container_of(work
, struct cx25821_dev
, _audio_work_entry
);
350 printk(KERN_ERR
"ERROR %s(): since container_of(work_struct) FAILED!\n",
355 cx25821_get_audio_data(dev
,
356 &dev
->sram_channels
[dev
->
357 _audio_upstream_channel_select
]);
360 int cx25821_openfile_audio(struct cx25821_dev
*dev
,
361 struct sram_channel
*sram_ch
)
365 int line_size
= AUDIO_LINE_SIZE
;
366 ssize_t vfs_read_retval
= 0;
367 char mybuf
[line_size
];
369 loff_t offset
= (unsigned long)0;
372 myfile
= filp_open(dev
->_audiofilename
, O_RDONLY
| O_LARGEFILE
, 0);
374 if (IS_ERR(myfile
)) {
375 const int open_errno
= -PTR_ERR(myfile
);
376 printk(KERN_ERR
"%s(): ERROR opening file(%s) with errno = %d!\n",
377 __func__
, dev
->_audiofilename
, open_errno
);
378 return PTR_ERR(myfile
);
380 if (!(myfile
->f_op
)) {
381 printk("%s: File has no file operations registered!\n",
383 filp_close(myfile
, NULL
);
387 if (!myfile
->f_op
->read
) {
388 printk("%s: File has no READ operations registered!\n",
390 filp_close(myfile
, NULL
);
398 for (j
= 0; j
< NUM_AUDIO_FRAMES
; j
++) {
399 for (i
= 0; i
< dev
->_audio_lines_count
; i
++) {
403 vfs_read(myfile
, mybuf
, line_size
, &pos
);
405 if (vfs_read_retval
> 0
406 && vfs_read_retval
== line_size
407 && dev
->_audiodata_buf_virt_addr
!= NULL
) {
408 memcpy((void *)(dev
->
409 _audiodata_buf_virt_addr
410 + offset
/ 4), mybuf
,
414 offset
+= vfs_read_retval
;
416 if (vfs_read_retval
< line_size
) {
418 "Done: exit %s() since no more bytes to read from Audio file.\n",
425 dev
->_audioframe_count
++;
427 if (vfs_read_retval
< line_size
)
431 dev
->_audiofile_status
=
432 (vfs_read_retval
== line_size
) ? IN_PROGRESS
: END_OF_FILE
;
436 filp_close(myfile
, NULL
);
442 static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev
*dev
,
443 struct sram_channel
*sram_ch
,
448 dma_addr_t data_dma_addr
;
450 cx25821_free_memory_audio(dev
);
452 dev
->_risc_virt_addr
=
453 pci_alloc_consistent(dev
->pci
, dev
->audio_upstream_riscbuf_size
,
455 dev
->_risc_virt_start_addr
= dev
->_risc_virt_addr
;
456 dev
->_risc_phys_start_addr
= dma_addr
;
457 dev
->_risc_phys_addr
= dma_addr
;
458 dev
->_audiorisc_size
= dev
->audio_upstream_riscbuf_size
;
460 if (!dev
->_risc_virt_addr
) {
462 "cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for RISC program! Returning.\n");
465 /* Clear out memory at address */
466 memset(dev
->_risc_virt_addr
, 0, dev
->_audiorisc_size
);
468 /* For Audio Data buffer allocation */
469 dev
->_audiodata_buf_virt_addr
=
470 pci_alloc_consistent(dev
->pci
, dev
->audio_upstream_databuf_size
,
472 dev
->_audiodata_buf_phys_addr
= data_dma_addr
;
473 dev
->_audiodata_buf_size
= dev
->audio_upstream_databuf_size
;
475 if (!dev
->_audiodata_buf_virt_addr
) {
477 "cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for data buffer! Returning.\n");
480 /* Clear out memory at address */
481 memset(dev
->_audiodata_buf_virt_addr
, 0, dev
->_audiodata_buf_size
);
483 ret
= cx25821_openfile_audio(dev
, sram_ch
);
487 /* Creating RISC programs */
489 cx25821_risc_buffer_upstream_audio(dev
, dev
->pci
, bpl
,
490 dev
->_audio_lines_count
);
493 "cx25821 ERROR creating audio upstream RISC programs!\n");
503 int cx25821_audio_upstream_irq(struct cx25821_dev
*dev
, int chan_num
,
508 struct sram_channel
*channel
= &dev
->sram_channels
[chan_num
];
509 dma_addr_t risc_phys_jump_addr
;
512 if (status
& FLD_AUD_SRC_RISCI1
) {
513 /* Get interrupt_index of the program that interrupted */
514 u32 prog_cnt
= cx_read(channel
->gpcnt
);
516 /* Since we've identified our IRQ, clear our bits from the
517 * interrupt mask and interrupt status registers */
518 cx_write(channel
->int_msk
, 0);
519 cx_write(channel
->int_stat
, cx_read(channel
->int_stat
));
521 spin_lock(&dev
->slock
);
523 while (prog_cnt
!= dev
->_last_index_irq
) {
524 /* Update _last_index_irq */
525 if (dev
->_last_index_irq
< (NUMBER_OF_PROGRAMS
- 1))
526 dev
->_last_index_irq
++;
528 dev
->_last_index_irq
= 0;
530 dev
->_audioframe_index
= dev
->_last_index_irq
;
532 queue_work(dev
->_irq_audio_queues
,
533 &dev
->_audio_work_entry
);
536 if (dev
->_is_first_audio_frame
) {
537 dev
->_is_first_audio_frame
= 0;
539 if (dev
->_risc_virt_start_addr
!= NULL
) {
540 risc_phys_jump_addr
=
541 dev
->_risc_phys_start_addr
+
542 RISC_SYNC_INSTRUCTION_SIZE
+
543 AUDIO_RISC_DMA_BUF_SIZE
;
545 rp
= cx25821_risc_field_upstream_audio(dev
,
547 _risc_virt_start_addr
550 _audiodata_buf_phys_addr
,
554 if (USE_RISC_NOOP_AUDIO
) {
555 for (i
= 0; i
< NUM_NO_OPS
; i
++) {
557 cpu_to_le32(RISC_NOOP
);
560 /* Jump to 2nd Audio Frame */
562 cpu_to_le32(RISC_JUMP
| RISC_IRQ1
|
564 *(rp
++) = cpu_to_le32(risc_phys_jump_addr
);
565 *(rp
++) = cpu_to_le32(0);
569 spin_unlock(&dev
->slock
);
571 if (status
& FLD_AUD_SRC_OF
)
572 printk("%s: Audio Received Overflow Error Interrupt!\n",
575 if (status
& FLD_AUD_SRC_SYNC
)
576 printk("%s: Audio Received Sync Error Interrupt!\n",
579 if (status
& FLD_AUD_SRC_OPC_ERR
)
580 printk("%s: Audio Received OpCode Error Interrupt!\n",
583 /* Read and write back the interrupt status register to clear
585 cx_write(channel
->int_stat
, cx_read(channel
->int_stat
));
588 if (dev
->_audiofile_status
== END_OF_FILE
) {
589 printk("cx25821: EOF Channel Audio Framecount = %d\n",
590 dev
->_audioframe_count
);
593 /* ElSE, set the interrupt mask register, re-enable irq. */
594 int_msk_tmp
= cx_read(channel
->int_msk
);
595 cx_write(channel
->int_msk
, int_msk_tmp
|= _intr_msk
);
600 static irqreturn_t
cx25821_upstream_irq_audio(int irq
, void *dev_id
)
602 struct cx25821_dev
*dev
= dev_id
;
603 u32 msk_stat
, audio_status
;
605 struct sram_channel
*sram_ch
;
610 sram_ch
= &dev
->sram_channels
[dev
->_audio_upstream_channel_select
];
612 msk_stat
= cx_read(sram_ch
->int_mstat
);
613 audio_status
= cx_read(sram_ch
->int_stat
);
615 /* Only deal with our interrupt */
618 cx25821_audio_upstream_irq(dev
,
620 _audio_upstream_channel_select
,
625 cx25821_stop_upstream_audio(dev
);
629 return IRQ_RETVAL(handled
);
632 static void cx25821_wait_fifo_enable(struct cx25821_dev
*dev
,
633 struct sram_channel
*sram_ch
)
639 /* Wait 10 microsecond before checking to see if the FIFO is
643 tmp
= cx_read(sram_ch
->dma_ctl
);
645 /* 10 millisecond timeout */
646 if (count
++ > 1000) {
648 ("cx25821 ERROR: %s() fifo is NOT turned on. Timeout!\n",
653 } while (!(tmp
& sram_ch
->fld_aud_fifo_en
));
657 int cx25821_start_audio_dma_upstream(struct cx25821_dev
*dev
,
658 struct sram_channel
*sram_ch
)
663 /* Set the physical start address of the RISC program in the initial
664 * program counter(IPC) member of the CMDS. */
665 cx_write(sram_ch
->cmds_start
+ 0, dev
->_risc_phys_addr
);
666 /* Risc IPC High 64 bits 63-32 */
667 cx_write(sram_ch
->cmds_start
+ 4, 0);
670 cx_write(sram_ch
->gpcnt_ctl
, 3);
672 /* Set the line length (It looks like we do not need to set the
674 cx_write(sram_ch
->aud_length
, AUDIO_LINE_SIZE
& FLD_AUD_DST_LN_LNGTH
);
676 /* Set the input mode to 16-bit */
677 tmp
= cx_read(sram_ch
->aud_cfg
);
679 FLD_AUD_SRC_ENABLE
| FLD_AUD_DST_PK_MODE
| FLD_AUD_CLK_ENABLE
|
680 FLD_AUD_MASTER_MODE
| FLD_AUD_CLK_SELECT_PLL_D
| FLD_AUD_SONY_MODE
;
681 cx_write(sram_ch
->aud_cfg
, tmp
);
683 /* Read and write back the interrupt status register to clear it */
684 tmp
= cx_read(sram_ch
->int_stat
);
685 cx_write(sram_ch
->int_stat
, tmp
);
687 /* Clear our bits from the interrupt status register. */
688 cx_write(sram_ch
->int_stat
, _intr_msk
);
690 /* Set the interrupt mask register, enable irq. */
691 cx_set(PCI_INT_MSK
, cx_read(PCI_INT_MSK
) | (1 << sram_ch
->irq_bit
));
692 tmp
= cx_read(sram_ch
->int_msk
);
693 cx_write(sram_ch
->int_msk
, tmp
|= _intr_msk
);
696 request_irq(dev
->pci
->irq
, cx25821_upstream_irq_audio
,
697 IRQF_SHARED
| IRQF_DISABLED
, dev
->name
, dev
);
699 printk(KERN_ERR
"%s: can't get upstream IRQ %d\n", dev
->name
,
704 /* Start the DMA engine */
705 tmp
= cx_read(sram_ch
->dma_ctl
);
706 cx_set(sram_ch
->dma_ctl
, tmp
| sram_ch
->fld_aud_risc_en
);
708 dev
->_audio_is_running
= 1;
709 dev
->_is_first_audio_frame
= 1;
711 /* The fifo_en bit turns on by the first Risc program */
712 cx25821_wait_fifo_enable(dev
, sram_ch
);
717 cx25821_dev_unregister(dev
);
721 int cx25821_audio_upstream_init(struct cx25821_dev
*dev
, int channel_select
)
723 struct sram_channel
*sram_ch
;
728 if (dev
->_audio_is_running
) {
729 printk("Audio Channel is still running so return!\n");
733 dev
->_audio_upstream_channel_select
= channel_select
;
734 sram_ch
= &dev
->sram_channels
[channel_select
];
737 INIT_WORK(&dev
->_audio_work_entry
, cx25821_audioups_handler
);
738 dev
->_irq_audio_queues
=
739 create_singlethread_workqueue("cx25821_audioworkqueue");
741 if (!dev
->_irq_audio_queues
) {
743 "cx25821 ERROR: create_singlethread_workqueue() for Audio FAILED!\n");
747 dev
->_last_index_irq
= 0;
748 dev
->_audio_is_running
= 0;
749 dev
->_audioframe_count
= 0;
750 dev
->_audiofile_status
= RESET_STATUS
;
751 dev
->_audio_lines_count
= LINES_PER_AUDIO_BUFFER
;
752 _line_size
= AUDIO_LINE_SIZE
;
754 if (dev
->input_audiofilename
) {
755 str_length
= strlen(dev
->input_audiofilename
);
756 dev
->_audiofilename
= kmalloc(str_length
+ 1, GFP_KERNEL
);
758 if (!dev
->_audiofilename
)
761 memcpy(dev
->_audiofilename
, dev
->input_audiofilename
,
764 /* Default if filename is empty string */
765 if (strcmp(dev
->input_audiofilename
, "") == 0) {
766 dev
->_audiofilename
= "/root/audioGOOD.wav";
769 str_length
= strlen(_defaultAudioName
);
770 dev
->_audiofilename
= kmalloc(str_length
+ 1, GFP_KERNEL
);
772 if (!dev
->_audiofilename
)
775 memcpy(dev
->_audiofilename
, _defaultAudioName
, str_length
+ 1);
779 cx25821_sram_channel_setup_upstream_audio(dev
, sram_ch
, _line_size
,
782 dev
->audio_upstream_riscbuf_size
=
783 AUDIO_RISC_DMA_BUF_SIZE
* NUM_AUDIO_PROGS
+
784 RISC_SYNC_INSTRUCTION_SIZE
;
785 dev
->audio_upstream_databuf_size
= AUDIO_DATA_BUF_SZ
* NUM_AUDIO_PROGS
;
787 /* Allocating buffers and prepare RISC program */
789 cx25821_audio_upstream_buffer_prepare(dev
, sram_ch
, _line_size
);
792 "%s: Failed to set up Audio upstream buffers!\n",
796 /* Start RISC engine */
797 cx25821_start_audio_dma_upstream(dev
, sram_ch
);
802 cx25821_dev_unregister(dev
);