aurora: make it suitable for the latest version and bump PR/SRCREV
[openembedded.git] / recipes / linux / linux-omap-2.6.39 / camera / 0002-OMAP3BEAGLE-Add-support-for-mt9p031-sensor-driver.patch
blob68a762b25b9bc8b9cc9651d8d3df61659ffe1f46
1 From 186ab3a6cd3f1751b4e60044d8207eb95c4b224a Mon Sep 17 00:00:00 2001
2 From: Javier Martin <javier.martin@vista-silicon.com>
3 Date: Wed, 25 May 2011 10:09:23 +0200
4 Subject: [PATCH 2/4] OMAP3BEAGLE: Add support for mt9p031 sensor driver.
6 isp.h file has to be included as a temporal measure
7 since clocks of the isp are not exposed yet.
9 Signed-off-by: Javier Martin <javier.martin@vista-silicon.com>
10 ---
11 arch/arm/mach-omap2/board-omap3beagle.c | 73 ++++++++++++++++++++++++++++++-
12 1 files changed, 72 insertions(+), 1 deletions(-)
14 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
15 index 221bfda..9af1cf8 100644
16 --- a/arch/arm/mach-omap2/board-omap3beagle.c
17 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
18 @@ -25,15 +25,21 @@
19 #include <linux/input.h>
20 #include <linux/gpio_keys.h>
21 #include <linux/opp.h>
22 +#include <linux/i2c.h>
23 +#include <linux/mm.h>
24 +#include <linux/videodev2.h>
26 #include <linux/mtd/mtd.h>
27 #include <linux/mtd/partitions.h>
28 #include <linux/mtd/nand.h>
29 #include <linux/mmc/host.h>
31 +#include <linux/gpio.h>
32 #include <linux/regulator/machine.h>
33 #include <linux/i2c/twl.h>
35 +#include <media/mt9p031.h>
37 #include <mach/hardware.h>
38 #include <asm/mach-types.h>
39 #include <asm/mach/arch.h>
40 @@ -48,11 +54,17 @@
41 #include <plat/nand.h>
42 #include <plat/usb.h>
43 #include <plat/omap_device.h>
44 +#include <plat/i2c.h>
46 #include "mux.h"
47 #include "hsmmc.h"
48 #include "timer-gp.h"
49 #include "pm.h"
50 +#include "devices.h"
51 +#include "../../../drivers/media/video/omap3isp/isp.h"
53 +#define MT9P031_RESET_GPIO 98
54 +#define MT9P031_XCLK ISP_XCLK_A
56 #define NAND_BLOCK_SIZE SZ_128K
58 @@ -734,7 +746,7 @@ static int __init omap3_beagle_i2c_init(void)
60 omap_register_i2c_bus(1, 2600, beagle_i2c1_boardinfo,
61 ARRAY_SIZE(beagle_i2c1_boardinfo));
62 - omap_register_i2c_bus(2, 400, beagle_i2c2_boardinfo,
63 + omap_register_i2c_bus(2, 100, beagle_i2c2_boardinfo,
64 ARRAY_SIZE(beagle_i2c2_boardinfo));
65 /* Bus 3 is attached to the DVI port where devices like the pico DLP
66 * projector don't work reliably with 400kHz */
67 @@ -935,6 +947,60 @@ static void __init beagle_opp_init(void)
68 return;
71 +static int beagle_cam_set_xclk(struct v4l2_subdev *subdev, int hz)
73 + struct isp_device *isp = v4l2_dev_to_isp_device(subdev->v4l2_dev);
74 + int ret;
76 + ret = isp->platform_cb.set_xclk(isp, hz, MT9P031_XCLK);
77 + return 0;
80 +static int beagle_cam_reset(struct v4l2_subdev *subdev, int active)
82 + /* Set RESET_BAR to !active */
83 + gpio_set_value(MT9P031_RESET_GPIO, !active);
85 + return 0;
88 +static struct mt9p031_platform_data beagle_mt9p031_platform_data = {
89 + .set_xclk = beagle_cam_set_xclk,
90 + .reset = beagle_cam_reset,
91 +};
93 +static struct i2c_board_info mt9p031_camera_i2c_device = {
94 + I2C_BOARD_INFO("mt9p031", 0x48),
95 + .platform_data = &beagle_mt9p031_platform_data,
96 +};
98 +static struct isp_subdev_i2c_board_info mt9p031_camera_subdevs[] = {
99 + {
100 + .board_info = &mt9p031_camera_i2c_device,
101 + .i2c_adapter_id = 2,
102 + },
103 + { NULL, 0, },
106 +static struct isp_v4l2_subdevs_group beagle_camera_subdevs[] = {
108 + .subdevs = mt9p031_camera_subdevs,
109 + .interface = ISP_INTERFACE_PARALLEL,
110 + .bus = {
111 + .parallel = {
112 + .data_lane_shift = 0,
113 + .clk_pol = 1,
114 + .bridge = ISPCTRL_PAR_BRIDGE_DISABLE,
116 + },
117 + },
118 + { },
121 +static struct isp_platform_data beagle_isp_platform_data = {
122 + .subdevs = beagle_camera_subdevs,
125 static void __init omap3_beagle_init(void)
127 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
128 @@ -1024,6 +1090,11 @@ static void __init omap3_beagle_init(void)
130 beagle_display_init();
131 beagle_opp_init();
133 + /* Enable camera */
134 + gpio_request(MT9P031_RESET_GPIO, "cam_rst");
135 + gpio_direction_output(MT9P031_RESET_GPIO, 0);
136 + omap3_init_camera(&beagle_isp_platform_data);
139 early_param("buddy", expansionboard_setup);
141 1.6.6.1