diff options
author | Erik Andr?n <erik.andren@gmail.com> | 2008-12-29 12:49:25 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-04-06 21:44:38 -0300 |
commit | 3d3ec926e98bc10c4c48ee7422aecdc335ab1222 (patch) | |
tree | 59011271e347e155ec64f3f7e577e370dd68d763 /drivers/media/video | |
parent | 4a7581f084ce308a448f4940ed2c664e9e3d78a1 (diff) | |
download | blackbird-op-linux-3d3ec926e98bc10c4c48ee7422aecdc335ab1222.tar.gz blackbird-op-linux-3d3ec926e98bc10c4c48ee7422aecdc335ab1222.zip |
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>
Diffstat (limited to 'drivers/media/video')
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_ov9650.c | 16 | ||||
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_ov9650.h | 23 |
2 files changed, 31 insertions, 8 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.c b/drivers/media/video/gspca/m5602/m5602_ov9650.c index 76317e274bf4..bbf91356096c 100644 --- a/drivers/media/video/gspca/m5602/m5602_ov9650.c +++ b/drivers/media/video/gspca/m5602/m5602_ov9650.c @@ -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; diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.h b/drivers/media/video/gspca/m5602/m5602_ov9650.h index 92536da9db63..fe69ddfcb002 100644 --- a/drivers/media/video/gspca/m5602/m5602_ov9650.h +++ b/drivers/media/video/gspca/m5602/m5602_ov9650.h @@ -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] = |