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"
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 int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev
*dev
,
48 struct sram_channel
*ch
,
49 unsigned int bpl
, u32 risc
)
51 unsigned int i
, lines
;
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);
62 bpl
= (bpl
+ 7) & ~7; /* alignment */
64 lines
= ch
->fifo_size
/ bpl
;
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);
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
);
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);
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);
102 static __le32
*cx25821_risc_field_upstream_audio(struct cx25821_dev
*dev
,
104 dma_addr_t databuf_phys_addr
,
109 struct sram_channel
*sram_ch
=
110 dev
->channels
[dev
->_audio_upstream_channel
].sram_channels
;
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
;
136 int cx25821_risc_buffer_upstream_audio(struct cx25821_dev
*dev
,
138 unsigned int bpl
, unsigned int lines
)
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
;
159 risc_flag
= RISC_CNT_RESET
;
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
;
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
,
179 _audiodata_buf_phys_addr
180 + databuf_offset
, bpl
,
183 if (USE_RISC_NOOP_AUDIO
) {
184 for (i
= 0; i
< NUM_NO_OPS
; i
++)
185 *(rp
++) = cpu_to_le32(RISC_NOOP
);
188 /* Loop to (Nth)FrameRISC or to Start of Risc program &
190 *(rp
++) = cpu_to_le32(RISC_JUMP
| RISC_IRQ1
| risc_flag
);
191 *(rp
++) = cpu_to_le32(risc_phys_jump_addr
);
192 *(rp
++) = cpu_to_le32(0);
194 /* Recalculate virtual address based on frame index */
195 rp
= dev
->_risc_virt_addr
+ RISC_SYNC_INSTRUCTION_SIZE
/ 4 +
196 (AUDIO_RISC_DMA_BUF_SIZE
* (frame
+ 1) / 4);
202 void cx25821_free_memory_audio(struct cx25821_dev
*dev
)
204 if (dev
->_risc_virt_addr
) {
205 pci_free_consistent(dev
->pci
, dev
->_audiorisc_size
,
206 dev
->_risc_virt_addr
, dev
->_risc_phys_addr
);
207 dev
->_risc_virt_addr
= NULL
;
210 if (dev
->_audiodata_buf_virt_addr
) {
211 pci_free_consistent(dev
->pci
, dev
->_audiodata_buf_size
,
212 dev
->_audiodata_buf_virt_addr
,
213 dev
->_audiodata_buf_phys_addr
);
214 dev
->_audiodata_buf_virt_addr
= NULL
;
218 void cx25821_stop_upstream_audio(struct cx25821_dev
*dev
)
220 struct sram_channel
*sram_ch
=
221 dev
->channels
[AUDIO_UPSTREAM_SRAM_CHANNEL_B
].sram_channels
;
224 if (!dev
->_audio_is_running
) {
226 pr_fmt("No audio file is currently running so return!\n"));
229 /* Disable RISC interrupts */
230 cx_write(sram_ch
->int_msk
, 0);
232 /* Turn OFF risc and fifo enable in AUD_DMA_CNTRL */
233 tmp
= cx_read(sram_ch
->dma_ctl
);
234 cx_write(sram_ch
->dma_ctl
,
235 tmp
& ~(sram_ch
->fld_aud_fifo_en
| sram_ch
->fld_aud_risc_en
));
237 /* Clear data buffer memory */
238 if (dev
->_audiodata_buf_virt_addr
)
239 memset(dev
->_audiodata_buf_virt_addr
, 0,
240 dev
->_audiodata_buf_size
);
242 dev
->_audio_is_running
= 0;
243 dev
->_is_first_audio_frame
= 0;
244 dev
->_audioframe_count
= 0;
245 dev
->_audiofile_status
= END_OF_FILE
;
247 kfree(dev
->_irq_audio_queues
);
248 dev
->_irq_audio_queues
= NULL
;
250 kfree(dev
->_audiofilename
);
253 void cx25821_free_mem_upstream_audio(struct cx25821_dev
*dev
)
255 if (dev
->_audio_is_running
)
256 cx25821_stop_upstream_audio(dev
);
258 cx25821_free_memory_audio(dev
);
261 int cx25821_get_audio_data(struct cx25821_dev
*dev
,
262 struct sram_channel
*sram_ch
)
265 int frame_index_temp
= dev
->_audioframe_index
;
267 int line_size
= AUDIO_LINE_SIZE
;
268 int frame_size
= AUDIO_DATA_BUF_SZ
;
269 int frame_offset
= frame_size
* frame_index_temp
;
270 ssize_t vfs_read_retval
= 0;
271 char mybuf
[line_size
];
272 loff_t file_offset
= dev
->_audioframe_count
* frame_size
;
276 if (dev
->_audiofile_status
== END_OF_FILE
)
279 myfile
= filp_open(dev
->_audiofilename
, O_RDONLY
| O_LARGEFILE
, 0);
281 if (IS_ERR(myfile
)) {
282 const int open_errno
= -PTR_ERR(myfile
);
283 pr_err("%s(): ERROR opening file(%s) with errno = %d!\n",
284 __func__
, dev
->_audiofilename
, open_errno
);
285 return PTR_ERR(myfile
);
287 if (!(myfile
->f_op
)) {
288 pr_err("%s(): File has no file operations registered!\n",
290 filp_close(myfile
, NULL
);
294 if (!myfile
->f_op
->read
) {
295 pr_err("%s(): File has no READ operations registered!\n",
297 filp_close(myfile
, NULL
);
305 for (i
= 0; i
< dev
->_audio_lines_count
; i
++) {
309 vfs_read(myfile
, mybuf
, line_size
, &pos
);
311 if (vfs_read_retval
> 0 && vfs_read_retval
== line_size
312 && dev
->_audiodata_buf_virt_addr
!= NULL
) {
313 memcpy((void *)(dev
->_audiodata_buf_virt_addr
+
314 frame_offset
/ 4), mybuf
,
318 file_offset
+= vfs_read_retval
;
319 frame_offset
+= vfs_read_retval
;
321 if (vfs_read_retval
< line_size
) {
322 pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
329 dev
->_audioframe_count
++;
331 dev
->_audiofile_status
=
332 (vfs_read_retval
== line_size
) ? IN_PROGRESS
: END_OF_FILE
;
335 filp_close(myfile
, NULL
);
341 static void cx25821_audioups_handler(struct work_struct
*work
)
343 struct cx25821_dev
*dev
=
344 container_of(work
, struct cx25821_dev
, _audio_work_entry
);
347 pr_err("ERROR %s(): since container_of(work_struct) FAILED!\n",
352 cx25821_get_audio_data(dev
, dev
->channels
[dev
->_audio_upstream_channel
].
356 int cx25821_openfile_audio(struct cx25821_dev
*dev
,
357 struct sram_channel
*sram_ch
)
361 int line_size
= AUDIO_LINE_SIZE
;
362 ssize_t vfs_read_retval
= 0;
363 char mybuf
[line_size
];
365 loff_t offset
= (unsigned long)0;
368 myfile
= filp_open(dev
->_audiofilename
, O_RDONLY
| O_LARGEFILE
, 0);
370 if (IS_ERR(myfile
)) {
371 const int open_errno
= -PTR_ERR(myfile
);
372 pr_err("%s(): ERROR opening file(%s) with errno = %d!\n",
373 __func__
, dev
->_audiofilename
, open_errno
);
374 return PTR_ERR(myfile
);
376 if (!(myfile
->f_op
)) {
377 pr_err("%s(): File has no file operations registered!\n",
379 filp_close(myfile
, NULL
);
383 if (!myfile
->f_op
->read
) {
384 pr_err("%s(): File has no READ operations registered!\n",
386 filp_close(myfile
, NULL
);
394 for (j
= 0; j
< NUM_AUDIO_FRAMES
; j
++) {
395 for (i
= 0; i
< dev
->_audio_lines_count
; i
++) {
399 vfs_read(myfile
, mybuf
, line_size
, &pos
);
401 if (vfs_read_retval
> 0
402 && vfs_read_retval
== line_size
403 && dev
->_audiodata_buf_virt_addr
!= NULL
) {
404 memcpy((void *)(dev
->
405 _audiodata_buf_virt_addr
406 + offset
/ 4), mybuf
,
410 offset
+= vfs_read_retval
;
412 if (vfs_read_retval
< line_size
) {
413 pr_info("Done: exit %s() since no more bytes to read from Audio file\n",
420 dev
->_audioframe_count
++;
422 if (vfs_read_retval
< line_size
)
426 dev
->_audiofile_status
=
427 (vfs_read_retval
== line_size
) ? IN_PROGRESS
: END_OF_FILE
;
431 filp_close(myfile
, NULL
);
437 static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev
*dev
,
438 struct sram_channel
*sram_ch
,
443 dma_addr_t data_dma_addr
;
445 cx25821_free_memory_audio(dev
);
447 dev
->_risc_virt_addr
=
448 pci_alloc_consistent(dev
->pci
, dev
->audio_upstream_riscbuf_size
,
450 dev
->_risc_virt_start_addr
= dev
->_risc_virt_addr
;
451 dev
->_risc_phys_start_addr
= dma_addr
;
452 dev
->_risc_phys_addr
= dma_addr
;
453 dev
->_audiorisc_size
= dev
->audio_upstream_riscbuf_size
;
455 if (!dev
->_risc_virt_addr
) {
457 pr_fmt("ERROR: pci_alloc_consistent() FAILED to allocate memory for RISC program! Returning\n"));
460 /* Clear out memory at address */
461 memset(dev
->_risc_virt_addr
, 0, dev
->_audiorisc_size
);
463 /* For Audio Data buffer allocation */
464 dev
->_audiodata_buf_virt_addr
=
465 pci_alloc_consistent(dev
->pci
, dev
->audio_upstream_databuf_size
,
467 dev
->_audiodata_buf_phys_addr
= data_dma_addr
;
468 dev
->_audiodata_buf_size
= dev
->audio_upstream_databuf_size
;
470 if (!dev
->_audiodata_buf_virt_addr
) {
472 pr_fmt("ERROR: pci_alloc_consistent() FAILED to allocate memory for data buffer! Returning\n"));
475 /* Clear out memory at address */
476 memset(dev
->_audiodata_buf_virt_addr
, 0, dev
->_audiodata_buf_size
);
478 ret
= cx25821_openfile_audio(dev
, sram_ch
);
482 /* Creating RISC programs */
484 cx25821_risc_buffer_upstream_audio(dev
, dev
->pci
, bpl
,
485 dev
->_audio_lines_count
);
488 pr_fmt("ERROR creating audio upstream RISC programs!\n"));
498 int cx25821_audio_upstream_irq(struct cx25821_dev
*dev
, int chan_num
,
503 struct sram_channel
*channel
= dev
->channels
[chan_num
].sram_channels
;
504 dma_addr_t risc_phys_jump_addr
;
507 if (status
& FLD_AUD_SRC_RISCI1
) {
508 /* Get interrupt_index of the program that interrupted */
509 u32 prog_cnt
= cx_read(channel
->gpcnt
);
511 /* Since we've identified our IRQ, clear our bits from the
512 * interrupt mask and interrupt status registers */
513 cx_write(channel
->int_msk
, 0);
514 cx_write(channel
->int_stat
, cx_read(channel
->int_stat
));
516 spin_lock(&dev
->slock
);
518 while (prog_cnt
!= dev
->_last_index_irq
) {
519 /* Update _last_index_irq */
520 if (dev
->_last_index_irq
< (NUMBER_OF_PROGRAMS
- 1))
521 dev
->_last_index_irq
++;
523 dev
->_last_index_irq
= 0;
525 dev
->_audioframe_index
= dev
->_last_index_irq
;
527 queue_work(dev
->_irq_audio_queues
,
528 &dev
->_audio_work_entry
);
531 if (dev
->_is_first_audio_frame
) {
532 dev
->_is_first_audio_frame
= 0;
534 if (dev
->_risc_virt_start_addr
!= NULL
) {
535 risc_phys_jump_addr
=
536 dev
->_risc_phys_start_addr
+
537 RISC_SYNC_INSTRUCTION_SIZE
+
538 AUDIO_RISC_DMA_BUF_SIZE
;
540 rp
= cx25821_risc_field_upstream_audio(dev
,
541 dev
->_risc_virt_start_addr
+ 1,
542 dev
->_audiodata_buf_phys_addr
,
543 AUDIO_LINE_SIZE
, FIFO_DISABLE
);
545 if (USE_RISC_NOOP_AUDIO
) {
546 for (i
= 0; i
< NUM_NO_OPS
; i
++) {
548 cpu_to_le32(RISC_NOOP
);
551 /* Jump to 2nd Audio Frame */
552 *(rp
++) = cpu_to_le32(RISC_JUMP
| RISC_IRQ1
|
554 *(rp
++) = cpu_to_le32(risc_phys_jump_addr
);
555 *(rp
++) = cpu_to_le32(0);
559 spin_unlock(&dev
->slock
);
561 if (status
& FLD_AUD_SRC_OF
)
562 pr_warn("%s(): Audio Received Overflow Error Interrupt!\n",
565 if (status
& FLD_AUD_SRC_SYNC
)
566 pr_warn("%s(): Audio Received Sync Error Interrupt!\n",
569 if (status
& FLD_AUD_SRC_OPC_ERR
)
570 pr_warn("%s(): Audio Received OpCode Error Interrupt!\n",
573 /* Read and write back the interrupt status register to clear
575 cx_write(channel
->int_stat
, cx_read(channel
->int_stat
));
578 if (dev
->_audiofile_status
== END_OF_FILE
) {
579 pr_warn("EOF Channel Audio Framecount = %d\n",
580 dev
->_audioframe_count
);
583 /* ElSE, set the interrupt mask register, re-enable irq. */
584 int_msk_tmp
= cx_read(channel
->int_msk
);
585 cx_write(channel
->int_msk
, int_msk_tmp
|= _intr_msk
);
590 static irqreturn_t
cx25821_upstream_irq_audio(int irq
, void *dev_id
)
592 struct cx25821_dev
*dev
= dev_id
;
593 u32 msk_stat
, audio_status
;
595 struct sram_channel
*sram_ch
;
600 sram_ch
= dev
->channels
[dev
->_audio_upstream_channel
].sram_channels
;
602 msk_stat
= cx_read(sram_ch
->int_mstat
);
603 audio_status
= cx_read(sram_ch
->int_stat
);
605 /* Only deal with our interrupt */
607 handled
= cx25821_audio_upstream_irq(dev
,
608 dev
->_audio_upstream_channel
, audio_status
);
612 cx25821_stop_upstream_audio(dev
);
616 return IRQ_RETVAL(handled
);
619 static void cx25821_wait_fifo_enable(struct cx25821_dev
*dev
,
620 struct sram_channel
*sram_ch
)
626 /* Wait 10 microsecond before checking to see if the FIFO is
630 tmp
= cx_read(sram_ch
->dma_ctl
);
632 /* 10 millisecond timeout */
633 if (count
++ > 1000) {
634 pr_err("ERROR: %s() fifo is NOT turned on. Timeout!\n",
639 } while (!(tmp
& sram_ch
->fld_aud_fifo_en
));
643 int cx25821_start_audio_dma_upstream(struct cx25821_dev
*dev
,
644 struct sram_channel
*sram_ch
)
649 /* Set the physical start address of the RISC program in the initial
650 * program counter(IPC) member of the CMDS. */
651 cx_write(sram_ch
->cmds_start
+ 0, dev
->_risc_phys_addr
);
652 /* Risc IPC High 64 bits 63-32 */
653 cx_write(sram_ch
->cmds_start
+ 4, 0);
656 cx_write(sram_ch
->gpcnt_ctl
, 3);
658 /* Set the line length (It looks like we do not need to set the
660 cx_write(sram_ch
->aud_length
, AUDIO_LINE_SIZE
& FLD_AUD_DST_LN_LNGTH
);
662 /* Set the input mode to 16-bit */
663 tmp
= cx_read(sram_ch
->aud_cfg
);
665 FLD_AUD_SRC_ENABLE
| FLD_AUD_DST_PK_MODE
| FLD_AUD_CLK_ENABLE
|
666 FLD_AUD_MASTER_MODE
| FLD_AUD_CLK_SELECT_PLL_D
| FLD_AUD_SONY_MODE
;
667 cx_write(sram_ch
->aud_cfg
, tmp
);
669 /* Read and write back the interrupt status register to clear it */
670 tmp
= cx_read(sram_ch
->int_stat
);
671 cx_write(sram_ch
->int_stat
, tmp
);
673 /* Clear our bits from the interrupt status register. */
674 cx_write(sram_ch
->int_stat
, _intr_msk
);
676 /* Set the interrupt mask register, enable irq. */
677 cx_set(PCI_INT_MSK
, cx_read(PCI_INT_MSK
) | (1 << sram_ch
->irq_bit
));
678 tmp
= cx_read(sram_ch
->int_msk
);
679 cx_write(sram_ch
->int_msk
, tmp
|= _intr_msk
);
682 request_irq(dev
->pci
->irq
, cx25821_upstream_irq_audio
,
683 IRQF_SHARED
, dev
->name
, dev
);
685 pr_err("%s: can't get upstream IRQ %d\n",
686 dev
->name
, dev
->pci
->irq
);
690 /* Start the DMA engine */
691 tmp
= cx_read(sram_ch
->dma_ctl
);
692 cx_set(sram_ch
->dma_ctl
, tmp
| sram_ch
->fld_aud_risc_en
);
694 dev
->_audio_is_running
= 1;
695 dev
->_is_first_audio_frame
= 1;
697 /* The fifo_en bit turns on by the first Risc program */
698 cx25821_wait_fifo_enable(dev
, sram_ch
);
703 cx25821_dev_unregister(dev
);
707 int cx25821_audio_upstream_init(struct cx25821_dev
*dev
, int channel_select
)
709 struct sram_channel
*sram_ch
;
714 if (dev
->_audio_is_running
) {
715 pr_warn("Audio Channel is still running so return!\n");
719 dev
->_audio_upstream_channel
= channel_select
;
720 sram_ch
= dev
->channels
[channel_select
].sram_channels
;
723 INIT_WORK(&dev
->_audio_work_entry
, cx25821_audioups_handler
);
724 dev
->_irq_audio_queues
=
725 create_singlethread_workqueue("cx25821_audioworkqueue");
727 if (!dev
->_irq_audio_queues
) {
729 pr_fmt("ERROR: create_singlethread_workqueue() for Audio FAILED!\n"));
733 dev
->_last_index_irq
= 0;
734 dev
->_audio_is_running
= 0;
735 dev
->_audioframe_count
= 0;
736 dev
->_audiofile_status
= RESET_STATUS
;
737 dev
->_audio_lines_count
= LINES_PER_AUDIO_BUFFER
;
738 _line_size
= AUDIO_LINE_SIZE
;
740 if (dev
->input_audiofilename
) {
741 str_length
= strlen(dev
->input_audiofilename
);
742 dev
->_audiofilename
= kmalloc(str_length
+ 1, GFP_KERNEL
);
744 if (!dev
->_audiofilename
)
747 memcpy(dev
->_audiofilename
, dev
->input_audiofilename
,
750 /* Default if filename is empty string */
751 if (strcmp(dev
->input_audiofilename
, "") == 0)
752 dev
->_audiofilename
= "/root/audioGOOD.wav";
754 str_length
= strlen(_defaultAudioName
);
755 dev
->_audiofilename
= kmalloc(str_length
+ 1, GFP_KERNEL
);
757 if (!dev
->_audiofilename
)
760 memcpy(dev
->_audiofilename
, _defaultAudioName
, str_length
+ 1);
763 retval
= cx25821_sram_channel_setup_upstream_audio(dev
, sram_ch
,
766 dev
->audio_upstream_riscbuf_size
=
767 AUDIO_RISC_DMA_BUF_SIZE
* NUM_AUDIO_PROGS
+
768 RISC_SYNC_INSTRUCTION_SIZE
;
769 dev
->audio_upstream_databuf_size
= AUDIO_DATA_BUF_SZ
* NUM_AUDIO_PROGS
;
771 /* Allocating buffers and prepare RISC program */
772 retval
= cx25821_audio_upstream_buffer_prepare(dev
, sram_ch
,
775 pr_err("%s: Failed to set up Audio upstream buffers!\n",
779 /* Start RISC engine */
780 cx25821_start_audio_dma_upstream(dev
, sram_ch
);
785 cx25821_dev_unregister(dev
);