Commit 3e9442c6 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB: cx25821: Fix bad whitespacing

Should use tabs for identation, and not whitespace
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent e986bf1e
cx25821-objs := cx25821-core.o cx25821-cards.o cx25821-i2c.o \ cx25821-objs := cx25821-core.o cx25821-cards.o cx25821-i2c.o \
cx25821-gpio.o cx25821-medusa-video.o \ cx25821-gpio.o cx25821-medusa-video.o \
cx25821-video.o cx25821-video-upstream.o \ cx25821-video.o cx25821-video-upstream.o \
cx25821-video-upstream-ch2.o \ cx25821-video-upstream-ch2.o \
cx25821-audio-upstream.o cx25821-audio-upstream.o
obj-$(CONFIG_VIDEO_CX25821) += cx25821.o obj-$(CONFIG_VIDEO_CX25821) += cx25821.o
obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o
......
...@@ -106,7 +106,7 @@ static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev, ...@@ -106,7 +106,7 @@ static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev,
{ {
unsigned int line; unsigned int line;
struct sram_channel *sram_ch = struct sram_channel *sram_ch =
dev->channels[dev->_audio_upstream_channel_select].sram_channels; dev->channels[dev->_audio_upstream_channel_select].sram_channels;
int offset = 0; int offset = 0;
/* scan lines */ /* scan lines */
...@@ -217,7 +217,7 @@ void cx25821_free_memory_audio(struct cx25821_dev *dev) ...@@ -217,7 +217,7 @@ void cx25821_free_memory_audio(struct cx25821_dev *dev)
void cx25821_stop_upstream_audio(struct cx25821_dev *dev) void cx25821_stop_upstream_audio(struct cx25821_dev *dev)
{ {
struct sram_channel *sram_ch = struct sram_channel *sram_ch =
dev->channels[AUDIO_UPSTREAM_SRAM_CHANNEL_B].sram_channels; dev->channels[AUDIO_UPSTREAM_SRAM_CHANNEL_B].sram_channels;
u32 tmp = 0; u32 tmp = 0;
if (!dev->_audio_is_running) { if (!dev->_audio_is_running) {
...@@ -353,9 +353,9 @@ static void cx25821_audioups_handler(struct work_struct *work) ...@@ -353,9 +353,9 @@ static void cx25821_audioups_handler(struct work_struct *work)
} }
cx25821_get_audio_data(dev, cx25821_get_audio_data(dev,
dev->channels[dev-> dev->channels[dev->
_audio_upstream_channel_select]. _audio_upstream_channel_select].
sram_channels); sram_channels);
} }
int cx25821_openfile_audio(struct cx25821_dev *dev, int cx25821_openfile_audio(struct cx25821_dev *dev,
...@@ -609,7 +609,7 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id) ...@@ -609,7 +609,7 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id)
return -1; return -1;
sram_ch = dev->channels[dev->_audio_upstream_channel_select]. sram_ch = dev->channels[dev->_audio_upstream_channel_select].
sram_channels; sram_channels;
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);
......
...@@ -781,14 +781,14 @@ static void cx25821_shutdown(struct cx25821_dev *dev) ...@@ -781,14 +781,14 @@ static void cx25821_shutdown(struct cx25821_dev *dev)
/* Disable Video A/B activity */ /* Disable Video A/B activity */
for (i = 0; i < VID_CHANNEL_NUM; i++) { for (i = 0; i < VID_CHANNEL_NUM; i++) {
cx_write(dev->channels[i].sram_channels->dma_ctl, 0); cx_write(dev->channels[i].sram_channels->dma_ctl, 0);
cx_write(dev->channels[i].sram_channels->int_msk, 0); cx_write(dev->channels[i].sram_channels->int_msk, 0);
} }
for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J; for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J;
i++) { i++) {
cx_write(dev->channels[i].sram_channels->dma_ctl, 0); cx_write(dev->channels[i].sram_channels->dma_ctl, 0);
cx_write(dev->channels[i].sram_channels->int_msk, 0); cx_write(dev->channels[i].sram_channels->int_msk, 0);
} }
/* Disable Audio activity */ /* Disable Audio activity */
...@@ -806,9 +806,9 @@ void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel_select, ...@@ -806,9 +806,9 @@ void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel_select,
u32 format) u32 format)
{ {
if (channel_select <= 7 && channel_select >= 0) { if (channel_select <= 7 && channel_select >= 0) {
cx_write(dev->channels[channel_select]. cx_write(dev->channels[channel_select].
sram_channels->pix_frmt, format); sram_channels->pix_frmt, format);
dev->channels[channel_select].pixel_formats = format; dev->channels[channel_select].pixel_formats = format;
} }
} }
...@@ -829,7 +829,7 @@ static void cx25821_initialize(struct cx25821_dev *dev) ...@@ -829,7 +829,7 @@ static void cx25821_initialize(struct cx25821_dev *dev)
cx_write(PCI_INT_STAT, 0xffffffff); cx_write(PCI_INT_STAT, 0xffffffff);
for (i = 0; i < VID_CHANNEL_NUM; i++) for (i = 0; i < VID_CHANNEL_NUM; i++)
cx_write(dev->channels[i].sram_channels->int_stat, 0xffffffff); cx_write(dev->channels[i].sram_channels->int_stat, 0xffffffff);
cx_write(AUD_A_INT_STAT, 0xffffffff); cx_write(AUD_A_INT_STAT, 0xffffffff);
cx_write(AUD_B_INT_STAT, 0xffffffff); cx_write(AUD_B_INT_STAT, 0xffffffff);
...@@ -843,22 +843,22 @@ static void cx25821_initialize(struct cx25821_dev *dev) ...@@ -843,22 +843,22 @@ static void cx25821_initialize(struct cx25821_dev *dev)
mdelay(100); mdelay(100);
for (i = 0; i < VID_CHANNEL_NUM; i++) { for (i = 0; i < VID_CHANNEL_NUM; i++) {
cx25821_set_vip_mode(dev, dev->channels[i].sram_channels); cx25821_set_vip_mode(dev, dev->channels[i].sram_channels);
cx25821_sram_channel_setup(dev, dev->channels[i].sram_channels, cx25821_sram_channel_setup(dev, dev->channels[i].sram_channels,
1440, 0); 1440, 0);
dev->channels[i].pixel_formats = PIXEL_FRMT_422; dev->channels[i].pixel_formats = PIXEL_FRMT_422;
dev->channels[i].use_cif_resolution = FALSE; dev->channels[i].use_cif_resolution = FALSE;
} }
/* Probably only affect Downstream */ /* Probably only affect Downstream */
for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J; for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J;
i++) { i++) {
cx25821_set_vip_mode(dev, dev->channels[i].sram_channels); cx25821_set_vip_mode(dev, dev->channels[i].sram_channels);
} }
cx25821_sram_channel_setup_audio(dev, cx25821_sram_channel_setup_audio(dev,
dev->channels[SRAM_CH08].sram_channels, dev->channels[SRAM_CH08].sram_channels,
128, 0); 128, 0);
cx25821_gpio_init(dev); cx25821_gpio_init(dev);
} }
...@@ -932,7 +932,7 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) ...@@ -932,7 +932,7 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
/* Apply a sensible clock frequency for the PCIe bridge */ /* Apply a sensible clock frequency for the PCIe bridge */
dev->clk_freq = 28000000; dev->clk_freq = 28000000;
for (i = 0; i < MAX_VID_CHANNEL_NUM; i++) for (i = 0; i < MAX_VID_CHANNEL_NUM; i++)
dev->channels[i].sram_channels = &cx25821_sram_channels[i]; dev->channels[i].sram_channels = &cx25821_sram_channels[i];
if (dev->nr > 1) if (dev->nr > 1)
CX25821_INFO("dev->nr > 1!"); CX25821_INFO("dev->nr > 1!");
...@@ -1004,22 +1004,22 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) ...@@ -1004,22 +1004,22 @@ static int cx25821_dev_setup(struct cx25821_dev *dev)
cx25821_card_setup(dev); cx25821_card_setup(dev);
if (medusa_video_init(dev) < 0) if (medusa_video_init(dev) < 0)
CX25821_ERR("%s() Failed to initialize medusa!\n" CX25821_ERR("%s() Failed to initialize medusa!\n"
, __func__); , __func__);
cx25821_video_register(dev); cx25821_video_register(dev);
/* register IOCTL device */ /* register IOCTL device */
dev->ioctl_dev = dev->ioctl_dev =
cx25821_vdev_init(dev, dev->pci, &cx25821_videoioctl_template, cx25821_vdev_init(dev, dev->pci, &cx25821_videoioctl_template,
"video"); "video");
if (video_register_device if (video_register_device
(dev->ioctl_dev, VFL_TYPE_GRABBER, VIDEO_IOCTL_CH) < 0) { (dev->ioctl_dev, VFL_TYPE_GRABBER, VIDEO_IOCTL_CH) < 0) {
cx25821_videoioctl_unregister(dev); cx25821_videoioctl_unregister(dev);
printk(KERN_ERR printk(KERN_ERR
"%s() Failed to register video adapter for IOCTL, so \ "%s() Failed to register video adapter for IOCTL, so \
unregistering videoioctl device.\n", __func__); unregistering videoioctl device.\n", __func__);
} }
cx25821_dev_checkrevision(dev); cx25821_dev_checkrevision(dev);
...@@ -1342,8 +1342,8 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id) ...@@ -1342,8 +1342,8 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id)
for (i = 0; i < VID_CHANNEL_NUM; i++) { for (i = 0; i < VID_CHANNEL_NUM; i++) {
if (pci_status & mask[i]) { if (pci_status & mask[i]) {
vid_status = cx_read(dev->channels[i]. vid_status = cx_read(dev->channels[i].
sram_channels->int_stat); sram_channels->int_stat);
if (vid_status) if (vid_status)
handled += handled +=
......
...@@ -830,8 +830,8 @@ int medusa_video_init(struct cx25821_dev *dev) ...@@ -830,8 +830,8 @@ int medusa_video_init(struct cx25821_dev *dev)
value = cx25821_i2c_read(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, &tmp); value = cx25821_i2c_read(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, &tmp);
value &= 0x83FFFFFF; value &= 0x83FFFFFF;
ret_val = ret_val =
cx25821_i2c_write(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, cx25821_i2c_write(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL,
value | 0x10000000); value | 0x10000000);
if (ret_val < 0) if (ret_val < 0)
goto error; goto error;
......
...@@ -84,7 +84,7 @@ static __le32 *cx25821_risc_field_upstream_ch2(struct cx25821_dev *dev, ...@@ -84,7 +84,7 @@ static __le32 *cx25821_risc_field_upstream_ch2(struct cx25821_dev *dev,
{ {
unsigned int line, i; unsigned int line, i;
struct sram_channel *sram_ch = struct sram_channel *sram_ch =
dev->channels[dev->_channel2_upstream_select].sram_channels; dev->channels[dev->_channel2_upstream_select].sram_channels;
int dist_betwn_starts = bpl * 2; int dist_betwn_starts = bpl * 2;
/* sync instruction */ /* sync instruction */
...@@ -110,11 +110,11 @@ static __le32 *cx25821_risc_field_upstream_ch2(struct cx25821_dev *dev, ...@@ -110,11 +110,11 @@ static __le32 *cx25821_risc_field_upstream_ch2(struct cx25821_dev *dev,
offset += dist_betwn_starts; offset += dist_betwn_starts;
} }
/* /*
check if we need to enable the FIFO after the first 4 lines check if we need to enable the FIFO after the first 4 lines
For the upstream video channel, the risc engine will enable For the upstream video channel, the risc engine will enable
the FIFO. the FIFO.
*/ */
if (fifo_enable && line == 3) { if (fifo_enable && line == 3) {
*(rp++) = RISC_WRITECR; *(rp++) = RISC_WRITECR;
*(rp++) = sram_ch->dma_ctl; *(rp++) = sram_ch->dma_ctl;
...@@ -177,7 +177,7 @@ int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev, ...@@ -177,7 +177,7 @@ int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev,
fifo_enable = FIFO_DISABLE; fifo_enable = FIFO_DISABLE;
/* Even field */ /* Even field */
rp = cx25821_risc_field_upstream_ch2(dev, rp, rp = cx25821_risc_field_upstream_ch2(dev, rp,
dev-> dev->
_data_buf_phys_addr_ch2 + _data_buf_phys_addr_ch2 +
...@@ -195,10 +195,10 @@ int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev, ...@@ -195,10 +195,10 @@ int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev,
risc_phys_jump_addr = dev->_dma_phys_start_addr_ch2; risc_phys_jump_addr = dev->_dma_phys_start_addr_ch2;
} }
/* /*
Loop to 2ndFrameRISC or to Start of Loop to 2ndFrameRISC or to Start of
Risc program & generate IRQ 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);
...@@ -210,7 +210,7 @@ int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev, ...@@ -210,7 +210,7 @@ int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev,
void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev) void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev)
{ {
struct sram_channel *sram_ch = struct sram_channel *sram_ch =
dev->channels[VID_UPSTREAM_SRAM_CHANNEL_J].sram_channels; dev->channels[VID_UPSTREAM_SRAM_CHANNEL_J].sram_channels;
u32 tmp = 0; u32 tmp = 0;
if (!dev->_is_running_ch2) { if (!dev->_is_running_ch2) {
...@@ -377,8 +377,8 @@ static void cx25821_vidups_handler_ch2(struct work_struct *work) ...@@ -377,8 +377,8 @@ static void cx25821_vidups_handler_ch2(struct work_struct *work)
} }
cx25821_get_frame_ch2(dev, cx25821_get_frame_ch2(dev,
dev->channels[dev-> dev->channels[dev->
_channel2_upstream_select].sram_channels); _channel2_upstream_select].sram_channels);
} }
int cx25821_openfile_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch) int cx25821_openfile_ch2(struct cx25821_dev *dev, struct sram_channel *sram_ch)
...@@ -550,13 +550,13 @@ int cx25821_video_upstream_irq_ch2(struct cx25821_dev *dev, int chan_num, ...@@ -550,13 +550,13 @@ int cx25821_video_upstream_irq_ch2(struct cx25821_dev *dev, int chan_num,
__le32 *rp; __le32 *rp;
if (status & FLD_VID_SRC_RISC1) { if (status & FLD_VID_SRC_RISC1) {
/* We should only process one program per call */ /* We should only process one program per call */
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 Since we've identified our IRQ, clear our bits from the
interrupt mask and interrupt status registers interrupt mask and interrupt status registers
*/ */
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);
cx_write(channel->int_stat, _intr_msk); cx_write(channel->int_stat, _intr_msk);
...@@ -597,7 +597,7 @@ int cx25821_video_upstream_irq_ch2(struct cx25821_dev *dev, int chan_num, ...@@ -597,7 +597,7 @@ int cx25821_video_upstream_irq_ch2(struct cx25821_dev *dev, int chan_num,
FIFO_DISABLE, FIFO_DISABLE,
ODD_FIELD); ODD_FIELD);
/* Jump to Even Risc program of 1st Frame */ /* Jump to Even Risc program of 1st Frame */
*(rp++) = cpu_to_le32(RISC_JUMP); *(rp++) = cpu_to_le32(RISC_JUMP);
*(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);
...@@ -668,8 +668,8 @@ static void cx25821_set_pixelengine_ch2(struct cx25821_dev *dev, ...@@ -668,8 +668,8 @@ static void cx25821_set_pixelengine_ch2(struct cx25821_dev *dev,
cx_write(ch->vid_fmt_ctl, value); cx_write(ch->vid_fmt_ctl, value);
/* /*
set number of active pixels in each line. Default is 720 set number of active pixels in each line. Default is 720
pixels in both NTSC and PAL format pixels in both NTSC and PAL format
*/ */
cx_write(ch->vid_active_ctl1, width); cx_write(ch->vid_active_ctl1, width);
...@@ -695,15 +695,15 @@ int cx25821_start_video_dma_upstream_ch2(struct cx25821_dev *dev, ...@@ -695,15 +695,15 @@ int cx25821_start_video_dma_upstream_ch2(struct cx25821_dev *dev,
int err = 0; int err = 0;
/* /*
656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface
for channel A-C for channel A-C
*/ */
tmp = cx_read(VID_CH_MODE_SEL); tmp = cx_read(VID_CH_MODE_SEL);
cx_write(VID_CH_MODE_SEL, tmp | 0x1B0001FF); cx_write(VID_CH_MODE_SEL, tmp | 0x1B0001FF);
/* /*
Set the physical start address of the RISC program in the initial Set the physical start address of the RISC program in the initial
program counter(IPC) member of the cmds. program counter(IPC) member of the cmds.
*/ */
cx_write(sram_ch->cmds_start + 0, dev->_dma_phys_addr_ch2); cx_write(sram_ch->cmds_start + 0, dev->_dma_phys_addr_ch2);
cx_write(sram_ch->cmds_start + 4, 0); /* Risc IPC High 64 bits 63-32 */ cx_write(sram_ch->cmds_start + 4, 0); /* Risc IPC High 64 bits 63-32 */
...@@ -770,8 +770,8 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select, ...@@ -770,8 +770,8 @@ int cx25821_vidupstream_init_ch2(struct cx25821_dev *dev, int channel_select,
return -ENOMEM; return -ENOMEM;
} }
/* /*
656/VIP SRC Upstream Channel I & J and 7 - 656/VIP SRC Upstream Channel I & J and 7 -
Host Bus Interface for channel A-C Host Bus Interface for channel A-C
*/ */
tmp = cx_read(VID_CH_MODE_SEL); tmp = cx_read(VID_CH_MODE_SEL);
cx_write(VID_CH_MODE_SEL, tmp | 0x1B0001FF); cx_write(VID_CH_MODE_SEL, tmp | 0x1B0001FF);
......
...@@ -134,7 +134,7 @@ static __le32 *cx25821_risc_field_upstream(struct cx25821_dev *dev, __le32 * rp, ...@@ -134,7 +134,7 @@ static __le32 *cx25821_risc_field_upstream(struct cx25821_dev *dev, __le32 * rp,
{ {
unsigned int line, i; unsigned int line, i;
struct sram_channel *sram_ch = struct sram_channel *sram_ch =
dev->channels[dev->_channel_upstream_select].sram_channels; dev->channels[dev->_channel_upstream_select].sram_channels;
int dist_betwn_starts = bpl * 2; int dist_betwn_starts = bpl * 2;
/* sync instruction */ /* sync instruction */
...@@ -253,7 +253,7 @@ int cx25821_risc_buffer_upstream(struct cx25821_dev *dev, ...@@ -253,7 +253,7 @@ int cx25821_risc_buffer_upstream(struct cx25821_dev *dev,
void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev) void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev)
{ {
struct sram_channel *sram_ch = struct sram_channel *sram_ch =
dev->channels[VID_UPSTREAM_SRAM_CHANNEL_I].sram_channels; dev->channels[VID_UPSTREAM_SRAM_CHANNEL_I].sram_channels;
u32 tmp = 0; u32 tmp = 0;
if (!dev->_is_running) { if (!dev->_is_running) {
...@@ -346,23 +346,23 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -346,23 +346,23 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch)
if (IS_ERR(myfile)) { if (IS_ERR(myfile)) {
const int open_errno = -PTR_ERR(myfile); const int open_errno = -PTR_ERR(myfile);
printk(KERN_ERR printk(KERN_ERR
"%s(): ERROR opening file(%s) with errno = %d!\n", "%s(): ERROR opening file(%s) with errno = %d!\n",
__func__, dev->_filename, open_errno); __func__, dev->_filename, open_errno);
return PTR_ERR(myfile); return PTR_ERR(myfile);
} else { } else {
if (!(myfile->f_op)) { if (!(myfile->f_op)) {
printk(KERN_ERR printk(KERN_ERR
"%s: File has no file operations registered!", "%s: File has no file operations registered!",
__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(KERN_ERR printk(KERN_ERR
"%s: File has no READ operations registered!", "%s: File has no READ operations registered!",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
} }
...@@ -389,8 +389,8 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -389,8 +389,8 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch)
if (vfs_read_retval < line_size) { if (vfs_read_retval < line_size) {
printk(KERN_INFO printk(KERN_INFO
"Done: exit %s() since no more bytes to \ "Done: exit %s() since no more bytes to \
read from Video file.\n", read from Video file.\n",
__func__); __func__);
break; break;
} }
...@@ -415,15 +415,15 @@ static void cx25821_vidups_handler(struct work_struct *work) ...@@ -415,15 +415,15 @@ static void cx25821_vidups_handler(struct work_struct *work)
container_of(work, struct cx25821_dev, _irq_work_entry); container_of(work, struct cx25821_dev, _irq_work_entry);
if (!dev) { if (!dev) {
printk(KERN_ERR printk(KERN_ERR
"ERROR %s(): since container_of(work_struct) FAILED!\n", "ERROR %s(): since container_of(work_struct) FAILED!\n",
__func__); __func__);
return; return;
} }
cx25821_get_frame(dev, cx25821_get_frame(dev,
dev->channels[dev->_channel_upstream_select]. dev->channels[dev->_channel_upstream_select].
sram_channels); sram_channels);
} }
int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch)
...@@ -443,22 +443,22 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -443,22 +443,22 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch)
if (IS_ERR(myfile)) { if (IS_ERR(myfile)) {
const int open_errno = -PTR_ERR(myfile); const int open_errno = -PTR_ERR(myfile);
printk(KERN_ERR "%s(): ERROR opening file(%s) with errno = %d!\n", printk(KERN_ERR "%s(): ERROR opening file(%s) with errno = %d!\n",
__func__, dev->_filename, open_errno); __func__, dev->_filename, open_errno);
return PTR_ERR(myfile); return PTR_ERR(myfile);
} else { } else {
if (!(myfile->f_op)) { if (!(myfile->f_op)) {
printk(KERN_ERR printk(KERN_ERR
"%s: File has no file operations registered!", "%s: File has no file operations registered!",
__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(KERN_ERR printk(KERN_ERR
"%s: File has no READ operations registered! \ "%s: File has no READ operations registered! \
Returning.", Returning.",
__func__); __func__);
filp_close(myfile, NULL); filp_close(myfile, NULL);
return -EIO; return -EIO;
...@@ -488,8 +488,8 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) ...@@ -488,8 +488,8 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch)
if (vfs_read_retval < line_size) { if (vfs_read_retval < line_size) {
printk(KERN_INFO printk(KERN_INFO
"Done: exit %s() since no more \ "Done: exit %s() since no more \
bytes to read from Video file.\n", bytes to read from Video file.\n",
__func__); __func__);
break; break;
} }
...@@ -535,8 +535,8 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, ...@@ -535,8 +535,8 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev,
if (!dev->_dma_virt_addr) { if (!dev->_dma_virt_addr) {
printk printk
(KERN_ERR "cx25821: FAILED to allocate memory for Risc \ (KERN_ERR "cx25821: FAILED to allocate memory for Risc \
buffer! Returning.\n"); buffer! Returning.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -557,8 +557,8 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, ...@@ -557,8 +557,8 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev,
if (!dev->_data_buf_virt_addr) { if (!dev->_data_buf_virt_addr) {
printk printk
(KERN_ERR "cx25821: FAILED to allocate memory for data \ (KERN_ERR "cx25821: FAILED to allocate memory for data \
buffer! Returning.\n"); buffer! Returning.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -653,16 +653,16 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num, ...@@ -653,16 +653,16 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num,
} else { } else {
if (status & FLD_VID_SRC_UF) if (status & FLD_VID_SRC_UF)
printk printk
(KERN_ERR "%s: Video Received Underflow Error \ (KERN_ERR "%s: Video Received Underflow Error \
Interrupt!\n", __func__); Interrupt!\n", __func__);
if (status & FLD_VID_SRC_SYNC) if (status & FLD_VID_SRC_SYNC)
printk(KERN_ERR "%s: Video Received Sync Error \ printk(KERN_ERR "%s: Video Received Sync Error \
Interrupt!\n", __func__); Interrupt!\n", __func__);
if (status & FLD_VID_SRC_OPC_ERR) if (status & FLD_VID_SRC_OPC_ERR)
printk(KERN_ERR "%s: Video Received OpCode Error \ printk(KERN_ERR "%s: Video Received OpCode Error \
Interrupt!\n", __func__); Interrupt!\n", __func__);
} }
if (dev->_file_status == END_OF_FILE) { if (dev->_file_status == END_OF_FILE) {
...@@ -818,8 +818,8 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, ...@@ -818,8 +818,8 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select,
if (!dev->_irq_queues) { if (!dev->_irq_queues) {
printk printk
(KERN_ERR "cx25821: create_singlethread_workqueue() for \ (KERN_ERR "cx25821: create_singlethread_workqueue() for \
Video FAILED!\n"); Video FAILED!\n");
return -ENOMEM; return -ENOMEM;
} }
/* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for /* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for
......
...@@ -410,8 +410,8 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status) ...@@ -410,8 +410,8 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
if (status & FLD_VID_DST_RISC1) { if (status & FLD_VID_DST_RISC1) {
spin_lock(&dev->slock); spin_lock(&dev->slock);
count = cx_read(channel->gpcnt); count = cx_read(channel->gpcnt);
cx25821_video_wakeup(dev, cx25821_video_wakeup(dev,
&dev->channels[channel->i].vidq, count); &dev->channels[channel->i].vidq, count);
spin_unlock(&dev->slock); spin_unlock(&dev->slock);
handled++; handled++;
} }
...@@ -420,9 +420,9 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status) ...@@ -420,9 +420,9 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status)
if (status & 0x10) { if (status & 0x10) {
dprintk(2, "stopper video\n"); dprintk(2, "stopper video\n");
spin_lock(&dev->slock); spin_lock(&dev->slock);
cx25821_restart_video_queue(dev, cx25821_restart_video_queue(dev,
&dev->channels[channel->i].vidq, &dev->channels[channel->i].vidq,
channel); channel);
spin_unlock(&dev->slock); spin_unlock(&dev->slock);
handled++; handled++;
} }
...@@ -446,17 +446,17 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num) ...@@ -446,17 +446,17 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num)
cx_clear(PCI_INT_MSK, 1); cx_clear(PCI_INT_MSK, 1);
if (dev->channels[chan_num].video_dev) { if (dev->channels[chan_num].video_dev) {
if (video_is_registered(dev->channels[chan_num].video_dev)) if (video_is_registered(dev->channels[chan_num].video_dev))
video_unregister_device( video_unregister_device(
dev->channels[chan_num].video_dev); dev->channels[chan_num].video_dev);
else else
video_device_release( video_device_release(
dev->channels[chan_num].video_dev); dev->channels[chan_num].video_dev);
dev->channels[chan_num].video_dev = NULL; dev->channels[chan_num].video_dev = NULL;
btcx_riscmem_free(dev->pci, btcx_riscmem_free(dev->pci,
&dev->channels[chan_num].vidq.stopper); &dev->channels[chan_num].vidq.stopper);
printk(KERN_WARNING "device %d released!\n", chan_num); printk(KERN_WARNING "device %d released!\n", chan_num);
} }
...@@ -469,52 +469,52 @@ int cx25821_video_register(struct cx25821_dev *dev) ...@@ -469,52 +469,52 @@ int cx25821_video_register(struct cx25821_dev *dev)
int i; int i;
struct video_device cx25821_video_device = { struct video_device cx25821_video_device = {
.name = "cx25821-video", .name = "cx25821-video",
.fops = &video_fops, .fops = &video_fops,
.minor = -1, .minor = -1,
.ioctl_ops = &video_ioctl_ops, .ioctl_ops = &video_ioctl_ops,
.tvnorms = CX25821_NORMS, .tvnorms = CX25821_NORMS,
.current_norm = V4L2_STD_NTSC_M, .current_norm = V4L2_STD_NTSC_M,
}; };
spin_lock_init(&dev->slock); spin_lock_init(&dev->slock);
for (i = 0; i < MAX_VID_CHANNEL_NUM - 1; ++i) { for (i = 0; i < MAX_VID_CHANNEL_NUM - 1; ++i) {
cx25821_init_controls(dev, i); cx25821_init_controls(dev, i);
cx25821_risc_stopper(dev->pci, cx25821_risc_stopper(dev->pci,
&dev->channels[i].vidq.stopper, &dev->channels[i].vidq.stopper,
dev->channels[i].sram_channels->dma_ctl, dev->channels[i].sram_channels->dma_ctl,
0x11, 0); 0x11, 0);
dev->channels[i].sram_channels = &cx25821_sram_channels[i]; dev->channels[i].sram_channels = &cx25821_sram_channels[i];
dev->channels[i].video_dev = NULL; dev->channels[i].video_dev = NULL;
dev->channels[i].resources = 0; dev->channels[i].resources = 0;
cx_write(dev->channels[i].sram_channels->int_stat, cx_write(dev->channels[i].sram_channels->int_stat,
0xffffffff); 0xffffffff);
INIT_LIST_HEAD(&dev->channels[i].vidq.active); INIT_LIST_HEAD(&dev->channels[i].vidq.active);
INIT_LIST_HEAD(&dev->channels[i].vidq.queued); INIT_LIST_HEAD(&dev->channels[i].vidq.queued);
dev->channels[i].timeout_data.dev = dev; dev->channels[i].timeout_data.dev = dev;
dev->channels[i].timeout_data.channel = dev->channels[i].timeout_data.channel =
&cx25821_sram_channels[i]; &cx25821_sram_channels[i];
dev->channels[i].vidq.timeout.function = dev->channels[i].vidq.timeout.function =
cx25821_vid_timeout; cx25821_vid_timeout;
dev->channels[i].vidq.timeout.data = dev->channels[i].vidq.timeout.data =
(unsigned long)&dev->channels[i].timeout_data; (unsigned long)&dev->channels[i].timeout_data;
init_timer(&dev->channels[i].vidq.timeout); init_timer(&dev->channels[i].vidq.timeout);
/* register v4l devices */ /* register v4l devices */
dev->channels[i].video_dev = cx25821_vdev_init(dev, dev->channels[i].video_dev = cx25821_vdev_init(dev,
dev->pci, &cx25821_video_device, "video"); dev->pci, &cx25821_video_device, "video");
err = video_register_device(dev->channels[i].video_dev, err = video_register_device(dev->channels[i].video_dev,
VFL_TYPE_GRABBER, video_nr[dev->nr]); VFL_TYPE_GRABBER, video_nr[dev->nr]);
if (err < 0) if (err < 0)
goto fail_unreg; goto fail_unreg;
} }
...@@ -603,29 +603,29 @@ int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, ...@@ -603,29 +603,29 @@ int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,
channel_opened = (channel_opened < 0 channel_opened = (channel_opened < 0
|| channel_opened > 7) ? 7 : channel_opened; || channel_opened > 7) ? 7 : channel_opened;
if (dev->channels[channel_opened] if (dev->channels[channel_opened]
.pixel_formats == PIXEL_FRMT_411) .pixel_formats == PIXEL_FRMT_411)
buf->bpl = (buf->fmt->depth * buf->vb.width) >> 3; buf->bpl = (buf->fmt->depth * buf->vb.width) >> 3;
else else
buf->bpl = (buf->fmt->depth >> 3) * (buf->vb.width); buf->bpl = (buf->fmt->depth >> 3) * (buf->vb.width);
if (dev->channels[channel_opened] if (dev->channels[channel_opened]
.pixel_formats == PIXEL_FRMT_411) { .pixel_formats == PIXEL_FRMT_411) {
bpl_local = buf->bpl; bpl_local = buf->bpl;
} else { } else {
bpl_local = buf->bpl; /* Default */ bpl_local = buf->bpl; /* Default */
if (channel_opened >= 0 && channel_opened <= 7) { if (channel_opened >= 0 && channel_opened <= 7) {
if (dev->channels[channel_opened] if (dev->channels[channel_opened]
.use_cif_resolution) { .use_cif_resolution) {
if (dev->tvnorm & V4L2_STD_PAL_BG if (dev->tvnorm & V4L2_STD_PAL_BG
|| dev->tvnorm & V4L2_STD_PAL_DK) || dev->tvnorm & V4L2_STD_PAL_DK)
bpl_local = 352 << 1; bpl_local = 352 << 1;
else else
bpl_local = bpl_local =
dev->channels[channel_opened]. dev->channels[channel_opened].
cif_width << cif_width <<
1; 1;
} }
} }
} }
...@@ -723,7 +723,7 @@ int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -723,7 +723,7 @@ int cx25821_video_mmap(struct file *file, struct vm_area_struct *vma)
static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
{ {
struct cx25821_buffer *buf = struct cx25821_buffer *buf =
container_of(vb, struct cx25821_buffer, vb); container_of(vb, struct cx25821_buffer, vb);
struct cx25821_buffer *prev; struct cx25821_buffer *prev;
struct cx25821_fh *fh = vq->priv_data; struct cx25821_fh *fh = vq->priv_data;
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev = fh->dev;
...@@ -737,51 +737,51 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) ...@@ -737,51 +737,51 @@ static void buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb)
dprintk(2, "jmp to stopper (0x%x)\n", buf->risc.jmp[1]); dprintk(2, "jmp to stopper (0x%x)\n", buf->risc.jmp[1]);
if (!list_empty(&q->queued)) { if (!list_empty(&q->queued)) {
list_add_tail(&buf->vb.queue, &q->queued); list_add_tail(&buf->vb.queue, &q->queued);
buf->vb.state = VIDEOBUF_QUEUED; buf->vb.state = VIDEOBUF_QUEUED;
dprintk(2, "[%p/%d] buffer_queue - append to queued\n", buf, dprintk(2, "[%p/%d] buffer_queue - append to queued\n", buf,
buf->vb.i); buf->vb.i);
} else if (list_empty(&q->active)) { } else if (list_empty(&q->active)) {
list_add_tail(&buf->vb.queue, &q->active); list_add_tail(&buf->vb.queue, &q->active);
cx25821_start_video_dma(dev, q, buf, cx25821_start_video_dma(dev, q, buf,
dev->channels[fh->channel_id]. dev->channels[fh->channel_id].
sram_channels); sram_channels);
buf->vb.state = VIDEOBUF_ACTIVE; buf->vb.state = VIDEOBUF_ACTIVE;
buf->count = q->count++; buf->count = q->count++;
mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT);
dprintk(2, dprintk(2,
"[%p/%d] buffer_queue - first active, buf cnt = %d, \ "[%p/%d] buffer_queue - first active, buf cnt = %d, \
q->count = %d\n", q->count = %d\n",
buf, buf->vb.i, buf->count, q->count); buf, buf->vb.i, buf->count, q->count);
} else { } else {
prev = prev =
list_entry(q->active.prev, struct cx25821_buffer, vb.queue); list_entry(q->active.prev, struct cx25821_buffer, vb.queue);
if (prev->vb.width == buf->vb.width if (prev->vb.width == buf->vb.width
&& prev->vb.height == buf->vb.height && prev->vb.height == buf->vb.height
&& prev->fmt == buf->fmt) { && prev->fmt == buf->fmt) {
list_add_tail(&buf->vb.queue, &q->active); list_add_tail(&buf->vb.queue, &q->active);
buf->vb.state = VIDEOBUF_ACTIVE; buf->vb.state = VIDEOBUF_ACTIVE;
buf->count = q->count++; buf->count = q->count++;
prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma);
/* 64 bit bits 63-32 */ /* 64 bit bits 63-32 */
prev->risc.jmp[2] = cpu_to_le32(0); prev->risc.jmp[2] = cpu_to_le32(0);
dprintk(2, dprintk(2,
"[%p/%d] buffer_queue - append to active, \ "[%p/%d] buffer_queue - append to active, \
buf->count=%d\n", buf->count=%d\n",
buf, buf->vb.i, buf->count); buf, buf->vb.i, buf->count);
} else { } else {
list_add_tail(&buf->vb.queue, &q->queued); list_add_tail(&buf->vb.queue, &q->queued);
buf->vb.state = VIDEOBUF_QUEUED; buf->vb.state = VIDEOBUF_QUEUED;
dprintk(2, "[%p/%d] buffer_queue - first queued\n", buf, dprintk(2, "[%p/%d] buffer_queue - first queued\n", buf,
buf->vb.i); buf->vb.i);
} }
} }
if (list_empty(&q->active)) if (list_empty(&q->active))
dprintk(2, "active queue empty!\n"); dprintk(2, "active queue empty!\n");
} }
static struct videobuf_queue_ops cx25821_video_qops = { static struct videobuf_queue_ops cx25821_video_qops = {
...@@ -804,33 +804,33 @@ static int video_open(struct file *file) ...@@ -804,33 +804,33 @@ static int video_open(struct file *file)
int i; int i;
dprintk(1, "open dev=%s type=%s\n", dprintk(1, "open dev=%s type=%s\n",
video_device_node_name(vdev), video_device_node_name(vdev),
v4l2_type_names[type]); v4l2_type_names[type]);
/* allocate + initialize per filehandle data */ /* allocate + initialize per filehandle data */
fh = kzalloc(sizeof(*fh), GFP_KERNEL); fh = kzalloc(sizeof(*fh), GFP_KERNEL);
if (NULL == fh) if (NULL == fh)
return -ENOMEM; return -ENOMEM;
lock_kernel(); lock_kernel();
list_for_each(list, &cx25821_devlist) list_for_each(list, &cx25821_devlist)
{ {
h = list_entry(list, struct cx25821_dev, devlist); h = list_entry(list, struct cx25821_dev, devlist);
for (i = 0; i < MAX_VID_CHANNEL_NUM; i++) { for (i = 0; i < MAX_VID_CHANNEL_NUM; i++) {
if (h->channels[i].video_dev && if (h->channels[i].video_dev &&
h->channels[i].video_dev->minor == minor) { h->channels[i].video_dev->minor == minor) {
dev = h; dev = h;
ch_id = i; ch_id = i;
type = V4L2_BUF_TYPE_VIDEO_CAPTURE; type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
} }
} }
} }
if (NULL == dev) { if (NULL == dev) {
unlock_kernel(); unlock_kernel();
return -ENODEV; return -ENODEV;
} }
file->private_data = fh; file->private_data = fh;
...@@ -840,23 +840,23 @@ static int video_open(struct file *file) ...@@ -840,23 +840,23 @@ static int video_open(struct file *file)
fh->channel_id = ch_id; fh->channel_id = ch_id;
if (dev->tvnorm & V4L2_STD_PAL_BG || dev->tvnorm & V4L2_STD_PAL_DK) if (dev->tvnorm & V4L2_STD_PAL_BG || dev->tvnorm & V4L2_STD_PAL_DK)
fh->height = 576; fh->height = 576;
else else
fh->height = 480; fh->height = 480;
dev->channel_opened = fh->channel_id; dev->channel_opened = fh->channel_id;
pix_format = pix_format =
(dev->channels[ch_id].pixel_formats == (dev->channels[ch_id].pixel_formats ==
PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV; PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV;
fh->fmt = format_by_fourcc(pix_format); fh->fmt = format_by_fourcc(pix_format);
v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio); v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio);
videobuf_queue_sg_init(&fh->vidq, &cx25821_video_qops, videobuf_queue_sg_init(&fh->vidq, &cx25821_video_qops,
&dev->pci->dev, &dev->slock, &dev->pci->dev, &dev->slock,
V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_BUF_TYPE_VIDEO_CAPTURE,
V4L2_FIELD_INTERLACED, V4L2_FIELD_INTERLACED,
sizeof(struct cx25821_buffer), fh); sizeof(struct cx25821_buffer), fh);
dprintk(1, "post videobuf_queue_init()\n"); dprintk(1, "post videobuf_queue_init()\n");
unlock_kernel(); unlock_kernel();
...@@ -865,59 +865,59 @@ static int video_open(struct file *file) ...@@ -865,59 +865,59 @@ static int video_open(struct file *file)
} }
static ssize_t video_read(struct file *file, char __user * data, size_t count, static ssize_t video_read(struct file *file, char __user * data, size_t count,
loff_t *ppos) loff_t *ppos)
{ {
struct cx25821_fh *fh = file->private_data; struct cx25821_fh *fh = file->private_data;
switch (fh->type) { switch (fh->type) {
case V4L2_BUF_TYPE_VIDEO_CAPTURE: case V4L2_BUF_TYPE_VIDEO_CAPTURE:
if (cx25821_res_locked(fh, RESOURCE_VIDEO0)) if (cx25821_res_locked(fh, RESOURCE_VIDEO0))
return -EBUSY; return -EBUSY;
return videobuf_read_one(&fh->vidq, data, count, ppos, return videobuf_read_one(&fh->vidq, data, count, ppos,
file->f_flags & O_NONBLOCK); file->f_flags & O_NONBLOCK);
default: default:
BUG(); BUG();
return 0; return 0;
} }
} }
static unsigned int video_poll(struct file *file, static unsigned int video_poll(struct file *file,
struct poll_table_struct *wait) struct poll_table_struct *wait)
{ {
struct cx25821_fh *fh = file->private_data; struct cx25821_fh *fh = file->private_data;
struct cx25821_buffer *buf; struct cx25821_buffer *buf;
if (cx25821_res_check(fh, RESOURCE_VIDEO0)) { if (cx25821_res_check(fh, RESOURCE_VIDEO0)) {
/* streaming capture */ /* streaming capture */
if (list_empty(&fh->vidq.stream)) if (list_empty(&fh->vidq.stream))
return POLLERR; return POLLERR;
buf = list_entry(fh->vidq.stream.next, buf = list_entry(fh->vidq.stream.next,
struct cx25821_buffer, vb.stream); struct cx25821_buffer, vb.stream);
} else { } else {
/* read() capture */ /* read() capture */
buf = (struct cx25821_buffer *)fh->vidq.read_buf; buf = (struct cx25821_buffer *)fh->vidq.read_buf;
if (NULL == buf) if (NULL == buf)
return POLLERR; return POLLERR;
} }
poll_wait(file, &buf->vb.done, wait); poll_wait(file, &buf->vb.done, wait);
if (buf->vb.state == VIDEOBUF_DONE || buf->vb.state == VIDEOBUF_ERROR) { if (buf->vb.state == VIDEOBUF_DONE || buf->vb.state == VIDEOBUF_ERROR) {
if (buf->vb.state == VIDEOBUF_DONE) { if (buf->vb.state == VIDEOBUF_DONE) {
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev = fh->dev;
if (dev && dev->channels[fh->channel_id] if (dev && dev->channels[fh->channel_id]
.use_cif_resolution) { .use_cif_resolution) {
u8 cam_id = *((char *)buf->vb.baddr + 3); u8 cam_id = *((char *)buf->vb.baddr + 3);
memcpy((char *)buf->vb.baddr, memcpy((char *)buf->vb.baddr,
(char *)buf->vb.baddr + (fh->width * 2), (char *)buf->vb.baddr + (fh->width * 2),
(fh->width * 2)); (fh->width * 2));
*((char *)buf->vb.baddr + 3) = cam_id; *((char *)buf->vb.baddr + 3) = cam_id;
} }
} }
return POLLIN | POLLRDNORM; return POLLIN | POLLRDNORM;
} }
return 0; return 0;
...@@ -933,13 +933,13 @@ static int video_release(struct file *file) ...@@ -933,13 +933,13 @@ static int video_release(struct file *file)
/* stop video capture */ /* stop video capture */
if (cx25821_res_check(fh, RESOURCE_VIDEO0)) { if (cx25821_res_check(fh, RESOURCE_VIDEO0)) {
videobuf_queue_cancel(&fh->vidq); videobuf_queue_cancel(&fh->vidq);
cx25821_res_free(dev, fh, RESOURCE_VIDEO0); cx25821_res_free(dev, fh, RESOURCE_VIDEO0);
} }
if (fh->vidq.read_buf) { if (fh->vidq.read_buf) {
cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf);
kfree(fh->vidq.read_buf); kfree(fh->vidq.read_buf);
} }
videobuf_mmap_free(&fh->vidq); videobuf_mmap_free(&fh->vidq);
...@@ -957,14 +957,14 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) ...@@ -957,14 +957,14 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev = fh->dev;
if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)) if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE))
return -EINVAL; return -EINVAL;
if (unlikely(i != fh->type)) if (unlikely(i != fh->type))
return -EINVAL; return -EINVAL;
if (unlikely(!cx25821_res_get(dev, fh, if (unlikely(!cx25821_res_get(dev, fh,
cx25821_get_resource(fh, RESOURCE_VIDEO0)))) cx25821_get_resource(fh, RESOURCE_VIDEO0))))
return -EBUSY; return -EBUSY;
return videobuf_streamon(get_queue(fh)); return videobuf_streamon(get_queue(fh));
} }
...@@ -976,20 +976,20 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) ...@@ -976,20 +976,20 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i)
int err, res; int err, res;
if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL; return -EINVAL;
if (i != fh->type) if (i != fh->type)
return -EINVAL; return -EINVAL;
res = cx25821_get_resource(fh, RESOURCE_VIDEO0); res = cx25821_get_resource(fh, RESOURCE_VIDEO0);
err = videobuf_streamoff(get_queue(fh)); err = videobuf_streamoff(get_queue(fh));
if (err < 0) if (err < 0)
return err; return err;
cx25821_res_free(dev, fh, res); cx25821_res_free(dev, fh, res);
return 0; return 0;
} }
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f) struct v4l2_format *f)
{ {
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
...@@ -997,48 +997,48 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, ...@@ -997,48 +997,48 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
int pix_format = PIXEL_FRMT_422; int pix_format = PIXEL_FRMT_422;
if (fh) { if (fh) {
err = v4l2_prio_check(&dev->channels[fh->channel_id] err = v4l2_prio_check(&dev->channels[fh->channel_id]
.prio, fh->prio); .prio, fh->prio);
if (0 != err) if (0 != err)
return err; return err;
} }
dprintk(2, "%s()\n", __func__); dprintk(2, "%s()\n", __func__);
err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f);
if (0 != err) if (0 != err)
return err; return err;
fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat); fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat);
fh->vidq.field = f->fmt.pix.field; fh->vidq.field = f->fmt.pix.field;
/* check if width and height is valid based on set standard */ /* check if width and height is valid based on set standard */
if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm)) if (cx25821_is_valid_width(f->fmt.pix.width, dev->tvnorm))
fh->width = f->fmt.pix.width; fh->width = f->fmt.pix.width;
if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm)) if (cx25821_is_valid_height(f->fmt.pix.height, dev->tvnorm))
fh->height = f->fmt.pix.height; fh->height = f->fmt.pix.height;
if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_Y41P) if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_Y41P)
pix_format = PIXEL_FRMT_411; pix_format = PIXEL_FRMT_411;
else if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_YUYV) else if (f->fmt.pix.pixelformat == V4L2_PIX_FMT_YUYV)
pix_format = PIXEL_FRMT_422; pix_format = PIXEL_FRMT_422;
else else
return -EINVAL; return -EINVAL;
cx25821_set_pixel_format(dev, SRAM_CH00, pix_format); cx25821_set_pixel_format(dev, SRAM_CH00, pix_format);
/* check if cif resolution */ /* check if cif resolution */
if (fh->width == 320 || fh->width == 352) if (fh->width == 320 || fh->width == 352)
dev->channels[fh->channel_id].use_cif_resolution = 1; dev->channels[fh->channel_id].use_cif_resolution = 1;
else else
dev->channels[fh->channel_id].use_cif_resolution = 0; dev->channels[fh->channel_id].use_cif_resolution = 0;
dev->channels[fh->channel_id].cif_width = fh->width; dev->channels[fh->channel_id].cif_width = fh->width;
medusa_set_resolution(dev, fh->width, SRAM_CH00); medusa_set_resolution(dev, fh->width, SRAM_CH00);
dprintk(2, "%s() width=%d height=%d field=%d\n", __func__, fh->width, dprintk(2, "%s() width=%d height=%d field=%d\n", __func__, fh->width,
fh->height, fh->vidq.field); fh->height, fh->vidq.field);
cx25821_call_all(dev, video, s_fmt, f); cx25821_call_all(dev, video, s_fmt, f);
return 0; return 0;
...@@ -1064,33 +1064,33 @@ static int vidioc_log_status(struct file *file, void *priv) ...@@ -1064,33 +1064,33 @@ static int vidioc_log_status(struct file *file, void *priv)
char name[32 + 2]; char name[32 + 2];
struct sram_channel *sram_ch = dev->channels[fh->channel_id] struct sram_channel *sram_ch = dev->channels[fh->channel_id]
.sram_channels; .sram_channels;
u32 tmp = 0; u32 tmp = 0;
snprintf(name, sizeof(name), "%s/2", dev->name); snprintf(name, sizeof(name), "%s/2", dev->name);
printk(KERN_INFO "%s/2: ============ START LOG STATUS ============\n", printk(KERN_INFO "%s/2: ============ START LOG STATUS ============\n",
dev->name); dev->name);
cx25821_call_all(dev, core, log_status); cx25821_call_all(dev, core, log_status);
tmp = cx_read(sram_ch->dma_ctl); tmp = cx_read(sram_ch->dma_ctl);
printk(KERN_INFO "Video input 0 is %s\n", printk(KERN_INFO "Video input 0 is %s\n",
(tmp & 0x11) ? "streaming" : "stopped"); (tmp & 0x11) ? "streaming" : "stopped");
printk(KERN_INFO "%s/2: ============= END LOG STATUS =============\n", printk(KERN_INFO "%s/2: ============= END LOG STATUS =============\n",
dev->name); dev->name);
return 0; return 0;
} }
static int vidioc_s_ctrl(struct file *file, void *priv, static int vidioc_s_ctrl(struct file *file, void *priv,
struct v4l2_control *ctl) struct v4l2_control *ctl)
{ {
struct cx25821_fh *fh = priv; struct cx25821_fh *fh = priv;
struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)priv)->dev;
int err; int err;
if (fh) { if (fh) {
err = v4l2_prio_check(&dev->channels[fh->channel_id] err = v4l2_prio_check(&dev->channels[fh->channel_id]
.prio, fh->prio); .prio, fh->prio);
if (0 != err) if (0 != err)
return err; return err;
} }
return cx25821_set_control(dev, ctl, fh->channel_id); return cx25821_set_control(dev, ctl, fh->channel_id);
...@@ -1246,7 +1246,7 @@ int cx25821_vidioc_s_priority(struct file *file, void *f, enum v4l2_priority pri ...@@ -1246,7 +1246,7 @@ int cx25821_vidioc_s_priority(struct file *file, void *f, enum v4l2_priority pri
struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev; struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev;
return v4l2_prio_change(&dev->channels[fh->channel_id] return v4l2_prio_change(&dev->channels[fh->channel_id]
.prio, &fh->prio, prio); .prio, &fh->prio, prio);
} }
#ifdef TUNER_FLAG #ifdef TUNER_FLAG
...@@ -1259,8 +1259,8 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms) ...@@ -1259,8 +1259,8 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms)
dprintk(1, "%s()\n", __func__); dprintk(1, "%s()\n", __func__);
if (fh) { if (fh) {
err = v4l2_prio_check(&dev->channels[fh->channel_id] err = v4l2_prio_check(&dev->channels[fh->channel_id]
.prio, fh->prio); .prio, fh->prio);
if (0 != err) if (0 != err)
return err; return err;
} }
...@@ -1330,8 +1330,8 @@ int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i) ...@@ -1330,8 +1330,8 @@ int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i)
dprintk(1, "%s(%d)\n", __func__, i); dprintk(1, "%s(%d)\n", __func__, i);
if (fh) { if (fh) {
err = v4l2_prio_check(&dev->channels[fh->channel_id] err = v4l2_prio_check(&dev->channels[fh->channel_id]
.prio, fh->prio); .prio, fh->prio);
if (0 != err) if (0 != err)
return err; return err;
} }
...@@ -1382,14 +1382,14 @@ int cx25821_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_freque ...@@ -1382,14 +1382,14 @@ int cx25821_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_freque
int err; int err;
if (fh) { if (fh) {
dev = fh->dev; dev = fh->dev;
err = v4l2_prio_check(&dev->channels[fh->channel_id] err = v4l2_prio_check(&dev->channels[fh->channel_id]
.prio, fh->prio); .prio, fh->prio);
if (0 != err) if (0 != err)
return err; return err;
} else { } else {
printk(KERN_ERR "Invalid fh pointer!\n"); printk(KERN_ERR "Invalid fh pointer!\n");
return -EINVAL; return -EINVAL;
} }
return cx25821_set_freq(dev, f); return cx25821_set_freq(dev, f);
...@@ -1451,8 +1451,8 @@ int cx25821_vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t) ...@@ -1451,8 +1451,8 @@ int cx25821_vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t)
int err; int err;
if (fh) { if (fh) {
err = v4l2_prio_check(&dev->channels[fh->channel_id] err = v4l2_prio_check(&dev->channels[fh->channel_id]
.prio, fh->prio); .prio, fh->prio);
if (0 != err) if (0 != err)
return err; return err;
} }
...@@ -1560,16 +1560,16 @@ int cx25821_vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ct ...@@ -1560,16 +1560,16 @@ int cx25821_vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ct
return -EINVAL; return -EINVAL;
switch (ctl->id) { switch (ctl->id) {
case V4L2_CID_BRIGHTNESS: case V4L2_CID_BRIGHTNESS:
ctl->value = dev->channels[fh->channel_id].ctl_bright; ctl->value = dev->channels[fh->channel_id].ctl_bright;
break; break;
case V4L2_CID_HUE: case V4L2_CID_HUE:
ctl->value = dev->channels[fh->channel_id].ctl_hue; ctl->value = dev->channels[fh->channel_id].ctl_hue;
break; break;
case V4L2_CID_CONTRAST: case V4L2_CID_CONTRAST:
ctl->value = dev->channels[fh->channel_id].ctl_contrast; ctl->value = dev->channels[fh->channel_id].ctl_contrast;
break; break;
case V4L2_CID_SATURATION: case V4L2_CID_SATURATION:
ctl->value = dev->channels[fh->channel_id].ctl_saturation; ctl->value = dev->channels[fh->channel_id].ctl_saturation;
break; break;
} }
return 0; return 0;
...@@ -1603,19 +1603,19 @@ int cx25821_set_control(struct cx25821_dev *dev, ...@@ -1603,19 +1603,19 @@ int cx25821_set_control(struct cx25821_dev *dev,
switch (ctl->id) { switch (ctl->id) {
case V4L2_CID_BRIGHTNESS: case V4L2_CID_BRIGHTNESS:
dev->channels[chan_num].ctl_bright = ctl->value; dev->channels[chan_num].ctl_bright = ctl->value;
medusa_set_brightness(dev, ctl->value, chan_num); medusa_set_brightness(dev, ctl->value, chan_num);
break; break;
case V4L2_CID_HUE: case V4L2_CID_HUE:
dev->channels[chan_num].ctl_hue = ctl->value; dev->channels[chan_num].ctl_hue = ctl->value;
medusa_set_hue(dev, ctl->value, chan_num); medusa_set_hue(dev, ctl->value, chan_num);
break; break;
case V4L2_CID_CONTRAST: case V4L2_CID_CONTRAST:
dev->channels[chan_num].ctl_contrast = ctl->value; dev->channels[chan_num].ctl_contrast = ctl->value;
medusa_set_contrast(dev, ctl->value, chan_num); medusa_set_contrast(dev, ctl->value, chan_num);
break; break;
case V4L2_CID_SATURATION: case V4L2_CID_SATURATION:
dev->channels[chan_num].ctl_saturation = ctl->value; dev->channels[chan_num].ctl_saturation = ctl->value;
medusa_set_saturation(dev, ctl->value, chan_num); medusa_set_saturation(dev, ctl->value, chan_num);
break; break;
} }
...@@ -1661,8 +1661,8 @@ int cx25821_vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop) ...@@ -1661,8 +1661,8 @@ int cx25821_vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop)
int err; int err;
if (fh) { if (fh) {
err = v4l2_prio_check(&dev->channels[fh->channel_id]. err = v4l2_prio_check(&dev->channels[fh->channel_id].
prio, fh->prio); prio, fh->prio);
if (0 != err) if (0 != err)
return err; return err;
} }
...@@ -1722,7 +1722,7 @@ int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm) ...@@ -1722,7 +1722,7 @@ int cx25821_is_valid_height(u32 height, v4l2_std_id tvnorm)
} }
static long video_ioctl_upstream9(struct file *file, unsigned int cmd, static long video_ioctl_upstream9(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct cx25821_fh *fh = file->private_data; struct cx25821_fh *fh = file->private_data;
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev = fh->dev;
...@@ -1732,17 +1732,17 @@ static long video_ioctl_upstream9(struct file *file, unsigned int cmd, ...@@ -1732,17 +1732,17 @@ static long video_ioctl_upstream9(struct file *file, unsigned int cmd,
data_from_user = (struct upstream_user_struct *)arg; data_from_user = (struct upstream_user_struct *)arg;
if (!data_from_user) { if (!data_from_user) {
printk printk
("cx25821 in %s(): Upstream data is INVALID. Returning.\n", ("cx25821 in %s(): Upstream data is INVALID. Returning.\n",
__func__); __func__);
return 0; return 0;
} }
command = data_from_user->command; command = data_from_user->command;
if (command != UPSTREAM_START_VIDEO && if (command != UPSTREAM_START_VIDEO &&
command != UPSTREAM_STOP_VIDEO) command != UPSTREAM_STOP_VIDEO)
return 0; return 0;
dev->input_filename = data_from_user->input_filename; dev->input_filename = data_from_user->input_filename;
dev->input_audiofilename = data_from_user->input_filename; dev->input_audiofilename = data_from_user->input_filename;
...@@ -1753,19 +1753,19 @@ static long video_ioctl_upstream9(struct file *file, unsigned int cmd, ...@@ -1753,19 +1753,19 @@ static long video_ioctl_upstream9(struct file *file, unsigned int cmd,
switch (command) { switch (command) {
case UPSTREAM_START_VIDEO: case UPSTREAM_START_VIDEO:
cx25821_start_upstream_video_ch1(dev, data_from_user); cx25821_start_upstream_video_ch1(dev, data_from_user);
break; break;
case UPSTREAM_STOP_VIDEO: case UPSTREAM_STOP_VIDEO:
cx25821_stop_upstream_video_ch1(dev); cx25821_stop_upstream_video_ch1(dev);
break; break;
} }
return 0; return 0;
} }
static long video_ioctl_upstream10(struct file *file, unsigned int cmd, static long video_ioctl_upstream10(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct cx25821_fh *fh = file->private_data; struct cx25821_fh *fh = file->private_data;
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev = fh->dev;
...@@ -1775,17 +1775,17 @@ static long video_ioctl_upstream10(struct file *file, unsigned int cmd, ...@@ -1775,17 +1775,17 @@ static long video_ioctl_upstream10(struct file *file, unsigned int cmd,
data_from_user = (struct upstream_user_struct *)arg; data_from_user = (struct upstream_user_struct *)arg;
if (!data_from_user) { if (!data_from_user) {
printk printk
("cx25821 in %s(): Upstream data is INVALID. Returning.\n", ("cx25821 in %s(): Upstream data is INVALID. Returning.\n",
__func__); __func__);
return 0; return 0;
} }
command = data_from_user->command; command = data_from_user->command;
if (command != UPSTREAM_START_VIDEO && if (command != UPSTREAM_START_VIDEO &&
command != UPSTREAM_STOP_VIDEO) command != UPSTREAM_STOP_VIDEO)
return 0; return 0;
dev->input_filename_ch2 = data_from_user->input_filename; dev->input_filename_ch2 = data_from_user->input_filename;
dev->input_audiofilename = data_from_user->input_filename; dev->input_audiofilename = data_from_user->input_filename;
...@@ -1796,19 +1796,19 @@ static long video_ioctl_upstream10(struct file *file, unsigned int cmd, ...@@ -1796,19 +1796,19 @@ static long video_ioctl_upstream10(struct file *file, unsigned int cmd,
switch (command) { switch (command) {
case UPSTREAM_START_VIDEO: case UPSTREAM_START_VIDEO:
cx25821_start_upstream_video_ch2(dev, data_from_user); cx25821_start_upstream_video_ch2(dev, data_from_user);
break; break;
case UPSTREAM_STOP_VIDEO: case UPSTREAM_STOP_VIDEO:
cx25821_stop_upstream_video_ch2(dev); cx25821_stop_upstream_video_ch2(dev);
break; break;
} }
return 0; return 0;
} }
static long video_ioctl_upstream11(struct file *file, unsigned int cmd, static long video_ioctl_upstream11(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct cx25821_fh *fh = file->private_data; struct cx25821_fh *fh = file->private_data;
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev = fh->dev;
...@@ -1818,17 +1818,17 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd, ...@@ -1818,17 +1818,17 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd,
data_from_user = (struct upstream_user_struct *)arg; data_from_user = (struct upstream_user_struct *)arg;
if (!data_from_user) { if (!data_from_user) {
printk printk
("cx25821 in %s(): Upstream data is INVALID. Returning.\n", ("cx25821 in %s(): Upstream data is INVALID. Returning.\n",
__func__); __func__);
return 0; return 0;
} }
command = data_from_user->command; command = data_from_user->command;
if (command != UPSTREAM_START_AUDIO && if (command != UPSTREAM_START_AUDIO &&
command != UPSTREAM_STOP_AUDIO) command != UPSTREAM_STOP_AUDIO)
return 0; return 0;
dev->input_filename = data_from_user->input_filename; dev->input_filename = data_from_user->input_filename;
dev->input_audiofilename = data_from_user->input_filename; dev->input_audiofilename = data_from_user->input_filename;
...@@ -1839,19 +1839,19 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd, ...@@ -1839,19 +1839,19 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd,
switch (command) { switch (command) {
case UPSTREAM_START_AUDIO: case UPSTREAM_START_AUDIO:
cx25821_start_upstream_audio(dev, data_from_user); cx25821_start_upstream_audio(dev, data_from_user);
break; break;
case UPSTREAM_STOP_AUDIO: case UPSTREAM_STOP_AUDIO:
cx25821_stop_upstream_audio(dev); cx25821_stop_upstream_audio(dev);
break; break;
} }
return 0; return 0;
} }
static long video_ioctl_set(struct file *file, unsigned int cmd, static long video_ioctl_set(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct cx25821_fh *fh = file->private_data; struct cx25821_fh *fh = file->private_data;
struct cx25821_dev *dev = fh->dev; struct cx25821_dev *dev = fh->dev;
...@@ -1865,101 +1865,101 @@ static long video_ioctl_set(struct file *file, unsigned int cmd, ...@@ -1865,101 +1865,101 @@ static long video_ioctl_set(struct file *file, unsigned int cmd,
data_from_user = (struct downstream_user_struct *)arg; data_from_user = (struct downstream_user_struct *)arg;
if (!data_from_user) { if (!data_from_user) {
printk( printk(
"cx25821 in %s(): User data is INVALID. Returning.\n", "cx25821 in %s(): User data is INVALID. Returning.\n",
__func__); __func__);
return 0; return 0;
} }
command = data_from_user->command; command = data_from_user->command;
if (command != SET_VIDEO_STD && command != SET_PIXEL_FORMAT if (command != SET_VIDEO_STD && command != SET_PIXEL_FORMAT
&& command != ENABLE_CIF_RESOLUTION && command != REG_READ && command != ENABLE_CIF_RESOLUTION && command != REG_READ
&& command != REG_WRITE && command != MEDUSA_READ && command != REG_WRITE && command != MEDUSA_READ
&& command != MEDUSA_WRITE) { && command != MEDUSA_WRITE) {
return 0; return 0;
} }
switch (command) { switch (command) {
case SET_VIDEO_STD: case SET_VIDEO_STD:
dev->tvnorm = dev->tvnorm =
!strcmp(data_from_user->vid_stdname, !strcmp(data_from_user->vid_stdname,
"PAL") ? V4L2_STD_PAL_BG : V4L2_STD_NTSC_M; "PAL") ? V4L2_STD_PAL_BG : V4L2_STD_NTSC_M;
medusa_set_videostandard(dev); medusa_set_videostandard(dev);
break; break;
case SET_PIXEL_FORMAT: case SET_PIXEL_FORMAT:
selected_channel = data_from_user->decoder_select; selected_channel = data_from_user->decoder_select;
pix_format = data_from_user->pixel_format; pix_format = data_from_user->pixel_format;
if (!(selected_channel <= 7 && selected_channel >= 0)) { if (!(selected_channel <= 7 && selected_channel >= 0)) {
selected_channel -= 4; selected_channel -= 4;
selected_channel = selected_channel % 8; selected_channel = selected_channel % 8;
} }
if (selected_channel >= 0) if (selected_channel >= 0)
cx25821_set_pixel_format(dev, selected_channel, cx25821_set_pixel_format(dev, selected_channel,
pix_format); pix_format);
break; break;
case ENABLE_CIF_RESOLUTION: case ENABLE_CIF_RESOLUTION:
selected_channel = data_from_user->decoder_select; selected_channel = data_from_user->decoder_select;
cif_enable = data_from_user->cif_resolution_enable; cif_enable = data_from_user->cif_resolution_enable;
cif_width = data_from_user->cif_width; cif_width = data_from_user->cif_width;
if (cif_enable) { if (cif_enable) {
if (dev->tvnorm & V4L2_STD_PAL_BG if (dev->tvnorm & V4L2_STD_PAL_BG
|| dev->tvnorm & V4L2_STD_PAL_DK) || dev->tvnorm & V4L2_STD_PAL_DK)
width = 352; width = 352;
else else
width = (cif_width == 320 width = (cif_width == 320
|| cif_width == 352) ? cif_width : 320; || cif_width == 352) ? cif_width : 320;
} }
if (!(selected_channel <= 7 && selected_channel >= 0)) { if (!(selected_channel <= 7 && selected_channel >= 0)) {
selected_channel -= 4; selected_channel -= 4;
selected_channel = selected_channel % 8; selected_channel = selected_channel % 8;
} }
if (selected_channel <= 7 && selected_channel >= 0) { if (selected_channel <= 7 && selected_channel >= 0) {
dev->channels[selected_channel]. dev->channels[selected_channel].
use_cif_resolution = cif_enable; use_cif_resolution = cif_enable;
dev->channels[selected_channel].cif_width = width; dev->channels[selected_channel].cif_width = width;
} else { } else {
for (i = 0; i < VID_CHANNEL_NUM; i++) { for (i = 0; i < VID_CHANNEL_NUM; i++) {
dev->channels[i].use_cif_resolution = dev->channels[i].use_cif_resolution =
cif_enable; cif_enable;
dev->channels[i].cif_width = width; dev->channels[i].cif_width = width;
} }
} }
medusa_set_resolution(dev, width, selected_channel); medusa_set_resolution(dev, width, selected_channel);
break; break;
case REG_READ: case REG_READ:
data_from_user->reg_data = cx_read(data_from_user->reg_address); data_from_user->reg_data = cx_read(data_from_user->reg_address);
break; break;
case REG_WRITE: case REG_WRITE:
cx_write(data_from_user->reg_address, data_from_user->reg_data); cx_write(data_from_user->reg_address, data_from_user->reg_data);
break; break;
case MEDUSA_READ: case MEDUSA_READ:
value = value =
cx25821_i2c_read(&dev->i2c_bus[0], cx25821_i2c_read(&dev->i2c_bus[0],
(u16) data_from_user->reg_address, (u16) data_from_user->reg_address,
&data_from_user->reg_data); &data_from_user->reg_data);
break; break;
case MEDUSA_WRITE: case MEDUSA_WRITE:
cx25821_i2c_write(&dev->i2c_bus[0], cx25821_i2c_write(&dev->i2c_bus[0],
(u16) data_from_user->reg_address, (u16) data_from_user->reg_address,
data_from_user->reg_data); data_from_user->reg_data);
break; break;
} }
return 0; return 0;
} }
static long cx25821_video_ioctl(struct file *file, static long cx25821_video_ioctl(struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
int ret = 0; int ret = 0;
...@@ -1967,15 +1967,15 @@ static long cx25821_video_ioctl(struct file *file, ...@@ -1967,15 +1967,15 @@ static long cx25821_video_ioctl(struct file *file,
/* check to see if it's the video upstream */ /* check to see if it's the video upstream */
if (fh->channel_id == SRAM_CH09) { if (fh->channel_id == SRAM_CH09) {
ret = video_ioctl_upstream9(file, cmd, arg); ret = video_ioctl_upstream9(file, cmd, arg);
return ret; return ret;
} else if (fh->channel_id == SRAM_CH10) { } else if (fh->channel_id == SRAM_CH10) {
ret = video_ioctl_upstream10(file, cmd, arg); ret = video_ioctl_upstream10(file, cmd, arg);
return ret; return ret;
} else if (fh->channel_id == SRAM_CH11) { } else if (fh->channel_id == SRAM_CH11) {
ret = video_ioctl_upstream11(file, cmd, arg); ret = video_ioctl_upstream11(file, cmd, arg);
ret = video_ioctl_set(file, cmd, arg); ret = video_ioctl_set(file, cmd, arg);
return ret; return ret;
} }
return video_ioctl2(file, cmd, arg); return video_ioctl2(file, cmd, arg);
...@@ -2036,9 +2036,9 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { ...@@ -2036,9 +2036,9 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = {
}; };
struct video_device cx25821_videoioctl_template = { struct video_device cx25821_videoioctl_template = {
.name = "cx25821-videoioctl", .name = "cx25821-videoioctl",
.fops = &video_fops, .fops = &video_fops,
.ioctl_ops = &video_ioctl_ops, .ioctl_ops = &video_ioctl_ops,
.tvnorms = CX25821_NORMS, .tvnorms = CX25821_NORMS,
.current_norm = V4L2_STD_NTSC_M, .current_norm = V4L2_STD_NTSC_M,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment