diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2009-02-18 15:26:06 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-03-30 11:42:57 -0400 |
commit | 107063c6156a0cbf055e771baafc28a3e3c0fb9b (patch) | |
tree | 813a2dc2c1426521167f2f289d7a106aaf2f24ec /drivers/media/video/adv7170.c | |
parent | 84c1b09495ea366276726b0df2dcd7898cda9d0f (diff) |
V4L/DVB (10714): zoran et al: convert zoran i2c modules to V4L2.
The zoran i2c modules were still using V4L1 internally. Replace this
with V4L2. Also deleted saa7111.c and saa7114.c, we use saa7115.c instead.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
[mchehab@redhat.com: fix v4l2_ctrl_query_fill_std merge conflict]
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/adv7170.c')
-rw-r--r-- | drivers/media/video/adv7170.c | 74 |
1 files changed, 18 insertions, 56 deletions
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index e0eb4f321442..ebafe78cb4c0 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c | |||
@@ -52,9 +52,8 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); | |||
52 | struct adv7170 { | 52 | struct adv7170 { |
53 | unsigned char reg[128]; | 53 | unsigned char reg[128]; |
54 | 54 | ||
55 | int norm; | 55 | v4l2_std_id norm; |
56 | int input; | 56 | int input; |
57 | int enable; | ||
58 | int bright; | 57 | int bright; |
59 | int contrast; | 58 | int contrast; |
60 | int hue; | 59 | int hue; |
@@ -62,7 +61,6 @@ struct adv7170 { | |||
62 | }; | 61 | }; |
63 | 62 | ||
64 | static char *inputs[] = { "pass_through", "play_back" }; | 63 | static char *inputs[] = { "pass_through", "play_back" }; |
65 | static char *norms[] = { "PAL", "NTSC" }; | ||
66 | 64 | ||
67 | /* ----------------------------------------------------------------------- */ | 65 | /* ----------------------------------------------------------------------- */ |
68 | 66 | ||
@@ -191,7 +189,7 @@ static int adv7170_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
191 | struct adv7170 *encoder = i2c_get_clientdata(client); | 189 | struct adv7170 *encoder = i2c_get_clientdata(client); |
192 | 190 | ||
193 | switch (cmd) { | 191 | switch (cmd) { |
194 | case 0: | 192 | case VIDIOC_INT_INIT: |
195 | #if 0 | 193 | #if 0 |
196 | /* This is just for testing!!! */ | 194 | /* This is just for testing!!! */ |
197 | adv7170_write_block(client, init_common, | 195 | adv7170_write_block(client, init_common, |
@@ -201,63 +199,47 @@ static int adv7170_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
201 | #endif | 199 | #endif |
202 | break; | 200 | break; |
203 | 201 | ||
204 | case ENCODER_GET_CAPABILITIES: | 202 | case VIDIOC_INT_S_STD_OUTPUT: |
205 | { | 203 | { |
206 | struct video_encoder_capability *cap = arg; | 204 | v4l2_std_id iarg = *(v4l2_std_id *) arg; |
207 | 205 | ||
208 | cap->flags = VIDEO_ENCODER_PAL | | 206 | v4l_dbg(1, debug, client, "set norm %llx\n", iarg); |
209 | VIDEO_ENCODER_NTSC; | ||
210 | cap->inputs = 2; | ||
211 | cap->outputs = 1; | ||
212 | break; | ||
213 | } | ||
214 | |||
215 | case ENCODER_SET_NORM: | ||
216 | { | ||
217 | int iarg = *(int *) arg; | ||
218 | |||
219 | v4l_dbg(1, debug, client, "set norm %d\n", iarg); | ||
220 | 207 | ||
221 | switch (iarg) { | 208 | if (iarg & V4L2_STD_NTSC) { |
222 | case VIDEO_MODE_NTSC: | ||
223 | adv7170_write_block(client, init_NTSC, | 209 | adv7170_write_block(client, init_NTSC, |
224 | sizeof(init_NTSC)); | 210 | sizeof(init_NTSC)); |
225 | if (encoder->input == 0) | 211 | if (encoder->input == 0) |
226 | adv7170_write(client, 0x02, 0x0e); // Enable genlock | 212 | adv7170_write(client, 0x02, 0x0e); // Enable genlock |
227 | adv7170_write(client, 0x07, TR0MODE | TR0RST); | 213 | adv7170_write(client, 0x07, TR0MODE | TR0RST); |
228 | adv7170_write(client, 0x07, TR0MODE); | 214 | adv7170_write(client, 0x07, TR0MODE); |
229 | break; | 215 | } else if (iarg & V4L2_STD_PAL) { |
230 | |||
231 | case VIDEO_MODE_PAL: | ||
232 | adv7170_write_block(client, init_PAL, | 216 | adv7170_write_block(client, init_PAL, |
233 | sizeof(init_PAL)); | 217 | sizeof(init_PAL)); |
234 | if (encoder->input == 0) | 218 | if (encoder->input == 0) |
235 | adv7170_write(client, 0x02, 0x0e); // Enable genlock | 219 | adv7170_write(client, 0x02, 0x0e); // Enable genlock |
236 | adv7170_write(client, 0x07, TR0MODE | TR0RST); | 220 | adv7170_write(client, 0x07, TR0MODE | TR0RST); |
237 | adv7170_write(client, 0x07, TR0MODE); | 221 | adv7170_write(client, 0x07, TR0MODE); |
238 | break; | 222 | } else { |
239 | 223 | v4l_dbg(1, debug, client, "illegal norm: %llx\n", iarg); | |
240 | default: | ||
241 | v4l_dbg(1, debug, client, "illegal norm: %d\n", iarg); | ||
242 | return -EINVAL; | 224 | return -EINVAL; |
243 | } | 225 | } |
244 | v4l_dbg(1, debug, client, "switched to %s\n", norms[iarg]); | 226 | v4l_dbg(1, debug, client, "switched to %llx\n", iarg); |
245 | encoder->norm = iarg; | 227 | encoder->norm = iarg; |
246 | break; | 228 | break; |
247 | } | 229 | } |
248 | 230 | ||
249 | case ENCODER_SET_INPUT: | 231 | case VIDIOC_INT_S_VIDEO_ROUTING: |
250 | { | 232 | { |
251 | int iarg = *(int *) arg; | 233 | struct v4l2_routing *route = arg; |
252 | 234 | ||
253 | /* RJ: *iarg = 0: input is from decoder | 235 | /* RJ: *iarg = 0: input is from decoder |
254 | *iarg = 1: input is from ZR36060 | 236 | *iarg = 1: input is from ZR36060 |
255 | *iarg = 2: color bar */ | 237 | *iarg = 2: color bar */ |
256 | 238 | ||
257 | v4l_dbg(1, debug, client, "set input from %s\n", | 239 | v4l_dbg(1, debug, client, "set input from %s\n", |
258 | iarg == 0 ? "decoder" : "ZR36060"); | 240 | route->input == 0 ? "decoder" : "ZR36060"); |
259 | 241 | ||
260 | switch (iarg) { | 242 | switch (route->input) { |
261 | case 0: | 243 | case 0: |
262 | adv7170_write(client, 0x01, 0x20); | 244 | adv7170_write(client, 0x01, 0x20); |
263 | adv7170_write(client, 0x08, TR1CAPT); /* TR1 */ | 245 | adv7170_write(client, 0x08, TR1CAPT); /* TR1 */ |
@@ -277,30 +259,11 @@ static int adv7170_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
277 | break; | 259 | break; |
278 | 260 | ||
279 | default: | 261 | default: |
280 | v4l_dbg(1, debug, client, "illegal input: %d\n", iarg); | 262 | v4l_dbg(1, debug, client, "illegal input: %d\n", route->input); |
281 | return -EINVAL; | ||
282 | } | ||
283 | v4l_dbg(1, debug, client, "switched to %s\n", inputs[iarg]); | ||
284 | encoder->input = iarg; | ||
285 | break; | ||
286 | } | ||
287 | |||
288 | case ENCODER_SET_OUTPUT: | ||
289 | { | ||
290 | int *iarg = arg; | ||
291 | |||
292 | /* not much choice of outputs */ | ||
293 | if (*iarg != 0) { | ||
294 | return -EINVAL; | 263 | return -EINVAL; |
295 | } | 264 | } |
296 | break; | 265 | v4l_dbg(1, debug, client, "switched to %s\n", inputs[route->input]); |
297 | } | 266 | encoder->input = route->input; |
298 | |||
299 | case ENCODER_ENABLE_OUTPUT: | ||
300 | { | ||
301 | int *iarg = arg; | ||
302 | |||
303 | encoder->enable = !!*iarg; | ||
304 | break; | 267 | break; |
305 | } | 268 | } |
306 | 269 | ||
@@ -337,9 +300,8 @@ static int adv7170_probe(struct i2c_client *client, | |||
337 | encoder = kzalloc(sizeof(struct adv7170), GFP_KERNEL); | 300 | encoder = kzalloc(sizeof(struct adv7170), GFP_KERNEL); |
338 | if (encoder == NULL) | 301 | if (encoder == NULL) |
339 | return -ENOMEM; | 302 | return -ENOMEM; |
340 | encoder->norm = VIDEO_MODE_NTSC; | 303 | encoder->norm = V4L2_STD_NTSC; |
341 | encoder->input = 0; | 304 | encoder->input = 0; |
342 | encoder->enable = 1; | ||
343 | i2c_set_clientdata(client, encoder); | 305 | i2c_set_clientdata(client, encoder); |
344 | 306 | ||
345 | i = adv7170_write_block(client, init_NTSC, sizeof(init_NTSC)); | 307 | i = adv7170_write_block(client, init_NTSC, sizeof(init_NTSC)); |