mirror of https://gitee.com/openkylin/linux.git
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
|
@ -152,13 +152,13 @@ static struct w9966_dev w9966_cams[W9966_MAXCAMS];
|
||||||
|
|
||||||
|
|
||||||
/* Set camera phase flags, so we know what to uninit when terminating */
|
/* 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;
|
cam->dev_state = (cam->dev_state & ~mask) ^ val;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get camera phase flags */
|
/* 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);
|
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 */
|
/* Claim parport for ourself */
|
||||||
static void w9966_pdev_claim(struct w9966_dev *cam)
|
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;
|
return;
|
||||||
parport_claim_or_block(cam->pdev);
|
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 */
|
/* Release parport for others to use */
|
||||||
static void w9966_pdev_release(struct w9966_dev *cam)
|
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;
|
return;
|
||||||
parport_release(cam->pdev);
|
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
|
/* Read register from W9966 interface-chip
|
||||||
Expects a claimed pdev
|
Expects a claimed pdev
|
||||||
-1 on error, else register data (byte) */
|
-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 */
|
/* ECP, read, regtransfer, REG, REG, REG, REG, REG */
|
||||||
const unsigned char addr = 0x80 | (reg & 0x1f);
|
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
|
/* Write register to W9966 interface-chip
|
||||||
Expects a claimed pdev
|
Expects a claimed pdev
|
||||||
-1 on error */
|
-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 */
|
/* ECP, write, regtransfer, REG, REG, REG, REG, REG */
|
||||||
const unsigned char addr = 0xc0 | (reg & 0x1f);
|
const unsigned char addr = 0xc0 | (reg & 0x1f);
|
||||||
|
@ -236,7 +236,7 @@ static void w9966_i2c_setsda(struct w9966_dev *cam, int state)
|
||||||
else
|
else
|
||||||
cam->i2c_state &= ~W9966_I2C_W_DATA;
|
cam->i2c_state &= ~W9966_I2C_W_DATA;
|
||||||
|
|
||||||
w9966_wReg(cam, 0x18, cam->i2c_state);
|
w9966_write_reg(cam, 0x18, cam->i2c_state);
|
||||||
udelay(5);
|
udelay(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ static void w9966_i2c_setsda(struct w9966_dev *cam, int state)
|
||||||
Expects a claimed pdev. */
|
Expects a claimed pdev. */
|
||||||
static int w9966_i2c_getscl(struct w9966_dev *cam)
|
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);
|
return ((state & W9966_I2C_R_CLOCK) > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ static int w9966_i2c_setscl(struct w9966_dev *cam, int state)
|
||||||
else
|
else
|
||||||
cam->i2c_state &= ~W9966_I2C_W_CLOCK;
|
cam->i2c_state &= ~W9966_I2C_W_CLOCK;
|
||||||
|
|
||||||
w9966_wReg(cam, 0x18, cam->i2c_state);
|
w9966_write_reg(cam, 0x18, cam->i2c_state);
|
||||||
udelay(5);
|
udelay(5);
|
||||||
|
|
||||||
/* we go to high, we also expect the peripheral to ack. */
|
/* 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. */
|
Expects a claimed pdev. */
|
||||||
static int w9966_i2c_getsda(struct w9966_dev *cam)
|
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);
|
return ((state & W9966_I2C_R_DATA) > 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -332,7 +332,7 @@ static int w9966_i2c_rbyte(struct w9966_dev *cam)
|
||||||
/* Read a register from the i2c device.
|
/* Read a register from the i2c device.
|
||||||
Expects claimed pdev. -1 on error */
|
Expects claimed pdev. -1 on error */
|
||||||
#if 0
|
#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;
|
int data;
|
||||||
|
|
||||||
|
@ -367,7 +367,7 @@ static int w9966_rReg_i2c(struct w9966_dev *cam, int reg)
|
||||||
|
|
||||||
/* Write a register to the i2c device.
|
/* Write a register to the i2c device.
|
||||||
Expects claimed pdev. -1 on error */
|
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_setsda(cam, 0);
|
||||||
w9966_i2c_setscl(cam, 0);
|
w9966_i2c_setscl(cam, 0);
|
||||||
|
@ -537,17 +537,17 @@ static int w9966_setup(struct w9966_dev *cam, int x1, int y1, int x2, int y2, in
|
||||||
saa7111_regs[0x0d] = cam->hue;
|
saa7111_regs[0x0d] = cam->hue;
|
||||||
|
|
||||||
/* Reset (ECP-fifo & serial-bus) */
|
/* Reset (ECP-fifo & serial-bus) */
|
||||||
if (w9966_wReg(cam, 0x00, 0x03) == -1)
|
if (w9966_write_reg(cam, 0x00, 0x03) == -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
/* Write regs to w9966cf chip */
|
/* Write regs to w9966cf chip */
|
||||||
for (i = 0; i < 0x1c; i++)
|
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;
|
return -1;
|
||||||
|
|
||||||
/* Write regs to saa7111 chip */
|
/* Write regs to saa7111 chip */
|
||||||
for (i = 0; i < 0x20; i++)
|
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 -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -644,10 +644,10 @@ static long w9966_v4l_do_ioctl(struct file *file, unsigned int cmd, void *arg)
|
||||||
w9966_pdev_claim(cam);
|
w9966_pdev_claim(cam);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 ||
|
w9966_write_reg_i2c(cam, 0x0a, cam->brightness) == -1 ||
|
||||||
w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 ||
|
w9966_write_reg_i2c(cam, 0x0b, cam->contrast) == -1 ||
|
||||||
w9966_wReg_i2c(cam, 0x0c, cam->color) == -1 ||
|
w9966_write_reg_i2c(cam, 0x0c, cam->color) == -1 ||
|
||||||
w9966_wReg_i2c(cam, 0x0d, cam->hue) == -1
|
w9966_write_reg_i2c(cam, 0x0d, cam->hue) == -1
|
||||||
) {
|
) {
|
||||||
w9966_pdev_release(cam);
|
w9966_pdev_release(cam);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
@ -727,9 +727,9 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf,
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
w9966_pdev_claim(cam);
|
w9966_pdev_claim(cam);
|
||||||
w9966_wReg(cam, 0x00, 0x02); /* Reset ECP-FIFO buffer */
|
w9966_write_reg(cam, 0x00, 0x02); /* Reset ECP-FIFO buffer */
|
||||||
w9966_wReg(cam, 0x00, 0x00); /* Return to normal operation */
|
w9966_write_reg(cam, 0x00, 0x00); /* Return to normal operation */
|
||||||
w9966_wReg(cam, 0x01, 0x98); /* Enable capture */
|
w9966_write_reg(cam, 0x01, 0x98); /* Enable capture */
|
||||||
|
|
||||||
/* write special capture-addr and negotiate into data transfer */
|
/* write special capture-addr and negotiate into data transfer */
|
||||||
if ((parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0) ||
|
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;
|
dleft -= tsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
w9966_wReg(cam, 0x01, 0x18); /* Disable capture */
|
w9966_write_reg(cam, 0x01, 0x18); /* Disable capture */
|
||||||
|
|
||||||
out:
|
out:
|
||||||
kfree(tbuf);
|
kfree(tbuf);
|
||||||
|
@ -839,7 +839,7 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
|
||||||
DPRINTF("parport_register_device() failed\n");
|
DPRINTF("parport_register_device() failed\n");
|
||||||
return -1;
|
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);
|
w9966_pdev_claim(cam);
|
||||||
|
|
||||||
|
@ -858,7 +858,7 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
|
||||||
if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0)
|
if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV);
|
w9966_set_state(cam, W9966_STATE_VDEV, W9966_STATE_VDEV);
|
||||||
|
|
||||||
/* All ok */
|
/* All ok */
|
||||||
printk(KERN_INFO "w9966cf: Found and initialized a webcam on %s.\n",
|
printk(KERN_INFO "w9966cf: Found and initialized a webcam on %s.\n",
|
||||||
|
@ -871,22 +871,22 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
|
||||||
static void w9966_term(struct w9966_dev *cam)
|
static void w9966_term(struct w9966_dev *cam)
|
||||||
{
|
{
|
||||||
/* Unregister from v4l */
|
/* Unregister from v4l */
|
||||||
if (w9966_getState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) {
|
if (w9966_get_state(cam, W9966_STATE_VDEV, W9966_STATE_VDEV)) {
|
||||||
video_unregister_device(&cam->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 */
|
/* Terminate from IEEE1284 mode and release pdev block */
|
||||||
if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
|
if (w9966_get_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
|
||||||
w9966_pdev_claim(cam);
|
w9966_pdev_claim(cam);
|
||||||
parport_negotiate(cam->pport, IEEE1284_MODE_COMPAT);
|
parport_negotiate(cam->pport, IEEE1284_MODE_COMPAT);
|
||||||
w9966_pdev_release(cam);
|
w9966_pdev_release(cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Unregister from parport */
|
/* Unregister from parport */
|
||||||
if (w9966_getState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
|
if (w9966_get_state(cam, W9966_STATE_PDEV, W9966_STATE_PDEV)) {
|
||||||
parport_unregister_device(cam->pdev);
|
parport_unregister_device(cam->pdev);
|
||||||
w9966_setState(cam, W9966_STATE_PDEV, 0);
|
w9966_set_state(cam, W9966_STATE_PDEV, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue