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/saa7185.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/saa7185.c')
-rw-r--r-- | drivers/media/video/saa7185.c | 78 |
1 files changed, 15 insertions, 63 deletions
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 8d06bb312c55..fc51e6c9cb95 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c | |||
@@ -49,8 +49,7 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)"); | |||
49 | struct saa7185 { | 49 | struct saa7185 { |
50 | unsigned char reg[128]; | 50 | unsigned char reg[128]; |
51 | 51 | ||
52 | int norm; | 52 | v4l2_std_id norm; |
53 | int enable; | ||
54 | int bright; | 53 | int bright; |
55 | int contrast; | 54 | int contrast; |
56 | int hue; | 55 | int hue; |
@@ -218,68 +217,43 @@ static int saa7185_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
218 | struct saa7185 *encoder = i2c_get_clientdata(client); | 217 | struct saa7185 *encoder = i2c_get_clientdata(client); |
219 | 218 | ||
220 | switch (cmd) { | 219 | switch (cmd) { |
221 | case 0: | 220 | case VIDIOC_INT_INIT: |
222 | saa7185_write_block(client, init_common, | 221 | saa7185_write_block(client, init_common, |
223 | sizeof(init_common)); | 222 | sizeof(init_common)); |
224 | switch (encoder->norm) { | 223 | if (encoder->norm & V4L2_STD_NTSC) |
225 | |||
226 | case VIDEO_MODE_NTSC: | ||
227 | saa7185_write_block(client, init_ntsc, | 224 | saa7185_write_block(client, init_ntsc, |
228 | sizeof(init_ntsc)); | 225 | sizeof(init_ntsc)); |
229 | break; | 226 | else |
230 | |||
231 | case VIDEO_MODE_PAL: | ||
232 | saa7185_write_block(client, init_pal, | 227 | saa7185_write_block(client, init_pal, |
233 | sizeof(init_pal)); | 228 | sizeof(init_pal)); |
234 | break; | ||
235 | } | ||
236 | break; | ||
237 | |||
238 | case ENCODER_GET_CAPABILITIES: | ||
239 | { | ||
240 | struct video_encoder_capability *cap = arg; | ||
241 | |||
242 | cap->flags = | ||
243 | VIDEO_ENCODER_PAL | VIDEO_ENCODER_NTSC | | ||
244 | VIDEO_ENCODER_SECAM | VIDEO_ENCODER_CCIR; | ||
245 | cap->inputs = 1; | ||
246 | cap->outputs = 1; | ||
247 | break; | 229 | break; |
248 | } | ||
249 | 230 | ||
250 | case ENCODER_SET_NORM: | 231 | case VIDIOC_INT_S_STD_OUTPUT: |
251 | { | 232 | { |
252 | int *iarg = arg; | 233 | v4l2_std_id *iarg = arg; |
253 | 234 | ||
254 | //saa7185_write_block(client, init_common, sizeof(init_common)); | 235 | //saa7185_write_block(client, init_common, sizeof(init_common)); |
255 | 236 | ||
256 | switch (*iarg) { | 237 | if (*iarg & V4L2_STD_NTSC) |
257 | case VIDEO_MODE_NTSC: | ||
258 | saa7185_write_block(client, init_ntsc, | 238 | saa7185_write_block(client, init_ntsc, |
259 | sizeof(init_ntsc)); | 239 | sizeof(init_ntsc)); |
260 | break; | 240 | else if (*iarg & V4L2_STD_PAL) |
261 | |||
262 | case VIDEO_MODE_PAL: | ||
263 | saa7185_write_block(client, init_pal, | 241 | saa7185_write_block(client, init_pal, |
264 | sizeof(init_pal)); | 242 | sizeof(init_pal)); |
265 | break; | 243 | else |
266 | |||
267 | case VIDEO_MODE_SECAM: | ||
268 | default: | ||
269 | return -EINVAL; | 244 | return -EINVAL; |
270 | } | ||
271 | encoder->norm = *iarg; | 245 | encoder->norm = *iarg; |
272 | break; | 246 | break; |
273 | } | 247 | } |
274 | 248 | ||
275 | case ENCODER_SET_INPUT: | 249 | case VIDIOC_INT_S_VIDEO_ROUTING: |
276 | { | 250 | { |
277 | int *iarg = arg; | 251 | struct v4l2_routing *route = arg; |
278 | 252 | ||
279 | /* RJ: *iarg = 0: input is from SA7111 | 253 | /* RJ: route->input = 0: input is from SA7111 |
280 | *iarg = 1: input is from ZR36060 */ | 254 | route->input = 1: input is from ZR36060 */ |
281 | 255 | ||
282 | switch (*iarg) { | 256 | switch (route->input) { |
283 | case 0: | 257 | case 0: |
284 | /* turn off colorbar */ | 258 | /* turn off colorbar */ |
285 | saa7185_write(client, 0x3a, 0x0f); | 259 | saa7185_write(client, 0x3a, 0x0f); |
@@ -315,27 +289,6 @@ static int saa7185_command(struct i2c_client *client, unsigned cmd, void *arg) | |||
315 | break; | 289 | break; |
316 | } | 290 | } |
317 | 291 | ||
318 | case ENCODER_SET_OUTPUT: | ||
319 | { | ||
320 | int *iarg = arg; | ||
321 | |||
322 | /* not much choice of outputs */ | ||
323 | if (*iarg != 0) | ||
324 | return -EINVAL; | ||
325 | break; | ||
326 | } | ||
327 | |||
328 | case ENCODER_ENABLE_OUTPUT: | ||
329 | { | ||
330 | int *iarg = arg; | ||
331 | |||
332 | encoder->enable = !!*iarg; | ||
333 | saa7185_write(client, 0x61, | ||
334 | (encoder->reg[0x61] & 0xbf) | | ||
335 | (encoder->enable ? 0x00 : 0x40)); | ||
336 | break; | ||
337 | } | ||
338 | |||
339 | default: | 292 | default: |
340 | return -EINVAL; | 293 | return -EINVAL; |
341 | } | 294 | } |
@@ -365,8 +318,7 @@ static int saa7185_probe(struct i2c_client *client, | |||
365 | encoder = kzalloc(sizeof(struct saa7185), GFP_KERNEL); | 318 | encoder = kzalloc(sizeof(struct saa7185), GFP_KERNEL); |
366 | if (encoder == NULL) | 319 | if (encoder == NULL) |
367 | return -ENOMEM; | 320 | return -ENOMEM; |
368 | encoder->norm = VIDEO_MODE_NTSC; | 321 | encoder->norm = V4L2_STD_NTSC; |
369 | encoder->enable = 1; | ||
370 | i2c_set_clientdata(client, encoder); | 322 | i2c_set_clientdata(client, encoder); |
371 | 323 | ||
372 | i = saa7185_write_block(client, init_common, sizeof(init_common)); | 324 | i = saa7185_write_block(client, init_common, sizeof(init_common)); |