The MT9M032 is a parallel 1.6MP sensor from Micron controlled through I2C.
The driver creates a V4L2 subdevice. It currently supports cropping, gain,
exposure and v/h flipping controls in monochrome mode with an
external pixel clock.
Signed-off-by: Martin Hostettler mar...@neutronstar.dyndns.org
---
drivers/media/video/Kconfig |7 +
drivers/media/video/Makefile |1 +
drivers/media/video/mt9m032.c | 837 +
include/media/mt9m032.h | 38 ++
4 files changed, 883 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/video/mt9m032.c
create mode 100644 include/media/mt9m032.h
Changes in V4
* Use register(-value) constants from MT9P031 to fill in gaps
* Use MT9M032_CHIP_VERSION_VALUE instead of magical number
* Use i2c_smbus_{read,write}_word_swapped
* Minor error return code handling fixes
Changes in V3
* rebased to current mainline
* removed unneeded includes
* remove all translation code to hide black or active boundry sensor pixels.
Userspace now needs to select
crop in original device coordinates.
* remove useless consts, casts and defines
* changed enum_frame_size to return min == max
* removed duplicated input validation
* validate crop rectangle on set_crop
Changes in V2
* ported to current mainline
* Moved dispatching for subdev ioctls VIDIOC_DBG_G_REGISTER and
VIDIOC_DBG_S_REGISTER into v4l2-subdev
* Removed VIDIOC_DBG_G_CHIP_IDENT support
* moved header to media/
* Fixed missing error handling
* lowercase hex constants
* moved v4l2_get_subdevdata to register access helpers
* use div_u64 instead of do_div
* moved all know register values into #define:ed constants
* Fixed error reporting, used clamp instead of open coding.
* lots of style fixes.
* add try_ctrl to make sure user space sees rounded values
* Fixed some problem in control framework usage.
* Fixed set_format to force width and height setup via crop. Simplyfied code.
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index b303a3f..cf05d9b 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -820,6 +820,13 @@ config SOC_CAMERA_MT9M001
This driver supports MT9M001 cameras from Micron, monochrome
and colour models.
+config VIDEO_MT9M032
+ tristate MT9M032 camera sensor support
+ depends on I2C VIDEO_V4L2
+ help
+ This driver supports MT9M032 cameras from Micron, monochrome
+ models only.
+
config SOC_CAMERA_MT9M111
tristate mt9m111, mt9m112 and mt9m131 support
depends on SOC_CAMERA I2C
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index 117f9c4..39c7455 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -77,6 +77,7 @@ obj-$(CONFIG_VIDEO_ADP1653) += adp1653.o
obj-$(CONFIG_SOC_CAMERA_IMX074)+= imx074.o
obj-$(CONFIG_SOC_CAMERA_MT9M001) += mt9m001.o
+obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o
obj-$(CONFIG_SOC_CAMERA_MT9M111) += mt9m111.o
obj-$(CONFIG_SOC_CAMERA_MT9T031) += mt9t031.o
obj-$(CONFIG_SOC_CAMERA_MT9T112) += mt9t112.o
diff --git a/drivers/media/video/mt9m032.c b/drivers/media/video/mt9m032.c
new file mode 100644
index 000..6f1968a
--- /dev/null
+++ b/drivers/media/video/mt9m032.c
@@ -0,0 +1,837 @@
+/*
+ * Driver for MT9M032 CMOS Image Sensor from Micron
+ *
+ * Copyright (C) 2010-2011 Lund Engineering
+ * Contact: Gil Lund gwl...@lundeng.com
+ * Author: Martin Hostettler mar...@neutronstar.dyndns.org
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ */
+
+#include linux/delay.h
+#include linux/i2c.h
+#include linux/init.h
+#include linux/kernel.h
+#include linux/math64.h
+#include linux/module.h
+#include linux/slab.h
+#include linux/v4l2-mediabus.h
+
+#include media/media-entity.h
+#include media/v4l2-ctrls.h
+#include media/v4l2-device.h
+#include media/v4l2-subdev.h
+
+#include media/mt9m032.h
+
+#define MT9M032_CHIP_VERSION 0x00
+#define MT9M032_CHIP_VERSION_VALUE 0x1402
+#define MT9M032_ROW_START 0x01
+#define MT9M032_COLUMN_START 0x02
+#define MT9M032_ROW_SIZE 0x03
+#define MT9M032_COLUMN_SIZE0x04
+#define MT9M032_HBLANK 0x05
+#define MT9M032_VBLANK