aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/usb
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/usb')
-rw-r--r--drivers/media/usb/em28xx/em28xx-camera.c49
-rw-r--r--drivers/media/usb/em28xx/em28xx.h1
2 files changed, 50 insertions, 0 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c
index 64b70d42da1e..73cc50afa5e1 100644
--- a/drivers/media/usb/em28xx/em28xx-camera.c
+++ b/drivers/media/usb/em28xx/em28xx-camera.c
@@ -20,6 +20,7 @@
20*/ 20*/
21 21
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <media/soc_camera.h>
23#include <media/mt9v011.h> 24#include <media/mt9v011.h>
24#include <media/v4l2-common.h> 25#include <media/v4l2-common.h>
25 26
@@ -42,6 +43,13 @@ static unsigned short omnivision_sensor_addrs[] = {
42}; 43};
43 44
44 45
46static struct soc_camera_link camlink = {
47 .bus_id = 0,
48 .flags = 0,
49 .module_name = "em28xx",
50};
51
52
45/* FIXME: Should be replaced by a proper mt9m111 driver */ 53/* FIXME: Should be replaced by a proper mt9m111 driver */
46static int em28xx_initialize_mt9m111(struct em28xx *dev) 54static int em28xx_initialize_mt9m111(struct em28xx *dev)
47{ 55{
@@ -246,6 +254,7 @@ static int em28xx_probe_sensor_omnivision(struct em28xx *dev)
246 switch (id) { 254 switch (id) {
247 case 0x2642: 255 case 0x2642:
248 name = "OV2640"; 256 name = "OV2640";
257 dev->em28xx_sensor = EM28XX_OV2640;
249 break; 258 break;
250 case 0x7648: 259 case 0x7648:
251 name = "OV7648"; 260 name = "OV7648";
@@ -376,6 +385,46 @@ int em28xx_init_camera(struct em28xx *dev)
376 dev->vinctl = 0x00; 385 dev->vinctl = 0x00;
377 386
378 break; 387 break;
388 case EM28XX_OV2640:
389 {
390 struct v4l2_subdev *subdev;
391 struct i2c_board_info ov2640_info = {
392 .type = "ov2640",
393 .flags = I2C_CLIENT_SCCB,
394 .addr = dev->i2c_client[dev->def_i2c_bus].addr,
395 .platform_data = &camlink,
396 };
397 struct v4l2_mbus_framefmt fmt;
398
399 /*
400 * FIXME: sensor supports resolutions up to 1600x1200, but
401 * resolution setting/switching needs to be modified to
402 * - switch sensor output resolution (including further
403 * configuration changes)
404 * - adjust bridge xclk
405 * - disable 16 bit (12 bit) output formats on high resolutions
406 */
407 dev->sensor_xres = 640;
408 dev->sensor_yres = 480;
409
410 subdev =
411 v4l2_i2c_new_subdev_board(&dev->v4l2_dev,
412 &dev->i2c_adap[dev->def_i2c_bus],
413 &ov2640_info, NULL);
414
415 fmt.code = V4L2_MBUS_FMT_YUYV8_2X8;
416 fmt.width = 640;
417 fmt.height = 480;
418 v4l2_subdev_call(subdev, video, s_mbus_fmt, &fmt);
419
420 /* NOTE: for UXGA=1600x1200 switch to 12MHz */
421 dev->board.xclk = EM28XX_XCLK_FREQUENCY_24MHZ;
422 em28xx_write_reg(dev, EM28XX_R0F_XCLK, dev->board.xclk);
423 dev->vinmode = 0x08;
424 dev->vinctl = 0x00;
425
426 break;
427 }
379 case EM28XX_NOSENSOR: 428 case EM28XX_NOSENSOR:
380 default: 429 default:
381 return -EINVAL; 430 return -EINVAL;
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index a14492ff1fd2..a9323b63d8e5 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -364,6 +364,7 @@ enum em28xx_sensor {
364 EM28XX_MT9V011, 364 EM28XX_MT9V011,
365 EM28XX_MT9M001, 365 EM28XX_MT9M001,
366 EM28XX_MT9M111, 366 EM28XX_MT9M111,
367 EM28XX_OV2640,
367}; 368};
368 369
369enum em28xx_adecoder { 370enum em28xx_adecoder {