diff options
author | Erik Andrén <erik.andren@gmail.com> | 2008-12-22 14:06:29 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:40:02 -0500 |
commit | 3b2f3327ff5af235837bc83c6b788bc560ba23a6 (patch) | |
tree | 0427347816392829b994edd3f6c4490027f55343 | |
parent | 082aa8937c79a02397981b7543ccc65d2bdeaf97 (diff) |
V4L/DVB (10037): m5602: add QVGA mode for the ov9650 sensor
Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_ov9650.c | 14 | ||||
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_ov9650.h | 40 |
2 files changed, 51 insertions, 3 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.c b/drivers/media/video/gspca/m5602/m5602_ov9650.c index fcca3adefc5b..98c979dbbe3d 100644 --- a/drivers/media/video/gspca/m5602/m5602_ov9650.c +++ b/drivers/media/video/gspca/m5602/m5602_ov9650.c | |||
@@ -150,7 +150,6 @@ int ov9650_start(struct sd *sd) | |||
150 | 150 | ||
151 | switch (cam->cam_mode[sd->gspca_dev.curr_mode].width) | 151 | switch (cam->cam_mode[sd->gspca_dev.curr_mode].width) |
152 | { | 152 | { |
153 | default: | ||
154 | case 640: | 153 | case 640: |
155 | PDEBUG(D_V4L2, "Configuring camera for VGA mode"); | 154 | PDEBUG(D_V4L2, "Configuring camera for VGA mode"); |
156 | 155 | ||
@@ -163,6 +162,19 @@ int ov9650_start(struct sd *sd) | |||
163 | err = m5602_write_bridge(sd, VGA_ov9650[i][1], data); | 162 | err = m5602_write_bridge(sd, VGA_ov9650[i][1], data); |
164 | } | 163 | } |
165 | break; | 164 | break; |
165 | |||
166 | case 320: | ||
167 | PDEBUG(D_V4L2, "Configuring camera for QVGA mode"); | ||
168 | |||
169 | for (i = 0; i < ARRAY_SIZE(QVGA_ov9650) && !err; i++) { | ||
170 | u8 data = QVGA_ov9650[i][2]; | ||
171 | if (QVGA_ov9650[i][0] == SENSOR) | ||
172 | err = m5602_write_sensor(sd, | ||
173 | QVGA_ov9650[i][1], &data, 1); | ||
174 | else | ||
175 | err = m5602_write_bridge(sd, QVGA_ov9650[i][1], data); | ||
176 | } | ||
177 | break; | ||
166 | } | 178 | } |
167 | return err; | 179 | return err; |
168 | } | 180 | } |
diff --git a/drivers/media/video/gspca/m5602/m5602_ov9650.h b/drivers/media/video/gspca/m5602/m5602_ov9650.h index 17f3382af76a..636dce61c49d 100644 --- a/drivers/media/video/gspca/m5602/m5602_ov9650.h +++ b/drivers/media/video/gspca/m5602/m5602_ov9650.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #define M5602_OV9650_H_ | 20 | #define M5602_OV9650_H_ |
21 | 21 | ||
22 | #include <linux/dmi.h> | 22 | #include <linux/dmi.h> |
23 | |||
24 | #include "m5602_sensor.h" | 23 | #include "m5602_sensor.h" |
25 | 24 | ||
26 | /*****************************************************************************/ | 25 | /*****************************************************************************/ |
@@ -94,6 +93,7 @@ | |||
94 | 93 | ||
95 | #define OV9650_REGISTER_RESET (1 << 7) | 94 | #define OV9650_REGISTER_RESET (1 << 7) |
96 | #define OV9650_VGA_SELECT (1 << 6) | 95 | #define OV9650_VGA_SELECT (1 << 6) |
96 | #define OV9650_QVGA_SELECT (1 << 4) | ||
97 | #define OV9650_RGB_SELECT (1 << 2) | 97 | #define OV9650_RGB_SELECT (1 << 2) |
98 | #define OV9650_RAW_RGB_SELECT (1 << 0) | 98 | #define OV9650_RAW_RGB_SELECT (1 << 0) |
99 | 99 | ||
@@ -258,9 +258,19 @@ static struct m5602_sensor ov9650 = { | |||
258 | } | 258 | } |
259 | }, | 259 | }, |
260 | 260 | ||
261 | .nmodes = 1, | 261 | .nmodes = 2, |
262 | .modes = { | 262 | .modes = { |
263 | { | 263 | { |
264 | 320, | ||
265 | 240, | ||
266 | V4L2_PIX_FMT_SBGGR8, | ||
267 | V4L2_FIELD_NONE, | ||
268 | .sizeimage = | ||
269 | 320 * 240, | ||
270 | .bytesperline = 320, | ||
271 | .colorspace = V4L2_COLORSPACE_SRGB, | ||
272 | .priv = 0 | ||
273 | }, { | ||
264 | 640, | 274 | 640, |
265 | 480, | 275 | 480, |
266 | V4L2_PIX_FMT_SBGGR8, | 276 | V4L2_PIX_FMT_SBGGR8, |
@@ -464,4 +474,30 @@ static const unsigned char VGA_ov9650[][3] = | |||
464 | {BRIDGE, M5602_XB_HSYNC_PARA, 0xe4} | 474 | {BRIDGE, M5602_XB_HSYNC_PARA, 0xe4} |
465 | }; | 475 | }; |
466 | 476 | ||
477 | static const unsigned char QVGA_ov9650[][3] = | ||
478 | { | ||
479 | {SENSOR, OV9650_COM7, OV9650_QVGA_SELECT | | ||
480 | OV9650_RGB_SELECT | | ||
481 | OV9650_RAW_RGB_SELECT}, | ||
482 | |||
483 | {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x82}, | ||
484 | {BRIDGE, M5602_XB_LINE_OF_FRAME_L, 0x00}, | ||
485 | {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, | ||
486 | {BRIDGE, M5602_XB_PIX_OF_LINE_L, 0x00}, | ||
487 | {BRIDGE, M5602_XB_SIG_INI, 0x01}, | ||
488 | |||
489 | /* Moves the view window in a vertical orientation */ | ||
490 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
491 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x08}, | ||
492 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
493 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
494 | {BRIDGE, M5602_XB_VSYNC_PARA, 0xf0}, /* 240 */ | ||
495 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
496 | {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, | ||
497 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x00}, | ||
498 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x31}, /* 50 */ | ||
499 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x01}, /* 320 + 50 */ | ||
500 | {BRIDGE, M5602_XB_HSYNC_PARA, 0x71} | ||
501 | }; | ||
502 | |||
467 | #endif | 503 | #endif |