diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/5m03/0002-board-omap3beagle-import-li5m03-driver-from-https-gi.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/5m03/0002-board-omap3beagle-import-li5m03-driver-from-https-gi.patch | 294 |
1 files changed, 294 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/5m03/0002-board-omap3beagle-import-li5m03-driver-from-https-gi.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/5m03/0002-board-omap3beagle-import-li5m03-driver-from-https-gi.patch new file mode 100644 index 00000000..2b45f197 --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/5m03/0002-board-omap3beagle-import-li5m03-driver-from-https-gi.patch | |||
@@ -0,0 +1,294 @@ | |||
1 | From 675ad06f53fbb0c7f398aaff8c3508196dfeb9bc Mon Sep 17 00:00:00 2001 | ||
2 | From: Koen Kooi <koen@dominion.thruhere.net> | ||
3 | Date: Sun, 1 May 2011 16:41:57 +0200 | ||
4 | Subject: [PATCH 2/2] board-omap3beagle: import li5m03 driver from https://github.com/Aptina/BeagleBoard-xM/tree/master/Angstrom/MT9P031 | ||
5 | |||
6 | Properly hook it into the board file and some more updates | ||
7 | |||
8 | Signed-off-by: Koen Kooi <koen@dominion.thruhere.net> | ||
9 | --- | ||
10 | arch/arm/mach-omap2/board-omap3beagle-camera.c | 186 +++++++++++++++++++++++- | ||
11 | arch/arm/mach-omap2/board-omap3beagle.c | 20 +++ | ||
12 | 2 files changed, 198 insertions(+), 8 deletions(-) | ||
13 | |||
14 | diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c | ||
15 | index 110c2c9..97f0e7a 100644 | ||
16 | --- a/arch/arm/mach-omap2/board-omap3beagle-camera.c | ||
17 | +++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c | ||
18 | @@ -160,6 +160,8 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power) | ||
19 | case V4L2_POWER_ON: | ||
20 | |||
21 | isp_configure_interface(vdev->cam->isp, &mt9v113_if_config); | ||
22 | + /* Set RESET_BAR to 0 */ | ||
23 | + gpio_set_value(LEOPARD_RESET_GPIO, 0); | ||
24 | |||
25 | /* turn on VDD */ | ||
26 | regulator_enable(cam_1v8_reg); | ||
27 | @@ -168,9 +170,6 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power) | ||
28 | regulator_enable(cam_2v8_reg); | ||
29 | mdelay(50); | ||
30 | |||
31 | - /* Set RESET_BAR to 0 */ | ||
32 | - gpio_set_value(LEOPARD_RESET_GPIO, 0); | ||
33 | - | ||
34 | /* Enable EXTCLK */ | ||
35 | isp_set_xclk(vdev->cam->isp, MT9V113_CLK_MIN*2, CAM_USE_XCLKA); | ||
36 | /* | ||
37 | @@ -294,7 +293,7 @@ static int mt9t112_set_prv_data(void *priv) | ||
38 | } | ||
39 | |||
40 | /** | ||
41 | - * @brief mt9t112_power_set - Power-on or power-off TVP5146 device | ||
42 | + * @brief mt9t112_power_set - Power-on or power-off MT9T112 device | ||
43 | * | ||
44 | * @param power - enum, Power on/off, resume/standby | ||
45 | * | ||
46 | @@ -320,6 +319,8 @@ static int mt9t112_power_set(struct v4l2_int_device *s, enum v4l2_power power) | ||
47 | isp_configure_interface(vdev->cam->isp, &mt9t112_if_config); | ||
48 | #endif | ||
49 | |||
50 | + /* Set RESET_BAR to 0 */ | ||
51 | + gpio_set_value(LEOPARD_RESET_GPIO, 0); | ||
52 | |||
53 | /* turn on VDD */ | ||
54 | regulator_enable(cam_1v8_reg); | ||
55 | @@ -331,11 +332,8 @@ static int mt9t112_power_set(struct v4l2_int_device *s, enum v4l2_power power) | ||
56 | |||
57 | mdelay(50); | ||
58 | |||
59 | - /* Set RESET_BAR to 0 */ | ||
60 | - gpio_set_value(LEOPARD_RESET_GPIO, 0); | ||
61 | - | ||
62 | /* Enable EXTCLK */ | ||
63 | - isp_set_xclk(vdev->cam->isp, 24000000, CAM_USE_XCLKA); | ||
64 | + isp_set_xclk(vdev->cam->isp, 12000000, CAM_USE_XCLKA); | ||
65 | |||
66 | /* | ||
67 | * Wait at least 70 CLK cycles (w/EXTCLK = 24MHz): | ||
68 | @@ -372,6 +370,178 @@ struct mt9t112_platform_data mt9t112_pdata = { | ||
69 | |||
70 | #endif /* #ifdef CONFIG_VIDEO_MT9T112 */ | ||
71 | |||
72 | +#if defined(CONFIG_SOC_CAMERA_MT9P031) || defined(CONFIG_SOC_CAMERA_MT9P031_MODULE) | ||
73 | +#include <media/mt9p031.h> | ||
74 | + | ||
75 | +#define ISP_MT9P031_MCLK 216000000 | ||
76 | + | ||
77 | +/* Arbitrary memory handling limit */ | ||
78 | +#define MT9P031_BIGGEST_FRAME_BYTE_SIZE PAGE_ALIGN((2592 * 1944) * 2 * 4 ) | ||
79 | + | ||
80 | +static struct isp_interface_config mt9p031_if_config = { | ||
81 | + .ccdc_par_ser = ISP_PARLL, | ||
82 | + .dataline_shift = 0x1, | ||
83 | + .hsvs_syncdetect = ISPCTRL_SYNC_DETECT_VSRISE, | ||
84 | + .strobe = 0x0, | ||
85 | + .prestrobe = 0x0, | ||
86 | + .shutter = 0x0, | ||
87 | + .cam_mclk = ISP_MT9P031_MCLK, | ||
88 | + .wenlog = ISPCCDC_CFG_WENLOG_AND, | ||
89 | + .wait_hs_vs = 2, | ||
90 | + .u.par.par_bridge = 0x0, | ||
91 | + .u.par.par_clk_pol = 0x0, | ||
92 | +}; | ||
93 | + | ||
94 | +static struct v4l2_ifparm mt9p031_ifparm_s = { | ||
95 | + .if_type = V4L2_IF_TYPE_RAW, | ||
96 | + .u = { | ||
97 | + .raw = { | ||
98 | + .frame_start_on_rising_vs = 1, | ||
99 | + .bt_sync_correct = 0, | ||
100 | + .swap = 0, | ||
101 | + .latch_clk_inv = 0, | ||
102 | + .nobt_hs_inv = 0, /* active high */ | ||
103 | + .nobt_vs_inv = 0, /* active high */ | ||
104 | + .clock_min = MT9P031_CLK_MIN, | ||
105 | + .clock_max = MT9P031_CLK_MAX, | ||
106 | + }, | ||
107 | + }, | ||
108 | +}; | ||
109 | + | ||
110 | +/** | ||
111 | + * @brief mt9p031_ifparm - Returns the mt9p031 interface parameters | ||
112 | + * | ||
113 | + * @param p - pointer to v4l2_ifparm structure | ||
114 | + * | ||
115 | + * @return result of operation - 0 is success | ||
116 | + */ | ||
117 | +static int mt9p031_ifparm(struct v4l2_ifparm *p) | ||
118 | +{ | ||
119 | + if (p == NULL) | ||
120 | + return -EINVAL; | ||
121 | + | ||
122 | + *p = mt9p031_ifparm_s; | ||
123 | + return 0; | ||
124 | +} | ||
125 | + | ||
126 | +#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) | ||
127 | +static struct omap34xxcam_hw_config mt9p031_hwc = { | ||
128 | + .dev_index = 1, | ||
129 | + .dev_minor = -1, | ||
130 | + .dev_type = OMAP34XXCAM_SLAVE_SENSOR, | ||
131 | + .u.sensor.sensor_isp = 0, | ||
132 | + .u.sensor.capture_mem = MT9P031_BIGGEST_FRAME_BYTE_SIZE, | ||
133 | + .u.sensor.ival_default = { 1, 30 }, | ||
134 | +}; | ||
135 | +#endif | ||
136 | + | ||
137 | +/** | ||
138 | + * @brief mt9p031_set_prv_data - Returns mt9p031 omap34xx driver private data | ||
139 | + * | ||
140 | + * @param priv - pointer to omap34xxcam_hw_config structure | ||
141 | + * | ||
142 | + * @return result of operation - 0 is success | ||
143 | + */ | ||
144 | +static int mt9p031_set_prv_data(void *priv) | ||
145 | +{ | ||
146 | +#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) | ||
147 | + struct omap34xxcam_hw_config *hwc = priv; | ||
148 | + | ||
149 | + if (priv == NULL) | ||
150 | + return -EINVAL; | ||
151 | + | ||
152 | + *hwc = mt9p031_hwc; | ||
153 | + return 0; | ||
154 | +#else | ||
155 | + return -EINVAL; | ||
156 | +#endif | ||
157 | +} | ||
158 | + | ||
159 | +/** | ||
160 | + * @brief mt9p031_power_set - Power-on or power-off mt9p031 device | ||
161 | + * | ||
162 | + * @param power - enum, Power on/off, resume/standby | ||
163 | + * | ||
164 | + * @return result of operation - 0 is success | ||
165 | + */ | ||
166 | +static int mt9p031_power_set(struct v4l2_int_device *s, enum v4l2_power power) | ||
167 | +{ | ||
168 | + struct omap34xxcam_videodev *vdev = s->u.slave->master->priv; | ||
169 | + switch (power) { | ||
170 | + case V4L2_POWER_OFF: | ||
171 | + case V4L2_POWER_STANDBY: | ||
172 | + isp_set_xclk(vdev->cam->isp, 0, CAM_USE_XCLKA); | ||
173 | + | ||
174 | + if (regulator_is_enabled(cam_1v8_reg)) | ||
175 | + regulator_disable(cam_1v8_reg); | ||
176 | + if (regulator_is_enabled(cam_2v8_reg)) | ||
177 | + regulator_disable(cam_2v8_reg); | ||
178 | + break; | ||
179 | + | ||
180 | + case V4L2_POWER_ON: | ||
181 | +#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE) | ||
182 | + isp_configure_interface(vdev->cam->isp, &mt9p031_if_config); | ||
183 | +#endif | ||
184 | + | ||
185 | + /* Set RESET_BAR to 0 */ | ||
186 | + gpio_set_value(LEOPARD_RESET_GPIO, 0); | ||
187 | + | ||
188 | + /* turn on VDD */ | ||
189 | + regulator_enable(cam_1v8_reg); | ||
190 | + | ||
191 | + mdelay(1); | ||
192 | + | ||
193 | + /* turn on VDD_IO */ | ||
194 | + regulator_enable(cam_2v8_reg); | ||
195 | + | ||
196 | + mdelay(50); | ||
197 | + | ||
198 | + /* Enable EXTCLK */ | ||
199 | + isp_set_xclk(vdev->cam->isp, 24000000, CAM_USE_XCLKA); //works for 36MHz too; try at lower freq | ||
200 | + | ||
201 | + /* | ||
202 | + * Wait at least 70 CLK cycles (w/EXTCLK = 24MHz): | ||
203 | + * ((1000000 * 70) / 24000000) = aprox 2.91 us. | ||
204 | + */ | ||
205 | + | ||
206 | + udelay(3); | ||
207 | + | ||
208 | + /* Set RESET_BAR to 1 */ | ||
209 | + gpio_set_value(LEOPARD_RESET_GPIO, 1); | ||
210 | + | ||
211 | + /* | ||
212 | + * Wait at least 100 CLK cycles (w/EXTCLK = 24MHz): | ||
213 | + * ((1000000 * 100) / 24000000) = aprox 4.16 us. | ||
214 | + */ | ||
215 | + | ||
216 | + udelay(5); | ||
217 | + | ||
218 | + break; | ||
219 | + | ||
220 | + default: | ||
221 | + return -ENODEV; | ||
222 | + break; | ||
223 | + } | ||
224 | + return 0; | ||
225 | +} | ||
226 | + | ||
227 | +static u32 mt9p031_set_xclk(struct v4l2_int_device *s, u32 xclkfreq) | ||
228 | +{ | ||
229 | + struct omap34xxcam_videodev *vdev = s->u.slave->master->priv; | ||
230 | + return isp_set_xclk(vdev->cam->isp, xclkfreq, 0); | ||
231 | +} | ||
232 | + | ||
233 | + | ||
234 | +struct mt9p031_platform_data mt9p031_pdata = { | ||
235 | + .master = "omap34xxcam", | ||
236 | + .power_set = mt9p031_power_set, | ||
237 | + .set_xclk = mt9p031_set_xclk, | ||
238 | + .priv_data_set = mt9p031_set_prv_data, | ||
239 | + .ifparm = mt9p031_ifparm, | ||
240 | +}; | ||
241 | + | ||
242 | +#endif /* #ifdef CONFIG_SOC_CAMERA_MT9P031 */ | ||
243 | + | ||
244 | static int beagle_cam_probe(struct platform_device *pdev) | ||
245 | { | ||
246 | cam_1v8_reg = regulator_get(&pdev->dev, "cam_1v8"); | ||
247 | diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c | ||
248 | index 2677b41..e561431 100644 | ||
249 | --- a/arch/arm/mach-omap2/board-omap3beagle.c | ||
250 | +++ b/arch/arm/mach-omap2/board-omap3beagle.c | ||
251 | @@ -83,6 +83,12 @@ extern struct mt9v113_platform_data mt9v113_pdata; | ||
252 | extern struct mt9t112_platform_data mt9t112_pdata; | ||
253 | #endif | ||
254 | |||
255 | +#if defined(CONFIG_SOC_CAMERA_MT9P031) || defined(CONFIG_SOC_CAMERA_MT9P031_MODULE) | ||
256 | +#include <media/v4l2-int-device.h> | ||
257 | +#include <media/mt9p031.h> | ||
258 | +extern struct mt9p031_platform_data mt9p031_pdata; | ||
259 | +#endif | ||
260 | + | ||
261 | #define GPMC_CS0_BASE 0x60 | ||
262 | #define GPMC_CS_SIZE 0x30 | ||
263 | |||
264 | @@ -614,6 +620,15 @@ static struct i2c_board_info __initdata beagle_lbcm3m1_i2c2_boardinfo[] = { | ||
265 | #endif | ||
266 | }; | ||
267 | |||
268 | +static struct i2c_board_info __initdata beagle_lbcm5m03_i2c2_boardinfo[] = { | ||
269 | +#if defined(CONFIG_SOC_CAMERA_MT9P031) || defined(CONFIG_SOC_CAMERA_MT9P031_MODULE) | ||
270 | + { | ||
271 | + I2C_BOARD_INFO("mt9p031", MT9P031_I2C_ADDR), | ||
272 | + .platform_data = &mt9p031_pdata, | ||
273 | + }, | ||
274 | +#endif | ||
275 | +}; | ||
276 | + | ||
277 | static int __init omap3_beagle_i2c_init(void) | ||
278 | { | ||
279 | omap_register_i2c_bus(1, 2600, beagle_i2c1_boardinfo, | ||
280 | @@ -636,6 +651,11 @@ static int __init omap3_beagle_i2c_init(void) | ||
281 | " registering i2c2 bus for lbcm3m1\n"); | ||
282 | omap_register_i2c_bus(2, 400, beagle_lbcm3m1_i2c2_boardinfo, | ||
283 | ARRAY_SIZE(beagle_lbcm3m1_i2c2_boardinfo)); | ||
284 | + } else if (!strcmp(cameraboard_name, "lbcm5m03")) { | ||
285 | + printk(KERN_INFO "Beagle cameraboard:" | ||
286 | + " registering i2c2 bus for lbcm5m03\n"); | ||
287 | + omap_register_i2c_bus(2, 400, beagle_lbcm5m03_i2c2_boardinfo, | ||
288 | + ARRAY_SIZE(beagle_lbcm5m03_i2c2_boardinfo)); | ||
289 | } else { | ||
290 | omap_register_i2c_bus(2, 400, NULL, 0); | ||
291 | } | ||
292 | -- | ||
293 | 1.6.6.1 | ||
294 | |||