Commit c1f2b0f2 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab
Browse files

V4L/DVB: w9966: remove camelCase

parent 271922c0
Loading
Loading
Loading
Loading
+168 −168
Original line number Diff line number Diff line
@@ -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);
@@ -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;

	/* Reset (ECP-fifo & serial-bus) */
	if (w9966_wReg(cam, 0x00, 0x03) == -1)
	if (w9966_write_reg(cam, 0x00, 0x03) == -1)
		return -1;

	/* 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 */
	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);
@@ -839,7 +839,7 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
		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);

@@ -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)
		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",
@@ -871,22 +871,22 @@ static int w9966_init(struct w9966_dev *cam, struct parport* port)
static void w9966_term(struct w9966_dev *cam)
{
	/* 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);
		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)) {
	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)) {
	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);
	}
}