aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0042-omap3beagle-camera-Further-clode-cleanup.patch
blob: 8855e6d62689c539a120c85895066f350ea3b4bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
From 7f6cbc648dcf2d7805f12e7b56bb2c7b602ca61d Mon Sep 17 00:00:00 2001
From: Vaibhav Hiremath <hvaibhav@ti.com>
Date: Wed, 14 Jul 2010 19:07:06 +0530
Subject: [PATCH 42/75] omap3beagle-camera: Further clode cleanup

Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
---
 arch/arm/mach-omap2/board-omap3beagle-camera.c |   89 ++++--------------------
 drivers/media/video/isp/isp.h                  |   13 ++++
 2 files changed, 28 insertions(+), 74 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3beagle-camera.c b/arch/arm/mach-omap2/board-omap3beagle-camera.c
index 8d4e5ab..90eadd0 100644
--- a/arch/arm/mach-omap2/board-omap3beagle-camera.c
+++ b/arch/arm/mach-omap2/board-omap3beagle-camera.c
@@ -46,21 +46,19 @@
 #include "mux.h"
 #include "board-omap3beagle-camera.h"
 
-#define MODULE_NAME			"omap3beaglelmb"
+#define MODULE_NAME		"omap3beaglelmb"
 
-#define CAM_USE_XCLKA       0
+#define CAM_USE_XCLKA		0
 
-#define ISP_MT9V113_MCLK		216000000
+#define ISP_MT9V113_MCLK	216000000
 
-#define LEOPARD_RESET_GPIO		98
+#define LEOPARD_RESET_GPIO	98
 
 static struct regulator *beagle_mt9v113_1_8v1;
 static struct regulator *beagle_mt9v113_1_8v2;
 
-#if defined(CONFIG_VIDEO_MT9V113) || defined(CONFIG_VIDEO_MT9V113_MODULE)
-
 /* Arbitrary memory handling limit */
-#define MT9V113_BIGGEST_FRAME_BYTE_SIZE	PAGE_ALIGN(2048 * 1536 * 4)
+#define MT9V113_MAX_FRAME_SIZE	PAGE_ALIGN(640 * 480 * 4)
 
 static struct isp_interface_config mt9v113_if_config = {
 	.ccdc_par_ser		= ISP_PARLL,
@@ -77,21 +75,6 @@ static struct isp_interface_config mt9v113_if_config = {
 };
 
 static struct v4l2_ifparm mt9v113_ifparm_s = {
-#if 0
-	.if_type = V4L2_IF_TYPE_RAW,
-	.u 	 = {
-		.raw = {
-			.frame_start_on_rising_vs = 1,
-			.bt_sync_correct	= 0,
-			.swap			= 0,
-			.latch_clk_inv		= 0,
-			.nobt_hs_inv		= 0,	/* active high */
-			.nobt_vs_inv		= 0,	/* active high */
-			.clock_min		= MT9V113_CLK_MIN,
-			.clock_max		= MT9V113_CLK_MAX,
-		},
-	},
-#else
 	.if_type = V4L2_IF_TYPE_YCbCr,
 	.u 	 = {
 		.ycbcr = {
@@ -99,13 +82,12 @@ static struct v4l2_ifparm mt9v113_ifparm_s = {
 			.bt_sync_correct	= 0,
 			.swap			= 0,
 			.latch_clk_inv		= 0,
-			.nobt_hs_inv		= 0,	/* active high */
-			.nobt_vs_inv		= 0,	/* active high */
+			.nobt_hs_inv		= 0,
+			.nobt_vs_inv		= 0,
 			.clock_min		= MT9V113_CLK_MIN,
 			.clock_max		= MT9V113_CLK_MAX,
 		},
 	},
-#endif
 };
 
 /**
@@ -124,16 +106,14 @@ static int mt9v113_ifparm(struct v4l2_ifparm *p)
 	return 0;
 }
 
-#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
 static struct omap34xxcam_hw_config mt9v113_hwc = {
 	.dev_index		= 0,
 	.dev_minor		= 0,
 	.dev_type		= OMAP34XXCAM_SLAVE_SENSOR,
 	.u.sensor.sensor_isp	= 1,
-	.u.sensor.capture_mem	= MT9V113_BIGGEST_FRAME_BYTE_SIZE * 2,
+	.u.sensor.capture_mem	= MT9V113_MAX_FRAME_SIZE * 2,
 	.u.sensor.ival_default	= { 1, 10 },
 };
-#endif
 
 /**
  * @brief mt9v113_set_prv_data - Returns mt9v113 omap34xx driver private data
@@ -144,7 +124,6 @@ static struct omap34xxcam_hw_config mt9v113_hwc = {
  */
 static int mt9v113_set_prv_data(void *priv)
 {
-#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
 	struct omap34xxcam_hw_config *hwc = priv;
 
 	if (priv == NULL)
@@ -154,10 +133,8 @@ static int mt9v113_set_prv_data(void *priv)
 	hwc->dev_index = mt9v113_hwc.dev_index;
 	hwc->dev_minor = mt9v113_hwc.dev_minor;
 	hwc->dev_type = mt9v113_hwc.dev_type;
+
 	return 0;
-#else
-	return -EINVAL;
-#endif
 }
 
 /**
@@ -172,21 +149,22 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power)
 	struct omap34xxcam_videodev *vdev = s->u.slave->master->priv;
 
 	switch (power) {
-	case V4L2_POWER_OFF:
 	case V4L2_POWER_STANDBY:
+		break;
+
+	case V4L2_POWER_OFF:
 		isp_set_xclk(vdev->cam->isp, 0, CAM_USE_XCLKA);
 
 		if (regulator_is_enabled(beagle_mt9v113_1_8v1))
 			regulator_disable(beagle_mt9v113_1_8v1);
 		if (regulator_is_enabled(beagle_mt9v113_1_8v2))
 			regulator_disable(beagle_mt9v113_1_8v2);
+
 		break;
 
 	case V4L2_POWER_ON:
-#if defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
-		isp_configure_interface(vdev->cam->isp, &mt9v113_if_config);
-#endif
 
+		isp_configure_interface(vdev->cam->isp, &mt9v113_if_config);
 		/* Set RESET_BAR to 0 */
 		gpio_set_value(LEOPARD_RESET_GPIO, 0);
 
@@ -216,8 +194,8 @@ static int mt9v113_power_set(struct v4l2_int_device *s, enum v4l2_power power)
 
 	default:
 		return -ENODEV;
-		break;
 	}
+
 	return 0;
 }
 
@@ -232,9 +210,6 @@ struct mt9v113_platform_data mt9v113_pdata = {
 	.vs_polarity	= 1, /* 0 - Active low, 1- Active high */
 };
 
-#endif				/* #ifdef CONFIG_VIDEO_MT9V113 */
-
-
 static int beagle_cam_probe(struct platform_device *pdev)
 {
 	beagle_mt9v113_1_8v1 = regulator_get(&pdev->dev, "vaux3_1");
@@ -277,40 +252,6 @@ static int beagle_cam_remove(struct platform_device *pdev)
 
 	gpio_free(LEOPARD_RESET_GPIO);
 
-	/* MUX init */
-	omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
-			 0x10C); /* CAM_HS */
-	omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
-			 0x10E); /* CAM_VS */
-	omap_ctrl_writew(OMAP_PIN_OUTPUT | OMAP_MUX_MODE0,
-			 0x110); /* CAM_XCLKA */
-	omap_ctrl_writew(OMAP_PIN_INPUT_PULLUP | OMAP_MUX_MODE0,
-			 0x112); /* CAM_PCLK */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x116); /* CAM_D0 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x118); /* CAM_D1 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x11A); /* CAM_D2 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x11C); /* CAM_D3 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x11E); /* CAM_D4 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x120); /* CAM_D5 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x122); /* CAM_D6 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x124); /* CAM_D7 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x126); /* CAM_D8 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x128); /* CAM_D9 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x12A); /* CAM_D10 */
-	omap_ctrl_writew(OMAP_PIN_INPUT | OMAP_MUX_MODE0,
-			 0x12C); /* CAM_D11 */
-
 	return 0;
 }
 
diff --git a/drivers/media/video/isp/isp.h b/drivers/media/video/isp/isp.h
index 85c3fa9..4929fad 100644
--- a/drivers/media/video/isp/isp.h
+++ b/drivers/media/video/isp/isp.h
@@ -482,10 +482,23 @@ int isp_set_callback(struct device *dev, enum isp_callback_type type,
 
 int isp_unset_callback(struct device *dev, enum isp_callback_type type);
 
+#if defined(CONFIG_VIDEO_OMAP3_ISP)
 u32 isp_set_xclk(struct device *dev, u32 xclk, u8 xclksel);
 
 int isp_configure_interface(struct device *dev,
 			    struct isp_interface_config *config);
+#else
+static inline u32 isp_set_xclk(struct device *dev, u32 xclk, u8 xclksel)
+{
+	return 0;
+}
+static inline int isp_configure_interface(struct device *dev,
+			    struct isp_interface_config *config)
+{
+	return 0;
+}
+
+#endif
 
 struct device *isp_get(void);
 
-- 
1.6.6.1