Re: [PATCH] [media] v4l: Add mt9v034 sensor driver

2012-12-05 Thread Enric Balletbo Serra
Hi all,

Thanks for all your comments

2012/12/2 Sakari Ailus sakari.ai...@iki.fi:
 Hi Enric,

 Thanks for the patch. (Removing my old e-mail address from cc.)

 On Fri, Oct 05, 2012 at 12:34:47PM +0200, Enric Balletbo i Serra wrote:
 From: Enric Balletbo i Serra eballe...@iseebcn.com

 The MT9V034 is a parallel wide VGA sensor from Aptina (formerly Micron)
 controlled through I2C.

 The driver creates a V4L2 subdevice. It currently supports binning and
 cropping, and the gain, auto gain, exposure, auto exposure and test
 pattern controls.

 The following patch is based on the MT9V032 driver from Laurent Pinchart
 and was tested on IGEP tech based boards with custom expansion board with
 MT9V034 sensor.

 How different is this from the mt9v032 sensor driver? How different are the
 two sensors? Could the mt9v032 driver be used on mt9v034 as well?


Well, are similar. Did you thinking that could be merged with mt9v032 ?

My first attempt was use the mt9v032, but there was some registers
that were different and finally I decided
to use a new file to not abuse of if sentence.

IMHO, is more clear use a separate driver, but if you prefer I can
merge with mt9v032.

 Signed-off-by: Enric Balletbo i Serra eballe...@iseebcn.com
 ---
  drivers/media/i2c/Kconfig   |   10 +
  drivers/media/i2c/Makefile  |1 +
  drivers/media/i2c/mt9v034.c |  834 
 +++
  include/media/mt9v034.h |   15 +
  4 files changed, 860 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/i2c/mt9v034.c
  create mode 100644 include/media/mt9v034.h

 diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
 index 0e0793a..c35efda 100644
 --- a/drivers/media/i2c/Kconfig
 +++ b/drivers/media/i2c/Kconfig
 @@ -475,6 +475,16 @@ config VIDEO_MT9V032
 This is a Video4Linux2 sensor-level driver for the Micron
 MT9V032 752x480 CMOS sensor.

 +config VIDEO_MT9V034
 + tristate Micron MT9V034 sensor support
 + depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API
 + depends on MEDIA_CAMERA_SUPPORT
 + ---help---
 +   This is a Video4Linux2 sensor-level driver for the Micron
 +   MT9V034 752x480 CMOS sensor. The MT9V034 is a 1/3-inch
 +   wide-VGA format CMOS active-pixel digital image sensor with
 +   TrueSNAP gobal shutter and high dynamic range (HDR) operation.
 +
  config VIDEO_TCM825X
   tristate TCM825x camera sensor support
   depends on I2C  VIDEO_V4L2
 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
 index 4a270f7..9d4c417 100644
 --- a/drivers/media/i2c/Makefile
 +++ b/drivers/media/i2c/Makefile
 @@ -54,6 +54,7 @@ obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o
  obj-$(CONFIG_VIDEO_MT9T001) += mt9t001.o
  obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
  obj-$(CONFIG_VIDEO_MT9V032) += mt9v032.o
 +obj-$(CONFIG_VIDEO_MT9V034) += mt9v034.o
  obj-$(CONFIG_VIDEO_SR030PC30)+= sr030pc30.o
  obj-$(CONFIG_VIDEO_NOON010PC30)  += noon010pc30.o
  obj-$(CONFIG_VIDEO_S5K6AA)   += s5k6aa.o
 diff --git a/drivers/media/i2c/mt9v034.c b/drivers/media/i2c/mt9v034.c
 new file mode 100644
 index 000..7bbfeb6
 --- /dev/null
 +++ b/drivers/media/i2c/mt9v034.c
 @@ -0,0 +1,834 @@
 +/*
 + * Driver for MT9V034 CMOS Image Sensor from Micron
 + *
 + * Copyright (C) 2012, Enric Balletbo eballe...@iseebcn.com
 + *
 + * Based on the MT9V032 driver,
 + *
 + * Copyright (C) 2010, Laurent Pinchart laurent.pinch...@ideasonboard.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +
 +#include linux/delay.h
 +#include linux/i2c.h
 +#include linux/log2.h
 +#include linux/mutex.h
 +#include linux/slab.h
 +#include linux/videodev2.h
 +#include linux/v4l2-mediabus.h
 +#include linux/module.h
 +
 +#include media/mt9v034.h
 +#include media/v4l2-ctrls.h
 +#include media/v4l2-device.h
 +#include media/v4l2-subdev.h
 +
 +#define MT9V034_PIXEL_ARRAY_HEIGHT   499
 +#define MT9V034_PIXEL_ARRAY_WIDTH809
 +
 +#define MT9V034_SYSCLK_FREQ_DEF  2660

 Isn't this purely board/SoC dependent? Typically sensors can accept a range
 instead.


No, is the master clock (SYSCLK) default value from sensor, although
the master clock range is form 13MHz to 27MHz

 +
 +#define MT9V034_CHIP_VERSION 0x00
 +#define  MT9V034_CHIP_ID_REV10x1324
 +#define MT9V034_COLUMN_START 0x01
 +#define  MT9V034_COLUMN_START_MIN1
 +#define  MT9V034_COLUMN_START_DEF1
 +#define  MT9V034_COLUMN_START_MAX752
 +#define MT9V034_ROW_START0x02
 +#define  MT9V034_ROW_START_MIN   4
 +#define  MT9V034_ROW_START_DEF   4
 +#define  

Re: [PATCH] [media] v4l: Add mt9v034 sensor driver

2012-12-02 Thread Sakari Ailus
Hi Enric,

Thanks for the patch. (Removing my old e-mail address from cc.)

On Fri, Oct 05, 2012 at 12:34:47PM +0200, Enric Balletbo i Serra wrote:
 From: Enric Balletbo i Serra eballe...@iseebcn.com
 
 The MT9V034 is a parallel wide VGA sensor from Aptina (formerly Micron)
 controlled through I2C.
 
 The driver creates a V4L2 subdevice. It currently supports binning and
 cropping, and the gain, auto gain, exposure, auto exposure and test
 pattern controls.
 
 The following patch is based on the MT9V032 driver from Laurent Pinchart
 and was tested on IGEP tech based boards with custom expansion board with
 MT9V034 sensor.

How different is this from the mt9v032 sensor driver? How different are the
two sensors? Could the mt9v032 driver be used on mt9v034 as well?

 Signed-off-by: Enric Balletbo i Serra eballe...@iseebcn.com
 ---
  drivers/media/i2c/Kconfig   |   10 +
  drivers/media/i2c/Makefile  |1 +
  drivers/media/i2c/mt9v034.c |  834 
 +++
  include/media/mt9v034.h |   15 +
  4 files changed, 860 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/i2c/mt9v034.c
  create mode 100644 include/media/mt9v034.h
 
 diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
 index 0e0793a..c35efda 100644
 --- a/drivers/media/i2c/Kconfig
 +++ b/drivers/media/i2c/Kconfig
 @@ -475,6 +475,16 @@ config VIDEO_MT9V032
 This is a Video4Linux2 sensor-level driver for the Micron
 MT9V032 752x480 CMOS sensor.
  
 +config VIDEO_MT9V034
 + tristate Micron MT9V034 sensor support
 + depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API
 + depends on MEDIA_CAMERA_SUPPORT
 + ---help---
 +   This is a Video4Linux2 sensor-level driver for the Micron
 +   MT9V034 752x480 CMOS sensor. The MT9V034 is a 1/3-inch
 +   wide-VGA format CMOS active-pixel digital image sensor with
 +   TrueSNAP gobal shutter and high dynamic range (HDR) operation.
 +
  config VIDEO_TCM825X
   tristate TCM825x camera sensor support
   depends on I2C  VIDEO_V4L2
 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
 index 4a270f7..9d4c417 100644
 --- a/drivers/media/i2c/Makefile
 +++ b/drivers/media/i2c/Makefile
 @@ -54,6 +54,7 @@ obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o
  obj-$(CONFIG_VIDEO_MT9T001) += mt9t001.o
  obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
  obj-$(CONFIG_VIDEO_MT9V032) += mt9v032.o
 +obj-$(CONFIG_VIDEO_MT9V034) += mt9v034.o
  obj-$(CONFIG_VIDEO_SR030PC30)+= sr030pc30.o
  obj-$(CONFIG_VIDEO_NOON010PC30)  += noon010pc30.o
  obj-$(CONFIG_VIDEO_S5K6AA)   += s5k6aa.o
 diff --git a/drivers/media/i2c/mt9v034.c b/drivers/media/i2c/mt9v034.c
 new file mode 100644
 index 000..7bbfeb6
 --- /dev/null
 +++ b/drivers/media/i2c/mt9v034.c
 @@ -0,0 +1,834 @@
 +/*
 + * Driver for MT9V034 CMOS Image Sensor from Micron
 + *
 + * Copyright (C) 2012, Enric Balletbo eballe...@iseebcn.com
 + *
 + * Based on the MT9V032 driver,
 + *
 + * Copyright (C) 2010, Laurent Pinchart laurent.pinch...@ideasonboard.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +
 +#include linux/delay.h
 +#include linux/i2c.h
 +#include linux/log2.h
 +#include linux/mutex.h
 +#include linux/slab.h
 +#include linux/videodev2.h
 +#include linux/v4l2-mediabus.h
 +#include linux/module.h
 +
 +#include media/mt9v034.h
 +#include media/v4l2-ctrls.h
 +#include media/v4l2-device.h
 +#include media/v4l2-subdev.h
 +
 +#define MT9V034_PIXEL_ARRAY_HEIGHT   499
 +#define MT9V034_PIXEL_ARRAY_WIDTH809
 +
 +#define MT9V034_SYSCLK_FREQ_DEF  2660

Isn't this purely board/SoC dependent? Typically sensors can accept a range
instead.

 +
 +#define MT9V034_CHIP_VERSION 0x00
 +#define  MT9V034_CHIP_ID_REV10x1324
 +#define MT9V034_COLUMN_START 0x01
 +#define  MT9V034_COLUMN_START_MIN1
 +#define  MT9V034_COLUMN_START_DEF1
 +#define  MT9V034_COLUMN_START_MAX752
 +#define MT9V034_ROW_START0x02
 +#define  MT9V034_ROW_START_MIN   4
 +#define  MT9V034_ROW_START_DEF   4
 +#define  MT9V034_ROW_START_MAX   482
 +#define MT9V034_WINDOW_HEIGHT0x03
 +#define  MT9V034_WINDOW_HEIGHT_MIN   1
 +#define  MT9V034_WINDOW_HEIGHT_DEF   480
 +#define  MT9V034_WINDOW_HEIGHT_MAX   480
 +#define MT9V034_WINDOW_WIDTH 0x04
 +#define  MT9V034_WINDOW_WIDTH_MIN1
 +#define  MT9V034_WINDOW_WIDTH_DEF752
 +#define  

Re: [PATCH] [media] v4l: Add mt9v034 sensor driver

2012-11-30 Thread Alexey Klimov
Hi Enric,

May i ask about mt9v034_probe() and mt9v034_remove()?

On Fri, Oct 5, 2012 at 2:34 PM, Enric Balletbo i Serra
eballe...@gmail.com wrote:
 From: Enric Balletbo i Serra eballe...@iseebcn.com

 The MT9V034 is a parallel wide VGA sensor from Aptina (formerly Micron)
 controlled through I2C.

 The driver creates a V4L2 subdevice. It currently supports binning and
 cropping, and the gain, auto gain, exposure, auto exposure and test
 pattern controls.

 The following patch is based on the MT9V032 driver from Laurent Pinchart
 and was tested on IGEP tech based boards with custom expansion board with
 MT9V034 sensor.

 Signed-off-by: Enric Balletbo i Serra eballe...@iseebcn.com
 ---
  drivers/media/i2c/Kconfig   |   10 +
  drivers/media/i2c/Makefile  |1 +
  drivers/media/i2c/mt9v034.c |  834 
 +++
  include/media/mt9v034.h |   15 +
  4 files changed, 860 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/i2c/mt9v034.c
  create mode 100644 include/media/mt9v034.h

 diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
 index 0e0793a..c35efda 100644
 --- a/drivers/media/i2c/Kconfig
 +++ b/drivers/media/i2c/Kconfig
 @@ -475,6 +475,16 @@ config VIDEO_MT9V032
   This is a Video4Linux2 sensor-level driver for the Micron
   MT9V032 752x480 CMOS sensor.

 +config VIDEO_MT9V034
 +   tristate Micron MT9V034 sensor support
 +   depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API
 +   depends on MEDIA_CAMERA_SUPPORT
 +   ---help---
 + This is a Video4Linux2 sensor-level driver for the Micron
 + MT9V034 752x480 CMOS sensor. The MT9V034 is a 1/3-inch
 + wide-VGA format CMOS active-pixel digital image sensor with
 + TrueSNAP gobal shutter and high dynamic range (HDR) operation.
 +
  config VIDEO_TCM825X
 tristate TCM825x camera sensor support
 depends on I2C  VIDEO_V4L2
 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
 index 4a270f7..9d4c417 100644
 --- a/drivers/media/i2c/Makefile
 +++ b/drivers/media/i2c/Makefile
 @@ -54,6 +54,7 @@ obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o
  obj-$(CONFIG_VIDEO_MT9T001) += mt9t001.o
  obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
  obj-$(CONFIG_VIDEO_MT9V032) += mt9v032.o
 +obj-$(CONFIG_VIDEO_MT9V034) += mt9v034.o
  obj-$(CONFIG_VIDEO_SR030PC30)  += sr030pc30.o
  obj-$(CONFIG_VIDEO_NOON010PC30)+= noon010pc30.o
  obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o
 diff --git a/drivers/media/i2c/mt9v034.c b/drivers/media/i2c/mt9v034.c
 new file mode 100644
 index 000..7bbfeb6
 --- /dev/null
 +++ b/drivers/media/i2c/mt9v034.c
 @@ -0,0 +1,834 @@
 +/*
 + * Driver for MT9V034 CMOS Image Sensor from Micron
 + *
 + * Copyright (C) 2012, Enric Balletbo eballe...@iseebcn.com
 + *
 + * Based on the MT9V032 driver,
 + *
 + * Copyright (C) 2010, Laurent Pinchart laurent.pinch...@ideasonboard.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +
 +#include linux/delay.h
 +#include linux/i2c.h
 +#include linux/log2.h
 +#include linux/mutex.h
 +#include linux/slab.h
 +#include linux/videodev2.h
 +#include linux/v4l2-mediabus.h
 +#include linux/module.h
 +
 +#include media/mt9v034.h
 +#include media/v4l2-ctrls.h
 +#include media/v4l2-device.h
 +#include media/v4l2-subdev.h
 +
 +#define MT9V034_PIXEL_ARRAY_HEIGHT 499
 +#define MT9V034_PIXEL_ARRAY_WIDTH  809
 +
 +#define MT9V034_SYSCLK_FREQ_DEF2660
 +
 +#define MT9V034_CHIP_VERSION   0x00
 +#defineMT9V034_CHIP_ID_REV10x1324
 +#define MT9V034_COLUMN_START   0x01
 +#defineMT9V034_COLUMN_START_MIN1
 +#defineMT9V034_COLUMN_START_DEF1
 +#defineMT9V034_COLUMN_START_MAX752
 +#define MT9V034_ROW_START  0x02
 +#defineMT9V034_ROW_START_MIN   4
 +#defineMT9V034_ROW_START_DEF   4
 +#defineMT9V034_ROW_START_MAX   482
 +#define MT9V034_WINDOW_HEIGHT  0x03
 +#defineMT9V034_WINDOW_HEIGHT_MIN   1
 +#defineMT9V034_WINDOW_HEIGHT_DEF   480
 +#defineMT9V034_WINDOW_HEIGHT_MAX   480
 +#define MT9V034_WINDOW_WIDTH   0x04
 +#defineMT9V034_WINDOW_WIDTH_MIN1
 +#defineMT9V034_WINDOW_WIDTH_DEF752
 +#defineMT9V034_WINDOW_WIDTH_MAX752
 +#define MT9V034_HORIZONTAL_BLANKING0x05
 +#defineMT9V034_HORIZONTAL_BLANKING_MIN 61
 

Re: [PATCH] [media] v4l: Add mt9v034 sensor driver

2012-11-29 Thread Sylwester Nawrocki

Hi Enric,

In general this driver looks good to me. However it seems you're
using it together with the omap3isp driver. Likely Laurent and Sakari
may have some comments on that.

Just one thing I'm unsure about, please see below.

On 10/05/2012 12:34 PM, Enric Balletbo i Serra wrote:

From: Enric Balletbo i Serraeballe...@iseebcn.com

The MT9V034 is a parallel wide VGA sensor from Aptina (formerly Micron)
controlled through I2C.

The driver creates a V4L2 subdevice. It currently supports binning and
cropping, and the gain, auto gain, exposure, auto exposure and test
pattern controls.

The following patch is based on the MT9V032 driver from Laurent Pinchart
and was tested on IGEP tech based boards with custom expansion board with
MT9V034 sensor.

Signed-off-by: Enric Balletbo i Serraeballe...@iseebcn.com
---
  drivers/media/i2c/Kconfig   |   10 +
  drivers/media/i2c/Makefile  |1 +
  drivers/media/i2c/mt9v034.c |  834 +++
  include/media/mt9v034.h |   15 +
  4 files changed, 860 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/i2c/mt9v034.c
  create mode 100644 include/media/mt9v034.h

...

+static int mt9v034_enum_frame_size(struct v4l2_subdev *subdev,
+  struct v4l2_subdev_fh *fh,
+  struct v4l2_subdev_frame_size_enum *fse)
+{
+   if (fse-index= 8 || fse-code != V4L2_MBUS_FMT_SBGGR10_1X10)
+   return -EINVAL;
+
+   fse-min_width = MT9V034_WINDOW_WIDTH_DEF / fse-index;
+   fse-max_width = fse-min_width;
+   fse-min_height = MT9V034_WINDOW_HEIGHT_DEF / fse-index;
+   fse-max_height = fse-min_height;
+
+   return 0;
+}


Have you actually tested VIDIOC_SUBDEV_ENUM_FRAME_SIZE ioctl with the index
field set to 0 ? Shouldn't (fse-index + 1) be used as a denominator 
instead ?


--

Regards,
Sylwester
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] v4l: Add mt9v034 sensor driver

2012-11-29 Thread Prabhakar Lad
Hi Enric,

Thanks for the patch. Below are few comments.

On Fri, Oct 5, 2012 at 4:04 PM, Enric Balletbo i Serra
eballe...@gmail.com wrote:
 From: Enric Balletbo i Serra eballe...@iseebcn.com

 The MT9V034 is a parallel wide VGA sensor from Aptina (formerly Micron)
 controlled through I2C.

 The driver creates a V4L2 subdevice. It currently supports binning and
 cropping, and the gain, auto gain, exposure, auto exposure and test
 pattern controls.

 The following patch is based on the MT9V032 driver from Laurent Pinchart
 and was tested on IGEP tech based boards with custom expansion board with
 MT9V034 sensor.

 Signed-off-by: Enric Balletbo i Serra eballe...@iseebcn.com
 ---
  drivers/media/i2c/Kconfig   |   10 +
  drivers/media/i2c/Makefile  |1 +
  drivers/media/i2c/mt9v034.c |  834 
 +++
  include/media/mt9v034.h |   15 +
  4 files changed, 860 insertions(+), 0 deletions(-)
  create mode 100644 drivers/media/i2c/mt9v034.c
  create mode 100644 include/media/mt9v034.h

 diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
 index 0e0793a..c35efda 100644
 --- a/drivers/media/i2c/Kconfig
 +++ b/drivers/media/i2c/Kconfig
 @@ -475,6 +475,16 @@ config VIDEO_MT9V032
   This is a Video4Linux2 sensor-level driver for the Micron
   MT9V032 752x480 CMOS sensor.

 +config VIDEO_MT9V034
 +   tristate Micron MT9V034 sensor support
 +   depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API
 +   depends on MEDIA_CAMERA_SUPPORT
 +   ---help---
 + This is a Video4Linux2 sensor-level driver for the Micron
 + MT9V034 752x480 CMOS sensor. The MT9V034 is a 1/3-inch
 + wide-VGA format CMOS active-pixel digital image sensor with
 + TrueSNAP gobal shutter and high dynamic range (HDR) operation.
 +
  config VIDEO_TCM825X
 tristate TCM825x camera sensor support
 depends on I2C  VIDEO_V4L2
 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
 index 4a270f7..9d4c417 100644
 --- a/drivers/media/i2c/Makefile
 +++ b/drivers/media/i2c/Makefile
 @@ -54,6 +54,7 @@ obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o
  obj-$(CONFIG_VIDEO_MT9T001) += mt9t001.o
  obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
  obj-$(CONFIG_VIDEO_MT9V032) += mt9v032.o
 +obj-$(CONFIG_VIDEO_MT9V034) += mt9v034.o
  obj-$(CONFIG_VIDEO_SR030PC30)  += sr030pc30.o
  obj-$(CONFIG_VIDEO_NOON010PC30)+= noon010pc30.o
  obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o
 diff --git a/drivers/media/i2c/mt9v034.c b/drivers/media/i2c/mt9v034.c
 new file mode 100644
 index 000..7bbfeb6
 --- /dev/null
 +++ b/drivers/media/i2c/mt9v034.c
 @@ -0,0 +1,834 @@
 +/*
 + * Driver for MT9V034 CMOS Image Sensor from Micron
 + *
 + * Copyright (C) 2012, Enric Balletbo eballe...@iseebcn.com
 + *
 + * Based on the MT9V032 driver,
 + *
 + * Copyright (C) 2010, Laurent Pinchart laurent.pinch...@ideasonboard.com
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * published by the Free Software Foundation.
 + */
 +
 +#include linux/delay.h
 +#include linux/i2c.h
 +#include linux/log2.h
 +#include linux/mutex.h
 +#include linux/slab.h
 +#include linux/videodev2.h
 +#include linux/v4l2-mediabus.h
 +#include linux/module.h
 +
Can you sort it alphabetically ? But left to you.

 +#include media/mt9v034.h
 +#include media/v4l2-ctrls.h
 +#include media/v4l2-device.h
 +#include media/v4l2-subdev.h
 +
 +#define MT9V034_PIXEL_ARRAY_HEIGHT 499
 +#define MT9V034_PIXEL_ARRAY_WIDTH  809
 +
 +#define MT9V034_SYSCLK_FREQ_DEF2660
 +
 +#define MT9V034_CHIP_VERSION   0x00
 +#defineMT9V034_CHIP_ID_REV10x1324
 +#define MT9V034_COLUMN_START   0x01
 +#defineMT9V034_COLUMN_START_MIN1
 +#defineMT9V034_COLUMN_START_DEF1
 +#defineMT9V034_COLUMN_START_MAX752
 +#define MT9V034_ROW_START  0x02
 +#defineMT9V034_ROW_START_MIN   4
 +#defineMT9V034_ROW_START_DEF   4
 +#defineMT9V034_ROW_START_MAX   482
 +#define MT9V034_WINDOW_HEIGHT  0x03
 +#defineMT9V034_WINDOW_HEIGHT_MIN   1
 +#defineMT9V034_WINDOW_HEIGHT_DEF   480
 +#defineMT9V034_WINDOW_HEIGHT_MAX   480
 +#define MT9V034_WINDOW_WIDTH   0x04
 +#defineMT9V034_WINDOW_WIDTH_MIN1
 +#defineMT9V034_WINDOW_WIDTH_DEF752
 +#defineMT9V034_WINDOW_WIDTH_MAX752
 +#define MT9V034_HORIZONTAL_BLANKING0x05
 +#define

[PATCH] [media] v4l: Add mt9v034 sensor driver

2012-10-05 Thread Enric Balletbo i Serra
From: Enric Balletbo i Serra eballe...@iseebcn.com

The MT9V034 is a parallel wide VGA sensor from Aptina (formerly Micron)
controlled through I2C.

The driver creates a V4L2 subdevice. It currently supports binning and
cropping, and the gain, auto gain, exposure, auto exposure and test
pattern controls.

The following patch is based on the MT9V032 driver from Laurent Pinchart
and was tested on IGEP tech based boards with custom expansion board with
MT9V034 sensor.

Signed-off-by: Enric Balletbo i Serra eballe...@iseebcn.com
---
 drivers/media/i2c/Kconfig   |   10 +
 drivers/media/i2c/Makefile  |1 +
 drivers/media/i2c/mt9v034.c |  834 +++
 include/media/mt9v034.h |   15 +
 4 files changed, 860 insertions(+), 0 deletions(-)
 create mode 100644 drivers/media/i2c/mt9v034.c
 create mode 100644 include/media/mt9v034.h

diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 0e0793a..c35efda 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -475,6 +475,16 @@ config VIDEO_MT9V032
  This is a Video4Linux2 sensor-level driver for the Micron
  MT9V032 752x480 CMOS sensor.
 
+config VIDEO_MT9V034
+   tristate Micron MT9V034 sensor support
+   depends on I2C  VIDEO_V4L2  VIDEO_V4L2_SUBDEV_API
+   depends on MEDIA_CAMERA_SUPPORT
+   ---help---
+ This is a Video4Linux2 sensor-level driver for the Micron
+ MT9V034 752x480 CMOS sensor. The MT9V034 is a 1/3-inch
+ wide-VGA format CMOS active-pixel digital image sensor with
+ TrueSNAP gobal shutter and high dynamic range (HDR) operation.
+
 config VIDEO_TCM825X
tristate TCM825x camera sensor support
depends on I2C  VIDEO_V4L2
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 4a270f7..9d4c417 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -54,6 +54,7 @@ obj-$(CONFIG_VIDEO_MT9P031) += mt9p031.o
 obj-$(CONFIG_VIDEO_MT9T001) += mt9t001.o
 obj-$(CONFIG_VIDEO_MT9V011) += mt9v011.o
 obj-$(CONFIG_VIDEO_MT9V032) += mt9v032.o
+obj-$(CONFIG_VIDEO_MT9V034) += mt9v034.o
 obj-$(CONFIG_VIDEO_SR030PC30)  += sr030pc30.o
 obj-$(CONFIG_VIDEO_NOON010PC30)+= noon010pc30.o
 obj-$(CONFIG_VIDEO_S5K6AA) += s5k6aa.o
diff --git a/drivers/media/i2c/mt9v034.c b/drivers/media/i2c/mt9v034.c
new file mode 100644
index 000..7bbfeb6
--- /dev/null
+++ b/drivers/media/i2c/mt9v034.c
@@ -0,0 +1,834 @@
+/*
+ * Driver for MT9V034 CMOS Image Sensor from Micron
+ *
+ * Copyright (C) 2012, Enric Balletbo eballe...@iseebcn.com
+ *
+ * Based on the MT9V032 driver,
+ *
+ * Copyright (C) 2010, Laurent Pinchart laurent.pinch...@ideasonboard.com
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include linux/delay.h
+#include linux/i2c.h
+#include linux/log2.h
+#include linux/mutex.h
+#include linux/slab.h
+#include linux/videodev2.h
+#include linux/v4l2-mediabus.h
+#include linux/module.h
+
+#include media/mt9v034.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-device.h
+#include media/v4l2-subdev.h
+
+#define MT9V034_PIXEL_ARRAY_HEIGHT 499
+#define MT9V034_PIXEL_ARRAY_WIDTH  809
+
+#define MT9V034_SYSCLK_FREQ_DEF2660
+
+#define MT9V034_CHIP_VERSION   0x00
+#defineMT9V034_CHIP_ID_REV10x1324
+#define MT9V034_COLUMN_START   0x01
+#defineMT9V034_COLUMN_START_MIN1
+#defineMT9V034_COLUMN_START_DEF1
+#defineMT9V034_COLUMN_START_MAX752
+#define MT9V034_ROW_START  0x02
+#defineMT9V034_ROW_START_MIN   4
+#defineMT9V034_ROW_START_DEF   4
+#defineMT9V034_ROW_START_MAX   482
+#define MT9V034_WINDOW_HEIGHT  0x03
+#defineMT9V034_WINDOW_HEIGHT_MIN   1
+#defineMT9V034_WINDOW_HEIGHT_DEF   480
+#defineMT9V034_WINDOW_HEIGHT_MAX   480
+#define MT9V034_WINDOW_WIDTH   0x04
+#defineMT9V034_WINDOW_WIDTH_MIN1
+#defineMT9V034_WINDOW_WIDTH_DEF752
+#defineMT9V034_WINDOW_WIDTH_MAX752
+#define MT9V034_HORIZONTAL_BLANKING0x05
+#defineMT9V034_HORIZONTAL_BLANKING_MIN 61
+#defineMT9V034_HORIZONTAL_BLANKING_DEF 94
+#defineMT9V034_HORIZONTAL_BLANKING_MAX 1023
+#define MT9V034_VERTICAL_BLANKING  0x06
+#defineMT9V034_VERTICAL_BLANKING_MIN