From 3e9442c6f1d50bce083c5870f293647efbd6f828 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Sun, 4 Jul 2010 15:37:05 -0300 Subject: [PATCH] V4L/DVB: cx25821: Fix bad whitespacing Should use tabs for identation, and not whitespace Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/cx25821/Makefile | 8 +- .../staging/cx25821/cx25821-audio-upstream.c | 12 +- drivers/staging/cx25821/cx25821-core.c | 48 +- .../staging/cx25821/cx25821-medusa-video.c | 4 +- .../cx25821/cx25821-video-upstream-ch2.c | 56 +- .../staging/cx25821/cx25821-video-upstream.c | 78 +-- drivers/staging/cx25821/cx25821-video.c | 642 +++++++++--------- 7 files changed, 424 insertions(+), 424 deletions(-) diff --git a/drivers/staging/cx25821/Makefile b/drivers/staging/cx25821/Makefile index 877d9a4fa6a7..d0eb16eac092 100644 --- a/drivers/staging/cx25821/Makefile +++ b/drivers/staging/cx25821/Makefile @@ -1,8 +1,8 @@ cx25821-objs := cx25821-core.o cx25821-cards.o cx25821-i2c.o \ - cx25821-gpio.o cx25821-medusa-video.o \ - cx25821-video.o cx25821-video-upstream.o \ - cx25821-video-upstream-ch2.o \ - cx25821-audio-upstream.o + cx25821-gpio.o cx25821-medusa-video.o \ + cx25821-video.o cx25821-video-upstream.o \ + cx25821-video-upstream-ch2.o \ + cx25821-audio-upstream.o obj-$(CONFIG_VIDEO_CX25821) += cx25821.o obj-$(CONFIG_VIDEO_CX25821_ALSA) += cx25821-alsa.o diff --git a/drivers/staging/cx25821/cx25821-audio-upstream.c b/drivers/staging/cx25821/cx25821-audio-upstream.c index 8d03768ea09a..cdff49f409f2 100644 --- a/drivers/staging/cx25821/cx25821-audio-upstream.c +++ b/drivers/staging/cx25821/cx25821-audio-upstream.c @@ -106,7 +106,7 @@ static __le32 *cx25821_risc_field_upstream_audio(struct cx25821_dev *dev, { unsigned int line; 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; /* scan lines */ @@ -217,7 +217,7 @@ void cx25821_free_memory_audio(struct cx25821_dev *dev) void cx25821_stop_upstream_audio(struct cx25821_dev *dev) { 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; if (!dev->_audio_is_running) { @@ -353,9 +353,9 @@ static void cx25821_audioups_handler(struct work_struct *work) } cx25821_get_audio_data(dev, - dev->channels[dev-> - _audio_upstream_channel_select]. - sram_channels); + dev->channels[dev-> + _audio_upstream_channel_select]. + sram_channels); } int cx25821_openfile_audio(struct cx25821_dev *dev, @@ -609,7 +609,7 @@ static irqreturn_t cx25821_upstream_irq_audio(int irq, void *dev_id) return -1; sram_ch = dev->channels[dev->_audio_upstream_channel_select]. - sram_channels; + sram_channels; msk_stat = cx_read(sram_ch->int_mstat); audio_status = cx_read(sram_ch->int_stat); diff --git a/drivers/staging/cx25821/cx25821-core.c b/drivers/staging/cx25821/cx25821-core.c index 0963d5745b50..be44195783d4 100644 --- a/drivers/staging/cx25821/cx25821-core.c +++ b/drivers/staging/cx25821/cx25821-core.c @@ -781,14 +781,14 @@ static void cx25821_shutdown(struct cx25821_dev *dev) /* Disable Video A/B activity */ 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->int_msk, 0); + cx_write(dev->channels[i].sram_channels->dma_ctl, 0); + cx_write(dev->channels[i].sram_channels->int_msk, 0); } for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J; i++) { - 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->dma_ctl, 0); + cx_write(dev->channels[i].sram_channels->int_msk, 0); } /* Disable Audio activity */ @@ -806,9 +806,9 @@ void cx25821_set_pixel_format(struct cx25821_dev *dev, int channel_select, u32 format) { if (channel_select <= 7 && channel_select >= 0) { - cx_write(dev->channels[channel_select]. - sram_channels->pix_frmt, format); - dev->channels[channel_select].pixel_formats = format; + cx_write(dev->channels[channel_select]. + sram_channels->pix_frmt, format); + dev->channels[channel_select].pixel_formats = format; } } @@ -829,7 +829,7 @@ static void cx25821_initialize(struct cx25821_dev *dev) cx_write(PCI_INT_STAT, 0xffffffff); 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_B_INT_STAT, 0xffffffff); @@ -843,22 +843,22 @@ static void cx25821_initialize(struct cx25821_dev *dev) mdelay(100); for (i = 0; i < VID_CHANNEL_NUM; i++) { - cx25821_set_vip_mode(dev, dev->channels[i].sram_channels); - cx25821_sram_channel_setup(dev, dev->channels[i].sram_channels, - 1440, 0); - dev->channels[i].pixel_formats = PIXEL_FRMT_422; - dev->channels[i].use_cif_resolution = FALSE; + cx25821_set_vip_mode(dev, dev->channels[i].sram_channels); + cx25821_sram_channel_setup(dev, dev->channels[i].sram_channels, + 1440, 0); + dev->channels[i].pixel_formats = PIXEL_FRMT_422; + dev->channels[i].use_cif_resolution = FALSE; } /* Probably only affect Downstream */ for (i = VID_UPSTREAM_SRAM_CHANNEL_I; i <= VID_UPSTREAM_SRAM_CHANNEL_J; 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, - dev->channels[SRAM_CH08].sram_channels, - 128, 0); + dev->channels[SRAM_CH08].sram_channels, + 128, 0); cx25821_gpio_init(dev); } @@ -932,7 +932,7 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) /* Apply a sensible clock frequency for the PCIe bridge */ dev->clk_freq = 28000000; 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) CX25821_INFO("dev->nr > 1!"); @@ -1004,22 +1004,22 @@ static int cx25821_dev_setup(struct cx25821_dev *dev) cx25821_card_setup(dev); if (medusa_video_init(dev) < 0) - CX25821_ERR("%s() Failed to initialize medusa!\n" - , __func__); + CX25821_ERR("%s() Failed to initialize medusa!\n" + , __func__); cx25821_video_register(dev); /* register IOCTL device */ dev->ioctl_dev = - cx25821_vdev_init(dev, dev->pci, &cx25821_videoioctl_template, + cx25821_vdev_init(dev, dev->pci, &cx25821_videoioctl_template, "video"); if (video_register_device (dev->ioctl_dev, VFL_TYPE_GRABBER, VIDEO_IOCTL_CH) < 0) { cx25821_videoioctl_unregister(dev); printk(KERN_ERR - "%s() Failed to register video adapter for IOCTL, so \ - unregistering videoioctl device.\n", __func__); + "%s() Failed to register video adapter for IOCTL, so \ + unregistering videoioctl device.\n", __func__); } cx25821_dev_checkrevision(dev); @@ -1342,8 +1342,8 @@ static irqreturn_t cx25821_irq(int irq, void *dev_id) for (i = 0; i < VID_CHANNEL_NUM; i++) { if (pci_status & mask[i]) { - vid_status = cx_read(dev->channels[i]. - sram_channels->int_stat); + vid_status = cx_read(dev->channels[i]. + sram_channels->int_stat); if (vid_status) handled += diff --git a/drivers/staging/cx25821/cx25821-medusa-video.c b/drivers/staging/cx25821/cx25821-medusa-video.c index 09fd1196f626..ef9f2b82a860 100644 --- a/drivers/staging/cx25821/cx25821-medusa-video.c +++ b/drivers/staging/cx25821/cx25821-medusa-video.c @@ -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 &= 0x83FFFFFF; ret_val = - cx25821_i2c_write(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, - value | 0x10000000); + cx25821_i2c_write(&dev->i2c_bus[0], AFE_AB_DIAG_CTRL, + value | 0x10000000); if (ret_val < 0) goto error; diff --git a/drivers/staging/cx25821/cx25821-video-upstream-ch2.c b/drivers/staging/cx25821/cx25821-video-upstream-ch2.c index af47ec4f96db..d12dbb572e8b 100644 --- a/drivers/staging/cx25821/cx25821-video-upstream-ch2.c +++ b/drivers/staging/cx25821/cx25821-video-upstream-ch2.c @@ -84,7 +84,7 @@ static __le32 *cx25821_risc_field_upstream_ch2(struct cx25821_dev *dev, { unsigned int line, i; 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; /* sync instruction */ @@ -110,11 +110,11 @@ static __le32 *cx25821_risc_field_upstream_ch2(struct cx25821_dev *dev, offset += dist_betwn_starts; } - /* - check if we need to enable the FIFO after the first 4 lines - For the upstream video channel, the risc engine will enable - the FIFO. - */ + /* + check if we need to enable the FIFO after the first 4 lines + For the upstream video channel, the risc engine will enable + the FIFO. + */ if (fifo_enable && line == 3) { *(rp++) = RISC_WRITECR; *(rp++) = sram_ch->dma_ctl; @@ -177,7 +177,7 @@ int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev, fifo_enable = FIFO_DISABLE; - /* Even field */ + /* Even field */ rp = cx25821_risc_field_upstream_ch2(dev, rp, dev-> _data_buf_phys_addr_ch2 + @@ -195,10 +195,10 @@ int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev, risc_phys_jump_addr = dev->_dma_phys_start_addr_ch2; } - /* - Loop to 2ndFrameRISC or to Start of - Risc program & generate IRQ - */ + /* + Loop to 2ndFrameRISC or to Start of + Risc program & generate IRQ + */ *(rp++) = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | risc_flag); *(rp++) = cpu_to_le32(risc_phys_jump_addr); *(rp++) = cpu_to_le32(0); @@ -210,7 +210,7 @@ int cx25821_risc_buffer_upstream_ch2(struct cx25821_dev *dev, void cx25821_stop_upstream_video_ch2(struct cx25821_dev *dev) { 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; if (!dev->_is_running_ch2) { @@ -377,8 +377,8 @@ static void cx25821_vidups_handler_ch2(struct work_struct *work) } cx25821_get_frame_ch2(dev, - dev->channels[dev-> - _channel2_upstream_select].sram_channels); + dev->channels[dev-> + _channel2_upstream_select].sram_channels); } 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, __le32 *rp; 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); - /* - 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 + */ int_msk_tmp = cx_read(channel->int_msk); cx_write(channel->int_msk, int_msk_tmp & ~_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, FIFO_DISABLE, 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_phys_jump_addr); *(rp++) = cpu_to_le32(0); @@ -668,8 +668,8 @@ static void cx25821_set_pixelengine_ch2(struct cx25821_dev *dev, cx_write(ch->vid_fmt_ctl, value); /* - set number of active pixels in each line. Default is 720 - pixels in both NTSC and PAL format + set number of active pixels in each line. Default is 720 + pixels in both NTSC and PAL format */ cx_write(ch->vid_active_ctl1, width); @@ -695,15 +695,15 @@ int cx25821_start_video_dma_upstream_ch2(struct cx25821_dev *dev, int err = 0; /* - 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface - for channel A-C + 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface + for channel A-C */ tmp = cx_read(VID_CH_MODE_SEL); cx_write(VID_CH_MODE_SEL, tmp | 0x1B0001FF); /* - 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->_dma_phys_addr_ch2); 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, return -ENOMEM; } /* - 656/VIP SRC Upstream Channel I & J and 7 - - Host Bus Interface for channel A-C + 656/VIP SRC Upstream Channel I & J and 7 - + Host Bus Interface for channel A-C */ tmp = cx_read(VID_CH_MODE_SEL); cx_write(VID_CH_MODE_SEL, tmp | 0x1B0001FF); diff --git a/drivers/staging/cx25821/cx25821-video-upstream.c b/drivers/staging/cx25821/cx25821-video-upstream.c index 386debf39556..756a820a76cb 100644 --- a/drivers/staging/cx25821/cx25821-video-upstream.c +++ b/drivers/staging/cx25821/cx25821-video-upstream.c @@ -134,7 +134,7 @@ static __le32 *cx25821_risc_field_upstream(struct cx25821_dev *dev, __le32 * rp, { unsigned int line, i; 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; /* sync instruction */ @@ -253,7 +253,7 @@ int cx25821_risc_buffer_upstream(struct cx25821_dev *dev, void cx25821_stop_upstream_video_ch1(struct cx25821_dev *dev) { 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; if (!dev->_is_running) { @@ -346,23 +346,23 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch) if (IS_ERR(myfile)) { const int open_errno = -PTR_ERR(myfile); - printk(KERN_ERR - "%s(): ERROR opening file(%s) with errno = %d!\n", - __func__, dev->_filename, open_errno); + printk(KERN_ERR + "%s(): ERROR opening file(%s) with errno = %d!\n", + __func__, dev->_filename, open_errno); return PTR_ERR(myfile); } else { if (!(myfile->f_op)) { - printk(KERN_ERR - "%s: File has no file operations registered!", - __func__); + printk(KERN_ERR + "%s: File has no file operations registered!", + __func__); filp_close(myfile, NULL); return -EIO; } if (!myfile->f_op->read) { - printk(KERN_ERR - "%s: File has no READ operations registered!", - __func__); + printk(KERN_ERR + "%s: File has no READ operations registered!", + __func__); filp_close(myfile, NULL); return -EIO; } @@ -389,8 +389,8 @@ int cx25821_get_frame(struct cx25821_dev *dev, struct sram_channel *sram_ch) if (vfs_read_retval < line_size) { printk(KERN_INFO - "Done: exit %s() since no more bytes to \ - read from Video file.\n", + "Done: exit %s() since no more bytes to \ + read from Video file.\n", __func__); break; } @@ -415,15 +415,15 @@ static void cx25821_vidups_handler(struct work_struct *work) container_of(work, struct cx25821_dev, _irq_work_entry); if (!dev) { - printk(KERN_ERR - "ERROR %s(): since container_of(work_struct) FAILED!\n", - __func__); + printk(KERN_ERR + "ERROR %s(): since container_of(work_struct) FAILED!\n", + __func__); return; } cx25821_get_frame(dev, - dev->channels[dev->_channel_upstream_select]. - sram_channels); + dev->channels[dev->_channel_upstream_select]. + sram_channels); } 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)) { 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); return PTR_ERR(myfile); } else { if (!(myfile->f_op)) { - printk(KERN_ERR - "%s: File has no file operations registered!", - __func__); + printk(KERN_ERR + "%s: File has no file operations registered!", + __func__); filp_close(myfile, NULL); return -EIO; } if (!myfile->f_op->read) { - printk(KERN_ERR - "%s: File has no READ operations registered! \ - Returning.", + printk(KERN_ERR + "%s: File has no READ operations registered! \ + Returning.", __func__); filp_close(myfile, NULL); return -EIO; @@ -488,8 +488,8 @@ int cx25821_openfile(struct cx25821_dev *dev, struct sram_channel *sram_ch) if (vfs_read_retval < line_size) { printk(KERN_INFO - "Done: exit %s() since no more \ - bytes to read from Video file.\n", + "Done: exit %s() since no more \ + bytes to read from Video file.\n", __func__); break; } @@ -535,8 +535,8 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, if (!dev->_dma_virt_addr) { printk - (KERN_ERR "cx25821: FAILED to allocate memory for Risc \ - buffer! Returning.\n"); + (KERN_ERR "cx25821: FAILED to allocate memory for Risc \ + buffer! Returning.\n"); return -ENOMEM; } @@ -557,8 +557,8 @@ int cx25821_upstream_buffer_prepare(struct cx25821_dev *dev, if (!dev->_data_buf_virt_addr) { printk - (KERN_ERR "cx25821: FAILED to allocate memory for data \ - buffer! Returning.\n"); + (KERN_ERR "cx25821: FAILED to allocate memory for data \ + buffer! Returning.\n"); return -ENOMEM; } @@ -653,16 +653,16 @@ int cx25821_video_upstream_irq(struct cx25821_dev *dev, int chan_num, } else { if (status & FLD_VID_SRC_UF) printk - (KERN_ERR "%s: Video Received Underflow Error \ - Interrupt!\n", __func__); + (KERN_ERR "%s: Video Received Underflow Error \ + Interrupt!\n", __func__); if (status & FLD_VID_SRC_SYNC) - printk(KERN_ERR "%s: Video Received Sync Error \ - Interrupt!\n", __func__); + printk(KERN_ERR "%s: Video Received Sync Error \ + Interrupt!\n", __func__); if (status & FLD_VID_SRC_OPC_ERR) - printk(KERN_ERR "%s: Video Received OpCode Error \ - Interrupt!\n", __func__); + printk(KERN_ERR "%s: Video Received OpCode Error \ + Interrupt!\n", __func__); } if (dev->_file_status == END_OF_FILE) { @@ -818,8 +818,8 @@ int cx25821_vidupstream_init_ch1(struct cx25821_dev *dev, int channel_select, if (!dev->_irq_queues) { printk - (KERN_ERR "cx25821: create_singlethread_workqueue() for \ - Video FAILED!\n"); + (KERN_ERR "cx25821: create_singlethread_workqueue() for \ + Video FAILED!\n"); return -ENOMEM; } /* 656/VIP SRC Upstream Channel I & J and 7 - Host Bus Interface for diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c index 90210b775c98..1d5e8796d383 100644 --- a/drivers/staging/cx25821/cx25821-video.c +++ b/drivers/staging/cx25821/cx25821-video.c @@ -410,8 +410,8 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status) if (status & FLD_VID_DST_RISC1) { spin_lock(&dev->slock); count = cx_read(channel->gpcnt); - cx25821_video_wakeup(dev, - &dev->channels[channel->i].vidq, count); + cx25821_video_wakeup(dev, + &dev->channels[channel->i].vidq, count); spin_unlock(&dev->slock); handled++; } @@ -420,9 +420,9 @@ int cx25821_video_irq(struct cx25821_dev *dev, int chan_num, u32 status) if (status & 0x10) { dprintk(2, "stopper video\n"); spin_lock(&dev->slock); - cx25821_restart_video_queue(dev, - &dev->channels[channel->i].vidq, - channel); + cx25821_restart_video_queue(dev, + &dev->channels[channel->i].vidq, + channel); spin_unlock(&dev->slock); handled++; } @@ -446,17 +446,17 @@ void cx25821_video_unregister(struct cx25821_dev *dev, int chan_num) cx_clear(PCI_INT_MSK, 1); if (dev->channels[chan_num].video_dev) { - if (video_is_registered(dev->channels[chan_num].video_dev)) - video_unregister_device( - dev->channels[chan_num].video_dev); + if (video_is_registered(dev->channels[chan_num].video_dev)) + video_unregister_device( + dev->channels[chan_num].video_dev); else - video_device_release( - dev->channels[chan_num].video_dev); + video_device_release( + 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, - &dev->channels[chan_num].vidq.stopper); + btcx_riscmem_free(dev->pci, + &dev->channels[chan_num].vidq.stopper); printk(KERN_WARNING "device %d released!\n", chan_num); } @@ -469,52 +469,52 @@ int cx25821_video_register(struct cx25821_dev *dev) int i; struct video_device cx25821_video_device = { - .name = "cx25821-video", - .fops = &video_fops, - .minor = -1, - .ioctl_ops = &video_ioctl_ops, - .tvnorms = CX25821_NORMS, - .current_norm = V4L2_STD_NTSC_M, + .name = "cx25821-video", + .fops = &video_fops, + .minor = -1, + .ioctl_ops = &video_ioctl_ops, + .tvnorms = CX25821_NORMS, + .current_norm = V4L2_STD_NTSC_M, }; spin_lock_init(&dev->slock); 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, - &dev->channels[i].vidq.stopper, - dev->channels[i].sram_channels->dma_ctl, - 0x11, 0); + cx25821_risc_stopper(dev->pci, + &dev->channels[i].vidq.stopper, + dev->channels[i].sram_channels->dma_ctl, + 0x11, 0); - dev->channels[i].sram_channels = &cx25821_sram_channels[i]; - dev->channels[i].video_dev = NULL; - dev->channels[i].resources = 0; + dev->channels[i].sram_channels = &cx25821_sram_channels[i]; + dev->channels[i].video_dev = NULL; + dev->channels[i].resources = 0; - cx_write(dev->channels[i].sram_channels->int_stat, - 0xffffffff); + cx_write(dev->channels[i].sram_channels->int_stat, + 0xffffffff); - INIT_LIST_HEAD(&dev->channels[i].vidq.active); - INIT_LIST_HEAD(&dev->channels[i].vidq.queued); + INIT_LIST_HEAD(&dev->channels[i].vidq.active); + INIT_LIST_HEAD(&dev->channels[i].vidq.queued); - dev->channels[i].timeout_data.dev = dev; - dev->channels[i].timeout_data.channel = - &cx25821_sram_channels[i]; - dev->channels[i].vidq.timeout.function = - cx25821_vid_timeout; - dev->channels[i].vidq.timeout.data = - (unsigned long)&dev->channels[i].timeout_data; - init_timer(&dev->channels[i].vidq.timeout); + dev->channels[i].timeout_data.dev = dev; + dev->channels[i].timeout_data.channel = + &cx25821_sram_channels[i]; + dev->channels[i].vidq.timeout.function = + cx25821_vid_timeout; + dev->channels[i].vidq.timeout.data = + (unsigned long)&dev->channels[i].timeout_data; + init_timer(&dev->channels[i].vidq.timeout); - /* register v4l devices */ - dev->channels[i].video_dev = cx25821_vdev_init(dev, - dev->pci, &cx25821_video_device, "video"); + /* register v4l devices */ + dev->channels[i].video_dev = cx25821_vdev_init(dev, + dev->pci, &cx25821_video_device, "video"); - err = video_register_device(dev->channels[i].video_dev, - VFL_TYPE_GRABBER, video_nr[dev->nr]); + err = video_register_device(dev->channels[i].video_dev, + VFL_TYPE_GRABBER, video_nr[dev->nr]); - if (err < 0) - goto fail_unreg; + if (err < 0) + goto fail_unreg; } @@ -603,29 +603,29 @@ int cx25821_buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, channel_opened = (channel_opened < 0 || channel_opened > 7) ? 7 : channel_opened; - if (dev->channels[channel_opened] - .pixel_formats == PIXEL_FRMT_411) + if (dev->channels[channel_opened] + .pixel_formats == PIXEL_FRMT_411) buf->bpl = (buf->fmt->depth * buf->vb.width) >> 3; else buf->bpl = (buf->fmt->depth >> 3) * (buf->vb.width); - if (dev->channels[channel_opened] - .pixel_formats == PIXEL_FRMT_411) { + if (dev->channels[channel_opened] + .pixel_formats == PIXEL_FRMT_411) { bpl_local = buf->bpl; } else { - bpl_local = buf->bpl; /* Default */ + bpl_local = buf->bpl; /* Default */ if (channel_opened >= 0 && channel_opened <= 7) { - if (dev->channels[channel_opened] - .use_cif_resolution) { + if (dev->channels[channel_opened] + .use_cif_resolution) { if (dev->tvnorm & V4L2_STD_PAL_BG || dev->tvnorm & V4L2_STD_PAL_DK) bpl_local = 352 << 1; else bpl_local = - dev->channels[channel_opened]. - cif_width << - 1; + dev->channels[channel_opened]. + cif_width << + 1; } } } @@ -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) { struct cx25821_buffer *buf = - container_of(vb, struct cx25821_buffer, vb); + container_of(vb, struct cx25821_buffer, vb); struct cx25821_buffer *prev; struct cx25821_fh *fh = vq->priv_data; struct cx25821_dev *dev = fh->dev; @@ -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]); if (!list_empty(&q->queued)) { - list_add_tail(&buf->vb.queue, &q->queued); - buf->vb.state = VIDEOBUF_QUEUED; - dprintk(2, "[%p/%d] buffer_queue - append to queued\n", buf, - buf->vb.i); + list_add_tail(&buf->vb.queue, &q->queued); + buf->vb.state = VIDEOBUF_QUEUED; + dprintk(2, "[%p/%d] buffer_queue - append to queued\n", buf, + buf->vb.i); } else if (list_empty(&q->active)) { - list_add_tail(&buf->vb.queue, &q->active); - cx25821_start_video_dma(dev, q, buf, - dev->channels[fh->channel_id]. - sram_channels); - buf->vb.state = VIDEOBUF_ACTIVE; - buf->count = q->count++; - mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); - dprintk(2, - "[%p/%d] buffer_queue - first active, buf cnt = %d, \ - q->count = %d\n", - buf, buf->vb.i, buf->count, q->count); + list_add_tail(&buf->vb.queue, &q->active); + cx25821_start_video_dma(dev, q, buf, + dev->channels[fh->channel_id]. + sram_channels); + buf->vb.state = VIDEOBUF_ACTIVE; + buf->count = q->count++; + mod_timer(&q->timeout, jiffies + BUFFER_TIMEOUT); + dprintk(2, + "[%p/%d] buffer_queue - first active, buf cnt = %d, \ + q->count = %d\n", + buf, buf->vb.i, buf->count, q->count); } else { - prev = - list_entry(q->active.prev, struct cx25821_buffer, vb.queue); - if (prev->vb.width == buf->vb.width - && prev->vb.height == buf->vb.height - && prev->fmt == buf->fmt) { - list_add_tail(&buf->vb.queue, &q->active); - buf->vb.state = VIDEOBUF_ACTIVE; - buf->count = q->count++; - prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); - - /* 64 bit bits 63-32 */ - prev->risc.jmp[2] = cpu_to_le32(0); - dprintk(2, - "[%p/%d] buffer_queue - append to active, \ - buf->count=%d\n", - buf, buf->vb.i, buf->count); - - } else { - list_add_tail(&buf->vb.queue, &q->queued); - buf->vb.state = VIDEOBUF_QUEUED; - dprintk(2, "[%p/%d] buffer_queue - first queued\n", buf, - buf->vb.i); - } + prev = + list_entry(q->active.prev, struct cx25821_buffer, vb.queue); + if (prev->vb.width == buf->vb.width + && prev->vb.height == buf->vb.height + && prev->fmt == buf->fmt) { + list_add_tail(&buf->vb.queue, &q->active); + buf->vb.state = VIDEOBUF_ACTIVE; + buf->count = q->count++; + prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); + + /* 64 bit bits 63-32 */ + prev->risc.jmp[2] = cpu_to_le32(0); + dprintk(2, + "[%p/%d] buffer_queue - append to active, \ + buf->count=%d\n", + buf, buf->vb.i, buf->count); + + } else { + list_add_tail(&buf->vb.queue, &q->queued); + buf->vb.state = VIDEOBUF_QUEUED; + dprintk(2, "[%p/%d] buffer_queue - first queued\n", buf, + buf->vb.i); + } } 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 = { @@ -804,33 +804,33 @@ static int video_open(struct file *file) int i; dprintk(1, "open dev=%s type=%s\n", - video_device_node_name(vdev), - v4l2_type_names[type]); + video_device_node_name(vdev), + v4l2_type_names[type]); /* allocate + initialize per filehandle data */ fh = kzalloc(sizeof(*fh), GFP_KERNEL); if (NULL == fh) - return -ENOMEM; + return -ENOMEM; lock_kernel(); list_for_each(list, &cx25821_devlist) { - h = list_entry(list, struct cx25821_dev, devlist); - - for (i = 0; i < MAX_VID_CHANNEL_NUM; i++) { - if (h->channels[i].video_dev && - h->channels[i].video_dev->minor == minor) { - dev = h; - ch_id = i; - type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - } - } + h = list_entry(list, struct cx25821_dev, devlist); + + for (i = 0; i < MAX_VID_CHANNEL_NUM; i++) { + if (h->channels[i].video_dev && + h->channels[i].video_dev->minor == minor) { + dev = h; + ch_id = i; + type = V4L2_BUF_TYPE_VIDEO_CAPTURE; + } + } } if (NULL == dev) { - unlock_kernel(); - return -ENODEV; + unlock_kernel(); + return -ENODEV; } file->private_data = fh; @@ -840,23 +840,23 @@ static int video_open(struct file *file) fh->channel_id = ch_id; if (dev->tvnorm & V4L2_STD_PAL_BG || dev->tvnorm & V4L2_STD_PAL_DK) - fh->height = 576; + fh->height = 576; else - fh->height = 480; + fh->height = 480; dev->channel_opened = fh->channel_id; pix_format = - (dev->channels[ch_id].pixel_formats == - PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV; + (dev->channels[ch_id].pixel_formats == + PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV; fh->fmt = format_by_fourcc(pix_format); v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio); videobuf_queue_sg_init(&fh->vidq, &cx25821_video_qops, - &dev->pci->dev, &dev->slock, - V4L2_BUF_TYPE_VIDEO_CAPTURE, - V4L2_FIELD_INTERLACED, - sizeof(struct cx25821_buffer), fh); + &dev->pci->dev, &dev->slock, + V4L2_BUF_TYPE_VIDEO_CAPTURE, + V4L2_FIELD_INTERLACED, + sizeof(struct cx25821_buffer), fh); dprintk(1, "post videobuf_queue_init()\n"); unlock_kernel(); @@ -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, - loff_t *ppos) + loff_t *ppos) { struct cx25821_fh *fh = file->private_data; switch (fh->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: - if (cx25821_res_locked(fh, RESOURCE_VIDEO0)) - return -EBUSY; + if (cx25821_res_locked(fh, RESOURCE_VIDEO0)) + return -EBUSY; - return videobuf_read_one(&fh->vidq, data, count, ppos, - file->f_flags & O_NONBLOCK); + return videobuf_read_one(&fh->vidq, data, count, ppos, + file->f_flags & O_NONBLOCK); default: - BUG(); - return 0; + BUG(); + return 0; } } 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_buffer *buf; if (cx25821_res_check(fh, RESOURCE_VIDEO0)) { - /* streaming capture */ - if (list_empty(&fh->vidq.stream)) - return POLLERR; - buf = list_entry(fh->vidq.stream.next, - struct cx25821_buffer, vb.stream); + /* streaming capture */ + if (list_empty(&fh->vidq.stream)) + return POLLERR; + buf = list_entry(fh->vidq.stream.next, + struct cx25821_buffer, vb.stream); } else { - /* read() capture */ - buf = (struct cx25821_buffer *)fh->vidq.read_buf; - if (NULL == buf) - return POLLERR; + /* read() capture */ + buf = (struct cx25821_buffer *)fh->vidq.read_buf; + if (NULL == buf) + return POLLERR; } poll_wait(file, &buf->vb.done, wait); if (buf->vb.state == VIDEOBUF_DONE || buf->vb.state == VIDEOBUF_ERROR) { - if (buf->vb.state == VIDEOBUF_DONE) { - struct cx25821_dev *dev = fh->dev; - - if (dev && dev->channels[fh->channel_id] - .use_cif_resolution) { - u8 cam_id = *((char *)buf->vb.baddr + 3); - memcpy((char *)buf->vb.baddr, - (char *)buf->vb.baddr + (fh->width * 2), - (fh->width * 2)); - *((char *)buf->vb.baddr + 3) = cam_id; - } - } - - return POLLIN | POLLRDNORM; + if (buf->vb.state == VIDEOBUF_DONE) { + struct cx25821_dev *dev = fh->dev; + + if (dev && dev->channels[fh->channel_id] + .use_cif_resolution) { + u8 cam_id = *((char *)buf->vb.baddr + 3); + memcpy((char *)buf->vb.baddr, + (char *)buf->vb.baddr + (fh->width * 2), + (fh->width * 2)); + *((char *)buf->vb.baddr + 3) = cam_id; + } + } + + return POLLIN | POLLRDNORM; } return 0; @@ -933,13 +933,13 @@ static int video_release(struct file *file) /* stop video capture */ if (cx25821_res_check(fh, RESOURCE_VIDEO0)) { - videobuf_queue_cancel(&fh->vidq); - cx25821_res_free(dev, fh, RESOURCE_VIDEO0); + videobuf_queue_cancel(&fh->vidq); + cx25821_res_free(dev, fh, RESOURCE_VIDEO0); } if (fh->vidq.read_buf) { - cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); - kfree(fh->vidq.read_buf); + cx25821_buffer_release(&fh->vidq, fh->vidq.read_buf); + kfree(fh->vidq.read_buf); } videobuf_mmap_free(&fh->vidq); @@ -957,14 +957,14 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) struct cx25821_dev *dev = fh->dev; if (unlikely(fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)) - return -EINVAL; + return -EINVAL; if (unlikely(i != fh->type)) - return -EINVAL; + return -EINVAL; if (unlikely(!cx25821_res_get(dev, fh, - cx25821_get_resource(fh, RESOURCE_VIDEO0)))) - return -EBUSY; + cx25821_get_resource(fh, RESOURCE_VIDEO0)))) + return -EBUSY; return videobuf_streamon(get_queue(fh)); } @@ -976,20 +976,20 @@ static int vidioc_streamoff(struct file *file, void *priv, enum v4l2_buf_type i) int err, res; if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) - return -EINVAL; + return -EINVAL; if (i != fh->type) - return -EINVAL; + return -EINVAL; res = cx25821_get_resource(fh, RESOURCE_VIDEO0); err = videobuf_streamoff(get_queue(fh)); if (err < 0) - return err; + return err; cx25821_res_free(dev, fh, res); return 0; } 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_dev *dev = ((struct cx25821_fh *)priv)->dev; @@ -997,48 +997,48 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, int pix_format = PIXEL_FRMT_422; if (fh) { - err = v4l2_prio_check(&dev->channels[fh->channel_id] - .prio, fh->prio); - if (0 != err) - return err; + err = v4l2_prio_check(&dev->channels[fh->channel_id] + .prio, fh->prio); + if (0 != err) + return err; } dprintk(2, "%s()\n", __func__); err = cx25821_vidioc_try_fmt_vid_cap(file, priv, f); if (0 != err) - return err; + return err; fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat); fh->vidq.field = f->fmt.pix.field; /* check if width and height is valid based on set standard */ 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)) - fh->height = f->fmt.pix.height; + fh->height = f->fmt.pix.height; 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) - pix_format = PIXEL_FRMT_422; + pix_format = PIXEL_FRMT_422; else - return -EINVAL; + return -EINVAL; cx25821_set_pixel_format(dev, SRAM_CH00, pix_format); /* check if cif resolution */ 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 - 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; medusa_set_resolution(dev, fh->width, SRAM_CH00); 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); return 0; @@ -1064,33 +1064,33 @@ static int vidioc_log_status(struct file *file, void *priv) char name[32 + 2]; struct sram_channel *sram_ch = dev->channels[fh->channel_id] - .sram_channels; + .sram_channels; u32 tmp = 0; snprintf(name, sizeof(name), "%s/2", dev->name); printk(KERN_INFO "%s/2: ============ START LOG STATUS ============\n", - dev->name); + dev->name); cx25821_call_all(dev, core, log_status); tmp = cx_read(sram_ch->dma_ctl); 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", - dev->name); + dev->name); return 0; } 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_dev *dev = ((struct cx25821_fh *)priv)->dev; int err; if (fh) { - err = v4l2_prio_check(&dev->channels[fh->channel_id] - .prio, fh->prio); - if (0 != err) - return err; + err = v4l2_prio_check(&dev->channels[fh->channel_id] + .prio, fh->prio); + if (0 != err) + return err; } 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 struct cx25821_dev *dev = ((struct cx25821_fh *)f)->dev; return v4l2_prio_change(&dev->channels[fh->channel_id] - .prio, &fh->prio, prio); + .prio, &fh->prio, prio); } #ifdef TUNER_FLAG @@ -1259,8 +1259,8 @@ int cx25821_vidioc_s_std(struct file *file, void *priv, v4l2_std_id * tvnorms) dprintk(1, "%s()\n", __func__); if (fh) { - err = v4l2_prio_check(&dev->channels[fh->channel_id] - .prio, fh->prio); + err = v4l2_prio_check(&dev->channels[fh->channel_id] + .prio, fh->prio); if (0 != err) return err; } @@ -1330,8 +1330,8 @@ int cx25821_vidioc_s_input(struct file *file, void *priv, unsigned int i) dprintk(1, "%s(%d)\n", __func__, i); if (fh) { - err = v4l2_prio_check(&dev->channels[fh->channel_id] - .prio, fh->prio); + err = v4l2_prio_check(&dev->channels[fh->channel_id] + .prio, fh->prio); if (0 != err) return err; } @@ -1382,14 +1382,14 @@ int cx25821_vidioc_s_frequency(struct file *file, void *priv, struct v4l2_freque int err; if (fh) { - dev = fh->dev; - err = v4l2_prio_check(&dev->channels[fh->channel_id] - .prio, fh->prio); + dev = fh->dev; + err = v4l2_prio_check(&dev->channels[fh->channel_id] + .prio, fh->prio); if (0 != err) return err; } else { - printk(KERN_ERR "Invalid fh pointer!\n"); - return -EINVAL; + printk(KERN_ERR "Invalid fh pointer!\n"); + return -EINVAL; } return cx25821_set_freq(dev, f); @@ -1451,8 +1451,8 @@ int cx25821_vidioc_s_tuner(struct file *file, void *priv, struct v4l2_tuner *t) int err; if (fh) { - err = v4l2_prio_check(&dev->channels[fh->channel_id] - .prio, fh->prio); + err = v4l2_prio_check(&dev->channels[fh->channel_id] + .prio, fh->prio); if (0 != err) return err; } @@ -1560,16 +1560,16 @@ int cx25821_vidioc_g_ctrl(struct file *file, void *priv, struct v4l2_control *ct return -EINVAL; switch (ctl->id) { case V4L2_CID_BRIGHTNESS: - ctl->value = dev->channels[fh->channel_id].ctl_bright; + ctl->value = dev->channels[fh->channel_id].ctl_bright; break; case V4L2_CID_HUE: - ctl->value = dev->channels[fh->channel_id].ctl_hue; + ctl->value = dev->channels[fh->channel_id].ctl_hue; break; case V4L2_CID_CONTRAST: - ctl->value = dev->channels[fh->channel_id].ctl_contrast; + ctl->value = dev->channels[fh->channel_id].ctl_contrast; break; case V4L2_CID_SATURATION: - ctl->value = dev->channels[fh->channel_id].ctl_saturation; + ctl->value = dev->channels[fh->channel_id].ctl_saturation; break; } return 0; @@ -1603,19 +1603,19 @@ int cx25821_set_control(struct cx25821_dev *dev, switch (ctl->id) { 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); break; 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); break; 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); break; 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); break; } @@ -1661,8 +1661,8 @@ int cx25821_vidioc_s_crop(struct file *file, void *priv, struct v4l2_crop *crop) int err; if (fh) { - err = v4l2_prio_check(&dev->channels[fh->channel_id]. - prio, fh->prio); + err = v4l2_prio_check(&dev->channels[fh->channel_id]. + prio, fh->prio); if (0 != err) return err; } @@ -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, - unsigned long arg) + unsigned long arg) { struct cx25821_fh *fh = file->private_data; struct cx25821_dev *dev = fh->dev; @@ -1732,17 +1732,17 @@ static long video_ioctl_upstream9(struct file *file, unsigned int cmd, data_from_user = (struct upstream_user_struct *)arg; if (!data_from_user) { - printk - ("cx25821 in %s(): Upstream data is INVALID. Returning.\n", - __func__); - return 0; + printk + ("cx25821 in %s(): Upstream data is INVALID. Returning.\n", + __func__); + return 0; } command = data_from_user->command; if (command != UPSTREAM_START_VIDEO && - command != UPSTREAM_STOP_VIDEO) - return 0; + command != UPSTREAM_STOP_VIDEO) + return 0; dev->input_filename = 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, switch (command) { case UPSTREAM_START_VIDEO: - cx25821_start_upstream_video_ch1(dev, data_from_user); - break; + cx25821_start_upstream_video_ch1(dev, data_from_user); + break; case UPSTREAM_STOP_VIDEO: - cx25821_stop_upstream_video_ch1(dev); - break; + cx25821_stop_upstream_video_ch1(dev); + break; } return 0; } 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_dev *dev = fh->dev; @@ -1775,17 +1775,17 @@ static long video_ioctl_upstream10(struct file *file, unsigned int cmd, data_from_user = (struct upstream_user_struct *)arg; if (!data_from_user) { - printk - ("cx25821 in %s(): Upstream data is INVALID. Returning.\n", - __func__); - return 0; + printk + ("cx25821 in %s(): Upstream data is INVALID. Returning.\n", + __func__); + return 0; } command = data_from_user->command; if (command != UPSTREAM_START_VIDEO && - command != UPSTREAM_STOP_VIDEO) - return 0; + command != UPSTREAM_STOP_VIDEO) + return 0; dev->input_filename_ch2 = 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, switch (command) { case UPSTREAM_START_VIDEO: - cx25821_start_upstream_video_ch2(dev, data_from_user); - break; + cx25821_start_upstream_video_ch2(dev, data_from_user); + break; case UPSTREAM_STOP_VIDEO: - cx25821_stop_upstream_video_ch2(dev); - break; + cx25821_stop_upstream_video_ch2(dev); + break; } return 0; } 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_dev *dev = fh->dev; @@ -1818,17 +1818,17 @@ static long video_ioctl_upstream11(struct file *file, unsigned int cmd, data_from_user = (struct upstream_user_struct *)arg; if (!data_from_user) { - printk - ("cx25821 in %s(): Upstream data is INVALID. Returning.\n", - __func__); - return 0; + printk + ("cx25821 in %s(): Upstream data is INVALID. Returning.\n", + __func__); + return 0; } command = data_from_user->command; if (command != UPSTREAM_START_AUDIO && - command != UPSTREAM_STOP_AUDIO) - return 0; + command != UPSTREAM_STOP_AUDIO) + return 0; dev->input_filename = 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, switch (command) { case UPSTREAM_START_AUDIO: - cx25821_start_upstream_audio(dev, data_from_user); - break; + cx25821_start_upstream_audio(dev, data_from_user); + break; case UPSTREAM_STOP_AUDIO: - cx25821_stop_upstream_audio(dev); - break; + cx25821_stop_upstream_audio(dev); + break; } return 0; } 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_dev *dev = fh->dev; @@ -1865,101 +1865,101 @@ static long video_ioctl_set(struct file *file, unsigned int cmd, data_from_user = (struct downstream_user_struct *)arg; if (!data_from_user) { - printk( - "cx25821 in %s(): User data is INVALID. Returning.\n", - __func__); - return 0; + printk( + "cx25821 in %s(): User data is INVALID. Returning.\n", + __func__); + return 0; } command = data_from_user->command; if (command != SET_VIDEO_STD && command != SET_PIXEL_FORMAT - && command != ENABLE_CIF_RESOLUTION && command != REG_READ - && command != REG_WRITE && command != MEDUSA_READ - && command != MEDUSA_WRITE) { - return 0; + && command != ENABLE_CIF_RESOLUTION && command != REG_READ + && command != REG_WRITE && command != MEDUSA_READ + && command != MEDUSA_WRITE) { + return 0; } switch (command) { case SET_VIDEO_STD: - dev->tvnorm = - !strcmp(data_from_user->vid_stdname, - "PAL") ? V4L2_STD_PAL_BG : V4L2_STD_NTSC_M; - medusa_set_videostandard(dev); - break; + dev->tvnorm = + !strcmp(data_from_user->vid_stdname, + "PAL") ? V4L2_STD_PAL_BG : V4L2_STD_NTSC_M; + medusa_set_videostandard(dev); + break; case SET_PIXEL_FORMAT: - selected_channel = data_from_user->decoder_select; - pix_format = data_from_user->pixel_format; + selected_channel = data_from_user->decoder_select; + pix_format = data_from_user->pixel_format; - if (!(selected_channel <= 7 && selected_channel >= 0)) { - selected_channel -= 4; - selected_channel = selected_channel % 8; - } + if (!(selected_channel <= 7 && selected_channel >= 0)) { + selected_channel -= 4; + selected_channel = selected_channel % 8; + } - if (selected_channel >= 0) - cx25821_set_pixel_format(dev, selected_channel, - pix_format); + if (selected_channel >= 0) + cx25821_set_pixel_format(dev, selected_channel, + pix_format); - break; + break; case ENABLE_CIF_RESOLUTION: - selected_channel = data_from_user->decoder_select; - cif_enable = data_from_user->cif_resolution_enable; - cif_width = data_from_user->cif_width; - - if (cif_enable) { - if (dev->tvnorm & V4L2_STD_PAL_BG - || dev->tvnorm & V4L2_STD_PAL_DK) - width = 352; - else - width = (cif_width == 320 - || cif_width == 352) ? cif_width : 320; - } - - if (!(selected_channel <= 7 && selected_channel >= 0)) { - selected_channel -= 4; - selected_channel = selected_channel % 8; - } - - if (selected_channel <= 7 && selected_channel >= 0) { - dev->channels[selected_channel]. - use_cif_resolution = cif_enable; - dev->channels[selected_channel].cif_width = width; - } else { - for (i = 0; i < VID_CHANNEL_NUM; i++) { - dev->channels[i].use_cif_resolution = - cif_enable; - dev->channels[i].cif_width = width; - } - } - - medusa_set_resolution(dev, width, selected_channel); - break; + selected_channel = data_from_user->decoder_select; + cif_enable = data_from_user->cif_resolution_enable; + cif_width = data_from_user->cif_width; + + if (cif_enable) { + if (dev->tvnorm & V4L2_STD_PAL_BG + || dev->tvnorm & V4L2_STD_PAL_DK) + width = 352; + else + width = (cif_width == 320 + || cif_width == 352) ? cif_width : 320; + } + + if (!(selected_channel <= 7 && selected_channel >= 0)) { + selected_channel -= 4; + selected_channel = selected_channel % 8; + } + + if (selected_channel <= 7 && selected_channel >= 0) { + dev->channels[selected_channel]. + use_cif_resolution = cif_enable; + dev->channels[selected_channel].cif_width = width; + } else { + for (i = 0; i < VID_CHANNEL_NUM; i++) { + dev->channels[i].use_cif_resolution = + cif_enable; + dev->channels[i].cif_width = width; + } + } + + medusa_set_resolution(dev, width, selected_channel); + break; case REG_READ: - data_from_user->reg_data = cx_read(data_from_user->reg_address); - break; + data_from_user->reg_data = cx_read(data_from_user->reg_address); + break; case REG_WRITE: - cx_write(data_from_user->reg_address, data_from_user->reg_data); - break; + cx_write(data_from_user->reg_address, data_from_user->reg_data); + break; case MEDUSA_READ: - value = - cx25821_i2c_read(&dev->i2c_bus[0], - (u16) data_from_user->reg_address, - &data_from_user->reg_data); - break; + value = + cx25821_i2c_read(&dev->i2c_bus[0], + (u16) data_from_user->reg_address, + &data_from_user->reg_data); + break; case MEDUSA_WRITE: - cx25821_i2c_write(&dev->i2c_bus[0], - (u16) data_from_user->reg_address, - data_from_user->reg_data); - break; + cx25821_i2c_write(&dev->i2c_bus[0], + (u16) data_from_user->reg_address, + data_from_user->reg_data); + break; } return 0; } static long cx25821_video_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) + unsigned int cmd, unsigned long arg) { int ret = 0; @@ -1967,15 +1967,15 @@ static long cx25821_video_ioctl(struct file *file, /* check to see if it's the video upstream */ if (fh->channel_id == SRAM_CH09) { - ret = video_ioctl_upstream9(file, cmd, arg); - return ret; + ret = video_ioctl_upstream9(file, cmd, arg); + return ret; } else if (fh->channel_id == SRAM_CH10) { - ret = video_ioctl_upstream10(file, cmd, arg); - return ret; + ret = video_ioctl_upstream10(file, cmd, arg); + return ret; } else if (fh->channel_id == SRAM_CH11) { - ret = video_ioctl_upstream11(file, cmd, arg); - ret = video_ioctl_set(file, cmd, arg); - return ret; + ret = video_ioctl_upstream11(file, cmd, arg); + ret = video_ioctl_set(file, cmd, arg); + return ret; } return video_ioctl2(file, cmd, arg); @@ -2036,9 +2036,9 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { }; struct video_device cx25821_videoioctl_template = { - .name = "cx25821-videoioctl", - .fops = &video_fops, - .ioctl_ops = &video_ioctl_ops, - .tvnorms = CX25821_NORMS, - .current_norm = V4L2_STD_NTSC_M, + .name = "cx25821-videoioctl", + .fops = &video_fops, + .ioctl_ops = &video_ioctl_ops, + .tvnorms = CX25821_NORMS, + .current_norm = V4L2_STD_NTSC_M, }; -- 2.30.2