]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/kernel/omap/beagle/expansion/0009-Beagle-expansion-add-Aptina-li5m03-camera.patch
ethtool: Update to 3.16
[ipfire-2.x.git] / src / patches / kernel / omap / beagle / expansion / 0009-Beagle-expansion-add-Aptina-li5m03-camera.patch
1 From cc6ced0a1cbaea65a507ec3fe543a5b98d760d23 Mon Sep 17 00:00:00 2001
2 From: Robert Nelson <robertcnelson@gmail.com>
3 Date: Tue, 11 Dec 2012 06:58:15 -0600
4 Subject: [PATCH 09/10] Beagle: expansion: add Aptina li5m03 camera
5
6 Based on:
7 https://github.com/Aptina/BeagleBoard-xM/blob/master/tools/0266-Adding-MT9P031-Support-files.patch
8
9 And on Max Galemin's patch
10 https://github.com/MaxGalemin/buildroot/blob/master/board/beagleboard/xm/kernel-patches/linux-0003-Add-support-for-MT9P031-Aptina-image-sensor-driver.patch
11
12 And Koen Kooi Previous work's
13 https://github.com/beagleboard/kernel/blob/beagleboard-3.2/patches/camera/0003-beagleboard-fix-i2c2-init.patch
14
15 Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
16 ---
17 arch/arm/mach-omap2/board-omap3beagle.c | 142 +++++++++++++++++++++++++++++++
18 1 file changed, 142 insertions(+)
19
20 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
21 index 3e0313ee..4fb5eae 100644
22 --- a/arch/arm/mach-omap2/board-omap3beagle.c
23 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
24 @@ -201,6 +201,7 @@ static void __init omap3_beagle_init_rev(void)
25
26 char expansionboard_name[16];
27 char expansionboard2_name[16];
28 +char camera_name[16];
29
30 enum {
31 EXPANSION_MMC_NONE = 0,
32 @@ -555,6 +556,14 @@ static struct regulator_consumer_supply beagle_vsim_supply[] = {
33 REGULATOR_SUPPLY("vmmc_aux", "omap_hsmmc.0"),
34 };
35
36 +static struct regulator_consumer_supply beagle_vaux3_supply = {
37 + .supply = "cam_1v8",
38 +};
39 +
40 +static struct regulator_consumer_supply beagle_vaux4_supply = {
41 + .supply = "cam_2v8",
42 +};
43 +
44 static struct gpio_led gpio_leds[];
45
46 /* PHY's VCC regulator might be added later, so flag that we need it */
47 @@ -677,11 +686,43 @@ static struct regulator_init_data beagle_vsim = {
48 .consumer_supplies = beagle_vsim_supply,
49 };
50
51 +/* VAUX3 for CAM_1V8 */
52 +static struct regulator_init_data beagle_vaux3 = {
53 + .constraints = {
54 + .min_uV = 1800000,
55 + .max_uV = 1800000,
56 + .apply_uV = true,
57 + .valid_modes_mask = REGULATOR_MODE_NORMAL
58 + | REGULATOR_MODE_STANDBY,
59 + .valid_ops_mask = REGULATOR_CHANGE_MODE
60 + | REGULATOR_CHANGE_STATUS,
61 + },
62 + .num_consumer_supplies = 1,
63 + .consumer_supplies = &beagle_vaux3_supply,
64 +};
65 +
66 +/* VAUX4 for CAM_2V8 */
67 +static struct regulator_init_data beagle_vaux4 = {
68 + .constraints = {
69 + .min_uV = 1800000,
70 + .max_uV = 1800000,
71 + .apply_uV = true,
72 + .valid_modes_mask = REGULATOR_MODE_NORMAL
73 + | REGULATOR_MODE_STANDBY,
74 + .valid_ops_mask = REGULATOR_CHANGE_MODE
75 + | REGULATOR_CHANGE_STATUS,
76 + },
77 + .num_consumer_supplies = 1,
78 + .consumer_supplies = &beagle_vaux4_supply,
79 +};
80 +
81 static struct twl4030_platform_data beagle_twldata = {
82 /* platform_data for children goes here */
83 .gpio = &beagle_gpio_data,
84 .vmmc1 = &beagle_vmmc1,
85 .vsim = &beagle_vsim,
86 + .vaux3 = &beagle_vaux3,
87 + .vaux4 = &beagle_vaux4,
88 };
89
90 static struct i2c_board_info __initdata beagle_i2c_eeprom[] = {
91 @@ -745,6 +786,61 @@ static void __init omap3beagle_tsc2007_init(void)
92 static struct i2c_board_info __initdata beagle_i2c2_bbtoys_ulcd[] = {};
93 #endif
94
95 +#if IS_ENABLED(CONFIG_VIDEO_MT9P031)
96 +/* needed for: omap3_beagle_late_initcall */
97 +#include "devices.h"
98 +#include <media/omap3isp.h>
99 +#include <media/mt9p031.h>
100 +/* needed for: v4l2_dev_to_isp_device */
101 +#include "../../../drivers/media/platform/omap3isp/isp.h"
102 +
103 +#define MT9P031_RESET_GPIO 98
104 +#define MT9P031_EXT_FREQ 21000000
105 +#define MT9P031_TARGET_FREQ 48000000
106 +
107 +#define MT9P031_I2C_ADDR 0x48
108 +#define MT9P031_I2C_BUS 2
109 +
110 +static struct regulator *reg_1v8, *reg_2v8;
111 +
112 +static struct mt9p031_platform_data beagle_mt9p031_platform_data = {
113 + .reset = MT9P031_RESET_GPIO,
114 + .ext_freq = MT9P031_EXT_FREQ,
115 + .target_freq = MT9P031_TARGET_FREQ,
116 +};
117 +
118 +static struct i2c_board_info mt9p031_camera_i2c_device = {
119 + I2C_BOARD_INFO("mt9p031", MT9P031_I2C_ADDR),
120 + .platform_data = &beagle_mt9p031_platform_data,
121 +};
122 +
123 +static struct isp_subdev_i2c_board_info mt9p031_camera_subdevs[] = {
124 + {
125 + .board_info = &mt9p031_camera_i2c_device,
126 + .i2c_adapter_id = MT9P031_I2C_BUS,
127 + },
128 + { NULL, 0, },
129 +};
130 +
131 +static struct isp_v4l2_subdevs_group beagle_camera_subdevs[] = {
132 + {
133 + .subdevs = mt9p031_camera_subdevs,
134 + .interface = ISP_INTERFACE_PARALLEL,
135 + .bus = {
136 + .parallel = {
137 + .data_lane_shift = 0,
138 + .clk_pol = 1,
139 + }
140 + },
141 + },
142 + { },
143 +};
144 +
145 +static struct isp_platform_data beagle_isp_platform_data = {
146 + .subdevs = beagle_camera_subdevs,
147 +};
148 +#endif
149 +
150 static int __init omap3_beagle_i2c_init(void)
151 {
152 omap3_pmic_get_config(&beagle_twldata,
153 @@ -869,6 +965,18 @@ static int __init expansionboard2_setup(char *str)
154 return 0;
155 }
156
157 +static int __init camera_setup(char *str)
158 +{
159 + if (!machine_is_omap3_beagle())
160 + return 0;
161 +
162 + if (!str)
163 + return -EINVAL;
164 + strncpy(camera_name, str, 16);
165 + pr_info("Beagle camera: %s\n", camera_name);
166 + return 0;
167 +}
168 +
169 static int __init beagle_opp_init(void)
170 {
171 int r = 0;
172 @@ -1155,8 +1263,42 @@ static void __init omap3_beagle_init(void)
173 pwm_add_table(pwm_lookup, ARRAY_SIZE(pwm_lookup));
174 }
175
176 +static int __init omap3_beagle_late_initcall(void)
177 +{
178 + if (!machine_is_omap3_beagle())
179 + return 0;
180 +
181 + if (!cpu_is_omap3630())
182 + return 0;
183 +
184 +#if IS_ENABLED(CONFIG_VIDEO_MT9P031)
185 + if ((!strcmp(camera_name, "lbcm5m1")) || (!strcmp(camera_name, "li5m03")))
186 + {
187 + pr_info("Beagle camera: MT9P031 init\n");
188 +
189 + reg_1v8 = regulator_get(NULL, "cam_1v8");
190 + if (IS_ERR(reg_1v8))
191 + pr_err("%s: cannot get cam_1v8 regulator\n", __func__);
192 + else
193 + regulator_enable(reg_1v8);
194 +
195 + reg_2v8 = regulator_get(NULL, "cam_2v8");
196 + if (IS_ERR(reg_2v8))
197 + pr_err("%s: cannot get cam_2v8 regulator\n", __func__);
198 + else
199 + regulator_enable(reg_2v8);
200 +
201 + omap3_init_camera(&beagle_isp_platform_data);
202 + }
203 +#endif
204 + return 0;
205 +}
206 +
207 early_param("buddy", expansionboard_setup);
208 early_param("buddy2", expansionboard2_setup);
209 +early_param("camera", camera_setup);
210 +
211 +late_initcall(omap3_beagle_late_initcall);
212
213 MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
214 /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */
215 --
216 1.7.10.4
217