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/zoran | |
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/zoran')
-rw-r--r-- | drivers/media/video/zoran/Kconfig | 4 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran.h | 6 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_card.c | 60 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_device.c | 61 | ||||
-rw-r--r-- | drivers/media/video/zoran/zoran_driver.c | 220 |
5 files changed, 122 insertions, 229 deletions
diff --git a/drivers/media/video/zoran/Kconfig b/drivers/media/video/zoran/Kconfig index e35121fdf78a..fd4120e4c104 100644 --- a/drivers/media/video/zoran/Kconfig +++ b/drivers/media/video/zoran/Kconfig | |||
@@ -32,7 +32,7 @@ config VIDEO_ZORAN_ZR36060 | |||
32 | config VIDEO_ZORAN_BUZ | 32 | config VIDEO_ZORAN_BUZ |
33 | tristate "Iomega Buz support" | 33 | tristate "Iomega Buz support" |
34 | depends on VIDEO_ZORAN_ZR36060 | 34 | depends on VIDEO_ZORAN_ZR36060 |
35 | select VIDEO_SAA7111 if VIDEO_HELPER_CHIPS_AUTO | 35 | select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO |
36 | select VIDEO_SAA7185 if VIDEO_HELPER_CHIPS_AUTO | 36 | select VIDEO_SAA7185 if VIDEO_HELPER_CHIPS_AUTO |
37 | help | 37 | help |
38 | Support for the Iomega Buz MJPEG capture/playback card. | 38 | Support for the Iomega Buz MJPEG capture/playback card. |
@@ -58,7 +58,7 @@ config VIDEO_ZORAN_LML33 | |||
58 | config VIDEO_ZORAN_LML33R10 | 58 | config VIDEO_ZORAN_LML33R10 |
59 | tristate "Linux Media Labs LML33R10 support" | 59 | tristate "Linux Media Labs LML33R10 support" |
60 | depends on VIDEO_ZORAN_ZR36060 | 60 | depends on VIDEO_ZORAN_ZR36060 |
61 | select VIDEO_SAA7114 if VIDEO_HELPER_CHIPS_AUTO | 61 | select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO |
62 | select VIDEO_ADV7170 if VIDEO_HELPER_CHIPS_AUTO | 62 | select VIDEO_ADV7170 if VIDEO_HELPER_CHIPS_AUTO |
63 | help | 63 | help |
64 | support for the Linux Media Labs LML33R10 MJPEG capture/playback | 64 | support for the Linux Media Labs LML33R10 MJPEG capture/playback |
diff --git a/drivers/media/video/zoran/zoran.h b/drivers/media/video/zoran/zoran.h index 76668bda0494..ee31bfc3428f 100644 --- a/drivers/media/video/zoran/zoran.h +++ b/drivers/media/video/zoran/zoran.h | |||
@@ -352,7 +352,7 @@ struct card_info { | |||
352 | char name[32]; | 352 | char name[32]; |
353 | } input[BUZ_MAX_INPUT]; | 353 | } input[BUZ_MAX_INPUT]; |
354 | 354 | ||
355 | int norms; | 355 | v4l2_std_id norms; |
356 | struct tvnorm *tvn[3]; /* supported TV norms */ | 356 | struct tvnorm *tvn[3]; /* supported TV norms */ |
357 | 357 | ||
358 | u32 jpeg_int; /* JPEG interrupt */ | 358 | u32 jpeg_int; /* JPEG interrupt */ |
@@ -401,8 +401,8 @@ struct zoran { | |||
401 | spinlock_t spinlock; /* Spinlock */ | 401 | spinlock_t spinlock; /* Spinlock */ |
402 | 402 | ||
403 | /* Video for Linux parameters */ | 403 | /* Video for Linux parameters */ |
404 | int input, norm; /* card's norm and input - norm=VIDEO_MODE_* */ | 404 | int input; /* card's norm and input - norm=VIDEO_MODE_* */ |
405 | int hue, saturation, contrast, brightness; /* Current picture params */ | 405 | v4l2_std_id norm; |
406 | struct video_buffer buffer; /* Current buffer params */ | 406 | struct video_buffer buffer; /* Current buffer params */ |
407 | struct zoran_overlay_settings overlay_settings; | 407 | struct zoran_overlay_settings overlay_settings; |
408 | u32 *overlay_mask; /* overlay mask */ | 408 | u32 *overlay_mask; /* overlay mask */ |
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index 774717bf43cc..51ae37effdeb 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c | |||
@@ -340,11 +340,8 @@ i2cid_to_modulename (u16 i2c_id) | |||
340 | case I2C_DRIVERID_SAA7110: | 340 | case I2C_DRIVERID_SAA7110: |
341 | name = "saa7110"; | 341 | name = "saa7110"; |
342 | break; | 342 | break; |
343 | case I2C_DRIVERID_SAA7111A: | 343 | case I2C_DRIVERID_SAA711X: |
344 | name = "saa7111"; | 344 | name = "saa7115"; |
345 | break; | ||
346 | case I2C_DRIVERID_SAA7114: | ||
347 | name = "saa7114"; | ||
348 | break; | 345 | break; |
349 | case I2C_DRIVERID_SAA7185B: | 346 | case I2C_DRIVERID_SAA7185B: |
350 | name = "saa7185"; | 347 | name = "saa7185"; |
@@ -439,7 +436,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
439 | { 2, "S-Video" }, | 436 | { 2, "S-Video" }, |
440 | { 0, "Internal/comp" } | 437 | { 0, "Internal/comp" } |
441 | }, | 438 | }, |
442 | .norms = 3, | 439 | .norms = V4L2_STD_NTSC|V4L2_STD_PAL|V4L2_STD_SECAM, |
443 | .tvn = { | 440 | .tvn = { |
444 | &f50sqpixel_dc10, | 441 | &f50sqpixel_dc10, |
445 | &f60sqpixel_dc10, | 442 | &f60sqpixel_dc10, |
@@ -467,7 +464,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
467 | { 7, "S-Video" }, | 464 | { 7, "S-Video" }, |
468 | { 5, "Internal/comp" } | 465 | { 5, "Internal/comp" } |
469 | }, | 466 | }, |
470 | .norms = 3, | 467 | .norms = V4L2_STD_NTSC|V4L2_STD_PAL|V4L2_STD_SECAM, |
471 | .tvn = { | 468 | .tvn = { |
472 | &f50sqpixel, | 469 | &f50sqpixel, |
473 | &f60sqpixel, | 470 | &f60sqpixel, |
@@ -494,7 +491,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
494 | { 7, "S-Video" }, | 491 | { 7, "S-Video" }, |
495 | { 5, "Internal/comp" } | 492 | { 5, "Internal/comp" } |
496 | }, | 493 | }, |
497 | .norms = 3, | 494 | .norms = V4L2_STD_NTSC|V4L2_STD_PAL|V4L2_STD_SECAM, |
498 | .tvn = { | 495 | .tvn = { |
499 | &f50sqpixel, | 496 | &f50sqpixel, |
500 | &f60sqpixel, | 497 | &f60sqpixel, |
@@ -523,7 +520,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
523 | { 2, "S-Video" }, | 520 | { 2, "S-Video" }, |
524 | { 0, "Internal/comp" } | 521 | { 0, "Internal/comp" } |
525 | }, | 522 | }, |
526 | .norms = 3, | 523 | .norms = V4L2_STD_NTSC|V4L2_STD_PAL|V4L2_STD_SECAM, |
527 | .tvn = { | 524 | .tvn = { |
528 | &f50sqpixel_dc10, | 525 | &f50sqpixel_dc10, |
529 | &f60sqpixel_dc10, | 526 | &f60sqpixel_dc10, |
@@ -552,7 +549,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
552 | { 2, "S-Video" }, | 549 | { 2, "S-Video" }, |
553 | { 0, "Internal/comp" } | 550 | { 0, "Internal/comp" } |
554 | }, | 551 | }, |
555 | .norms = 3, | 552 | .norms = V4L2_STD_NTSC|V4L2_STD_PAL|V4L2_STD_SECAM, |
556 | .tvn = { | 553 | .tvn = { |
557 | &f50sqpixel_dc10, | 554 | &f50sqpixel_dc10, |
558 | &f60sqpixel_dc10, | 555 | &f60sqpixel_dc10, |
@@ -579,7 +576,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
579 | { 0, "Composite" }, | 576 | { 0, "Composite" }, |
580 | { 7, "S-Video" } | 577 | { 7, "S-Video" } |
581 | }, | 578 | }, |
582 | .norms = 2, | 579 | .norms = V4L2_STD_NTSC|V4L2_STD_PAL, |
583 | .tvn = { | 580 | .tvn = { |
584 | &f50ccir601_lml33, | 581 | &f50ccir601_lml33, |
585 | &f60ccir601_lml33, | 582 | &f60ccir601_lml33, |
@@ -597,7 +594,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
597 | }, { | 594 | }, { |
598 | .type = LML33R10, | 595 | .type = LML33R10, |
599 | .name = "LML33R10", | 596 | .name = "LML33R10", |
600 | .i2c_decoder = I2C_DRIVERID_SAA7114, | 597 | .i2c_decoder = I2C_DRIVERID_SAA711X, |
601 | .i2c_encoder = I2C_DRIVERID_ADV7170, | 598 | .i2c_encoder = I2C_DRIVERID_ADV7170, |
602 | .video_codec = CODEC_TYPE_ZR36060, | 599 | .video_codec = CODEC_TYPE_ZR36060, |
603 | 600 | ||
@@ -606,7 +603,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
606 | { 0, "Composite" }, | 603 | { 0, "Composite" }, |
607 | { 7, "S-Video" } | 604 | { 7, "S-Video" } |
608 | }, | 605 | }, |
609 | .norms = 2, | 606 | .norms = V4L2_STD_NTSC|V4L2_STD_PAL, |
610 | .tvn = { | 607 | .tvn = { |
611 | &f50ccir601_lm33r10, | 608 | &f50ccir601_lm33r10, |
612 | &f60ccir601_lm33r10, | 609 | &f60ccir601_lm33r10, |
@@ -624,7 +621,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
624 | }, { | 621 | }, { |
625 | .type = BUZ, | 622 | .type = BUZ, |
626 | .name = "Buz", | 623 | .name = "Buz", |
627 | .i2c_decoder = I2C_DRIVERID_SAA7111A, | 624 | .i2c_decoder = I2C_DRIVERID_SAA711X, |
628 | .i2c_encoder = I2C_DRIVERID_SAA7185B, | 625 | .i2c_encoder = I2C_DRIVERID_SAA7185B, |
629 | .video_codec = CODEC_TYPE_ZR36060, | 626 | .video_codec = CODEC_TYPE_ZR36060, |
630 | 627 | ||
@@ -633,7 +630,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
633 | { 3, "Composite" }, | 630 | { 3, "Composite" }, |
634 | { 7, "S-Video" } | 631 | { 7, "S-Video" } |
635 | }, | 632 | }, |
636 | .norms = 3, | 633 | .norms = V4L2_STD_NTSC|V4L2_STD_PAL|V4L2_STD_SECAM, |
637 | .tvn = { | 634 | .tvn = { |
638 | &f50ccir601, | 635 | &f50ccir601, |
639 | &f60ccir601, | 636 | &f60ccir601, |
@@ -670,7 +667,7 @@ static struct card_info zoran_cards[NUM_CARDS] __devinitdata = { | |||
670 | {10, "S-Video 3" }, | 667 | {10, "S-Video 3" }, |
671 | {15, "YCbCr" } | 668 | {15, "YCbCr" } |
672 | }, | 669 | }, |
673 | .norms = 2, | 670 | .norms = V4L2_STD_NTSC|V4L2_STD_PAL, |
674 | .tvn = { | 671 | .tvn = { |
675 | &f50ccir601_avs6eyes, | 672 | &f50ccir601_avs6eyes, |
676 | &f60ccir601_avs6eyes, | 673 | &f60ccir601_avs6eyes, |
@@ -1086,8 +1083,6 @@ static int __devinit | |||
1086 | zr36057_init (struct zoran *zr) | 1083 | zr36057_init (struct zoran *zr) |
1087 | { | 1084 | { |
1088 | int j, err; | 1085 | int j, err; |
1089 | int two = 2; | ||
1090 | int zero = 0; | ||
1091 | 1086 | ||
1092 | dprintk(1, | 1087 | dprintk(1, |
1093 | KERN_INFO | 1088 | KERN_INFO |
@@ -1113,14 +1108,23 @@ zr36057_init (struct zoran *zr) | |||
1113 | if (default_norm < VIDEO_MODE_PAL && | 1108 | if (default_norm < VIDEO_MODE_PAL && |
1114 | default_norm > VIDEO_MODE_SECAM) | 1109 | default_norm > VIDEO_MODE_SECAM) |
1115 | default_norm = VIDEO_MODE_PAL; | 1110 | default_norm = VIDEO_MODE_PAL; |
1116 | zr->norm = default_norm; | 1111 | if (default_norm == VIDEO_MODE_PAL) { |
1117 | if (!(zr->timing = zr->card.tvn[zr->norm])) { | 1112 | zr->norm = V4L2_STD_PAL; |
1113 | zr->timing = zr->card.tvn[0]; | ||
1114 | } else if (default_norm == VIDEO_MODE_NTSC) { | ||
1115 | zr->norm = V4L2_STD_NTSC; | ||
1116 | zr->timing = zr->card.tvn[1]; | ||
1117 | } else { | ||
1118 | zr->norm = V4L2_STD_SECAM; | ||
1119 | zr->timing = zr->card.tvn[2]; | ||
1120 | } | ||
1121 | if (zr->timing == NULL) { | ||
1118 | dprintk(1, | 1122 | dprintk(1, |
1119 | KERN_WARNING | 1123 | KERN_WARNING |
1120 | "%s: zr36057_init() - default TV standard not supported by hardware. PAL will be used.\n", | 1124 | "%s: zr36057_init() - default TV standard not supported by hardware. PAL will be used.\n", |
1121 | ZR_DEVNAME(zr)); | 1125 | ZR_DEVNAME(zr)); |
1122 | zr->norm = VIDEO_MODE_PAL; | 1126 | zr->norm = V4L2_STD_PAL; |
1123 | zr->timing = zr->card.tvn[zr->norm]; | 1127 | zr->timing = zr->card.tvn[0]; |
1124 | } | 1128 | } |
1125 | 1129 | ||
1126 | if (default_input > zr->card.inputs-1) { | 1130 | if (default_input > zr->card.inputs-1) { |
@@ -1132,12 +1136,6 @@ zr36057_init (struct zoran *zr) | |||
1132 | } | 1136 | } |
1133 | zr->input = default_input; | 1137 | zr->input = default_input; |
1134 | 1138 | ||
1135 | /* Should the following be reset at every open ? */ | ||
1136 | zr->hue = 32768; | ||
1137 | zr->contrast = 32768; | ||
1138 | zr->saturation = 32768; | ||
1139 | zr->brightness = 32768; | ||
1140 | |||
1141 | /* default setup (will be repeated at every open) */ | 1139 | /* default setup (will be repeated at every open) */ |
1142 | zoran_open_init_params(zr); | 1140 | zoran_open_init_params(zr); |
1143 | 1141 | ||
@@ -1173,8 +1171,10 @@ zr36057_init (struct zoran *zr) | |||
1173 | detect_guest_activity(zr); | 1171 | detect_guest_activity(zr); |
1174 | test_interrupts(zr); | 1172 | test_interrupts(zr); |
1175 | if (!pass_through) { | 1173 | if (!pass_through) { |
1176 | decoder_command(zr, DECODER_ENABLE_OUTPUT, &zero); | 1174 | struct v4l2_routing route = { 2, 0 }; |
1177 | encoder_command(zr, ENCODER_SET_INPUT, &two); | 1175 | |
1176 | decoder_command(zr, VIDIOC_STREAMOFF, 0); | ||
1177 | encoder_command(zr, VIDIOC_INT_S_VIDEO_ROUTING, &route); | ||
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | zr->zoran_proc = NULL; | 1180 | zr->zoran_proc = NULL; |
diff --git a/drivers/media/video/zoran/zoran_device.c b/drivers/media/video/zoran/zoran_device.c index 1bcfa270d63d..712599a5ed72 100644 --- a/drivers/media/video/zoran/zoran_device.c +++ b/drivers/media/video/zoran/zoran_device.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include <linux/i2c.h> | 37 | #include <linux/i2c.h> |
38 | #include <linux/i2c-algo-bit.h> | 38 | #include <linux/i2c-algo-bit.h> |
39 | #include <linux/videodev.h> | 39 | #include <linux/videodev.h> |
40 | #include <linux/videodev2.h> | ||
41 | #include <media/v4l2-common.h> | ||
40 | #include <linux/spinlock.h> | 42 | #include <linux/spinlock.h> |
41 | #include <linux/sem.h> | 43 | #include <linux/sem.h> |
42 | 44 | ||
@@ -312,9 +314,9 @@ zr36057_adjust_vfe (struct zoran *zr, | |||
312 | case BUZ_MODE_MOTION_COMPRESS: | 314 | case BUZ_MODE_MOTION_COMPRESS: |
313 | case BUZ_MODE_IDLE: | 315 | case BUZ_MODE_IDLE: |
314 | default: | 316 | default: |
315 | if (zr->norm == VIDEO_MODE_NTSC || | 317 | if ((zr->norm & V4L2_STD_NTSC) || |
316 | (zr->card.type == LML33R10 && | 318 | (zr->card.type == LML33R10 && |
317 | zr->norm == VIDEO_MODE_PAL)) | 319 | (zr->norm & V4L2_STD_PAL))) |
318 | btand(~ZR36057_VFESPFR_ExtFl, ZR36057_VFESPFR); | 320 | btand(~ZR36057_VFESPFR_ExtFl, ZR36057_VFESPFR); |
319 | else | 321 | else |
320 | btor(ZR36057_VFESPFR_ExtFl, ZR36057_VFESPFR); | 322 | btor(ZR36057_VFESPFR_ExtFl, ZR36057_VFESPFR); |
@@ -355,14 +357,6 @@ zr36057_set_vfe (struct zoran *zr, | |||
355 | dprintk(2, KERN_INFO "%s: set_vfe() - width = %d, height = %d\n", | 357 | dprintk(2, KERN_INFO "%s: set_vfe() - width = %d, height = %d\n", |
356 | ZR_DEVNAME(zr), video_width, video_height); | 358 | ZR_DEVNAME(zr), video_width, video_height); |
357 | 359 | ||
358 | if (zr->norm != VIDEO_MODE_PAL && | ||
359 | zr->norm != VIDEO_MODE_NTSC && | ||
360 | zr->norm != VIDEO_MODE_SECAM) { | ||
361 | dprintk(1, | ||
362 | KERN_ERR "%s: set_vfe() - norm = %d not valid\n", | ||
363 | ZR_DEVNAME(zr), zr->norm); | ||
364 | return; | ||
365 | } | ||
366 | if (video_width < BUZ_MIN_WIDTH || | 360 | if (video_width < BUZ_MIN_WIDTH || |
367 | video_height < BUZ_MIN_HEIGHT || | 361 | video_height < BUZ_MIN_HEIGHT || |
368 | video_width > Wa || video_height > Ha) { | 362 | video_width > Wa || video_height > Ha) { |
@@ -426,7 +420,7 @@ zr36057_set_vfe (struct zoran *zr, | |||
426 | * we get the correct colors when uncompressing to the screen */ | 420 | * we get the correct colors when uncompressing to the screen */ |
427 | //reg |= ZR36057_VFESPFR_VCLKPol; /**/ | 421 | //reg |= ZR36057_VFESPFR_VCLKPol; /**/ |
428 | /* RJ: Don't know if that is needed for NTSC also */ | 422 | /* RJ: Don't know if that is needed for NTSC also */ |
429 | if (zr->norm != VIDEO_MODE_NTSC) | 423 | if (!(zr->norm & V4L2_STD_NTSC)) |
430 | reg |= ZR36057_VFESPFR_ExtFl; // NEEDED!!!!!!! Wolfgang | 424 | reg |= ZR36057_VFESPFR_ExtFl; // NEEDED!!!!!!! Wolfgang |
431 | reg |= ZR36057_VFESPFR_TopField; | 425 | reg |= ZR36057_VFESPFR_TopField; |
432 | if (HorDcm >= 48) { | 426 | if (HorDcm >= 48) { |
@@ -981,11 +975,10 @@ void | |||
981 | zr36057_enable_jpg (struct zoran *zr, | 975 | zr36057_enable_jpg (struct zoran *zr, |
982 | enum zoran_codec_mode mode) | 976 | enum zoran_codec_mode mode) |
983 | { | 977 | { |
984 | static int zero; | ||
985 | static int one = 1; | ||
986 | struct vfe_settings cap; | 978 | struct vfe_settings cap; |
987 | int field_size = | 979 | int field_size = |
988 | zr->jpg_buffers.buffer_size / zr->jpg_settings.field_per_buff; | 980 | zr->jpg_buffers.buffer_size / zr->jpg_settings.field_per_buff; |
981 | struct v4l2_routing route = { 0, 0 }; | ||
989 | 982 | ||
990 | zr->codec_mode = mode; | 983 | zr->codec_mode = mode; |
991 | 984 | ||
@@ -1007,8 +1000,9 @@ zr36057_enable_jpg (struct zoran *zr, | |||
1007 | * the video bus direction set to input. | 1000 | * the video bus direction set to input. |
1008 | */ | 1001 | */ |
1009 | set_videobus_dir(zr, 0); | 1002 | set_videobus_dir(zr, 0); |
1010 | decoder_command(zr, DECODER_ENABLE_OUTPUT, &one); | 1003 | decoder_command(zr, VIDIOC_STREAMON, 0); |
1011 | encoder_command(zr, ENCODER_SET_INPUT, &zero); | 1004 | route.input = 0; |
1005 | encoder_command(zr, VIDIOC_INT_S_VIDEO_ROUTING, &route); | ||
1012 | 1006 | ||
1013 | /* Take the JPEG codec and the VFE out of sleep */ | 1007 | /* Take the JPEG codec and the VFE out of sleep */ |
1014 | jpeg_codec_sleep(zr, 0); | 1008 | jpeg_codec_sleep(zr, 0); |
@@ -1054,9 +1048,10 @@ zr36057_enable_jpg (struct zoran *zr, | |||
1054 | /* In motion decompression mode, the decoder output must be disabled, and | 1048 | /* In motion decompression mode, the decoder output must be disabled, and |
1055 | * the video bus direction set to output. | 1049 | * the video bus direction set to output. |
1056 | */ | 1050 | */ |
1057 | decoder_command(zr, DECODER_ENABLE_OUTPUT, &zero); | 1051 | decoder_command(zr, VIDIOC_STREAMOFF, 0); |
1058 | set_videobus_dir(zr, 1); | 1052 | set_videobus_dir(zr, 1); |
1059 | encoder_command(zr, ENCODER_SET_INPUT, &one); | 1053 | route.input = 1; |
1054 | encoder_command(zr, VIDIOC_INT_S_VIDEO_ROUTING, &route); | ||
1060 | 1055 | ||
1061 | /* Take the JPEG codec and the VFE out of sleep */ | 1056 | /* Take the JPEG codec and the VFE out of sleep */ |
1062 | jpeg_codec_sleep(zr, 0); | 1057 | jpeg_codec_sleep(zr, 0); |
@@ -1100,8 +1095,9 @@ zr36057_enable_jpg (struct zoran *zr, | |||
1100 | jpeg_codec_sleep(zr, 1); | 1095 | jpeg_codec_sleep(zr, 1); |
1101 | zr36057_adjust_vfe(zr, mode); | 1096 | zr36057_adjust_vfe(zr, mode); |
1102 | 1097 | ||
1103 | decoder_command(zr, DECODER_ENABLE_OUTPUT, &one); | 1098 | decoder_command(zr, VIDIOC_STREAMON, 0); |
1104 | encoder_command(zr, ENCODER_SET_INPUT, &zero); | 1099 | route.input = 0; |
1100 | encoder_command(zr, VIDIOC_INT_S_VIDEO_ROUTING, &route); | ||
1105 | 1101 | ||
1106 | dprintk(2, KERN_INFO "%s: enable_jpg(IDLE)\n", ZR_DEVNAME(zr)); | 1102 | dprintk(2, KERN_INFO "%s: enable_jpg(IDLE)\n", ZR_DEVNAME(zr)); |
1107 | break; | 1103 | break; |
@@ -1211,17 +1207,17 @@ zoran_reap_stat_com (struct zoran *zr) | |||
1211 | static void zoran_restart(struct zoran *zr) | 1207 | static void zoran_restart(struct zoran *zr) |
1212 | { | 1208 | { |
1213 | /* Now the stat_comm buffer is ready for restart */ | 1209 | /* Now the stat_comm buffer is ready for restart */ |
1214 | int status, mode; | 1210 | int status = 0, mode; |
1215 | 1211 | ||
1216 | if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { | 1212 | if (zr->codec_mode == BUZ_MODE_MOTION_COMPRESS) { |
1217 | decoder_command(zr, DECODER_GET_STATUS, &status); | 1213 | decoder_command(zr, VIDIOC_INT_G_INPUT_STATUS, &status); |
1218 | mode = CODEC_DO_COMPRESSION; | 1214 | mode = CODEC_DO_COMPRESSION; |
1219 | } else { | 1215 | } else { |
1220 | status = 0; | 1216 | status = V4L2_IN_ST_NO_SIGNAL; |
1221 | mode = CODEC_DO_EXPANSION; | 1217 | mode = CODEC_DO_EXPANSION; |
1222 | } | 1218 | } |
1223 | if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS || | 1219 | if (zr->codec_mode == BUZ_MODE_MOTION_DECOMPRESS || |
1224 | (status & DECODER_STATUS_GOOD)) { | 1220 | !(status & V4L2_IN_ST_NO_SIGNAL)) { |
1225 | /********** RESTART code *************/ | 1221 | /********** RESTART code *************/ |
1226 | jpeg_codec_reset(zr); | 1222 | jpeg_codec_reset(zr); |
1227 | zr->codec->set_mode(zr->codec, mode); | 1223 | zr->codec->set_mode(zr->codec, mode); |
@@ -1582,7 +1578,7 @@ zoran_set_pci_master (struct zoran *zr, | |||
1582 | void | 1578 | void |
1583 | zoran_init_hardware (struct zoran *zr) | 1579 | zoran_init_hardware (struct zoran *zr) |
1584 | { | 1580 | { |
1585 | int j, zero = 0; | 1581 | struct v4l2_routing route = { 0, 0 }; |
1586 | 1582 | ||
1587 | /* Enable bus-mastering */ | 1583 | /* Enable bus-mastering */ |
1588 | zoran_set_pci_master(zr, 1); | 1584 | zoran_set_pci_master(zr, 1); |
@@ -1592,15 +1588,16 @@ zoran_init_hardware (struct zoran *zr) | |||
1592 | zr->card.init(zr); | 1588 | zr->card.init(zr); |
1593 | } | 1589 | } |
1594 | 1590 | ||
1595 | j = zr->card.input[zr->input].muxsel; | 1591 | route.input = zr->card.input[zr->input].muxsel; |
1596 | 1592 | ||
1597 | decoder_command(zr, 0, NULL); | 1593 | decoder_command(zr, VIDIOC_INT_INIT, NULL); |
1598 | decoder_command(zr, DECODER_SET_NORM, &zr->norm); | 1594 | decoder_command(zr, VIDIOC_S_STD, &zr->norm); |
1599 | decoder_command(zr, DECODER_SET_INPUT, &j); | 1595 | decoder_command(zr, VIDIOC_INT_S_VIDEO_ROUTING, &route); |
1600 | 1596 | ||
1601 | encoder_command(zr, 0, NULL); | 1597 | encoder_command(zr, VIDIOC_INT_INIT, NULL); |
1602 | encoder_command(zr, ENCODER_SET_NORM, &zr->norm); | 1598 | encoder_command(zr, VIDIOC_INT_S_STD_OUTPUT, &zr->norm); |
1603 | encoder_command(zr, ENCODER_SET_INPUT, &zero); | 1599 | route.input = 0; |
1600 | encoder_command(zr, VIDIOC_INT_S_VIDEO_ROUTING, &route); | ||
1604 | 1601 | ||
1605 | /* toggle JPEG codec sleep to sync PLL */ | 1602 | /* toggle JPEG codec sleep to sync PLL */ |
1606 | jpeg_codec_sleep(zr, 1); | 1603 | jpeg_codec_sleep(zr, 1); |
@@ -1674,7 +1671,7 @@ decoder_command (struct zoran *zr, | |||
1674 | return -EIO; | 1671 | return -EIO; |
1675 | 1672 | ||
1676 | if (zr->card.type == LML33 && | 1673 | if (zr->card.type == LML33 && |
1677 | (cmd == DECODER_SET_NORM || cmd == DECODER_SET_INPUT)) { | 1674 | (cmd == VIDIOC_S_STD || cmd == VIDIOC_INT_S_VIDEO_ROUTING)) { |
1678 | int res; | 1675 | int res; |
1679 | 1676 | ||
1680 | // Bt819 needs to reset its FIFO buffer using #FRST pin and | 1677 | // Bt819 needs to reset its FIFO buffer using #FRST pin and |
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 07f2bdfef4ee..ed8ac660a0c1 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c | |||
@@ -1145,9 +1145,10 @@ zoran_close(struct file *file) | |||
1145 | zoran_set_pci_master(zr, 0); | 1145 | zoran_set_pci_master(zr, 0); |
1146 | 1146 | ||
1147 | if (!pass_through) { /* Switch to color bar */ | 1147 | if (!pass_through) { /* Switch to color bar */ |
1148 | int zero = 0, two = 2; | 1148 | struct v4l2_routing route = { 2, 0 }; |
1149 | decoder_command(zr, DECODER_ENABLE_OUTPUT, &zero); | 1149 | |
1150 | encoder_command(zr, ENCODER_SET_INPUT, &two); | 1150 | decoder_command(zr, VIDIOC_STREAMOFF, 0); |
1151 | encoder_command(zr, VIDIOC_INT_S_VIDEO_ROUTING, &route); | ||
1151 | } | 1152 | } |
1152 | } | 1153 | } |
1153 | 1154 | ||
@@ -1569,9 +1570,9 @@ zoran_v4l2_buffer_status (struct file *file, | |||
1569 | 1570 | ||
1570 | static int | 1571 | static int |
1571 | zoran_set_norm (struct zoran *zr, | 1572 | zoran_set_norm (struct zoran *zr, |
1572 | int norm) /* VIDEO_MODE_* */ | 1573 | v4l2_std_id norm) |
1573 | { | 1574 | { |
1574 | int norm_encoder, on; | 1575 | int on; |
1575 | 1576 | ||
1576 | if (zr->v4l_buffers.active != ZORAN_FREE || | 1577 | if (zr->v4l_buffers.active != ZORAN_FREE || |
1577 | zr->jpg_buffers.active != ZORAN_FREE) { | 1578 | zr->jpg_buffers.active != ZORAN_FREE) { |
@@ -1598,52 +1599,42 @@ zoran_set_norm (struct zoran *zr, | |||
1598 | } | 1599 | } |
1599 | } | 1600 | } |
1600 | 1601 | ||
1601 | if (norm != VIDEO_MODE_AUTO && | 1602 | if (!(norm & zr->card.norms)) { |
1602 | (norm < 0 || norm >= zr->card.norms || | ||
1603 | !zr->card.tvn[norm])) { | ||
1604 | dprintk(1, | 1603 | dprintk(1, |
1605 | KERN_ERR "%s: set_norm() - unsupported norm %d\n", | 1604 | KERN_ERR "%s: set_norm() - unsupported norm %llx\n", |
1606 | ZR_DEVNAME(zr), norm); | 1605 | ZR_DEVNAME(zr), norm); |
1607 | return -EINVAL; | 1606 | return -EINVAL; |
1608 | } | 1607 | } |
1609 | 1608 | ||
1610 | if (norm == VIDEO_MODE_AUTO) { | 1609 | if (norm == V4L2_STD_ALL) { |
1611 | int status; | 1610 | int status = 0; |
1611 | v4l2_std_id std = 0; | ||
1612 | 1612 | ||
1613 | /* if we have autodetect, ... */ | 1613 | decoder_command(zr, VIDIOC_QUERYSTD, &std); |
1614 | struct video_decoder_capability caps; | 1614 | decoder_command(zr, VIDIOC_S_STD, &std); |
1615 | decoder_command(zr, DECODER_GET_CAPABILITIES, &caps); | ||
1616 | if (!(caps.flags & VIDEO_DECODER_AUTO)) { | ||
1617 | dprintk(1, KERN_ERR "%s: norm=auto unsupported\n", | ||
1618 | ZR_DEVNAME(zr)); | ||
1619 | return -EINVAL; | ||
1620 | } | ||
1621 | |||
1622 | decoder_command(zr, DECODER_SET_NORM, &norm); | ||
1623 | 1615 | ||
1624 | /* let changes come into effect */ | 1616 | /* let changes come into effect */ |
1625 | ssleep(2); | 1617 | ssleep(2); |
1626 | 1618 | ||
1627 | decoder_command(zr, DECODER_GET_STATUS, &status); | 1619 | decoder_command(zr, VIDIOC_INT_G_INPUT_STATUS, &status); |
1628 | if (!(status & DECODER_STATUS_GOOD)) { | 1620 | if (status & V4L2_IN_ST_NO_SIGNAL) { |
1629 | dprintk(1, | 1621 | dprintk(1, |
1630 | KERN_ERR | 1622 | KERN_ERR |
1631 | "%s: set_norm() - no norm detected\n", | 1623 | "%s: set_norm() - no norm detected\n", |
1632 | ZR_DEVNAME(zr)); | 1624 | ZR_DEVNAME(zr)); |
1633 | /* reset norm */ | 1625 | /* reset norm */ |
1634 | decoder_command(zr, DECODER_SET_NORM, &zr->norm); | 1626 | decoder_command(zr, VIDIOC_S_STD, &zr->norm); |
1635 | return -EIO; | 1627 | return -EIO; |
1636 | } | 1628 | } |
1637 | 1629 | ||
1638 | if (status & DECODER_STATUS_NTSC) | 1630 | norm = std; |
1639 | norm = VIDEO_MODE_NTSC; | ||
1640 | else if (status & DECODER_STATUS_SECAM) | ||
1641 | norm = VIDEO_MODE_SECAM; | ||
1642 | else | ||
1643 | norm = VIDEO_MODE_PAL; | ||
1644 | } | 1631 | } |
1645 | zr->timing = zr->card.tvn[norm]; | 1632 | if (norm & V4L2_STD_SECAM) |
1646 | norm_encoder = norm; | 1633 | zr->timing = zr->card.tvn[2]; |
1634 | else if (norm & V4L2_STD_NTSC) | ||
1635 | zr->timing = zr->card.tvn[1]; | ||
1636 | else | ||
1637 | zr->timing = zr->card.tvn[0]; | ||
1647 | 1638 | ||
1648 | /* We switch overlay off and on since a change in the | 1639 | /* We switch overlay off and on since a change in the |
1649 | * norm needs different VFE settings */ | 1640 | * norm needs different VFE settings */ |
@@ -1651,8 +1642,8 @@ zoran_set_norm (struct zoran *zr, | |||
1651 | if (on) | 1642 | if (on) |
1652 | zr36057_overlay(zr, 0); | 1643 | zr36057_overlay(zr, 0); |
1653 | 1644 | ||
1654 | decoder_command(zr, DECODER_SET_NORM, &norm); | 1645 | decoder_command(zr, VIDIOC_S_STD, &norm); |
1655 | encoder_command(zr, ENCODER_SET_NORM, &norm_encoder); | 1646 | encoder_command(zr, VIDIOC_INT_S_STD_OUTPUT, &norm); |
1656 | 1647 | ||
1657 | if (on) | 1648 | if (on) |
1658 | zr36057_overlay(zr, 1); | 1649 | zr36057_overlay(zr, 1); |
@@ -1667,7 +1658,7 @@ static int | |||
1667 | zoran_set_input (struct zoran *zr, | 1658 | zoran_set_input (struct zoran *zr, |
1668 | int input) | 1659 | int input) |
1669 | { | 1660 | { |
1670 | int realinput; | 1661 | struct v4l2_routing route = { 0, 0 }; |
1671 | 1662 | ||
1672 | if (input == zr->input) { | 1663 | if (input == zr->input) { |
1673 | return 0; | 1664 | return 0; |
@@ -1690,10 +1681,10 @@ zoran_set_input (struct zoran *zr, | |||
1690 | return -EINVAL; | 1681 | return -EINVAL; |
1691 | } | 1682 | } |
1692 | 1683 | ||
1693 | realinput = zr->card.input[input].muxsel; | 1684 | route.input = zr->card.input[input].muxsel; |
1694 | zr->input = input; | 1685 | zr->input = input; |
1695 | 1686 | ||
1696 | decoder_command(zr, DECODER_SET_INPUT, &realinput); | 1687 | decoder_command(zr, VIDIOC_INT_S_VIDEO_ROUTING, &route); |
1697 | 1688 | ||
1698 | return 0; | 1689 | return 0; |
1699 | } | 1690 | } |
@@ -1722,7 +1713,13 @@ static long zoran_default(struct file *file, void *__fh, int cmd, void *arg) | |||
1722 | 1713 | ||
1723 | mutex_lock(&zr->resource_lock); | 1714 | mutex_lock(&zr->resource_lock); |
1724 | 1715 | ||
1725 | bparams->norm = zr->norm; | 1716 | if (zr->norm & V4L2_STD_NTSC) |
1717 | bparams->norm = VIDEO_MODE_NTSC; | ||
1718 | else if (zr->norm & V4L2_STD_PAL) | ||
1719 | bparams->norm = VIDEO_MODE_PAL; | ||
1720 | else | ||
1721 | bparams->norm = VIDEO_MODE_SECAM; | ||
1722 | |||
1726 | bparams->input = zr->input; | 1723 | bparams->input = zr->input; |
1727 | 1724 | ||
1728 | bparams->decimation = fh->jpg_settings.decimation; | 1725 | bparams->decimation = fh->jpg_settings.decimation; |
@@ -1905,7 +1902,9 @@ jpgreqbuf_unlock_and_return: | |||
1905 | case BUZIOC_G_STATUS: | 1902 | case BUZIOC_G_STATUS: |
1906 | { | 1903 | { |
1907 | struct zoran_status *bstat = arg; | 1904 | struct zoran_status *bstat = arg; |
1908 | int norm, input, status, res = 0; | 1905 | struct v4l2_routing route = { 0, 0 }; |
1906 | int status = 0, res = 0; | ||
1907 | v4l2_std_id norm; | ||
1909 | 1908 | ||
1910 | dprintk(3, KERN_DEBUG "%s: BUZIOC_G_STATUS\n", ZR_DEVNAME(zr)); | 1909 | dprintk(3, KERN_DEBUG "%s: BUZIOC_G_STATUS\n", ZR_DEVNAME(zr)); |
1911 | 1910 | ||
@@ -1917,8 +1916,7 @@ jpgreqbuf_unlock_and_return: | |||
1917 | return -EINVAL; | 1916 | return -EINVAL; |
1918 | } | 1917 | } |
1919 | 1918 | ||
1920 | input = zr->card.input[bstat->input].muxsel; | 1919 | route.input = zr->card.input[bstat->input].muxsel; |
1921 | norm = VIDEO_MODE_AUTO; | ||
1922 | 1920 | ||
1923 | mutex_lock(&zr->resource_lock); | 1921 | mutex_lock(&zr->resource_lock); |
1924 | 1922 | ||
@@ -1931,34 +1929,33 @@ jpgreqbuf_unlock_and_return: | |||
1931 | goto gstat_unlock_and_return; | 1929 | goto gstat_unlock_and_return; |
1932 | } | 1930 | } |
1933 | 1931 | ||
1934 | decoder_command(zr, DECODER_SET_INPUT, &input); | 1932 | decoder_command(zr, VIDIOC_INT_S_VIDEO_ROUTING, &route); |
1935 | decoder_command(zr, DECODER_SET_NORM, &norm); | ||
1936 | 1933 | ||
1937 | /* sleep 1 second */ | 1934 | /* sleep 1 second */ |
1938 | ssleep(1); | 1935 | ssleep(1); |
1939 | 1936 | ||
1940 | /* Get status of video decoder */ | 1937 | /* Get status of video decoder */ |
1941 | decoder_command(zr, DECODER_GET_STATUS, &status); | 1938 | decoder_command(zr, VIDIOC_QUERYSTD, &norm); |
1939 | decoder_command(zr, VIDIOC_INT_G_INPUT_STATUS, &status); | ||
1942 | 1940 | ||
1943 | /* restore previous input and norm */ | 1941 | /* restore previous input and norm */ |
1944 | input = zr->card.input[zr->input].muxsel; | 1942 | route.input = zr->card.input[zr->input].muxsel; |
1945 | decoder_command(zr, DECODER_SET_INPUT, &input); | 1943 | decoder_command(zr, VIDIOC_INT_S_VIDEO_ROUTING, &route); |
1946 | decoder_command(zr, DECODER_SET_NORM, &zr->norm); | ||
1947 | gstat_unlock_and_return: | 1944 | gstat_unlock_and_return: |
1948 | mutex_unlock(&zr->resource_lock); | 1945 | mutex_unlock(&zr->resource_lock); |
1949 | 1946 | ||
1950 | if (!res) { | 1947 | if (!res) { |
1951 | bstat->signal = | 1948 | bstat->signal = |
1952 | (status & DECODER_STATUS_GOOD) ? 1 : 0; | 1949 | (status & V4L2_IN_ST_NO_SIGNAL) ? 0 : 1; |
1953 | if (status & DECODER_STATUS_NTSC) | 1950 | if (norm & V4L2_STD_NTSC) |
1954 | bstat->norm = VIDEO_MODE_NTSC; | 1951 | bstat->norm = VIDEO_MODE_NTSC; |
1955 | else if (status & DECODER_STATUS_SECAM) | 1952 | else if (norm & V4L2_STD_SECAM) |
1956 | bstat->norm = VIDEO_MODE_SECAM; | 1953 | bstat->norm = VIDEO_MODE_SECAM; |
1957 | else | 1954 | else |
1958 | bstat->norm = VIDEO_MODE_PAL; | 1955 | bstat->norm = VIDEO_MODE_PAL; |
1959 | 1956 | ||
1960 | bstat->color = | 1957 | bstat->color = |
1961 | (status & DECODER_STATUS_COLOR) ? 1 : 0; | 1958 | (status & V4L2_IN_ST_NO_COLOR) ? 0 : 1; |
1962 | } | 1959 | } |
1963 | 1960 | ||
1964 | return res; | 1961 | return res; |
@@ -2867,37 +2864,15 @@ strmoff_unlock_and_return: | |||
2867 | static int zoran_queryctrl(struct file *file, void *__fh, | 2864 | static int zoran_queryctrl(struct file *file, void *__fh, |
2868 | struct v4l2_queryctrl *ctrl) | 2865 | struct v4l2_queryctrl *ctrl) |
2869 | { | 2866 | { |
2867 | struct zoran_fh *fh = __fh; | ||
2868 | struct zoran *zr = fh->zr; | ||
2869 | |||
2870 | /* we only support hue/saturation/contrast/brightness */ | 2870 | /* we only support hue/saturation/contrast/brightness */ |
2871 | if (ctrl->id < V4L2_CID_BRIGHTNESS || | 2871 | if (ctrl->id < V4L2_CID_BRIGHTNESS || |
2872 | ctrl->id > V4L2_CID_HUE) | 2872 | ctrl->id > V4L2_CID_HUE) |
2873 | return -EINVAL; | 2873 | return -EINVAL; |
2874 | else { | ||
2875 | int id = ctrl->id; | ||
2876 | memset(ctrl, 0, sizeof(*ctrl)); | ||
2877 | ctrl->id = id; | ||
2878 | } | ||
2879 | |||
2880 | switch (ctrl->id) { | ||
2881 | case V4L2_CID_BRIGHTNESS: | ||
2882 | strncpy(ctrl->name, "Brightness", sizeof(ctrl->name)-1); | ||
2883 | break; | ||
2884 | case V4L2_CID_CONTRAST: | ||
2885 | strncpy(ctrl->name, "Contrast", sizeof(ctrl->name)-1); | ||
2886 | break; | ||
2887 | case V4L2_CID_SATURATION: | ||
2888 | strncpy(ctrl->name, "Saturation", sizeof(ctrl->name)-1); | ||
2889 | break; | ||
2890 | case V4L2_CID_HUE: | ||
2891 | strncpy(ctrl->name, "Hue", sizeof(ctrl->name)-1); | ||
2892 | break; | ||
2893 | } | ||
2894 | 2874 | ||
2895 | ctrl->minimum = 0; | 2875 | decoder_command(zr, VIDIOC_QUERYCTRL, ctrl); |
2896 | ctrl->maximum = 65535; | ||
2897 | ctrl->step = 1; | ||
2898 | ctrl->default_value = 32768; | ||
2899 | ctrl->type = V4L2_CTRL_TYPE_INTEGER; | ||
2900 | ctrl->flags = V4L2_CTRL_FLAG_SLIDER; | ||
2901 | 2876 | ||
2902 | return 0; | 2877 | return 0; |
2903 | } | 2878 | } |
@@ -2913,20 +2888,7 @@ static int zoran_g_ctrl(struct file *file, void *__fh, struct v4l2_control *ctrl | |||
2913 | return -EINVAL; | 2888 | return -EINVAL; |
2914 | 2889 | ||
2915 | mutex_lock(&zr->resource_lock); | 2890 | mutex_lock(&zr->resource_lock); |
2916 | switch (ctrl->id) { | 2891 | decoder_command(zr, VIDIOC_G_CTRL, ctrl); |
2917 | case V4L2_CID_BRIGHTNESS: | ||
2918 | ctrl->value = zr->brightness; | ||
2919 | break; | ||
2920 | case V4L2_CID_CONTRAST: | ||
2921 | ctrl->value = zr->contrast; | ||
2922 | break; | ||
2923 | case V4L2_CID_SATURATION: | ||
2924 | ctrl->value = zr->saturation; | ||
2925 | break; | ||
2926 | case V4L2_CID_HUE: | ||
2927 | ctrl->value = zr->hue; | ||
2928 | break; | ||
2929 | } | ||
2930 | mutex_unlock(&zr->resource_lock); | 2892 | mutex_unlock(&zr->resource_lock); |
2931 | 2893 | ||
2932 | return 0; | 2894 | return 0; |
@@ -2936,42 +2898,14 @@ static int zoran_s_ctrl(struct file *file, void *__fh, struct v4l2_control *ctrl | |||
2936 | { | 2898 | { |
2937 | struct zoran_fh *fh = __fh; | 2899 | struct zoran_fh *fh = __fh; |
2938 | struct zoran *zr = fh->zr; | 2900 | struct zoran *zr = fh->zr; |
2939 | struct video_picture pict; | ||
2940 | 2901 | ||
2941 | /* we only support hue/saturation/contrast/brightness */ | 2902 | /* we only support hue/saturation/contrast/brightness */ |
2942 | if (ctrl->id < V4L2_CID_BRIGHTNESS || | 2903 | if (ctrl->id < V4L2_CID_BRIGHTNESS || |
2943 | ctrl->id > V4L2_CID_HUE) | 2904 | ctrl->id > V4L2_CID_HUE) |
2944 | return -EINVAL; | 2905 | return -EINVAL; |
2945 | 2906 | ||
2946 | if (ctrl->value < 0 || ctrl->value > 65535) { | ||
2947 | dprintk(1, KERN_ERR | ||
2948 | "%s: VIDIOC_S_CTRL - invalid value %d for id=%d\n", | ||
2949 | ZR_DEVNAME(zr), ctrl->value, ctrl->id); | ||
2950 | return -EINVAL; | ||
2951 | } | ||
2952 | |||
2953 | mutex_lock(&zr->resource_lock); | 2907 | mutex_lock(&zr->resource_lock); |
2954 | switch (ctrl->id) { | 2908 | decoder_command(zr, VIDIOC_S_CTRL, ctrl); |
2955 | case V4L2_CID_BRIGHTNESS: | ||
2956 | zr->brightness = ctrl->value; | ||
2957 | break; | ||
2958 | case V4L2_CID_CONTRAST: | ||
2959 | zr->contrast = ctrl->value; | ||
2960 | break; | ||
2961 | case V4L2_CID_SATURATION: | ||
2962 | zr->saturation = ctrl->value; | ||
2963 | break; | ||
2964 | case V4L2_CID_HUE: | ||
2965 | zr->hue = ctrl->value; | ||
2966 | break; | ||
2967 | } | ||
2968 | pict.brightness = zr->brightness; | ||
2969 | pict.contrast = zr->contrast; | ||
2970 | pict.colour = zr->saturation; | ||
2971 | pict.hue = zr->hue; | ||
2972 | |||
2973 | decoder_command(zr, DECODER_SET_PICTURE, &pict); | ||
2974 | |||
2975 | mutex_unlock(&zr->resource_lock); | 2909 | mutex_unlock(&zr->resource_lock); |
2976 | 2910 | ||
2977 | return 0; | 2911 | return 0; |
@@ -2981,24 +2915,10 @@ static int zoran_g_std(struct file *file, void *__fh, v4l2_std_id *std) | |||
2981 | { | 2915 | { |
2982 | struct zoran_fh *fh = __fh; | 2916 | struct zoran_fh *fh = __fh; |
2983 | struct zoran *zr = fh->zr; | 2917 | struct zoran *zr = fh->zr; |
2984 | int norm; | ||
2985 | 2918 | ||
2986 | mutex_lock(&zr->resource_lock); | 2919 | mutex_lock(&zr->resource_lock); |
2987 | norm = zr->norm; | 2920 | *std = zr->norm; |
2988 | mutex_unlock(&zr->resource_lock); | 2921 | mutex_unlock(&zr->resource_lock); |
2989 | |||
2990 | switch (norm) { | ||
2991 | case VIDEO_MODE_PAL: | ||
2992 | *std = V4L2_STD_PAL; | ||
2993 | break; | ||
2994 | case VIDEO_MODE_NTSC: | ||
2995 | *std = V4L2_STD_NTSC; | ||
2996 | break; | ||
2997 | case VIDEO_MODE_SECAM: | ||
2998 | *std = V4L2_STD_SECAM; | ||
2999 | break; | ||
3000 | } | ||
3001 | |||
3002 | return 0; | 2922 | return 0; |
3003 | } | 2923 | } |
3004 | 2924 | ||
@@ -3006,25 +2926,10 @@ static int zoran_s_std(struct file *file, void *__fh, v4l2_std_id *std) | |||
3006 | { | 2926 | { |
3007 | struct zoran_fh *fh = __fh; | 2927 | struct zoran_fh *fh = __fh; |
3008 | struct zoran *zr = fh->zr; | 2928 | struct zoran *zr = fh->zr; |
3009 | int norm = -1, res = 0; | 2929 | int res = 0; |
3010 | |||
3011 | if ((*std & V4L2_STD_PAL) && !(*std & ~V4L2_STD_PAL)) | ||
3012 | norm = VIDEO_MODE_PAL; | ||
3013 | else if ((*std & V4L2_STD_NTSC) && !(*std & ~V4L2_STD_NTSC)) | ||
3014 | norm = VIDEO_MODE_NTSC; | ||
3015 | else if ((*std & V4L2_STD_SECAM) && !(*std & ~V4L2_STD_SECAM)) | ||
3016 | norm = VIDEO_MODE_SECAM; | ||
3017 | else if (*std == V4L2_STD_ALL) | ||
3018 | norm = VIDEO_MODE_AUTO; | ||
3019 | else { | ||
3020 | dprintk(1, KERN_ERR | ||
3021 | "%s: VIDIOC_S_STD - invalid norm 0x%llx\n", | ||
3022 | ZR_DEVNAME(zr), (unsigned long long)*std); | ||
3023 | return -EINVAL; | ||
3024 | } | ||
3025 | 2930 | ||
3026 | mutex_lock(&zr->resource_lock); | 2931 | mutex_lock(&zr->resource_lock); |
3027 | res = zoran_set_norm(zr, norm); | 2932 | res = zoran_set_norm(zr, *std); |
3028 | if (res) | 2933 | if (res) |
3029 | goto sstd_unlock_and_return; | 2934 | goto sstd_unlock_and_return; |
3030 | 2935 | ||
@@ -3039,7 +2944,6 @@ static int zoran_enum_input(struct file *file, void *__fh, | |||
3039 | { | 2944 | { |
3040 | struct zoran_fh *fh = __fh; | 2945 | struct zoran_fh *fh = __fh; |
3041 | struct zoran *zr = fh->zr; | 2946 | struct zoran *zr = fh->zr; |
3042 | int status; | ||
3043 | 2947 | ||
3044 | if (inp->index < 0 || inp->index >= zr->card.inputs) | 2948 | if (inp->index < 0 || inp->index >= zr->card.inputs) |
3045 | return -EINVAL; | 2949 | return -EINVAL; |
@@ -3056,16 +2960,8 @@ static int zoran_enum_input(struct file *file, void *__fh, | |||
3056 | 2960 | ||
3057 | /* Get status of video decoder */ | 2961 | /* Get status of video decoder */ |
3058 | mutex_lock(&zr->resource_lock); | 2962 | mutex_lock(&zr->resource_lock); |
3059 | decoder_command(zr, DECODER_GET_STATUS, &status); | 2963 | decoder_command(zr, VIDIOC_INT_G_INPUT_STATUS, &inp->status); |
3060 | mutex_unlock(&zr->resource_lock); | 2964 | mutex_unlock(&zr->resource_lock); |
3061 | |||
3062 | if (!(status & DECODER_STATUS_GOOD)) { | ||
3063 | inp->status |= V4L2_IN_ST_NO_POWER; | ||
3064 | inp->status |= V4L2_IN_ST_NO_SIGNAL; | ||
3065 | } | ||
3066 | if (!(status & DECODER_STATUS_COLOR)) | ||
3067 | inp->status |= V4L2_IN_ST_NO_COLOR; | ||
3068 | |||
3069 | return 0; | 2965 | return 0; |
3070 | } | 2966 | } |
3071 | 2967 | ||