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

V4L/DVB (8105): cx2341x: add TS capability

The cx18 can support transport streams with newer firmwares. Add a TS
capability to the generic cx2341x module.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>

authored by

Hans Verkuil and committed by
Mauro Carvalho Chehab
e0e31cdb 37f89f95

+35 -17
+3 -1
drivers/media/video/cx18/cx18-controls.c
··· 92 92 93 93 int cx18_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) 94 94 { 95 + struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; 95 96 struct v4l2_queryctrl qctrl; 96 97 97 98 qctrl.id = qmenu->id; 98 99 cx18_queryctrl(file, fh, &qctrl); 99 - return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); 100 + return v4l2_ctrl_query_menu(qmenu, &qctrl, 101 + cx2341x_ctrl_get_menu(&cx->params, qmenu->id)); 100 102 } 101 103 102 104 int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
+20 -9
drivers/media/video/cx2341x.c
··· 80 80 81 81 /* Map the control ID to the correct field in the cx2341x_mpeg_params 82 82 struct. Return -EINVAL if the ID is unknown, else return 0. */ 83 - static int cx2341x_get_ctrl(struct cx2341x_mpeg_params *params, 83 + static int cx2341x_get_ctrl(const struct cx2341x_mpeg_params *params, 84 84 struct v4l2_ext_control *ctrl) 85 85 { 86 86 switch (ctrl->id) { ··· 420 420 return 0; 421 421 } 422 422 423 - int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, 423 + int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, 424 424 struct v4l2_queryctrl *qctrl) 425 425 { 426 426 int err; ··· 580 580 } 581 581 EXPORT_SYMBOL(cx2341x_ctrl_query); 582 582 583 - const char **cx2341x_ctrl_get_menu(u32 id) 583 + const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id) 584 584 { 585 - static const char *mpeg_stream_type[] = { 585 + static const char *mpeg_stream_type_without_ts[] = { 586 586 "MPEG-2 Program Stream", 587 587 "", 588 + "MPEG-1 System Stream", 589 + "MPEG-2 DVD-compatible Stream", 590 + "MPEG-1 VCD-compatible Stream", 591 + "MPEG-2 SVCD-compatible Stream", 592 + NULL 593 + }; 594 + 595 + static const char *mpeg_stream_type_with_ts[] = { 596 + "MPEG-2 Program Stream", 597 + "MPEG-2 Transport Stream", 588 598 "MPEG-1 System Stream", 589 599 "MPEG-2 DVD-compatible Stream", 590 600 "MPEG-1 VCD-compatible Stream", ··· 640 630 641 631 switch (id) { 642 632 case V4L2_CID_MPEG_STREAM_TYPE: 643 - return mpeg_stream_type; 633 + return (p->capabilities & CX2341X_CAP_HAS_TS) ? 634 + mpeg_stream_type_with_ts : mpeg_stream_type_without_ts; 644 635 case V4L2_CID_MPEG_AUDIO_L1_BITRATE: 645 636 case V4L2_CID_MPEG_AUDIO_L3_BITRATE: 646 637 return NULL; ··· 701 690 if (err) 702 691 break; 703 692 if (qctrl.type == V4L2_CTRL_TYPE_MENU) 704 - menu_items = cx2341x_ctrl_get_menu(qctrl.id); 693 + menu_items = cx2341x_ctrl_get_menu(params, qctrl.id); 705 694 err = v4l2_ctrl_check(ctrl, &qctrl, menu_items); 706 695 if (err) 707 696 break; ··· 944 933 } 945 934 EXPORT_SYMBOL(cx2341x_update); 946 935 947 - static const char *cx2341x_menu_item(struct cx2341x_mpeg_params *p, u32 id) 936 + static const char *cx2341x_menu_item(const struct cx2341x_mpeg_params *p, u32 id) 948 937 { 949 - const char **menu = cx2341x_ctrl_get_menu(id); 938 + const char **menu = cx2341x_ctrl_get_menu(p, id); 950 939 struct v4l2_ext_control ctrl; 951 940 952 941 if (menu == NULL) ··· 963 952 return "<invalid>"; 964 953 } 965 954 966 - void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix) 955 + void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix) 967 956 { 968 957 int is_mpeg1 = p->video_encoding == V4L2_MPEG_VIDEO_ENCODING_MPEG_1; 969 958 int temporal = p->video_temporal_filter;
+1 -1
drivers/media/video/cx23885/cx23885-417.c
··· 1173 1173 qctrl.id = qmenu->id; 1174 1174 cx23885_queryctrl(dev, &qctrl); 1175 1175 return v4l2_ctrl_query_menu(qmenu, &qctrl, 1176 - cx2341x_ctrl_get_menu(qmenu->id)); 1176 + cx2341x_ctrl_get_menu(&dev->mpeg_params, qmenu->id)); 1177 1177 } 1178 1178 1179 1179 int cx23885_do_ioctl(struct inode *inode, struct file *file, int radio,
+2 -1
drivers/media/video/cx88/cx88-blackbird.c
··· 715 715 716 716 qctrl.id = qmenu->id; 717 717 blackbird_queryctrl(dev, &qctrl); 718 - return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); 718 + return v4l2_ctrl_query_menu(qmenu, &qctrl, 719 + cx2341x_ctrl_get_menu(&dev->params, qmenu->id)); 719 720 } 720 721 721 722 static int vidioc_querycap (struct file *file, void *priv,
+3 -1
drivers/media/video/ivtv/ivtv-controls.c
··· 89 89 90 90 int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) 91 91 { 92 + struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 92 93 struct v4l2_queryctrl qctrl; 93 94 94 95 qctrl.id = qmenu->id; 95 96 ivtv_queryctrl(file, fh, &qctrl); 96 - return v4l2_ctrl_query_menu(qmenu, &qctrl, cx2341x_ctrl_get_menu(qmenu->id)); 97 + return v4l2_ctrl_query_menu(qmenu, &qctrl, 98 + cx2341x_ctrl_get_menu(&itv->params, qmenu->id)); 97 99 } 98 100 99 101 int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
+2 -1
drivers/media/video/pvrusb2/pvrusb2-hdw.c
··· 2013 2013 case V4L2_CTRL_TYPE_MENU: 2014 2014 ciptr->type = pvr2_ctl_enum; 2015 2015 ciptr->def.type_enum.value_names = 2016 - cx2341x_ctrl_get_menu(ciptr->v4l_id); 2016 + cx2341x_ctrl_get_menu(&hdw->enc_ctl_state, 2017 + ciptr->v4l_id); 2017 2018 for (cnt1 = 0; 2018 2019 ciptr->def.type_enum.value_names[cnt1] != NULL; 2019 2020 cnt1++) { }
+4 -3
include/media/cx2341x.h
··· 27 27 28 28 enum cx2341x_cap { 29 29 CX2341X_CAP_HAS_SLICED_VBI = 1 << 0, 30 + CX2341X_CAP_HAS_TS = 1 << 1, 30 31 }; 31 32 32 33 struct cx2341x_mpeg_params { ··· 89 88 int cx2341x_update(void *priv, cx2341x_mbox_func func, 90 89 const struct cx2341x_mpeg_params *old, 91 90 const struct cx2341x_mpeg_params *new); 92 - int cx2341x_ctrl_query(struct cx2341x_mpeg_params *params, 91 + int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, 93 92 struct v4l2_queryctrl *qctrl); 94 - const char **cx2341x_ctrl_get_menu(u32 id); 93 + const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id); 95 94 int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, 96 95 struct v4l2_ext_controls *ctrls, unsigned int cmd); 97 96 void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); 98 - void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix); 97 + void cx2341x_log_status(const struct cx2341x_mpeg_params *p, const char *prefix); 99 98 100 99 /* Firmware names */ 101 100 #define CX2341X_FIRM_ENC_FILENAME "v4l-cx2341x-enc.fw"