Skip to content

Commit

Permalink
V4L/DVB (4842): Updated camera driver
Browse files Browse the repository at this point in the history
A couple of Cafe driver fixes, and support for the hue and saturation
controls.

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information
Jonathan Corbet authored and Mauro Carvalho Chehab committed Dec 10, 2006
1 parent 96389bf commit f9a7615
Show file tree
Hide file tree
Showing 2 changed files with 338 additions and 45 deletions.
17 changes: 13 additions & 4 deletions drivers/media/video/cafe_ccic.c
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,8 @@ static struct i2c_algorithm cafe_smbus_algo = {

/* Somebody is on the bus */
static int cafe_cam_init(struct cafe_camera *cam);
static void cafe_ctlr_stop_dma(struct cafe_camera *cam);
static void cafe_ctlr_power_down(struct cafe_camera *cam);

static int cafe_smbus_attach(struct i2c_client *client)
{
Expand All @@ -513,7 +515,6 @@ static int cafe_smbus_attach(struct i2c_client *client)
/*
* Don't talk to chips we don't recognize.
*/
cam_err(cam, "smbus_attach id = %d\n", client->driver->id);
if (client->driver->id == I2C_DRIVERID_OV7670) {
cam->sensor = client;
return cafe_cam_init(cam);
Expand All @@ -525,8 +526,13 @@ static int cafe_smbus_detach(struct i2c_client *client)
{
struct cafe_camera *cam = i2c_get_adapdata(client->adapter);

if (cam->sensor == client)
if (cam->sensor == client) {
cafe_ctlr_stop_dma(cam);
cafe_ctlr_power_down(cam);
cam_err(cam, "lost the sensor!\n");
cam->sensor = NULL; /* Bummer, no camera */
cam->state = S_NOTREADY;
}
return 0;
}

Expand Down Expand Up @@ -774,7 +780,7 @@ static void cafe_ctlr_power_up(struct cafe_camera *cam)
* wiring). Control 0 is reset - set to 1 to operate.
* Control 1 is power down, set to 0 to operate.
*/
cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C1);
cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN); /* pwr up, reset */
mdelay(1); /* Marvell says 1ms will do it */
cafe_reg_write(cam, REG_GPR, GPR_C1EN|GPR_C0EN|GPR_C0);
mdelay(1); /* Enough? */
Expand Down Expand Up @@ -1468,8 +1474,11 @@ static int cafe_v4l_release(struct inode *inode, struct file *filp)
cafe_free_sio_buffers(cam);
cam->owner = NULL;
}
if (cam->users == 0)
if (cam->users == 0) {
cafe_ctlr_power_down(cam);
if (! alloc_bufs_at_load)
cafe_free_dma_bufs(cam);
}
mutex_unlock(&cam->s_mutex);
return 0;
}
Expand Down
Loading

0 comments on commit f9a7615

Please sign in to comment.