diff options
Diffstat (limited to 'drivers/media/video/v4l2-common.c')
-rw-r--r-- | drivers/media/video/v4l2-common.c | 41 |
1 files changed, 38 insertions, 3 deletions
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 54747606eae1..49f1df74aa21 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -60,6 +60,7 @@ | |||
60 | #include <linux/video_decoder.h> | 60 | #include <linux/video_decoder.h> |
61 | #define __OLD_VIDIOC_ /* To allow fixing old calls*/ | 61 | #define __OLD_VIDIOC_ /* To allow fixing old calls*/ |
62 | #include <media/v4l2-common.h> | 62 | #include <media/v4l2-common.h> |
63 | #include <media/v4l2-chip-ident.h> | ||
63 | 64 | ||
64 | #ifdef CONFIG_KMOD | 65 | #ifdef CONFIG_KMOD |
65 | #include <linux/kmod.h> | 66 | #include <linux/kmod.h> |
@@ -260,6 +261,8 @@ char *v4l2_field_names[] = { | |||
260 | [V4L2_FIELD_SEQ_TB] = "seq-tb", | 261 | [V4L2_FIELD_SEQ_TB] = "seq-tb", |
261 | [V4L2_FIELD_SEQ_BT] = "seq-bt", | 262 | [V4L2_FIELD_SEQ_BT] = "seq-bt", |
262 | [V4L2_FIELD_ALTERNATE] = "alternate", | 263 | [V4L2_FIELD_ALTERNATE] = "alternate", |
264 | [V4L2_FIELD_INTERLACED_TB] = "interlaced-tb", | ||
265 | [V4L2_FIELD_INTERLACED_BT] = "interlaced-bt", | ||
263 | }; | 266 | }; |
264 | 267 | ||
265 | char *v4l2_type_names[] = { | 268 | char *v4l2_type_names[] = { |
@@ -269,7 +272,8 @@ char *v4l2_type_names[] = { | |||
269 | [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", | 272 | [V4L2_BUF_TYPE_VBI_CAPTURE] = "vbi-cap", |
270 | [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", | 273 | [V4L2_BUF_TYPE_VBI_OUTPUT] = "vbi-out", |
271 | [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap", | 274 | [V4L2_BUF_TYPE_SLICED_VBI_CAPTURE] = "sliced-vbi-cap", |
272 | [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "slicec-vbi-out", | 275 | [V4L2_BUF_TYPE_SLICED_VBI_OUTPUT] = "sliced-vbi-out", |
276 | [V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY] = "video-out-over", | ||
273 | }; | 277 | }; |
274 | 278 | ||
275 | 279 | ||
@@ -380,6 +384,8 @@ static const char *v4l2_ioctls[] = { | |||
380 | 384 | ||
381 | [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", | 385 | [_IOC_NR(VIDIOC_DBG_S_REGISTER)] = "VIDIOC_DBG_S_REGISTER", |
382 | [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", | 386 | [_IOC_NR(VIDIOC_DBG_G_REGISTER)] = "VIDIOC_DBG_G_REGISTER", |
387 | |||
388 | [_IOC_NR(VIDIOC_G_CHIP_IDENT)] = "VIDIOC_G_CHIP_IDENT", | ||
383 | #endif | 389 | #endif |
384 | }; | 390 | }; |
385 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | 391 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) |
@@ -410,14 +416,16 @@ static const char *v4l2_int_ioctls[] = { | |||
410 | [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE", | 416 | [_IOC_NR(VIDIOC_INT_DECODE_VBI_LINE)] = "VIDIOC_INT_DECODE_VBI_LINE", |
411 | [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA", | 417 | [_IOC_NR(VIDIOC_INT_S_VBI_DATA)] = "VIDIOC_INT_S_VBI_DATA", |
412 | [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA", | 418 | [_IOC_NR(VIDIOC_INT_G_VBI_DATA)] = "VIDIOC_INT_G_VBI_DATA", |
413 | [_IOC_NR(VIDIOC_INT_G_CHIP_IDENT)] = "VIDIOC_INT_G_CHIP_IDENT", | ||
414 | [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ", | 419 | [_IOC_NR(VIDIOC_INT_I2S_CLOCK_FREQ)] = "VIDIOC_INT_I2S_CLOCK_FREQ", |
415 | [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY", | 420 | [_IOC_NR(VIDIOC_INT_S_STANDBY)] = "VIDIOC_INT_S_STANDBY", |
416 | [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING", | 421 | [_IOC_NR(VIDIOC_INT_S_AUDIO_ROUTING)] = "VIDIOC_INT_S_AUDIO_ROUTING", |
417 | [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)] = "VIDIOC_INT_G_AUDIO_ROUTING", | 422 | [_IOC_NR(VIDIOC_INT_G_AUDIO_ROUTING)] = "VIDIOC_INT_G_AUDIO_ROUTING", |
418 | [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)] = "VIDIOC_INT_S_VIDEO_ROUTING", | 423 | [_IOC_NR(VIDIOC_INT_S_VIDEO_ROUTING)] = "VIDIOC_INT_S_VIDEO_ROUTING", |
419 | [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)] = "VIDIOC_INT_G_VIDEO_ROUTING", | 424 | [_IOC_NR(VIDIOC_INT_G_VIDEO_ROUTING)] = "VIDIOC_INT_G_VIDEO_ROUTING", |
420 | [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)] = "VIDIOC_INT_S_CRYSTAL_FREQ" | 425 | [_IOC_NR(VIDIOC_INT_S_CRYSTAL_FREQ)] = "VIDIOC_INT_S_CRYSTAL_FREQ", |
426 | [_IOC_NR(VIDIOC_INT_INIT)] = "VIDIOC_INT_INIT", | ||
427 | [_IOC_NR(VIDIOC_INT_G_STD_OUTPUT)] = "VIDIOC_INT_G_STD_OUTPUT", | ||
428 | [_IOC_NR(VIDIOC_INT_S_STD_OUTPUT)] = "VIDIOC_INT_S_STD_OUTPUT", | ||
421 | }; | 429 | }; |
422 | #define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls) | 430 | #define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls) |
423 | 431 | ||
@@ -680,6 +688,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste | |||
680 | case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: name = "Audio Stereo Mode Extension"; break; | 688 | case V4L2_CID_MPEG_AUDIO_MODE_EXTENSION: name = "Audio Stereo Mode Extension"; break; |
681 | case V4L2_CID_MPEG_AUDIO_EMPHASIS: name = "Audio Emphasis"; break; | 689 | case V4L2_CID_MPEG_AUDIO_EMPHASIS: name = "Audio Emphasis"; break; |
682 | case V4L2_CID_MPEG_AUDIO_CRC: name = "Audio CRC"; break; | 690 | case V4L2_CID_MPEG_AUDIO_CRC: name = "Audio CRC"; break; |
691 | case V4L2_CID_MPEG_AUDIO_MUTE: name = "Audio Mute"; break; | ||
683 | case V4L2_CID_MPEG_VIDEO_ENCODING: name = "Video Encoding"; break; | 692 | case V4L2_CID_MPEG_VIDEO_ENCODING: name = "Video Encoding"; break; |
684 | case V4L2_CID_MPEG_VIDEO_ASPECT: name = "Video Aspect"; break; | 693 | case V4L2_CID_MPEG_VIDEO_ASPECT: name = "Video Aspect"; break; |
685 | case V4L2_CID_MPEG_VIDEO_B_FRAMES: name = "Video B Frames"; break; | 694 | case V4L2_CID_MPEG_VIDEO_B_FRAMES: name = "Video B Frames"; break; |
@@ -690,6 +699,8 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste | |||
690 | case V4L2_CID_MPEG_VIDEO_BITRATE: name = "Video Bitrate"; break; | 699 | case V4L2_CID_MPEG_VIDEO_BITRATE: name = "Video Bitrate"; break; |
691 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: name = "Video Peak Bitrate"; break; | 700 | case V4L2_CID_MPEG_VIDEO_BITRATE_PEAK: name = "Video Peak Bitrate"; break; |
692 | case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: name = "Video Temporal Decimation"; break; | 701 | case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: name = "Video Temporal Decimation"; break; |
702 | case V4L2_CID_MPEG_VIDEO_MUTE: name = "Video Mute"; break; | ||
703 | case V4L2_CID_MPEG_VIDEO_MUTE_YUV: name = "Video Mute YUV"; break; | ||
693 | case V4L2_CID_MPEG_STREAM_TYPE: name = "Stream Type"; break; | 704 | case V4L2_CID_MPEG_STREAM_TYPE: name = "Stream Type"; break; |
694 | case V4L2_CID_MPEG_STREAM_PID_PMT: name = "Stream PMT Program ID"; break; | 705 | case V4L2_CID_MPEG_STREAM_PID_PMT: name = "Stream PMT Program ID"; break; |
695 | case V4L2_CID_MPEG_STREAM_PID_AUDIO: name = "Stream Audio Program ID"; break; | 706 | case V4L2_CID_MPEG_STREAM_PID_AUDIO: name = "Stream Audio Program ID"; break; |
@@ -705,6 +716,7 @@ int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 ste | |||
705 | switch (qctrl->id) { | 716 | switch (qctrl->id) { |
706 | case V4L2_CID_AUDIO_MUTE: | 717 | case V4L2_CID_AUDIO_MUTE: |
707 | case V4L2_CID_AUDIO_LOUDNESS: | 718 | case V4L2_CID_AUDIO_LOUDNESS: |
719 | case V4L2_CID_MPEG_AUDIO_MUTE: | ||
708 | case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE: | 720 | case V4L2_CID_MPEG_VIDEO_GOP_CLOSURE: |
709 | case V4L2_CID_MPEG_VIDEO_PULLDOWN: | 721 | case V4L2_CID_MPEG_VIDEO_PULLDOWN: |
710 | qctrl->type = V4L2_CTRL_TYPE_BOOLEAN; | 722 | qctrl->type = V4L2_CTRL_TYPE_BOOLEAN; |
@@ -838,6 +850,8 @@ int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl) | |||
838 | V4L2_MPEG_AUDIO_CRC_NONE, | 850 | V4L2_MPEG_AUDIO_CRC_NONE, |
839 | V4L2_MPEG_AUDIO_CRC_CRC16, 1, | 851 | V4L2_MPEG_AUDIO_CRC_CRC16, 1, |
840 | V4L2_MPEG_AUDIO_CRC_NONE); | 852 | V4L2_MPEG_AUDIO_CRC_NONE); |
853 | case V4L2_CID_MPEG_AUDIO_MUTE: | ||
854 | return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0); | ||
841 | case V4L2_CID_MPEG_VIDEO_ENCODING: | 855 | case V4L2_CID_MPEG_VIDEO_ENCODING: |
842 | return v4l2_ctrl_query_fill(qctrl, | 856 | return v4l2_ctrl_query_fill(qctrl, |
843 | V4L2_MPEG_VIDEO_ENCODING_MPEG_1, | 857 | V4L2_MPEG_VIDEO_ENCODING_MPEG_1, |
@@ -867,6 +881,10 @@ int v4l2_ctrl_query_fill_std(struct v4l2_queryctrl *qctrl) | |||
867 | return v4l2_ctrl_query_fill(qctrl, 0, 27000000, 1, 8000000); | 881 | return v4l2_ctrl_query_fill(qctrl, 0, 27000000, 1, 8000000); |
868 | case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: | 882 | case V4L2_CID_MPEG_VIDEO_TEMPORAL_DECIMATION: |
869 | return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0); | 883 | return v4l2_ctrl_query_fill(qctrl, 0, 255, 1, 0); |
884 | case V4L2_CID_MPEG_VIDEO_MUTE: | ||
885 | return v4l2_ctrl_query_fill(qctrl, 0, 1, 1, 0); | ||
886 | case V4L2_CID_MPEG_VIDEO_MUTE_YUV: /* Init YUV (really YCbCr) to black */ | ||
887 | return v4l2_ctrl_query_fill(qctrl, 0, 0xffffff, 1, 0x008080); | ||
870 | case V4L2_CID_MPEG_STREAM_TYPE: | 888 | case V4L2_CID_MPEG_STREAM_TYPE: |
871 | return v4l2_ctrl_query_fill(qctrl, | 889 | return v4l2_ctrl_query_fill(qctrl, |
872 | V4L2_MPEG_STREAM_TYPE_MPEG2_PS, | 890 | V4L2_MPEG_STREAM_TYPE_MPEG2_PS, |
@@ -965,6 +983,22 @@ int v4l2_chip_match_i2c_client(struct i2c_client *c, u32 match_type, u32 match_c | |||
965 | } | 983 | } |
966 | } | 984 | } |
967 | 985 | ||
986 | int v4l2_chip_ident_i2c_client(struct i2c_client *c, struct v4l2_chip_ident *chip, | ||
987 | u32 ident, u32 revision) | ||
988 | { | ||
989 | if (!v4l2_chip_match_i2c_client(c, chip->match_type, chip->match_chip)) | ||
990 | return 0; | ||
991 | if (chip->ident == V4L2_IDENT_NONE) { | ||
992 | chip->ident = ident; | ||
993 | chip->revision = revision; | ||
994 | } | ||
995 | else { | ||
996 | chip->ident = V4L2_IDENT_AMBIGUOUS; | ||
997 | chip->revision = 0; | ||
998 | } | ||
999 | return 0; | ||
1000 | } | ||
1001 | |||
968 | int v4l2_chip_match_host(u32 match_type, u32 match_chip) | 1002 | int v4l2_chip_match_host(u32 match_type, u32 match_chip) |
969 | { | 1003 | { |
970 | switch (match_type) { | 1004 | switch (match_type) { |
@@ -999,6 +1033,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_fill); | |||
999 | EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); | 1033 | EXPORT_SYMBOL(v4l2_ctrl_query_fill_std); |
1000 | 1034 | ||
1001 | EXPORT_SYMBOL(v4l2_chip_match_i2c_client); | 1035 | EXPORT_SYMBOL(v4l2_chip_match_i2c_client); |
1036 | EXPORT_SYMBOL(v4l2_chip_ident_i2c_client); | ||
1002 | EXPORT_SYMBOL(v4l2_chip_match_host); | 1037 | EXPORT_SYMBOL(v4l2_chip_match_host); |
1003 | 1038 | ||
1004 | /* | 1039 | /* |