diff options
author | Mauro Carvalho Chehab <devnull@localhost> | 2006-01-21 21:50:54 +0000 |
---|---|---|
committer | Mauro Carvalho Chehab <devnull@localhost> | 2006-01-21 21:50:54 +0000 |
commit | 55459439b108cceab0c36fcd1d5be65323ad595d (patch) | |
tree | d93bbdb62f40af2d1aa8f1f2345345fa7cb6c8d9 /linux/drivers/media/video/tvp5150.c | |
parent | b702770892b1af21633d0703914343bdfc4547c2 (diff) | |
download | mediapointer-dvb-s2-55459439b108cceab0c36fcd1d5be65323ad595d.tar.gz mediapointer-dvb-s2-55459439b108cceab0c36fcd1d5be65323ad595d.tar.bz2 |
Added iocls to configure VBI on tvp5150
From: Mauro Carvalho Chehab <mchehab@infradead.org>
- Added iocls to configure VBI on tvp5150
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'linux/drivers/media/video/tvp5150.c')
-rw-r--r-- | linux/drivers/media/video/tvp5150.c | 128 |
1 files changed, 126 insertions, 2 deletions
diff --git a/linux/drivers/media/video/tvp5150.c b/linux/drivers/media/video/tvp5150.c index 4e0fe9f52..701190ea9 100644 --- a/linux/drivers/media/video/tvp5150.c +++ b/linux/drivers/media/video/tvp5150.c @@ -572,7 +572,7 @@ static struct i2c_vbi_ram_value vbi_ram_default[] = 0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 } }, {0x110, /* Wide Screen Signal, PAL/SECAM */ - {V4L2_SLICED_WSS_625,20,21,1}, + {V4L2_SLICED_WSS_625,23,23,1}, { 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42, 0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 } }, @@ -687,7 +687,7 @@ static int tvp5150_set_vbi(struct i2c_client *c, if (std == V4L2_STD_ALL) { tvp5150_err("VBI can't be configured without knowing number of lines\n"); - return -EINVAL; + return 0; } else if (std && V4L2_STD_625_50) { /* Don't follow NTSC Line number convension */ line += 3; @@ -724,6 +724,48 @@ static int tvp5150_set_vbi(struct i2c_client *c, return type; } +static int tvp5150_get_vbi(struct i2c_client *c, + const struct i2c_vbi_ram_value *regs, int line) +{ + struct tvp5150 *decoder = i2c_get_clientdata(c); + v4l2_std_id std=decoder->norm; + u8 reg; + int pos, type=0; + + if (std == V4L2_STD_ALL) { + tvp5150_err("VBI can't be configured without knowing number of lines\n"); + return 0; + } else if (std && V4L2_STD_625_50) { + /* Don't follow NTSC Line number convension */ + line += 3; + } + + if (line<6||line>27) + return 0; + + reg=((line-6)<<1)+TVP5150_LINE_MODE_INI; + + pos=tvp5150_read(c, reg)&0x0f; + if (pos<0x0f) + type=regs[pos].type.vbi_type; + + pos=tvp5150_read(c, reg+1)&0x0f; + if (pos<0x0f) + type|=regs[pos].type.vbi_type; + + return type; +} +#if 0 +static int decode_vbi_data(struct i2c_client *c, vbi) +{ + count=tvp5150_read(c, TVP5150_FIFO_WORD_COUNT); + + for (i=0;i<count;i++) { + *p=tvp5150_read(c, TVP5150_VBI_FIFO_READ_DATA); + p++; + } +} +#endif static int tvp5150_set_std(struct i2c_client *c, v4l2_std_id std) { struct tvp5150 *decoder = i2c_get_clientdata(c); @@ -894,9 +936,90 @@ static int tvp5150_command(struct i2c_client *c, vbi_ram_default, svbi->service_lines[0][i],0xf0,i,3); } + /* Enables FIFO */ + tvp5150_write(c, TVP5150_FIFO_OUT_CTRL,1); + } else { + /* Disables FIFO*/ + tvp5150_write(c, TVP5150_FIFO_OUT_CTRL,0); + + /* Disable Full Field */ + tvp5150_write(c, TVP5150_FULL_FIELD_ENA, 0); + + /* Disable Line modes */ + for (i=TVP5150_LINE_MODE_INI; i<=TVP5150_LINE_MODE_END; i++) + tvp5150_write(c, i, 0xff); + } + break; + } + case VIDIOC_G_FMT: + { + struct v4l2_format *fmt; + struct v4l2_sliced_vbi_format *svbi; + + int i, mask=0; + + fmt = arg; + if (fmt->type != V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) + return -EINVAL; + svbi = &fmt->fmt.sliced; + memset(svbi, 0, sizeof(*svbi)); + + for (i = 0; i <= 23; i++) { + svbi->service_lines[0][i]=tvp5150_get_vbi(c, + vbi_ram_default,i); + mask|=svbi->service_lines[0][i]; } + svbi->service_set=mask; break; } +#if 0 + /* This will not work for USB devices */ + case VIDIOC_INT_G_VBI_DATA: + { + struct v4l2_sliced_vbi_data *data = arg; + u8 status; + + status=tvp5150_read(c, TVP5150_VDP_STATUS_REG); + + if (data->id & V4L2_SLICED_CAPTION) { + if (!field && (status&0x10)) { + data->data[0]=tvp5150_read(c, TVP5150_CC_DATA_INI); + data->data[1]=tvp5150_read(c, TVP5150_CC_DATA_INI+1); + } if (field && (status&0x8)) { + data->data[0]=tvp5150_read(c, TVP5150_CC_DATA_INI+2); + data->data[1]=tvp5150_read(c, TVP5150_CC_DATA_INI+3); + } else data->id=0; + return 0; + } else if (data->id & V4L2_SLICED_WSS) { + } else if (data->id & V4L2_SLICED_VPS) { + } + break; + } + case VIDIOC_INT_DECODE_VBI_LINE: + { + struct v4l2_decode_vbi_line *vbi = arg; + u8 status; + + status=tvp5150_read(c, TVP5150_VDP_STATUS_REG); + + if (status&0x80) { + tvp5150_err("Full field error"); + status&=0x7f; + tvp5150_write(c, TVP5150_VDP_STATUS_REG,status); + } + + /* FIFO */ + /* Current V4L2 API allows sliced VBI only with fifo mode, + since line and types are not provided on other means + on tvp5150. + */ + if (!(status&0x40)) /* Has FIFO data */ + decode_vbi_data(c,vbi); + + break; + } +#endif + #ifdef CONFIG_VIDEO_ADV_DEBUG case VIDIOC_INT_G_REGISTER: { @@ -921,6 +1044,7 @@ static int tvp5150_command(struct i2c_client *c, } #endif + case VIDIOC_LOG_STATUS: case DECODER_DUMP: dump_reg(c); break; |