aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/linux/linux-omap-2.6.39
diff options
context:
space:
mode:
authorKoen Kooi <koen@openembedded.org>2011-06-03 23:01:20 +0200
committerKoen Kooi <koen@openembedded.org>2011-06-03 23:02:22 +0200
commit1672042214d87572815d11bc55a04abf86dcbe0c (patch)
treefd920aed33c4069ec23c59f3a839606acf5b66cb /recipes/linux/linux-omap-2.6.39
parent5348fa080f2629f64085e1b095b00c5138fc6918 (diff)
downloadopenembedded-1672042214d87572815d11bc55a04abf86dcbe0c.tar.gz
linux-omap 2.6.39: sync with meta-texasinstruments again
Signed-off-by: Koen Kooi <koen@openembedded.org>
Diffstat (limited to 'recipes/linux/linux-omap-2.6.39')
-rw-r--r--recipes/linux/linux-omap-2.6.39/camera/0001-Add-driver-for-Aptina-Micron-mt9p031-sensor.patch (renamed from recipes/linux/linux-omap-2.6.39/camera/0001-Add-support-for-mt9p031-Aptina-Micron-sensor.patch)122
-rw-r--r--recipes/linux/linux-omap-2.6.39/camera/0002-v4l-Add-mt9v032-sensor-driver.patch2
-rw-r--r--recipes/linux/linux-omap-2.6.39/camera/0003-Add-support-for-mt9p031-LI-5M03-module-in-Beagleboar.patch56
3 files changed, 135 insertions, 45 deletions
diff --git a/recipes/linux/linux-omap-2.6.39/camera/0001-Add-support-for-mt9p031-Aptina-Micron-sensor.patch b/recipes/linux/linux-omap-2.6.39/camera/0001-Add-driver-for-Aptina-Micron-mt9p031-sensor.patch
index 7f68de4048..b0d8736113 100644
--- a/recipes/linux/linux-omap-2.6.39/camera/0001-Add-support-for-mt9p031-Aptina-Micron-sensor.patch
+++ b/recipes/linux/linux-omap-2.6.39/camera/0001-Add-driver-for-Aptina-Micron-mt9p031-sensor.patch
@@ -1,18 +1,28 @@
-From 244f96b15afbd73942762e2c07523d6c5cf68a7e Mon Sep 17 00:00:00 2001
+From bb84d2eef0f0487c4bcdf06e45dd64821de27b44 Mon Sep 17 00:00:00 2001
From: Javier Martin <javier.martin@vista-silicon.com>
-Date: Tue, 31 May 2011 11:46:49 +0200
-Subject: [PATCH 1/3] Add support for mt9p031 Aptina (Micron) sensor.
+Date: Wed, 1 Jun 2011 17:36:48 +0200
+Subject: [PATCH 1/3] Add driver for Aptina (Micron) mt9p031 sensor.
-This patch adds basic support (no controls) for
-mt9p031 sensor. It applies on kernel 2.6.39.
+Clock frequency of 57MHz used in previous version was wrong since
+when VDD_IO is 1.8V it can only support 48MHz.
+
+Two new platform flags have been added:
+
+- vdd_io: indicates whether the chip is powered with 1.8 or 2.8 VDD_IO.
+So that it can use the maximum allowed frequency.
+- version: monochrome and color versions of the chip have exactly
+the same ID, so the only way to select one of them is through
+platform data.
+
+Internal PLL is now used to generate PIXCLK depending on VDD_IO.
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
---
drivers/media/video/Kconfig | 7 +
drivers/media/video/Makefile | 1 +
- drivers/media/video/mt9p031.c | 699 +++++++++++++++++++++++++++++++++++++++++
- include/media/mt9p031.h | 11 +
- 4 files changed, 718 insertions(+), 0 deletions(-)
+ drivers/media/video/mt9p031.c | 763 +++++++++++++++++++++++++++++++++++++++++
+ include/media/mt9p031.h | 23 ++
+ 4 files changed, 794 insertions(+), 0 deletions(-)
create mode 100644 drivers/media/video/mt9p031.c
create mode 100644 include/media/mt9p031.h
@@ -48,10 +58,10 @@ index ace5d8b..912b29b 100644
obj-$(CONFIG_VIDEO_NOON010PC30) += noon010pc30.o
diff --git a/drivers/media/video/mt9p031.c b/drivers/media/video/mt9p031.c
new file mode 100644
-index 0000000..61b46a0
+index 0000000..cd830b1
--- /dev/null
+++ b/drivers/media/video/mt9p031.c
-@@ -0,0 +1,699 @@
+@@ -0,0 +1,763 @@
+/*
+ * Driver for MT9P031 CMOS Image Sensor from Aptina
+ *
@@ -80,7 +90,7 @@ index 0000000..61b46a0
+#include <media/v4l2-subdev.h>
+#include <media/v4l2-device.h>
+
-+#define MT9P031_PIXCLK_FREQ 54000000
++#define MT9P031_EXTCLK_FREQ 20000000
+
+#define MT9P031_CHIP_VERSION 0x00
+#define MT9P031_CHIP_VERSION_VALUE 0x1801
@@ -109,6 +119,18 @@ index 0000000..61b46a0
+#define MT9P031_OUTPUT_CONTROL_SYN 1
+#define MT9P031_SHUTTER_WIDTH_UPPER 0x08
+#define MT9P031_SHUTTER_WIDTH 0x09
++#define MT9P031_PLL_CONTROL 0x10
++#define MT9P031_PLL_CONTROL_PWROFF 0x0050
++#define MT9P031_PLL_CONTROL_PWRON 0x0051
++#define MT9P031_PLL_CONTROL_USEPLL 0x0052
++#define MT9P031_PLL_CONFIG_1 0x11
++#define MT9P031_PLL_CONFIG_1_M_48MHZ 0x5000
++#define MT9P031_PLL_CONFIG_1_N_48MHZ 0x05
++#define MT9P031_PLL_CONFIG_1_M_96MHZ 0x3600
++#define MT9P031_PLL_CONFIG_1_N_96MHZ 0x05
++#define MT9P031_PLL_CONFIG_2 0x12
++#define MT9P031_PLL_CONFIG_2_P1_48MHZ 5
++#define MT9P031_PLL_CONFIG_2_P1_96MHZ 2
+#define MT9P031_PIXEL_CLOCK_CONTROL 0x0a
+#define MT9P031_FRAME_RESTART 0x0b
+#define MT9P031_SHUTTER_DELAY 0x0c
@@ -123,9 +145,6 @@ index 0000000..61b46a0
+#define MT9P031_COLUMN_ADDRESS_MODE 0x23
+#define MT9P031_GLOBAL_GAIN 0x35
+
-+
-+
-+
+struct mt9p031 {
+ struct v4l2_subdev subdev;
+ struct media_pad pad;
@@ -199,7 +218,7 @@ index 0000000..61b46a0
+ }
+ /* Emable clock */
+ if (mt9p031->pdata->set_xclk)
-+ mt9p031->pdata->set_xclk(&mt9p031->subdev, MT9P031_PIXCLK_FREQ);
++ mt9p031->pdata->set_xclk(&mt9p031->subdev, MT9P031_EXTCLK_FREQ);
+ /* Now RESET_BAR must be high */
+ if (mt9p031->pdata->reset) {
+ mt9p031->pdata->reset(&mt9p031->subdev, 0);
@@ -526,6 +545,51 @@ index 0000000..61b46a0
+ return 0;
+}
+
++static int mt9p031_pll_enable(struct i2c_client *client)
++{
++ struct mt9p031 *mt9p031 = to_mt9p031(client);
++ int ret;
++
++ ret = reg_write(client, MT9P031_PLL_CONTROL, MT9P031_PLL_CONTROL_PWRON);
++ if (ret < 0)
++ return ret;
++
++ /* Always set the maximum frequency allowed by VDD_IO */
++ if (mt9p031->pdata->vdd_io == MT9P031_VDD_IO_2V8) {
++ ret = reg_write(client, MT9P031_PLL_CONFIG_1,
++ MT9P031_PLL_CONFIG_1_M_96MHZ |
++ MT9P031_PLL_CONFIG_1_N_96MHZ);
++ if (ret < 0)
++ return ret;
++ ret = reg_write(client, MT9P031_PLL_CONFIG_2,
++ MT9P031_PLL_CONFIG_2_P1_96MHZ);
++ if (ret < 0)
++ return ret;
++ } else {
++ ret = reg_write(client, MT9P031_PLL_CONFIG_1,
++ MT9P031_PLL_CONFIG_1_M_48MHZ |
++ MT9P031_PLL_CONFIG_1_N_48MHZ);
++ if (ret < 0)
++ return ret;
++ ret = reg_write(client, MT9P031_PLL_CONFIG_2,
++ MT9P031_PLL_CONFIG_2_P1_48MHZ);
++ if (ret < 0)
++ return ret;
++ }
++ mdelay(1);
++ ret = reg_write(client, MT9P031_PLL_CONTROL,
++ MT9P031_PLL_CONTROL_PWRON |
++ MT9P031_PLL_CONTROL_USEPLL);
++ mdelay(1);
++ return ret;
++}
++
++static inline int mt9p031_pll_disable(struct i2c_client *client)
++{
++ return reg_write(client, MT9P031_PLL_CONTROL,
++ MT9P031_PLL_CONTROL_PWROFF);
++}
++
+static int mt9p031_s_stream(struct v4l2_subdev *sd, int enable)
+{
+ struct mt9p031 *mt9p031 = container_of(sd, struct mt9p031, subdev);
@@ -542,10 +606,16 @@ index 0000000..61b46a0
+ /* Switch to master "normal" mode */
+ ret = mt9p031_set_output_control(mt9p031, 0,
+ MT9P031_OUTPUT_CONTROL_CEN);
++ if (ret < 0)
++ return ret;
++ ret = mt9p031_pll_enable(client);
+ } else {
+ /* Stop sensor readout */
+ ret = mt9p031_set_output_control(mt9p031,
+ MT9P031_OUTPUT_CONTROL_CEN, 0);
++ if (ret < 0)
++ return ret;
++ ret = mt9p031_pll_disable(client);
+ }
+ return ret;
+}
@@ -630,7 +700,11 @@ index 0000000..61b46a0
+ mt9p031->rect.left = MT9P031_COLUMN_START_DEF;
+ mt9p031->rect.top = MT9P031_ROW_START_DEF;
+
-+ mt9p031->format.code = V4L2_MBUS_FMT_SGRBG12_1X12;
++ if (mt9p031->pdata->version == MT9P031_MONOCHROME_VERSION)
++ mt9p031->format.code = V4L2_MBUS_FMT_Y12_1X12;
++ else
++ mt9p031->format.code = V4L2_MBUS_FMT_SGRBG12_1X12;
++
+ mt9p031->format.width = MT9P031_WINDOW_WIDTH_DEF;
+ mt9p031->format.height = MT9P031_WINDOW_HEIGHT_DEF;
+ mt9p031->format.field = V4L2_FIELD_NONE;
@@ -753,18 +827,30 @@ index 0000000..61b46a0
+MODULE_LICENSE("GPL v2");
diff --git a/include/media/mt9p031.h b/include/media/mt9p031.h
new file mode 100644
-index 0000000..ad37eb3
+index 0000000..27b4c75
--- /dev/null
+++ b/include/media/mt9p031.h
-@@ -0,0 +1,11 @@
+@@ -0,0 +1,23 @@
+#ifndef MT9P031_H
+#define MT9P031_H
+
+struct v4l2_subdev;
+
++enum {
++ MT9P031_COLOR_VERSION = 0,
++ MT9P031_MONOCHROME_VERSION = 1,
++};
++
++enum {
++ MT9P031_VDD_IO_1V8 = 0,
++ MT9P031_VDD_IO_2V8 = 1,
++};
++
+struct mt9p031_platform_data {
+ int (*set_xclk)(struct v4l2_subdev *subdev, int hz);
+ int (*reset)(struct v4l2_subdev *subdev, int active);
++ int vdd_io; /* MT9P031_VDD_IO_1V8 or MT9P031_VDD_IO_2V8 */
++ int version; /* MT9P031_COLOR_VERSION or MT9P031_MONOCHROME_VERSION */
+};
+
+#endif
diff --git a/recipes/linux/linux-omap-2.6.39/camera/0002-v4l-Add-mt9v032-sensor-driver.patch b/recipes/linux/linux-omap-2.6.39/camera/0002-v4l-Add-mt9v032-sensor-driver.patch
index 2b7e9557f2..66353eaabf 100644
--- a/recipes/linux/linux-omap-2.6.39/camera/0002-v4l-Add-mt9v032-sensor-driver.patch
+++ b/recipes/linux/linux-omap-2.6.39/camera/0002-v4l-Add-mt9v032-sensor-driver.patch
@@ -1,4 +1,4 @@
-From 78fdfee2f749cdcdfa69a008b70c4e5629b9c9df Mon Sep 17 00:00:00 2001
+From 55d8ca4b03eb04432adefa6fbf6e5f0197c7fb32 Mon Sep 17 00:00:00 2001
From: Detlev Casanova <detlev.casanova@gmail.com>
Date: Sun, 28 Nov 2010 19:07:20 +0100
Subject: [PATCH 2/3] v4l: Add mt9v032 sensor driver
diff --git a/recipes/linux/linux-omap-2.6.39/camera/0003-Add-support-for-mt9p031-LI-5M03-module-in-Beagleboar.patch b/recipes/linux/linux-omap-2.6.39/camera/0003-Add-support-for-mt9p031-LI-5M03-module-in-Beagleboar.patch
index 9f7fb006e2..31c525e223 100644
--- a/recipes/linux/linux-omap-2.6.39/camera/0003-Add-support-for-mt9p031-LI-5M03-module-in-Beagleboar.patch
+++ b/recipes/linux/linux-omap-2.6.39/camera/0003-Add-support-for-mt9p031-LI-5M03-module-in-Beagleboar.patch
@@ -1,4 +1,4 @@
-From 6cce194e3d1fbc5d746b192b4d1ff78aef6099cf Mon Sep 17 00:00:00 2001
+From c53e55e3d361eb79bc8fc27971428fc37d804ea9 Mon Sep 17 00:00:00 2001
From: Javier Martin <javier.martin@vista-silicon.com>
Date: Mon, 30 May 2011 10:37:17 +0200
Subject: [PATCH 3/3] Add support for mt9p031 (LI-5M03 module) in Beagleboard xM.
@@ -10,9 +10,9 @@ in Beagleboard xM.
Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
---
arch/arm/mach-omap2/Makefile | 1 +
- arch/arm/mach-omap2/board-omap3beagle-camera.c | 91 ++++++++++++++++++++++++
- arch/arm/mach-omap2/board-omap3beagle.c | 5 ++
- 3 files changed, 97 insertions(+), 0 deletions(-)
+ arch/arm/mach-omap2/board-omap3beagle-camera.c | 95 ++++++++++++++++++++++++
+ arch/arm/mach-omap2/board-omap3beagle.c | 5 +
+ 3 files changed, 101 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-omap2/board-omap3beagle-camera.c
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
@@ -29,17 +29,17 @@ index 512b152..05cd983 100644
hsmmc.o
diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c
new file mode 100644
-index 0000000..8387951
+index 0000000..2632557
--- /dev/null
+++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c
-@@ -0,0 +1,91 @@
+@@ -0,0 +1,95 @@
+#include <linux/gpio.h>
+#include <linux/regulator/machine.h>
+
+#include <plat/i2c.h>
+
+#include <media/mt9p031.h>
-+
++#include <asm/mach-types.h>
+#include "devices.h"
+#include "../../../drivers/media/video/omap3isp/isp.h"
+
@@ -68,6 +68,8 @@ index 0000000..8387951
+static struct mt9p031_platform_data beagle_mt9p031_platform_data = {
+ .set_xclk = beagle_cam_set_xclk,
+ .reset = beagle_cam_reset,
++ .vdd_io = MT9P031_VDD_IO_1V8,
++ .version = MT9P031_COLOR_VERSION,
+};
+
+static struct i2c_board_info mt9p031_camera_i2c_device = {
@@ -102,25 +104,27 @@ index 0000000..8387951
+ .subdevs = beagle_camera_subdevs,
+};
+
-+static int __init beagle_camera_init(void) {
-+ if(cpu_is_omap3630()){
-+ reg_1v8 = regulator_get(NULL, "cam_1v8");
-+ if (IS_ERR(reg_1v8))
-+ pr_err("%s: cannot get cam_1v8 regulator\n", __func__);
-+ else
-+ regulator_enable(reg_1v8);
-+
-+ reg_2v8 = regulator_get(NULL, "cam_2v8");
-+ if (IS_ERR(reg_2v8))
-+ pr_err("%s: cannot get cam_2v8 regulator\n", __func__);
-+ else
-+ regulator_enable(reg_2v8);
-+
-+ omap_register_i2c_bus(2, 100, NULL, 0);
-+ gpio_request(MT9P031_RESET_GPIO, "cam_rst");
-+ gpio_direction_output(MT9P031_RESET_GPIO, 0);
-+ omap3_init_camera(&beagle_isp_platform_data);
-+ }
++static int __init beagle_camera_init(void)
++{
++ if (!machine_is_omap3_beagle() || !cpu_is_omap3630())
++ return 0;
++
++ reg_1v8 = regulator_get(NULL, "cam_1v8");
++ if (IS_ERR(reg_1v8))
++ pr_err("%s: cannot get cam_1v8 regulator\n", __func__);
++ else
++ regulator_enable(reg_1v8);
++
++ reg_2v8 = regulator_get(NULL, "cam_2v8");
++ if (IS_ERR(reg_2v8))
++ pr_err("%s: cannot get cam_2v8 regulator\n", __func__);
++ else
++ regulator_enable(reg_2v8);
++
++ omap_register_i2c_bus(2, 100, NULL, 0);
++ gpio_request(MT9P031_RESET_GPIO, "cam_rst");
++ gpio_direction_output(MT9P031_RESET_GPIO, 0);
++ omap3_init_camera(&beagle_isp_platform_data);
+ return 0;
+}
+late_initcall(beagle_camera_init);