diff options
Diffstat (limited to 'linux/drivers')
-rw-r--r-- | linux/drivers/media/video/cafe_ccic.c | 90 | ||||
-rw-r--r-- | linux/drivers/media/video/ov7670.c | 26 |
2 files changed, 58 insertions, 58 deletions
diff --git a/linux/drivers/media/video/cafe_ccic.c b/linux/drivers/media/video/cafe_ccic.c index 02079a003..3a8bbe4d2 100644 --- a/linux/drivers/media/video/cafe_ccic.c +++ b/linux/drivers/media/video/cafe_ccic.c @@ -70,7 +70,7 @@ MODULE_PARM_DESC(alloc_bufs_at_load, "those buffers, but at the cost of nailing down the memory from " "the outset."); -static int n_dma_bufs = 3; +static int n_dma_bufs = 3; module_param(n_dma_bufs, uint, 0644); MODULE_PARM_DESC(n_dma_bufs, "The number of DMA buffers to allocate. Can be either two " @@ -82,7 +82,7 @@ MODULE_PARM_DESC(dma_buf_size, "The size of the allocated DMA buffers. If actual operating " "parameters require larger buffers, an attempt to reallocate " "will be made."); - + static int min_buffers = 1; module_param(min_buffers, uint, 0644); MODULE_PARM_DESC(min_buffers, @@ -131,10 +131,10 @@ struct cafe_sio_buffer { */ struct cafe_camera { - enum cafe_state state; + enum cafe_state state; unsigned long flags; /* Buffer status, mainly (dev_lock) */ int users; /* How many open FDs */ - struct file *owner; /* Who has data access (v4l2) */ + struct file *owner; /* Who has data access (v4l2) */ /* * Subsystem structures. @@ -162,12 +162,12 @@ struct cafe_camera struct cafe_sio_buffer *sb_bufs; /* The array of housekeeping structs */ struct list_head sb_avail; /* Available for data (we own) (dev_lock) */ struct list_head sb_full; /* With data (user space owns) (dev_lock) */ - struct tasklet_struct s_tasklet; + struct tasklet_struct s_tasklet; /* Current operating parameters */ enum v4l2_chip_ident sensor_type; /* Currently ov7670 only */ struct v4l2_pix_format pix_format; - + /* Locks */ struct mutex s_mutex; /* Access to this structure */ spinlock_t dev_lock; /* Access to device */ @@ -198,9 +198,9 @@ struct cafe_camera static void cafe_reset_buffers(struct cafe_camera *cam) { int i; - + cam->next_buf = -1; - for (i = 0; i < cam->nbufs; i++) + for (i = 0; i < cam->nbufs; i++) clear_bit(i, &cam->flags); cam->specframes = 0; } @@ -256,7 +256,7 @@ static void cafe_remove_dev(struct cafe_camera *cam) static struct cafe_camera *cafe_find_dev(int minor) { struct cafe_camera *cam; - + mutex_lock(&cafe_dev_list_lock); list_for_each_entry(cam, &cafe_dev_list, dev_list) { if (cam->v4ldev.minor == minor) @@ -267,12 +267,12 @@ static struct cafe_camera *cafe_find_dev(int minor) mutex_unlock(&cafe_dev_list_lock); return cam; } - + static struct cafe_camera *cafe_find_by_pdev(struct pci_dev *pdev) { struct cafe_camera *cam; - + mutex_lock(&cafe_dev_list_lock); list_for_each_entry(cam, &cafe_dev_list, dev_list) { if (cam->pdev == pdev) @@ -283,7 +283,7 @@ static struct cafe_camera *cafe_find_by_pdev(struct pci_dev *pdev) mutex_unlock(&cafe_dev_list_lock); return cam; } - + /* ------------------------------------------------------------------------ */ /* @@ -375,7 +375,7 @@ static int cafe_smbus_write_data(struct cafe_camera *cam, spin_lock_irqsave(&cam->dev_lock, flags); rval = cafe_reg_read(cam, REG_TWSIC1); spin_unlock_irqrestore(&cam->dev_lock, flags); - + if (rval & TWSIC1_WSTAT) { cam_err(cam, "SMBUS write (%02x/%02x/%02x) timed out\n", addr, command, value); @@ -434,7 +434,7 @@ static int cafe_smbus_read_data(struct cafe_camera *cam, spin_lock_irqsave(&cam->dev_lock, flags); rval = cafe_reg_read(cam, REG_TWSIC1); spin_unlock_irqrestore(&cam->dev_lock, flags); - + if (rval & TWSIC1_ERROR) { cam_err(cam, "SMBUS read (%02x/%02x) error\n", addr, command); return -EIO; @@ -458,7 +458,7 @@ static int cafe_smbus_xfer(struct i2c_adapter *adapter, u16 addr, { struct cafe_camera *cam = i2c_get_adapdata(adapter); int ret = -EINVAL; - + /* * Refuse to talk to anything but OV cam chips. We should * never even see an attempt to do so, but one never knows. @@ -493,7 +493,7 @@ static int cafe_smbus_xfer(struct i2c_adapter *adapter, u16 addr, static void cafe_smbus_enable_irq(struct cafe_camera *cam) { unsigned long flags; - + spin_lock_irqsave(&cam->dev_lock, flags); cafe_reg_set_bit(cam, REG_IRQMASK, TWSIIRQS); spin_unlock_irqrestore(&cam->dev_lock, flags); @@ -590,7 +590,7 @@ static void cafe_ctlr_dma(struct cafe_camera *cam) cafe_reg_set_bit(cam, REG_CTRL1, C1_TWOBUFS); cafe_reg_write(cam, REG_UBAR, 0); /* 32 bits only for now */ } - + static void cafe_ctlr_image(struct cafe_camera *cam) { int imgsz; @@ -607,13 +607,13 @@ static void cafe_ctlr_image(struct cafe_camera *cam) * Tell the controller about the image format we are using. */ switch (cam->pix_format.pixelformat) { - case V4L2_PIX_FMT_YUYV: + case V4L2_PIX_FMT_YUYV: cafe_reg_write_mask(cam, REG_CTRL0, C0_DF_YUV|C0_YUV_PACKED|C0_YUVE_YUYV, C0_DF_MASK); break; - /* + /* * For "fake rgb32" get the image pitch right. */ case V4L2_PIX_FMT_RGB32: @@ -622,12 +622,12 @@ static void cafe_ctlr_image(struct cafe_camera *cam) imgsz = ((fmt->height << IMGSZ_V_SHIFT) & IMGSZ_V_MASK) | ((fmt->bytesperline/2) & IMGSZ_H_MASK); cafe_reg_write(cam, REG_IMGSIZE, imgsz); - /* fall into ... */ + /* fall into ... */ case V4L2_PIX_FMT_RGB444: cafe_reg_write_mask(cam, REG_CTRL0, C0_DF_RGB|C0_RGBF_444|C0_RGB4_XRGB, C0_DF_MASK); - /* Alpha value? */ + /* Alpha value? */ break; case V4L2_PIX_FMT_RGB565: @@ -718,7 +718,7 @@ static void cafe_ctlr_init(struct cafe_camera *cam) cafe_reg_write(cam, REG_GL_CSR, GCSR_CCIC_EN|GCSR_SRC|GCSR_MRC); cafe_reg_set_bit(cam, REG_GL_IMASK, GIMSK_CCIC_EN); /* - * Make sure it's not powered down. + * Make sure it's not powered down. */ cafe_reg_clear_bit(cam, REG_CTRL1, C1_PWRDWN); /* @@ -758,7 +758,7 @@ static void cafe_ctlr_stop_dma(struct cafe_camera *cam) mdelay(1); wait_event_timeout(cam->iowait, !test_bit(CF_DMA_ACTIVE, &cam->flags), HZ); - if (test_bit(CF_DMA_ACTIVE, &cam->flags)) + if (test_bit(CF_DMA_ACTIVE, &cam->flags)) cam_err(cam, "Timeout waiting for DMA to end\n"); /* This would be bad news - what now? */ spin_lock_irqsave(&cam->dev_lock, flags); @@ -796,7 +796,7 @@ static void cafe_ctlr_power_down(struct cafe_camera *cam) cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C1); cafe_reg_set_bit(cam, REG_CTRL1, C1_PWRDWN); spin_unlock_irqrestore(&cam->dev_lock, flags); -} +} /* -------------------------------------------------------------------- */ /* @@ -873,12 +873,12 @@ static int cafe_cam_configure(struct cafe_camera *cam) { struct v4l2_format fmt; int ret, zero = 0; - + if (cam->state != S_IDLE) return -EINVAL; fmt.fmt.pix = cam->pix_format; ret = __cafe_cam_cmd(cam, VIDIOC_INT_INIT, &zero); - if (ret == 0) + if (ret == 0) ret = __cafe_cam_cmd(cam, VIDIOC_S_FMT, &fmt); /* * OV7670 does weird things if flip is set *before* format... @@ -901,7 +901,7 @@ static int cafe_alloc_dma_bufs(struct cafe_camera *cam, int loadtime) int i; cafe_set_config_needed(cam, 1); - if (loadtime) + if (loadtime) cam->dma_buf_size = dma_buf_size; else { cam->dma_buf_size = cam->pix_format.sizeimage; @@ -941,7 +941,7 @@ static int cafe_alloc_dma_bufs(struct cafe_camera *cam, int loadtime) } return 0; } - + static void cafe_free_dma_bufs(struct cafe_camera *cam) { int i; @@ -964,7 +964,7 @@ static void cafe_free_dma_bufs(struct cafe_camera *cam) */ /* - * Read an image from the device. + * Read an image from the device. */ static ssize_t cafe_deliver_buffer(struct cafe_camera *cam, char __user *buffer, size_t len, loff_t *pos) @@ -989,11 +989,11 @@ static ssize_t cafe_deliver_buffer(struct cafe_camera *cam, if (len > cam->pix_format.sizeimage) len = cam->pix_format.sizeimage; - if (copy_to_user(buffer, cam->dma_bufs[bufno], len)) + if (copy_to_user(buffer, cam->dma_bufs[bufno], len)) return -EFAULT; (*pos) += len; return len; -} +} /* * Get everything ready, and start grabbing frames. @@ -1002,12 +1002,12 @@ static int cafe_read_setup(struct cafe_camera *cam, enum cafe_state state) { int ret; unsigned long flags; - + /* * Configuration. If we still don't have DMA buffers, * make one last, desperate attempt. */ - if (cam->nbufs == 0) + if (cam->nbufs == 0) if (cafe_alloc_dma_bufs(cam, 0)) return -ENOMEM; @@ -1036,7 +1036,7 @@ static ssize_t cafe_v4l_read(struct file *filp, { struct cafe_camera *cam = filp->private_data; int ret; - + /* * Perhaps we're in speculative read mode and already * have data? @@ -1156,7 +1156,7 @@ static int cafe_vidioc_streamoff(struct file *filp, void *priv, static int cafe_setup_siobuf(struct cafe_camera *cam, int index) { struct cafe_sio_buffer *buf = cam->sb_bufs + index; - + INIT_LIST_HEAD(&buf->list); buf->v4lbuf.length = PAGE_ALIGN(cam->pix_format.sizeimage); buf->buffer = vmalloc_user(buf->v4lbuf.length); @@ -1439,7 +1439,7 @@ static int cafe_v4l_mmap(struct file *filp, struct vm_area_struct *vma) mutex_unlock(&cam->s_mutex); return ret; } - + static int cafe_v4l_open(struct inode *inode, struct file *filp) @@ -1467,7 +1467,7 @@ static int cafe_v4l_open(struct inode *inode, struct file *filp) static int cafe_v4l_release(struct inode *inode, struct file *filp) { struct cafe_camera *cam = filp->private_data; - + mutex_lock(&cam->s_mutex); (cam->users)--; if (filp == cam->owner) { @@ -1501,7 +1501,7 @@ static int cafe_vidioc_queryctrl(struct file *filp, void *priv, { struct cafe_camera *cam = filp->private_data; int ret; - + mutex_lock(&cam->s_mutex); ret = __cafe_cam_cmd(cam, VIDIOC_QUERYCTRL, qc); mutex_unlock(&cam->s_mutex); @@ -1514,7 +1514,7 @@ static int cafe_vidioc_g_ctrl(struct file *filp, void *priv, { struct cafe_camera *cam = filp->private_data; int ret; - + mutex_lock(&cam->s_mutex); ret = __cafe_cam_cmd(cam, VIDIOC_G_CTRL, ctrl); mutex_unlock(&cam->s_mutex); @@ -1527,7 +1527,7 @@ static int cafe_vidioc_s_ctrl(struct file *filp, void *priv, { struct cafe_camera *cam = filp->private_data; int ret; - + mutex_lock(&cam->s_mutex); ret = __cafe_cam_cmd(cam, VIDIOC_S_CTRL, ctrl); mutex_unlock(&cam->s_mutex); @@ -1643,7 +1643,7 @@ static int cafe_vidioc_g_fmt_cap(struct file *filp, void *priv, struct v4l2_format *f) { struct cafe_camera *cam = priv; - + f->fmt.pix = cam->pix_format; return 0; } @@ -1847,7 +1847,7 @@ static void cafe_frame_complete(struct cafe_camera *cam, int frame) * Basic frame housekeeping. */ if (test_bit(frame, &cam->flags) && printk_ratelimit()) - cam_err(cam, "Frame overrun on %d, frames lost\n", frame); + cam_err(cam, "Frame overrun on %d, frames lost\n", frame); set_bit(frame, &cam->flags); clear_bit(CF_DMA_ACTIVE, &cam->flags); if (cam->next_buf < 0) @@ -1863,7 +1863,7 @@ static void cafe_frame_complete(struct cafe_camera *cam, int frame) cam->specframes = 0; wake_up(&cam->iowait); break; - + /* * If we are already doing speculative reads, and nobody is * reading them, just stop. @@ -1995,7 +1995,7 @@ static ssize_t cafe_dfs_read_regs(struct file *file, return simple_read_from_buffer(buf, count, ppos, cafe_debug_buf, s - cafe_debug_buf); } - + static struct file_operations cafe_dfs_reg_ops = { .owner = THIS_MODULE, .read = cafe_dfs_read_regs, @@ -2186,7 +2186,7 @@ static void cafe_shutdown(struct cafe_camera *cam) video_unregister_device(&cam->v4ldev); /* kfree(cam); done in v4l_release () */ } - + static void cafe_pci_remove(struct pci_dev *pdev) { diff --git a/linux/drivers/media/video/ov7670.c b/linux/drivers/media/video/ov7670.c index f7f340858..26397cdb3 100644 --- a/linux/drivers/media/video/ov7670.c +++ b/linux/drivers/media/video/ov7670.c @@ -196,7 +196,7 @@ static struct regval_list ov7670_default_regs[] = { { 0x70, 0x3a }, { 0x71, 0x35 }, { 0x72, 0x11 }, { 0x73, 0xf0 }, { 0xa2, 0x02 }, { REG_COM10, 0x0 }, - + /* Gamma curve values */ { 0x7a, 0x20 }, { 0x7b, 0x10 }, { 0x7c, 0x1e }, { 0x7d, 0x35 }, @@ -221,7 +221,7 @@ static struct regval_list ov7670_default_regs[] = { { REG_HAECC5, 0xf0 }, { REG_HAECC6, 0x90 }, { REG_HAECC7, 0x94 }, { REG_COM8, COM8_FASTAEC|COM8_AECSTEP|COM8_BFILT|COM8_AGC|COM8_AEC }, - + /* Almost all of these are magic "reserved" values. */ { REG_COM5, 0x61 }, { REG_COM6, 0x4b }, { 0x16, 0x02 }, { REG_MVFP, 0x07|MVFP_MIRROR }, @@ -257,7 +257,7 @@ static struct regval_list ov7670_default_regs[] = { { 0x51, 0 }, { 0x52, 0x22 }, { 0x53, 0x5e }, { 0x54, 0x80 }, { 0x58, 0x9e }, - + { REG_COM16, COM16_AWBGAIN }, { REG_EDGE, 0 }, { 0x75, 0x05 }, { 0x76, 0xe1 }, { 0x4c, 0 }, { 0x77, 0x01 }, @@ -605,7 +605,7 @@ static int ov7670_set_hw(struct i2c_client *client, int hstart, int hstop, static int ov7670_enum_fmt(struct i2c_client *c, struct v4l2_fmtdesc *fmt) { struct ov7670_format_struct *ofmt; - + if (fmt->index >= N_OV7670_FMTS) return -EINVAL; @@ -644,7 +644,7 @@ static int ov7670_try_fmt(struct i2c_client *c, struct v4l2_format *fmt, * we support, but not below the smallest. */ for (wsize = ov7670_win_sizes; wsize < ov7670_win_sizes + N_WIN_SIZES; - wsize++) + wsize++) if (pix->width >= wsize->width && pix->height >= wsize->height) break; if (wsize > ov7670_win_sizes + N_WIN_SIZES) @@ -723,7 +723,7 @@ static int ov7670_t_brightness(struct i2c_client *client, unsigned char value) { unsigned char com8; int ret; - + ov7670_read(client, REG_COM8, &com8); com8 &= ~COM8_AEC; ov7670_write(client, REG_COM8, com8); @@ -847,7 +847,7 @@ static struct ov7670_control { .minimum = 0, .maximum = 1, .step = 1, - .default_value = 0, + .default_value = 0, }, .tweak = ov7670_t_vflip, .query = ov7670_q_vflip, @@ -860,7 +860,7 @@ static struct ov7670_control { .minimum = 0, .maximum = 1, .step = 1, - .default_value = 0, + .default_value = 0, }, .tweak = ov7670_t_hflip, .query = ov7670_q_hflip, @@ -895,7 +895,7 @@ static int ov7670_g_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) struct ov7670_control *octrl = ov7670_find_control(ctrl->id); int ret; unsigned char v; - + if (octrl == NULL) return -EINVAL; ret = octrl->query(client, &v); @@ -909,7 +909,7 @@ static int ov7670_g_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) static int ov7670_s_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) { struct ov7670_control *octrl = ov7670_find_control(ctrl->id); - + if (octrl == NULL) return -EINVAL; return octrl->tweak(client, ctrl->value); @@ -930,7 +930,7 @@ static int ov7670_attach(struct i2c_adapter *adapter) { int ret; struct i2c_client *client; - + printk(KERN_ERR "ov7670 attach, id = %d\n", adapter->id); /* * For now: only deal with adapters we recognize. @@ -990,11 +990,11 @@ static int ov7670_command(struct i2c_client *client, unsigned int cmd, case VIDIOC_ENUM_FMT: return ov7670_enum_fmt(client, (struct v4l2_fmtdesc *) arg); case VIDIOC_TRY_FMT: - return ov7670_try_fmt(client, (struct v4l2_format *) arg, NULL, NULL); + return ov7670_try_fmt(client, (struct v4l2_format *) arg, NULL, NULL); case VIDIOC_S_FMT: return ov7670_s_fmt(client, (struct v4l2_format *) arg); case VIDIOC_QUERYCTRL: - return ov7670_queryctrl(client, (struct v4l2_queryctrl *) arg); + return ov7670_queryctrl(client, (struct v4l2_queryctrl *) arg); case VIDIOC_S_CTRL: return ov7670_s_ctrl(client, (struct v4l2_control *) arg); case VIDIOC_G_CTRL: |