Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164182
b: refs/heads/master
c: 7c7ddf1
h: refs/heads/master
v: v3
  • Loading branch information
Erik Andrén authored and Mauro Carvalho Chehab committed Sep 19, 2009
1 parent b6b99ae commit 60ffe46
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 456ebe4e92063b92d2672da272bfc7ac70bd8bdd
refs/heads/master: 7c7ddf1638a45923ab053d1f7818c6d123148b4b
52 changes: 51 additions & 1 deletion trunk/drivers/media/video/gspca/m5602/m5602_ov7660.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ static int ov7660_set_auto_white_balance(struct gspca_dev *gspca_dev,
__s32 val);
static int ov7660_get_auto_gain(struct gspca_dev *gspca_dev, __s32 *val);
static int ov7660_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val);

static int ov7660_get_auto_exposure(struct gspca_dev *gspca_dev, __s32 *val);
static int ov7660_set_auto_exposure(struct gspca_dev *gspca_dev, __s32 val);

const static struct ctrl ov7660_ctrls[] = {
#define GAIN_IDX 1
Expand Down Expand Up @@ -106,6 +107,20 @@ const static struct ctrl ov7660_ctrls[] = {
.set = ov7660_set_auto_gain,
.get = ov7660_get_auto_gain
},
#define AUTO_EXPOSURE_IDX 6
{
{
.id = V4L2_CID_EXPOSURE_AUTO,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "auto exposure",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 1
},
.set = ov7660_set_auto_exposure,
.get = ov7660_get_auto_exposure
}
};

static struct v4l2_pix_format ov7660_modes[] = {
Expand Down Expand Up @@ -227,6 +242,11 @@ int ov7660_init(struct sd *sd)
if (err < 0)
return err;

err = ov7660_set_auto_exposure(&sd->gspca_dev,
sensor_settings[AUTO_EXPOSURE_IDX]);
if (err < 0)
return err;

err = ov7660_set_blue_gain(&sd->gspca_dev,
sensor_settings[BLUE_BALANCE_IDX]);
if (err < 0)
Expand Down Expand Up @@ -391,6 +411,36 @@ static int ov7660_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val)
return m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1);
}

static int ov7660_get_auto_exposure(struct gspca_dev *gspca_dev, __s32 *val)
{
struct sd *sd = (struct sd *) gspca_dev;
s32 *sensor_settings = sd->sensor_priv;

*val = sensor_settings[AUTO_EXPOSURE_IDX];
PDEBUG(D_V4L2, "Read auto exposure control %d", *val);
return 0;
}

static int ov7660_set_auto_exposure(struct gspca_dev *gspca_dev,
__s32 val)
{
int err;
u8 i2c_data;
struct sd *sd = (struct sd *) gspca_dev;
s32 *sensor_settings = sd->sensor_priv;

PDEBUG(D_V4L2, "Set auto exposure control to %d", val);

sensor_settings[AUTO_EXPOSURE_IDX] = val;
err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1);
if (err < 0)
return err;

i2c_data = ((i2c_data & 0xfe) | ((val & 0x01) << 0));

return m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1);
}

static void ov7660_dump_registers(struct sd *sd)
{
int address;
Expand Down

0 comments on commit 60ffe46

Please sign in to comment.