diff options
author | Erik Andr?n <erik.andren@gmail.com> | 2008-12-29 10:49:25 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-04-06 20:44:38 -0400 |
commit | 3d3ec926e98bc10c4c48ee7422aecdc335ab1222 (patch) | |
tree | 59011271e347e155ec64f3f7e577e370dd68d763 /drivers/media/video | |
parent | 4a7581f084ce308a448f4940ed2c664e9e3d78a1 (diff) |
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) | |||
147 | int i, err = 0; | 147 | int i, err = 0; |
148 | struct cam *cam = &sd->gspca_dev.cam; | 148 | struct cam *cam = &sd->gspca_dev.cam; |
149 | 149 | ||
150 | for (i = 0; i < ARRAY_SIZE(res_init_ov9650) && !err; i++) | 150 | for (i = 0; i < ARRAY_SIZE(res_init_ov9650) && !err; i++) { |
151 | err = m5602_write_bridge(sd, res_init_ov9650[i][0], res_init_ov9650[i][1]); | 151 | if (res_init_ov9650[i][0] == BRIDGE) |
152 | err = m5602_write_bridge(sd, res_init_ov9650[i][1], res_init_ov9650[i][2]); | ||
153 | else if (res_init_ov9650[i][0] == SENSOR) { | ||
154 | u8 data = res_init_ov9650[i][2]; | ||
155 | err = m5602_write_sensor(sd, res_init_ov9650[i][1], &data, 1); | ||
156 | } | ||
157 | } | ||
152 | if (err < 0) | 158 | if (err < 0) |
153 | return err; | 159 | return err; |
154 | 160 | ||
@@ -217,6 +223,12 @@ int ov9650_start(struct sd *sd) | |||
217 | return err; | 223 | return err; |
218 | } | 224 | } |
219 | 225 | ||
226 | int ov9650_stop(struct sd *sd) | ||
227 | { | ||
228 | u8 data = OV9650_SOFT_SLEEP | OV9650_OUTPUT_DRIVE_2X; | ||
229 | return m5602_write_sensor(sd, OV9650_COM2, &data, 1); | ||
230 | } | ||
231 | |||
220 | int ov9650_power_down(struct sd *sd) | 232 | int ov9650_power_down(struct sd *sd) |
221 | { | 233 | { |
222 | int i, err = 0; | 234 | 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 @@ | |||
32 | #define OV9650_BAVE 0x05 | 32 | #define OV9650_BAVE 0x05 |
33 | #define OV9650_GEAVE 0x06 | 33 | #define OV9650_GEAVE 0x06 |
34 | #define OV9650_RSVD7 0x07 | 34 | #define OV9650_RSVD7 0x07 |
35 | #define OV9650_COM2 0x09 | ||
35 | #define OV9650_PID 0x0a | 36 | #define OV9650_PID 0x0a |
36 | #define OV9650_VER 0x0b | 37 | #define OV9650_VER 0x0b |
37 | #define OV9650_COM3 0x0c | 38 | #define OV9650_COM3 0x0c |
@@ -116,6 +117,9 @@ | |||
116 | #define OV9650_VFLIP (1 << 4) | 117 | #define OV9650_VFLIP (1 << 4) |
117 | #define OV9650_HFLIP (1 << 5) | 118 | #define OV9650_HFLIP (1 << 5) |
118 | 119 | ||
120 | #define OV9650_SOFT_SLEEP (1 << 4) | ||
121 | #define OV9650_OUTPUT_DRIVE_2X (1 << 0) | ||
122 | |||
119 | #define GAIN_DEFAULT 0x14 | 123 | #define GAIN_DEFAULT 0x14 |
120 | #define RED_GAIN_DEFAULT 0x70 | 124 | #define RED_GAIN_DEFAULT 0x70 |
121 | #define BLUE_GAIN_DEFAULT 0x20 | 125 | #define BLUE_GAIN_DEFAULT 0x20 |
@@ -130,6 +134,7 @@ extern int dump_sensor; | |||
130 | int ov9650_probe(struct sd *sd); | 134 | int ov9650_probe(struct sd *sd); |
131 | int ov9650_init(struct sd *sd); | 135 | int ov9650_init(struct sd *sd); |
132 | int ov9650_start(struct sd *sd); | 136 | int ov9650_start(struct sd *sd); |
137 | int ov9650_stop(struct sd *sd); | ||
133 | int ov9650_power_down(struct sd *sd); | 138 | int ov9650_power_down(struct sd *sd); |
134 | 139 | ||
135 | int ov9650_set_exposure(struct gspca_dev *gspca_dev, __s32 val); | 140 | int ov9650_set_exposure(struct gspca_dev *gspca_dev, __s32 val); |
@@ -158,6 +163,7 @@ static struct m5602_sensor ov9650 = { | |||
158 | .probe = ov9650_probe, | 163 | .probe = ov9650_probe, |
159 | .init = ov9650_init, | 164 | .init = ov9650_init, |
160 | .start = ov9650_start, | 165 | .start = ov9650_start, |
166 | .stop = ov9650_stop, | ||
161 | .power_down = ov9650_power_down, | 167 | .power_down = ov9650_power_down, |
162 | 168 | ||
163 | .nctrls = 8, | 169 | .nctrls = 8, |
@@ -450,6 +456,9 @@ static const unsigned char init_ov9650[][3] = | |||
450 | {SENSOR, OV9650_GAIN, GAIN_DEFAULT}, | 456 | {SENSOR, OV9650_GAIN, GAIN_DEFAULT}, |
451 | {SENSOR, OV9650_BLUE, BLUE_GAIN_DEFAULT}, | 457 | {SENSOR, OV9650_BLUE, BLUE_GAIN_DEFAULT}, |
452 | {SENSOR, OV9650_RED, RED_GAIN_DEFAULT}, | 458 | {SENSOR, OV9650_RED, RED_GAIN_DEFAULT}, |
459 | |||
460 | /* Put the sensor in soft sleep mode */ | ||
461 | {SENSOR, OV9650_COM2, OV9650_SOFT_SLEEP | OV9650_OUTPUT_DRIVE_2X}, | ||
453 | }; | 462 | }; |
454 | 463 | ||
455 | static const unsigned char power_down_ov9650[][3] = | 464 | static const unsigned char power_down_ov9650[][3] = |
@@ -472,13 +481,15 @@ static const unsigned char power_down_ov9650[][3] = | |||
472 | {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, | 481 | {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, |
473 | }; | 482 | }; |
474 | 483 | ||
475 | static const unsigned char res_init_ov9650[][2] = | 484 | static const unsigned char res_init_ov9650[][3] = |
476 | { | 485 | { |
477 | {M5602_XB_LINE_OF_FRAME_H, 0x82}, | 486 | {SENSOR, OV9650_COM2, (1 << 0)}, |
478 | {M5602_XB_LINE_OF_FRAME_L, 0x00}, | 487 | |
479 | {M5602_XB_PIX_OF_LINE_H, 0x82}, | 488 | {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x82}, |
480 | {M5602_XB_PIX_OF_LINE_L, 0x00}, | 489 | {BRIDGE, M5602_XB_LINE_OF_FRAME_L, 0x00}, |
481 | {M5602_XB_SIG_INI, 0x01} | 490 | {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, |
491 | {BRIDGE, M5602_XB_PIX_OF_LINE_L, 0x00}, | ||
492 | {BRIDGE, M5602_XB_SIG_INI, 0x01} | ||
482 | }; | 493 | }; |
483 | 494 | ||
484 | static const unsigned char VGA_ov9650[][3] = | 495 | static const unsigned char VGA_ov9650[][3] = |