summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/cafe_ccic.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/cafe_ccic.c')
-rw-r--r--linux/drivers/media/video/cafe_ccic.c90
1 files changed, 45 insertions, 45 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)
{