V4L/DVB: w9966: remove camelCase
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
271922c0ce
commit
c1f2b0f29e
1 changed files with 164 additions and 164 deletions
|
@ -152,13 +152,13 @@ static struct w9966_dev w9966_cams[W9966_MAXCAMS];
|
|||
|
||||
|
||||
/* Set camera phase flags, so we know what to uninit when terminating */
|
||||
static inline void w9966_setState(struct w9966_dev *cam, int mask, int val)
|
||||
static inline void w9966_set_state(struct w9966_dev *cam, int mask, int val)
|
||||
{
|
||||
cam->dev_state = (cam->dev_state & ~mask) ^ val;
|
||||
}
|
||||
|
||||
/* Get camera phase flags */
|
||||
static inline int w9966_getState(struct w9966_dev *cam, int mask, int val)
|
||||
static inline int w9966_get_state(struct w9966_dev *cam, int mask, int val)
|
||||
{
|
||||
return ((cam->dev_state & mask) == val);
|
||||
}
|
||||
|
@ -166,25 +166,25 @@ static inline int w9966_getState(struct w9966_dev *cam, int mask, int val)
|
|||
/* Claim parport for ourself */
|
||||
static void w9966_pdev_claim(struct w9966_dev *cam)
|
||||
{
|
||||
if (w9966_getState(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED))
|
||||
if (w9966_get_state(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED))
|
||||
return;
|
||||
parport_claim_or_block(cam->pdev);
|
||||
w9966_setState(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED);
|
||||
w9966_set_state(cam, W9966_STATE_CLAIMED, W9966_STATE_CLAIMED);
|
||||
}
|
||||
|
||||
/* Release parport for others to use */
|
||||
static void w9966_pdev_release(struct w9966_dev *cam)
|
||||
{
|
||||
if (w9966_getState(cam, W9966_STATE_CLAIMED, 0))
|
||||
if (w9966_get_state(cam, W9966_STATE_CLAIMED, 0))
|
||||
return;
|
||||
parport_release(cam->pdev);
|
||||
w9966_setState(cam, W9966_STATE_CLAIMED, 0);
|
||||
w9966_set_state(cam, W9966_STATE_CLAIMED, 0);
|
||||
}
|
||||
|
||||
/* Read register from W9966 interface-chip
|
||||
Expects a claimed pdev
|
||||
-1 on error, else register data (byte) */
|
||||
static int w9966_rReg(struct w9966_dev *cam, int reg)
|
||||
static int w9966_read_reg(struct w9966_dev *cam, int reg)
|
||||
{
|
||||
/* ECP, read, regtransfer, REG, REG, REG, REG, REG */
|
||||
const unsigned char addr = 0x80 | (reg & 0x1f);
|
||||
|
@ -205,7 +205,7 @@ static int w9966_rReg(struct w9966_dev *cam, int reg)
|
|||
/* Write register to W9966 interface-chip
|
||||
Expects a claimed pdev
|
||||
-1 on error */
|
||||
static int w9966_wReg(struct w9966_dev *cam, int reg, int data)
|
||||
static int w9966_write_reg(struct w9966_dev *cam, int reg, int data)
|
||||
{
|
||||
/* ECP, write, regtransfer, REG, REG, REG, REG, REG */
|
||||
const unsigned char addr = 0xc0 | (reg & 0x1f);
|
||||
|
@ -236,7 +236,7 @@ static void w9966_i2c_setsda(struct w9966_dev *cam, int state)
|
|||
else
|
||||
cam->i2c_state &= ~W9966_I2C_W_DATA;
|
||||
|
||||
w9966_wReg(cam, 0x18, cam->i2c_state);
|
||||
w9966_write_reg(cam, 0x18, cam->i2c_state);
|
||||
udelay(5);
|
||||
}
|
||||
|
||||
|
@ -244,7 +244,7 @@ static void w9966_i2c_setsda(struct w9966_dev *cam, int state)
|
|||
Expects a claimed pdev. */
|
||||
static int w9966_i2c_getscl(struct w9966_dev *cam)
|
||||
{
|
||||
const unsigned char state = w9966_rReg(cam, 0x18);
|
||||
const unsigned char state = w9966_read_reg(cam, 0x18);
|
||||
return ((state & W9966_I2C_R_CLOCK) > 0);
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ static int w9966_i2c_setscl(struct w9966_dev *cam, int state)
|
|||
else
|
||||
cam->i2c_state &= ~W9966_I2C_W_CLOCK;
|
||||
|
||||
w9966_wReg(cam, 0x18, cam->i2c_state);
|
||||
w9966_write_reg(cam, 0x18, cam->i2c_state);
|
||||
udelay(5);
|
||||
|
||||
/* we go to high, we also expect the peripheral to ack. */
|
||||
|
@ -278,7 +278,7 @@ static int w9966_i2c_setscl(struct w9966_dev *cam, int state)
|
|||
Expects a claimed pdev. */
|
||||
static int w9966_i2c_getsda(struct w9966_dev *cam)
|
||||
{
|
||||
const unsigned char state = w9966_rReg(cam, 0x18);
|
||||
const unsigned char state = w9966_read_reg(cam, 0x18);
|
||||
return ((state & W9966_I2C_R_DATA) > 0);
|
||||
}
|
||||
#endif
|
||||
|
@ -332,7 +332,7 @@ static int w9966_i2c_rbyte(struct w9966_dev *cam)
|
|||
/* Read a register from the i2c device.
|
||||
Expects claimed pdev. -1 on error */
|
||||
#if 0
|
||||
static int w9966_rReg_i2c(struct w9966_dev *cam, int reg)
|
||||
static int w9966_read_reg_i2c(struct w9966_dev *cam, int reg)
|
||||
{
|
||||
int data;
|
||||
|
||||
|
@ -367,7 +367,7 @@ static int w9966_rReg_i2c(struct w9966_dev *cam, int reg)
|
|||
|
||||
/* Write a register to the i2c device.
|
||||
Expects claimed pdev. -1 on error */
|
||||
static int w9966_wReg_i2c(struct w9966_dev *cam, int reg, int data)
|
||||
static int w9966_write_reg_i2c(struct w9966_dev *cam, int reg, int data)
|
||||
{
|
||||
w9966_i2c_setsda(cam, 0);
|
||||
w9966_i2c_setscl(cam, 0);
|
||||
|
@ -489,7 +489,7 @@ static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, in
|
|||
enh_s = 0;
|
||||
enh_e = w * h * 2;
|
||||
|
||||
/* Modify capture window if necessary and calculate downscaling */
|
||||
/* Modify capture window if necessary and calculate downscaling */
|
||||
if (w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 ||
|
||||
w9966_calcscale(h, W9966_WND_MIN_Y, W9966_WND_MAX_Y, &y1, &y2, &scale_y) != 0)
|
||||
return -1;
|
||||
|
@ -497,7 +497,7 @@ static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, in
|
|||
DPRINTF("%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n",
|
||||
w, h, x1, x2, y1, y2, scale_x & ~0x80, scale_y & ~0x80);
|
||||
|
||||
/* Setup registers */
|
||||
/* Setup registers */
|
||||
regs[0x00] = 0x00; /* Set normal operation */
|
||||
regs[0x01] = 0x18; /* Capture mode */
|
||||
regs[0x02] = scale_y; /* V-scaling */
|
||||
|
@ -536,18 +536,18 @@ static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, in
|
|||
saa7111_regs[0x0c] = cam->color;
|
||||
saa7111_regs[0x0d] = cam->hue;
|
||||
|
||||
/* Reset (ECP-fifo & serial-bus) */
|
||||
if (w9966_wReg(cam, 0x00, 0x03) == -1)
|
||||
/* Reset (ECP-fifo & serial-bus) */
|
||||
if (w9966_write_reg(cam, 0x00, 0x03) == -1)
|
||||
return -1;
|
||||
|
||||
/* Write regs to w9966cf chip */
|
||||
/* Write regs to w9966cf chip */
|
||||
for (i = 0; i < 0x1c; i++)
|
||||
if (w9966_wReg(cam, i, regs[i]) == -1)
|
||||
if (w9966_write_reg(cam, i, regs[i]) == -1)
|
||||
return -1;
|
||||
|
||||
/* Write regs to saa7111 chip */
|
||||
/* Write regs to saa7111 chip */
|
||||
for (i = 0; i < 0x20; i++)
|
||||
if (w9966_wReg_i2c(cam, i, saa7111_regs[i]) == -1)
|
||||
if (w9966_write_reg_i2c(cam, i, saa7111_regs[i]) == -1)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
|
@ -644,10 +644,10 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg)
|
|||
w9966_pdev_claim(cam);
|
||||
|
||||
if (
|
||||
w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 ||
|
||||
w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 ||
|
||||
w9966_wReg_i2c(cam, 0x0c, cam->color) == -1 ||
|
||||
w9966_wReg_i2c(cam, 0x0d, cam->hue) == -1
|
||||
w9966_write_reg_i2c(cam, 0x0a, cam->brightness) == -1 ||
|
||||
w9966_write_reg_i2c(cam, 0x0b, cam->contrast) == -1 ||
|
||||
w9966_write_reg_i2c(cam, 0x0c, cam->color) == -1 ||
|
||||
w9966_write_reg_i2c(cam, 0x0d, cam->hue) == -1
|
||||
) {
|
||||
w9966_pdev_release(cam);
|
||||
return -EIO;
|
||||
|
@ -727,9 +727,9 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
|
|||
return -EINVAL;
|
||||
|
||||
w9966_pdev_claim(cam);
|
||||
w9966_wReg(cam, 0x00, 0x02); /* Reset ECP-FIFO buffer */
|
||||
w9966_wReg(cam, 0x00, 0x00); /* Return to normal operation */
|
||||
w9966_wReg(cam, 0x01, 0x98); /* Enable capture */
|
||||
w9966_write_reg(cam, 0x00, 0x02); /* Reset ECP-FIFO buffer */
|
||||
w9966_write_reg(cam, 0x00, 0x00); /* Return to normal operation */
|
||||
w9966_write_reg(cam, 0x01, 0x98); /* Enable capture */
|
||||
|
||||
/* write special capture-addr and negotiate into data transfer */
|
||||
if ((parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0) ||
|
||||
|
@ -760,7 +760,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
|
|||
dleft -= tsize;
|
||||
}
|
||||
|
||||
w9966_wReg(cam, 0x01, 0x18); /* Disable capture */
|
||||
w9966_write_reg(cam, 0x01, 0x18); /* Disable capture */
|
||||
|
||||
out:
|
||||
kfree(tbuf);
|
||||
|
@ -814,7 +814,7 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
|
|||
cam->color = 64;
|
||||
cam->hue = 0;
|
||||
|
||||
/* Select requested transfer mode */
|
||||
/* Select requested transfer mode */
|
||||
switch (parmode) {
|
||||
default: /* Auto-detect (priority: hw-ecp, hw-epp, sw-ecp) */
|
||||
case 0:
|
||||
|
@ -833,17 +833,17 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
|
|||
break;
|
||||
}
|
||||
|
||||
/* Tell the parport driver that we exists */
|
||||
/* Tell the parport driver that we exists */
|
||||
cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL);
|
||||
if (cam->pdev == NULL) {
|
||||
DPRINTF("parport_register_device() failed\n");
|
||||
return -1;
|
||||
}
|
||||
w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV);
|
||||
w9966_set_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV);
|
||||
|
||||
w9966_pdev_claim(cam);
|
||||
|
||||
/* Setup a default capture mode */
|
||||
/* Setup a default capture mode */
|
||||
if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) {
|
||||
DPRINTF("w9966_setup() failed.\n");
|
||||
return -1;
|
||||
|
@ -851,14 +851,14 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
|
|||
|
||||
w9966_pdev_release(cam);
|
||||
|
||||
/* Fill in the video_device struct and register us to v4l */
|
||||
/* Fill in the video_device struct and register us to v4l */
|
||||
memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device));
|
||||
video_set_drvdata(&cam->vdev, cam);
|
||||
|
||||
if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0)
|
||||
return -1;
|
||||
|
||||
w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV);
|
||||
w9966_set_state(cam, W9966_STATE_VDEV, W9966_STATE_VDEV);
|
||||
|
||||
/* All ok */
|
||||
printk(KERN_INFO "w9966cf: Found and initialized a webcam on %s.\n",
|
||||
|
@ -870,23 +870,23 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
|
|||
/* Terminate everything gracefully */
|
||||
static void w9966_term(struct w9966_dev *cam)
|
||||
{
|
||||
/* Unregister from v4l */
|
||||
if (w9966_getState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) {
|
||||
/* Unregister from v4l */
|
||||
if (w9966_get_state(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) {
|
||||
video_unregister_device(&cam->vdev);
|
||||
w9966_setState(cam, W9966_STATE_VDEV, 0);
|
||||
w9966_set_state(cam, W9966_STATE_VDEV, 0);
|
||||
}
|
||||
|
||||
/* Terminate from IEEE1284 mode and release pdev block */
|
||||
if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
|
||||
/* Terminate from IEEE1284 mode and release pdev block */
|
||||
if (w9966_get_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
|
||||
w9966_pdev_claim(cam);
|
||||
parport_negotiate(cam->pport, IEEE1284_MODE_COMPAT);
|
||||
w9966_pdev_release(cam);
|
||||
}
|
||||
|
||||
/* Unregister from parport */
|
||||
if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
|
||||
/* Unregister from parport */
|
||||
if (w9966_get_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
|
||||
parport_unregister_device(cam->pdev);
|
||||
w9966_setState(cam, W9966_STATE_PDEV, 0);
|
||||
w9966_set_state(cam, W9966_STATE_PDEV, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue