V4L/DVB: cx25821-audio-upstream.c: Fixed some checkpatch.pl warnings/errors
This patch fixes up some warnings&errors found by the checkpatch.pl script Signed-off-by: Olimpiu Pascariu <olimpiu.pascariu@gmail.com> CC: Palash Bandyopadhyay <palash.bandyopadhyay@conexant.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
@@ -33,7 +33,7 @@
|
|||||||
#include <linux/fcntl.h>
|
#include <linux/fcntl.h>
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <asm/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
|
|
||||||
MODULE_DESCRIPTION("v4l2 driver module for cx25821 based TV cards");
|
MODULE_DESCRIPTION("v4l2 driver module for cx25821 based TV cards");
|
||||||
MODULE_AUTHOR("Hiep Huynh <hiep.huynh@conexant.com>");
|
MODULE_AUTHOR("Hiep Huynh <hiep.huynh@conexant.com>");
|
||||||
@@ -62,9 +62,8 @@ int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev,
|
|||||||
cdt = ch->cdt;
|
cdt = ch->cdt;
|
||||||
lines = ch->fifo_size / bpl;
|
lines = ch->fifo_size / bpl;
|
||||||
|
|
||||||
if (lines > 3) {
|
if (lines > 3)
|
||||||
lines = 3;
|
lines = 3;
|
||||||
}
|
|
||||||
|
|
||||||
BUG_ON(lines < 2);
|
BUG_ON(lines < 2);
|
||||||
|
|
||||||
@@ -84,7 +83,7 @@ int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev,
|
|||||||
cx_write(ch->cmds_start + 12, AUDIO_CDT_SIZE_QW);
|
cx_write(ch->cmds_start + 12, AUDIO_CDT_SIZE_QW);
|
||||||
cx_write(ch->cmds_start + 16, ch->ctrl_start);
|
cx_write(ch->cmds_start + 16, ch->ctrl_start);
|
||||||
|
|
||||||
//IQ size
|
/* IQ size */
|
||||||
cx_write(ch->cmds_start + 20, AUDIO_IQ_SIZE_DW);
|
cx_write(ch->cmds_start + 20, AUDIO_IQ_SIZE_DW);
|
||||||
|
|
||||||
for (i = 24; i < 80; i += 4)
|
for (i = 24; i < 80; i += 4)
|
||||||
@@ -100,7 +99,7 @@ int cx25821_sram_channel_setup_upstream_audio(struct cx25821_dev *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev,
|
static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev,
|
||||||
__le32 * rp,
|
__le32 *rp,
|
||||||
dma_addr_t databuf_phys_addr,
|
dma_addr_t databuf_phys_addr,
|
||||||
unsigned int bpl,
|
unsigned int bpl,
|
||||||
int fifo_enable)
|
int fifo_enable)
|
||||||
@@ -116,8 +115,10 @@ static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev,
|
|||||||
*(rp++) = cpu_to_le32(databuf_phys_addr + offset);
|
*(rp++) = cpu_to_le32(databuf_phys_addr + offset);
|
||||||
*(rp++) = cpu_to_le32(0); /* bits 63-32 */
|
*(rp++) = cpu_to_le32(0); /* bits 63-32 */
|
||||||
|
|
||||||
// Check if we need to enable the FIFO after the first 3 lines
|
/* Check if we need to enable the FIFO
|
||||||
// For the upstream audio channel, the risc engine will enable the FIFO.
|
* after the first 3 lines.
|
||||||
|
* For the upstream audio channel,
|
||||||
|
* the risc engine will enable the FIFO */
|
||||||
if (fifo_enable && line == 2) {
|
if (fifo_enable && line == 2) {
|
||||||
*(rp++) = RISC_WRITECR;
|
*(rp++) = RISC_WRITECR;
|
||||||
*(rp++) = sram_ch->dma_ctl;
|
*(rp++) = sram_ch->dma_ctl;
|
||||||
@@ -160,7 +161,7 @@ int cx25821_risc_buffer_upstream_audio(struct cx25821_dev *dev,
|
|||||||
risc_flag = RISC_CNT_INC;
|
risc_flag = RISC_CNT_INC;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Calculate physical jump address
|
/* Calculate physical jump address */
|
||||||
if ((frame + 1) == NUM_AUDIO_FRAMES) {
|
if ((frame + 1) == NUM_AUDIO_FRAMES) {
|
||||||
risc_phys_jump_addr =
|
risc_phys_jump_addr =
|
||||||
dev->_risc_phys_start_addr +
|
dev->_risc_phys_start_addr +
|
||||||
@@ -179,17 +180,17 @@ int cx25821_risc_buffer_upstream_audio(struct cx25821_dev *dev,
|
|||||||
fifo_enable);
|
fifo_enable);
|
||||||
|
|
||||||
if (USE_RISC_NOOP_AUDIO) {
|
if (USE_RISC_NOOP_AUDIO) {
|
||||||
for (i = 0; i < NUM_NO_OPS; i++) {
|
for (i = 0; i < NUM_NO_OPS; i++)
|
||||||
*(rp++) = cpu_to_le32(RISC_NOOP);
|
*(rp++) = cpu_to_le32(RISC_NOOP);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Loop to (Nth)FrameRISC or to Start of Risc program & generate IRQ
|
/* Loop to (Nth)FrameRISC or to Start of Risc program &
|
||||||
|
* generate IRQ */
|
||||||
*(rp++) = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | risc_flag);
|
*(rp++) = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | risc_flag);
|
||||||
*(rp++) = cpu_to_le32(risc_phys_jump_addr);
|
*(rp++) = cpu_to_le32(risc_phys_jump_addr);
|
||||||
*(rp++) = cpu_to_le32(0);
|
*(rp++) = cpu_to_le32(0);
|
||||||
|
|
||||||
//Recalculate virtual address based on frame index
|
/* Recalculate virtual address based on frame index */
|
||||||
rp = dev->_risc_virt_addr + RISC_SYNC_INSTRUCTION_SIZE / 4 +
|
rp = dev->_risc_virt_addr + RISC_SYNC_INSTRUCTION_SIZE / 4 +
|
||||||
(AUDIO_RISC_DMA_BUF_SIZE * (frame + 1) / 4);
|
(AUDIO_RISC_DMA_BUF_SIZE * (frame + 1) / 4);
|
||||||
}
|
}
|
||||||
@@ -220,19 +221,19 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev)
|
|||||||
u32 tmp = 0;
|
u32 tmp = 0;
|
||||||
|
|
||||||
if (!dev->_audio_is_running) {
|
if (!dev->_audio_is_running) {
|
||||||
printk
|
printk(KERN_DEBUG
|
||||||
("cx25821: No audio file is currently running so return!\n");
|
"cx25821: No audio file is currently running so return!\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//Disable RISC interrupts
|
/* Disable RISC interrupts */
|
||||||
cx_write(sram_ch->int_msk, 0);
|
cx_write(sram_ch->int_msk, 0);
|
||||||
|
|
||||||
//Turn OFF risc and fifo enable in AUD_DMA_CNTRL
|
/* Turn OFF risc and fifo enable in AUD_DMA_CNTRL */
|
||||||
tmp = cx_read(sram_ch->dma_ctl);
|
tmp = cx_read(sram_ch->dma_ctl);
|
||||||
cx_write(sram_ch->dma_ctl,
|
cx_write(sram_ch->dma_ctl,
|
||||||
tmp & ~(sram_ch->fld_aud_fifo_en | sram_ch->fld_aud_risc_en));
|
tmp & ~(sram_ch->fld_aud_fifo_en | sram_ch->fld_aud_risc_en));
|
||||||
|
|
||||||
//Clear data buffer memory
|
/* Clear data buffer memory */
|
||||||
if (dev->_audiodata_buf_virt_addr)
|
if (dev->_audiodata_buf_virt_addr)
|
||||||
memset(dev->_audiodata_buf_virt_addr, 0,
|
memset(dev->_audiodata_buf_virt_addr, 0,
|
||||||
dev->_audiodata_buf_size);
|
dev->_audiodata_buf_size);
|
||||||
@@ -253,9 +254,8 @@ void cx25821_stop_upstream_audio(struct cx25821_dev *dev)
|
|||||||
|
|
||||||
void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev)
|
void cx25821_free_mem_upstream_audio(struct cx25821_dev *dev)
|
||||||
{
|
{
|
||||||
if (dev->_audio_is_running) {
|
if (dev->_audio_is_running)
|
||||||
cx25821_stop_upstream_audio(dev);
|
cx25821_stop_upstream_audio(dev);
|
||||||
}
|
|
||||||
|
|
||||||
cx25821_free_memory_audio(dev);
|
cx25821_free_memory_audio(dev);
|
||||||
}
|
}
|
||||||
@@ -282,7 +282,7 @@ int cx25821_get_audio_data(struct cx25821_dev *dev,
|
|||||||
|
|
||||||
if (IS_ERR(myfile)) {
|
if (IS_ERR(myfile)) {
|
||||||
const int open_errno = -PTR_ERR(myfile);
|
const int open_errno = -PTR_ERR(myfile);
|
||||||
printk("%s(): ERROR opening file(%s) with errno = %d! \n",
|
printk(KERN_ERR "%s(): ERROR opening file(%s) with errno = %d!\n",
|
||||||
__func__, dev->_audiofilename, open_errno);
|
__func__, dev->_audiofilename, open_errno);
|
||||||
return PTR_ERR(myfile);
|
return PTR_ERR(myfile);
|
||||||
} else {
|
} else {
|
||||||
@@ -294,7 +294,7 @@ int cx25821_get_audio_data(struct cx25821_dev *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!myfile->f_op->read) {
|
if (!myfile->f_op->read) {
|
||||||
printk("%s: File has no READ operations registered! \n",
|
printk("%s: File has no READ operations registered!\n",
|
||||||
__func__);
|
__func__);
|
||||||
filp_close(myfile, NULL);
|
filp_close(myfile, NULL);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
@@ -347,7 +347,7 @@ static void cx25821_audioups_handler(struct work_struct *work)
|
|||||||
container_of(work, struct cx25821_dev, _audio_work_entry);
|
container_of(work, struct cx25821_dev, _audio_work_entry);
|
||||||
|
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
printk("ERROR %s(): since container_of(work_struct) FAILED! \n",
|
printk(KERN_ERR "ERROR %s(): since container_of(work_struct) FAILED!\n",
|
||||||
__func__);
|
__func__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -373,19 +373,19 @@ int cx25821_openfile_audio(struct cx25821_dev *dev,
|
|||||||
|
|
||||||
if (IS_ERR(myfile)) {
|
if (IS_ERR(myfile)) {
|
||||||
const int open_errno = -PTR_ERR(myfile);
|
const int open_errno = -PTR_ERR(myfile);
|
||||||
printk("%s(): ERROR opening file(%s) with errno = %d! \n",
|
printk(KERN_ERR "%s(): ERROR opening file(%s) with errno = %d!\n",
|
||||||
__func__, dev->_audiofilename, open_errno);
|
__func__, dev->_audiofilename, open_errno);
|
||||||
return PTR_ERR(myfile);
|
return PTR_ERR(myfile);
|
||||||
} else {
|
} else {
|
||||||
if (!(myfile->f_op)) {
|
if (!(myfile->f_op)) {
|
||||||
printk("%s: File has no file operations registered! \n",
|
printk("%s: File has no file operations registered!\n",
|
||||||
__func__);
|
__func__);
|
||||||
filp_close(myfile, NULL);
|
filp_close(myfile, NULL);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!myfile->f_op->read) {
|
if (!myfile->f_op->read) {
|
||||||
printk("%s: File has no READ operations registered! \n",
|
printk("%s: File has no READ operations registered!\n",
|
||||||
__func__);
|
__func__);
|
||||||
filp_close(myfile, NULL);
|
filp_close(myfile, NULL);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
@@ -421,13 +421,11 @@ int cx25821_openfile_audio(struct cx25821_dev *dev,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0)
|
||||||
dev->_audioframe_count++;
|
dev->_audioframe_count++;
|
||||||
}
|
|
||||||
|
|
||||||
if (vfs_read_retval < line_size) {
|
if (vfs_read_retval < line_size)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dev->_audiofile_status =
|
dev->_audiofile_status =
|
||||||
@@ -460,14 +458,14 @@ static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev,
|
|||||||
dev->_audiorisc_size = dev->audio_upstream_riscbuf_size;
|
dev->_audiorisc_size = dev->audio_upstream_riscbuf_size;
|
||||||
|
|
||||||
if (!dev->_risc_virt_addr) {
|
if (!dev->_risc_virt_addr) {
|
||||||
printk
|
printk(KERN_DEBUG
|
||||||
("cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for RISC program! Returning.\n");
|
"cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for RISC program! Returning.\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
//Clear out memory at address
|
/* Clear out memory at address */
|
||||||
memset(dev->_risc_virt_addr, 0, dev->_audiorisc_size);
|
memset(dev->_risc_virt_addr, 0, dev->_audiorisc_size);
|
||||||
|
|
||||||
//For Audio Data buffer allocation
|
/* For Audio Data buffer allocation */
|
||||||
dev->_audiodata_buf_virt_addr =
|
dev->_audiodata_buf_virt_addr =
|
||||||
pci_alloc_consistent(dev->pci, dev->audio_upstream_databuf_size,
|
pci_alloc_consistent(dev->pci, dev->audio_upstream_databuf_size,
|
||||||
&data_dma_addr);
|
&data_dma_addr);
|
||||||
@@ -475,30 +473,30 @@ static int cx25821_audio_upstream_buffer_prepare(struct cx25821_dev *dev,
|
|||||||
dev->_audiodata_buf_size = dev->audio_upstream_databuf_size;
|
dev->_audiodata_buf_size = dev->audio_upstream_databuf_size;
|
||||||
|
|
||||||
if (!dev->_audiodata_buf_virt_addr) {
|
if (!dev->_audiodata_buf_virt_addr) {
|
||||||
printk
|
printk(KERN_DEBUG
|
||||||
("cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for data buffer! Returning. \n");
|
"cx25821 ERROR: pci_alloc_consistent() FAILED to allocate memory for data buffer! Returning.\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
//Clear out memory at address
|
/* Clear out memory at address */
|
||||||
memset(dev->_audiodata_buf_virt_addr, 0, dev->_audiodata_buf_size);
|
memset(dev->_audiodata_buf_virt_addr, 0, dev->_audiodata_buf_size);
|
||||||
|
|
||||||
ret = cx25821_openfile_audio(dev, sram_ch);
|
ret = cx25821_openfile_audio(dev, sram_ch);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
//Creating RISC programs
|
/* Creating RISC programs */
|
||||||
ret =
|
ret =
|
||||||
cx25821_risc_buffer_upstream_audio(dev, dev->pci, bpl,
|
cx25821_risc_buffer_upstream_audio(dev, dev->pci, bpl,
|
||||||
dev->_audio_lines_count);
|
dev->_audio_lines_count);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printk(KERN_DEBUG
|
printk(KERN_DEBUG
|
||||||
"cx25821 ERROR creating audio upstream RISC programs! \n");
|
"cx25821 ERROR creating audio upstream RISC programs!\n");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -512,22 +510,22 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num,
|
|||||||
__le32 *rp;
|
__le32 *rp;
|
||||||
|
|
||||||
if (status & FLD_AUD_SRC_RISCI1) {
|
if (status & FLD_AUD_SRC_RISCI1) {
|
||||||
//Get interrupt_index of the program that interrupted
|
/* Get interrupt_index of the program that interrupted */
|
||||||
u32 prog_cnt = cx_read(channel->gpcnt);
|
u32 prog_cnt = cx_read(channel->gpcnt);
|
||||||
|
|
||||||
//Since we've identified our IRQ, clear our bits from the interrupt mask and interrupt status registers
|
/* Since we've identified our IRQ, clear our bits from the
|
||||||
|
* interrupt mask and interrupt status registers */
|
||||||
cx_write(channel->int_msk, 0);
|
cx_write(channel->int_msk, 0);
|
||||||
cx_write(channel->int_stat, cx_read(channel->int_stat));
|
cx_write(channel->int_stat, cx_read(channel->int_stat));
|
||||||
|
|
||||||
spin_lock(&dev->slock);
|
spin_lock(&dev->slock);
|
||||||
|
|
||||||
while (prog_cnt != dev->_last_index_irq) {
|
while (prog_cnt != dev->_last_index_irq) {
|
||||||
//Update _last_index_irq
|
/* Update _last_index_irq */
|
||||||
if (dev->_last_index_irq < (NUMBER_OF_PROGRAMS - 1)) {
|
if (dev->_last_index_irq < (NUMBER_OF_PROGRAMS - 1))
|
||||||
dev->_last_index_irq++;
|
dev->_last_index_irq++;
|
||||||
} else {
|
else
|
||||||
dev->_last_index_irq = 0;
|
dev->_last_index_irq = 0;
|
||||||
}
|
|
||||||
|
|
||||||
dev->_audioframe_index = dev->_last_index_irq;
|
dev->_audioframe_index = dev->_last_index_irq;
|
||||||
|
|
||||||
@@ -559,7 +557,7 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num,
|
|||||||
cpu_to_le32(RISC_NOOP);
|
cpu_to_le32(RISC_NOOP);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Jump to 2nd Audio Frame
|
/* Jump to 2nd Audio Frame */
|
||||||
*(rp++) =
|
*(rp++) =
|
||||||
cpu_to_le32(RISC_JUMP | RISC_IRQ1 |
|
cpu_to_le32(RISC_JUMP | RISC_IRQ1 |
|
||||||
RISC_CNT_RESET);
|
RISC_CNT_RESET);
|
||||||
@@ -582,7 +580,8 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num,
|
|||||||
printk("%s: Audio Received OpCode Error Interrupt!\n",
|
printk("%s: Audio Received OpCode Error Interrupt!\n",
|
||||||
__func__);
|
__func__);
|
||||||
|
|
||||||
// Read and write back the interrupt status register to clear our bits
|
/* Read and write back the interrupt status register to clear
|
||||||
|
* our bits */
|
||||||
cx_write(channel->int_stat, cx_read(channel->int_stat));
|
cx_write(channel->int_stat, cx_read(channel->int_stat));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -591,7 +590,7 @@ int cx25821_audio_upstream_irq(struct cx25821_dev *dev, int chan_num,
|
|||||||
dev->_audioframe_count);
|
dev->_audioframe_count);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//ElSE, set the interrupt mask register, re-enable irq.
|
/* ElSE, set the interrupt mask register, re-enable irq. */
|
||||||
int_msk_tmp = cx_read(channel->int_msk);
|
int_msk_tmp = cx_read(channel->int_msk);
|
||||||
cx_write(channel->int_msk, int_msk_tmp |= _intr_msk);
|
cx_write(channel->int_msk, int_msk_tmp |= _intr_msk);
|
||||||
|
|
||||||
@@ -613,7 +612,7 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id)
|
|||||||
msk_stat = cx_read(sram_ch->int_mstat);
|
msk_stat = cx_read(sram_ch->int_mstat);
|
||||||
audio_status = cx_read(sram_ch->int_stat);
|
audio_status = cx_read(sram_ch->int_stat);
|
||||||
|
|
||||||
// Only deal with our interrupt
|
/* Only deal with our interrupt */
|
||||||
if (audio_status) {
|
if (audio_status) {
|
||||||
handled =
|
handled =
|
||||||
cx25821_audio_upstream_irq(dev,
|
cx25821_audio_upstream_irq(dev,
|
||||||
@@ -622,11 +621,10 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id)
|
|||||||
audio_status);
|
audio_status);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handled < 0) {
|
if (handled < 0)
|
||||||
cx25821_stop_upstream_audio(dev);
|
cx25821_stop_upstream_audio(dev);
|
||||||
} else {
|
else
|
||||||
handled += handled;
|
handled += handled;
|
||||||
}
|
|
||||||
|
|
||||||
return IRQ_RETVAL(handled);
|
return IRQ_RETVAL(handled);
|
||||||
}
|
}
|
||||||
@@ -638,13 +636,14 @@ static void cx25821_wait_fifo_enable(struct cx25821_dev *dev,
|
|||||||
u32 tmp;
|
u32 tmp;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
//Wait 10 microsecond before checking to see if the FIFO is turned ON.
|
/* Wait 10 microsecond before checking to see if the FIFO is
|
||||||
|
* turned ON. */
|
||||||
udelay(10);
|
udelay(10);
|
||||||
|
|
||||||
tmp = cx_read(sram_ch->dma_ctl);
|
tmp = cx_read(sram_ch->dma_ctl);
|
||||||
|
|
||||||
if (count++ > 1000) //10 millisecond timeout
|
/* 10 millisecond timeout */
|
||||||
{
|
if (count++ > 1000) {
|
||||||
printk
|
printk
|
||||||
("cx25821 ERROR: %s() fifo is NOT turned on. Timeout!\n",
|
("cx25821 ERROR: %s() fifo is NOT turned on. Timeout!\n",
|
||||||
__func__);
|
__func__);
|
||||||
@@ -661,31 +660,34 @@ int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev,
|
|||||||
u32 tmp = 0;
|
u32 tmp = 0;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
// Set the physical start address of the RISC program in the initial program counter(IPC) member of the CMDS.
|
/* Set the physical start address of the RISC program in the initial
|
||||||
|
* program counter(IPC) member of the CMDS. */
|
||||||
cx_write(sram_ch->cmds_start + 0, dev->_risc_phys_addr);
|
cx_write(sram_ch->cmds_start + 0, dev->_risc_phys_addr);
|
||||||
cx_write(sram_ch->cmds_start + 4, 0); /* Risc IPC High 64 bits 63-32 */
|
/* Risc IPC High 64 bits 63-32 */
|
||||||
|
cx_write(sram_ch->cmds_start + 4, 0);
|
||||||
|
|
||||||
/* reset counter */
|
/* reset counter */
|
||||||
cx_write(sram_ch->gpcnt_ctl, 3);
|
cx_write(sram_ch->gpcnt_ctl, 3);
|
||||||
|
|
||||||
//Set the line length (It looks like we do not need to set the line length)
|
/* Set the line length (It looks like we do not need to set the
|
||||||
|
* line length) */
|
||||||
cx_write(sram_ch->aud_length, AUDIO_LINE_SIZE & FLD_AUD_DST_LN_LNGTH);
|
cx_write(sram_ch->aud_length, AUDIO_LINE_SIZE & FLD_AUD_DST_LN_LNGTH);
|
||||||
|
|
||||||
//Set the input mode to 16-bit
|
/* Set the input mode to 16-bit */
|
||||||
tmp = cx_read(sram_ch->aud_cfg);
|
tmp = cx_read(sram_ch->aud_cfg);
|
||||||
tmp |=
|
tmp |=
|
||||||
FLD_AUD_SRC_ENABLE | FLD_AUD_DST_PK_MODE | FLD_AUD_CLK_ENABLE |
|
FLD_AUD_SRC_ENABLE | FLD_AUD_DST_PK_MODE | FLD_AUD_CLK_ENABLE |
|
||||||
FLD_AUD_MASTER_MODE | FLD_AUD_CLK_SELECT_PLL_D | FLD_AUD_SONY_MODE;
|
FLD_AUD_MASTER_MODE | FLD_AUD_CLK_SELECT_PLL_D | FLD_AUD_SONY_MODE;
|
||||||
cx_write(sram_ch->aud_cfg, tmp);
|
cx_write(sram_ch->aud_cfg, tmp);
|
||||||
|
|
||||||
// Read and write back the interrupt status register to clear it
|
/* Read and write back the interrupt status register to clear it */
|
||||||
tmp = cx_read(sram_ch->int_stat);
|
tmp = cx_read(sram_ch->int_stat);
|
||||||
cx_write(sram_ch->int_stat, tmp);
|
cx_write(sram_ch->int_stat, tmp);
|
||||||
|
|
||||||
// Clear our bits from the interrupt status register.
|
/* Clear our bits from the interrupt status register. */
|
||||||
cx_write(sram_ch->int_stat, _intr_msk);
|
cx_write(sram_ch->int_stat, _intr_msk);
|
||||||
|
|
||||||
//Set the interrupt mask register, enable irq.
|
/* Set the interrupt mask register, enable irq. */
|
||||||
cx_set(PCI_INT_MSK, cx_read(PCI_INT_MSK) | (1 << sram_ch->irq_bit));
|
cx_set(PCI_INT_MSK, cx_read(PCI_INT_MSK) | (1 << sram_ch->irq_bit));
|
||||||
tmp = cx_read(sram_ch->int_msk);
|
tmp = cx_read(sram_ch->int_msk);
|
||||||
cx_write(sram_ch->int_msk, tmp |= _intr_msk);
|
cx_write(sram_ch->int_msk, tmp |= _intr_msk);
|
||||||
@@ -699,19 +701,19 @@ int cx25821_start_audio_dma_upstream(struct cx25821_dev *dev,
|
|||||||
goto fail_irq;
|
goto fail_irq;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start the DMA engine
|
/* Start the DMA engine */
|
||||||
tmp = cx_read(sram_ch->dma_ctl);
|
tmp = cx_read(sram_ch->dma_ctl);
|
||||||
cx_set(sram_ch->dma_ctl, tmp | sram_ch->fld_aud_risc_en);
|
cx_set(sram_ch->dma_ctl, tmp | sram_ch->fld_aud_risc_en);
|
||||||
|
|
||||||
dev->_audio_is_running = 1;
|
dev->_audio_is_running = 1;
|
||||||
dev->_is_first_audio_frame = 1;
|
dev->_is_first_audio_frame = 1;
|
||||||
|
|
||||||
// The fifo_en bit turns on by the first Risc program
|
/* The fifo_en bit turns on by the first Risc program */
|
||||||
cx25821_wait_fifo_enable(dev, sram_ch);
|
cx25821_wait_fifo_enable(dev, sram_ch);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail_irq:
|
fail_irq:
|
||||||
cx25821_dev_unregister(dev);
|
cx25821_dev_unregister(dev);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@@ -731,14 +733,14 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
|
|||||||
dev->_audio_upstream_channel_select = channel_select;
|
dev->_audio_upstream_channel_select = channel_select;
|
||||||
sram_ch = &dev->sram_channels[channel_select];
|
sram_ch = &dev->sram_channels[channel_select];
|
||||||
|
|
||||||
//Work queue
|
/* Work queue */
|
||||||
INIT_WORK(&dev->_audio_work_entry, cx25821_audioups_handler);
|
INIT_WORK(&dev->_audio_work_entry, cx25821_audioups_handler);
|
||||||
dev->_irq_audio_queues =
|
dev->_irq_audio_queues =
|
||||||
create_singlethread_workqueue("cx25821_audioworkqueue");
|
create_singlethread_workqueue("cx25821_audioworkqueue");
|
||||||
|
|
||||||
if (!dev->_irq_audio_queues) {
|
if (!dev->_irq_audio_queues) {
|
||||||
printk
|
printk(KERN_DEBUG
|
||||||
("cx25821 ERROR: create_singlethread_workqueue() for Audio FAILED!\n");
|
"cx25821 ERROR: create_singlethread_workqueue() for Audio FAILED!\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -760,7 +762,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
|
|||||||
memcpy(dev->_audiofilename, dev->input_audiofilename,
|
memcpy(dev->_audiofilename, dev->input_audiofilename,
|
||||||
str_length + 1);
|
str_length + 1);
|
||||||
|
|
||||||
//Default if filename is empty string
|
/* Default if filename is empty string */
|
||||||
if (strcmp(dev->input_audiofilename, "") == 0) {
|
if (strcmp(dev->input_audiofilename, "") == 0) {
|
||||||
dev->_audiofilename = "/root/audioGOOD.wav";
|
dev->_audiofilename = "/root/audioGOOD.wav";
|
||||||
}
|
}
|
||||||
@@ -784,7 +786,7 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
|
|||||||
RISC_SYNC_INSTRUCTION_SIZE;
|
RISC_SYNC_INSTRUCTION_SIZE;
|
||||||
dev->audio_upstream_databuf_size = AUDIO_DATA_BUF_SZ * NUM_AUDIO_PROGS;
|
dev->audio_upstream_databuf_size = AUDIO_DATA_BUF_SZ * NUM_AUDIO_PROGS;
|
||||||
|
|
||||||
//Allocating buffers and prepare RISC program
|
/* Allocating buffers and prepare RISC program */
|
||||||
retval =
|
retval =
|
||||||
cx25821_audio_upstream_buffer_prepare(dev, sram_ch, _line_size);
|
cx25821_audio_upstream_buffer_prepare(dev, sram_ch, _line_size);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
@@ -793,12 +795,12 @@ int cx25821_audio_upstream_init(struct cx25821_dev *dev, int channel_select)
|
|||||||
dev->name);
|
dev->name);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
//Start RISC engine
|
/* Start RISC engine */
|
||||||
cx25821_start_audio_dma_upstream(dev, sram_ch);
|
cx25821_start_audio_dma_upstream(dev, sram_ch);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
cx25821_dev_unregister(dev);
|
cx25821_dev_unregister(dev);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
|
Reference in New Issue
Block a user