aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tvp5150.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@infradead.org>2006-01-23 14:11:06 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-23 14:11:06 -0500
commit2701dacb5ae5e7ecab4131605bdbcedd92bbaf82 (patch)
tree7b4afaa7734005b77bdc9b2be93dff341ee65e2b /drivers/media/video/tvp5150.c
parent10b7a903072eb066b17cc9049d6ea55dd044f4c3 (diff)
V4L/DVB (3410): Implemented sliced VBI set on VIDIOC_S_FMT
- Implemented sliced VBI set on VIDIOC_S_FMT Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/tvp5150.c')
-rw-r--r--drivers/media/video/tvp5150.c47
1 files changed, 42 insertions, 5 deletions
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index 17a8dd726912..df7f304416c9 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -637,12 +637,15 @@ static void tvp5150_vbi_get_cap(const struct i2c_vbi_ram_value *regs,
637 * LSB = field1 637 * LSB = field1
638 * MSB = field2 638 * MSB = field2
639 */ 639 */
640static int tvp5150_set_vbi(struct i2c_client *c, unsigned int type, 640static int tvp5150_set_vbi(struct i2c_client *c,
641 u8 flags, int line, const int fields) 641 const struct i2c_vbi_ram_value *regs,
642 unsigned int type,u8 flags, int line,
643 const int fields)
642{ 644{
643 struct tvp5150 *decoder = i2c_get_clientdata(c); 645 struct tvp5150 *decoder = i2c_get_clientdata(c);
644 v4l2_std_id std=decoder->norm; 646 v4l2_std_id std=decoder->norm;
645 u8 reg; 647 u8 reg;
648 int pos=0;
646 649
647 if (std == V4L2_STD_ALL) { 650 if (std == V4L2_STD_ALL) {
648 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");
@@ -653,9 +656,23 @@ static int tvp5150_set_vbi(struct i2c_client *c, unsigned int type,
653 } 656 }
654 657
655 if (line<6||line>27) 658 if (line<6||line>27)
656 return -EINVAL; 659 return 0;
657 660
658 type=type | (flags & 0xf0); 661 while (regs->reg != (u16)-1 ) {
662 if ((type & regs->type.vbi_type) &&
663 (line>=regs->type.ini_line) &&
664 (line<=regs->type.end_line)) {
665 type=regs->type.vbi_type;
666 break;
667 }
668
669 regs++;
670 pos++;
671 }
672 if (regs->reg == (u16)-1)
673 return 0;
674
675 type=pos | (flags & 0xf0);
659 reg=((line-6)<<1)+TVP5150_LINE_MODE_INI; 676 reg=((line-6)<<1)+TVP5150_LINE_MODE_INI;
660 677
661 if (fields&1) { 678 if (fields&1) {
@@ -666,7 +683,7 @@ static int tvp5150_set_vbi(struct i2c_client *c, unsigned int type,
666 tvp5150_write(c, reg+1, type); 683 tvp5150_write(c, reg+1, type);
667 } 684 }
668 685
669 return 0; 686 return type;
670} 687}
671 688
672static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std) 689static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std)
@@ -821,7 +838,27 @@ static int tvp5150_command(struct i2c_client *c,
821 tvp5150_vbi_get_cap(vbi_ram_default, cap); 838 tvp5150_vbi_get_cap(vbi_ram_default, cap);
822 break; 839 break;
823 } 840 }
841 case VIDIOC_S_FMT:
842 {
843 struct v4l2_format *fmt;
844 struct v4l2_sliced_vbi_format *svbi;
845 int i;
824 846
847 fmt = arg;
848 if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE)
849 return -EINVAL;
850 svbi = &fmt->fmt.sliced;
851 if (svbi->service_set != 0) {
852 for (i = 0; i <= 23; i++) {
853 svbi->service_lines[1][i] = 0;
854
855 svbi->service_lines[0][i]=tvp5150_set_vbi(c,
856 vbi_ram_default,
857 svbi->service_lines[0][i],0xf0,i,3);
858 }
859 }
860 break;
861 }
825#ifdef CONFIG_VIDEO_ADV_DEBUG 862#ifdef CONFIG_VIDEO_ADV_DEBUG
826 case VIDIOC_INT_G_REGISTER: 863 case VIDIOC_INT_G_REGISTER:
827 { 864 {