Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

V4L/DVB (3408): Included new sliced VBI types to videodev2.h and tvp5150

- Added other sliced VBI types to videodev2.h
- tvp5150 now uses standard V4L2 API codes from videodev2.h
- Implemented VIDIOC_G_SLICED_VBI_CAP for tvp5150. This is
dynamically filled based on defined VDP C-RAM values filled
by the driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

authored by

Mauro Carvalho Chehab and committed by
Mauro Carvalho Chehab
6ac48b45 3ad96835

+162 -71
+3 -3
drivers/media/video/cx25840/cx25840-vbi.c
··· 151 151 case VIDIOC_G_FMT: 152 152 { 153 153 static u16 lcr2vbi[] = { 154 - 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ 154 + 0, V4L2_SLICED_TELETEXT_PAL_B, 0, /* 1 */ 155 155 0, V4L2_SLICED_WSS_625, 0, /* 4 */ 156 156 V4L2_SLICED_CAPTION_525, /* 6 */ 157 157 0, 0, V4L2_SLICED_VPS, 0, 0, /* 9 */ ··· 231 231 for (i = 7; i <= 23; i++) { 232 232 for (x = 0; x <= 1; x++) { 233 233 switch (svbi->service_lines[1-x][i]) { 234 - case V4L2_SLICED_TELETEXT_B: 234 + case V4L2_SLICED_TELETEXT_PAL_B: 235 235 lcr[i] |= 1 << (4 * x); 236 236 break; 237 237 case V4L2_SLICED_WSS_625: ··· 282 282 283 283 switch (id2) { 284 284 case 1: 285 - id2 = V4L2_SLICED_TELETEXT_B; 285 + id2 = V4L2_SLICED_TELETEXT_PAL_B; 286 286 break; 287 287 case 4: 288 288 id2 = V4L2_SLICED_WSS_625;
+3 -3
drivers/media/video/saa7115.c
··· 791 791 case 0: 792 792 lcr[i] |= 0xf << (4 * x); 793 793 break; 794 - case V4L2_SLICED_TELETEXT_B: 794 + case V4L2_SLICED_TELETEXT_PAL_B: 795 795 lcr[i] |= 1 << (4 * x); 796 796 break; 797 797 case V4L2_SLICED_CAPTION_525: ··· 820 820 static int saa7115_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) 821 821 { 822 822 static u16 lcr2vbi[] = { 823 - 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ 823 + 0, V4L2_SLICED_TELETEXT_PAL_B, 0, /* 1 */ 824 824 0, V4L2_SLICED_CAPTION_525, /* 4 */ 825 825 V4L2_SLICED_WSS_625, 0, /* 5 */ 826 826 V4L2_SLICED_VPS, 0, 0, 0, 0, /* 7 */ ··· 985 985 /* decode payloads */ 986 986 switch (id2) { 987 987 case 1: 988 - vbi->type = V4L2_SLICED_TELETEXT_B; 988 + vbi->type = V4L2_SLICED_TELETEXT_PAL_B; 989 989 break; 990 990 case 4: 991 991 if (!saa7115_odd_parity(p[0]) || !saa7115_odd_parity(p[1]))
+106 -59
drivers/media/video/tvp5150.c
··· 1 1 /* 2 - * tvp5150 - Texas Instruments TVP5150A(M) video decoder driver 2 + * tvp5150 - Texas Instruments TVP5150A/AM1 video decoder driver 3 3 * 4 - * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) 5 - * This code is placed under the terms of the GNU General Public License 4 + * Copyright (c) 2005,2006 Mauro Carvalho Chehab (mchehab@infradead.org) 5 + * This code is placed under the terms of the GNU General Public License v2 6 6 */ 7 7 8 8 #include <linux/i2c.h> ··· 13 13 14 14 #include "tvp5150_reg.h" 15 15 16 - MODULE_DESCRIPTION("Texas Instruments TVP5150A video decoder driver"); /* standard i2c insmod options */ 16 + MODULE_DESCRIPTION("Texas Instruments TVP5150A video decoder driver"); 17 17 MODULE_AUTHOR("Mauro Carvalho Chehab"); 18 18 MODULE_LICENSE("GPL"); 19 19 20 + /* standard i2c insmod options */ 20 21 static unsigned short normal_i2c[] = { 21 22 0xb8 >> 1, 22 23 0xba >> 1, ··· 478 477 } 479 478 }; 480 479 481 - struct i2c_vbi_ram_value { 482 - u16 reg; 483 - unsigned char values[26]; 480 + struct tvp5150_vbi_type { 481 + unsigned int vbi_type; 482 + unsigned int ini_line; 483 + unsigned int end_line; 484 + unsigned int by_field :1; 484 485 }; 485 486 486 - /* tvp5150_vbi_types should follow the same order as vbi_ram_default 487 + struct i2c_vbi_ram_value { 488 + u16 reg; 489 + struct tvp5150_vbi_type type; 490 + unsigned char values[16]; 491 + }; 492 + 493 + /* This struct have the values for each supported VBI Standard 494 + * by 495 + tvp5150_vbi_types should follow the same order as vbi_ram_default 487 496 * value 0 means rom position 0x10, value 1 means rom position 0x30 488 497 * and so on. There are 16 possible locations from 0 to 15. 489 498 */ 490 - enum tvp5150_vbi_types { /* Video line number Description */ 491 - VBI_WST_SECAM, /* 6-23 (field 1,2) Teletext, SECAM */ 492 - VBI_WST_PAL_B, /* 6-22 (field 1,2) Teletext, PAL, System B */ 493 - VBI_WST_PAL_C, /* 6-22 (field 1,2) Teletext, PAL, System C */ 494 - VBI_WST_NTSC_B, /* 10-21 (field 1,2) Teletext, NTSC, System B */ 495 - VBI_NABTS_NTSC_C, /* 10-21 (field 1,2) Teletext, NTSC, System C */ 496 - VBI_NABTS_NTSC_D, /* 10-21 (field 1,2) Teletext, NTSC, System D */ 497 - VBI_CC_PAL_SECAM, /* 22 (field 1,2) Closed Caption PAL/SECAM */ 498 - VBI_CC_NTSC, /* 21 (field 1,2) Closed Caption NTSC */ 499 - VBI_WSS_PAL_SECAM, /* 23 (field 1,2) Wide Screen Signal PAL/SECAM */ 500 - VBI_WSS_NTSC, /* 20 (field 1,2) Wide Screen Signal NTSC */ 501 - VBI_VITC_PAL_SECAM, /* 6-22 Vertical Interval Timecode PAL/SECAM */ 502 - VBI_VITC_NTSC, /* 10-20 Vertical Interval Timecode NTSC */ 503 - VBI_VPS_PAL, /* 16 Video Program System PAL */ 504 - VBI_EPG_GEMSTAR, /* EPG/Gemstar Electronic program guide */ 505 - VBI_RESERVED, /* not in use on vbi_ram_default table */ 506 - VBI_FULL_FIELD /* Active video/Full Field */ 507 - }; 508 499 509 500 static struct i2c_vbi_ram_value vbi_ram_default[] = 510 501 { 511 - {0x010, /* WST SECAM */ 512 - { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x26, 0xe6, 0xb4, 0x0e, 0x0, 0x0, 0x0, 0x10, 0x0 } 502 + {0x010, /* Teletext, SECAM, WST System A */ 503 + {V4L2_SLICED_TELETEXT_SECAM,6,23,1}, 504 + { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x26, 505 + 0xe6, 0xb4, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00 } 513 506 }, 514 - {0x030, /* WST PAL B */ 515 - { 0xaa, 0xaa, 0xff, 0xff , 0x27, 0x2e, 0x20, 0x2b, 0xa6, 0x72, 0x10, 0x0, 0x0, 0x0, 0x10, 0x0 } 507 + {0x030, /* Teletext, PAL, WST System B */ 508 + {V4L2_SLICED_TELETEXT_PAL_B,6,22,1}, 509 + { 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x2b, 510 + 0xa6, 0x72, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00 } 516 511 }, 517 - {0x050, /* WST PAL C */ 518 - { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x22, 0xa6, 0x98, 0x0d, 0x0, 0x0, 0x0, 0x10, 0x0 } 512 + {0x050, /* Teletext, PAL, WST System C */ 513 + {V4L2_SLICED_TELETEXT_PAL_C,6,22,1}, 514 + { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22, 515 + 0xa6, 0x98, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 } 519 516 }, 520 - {0x070, /* WST NTSC B */ 521 - { 0xaa, 0xaa, 0xff, 0xff , 0x27, 0x2e, 0x20, 0x23, 0x69, 0x93, 0x0d, 0x0, 0x0, 0x0, 0x10, 0x0 } 517 + {0x070, /* Teletext, NTSC, WST System B */ 518 + {V4L2_SLICED_TELETEXT_NTSC_B,10,21,1}, 519 + { 0xaa, 0xaa, 0xff, 0xff, 0x27, 0x2e, 0x20, 0x23, 520 + 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 } 522 521 }, 523 - {0x090, /* NABTS, NTSC */ 524 - { 0xaa, 0xaa, 0xff, 0xff , 0xe7, 0x2e, 0x20, 0x22, 0x69, 0x93, 0x0d, 0x0, 0x0, 0x0, 0x15, 0x0 } 522 + {0x090, /* Tetetext, NTSC NABTS System C */ 523 + {V4L2_SLICED_TELETEXT_NTSC_C,10,21,1}, 524 + { 0xaa, 0xaa, 0xff, 0xff, 0xe7, 0x2e, 0x20, 0x22, 525 + 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x15, 0x00 } 525 526 }, 526 - {0x0b0, /* NABTS, NTSC-J */ 527 - { 0xaa, 0xaa, 0xff, 0xff , 0xa7, 0x2e, 0x20, 0x23, 0x69, 0x93, 0x0d, 0x0, 0x0, 0x0, 0x10, 0x0 } 527 + {0x0b0, /* Teletext, NTSC-J, NABTS System D */ 528 + {V4L2_SLICED_TELETEXT_NTSC_D,10,21,1}, 529 + { 0xaa, 0xaa, 0xff, 0xff, 0xa7, 0x2e, 0x20, 0x23, 530 + 0x69, 0x93, 0x0d, 0x00, 0x00, 0x00, 0x10, 0x00 } 528 531 }, 529 - {0x0d0, /* CC, PAL/SECAM */ 530 - { 0xaa, 0x2a, 0xff, 0x3f , 0x04, 0x51, 0x6e, 0x02, 0xa6, 0x7b, 0x09, 0x0, 0x0, 0x0, 0x27, 0x0 } 532 + {0x0d0, /* Closed Caption, PAL/SECAM */ 533 + {V4L2_SLICED_CAPTION_625,22,22,1}, 534 + { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02, 535 + 0xa6, 0x7b, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 } 531 536 }, 532 - {0x0f0, /* CC, NTSC */ 533 - { 0xaa, 0x2a, 0xff, 0x3f , 0x04, 0x51, 0x6e, 0x02, 0x69, 0x8c, 0x09, 0x0, 0x0, 0x0, 0x27, 0x0 } 537 + {0x0f0, /* Closed Caption, NTSC */ 538 + {V4L2_SLICED_CAPTION_525,21,21,1}, 539 + { 0xaa, 0x2a, 0xff, 0x3f, 0x04, 0x51, 0x6e, 0x02, 540 + 0x69, 0x8c, 0x09, 0x00, 0x00, 0x00, 0x27, 0x00 } 534 541 }, 535 - {0x110, /* WSS, PAL/SECAM */ 536 - { 0x5b, 0x55, 0xc5, 0xff , 0x0, 0x71, 0x6e, 0x42, 0xa6, 0xcd, 0x0f, 0x0, 0x0, 0x0, 0x3a, 0x0 } 542 + {0x110, /* Wide Screen Signal, PAL/SECAM */ 543 + {V4L2_SLICED_WSS_625,20,21,1}, 544 + { 0x5b, 0x55, 0xc5, 0xff, 0x00, 0x71, 0x6e, 0x42, 545 + 0xa6, 0xcd, 0x0f, 0x00, 0x00, 0x00, 0x3a, 0x00 } 537 546 }, 538 - {0x130, /* WSS, NTSC C */ 539 - { 0x38, 0x00, 0x3f, 0x00 , 0x0, 0x71, 0x6e, 0x43, 0x69, 0x7c, 0x08, 0x0, 0x0, 0x0, 0x39, 0x0 } 547 + {0x130, /* Wide Screen Signal, NTSC C */ 548 + {V4L2_SLICED_WSS_525,20,20,1}, 549 + { 0x38, 0x00, 0x3f, 0x00, 0x00, 0x71, 0x6e, 0x43, 550 + 0x69, 0x7c, 0x08, 0x00, 0x00, 0x00, 0x39, 0x00 } 540 551 }, 541 - {0x150, /* VITC, PAL/SECAM */ 542 - { 0x0, 0x0, 0x0, 0x0 , 0x0, 0x8f, 0x6d, 0x49, 0xa6, 0x85, 0x08, 0x0, 0x0, 0x0, 0x4c, 0x0 } 552 + {0x150, /* Vertical Interval Timecode (VITC), PAL/SECAM */ 553 + {V4l2_SLICED_VITC_625,6,22,0}, 554 + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49, 555 + 0xa6, 0x85, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 } 543 556 }, 544 - {0x170, /* VITC, NTSC */ 545 - { 0x0, 0x0, 0x0, 0x0 , 0x0, 0x8f, 0x6d, 0x49, 0x69, 0x94, 0x08, 0x0, 0x0, 0x0, 0x4c, 0x0 } 557 + {0x170, /* Vertical Interval Timecode (VITC), NTSC */ 558 + {V4l2_SLICED_VITC_525,10,20,0}, 559 + { 0x00, 0x00, 0x00, 0x00, 0x00, 0x8f, 0x6d, 0x49, 560 + 0x69, 0x94, 0x08, 0x00, 0x00, 0x00, 0x4c, 0x00 } 546 561 }, 547 - {0x190, /* VPS, PAL */ 548 - { 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d, 0xa6, 0xda, 0x0b, 0x0, 0x0, 0x0, 0x60, 0x0 } 562 + {0x190, /* Video Program System (VPS), PAL */ 563 + {V4L2_SLICED_VPS,16,16,0}, 564 + { 0xaa, 0xaa, 0xff, 0xff, 0xba, 0xce, 0x2b, 0x0d, 565 + 0xa6, 0xda, 0x0b, 0x00, 0x00, 0x00, 0x60, 0x00 } 549 566 }, 550 - {0x1b0, /* Gemstar Custom 1 */ 551 - { 0xcc, 0xcc, 0xff, 0xff, 0x05, 0x51, 0x6e, 0x05, 0x69, 0x19, 0x13, 0x0, 0x0, 0x0, 0x60, 0x0 } 552 - }, 567 + /* 0x1d0 User programmable */ 568 + 569 + /* End of struct */ 570 + { (u16)-1 } 553 571 }; 554 572 555 573 static int tvp5150_write_inittab(struct i2c_client *c, 556 - const struct i2c_reg_value *regs) 574 + const struct i2c_reg_value *regs) 557 575 { 558 576 while (regs->reg != 0xff) { 559 577 tvp5150_write(c, regs->reg, regs->value); ··· 582 562 } 583 563 584 564 static int tvp5150_vdp_init(struct i2c_client *c, 585 - const struct i2c_vbi_ram_value *regs) 565 + const struct i2c_vbi_ram_value *regs) 586 566 { 587 567 unsigned int i; 588 568 ··· 606 586 return 0; 607 587 } 608 588 589 + /* Fills VBI capabilities based on i2c_vbi_ram_value struct */ 590 + static void tvp5150_vbi_get_cap(const struct i2c_vbi_ram_value *regs, 591 + struct v4l2_sliced_vbi_cap *cap) 592 + { 593 + int line; 594 + 595 + memset(cap, 0, sizeof *cap); 596 + 597 + while (regs->reg != (u16)-1 ) { 598 + for (line=regs->type.ini_line;line<=regs->type.end_line;line++) { 599 + cap->service_lines[0][line] |= regs->type.vbi_type; 600 + } 601 + cap->service_set |= regs->type.vbi_type; 602 + 603 + regs++; 604 + } 605 + } 606 + 609 607 /* Set vbi processing 610 608 * type - one of tvp5150_vbi_types 611 609 * line - line to gather data ··· 637 599 * LSB = field1 638 600 * MSB = field2 639 601 */ 640 - static int tvp5150_set_vbi(struct i2c_client *c, enum tvp5150_vbi_types type, 602 + static int tvp5150_set_vbi(struct i2c_client *c, unsigned int type, 641 603 u8 flags, int line, const int fields) 642 604 { 643 605 struct tvp5150 *decoder = i2c_get_clientdata(c); ··· 812 774 case VIDIOC_G_STD: 813 775 *(v4l2_std_id *)arg = decoder->norm; 814 776 break; 777 + 778 + case VIDIOC_G_SLICED_VBI_CAP: 779 + { 780 + struct v4l2_sliced_vbi_cap *cap = arg; 781 + tvp5150_dbg(1, "VIDIOC_G_SLICED_VBI_CAP\n"); 782 + 783 + tvp5150_vbi_get_cap(vbi_ram_default, cap); 784 + break; 785 + } 815 786 816 787 #ifdef CONFIG_VIDEO_ADV_DEBUG 817 788 case VIDIOC_INT_G_REGISTER: ··· 1068 1021 return rv; 1069 1022 } 1070 1023 1071 - if (debug > 1) 1024 + // if (debug > 1) 1072 1025 dump_reg(c); 1073 1026 return 0; 1074 1027 }
+7
drivers/media/video/tvp5150_reg.h
··· 1 + /* 2 + * tvp5150 - Texas Instruments TVP5150A/AM1 video decoder registers 3 + * 4 + * Copyright (c) 2005,2006 Mauro Carvalho Chehab (mchehab@infradead.org) 5 + * This code is placed under the terms of the GNU General Public License v2 6 + */ 7 + 1 8 #define TVP5150_VD_IN_SRC_SEL_1 0x00 /* Video input source selection #1 */ 2 9 #define TVP5150_ANAL_CHL_CTL 0x01 /* Analog channel controls */ 3 10 #define TVP5150_OP_MODE_CTL 0x02 /* Operation mode controls */
+43 -6
include/linux/videodev2.h
··· 949 949 __u32 reserved[2]; /* must be zero */ 950 950 }; 951 951 952 - #define V4L2_SLICED_TELETEXT_B (0x0001) 953 - #define V4L2_SLICED_VPS (0x0400) 954 - #define V4L2_SLICED_CAPTION_525 (0x1000) 955 - #define V4L2_SLICED_WSS_625 (0x4000) 952 + /* Teletext WST, defined on ITU-R BT.653-2 */ 953 + #define V4L2_SLICED_TELETEXT_PAL_B (0x000001) 954 + #define V4L2_SLICED_TELETEXT_PAL_C (0x000002) 955 + #define V4L2_SLICED_TELETEXT_NTSC_B (0x000010) 956 + #define V4L2_SLICED_TELETEXT_SECAM (0x000020) 956 957 957 - #define V4L2_SLICED_VBI_525 (V4L2_SLICED_CAPTION_525) 958 - #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_B | V4L2_SLICED_VPS | V4L2_SLICED_WSS_625) 958 + /* Teletext NABTS, defined on ITU-R BT.653-2 */ 959 + #define V4L2_SLICED_TELETEXT_NTSC_C (0x000040) 960 + #define V4L2_SLICED_TELETEXT_NTSC_D (0x000080) 961 + 962 + /* Video Program System, defined on ETS 300 231*/ 963 + #define V4L2_SLICED_VPS (0x000400) 964 + 965 + /* Closed Caption, defined on EIA-608 */ 966 + #define V4L2_SLICED_CAPTION_525 (0x001000) 967 + #define V4L2_SLICED_CAPTION_625 (0x002000) 968 + 969 + /* Wide Screen System, defined on ITU-R BT1119.1 */ 970 + #define V4L2_SLICED_WSS_625 (0x004000) 971 + 972 + /* Wide Screen System, defined on IEC 61880 */ 973 + #define V4L2_SLICED_WSS_525 (0x008000) 974 + 975 + /* Vertical Interval Timecode (VITC), defined on SMPTE 12M */ 976 + #define V4l2_SLICED_VITC_625 (0x010000) 977 + #define V4l2_SLICED_VITC_525 (0x020000) 978 + 979 + /* Compat macro - Should be removed for 2.6.18 */ 980 + #define V4L2_SLICED_TELETEXT_B V4L2_SLICED_TELETEXT_PAL_B 981 + 982 + #define V4L2_SLICED_VBI_525 (V4L2_SLICED_TELETEXT_NTSC_B |\ 983 + V4L2_SLICED_TELETEXT_NTSC_C |\ 984 + V4L2_SLICED_TELETEXT_NTSC_D |\ 985 + V4L2_SLICED_CAPTION_525 |\ 986 + V4L2_SLICED_WSS_525 |\ 987 + V4l2_SLICED_VITC_525) 988 + 989 + #define V4L2_SLICED_VBI_625 (V4L2_SLICED_TELETEXT_PAL_B |\ 990 + V4L2_SLICED_TELETEXT_PAL_C |\ 991 + V4L2_SLICED_TELETEXT_SECAM |\ 992 + V4L2_SLICED_VPS |\ 993 + V4L2_SLICED_CAPTION_625 |\ 994 + V4L2_SLICED_WSS_625 |\ 995 + V4l2_SLICED_VITC_625) 959 996 960 997 struct v4l2_sliced_vbi_cap 961 998 {