aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-omap-psp-2.6.32/cam/0064-mt9t112-Remove-smart-size-selection.patch
blob: b3506dc28c72a1f2cc1f5d02ec98b877652b1bde (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
From 2c8e7e157de32ebc5c8d60bf642c2f29f607c3d0 Mon Sep 17 00:00:00 2001
From: Sergio Aguirre <saaguirre@ti.com>
Date: Fri, 16 Jul 2010 17:09:10 -0500
Subject: [PATCH 64/75] mt9t112: Remove "smart" size selection

This code is broken, as it doesn't really adjust all other
settings, but output size to desired size. It isn't really
toggling everything that needs, and giving the false impression
of good size flexibility.

So, meanwhile, let's put fixed init settings for the contexts,
and toggle between them (implemented in other patch).

Signed-off-by: Sergio Aguirre <saaguirre@ti.com>
---
 drivers/media/video/mt9t112.c |  105 ++++++++++++++++-------------------------
 1 files changed, 41 insertions(+), 64 deletions(-)

diff --git a/drivers/media/video/mt9t112.c b/drivers/media/video/mt9t112.c
index ac295dd..ee991ef 100644
--- a/drivers/media/video/mt9t112.c
+++ b/drivers/media/video/mt9t112.c
@@ -390,50 +390,6 @@ static void mt9t112_frame_check(u32 *width, u32 *height)
 		*height = MAX_HEIGHT;
 }
 
-static int mt9t112_set_a_frame_size(const struct i2c_client *client,
-				   u16 width,
-				   u16 height)
-{
-	int ret;
-	u16 wstart, hstart, wend, hend;
-	u16 max_width = MAX_WIDTH_PREV, max_height = MAX_HEIGHT_PREV;
-
-	if ((width > max_width) || (height > max_height)) {
-		/* Capture case */
-		max_width = MAX_WIDTH;
-		max_height = MAX_HEIGHT;
-		hstart = 4;
-		wstart = 4;
-		hend = 1547;
-		wend = 2059;
-	} else {
-		hstart = 0;
-		wstart = 0;
-		hend = 1549;
-		wend = 2061;
-	}
-
-	/* (Context A) Image Width/Height */
-	mt9t112_mcu_write(ret, client, VAR(26, 0), width);
-	mt9t112_mcu_write(ret, client, VAR(26, 2), height);
-
-	/* (Context A) Output Width/Height */
-	mt9t112_mcu_write(ret, client, VAR(18, 43), 8 + max_width);
-	mt9t112_mcu_write(ret, client, VAR(18, 45), 8 + max_height);
-
-	/* (Context A) Start Row/Column */
-	mt9t112_mcu_write(ret, client, VAR(18, 2), hstart);
-	mt9t112_mcu_write(ret, client, VAR(18, 4), wstart);
-
-	/* (Context A) End Row/Column */
-	mt9t112_mcu_write(ret, client, VAR(18, 6), hend);
-	mt9t112_mcu_write(ret, client, VAR(18, 8), wend);
-
-	mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06);
-
-	return ret;
-}
-
 static int mt9t112_set_pll_dividers(const struct i2c_client *client,
 				    u8 m, u8 n,
 				    u8 p1, u8 p2, u8 p3,
@@ -561,9 +517,27 @@ static int mt9t112_init_setting(const struct i2c_client *client)
 
 	int ret;
 
+	/* Output Width (A) */
+	mt9t112_mcu_write(ret, client, VAR(26, 0), 640);
+
+	/* Output Height (A) */
+	mt9t112_mcu_write(ret, client, VAR(26, 2), 480);
+
 	/* Adaptive Output Clock (A) */
 	mt9t112_mcu_mask_set(ret, client, VAR(26, 160), 0x0040, 0x0000);
 
+	/* Row Start (A) */
+	mt9t112_mcu_write(ret, client, VAR(18, 2), 0);
+
+	/* Column Start (A) */
+	mt9t112_mcu_write(ret, client, VAR(18, 4), 0);
+
+	/* Row End (A) */
+	mt9t112_mcu_write(ret, client, VAR(18, 6), 1549);
+
+	/* Column End (A) */
+	mt9t112_mcu_write(ret, client, VAR(18, 8), 2061);
+
 	/* Read Mode (A) */
 	mt9t112_mcu_write(ret, client, VAR(18, 12), 0x046C);
 
@@ -585,6 +559,18 @@ static int mt9t112_init_setting(const struct i2c_client *client)
 	/* Line Length (A) */
 	mt9t112_mcu_write(ret, client, VAR(18, 37), 0x07AC);
 
+	/* Context Width (A) */
+	mt9t112_mcu_write(ret, client, VAR(18, 43), 8 + 1024);
+
+	/* Context Height (A) */
+	mt9t112_mcu_write(ret, client, VAR(18, 45), 8 + 768);
+
+	/* Output Width (B) */
+	mt9t112_mcu_write(ret, client, VAR(27, 0), 2048);
+
+	/* Output Hieght (B) */
+	mt9t112_mcu_write(ret, client, VAR(27, 2), 1536);
+
 	/* Adaptive Output Clock (B) */
 	mt9t112_mcu_mask_set(ret, client, VAR(27, 160), 0x0040, 0x0000);
 
@@ -610,13 +596,19 @@ static int mt9t112_init_setting(const struct i2c_client *client)
 	mt9t112_mcu_write(ret, client, VAR(18, 91), 0x00FF);
 
 	/* Base Frame Lines (B) */
-	mt9t112_mcu_write(ret, client, VAR(18, 101), 0x0668);
+	mt9t112_mcu_write(ret, client, VAR(18, 101), 0x066C);
 
 	/* Min Line Length (B) */
-	mt9t112_mcu_write(ret, client, VAR(18, 103), 0x0AF0);
+	mt9t112_mcu_write(ret, client, VAR(18, 103), 0x0378);
 
 	/* Line Length (B) */
-	mt9t112_mcu_write(ret, client, VAR(18, 109), 0x0AF0);
+	mt9t112_mcu_write(ret, client, VAR(18, 109), 0x0CB1);
+
+	/* Context Width (B) */
+	mt9t112_mcu_write(ret, client, VAR(18, 115), 8 + 2048);
+
+	/* Context Height (B) */
+	mt9t112_mcu_write(ret, client, VAR(18, 117), 8 + 1536);
 
 	/*
 	 * Flicker Dectection registers
@@ -692,10 +684,10 @@ static int mt9t112_init_setting(const struct i2c_client *client)
 	mt9t112_mcu_write(ret, client, VAR8(8, 12), 0x0A);
 
 	/* RX FIFO Watermark (A) */
-	mt9t112_mcu_write(ret, client, VAR(18, 70), 0x0014);
+	mt9t112_mcu_write(ret, client, VAR(18, 70), 0x0080);
 
 	/* RX FIFO Watermark (B) */
-	mt9t112_mcu_write(ret, client, VAR(18, 142), 0x0014);
+	mt9t112_mcu_write(ret, client, VAR(18, 142), 0x0080);
 
 	/* MCLK: 16MHz
 	 * PCLK: 73MHz
@@ -1008,17 +1000,6 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s,
 	case V4L2_POWER_STANDBY:
 		/* FALLTHROUGH */
 	case V4L2_POWER_OFF:
-		/* FIXME
-		 *
-		 * If user selected large output size,
-		 * and used it long time,
-		 * mt9t112 camera will be very warm.
-		 *
-		 * But current driver can not stop mt9t112 camera.
-		 * So, set small size here to solve this problem.
-		 */
-		mt9t112_set_a_frame_size(client, VGA_WIDTH, VGA_HEIGHT);
-
 		ret = priv->pdata->power_set(s, power);
 		if (ret < 0) {
 			dev_err(&client->dev, "Unable to set target board power "
@@ -1051,10 +1032,6 @@ static int mt9t112_v4l2_int_s_power(struct v4l2_int_device *s,
 				  mt9t112_pixfmt_to_order(priv->pix.pixelformat));
 		mt9t112_mcu_write(ret, client, VAR8(1, 0), 0x06);
 
-		mt9t112_set_a_frame_size(client,
-					 priv->pix.width,
-					 priv->pix.height);
-
 		ECHECKER(ret, mt9t112_auto_focus_trigger(client));
 
 		dev_dbg(&client->dev, "format : %d\n", priv->pix.pixelformat);
-- 
1.6.6.1