diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0004-omap3beagle-Add-camera-support.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0004-omap3beagle-Add-camera-support.patch | 352 |
1 files changed, 352 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0004-omap3beagle-Add-camera-support.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0004-omap3beagle-Add-camera-support.patch new file mode 100644 index 00000000..511bd93c --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0004-omap3beagle-Add-camera-support.patch | |||
@@ -0,0 +1,352 @@ | |||
1 | From 8b7b00860ac8c558c7156ff676655942027f7f53 Mon Sep 17 00:00:00 2001 | ||
2 | From: Sergio Aguirre <saaguirre@ti.com> | ||
3 | Date: Fri, 11 Jun 2010 16:15:58 -0500 | ||
4 | Subject: [PATCH 04/75] omap3beagle: Add camera support | ||
5 | |||
6 | This is tested with the xM + Leopard imaging module camera, which | ||
7 | has a MT9T111. | ||
8 | |||
9 | Signed-off-by: Sergio Aguirre <saaguirre@ti.com> | ||
10 | --- | ||
11 | arch/arm/mach-omap2/Makefile | 3 +- | ||
12 | arch/arm/mach-omap2/board-omap3beagle-camera.c | 228 ++++++++++++++++++++++++ | ||
13 | arch/arm/mach-omap2/board-omap3beagle-camera.h | 41 +++++ | ||
14 | arch/arm/mach-omap2/board-omap3beagle.c | 25 +++ | ||
15 | 4 files changed, 296 insertions(+), 1 deletions(-) | ||
16 | create mode 100644 arch/arm/mach-omap2/board-omap3beagle-camera.c | ||
17 | create mode 100644 arch/arm/mach-omap2/board-omap3beagle-camera.h | ||
18 | |||
19 | diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile | ||
20 | index 9042317..a49d436 100644 | ||
21 | --- a/arch/arm/mach-omap2/Makefile | ||
22 | +++ b/arch/arm/mach-omap2/Makefile | ||
23 | @@ -87,7 +87,8 @@ obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o \ | ||
24 | mmc-twl4030.o | ||
25 | obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o | ||
26 | obj-$(CONFIG_MACH_OMAP3_BEAGLE) += board-omap3beagle.o \ | ||
27 | - mmc-twl4030.o | ||
28 | + mmc-twl4030.o \ | ||
29 | + board-omap3beagle-camera.o | ||
30 | obj-$(CONFIG_MACH_OMAP_LDP) += board-ldp.o \ | ||
31 | mmc-twl4030.o \ | ||
32 | board-ldp-camera.o | ||
33 | diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c | ||
34 | new file mode 100644 | ||
35 | index 0000000..e93437f | ||
36 | --- /dev/null | ||
37 | +++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c | ||
38 | @@ -0,0 +1,228 @@ | ||
39 | +/* | ||
40 | + * Driver for Leopard Module Board used in Beagleboard (xM) | ||
41 | + * | ||
42 | + * Copyright (C) 2010 Texas Instruments Inc | ||
43 | + * Author: Sergio Aguirre <saaguirre@ti.com> | ||
44 | + * | ||
45 | + * Based on work done by: | ||
46 | + * Vaibhav Hiremath <hvaibhav@ti.com> | ||
47 | + * Anuj Aggarwal <anuj.aggarwal@ti.com> | ||
48 | + * Sivaraj R <sivaraj@ti.com> | ||
49 | + * | ||
50 | + * This package is free software; you can redistribute it and/or modify | ||
51 | + * it under the terms of the GNU General Public License version 2 as | ||
52 | + * published by the Free Software Foundation. | ||
53 | + * | ||
54 | + * This program is distributed in the hope that it will be useful, | ||
55 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
56 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
57 | + * GNU General Public License for more details. | ||
58 | + * | ||
59 | + * You should have received a copy of the GNU General Public License | ||
60 | + * along with this program; if not, write to the Free Software | ||
61 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
62 | + */ | ||
63 | + | ||
64 | +#include <linux/init.h> | ||
65 | +#include <linux/i2c.h> | ||
66 | +#include <linux/gpio.h> | ||
67 | +#include <linux/mm.h> | ||
68 | +#include <linux/videodev2.h> | ||
69 | +#include <linux/i2c/twl.h> | ||
70 | +#include <linux/delay.h> | ||
71 | + | ||
72 | +#include <plat/mux.h> | ||
73 | +#include <plat/board.h> | ||
74 | + | ||
75 | +#include <media/v4l2-int-device.h> | ||
76 | +#include <media/mt9t111.h> | ||
77 | + | ||
78 | +/* Include V4L2 ISP-Camera driver related header file */ | ||
79 | +#include <../drivers/media/video/omap34xxcam.h> | ||
80 | +#include <../drivers/media/video/isp/ispreg.h> | ||
81 | + | ||
82 | +#include "mux.h" | ||
83 | +#include "board-omap3beagle-camera.h" | ||
84 | + | ||
85 | +#define MODULE_NAME "omap3beaglelmb" | ||
86 | + | ||
87 | +#define MT9T111_I2C_BUSNUM (2) | ||
88 | + | ||
89 | +#define CAM_USE_XCLKA 1 | ||
90 | + | ||
91 | +#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) | ||
92 | +static struct isp_interface_config mt9t111_if_config = { | ||
93 | + .ccdc_par_ser = ISP_PARLL, | ||
94 | + .dataline_shift = 0x0, | ||
95 | + .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE, | ||
96 | + .strobe = 0x0, | ||
97 | + .prestrobe = 0x0, | ||
98 | + .shutter = 0x0, | ||
99 | + .u.par.par_bridge = 0x1, | ||
100 | + .u.par.par_clk_pol = 0x0, | ||
101 | +}; | ||
102 | + | ||
103 | +static struct v4l2_ifparm mt9t111_ifparm_s = { | ||
104 | +#if 1 | ||
105 | + .if_type = V4L2_IF_TYPE_RAW, | ||
106 | + .u = { | ||
107 | + .raw = { | ||
108 | + .frame_start_on_rising_vs = 1, | ||
109 | + .bt_sync_correct = 0, | ||
110 | + .swap = 0, | ||
111 | + .latch_clk_inv = 0, | ||
112 | + .nobt_hs_inv = 0, /* active high */ | ||
113 | + .nobt_vs_inv = 0, /* active high */ | ||
114 | + .clock_min = MT9T111_CLK_MIN, | ||
115 | + .clock_max = MT9T111_CLK_MAX, | ||
116 | + }, | ||
117 | + }, | ||
118 | +#else | ||
119 | + .if_type = V4L2_IF_TYPE_YCbCr, | ||
120 | + .u = { | ||
121 | + .ycbcr = { | ||
122 | + .frame_start_on_rising_vs = 1, | ||
123 | + .bt_sync_correct = 0, | ||
124 | + .swap = 0, | ||
125 | + .latch_clk_inv = 0, | ||
126 | + .nobt_hs_inv = 0, /* active high */ | ||
127 | + .nobt_vs_inv = 0, /* active high */ | ||
128 | + .clock_min = MT9T111_CLK_MIN, | ||
129 | + .clock_max = MT9T111_CLK_MAX, | ||
130 | + }, | ||
131 | + }, | ||
132 | +#endif | ||
133 | +}; | ||
134 | + | ||
135 | +/** | ||
136 | + * @brief mt9t111_ifparm - Returns the mt9t111 interface parameters | ||
137 | + * | ||
138 | + * @param p - pointer to v4l2_ifparm structure | ||
139 | + * | ||
140 | + * @return result of operation - 0 is success | ||
141 | + */ | ||
142 | +static int mt9t111_ifparm(struct v4l2_ifparm *p) | ||
143 | +{ | ||
144 | + if (p == NULL) | ||
145 | + return -EINVAL; | ||
146 | + | ||
147 | + *p = mt9t111_ifparm_s; | ||
148 | + return 0; | ||
149 | +} | ||
150 | + | ||
151 | +#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) | ||
152 | +static struct omap34xxcam_hw_config mt9t111_hwc = { | ||
153 | + .dev_index = 0, | ||
154 | + .dev_minor = 0, | ||
155 | + .dev_type = OMAP34XXCAM_SLAVE_SENSOR, | ||
156 | + .u.sensor.sensor_isp = 1, | ||
157 | +}; | ||
158 | +#endif | ||
159 | + | ||
160 | +/** | ||
161 | + * @brief mt9t111_set_prv_data - Returns mt9t111 omap34xx driver private data | ||
162 | + * | ||
163 | + * @param priv - pointer to omap34xxcam_hw_config structure | ||
164 | + * | ||
165 | + * @return result of operation - 0 is success | ||
166 | + */ | ||
167 | +static int mt9t111_set_prv_data(void *priv) | ||
168 | +{ | ||
169 | +#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) | ||
170 | + struct omap34xxcam_hw_config *hwc = priv; | ||
171 | + | ||
172 | + if (priv == NULL) | ||
173 | + return -EINVAL; | ||
174 | + | ||
175 | + hwc->u.sensor = mt9t111_hwc.u.sensor; | ||
176 | + hwc->dev_index = mt9t111_hwc.dev_index; | ||
177 | + hwc->dev_minor = mt9t111_hwc.dev_minor; | ||
178 | + hwc->dev_type = mt9t111_hwc.dev_type; | ||
179 | + return 0; | ||
180 | +#else | ||
181 | + return -EINVAL; | ||
182 | +#endif | ||
183 | +} | ||
184 | + | ||
185 | +/** | ||
186 | + * @brief mt9t111_power_set - Power-on or power-off TVP5146 device | ||
187 | + * | ||
188 | + * @param power - enum, Power on/off, resume/standby | ||
189 | + * | ||
190 | + * @return result of operation - 0 is success | ||
191 | + */ | ||
192 | +static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power) | ||
193 | +{ | ||
194 | + struct omap34xxcam_videodev *vdev = s->u.slave->master->priv; | ||
195 | + | ||
196 | + switch (power) { | ||
197 | + case V4L2_POWER_OFF: | ||
198 | + isp_set_xclk(vdev->cam->isp, 0, CAM_USE_XCLKA); | ||
199 | + break; | ||
200 | + | ||
201 | + case V4L2_POWER_STANDBY: | ||
202 | + break; | ||
203 | + | ||
204 | + case V4L2_POWER_ON: | ||
205 | + isp_set_xclk(vdev->cam->isp, MT9T111_CLK_MIN, CAM_USE_XCLKA); | ||
206 | + | ||
207 | +#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) | ||
208 | + isp_configure_interface(vdev->cam->isp, &mt9t111_if_config); | ||
209 | +#endif | ||
210 | + break; | ||
211 | + | ||
212 | + default: | ||
213 | + return -ENODEV; | ||
214 | + break; | ||
215 | + } | ||
216 | + return 0; | ||
217 | +} | ||
218 | + | ||
219 | +static struct mt9t111_platform_data mt9t111_pdata = { | ||
220 | + .master = "omap34xxcam", | ||
221 | + .power_set = mt9t111_power_set, | ||
222 | + .priv_data_set = mt9t111_set_prv_data, | ||
223 | + .ifparm = mt9t111_ifparm, | ||
224 | + /* Some interface dependent params */ | ||
225 | + .clk_polarity = 0, /* data clocked out on falling edge */ | ||
226 | + .hs_polarity = 1, /* 0 - Active low, 1- Active high */ | ||
227 | + .vs_polarity = 1, /* 0 - Active low, 1- Active high */ | ||
228 | +}; | ||
229 | + | ||
230 | +static struct i2c_board_info __initdata mt9t111_i2c_board_info = { | ||
231 | + I2C_BOARD_INFO("mt9t111", MT9T111_I2C_ADDR), | ||
232 | + .platform_data = &mt9t111_pdata, | ||
233 | +}; | ||
234 | + | ||
235 | +#endif /* #ifdef CONFIG_VIDEO_MT9T111 */ | ||
236 | + | ||
237 | +/** | ||
238 | + * @brief omap3beaglelmb_init - module init function. Should be called before any | ||
239 | + * client driver init call | ||
240 | + * | ||
241 | + * @return result of operation - 0 is success | ||
242 | + */ | ||
243 | +int __init omap3beaglelmb_init(void) | ||
244 | +{ | ||
245 | + int err; | ||
246 | + | ||
247 | + /* | ||
248 | + * Register the I2C devices present in the board to the I2C | ||
249 | + * framework. | ||
250 | + * If more I2C devices are added, then each device information should | ||
251 | + * be registered with I2C using i2c_register_board_info(). | ||
252 | + */ | ||
253 | +#if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE) | ||
254 | + err = i2c_register_board_info(MT9T111_I2C_BUSNUM, | ||
255 | + &mt9t111_i2c_board_info, 1); | ||
256 | + if (err) { | ||
257 | + printk(KERN_ERR MODULE_NAME \ | ||
258 | + ": MT9T111 I2C Board Registration failed \n"); | ||
259 | + return err; | ||
260 | + } | ||
261 | +#endif | ||
262 | + printk(KERN_INFO MODULE_NAME ": Driver registration complete \n"); | ||
263 | + | ||
264 | + return 0; | ||
265 | +} | ||
266 | +arch_initcall(omap3beaglelmb_init); | ||
267 | diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.h b/arch/arm/mach-omap2/board-omap3beagle-camera.h | ||
268 | new file mode 100644 | ||
269 | index 0000000..1026aeb | ||
270 | --- /dev/null | ||
271 | +++ b/arch/arm/mach-omap2/board-omap3beagle-camera.h | ||
272 | @@ -0,0 +1,41 @@ | ||
273 | +/* | ||
274 | + * Copyright (C) 2010 Texas Instruments Inc | ||
275 | + * Author: Sergio Aguirre <saaguirre@ti.com> | ||
276 | + * | ||
277 | + * Based on work done by: | ||
278 | + * Vaibhav Hiremath <hvaibhav@ti.com> | ||
279 | + * Anuj Aggarwal <anuj.aggarwal@ti.com> | ||
280 | + * Sivaraj R <sivaraj@ti.com> | ||
281 | + * | ||
282 | + * This package is free software; you can redistribute it and/or modify | ||
283 | + * it under the terms of the GNU General Public License version 2 as | ||
284 | + * published by the Free Software Foundation. | ||
285 | + * | ||
286 | + * This program is distributed in the hope that it will be useful, | ||
287 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
288 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
289 | + * GNU General Public License for more details. | ||
290 | + * | ||
291 | + * You should have received a copy of the GNU General Public License | ||
292 | + * along with this program; if not, write to the Free Software | ||
293 | + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
294 | + */ | ||
295 | + | ||
296 | +#ifndef __BOARD_OMAP3BEAGLE_LMB_H_ | ||
297 | +#define __BOARD_OMAP3BEAGLE_LMB_H_ | ||
298 | + | ||
299 | +/* mux id to enable/disable signal routing to different peripherals */ | ||
300 | +enum omap3beaglelmb_mux { | ||
301 | + MUX_TVP5146 = 0, | ||
302 | + MUX_CAMERA_SENSOR, | ||
303 | + MUX_EXP_CAMERA_SENSOR, | ||
304 | + NUM_MUX | ||
305 | +}; | ||
306 | + | ||
307 | +/* enum to enable or disable mux */ | ||
308 | +enum config_mux { | ||
309 | + DISABLE_MUX, | ||
310 | + ENABLE_MUX | ||
311 | +}; | ||
312 | + | ||
313 | +#endif /* __BOARD_OMAP3BEAGLE_LMB_H_ */ | ||
314 | diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c | ||
315 | index b313350..d6b69a6 100644 | ||
316 | --- a/arch/arm/mach-omap2/board-omap3beagle.c | ||
317 | +++ b/arch/arm/mach-omap2/board-omap3beagle.c | ||
318 | @@ -712,6 +712,31 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = { | ||
319 | |||
320 | #ifdef CONFIG_OMAP_MUX | ||
321 | static struct omap_board_mux board_mux[] __initdata = { | ||
322 | + /* Camera - Parallel Data */ | ||
323 | + OMAP3_MUX(CAM_D0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
324 | + OMAP3_MUX(CAM_D1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
325 | + OMAP3_MUX(CAM_D2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
326 | + OMAP3_MUX(CAM_D3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
327 | + OMAP3_MUX(CAM_D4, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
328 | + OMAP3_MUX(CAM_D5, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
329 | + OMAP3_MUX(CAM_D6, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
330 | + OMAP3_MUX(CAM_D7, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
331 | + OMAP3_MUX(CAM_D8, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
332 | + OMAP3_MUX(CAM_D9, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
333 | + OMAP3_MUX(CAM_D10, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
334 | + OMAP3_MUX(CAM_D11, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
335 | + OMAP3_MUX(CAM_PCLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
336 | + | ||
337 | + /* Camera - HS/VS signals */ | ||
338 | + OMAP3_MUX(CAM_HS, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
339 | + OMAP3_MUX(CAM_VS, OMAP_MUX_MODE0 | OMAP_PIN_INPUT), | ||
340 | + | ||
341 | + /* Camera - Reset GPIO 98 */ | ||
342 | + OMAP3_MUX(CAM_FLD, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), | ||
343 | + | ||
344 | + /* Camera - XCLK */ | ||
345 | + OMAP3_MUX(CAM_XCLKA, OMAP_MUX_MODE0 | OMAP_PIN_OUTPUT), | ||
346 | + | ||
347 | { .reg_offset = OMAP_MUX_TERMINATOR }, | ||
348 | }; | ||
349 | #else | ||
350 | -- | ||
351 | 1.6.6.1 | ||
352 | |||