V4L/DVB (11409): gspca - m5602-ov9650: Set the ov9650 sensor in soft sleep when inactive.

In order to save energy, put the sensor in soft sleep mode when not active

Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Erik Andr?n 2008-12-29 12:49:25 -03:00 committed by Mauro Carvalho Chehab
parent 4a7581f084
commit 3d3ec926e9
2 changed files with 31 additions and 8 deletions

View File

@ -147,8 +147,14 @@ int ov9650_start(struct sd *sd)
int i, err = 0;
struct cam *cam = &sd->gspca_dev.cam;
for (i = 0; i < ARRAY_SIZE(res_init_ov9650) && !err; i++)
err = m5602_write_bridge(sd, res_init_ov9650[i][0], res_init_ov9650[i][1]);
for (i = 0; i < ARRAY_SIZE(res_init_ov9650) && !err; i++) {
if (res_init_ov9650[i][0] == BRIDGE)
err = m5602_write_bridge(sd, res_init_ov9650[i][1], res_init_ov9650[i][2]);
else if (res_init_ov9650[i][0] == SENSOR) {
u8 data = res_init_ov9650[i][2];
err = m5602_write_sensor(sd, res_init_ov9650[i][1], &data, 1);
}
}
if (err < 0)
return err;
@ -217,6 +223,12 @@ int ov9650_start(struct sd *sd)
return err;
}
int ov9650_stop(struct sd *sd)
{
u8 data = OV9650_SOFT_SLEEP | OV9650_OUTPUT_DRIVE_2X;
return m5602_write_sensor(sd, OV9650_COM2, &data, 1);
}
int ov9650_power_down(struct sd *sd)
{
int i, err = 0;

View File

@ -32,6 +32,7 @@
#define OV9650_BAVE 0x05
#define OV9650_GEAVE 0x06
#define OV9650_RSVD7 0x07
#define OV9650_COM2 0x09
#define OV9650_PID 0x0a
#define OV9650_VER 0x0b
#define OV9650_COM3 0x0c
@ -116,6 +117,9 @@
#define OV9650_VFLIP (1 << 4)
#define OV9650_HFLIP (1 << 5)
#define OV9650_SOFT_SLEEP (1 << 4)
#define OV9650_OUTPUT_DRIVE_2X (1 << 0)
#define GAIN_DEFAULT 0x14
#define RED_GAIN_DEFAULT 0x70
#define BLUE_GAIN_DEFAULT 0x20
@ -130,6 +134,7 @@ extern int dump_sensor;
int ov9650_probe(struct sd *sd);
int ov9650_init(struct sd *sd);
int ov9650_start(struct sd *sd);
int ov9650_stop(struct sd *sd);
int ov9650_power_down(struct sd *sd);
int ov9650_set_exposure(struct gspca_dev *gspca_dev, __s32 val);
@ -158,6 +163,7 @@ static struct m5602_sensor ov9650 = {
.probe = ov9650_probe,
.init = ov9650_init,
.start = ov9650_start,
.stop = ov9650_stop,
.power_down = ov9650_power_down,
.nctrls = 8,
@ -450,6 +456,9 @@ static const unsigned char init_ov9650[][3] =
{SENSOR, OV9650_GAIN, GAIN_DEFAULT},
{SENSOR, OV9650_BLUE, BLUE_GAIN_DEFAULT},
{SENSOR, OV9650_RED, RED_GAIN_DEFAULT},
/* Put the sensor in soft sleep mode */
{SENSOR, OV9650_COM2, OV9650_SOFT_SLEEP | OV9650_OUTPUT_DRIVE_2X},
};
static const unsigned char power_down_ov9650[][3] =
@ -472,13 +481,15 @@ static const unsigned char power_down_ov9650[][3] =
{BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
};
static const unsigned char res_init_ov9650[][2] =
static const unsigned char res_init_ov9650[][3] =
{
{M5602_XB_LINE_OF_FRAME_H, 0x82},
{M5602_XB_LINE_OF_FRAME_L, 0x00},
{M5602_XB_PIX_OF_LINE_H, 0x82},
{M5602_XB_PIX_OF_LINE_L, 0x00},
{M5602_XB_SIG_INI, 0x01}
{SENSOR, OV9650_COM2, (1 << 0)},
{BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x82},
{BRIDGE, M5602_XB_LINE_OF_FRAME_L, 0x00},
{BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82},
{BRIDGE, M5602_XB_PIX_OF_LINE_L, 0x00},
{BRIDGE, M5602_XB_SIG_INI, 0x01}
};
static const unsigned char VGA_ov9650[][3] =