aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorErik Andr?n <erik.andren@gmail.com>2008-12-26 10:57:42 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-04-06 20:44:35 -0400
commitad567ec23501dfdf00dcc8915709a1fda556b6f4 (patch)
tree81908c6a5717ac69a881b58585add2cfaf4c259a /drivers/media/video
parent148d0b8deb4348e953e71ed17829e7817cf29e0e (diff)
V4L/DVB (11404): gspca - m5602-s5k4aa: Add start function and VGA resolution init.
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_s5k4aa.c43
-rw-r--r--drivers/media/video/gspca/m5602/m5602_s5k4aa.h61
2 files changed, 104 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
index 48892b5715d5..41ae7f0b959f 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
+++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.c
@@ -123,6 +123,49 @@ sensor_found:
123 return 0; 123 return 0;
124} 124}
125 125
126int s5k4aa_start(struct sd *sd)
127{
128 int i, err = 0;
129 u8 data[2];
130 struct cam *cam = &sd->gspca_dev.cam;
131
132 switch (cam->cam_mode[sd->gspca_dev.curr_mode].width)
133 {
134 case 640:
135 PDEBUG(D_V4L2, "Configuring camera for VGA mode");
136
137 for (i = 0; i < ARRAY_SIZE(VGA_s5k4aa); i++) {
138 switch (VGA_s5k4aa[i][0]) {
139 case BRIDGE:
140 err = m5602_write_bridge(sd,
141 VGA_s5k4aa[i][1],
142 VGA_s5k4aa[i][2]);
143 break;
144
145 case SENSOR:
146 data[0] = VGA_s5k4aa[i][2];
147 err = m5602_write_sensor(sd,
148 VGA_s5k4aa[i][1],
149 data, 1);
150 break;
151
152 case SENSOR_LONG:
153 data[0] = VGA_s5k4aa[i][2];
154 data[1] = VGA_s5k4aa[i][3];
155 err = m5602_write_sensor(sd,
156 VGA_s5k4aa[i][1],
157 data, 2);
158 break;
159
160 default:
161 err("Invalid stream command, exiting init");
162 return -EINVAL;
163 }
164 }
165 }
166 return err;
167}
168
126int s5k4aa_init(struct sd *sd) 169int s5k4aa_init(struct sd *sd)
127{ 170{
128 int i, err = 0; 171 int i, err = 0;
diff --git a/drivers/media/video/gspca/m5602/m5602_s5k4aa.h b/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
index 2f3af9503aa7..0c08ccffc7ff 100644
--- a/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
+++ b/drivers/media/video/gspca/m5602/m5602_s5k4aa.h
@@ -65,6 +65,7 @@ extern int dump_sensor;
65 65
66int s5k4aa_probe(struct sd *sd); 66int s5k4aa_probe(struct sd *sd);
67int s5k4aa_init(struct sd *sd); 67int s5k4aa_init(struct sd *sd);
68int s5k4aa_start(struct sd *sd);
68int s5k4aa_power_down(struct sd *sd); 69int s5k4aa_power_down(struct sd *sd);
69 70
70int s5k4aa_get_exposure(struct gspca_dev *gspca_dev, __s32 *val); 71int s5k4aa_get_exposure(struct gspca_dev *gspca_dev, __s32 *val);
@@ -80,6 +81,7 @@ static struct m5602_sensor s5k4aa = {
80 .name = "S5K4AA", 81 .name = "S5K4AA",
81 .probe = s5k4aa_probe, 82 .probe = s5k4aa_probe,
82 .init = s5k4aa_init, 83 .init = s5k4aa_init,
84 .start = s5k4aa_start,
83 .power_down = s5k4aa_power_down, 85 .power_down = s5k4aa_power_down,
84 .i2c_slave_id = 0x5a, 86 .i2c_slave_id = 0x5a,
85 .i2c_regW = 2, 87 .i2c_regW = 2,
@@ -329,4 +331,63 @@ static const unsigned char init_s5k4aa[][4] =
329 {SENSOR, S5K4AA_GAIN_2, 0xa0, 0x00} 331 {SENSOR, S5K4AA_GAIN_2, 0xa0, 0x00}
330}; 332};
331 333
334static const unsigned char VGA_s5k4aa[][4] =
335{
336 {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06, 0x00},
337 {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0, 0x00},
338 {BRIDGE, M5602_XB_ADC_CTRL, 0xc0, 0x00},
339 {BRIDGE, M5602_XB_SENSOR_TYPE, 0x08, 0x00},
340 {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81, 0x00},
341 {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82, 0x00},
342 {BRIDGE, M5602_XB_SIG_INI, 0x01, 0x00},
343 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
344 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
345 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
346 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
347 /* VSYNC_PARA, VSYNC_PARA : img height 480 = 0x01e0 */
348 {BRIDGE, M5602_XB_VSYNC_PARA, 0x01, 0x00},
349 {BRIDGE, M5602_XB_VSYNC_PARA, 0xe0, 0x00},
350 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
351 {BRIDGE, M5602_XB_VSYNC_PARA, 0x00, 0x00},
352 {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
353 {BRIDGE, M5602_XB_SIG_INI, 0x02, 0x00},
354 {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
355 {BRIDGE, M5602_XB_HSYNC_PARA, 0x00, 0x00},
356 /* HSYNC_PARA, HSYNC_PARA : img width 640 = 0x0280 */
357 {BRIDGE, M5602_XB_HSYNC_PARA, 0x02, 0x00},
358 {BRIDGE, M5602_XB_HSYNC_PARA, 0x80, 0x00},
359 {BRIDGE, M5602_XB_SIG_INI, 0x00, 0x00},
360 {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00, 0x00},
361 {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xa0, 0x00}, /* 48 MHz */
362
363 {SENSOR, S5K4AA_PAGE_MAP, 0x02, 0x00},
364 {SENSOR, S5K4AA_READ_MODE, S5K4AA_RM_H_FLIP | S5K4AA_RM_ROW_SKIP_2X
365 | S5K4AA_RM_COL_SKIP_2X, 0x00},
366 /* 0x37 : Fix image stability when light is too bright and improves
367 * image quality in 640x480, but worsens it in 1280x1024 */
368 {SENSOR, 0x37, 0x01, 0x00},
369 /* ROWSTART_HI, ROWSTART_LO : 10 + (1024-960)/2 = 42 = 0x002a */
370 {SENSOR, S5K4AA_ROWSTART_HI, 0x00, 0x00},
371 {SENSOR, S5K4AA_ROWSTART_LO, 0x2a, 0x00},
372 {SENSOR, S5K4AA_COLSTART_HI, 0x00, 0x00},
373 {SENSOR, S5K4AA_COLSTART_LO, 0x0c, 0x00},
374 /* window_height_hi, window_height_lo : 960 = 0x03c0 */
375 {SENSOR, S5K4AA_WINDOW_HEIGHT_HI, 0x03, 0x00},
376 {SENSOR, S5K4AA_WINDOW_HEIGHT_LO, 0xc0, 0x00},
377 /* window_width_hi, window_width_lo : 1280 = 0x0500 */
378 {SENSOR, S5K4AA_WINDOW_WIDTH_HI, 0x05, 0x00},
379 {SENSOR, S5K4AA_WINDOW_WIDTH_LO, 0x00, 0x00},
380 {SENSOR, S5K4AA_H_BLANK_HI__, 0x00, 0x00},
381 {SENSOR, S5K4AA_H_BLANK_LO__, 0xa8, 0x00}, /* helps to sync... */
382 {SENSOR, S5K4AA_EXPOSURE_HI, 0x01, 0x00},
383 {SENSOR, S5K4AA_EXPOSURE_LO, 0x00, 0x00},
384 {SENSOR, 0x11, 0x04, 0x00},
385 {SENSOR, 0x12, 0xc3, 0x00},
386 {SENSOR, S5K4AA_PAGE_MAP, 0x02, 0x00},
387 {SENSOR, 0x02, 0x0e, 0x00},
388 {SENSOR_LONG, S5K4AA_GLOBAL_GAIN__, 0x0f, 0x00},
389 {SENSOR, S5K4AA_GAIN_1, 0x0b, 0x00},
390 {SENSOR, S5K4AA_GAIN_2, 0xa0, 0x00}
391};
392
332#endif 393#endif