diff options
-rw-r--r-- | drivers/media/video/tvp5150.c | 70 | ||||
-rw-r--r-- | include/media/v4l2-common.h | 3 |
2 files changed, 70 insertions, 3 deletions
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index df7f304416c9..20e63593e441 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c | |||
@@ -541,7 +541,7 @@ static struct i2c_vbi_ram_value vbi_ram_default[] = | |||
541 | 0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 } | 541 | 0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 } |
542 | }, | 542 | }, |
543 | {0x110, /* Wide Screen Signal, PAL/SECAM */ | 543 | {0x110, /* Wide Screen Signal, PAL/SECAM */ |
544 | {V4L2_SLICED_WSS_625,20,21,1}, | 544 | {V4L2_SLICED_WSS_625,23,23,1}, |
545 | { 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42, | 545 | { 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42, |
546 | 0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 } | 546 | 0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 } |
547 | }, | 547 | }, |
@@ -649,7 +649,7 @@ static int tvp5150_set_vbi(struct i2c_client *c, | |||
649 | 649 | ||
650 | if (std == V4L2_STD_ALL) { | 650 | if (std == V4L2_STD_ALL) { |
651 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); | 651 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); |
652 | return -EINVAL; | 652 | return 0; |
653 | } else if (std && V4L2_STD_625_50) { | 653 | } else if (std && V4L2_STD_625_50) { |
654 | /* Don't follow NTSC Line number convension */ | 654 | /* Don't follow NTSC Line number convension */ |
655 | line += 3; | 655 | line += 3; |
@@ -686,6 +686,37 @@ static int tvp5150_set_vbi(struct i2c_client *c, | |||
686 | return type; | 686 | return type; |
687 | } | 687 | } |
688 | 688 | ||
689 | static int tvp5150_get_vbi(struct i2c_client *c, | ||
690 | const struct i2c_vbi_ram_value *regs, int line) | ||
691 | { | ||
692 | struct tvp5150 *decoder = i2c_get_clientdata(c); | ||
693 | v4l2_std_id std=decoder->norm; | ||
694 | u8 reg; | ||
695 | int pos, type=0; | ||
696 | |||
697 | if (std == V4L2_STD_ALL) { | ||
698 | tvp5150_err("VBI can't be configured without knowing number of lines\n"); | ||
699 | return 0; | ||
700 | } else if (std && V4L2_STD_625_50) { | ||
701 | /* Don't follow NTSC Line number convension */ | ||
702 | line += 3; | ||
703 | } | ||
704 | |||
705 | if (line<6||line>27) | ||
706 | return 0; | ||
707 | |||
708 | reg=((line-6)<<1)+TVP5150_LINE_MODE_INI; | ||
709 | |||
710 | pos=tvp5150_read(c, reg)&0x0f; | ||
711 | if (pos<0x0f) | ||
712 | type=regs[pos].type.vbi_type; | ||
713 | |||
714 | pos=tvp5150_read(c, reg+1)&0x0f; | ||
715 | if (pos<0x0f) | ||
716 | type|=regs[pos].type.vbi_type; | ||
717 | |||
718 | return type; | ||
719 | } | ||
689 | static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std) | 720 | static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std) |
690 | { | 721 | { |
691 | struct tvp5150 *decoder = i2c_get_clientdata(c); | 722 | struct tvp5150 *decoder = i2c_get_clientdata(c); |
@@ -856,9 +887,43 @@ static int tvp5150_command(struct i2c_client *c, | |||
856 | vbi_ram_default, | 887 | vbi_ram_default, |
857 | svbi->service_lines[0][i],0xf0,i,3); | 888 | svbi->service_lines[0][i],0xf0,i,3); |
858 | } | 889 | } |
890 | /* Enables FIFO */ | ||
891 | tvp5150_write(c, TVP5150_FIFO_OUT_CTRL,1); | ||
892 | } else { | ||
893 | /* Disables FIFO*/ | ||
894 | tvp5150_write(c, TVP5150_FIFO_OUT_CTRL,0); | ||
895 | |||
896 | /* Disable Full Field */ | ||
897 | tvp5150_write(c, TVP5150_FULL_FIELD_ENA, 0); | ||
898 | |||
899 | /* Disable Line modes */ | ||
900 | for (i=TVP5150_LINE_MODE_INI; i<=TVP5150_LINE_MODE_END; i++) | ||
901 | tvp5150_write(c, i, 0xff); | ||
902 | } | ||
903 | break; | ||
904 | } | ||
905 | case VIDIOC_G_FMT: | ||
906 | { | ||
907 | struct v4l2_format *fmt; | ||
908 | struct v4l2_sliced_vbi_format *svbi; | ||
909 | |||
910 | int i, mask=0; | ||
911 | |||
912 | fmt = arg; | ||
913 | if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) | ||
914 | return -EINVAL; | ||
915 | svbi = &fmt->fmt.sliced; | ||
916 | memset(svbi, 0, sizeof(*svbi)); | ||
917 | |||
918 | for (i = 0; i <= 23; i++) { | ||
919 | svbi->service_lines[0][i]=tvp5150_get_vbi(c, | ||
920 | vbi_ram_default,i); | ||
921 | mask|=svbi->service_lines[0][i]; | ||
859 | } | 922 | } |
923 | svbi->service_set=mask; | ||
860 | break; | 924 | break; |
861 | } | 925 | } |
926 | |||
862 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 927 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
863 | case VIDIOC_INT_G_REGISTER: | 928 | case VIDIOC_INT_G_REGISTER: |
864 | { | 929 | { |
@@ -883,6 +948,7 @@ static int tvp5150_command(struct i2c_client *c, | |||
883 | } | 948 | } |
884 | #endif | 949 | #endif |
885 | 950 | ||
951 | case VIDIOC_LOG_STATUS: | ||
886 | case DECODER_DUMP: | 952 | case DECODER_DUMP: |
887 | dump_reg(c); | 953 | dump_reg(c); |
888 | break; | 954 | break; |
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index d4030a7e16e0..11728daf0096 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -160,7 +160,8 @@ struct msp_matrix { | |||
160 | 160 | ||
161 | /* Used to generate VBI signals on a video signal. v4l2_sliced_vbi_data is | 161 | /* Used to generate VBI signals on a video signal. v4l2_sliced_vbi_data is |
162 | filled with the data packets that should be output. Note that if you set | 162 | filled with the data packets that should be output. Note that if you set |
163 | the line field to 0, then that VBI signal is disabled. */ | 163 | the line field to 0, then that VBI signal is disabled. If no |
164 | valid VBI data was found, then the type field is set to 0 on return. */ | ||
164 | #define VIDIOC_INT_S_VBI_DATA _IOW ('d', 105, struct v4l2_sliced_vbi_data) | 165 | #define VIDIOC_INT_S_VBI_DATA _IOW ('d', 105, struct v4l2_sliced_vbi_data) |
165 | 166 | ||
166 | /* Used to obtain the sliced VBI packet from a readback register. Not all | 167 | /* Used to obtain the sliced VBI packet from a readback register. Not all |