summaryrefslogtreecommitdiffstats
path: root/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0006-omap3beagle-camera-Add-support-for-regulators.patch
diff options
context:
space:
mode:
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0006-omap3beagle-camera-Add-support-for-regulators.patch')
-rw-r--r--extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0006-omap3beagle-camera-Add-support-for-regulators.patch238
1 files changed, 238 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0006-omap3beagle-camera-Add-support-for-regulators.patch b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0006-omap3beagle-camera-Add-support-for-regulators.patch
new file mode 100644
index 00000000..1af46198
--- /dev/null
+++ b/extras/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0006-omap3beagle-camera-Add-support-for-regulators.patch
@@ -0,0 +1,238 @@
1From a8bad5bfa652d2e35575f864da6192d41c85c818 Mon Sep 17 00:00:00 2001
2From: Sergio Aguirre <saaguirre@ti.com>
3Date: Fri, 11 Jun 2010 16:50:39 -0500
4Subject: [PATCH 06/75] omap3beagle: camera: Add support for regulators
5
6Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
7---
8 arch/arm/mach-omap2/board-omap3beagle-camera.c | 92 +++++++++++++++++++++---
9 arch/arm/mach-omap2/board-omap3beagle.c | 53 ++++++++++++++
10 2 files changed, 135 insertions(+), 10 deletions(-)
11
12diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c
13index e93437f..af8581a 100644
14--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c
15+++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c
16@@ -28,8 +28,9 @@
17 #include <linux/gpio.h>
18 #include <linux/mm.h>
19 #include <linux/videodev2.h>
20-#include <linux/i2c/twl.h>
21+#include <linux/regulator/consumer.h>
22 #include <linux/delay.h>
23+#include <linux/platform_device.h>
24
25 #include <plat/mux.h>
26 #include <plat/board.h>
27@@ -50,6 +51,11 @@
28
29 #define CAM_USE_XCLKA 1
30
31+static struct regulator *beagle_mt9t111_reg1;
32+static struct regulator *beagle_mt9t111_reg2;
33+
34+static struct device *beaglecam_dev;
35+
36 #if defined(CONFIG_VIDEO_MT9T111) || defined(CONFIG_VIDEO_MT9T111_MODULE)
37 static struct isp_interface_config mt9t111_if_config = {
38 .ccdc_par_ser = ISP_PARLL,
39@@ -157,10 +163,13 @@ static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power)
40
41 switch (power) {
42 case V4L2_POWER_OFF:
43+ case V4L2_POWER_STANDBY:
44 isp_set_xclk(vdev->cam->isp, 0, CAM_USE_XCLKA);
45- break;
46
47- case V4L2_POWER_STANDBY:
48+ if (regulator_is_enabled(beagle_mt9t111_reg1))
49+ regulator_disable(beagle_mt9t111_reg1);
50+ if (regulator_is_enabled(beagle_mt9t111_reg2))
51+ regulator_disable(beagle_mt9t111_reg2);
52 break;
53
54 case V4L2_POWER_ON:
55@@ -169,6 +178,12 @@ static int mt9t111_power_set(struct v4l2_int_device *s, enum v4l2_power power)
56 #if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
57 isp_configure_interface(vdev->cam->isp, &mt9t111_if_config);
58 #endif
59+
60+ /* turn on analog power */
61+ regulator_enable(beagle_mt9t111_reg1);
62+ regulator_enable(beagle_mt9t111_reg2);
63+ udelay(100);
64+
65 break;
66
67 default:
68@@ -196,16 +211,22 @@ static struct i2c_board_info __initdata mt9t111_i2c_board_info = {
69
70 #endif /* #ifdef CONFIG_VIDEO_MT9T111 */
71
72-/**
73- * @brief omap3beaglelmb_init - module init function. Should be called before any
74- * client driver init call
75- *
76- * @return result of operation - 0 is success
77- */
78-int __init omap3beaglelmb_init(void)
79+
80+static int beagle_cam_probe(struct platform_device *pdev)
81 {
82 int err;
83
84+ beagle_mt9t111_reg1 = regulator_get(beaglecam_dev, "vaux3_1");
85+ if (IS_ERR(beagle_mt9t111_reg1)) {
86+ dev_err(beaglecam_dev, "vaux3_1 regulator missing\n");
87+ return PTR_ERR(beagle_mt9t111_reg1);
88+ }
89+ beagle_mt9t111_reg2 = regulator_get(beaglecam_dev, "vaux4_1");
90+ if (IS_ERR(beagle_mt9t111_reg2)) {
91+ dev_err(beaglecam_dev, "vaux4_1 regulator missing\n");
92+ regulator_put(beagle_mt9t111_reg1);
93+ return PTR_ERR(beagle_mt9t111_reg2);
94+ }
95 /*
96 * Register the I2C devices present in the board to the I2C
97 * framework.
98@@ -221,8 +242,59 @@ int __init omap3beaglelmb_init(void)
99 return err;
100 }
101 #endif
102+
103+ beaglecam_dev = &pdev->dev;
104+
105 printk(KERN_INFO MODULE_NAME ": Driver registration complete \n");
106
107 return 0;
108 }
109+
110+static int beagle_cam_remove(struct platform_device *pdev)
111+{
112+ if (regulator_is_enabled(beagle_mt9t111_reg1))
113+ regulator_disable(beagle_mt9t111_reg1);
114+ regulator_put(beagle_mt9t111_reg1);
115+ if (regulator_is_enabled(beagle_mt9t111_reg2))
116+ regulator_disable(beagle_mt9t111_reg2);
117+ regulator_put(beagle_mt9t111_reg2);
118+
119+ return 0;
120+}
121+
122+static int beagle_cam_suspend(struct device *dev)
123+{
124+ return 0;
125+}
126+
127+static int beagle_cam_resume(struct device *dev)
128+{
129+ return 0;
130+}
131+
132+static struct dev_pm_ops beagle_cam_pm_ops = {
133+ .suspend = beagle_cam_suspend,
134+ .resume = beagle_cam_resume,
135+};
136+
137+static struct platform_driver beagle_cam_driver = {
138+ .probe = beagle_cam_probe,
139+ .remove = beagle_cam_remove,
140+ .driver = {
141+ .name = "beagle_cam",
142+ .pm = &beagle_cam_pm_ops,
143+ },
144+};
145+
146+/**
147+ * @brief omap3beaglelmb_init - module init function. Should be called before any
148+ * client driver init call
149+ *
150+ * @return result of operation - 0 is success
151+ */
152+int __init omap3beaglelmb_init(void)
153+{
154+ platform_driver_register(&beagle_cam_driver);
155+ return 0;
156+}
157 arch_initcall(omap3beaglelmb_init);
158diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
159index d6b69a6..aa16acd 100644
160--- a/arch/arm/mach-omap2/board-omap3beagle.c
161+++ b/arch/arm/mach-omap2/board-omap3beagle.c
162@@ -403,6 +403,56 @@ static struct twl4030_gpio_platform_data beagle_gpio_data = {
163 .setup = beagle_twl_gpio_setup,
164 };
165
166+
167+static struct platform_device beagle_cam_device = {
168+ .name = "beagle_cam",
169+ .id = -1,
170+};
171+
172+static struct regulator_consumer_supply beagle_vaux3_supplies[] = {
173+ {
174+ .supply = "vaux3_1",
175+ .dev = &beagle_cam_device.dev,
176+ },
177+};
178+
179+static struct regulator_consumer_supply beagle_vaux4_supplies[] = {
180+ {
181+ .supply = "vaux4_1",
182+ .dev = &beagle_cam_device.dev,
183+ },
184+};
185+
186+/* VAUX3 for CAM_1V8 */
187+static struct regulator_init_data beagle_vaux3 = {
188+ .constraints = {
189+ .min_uV = 1800000,
190+ .max_uV = 1800000,
191+ .apply_uV = true,
192+ .valid_modes_mask = REGULATOR_MODE_NORMAL
193+ | REGULATOR_MODE_STANDBY,
194+ .valid_ops_mask = REGULATOR_CHANGE_MODE
195+ | REGULATOR_CHANGE_STATUS,
196+ },
197+ .num_consumer_supplies = ARRAY_SIZE(beagle_vaux3_supplies),
198+ .consumer_supplies = beagle_vaux3_supplies,
199+};
200+
201+/* VAUX4 for CAM_2V8 */
202+static struct regulator_init_data beagle_vaux4 = {
203+ .constraints = {
204+ .min_uV = 2800000,
205+ .max_uV = 2800000,
206+ .apply_uV = true,
207+ .valid_modes_mask = REGULATOR_MODE_NORMAL
208+ | REGULATOR_MODE_STANDBY,
209+ .valid_ops_mask = REGULATOR_CHANGE_MODE
210+ | REGULATOR_CHANGE_STATUS,
211+ },
212+ .num_consumer_supplies = ARRAY_SIZE(beagle_vaux4_supplies),
213+ .consumer_supplies = beagle_vaux4_supplies,
214+};
215+
216 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
217 static struct regulator_init_data beagle_vmmc1 = {
218 .constraints = {
219@@ -492,6 +542,8 @@ static struct twl4030_platform_data beagle_twldata = {
220 .vsim = &beagle_vsim,
221 .vdac = &beagle_vdac,
222 .vpll2 = &beagle_vpll2,
223+ .vaux3 = &beagle_vaux3,
224+ .vaux4 = &beagle_vaux4,
225 };
226
227 static struct i2c_board_info __initdata beagle_i2c1_boardinfo[] = {
228@@ -658,6 +710,7 @@ static struct platform_device *omap3_beagle_devices[] __initdata = {
229 &leds_gpio,
230 &keys_gpio,
231 &beagle_dss_device,
232+ &beagle_cam_device,
233 };
234
235 static void __init omap3beagle_flash_init(void)
236--
2371.6.6.1
238