New IOCTL ops: vidioc_enum_fmt_sdr_out vidioc_g_fmt_sdr_out vidioc_s_fmt_sdr_out vidioc_try_fmt_sdr_out New vb2 buffertype: V4L2_BUF_TYPE_SDR_OUTPUT New v4l2 capability: V4L2_CAP_SDR_OUTPUT
Unified · Split
| @@ -214,6 +214,7 @@ static int __get_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __us · 213 unmodified lines | ||
| 214 | 214 | case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: |
| 215 | 215 | return get_v4l2_sliced_vbi_format(&kp->fmt.sliced, &up->fmt.sliced); |
| 216 | 216 | case V4L2_BUF_TYPE_SDR_CAPTURE: |
| 217 | + case V4L2_BUF_TYPE_SDR_OUTPUT: | |
| 217 | 218 | return get_v4l2_sdr_format(&kp->fmt.sdr, &up->fmt.sdr); |
| 218 | 219 | default: |
| 219 | 220 | pr_info("compat_ioctl32: unexpected VIDIOC_FMT type %d\n", |
| @@ -260,6 +261,7 @@ static int __put_v4l2_format32(struct v4l2_format *kp, struct v4l2_format32 __us · 40 unmodified lines | ||
| 260 | 261 | case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: |
| 261 | 262 | return put_v4l2_sliced_vbi_format(&kp->fmt.sliced, &up->fmt.sliced); |
| 262 | 263 | case V4L2_BUF_TYPE_SDR_CAPTURE: |
| 264 | + case V4L2_BUF_TYPE_SDR_OUTPUT: | |
| 263 | 265 | return put_v4l2_sdr_format(&kp->fmt.sdr, &up->fmt.sdr); |
| 264 | 266 | default: |
| 265 | 267 | pr_info("compat_ioctl32: unexpected VIDIOC_FMT type %d\n", |
| @@ -637,8 +637,8 @@ static void determine_valid_ioctls(struct video_device *vdev) · 636 unmodified lines | ||
| 637 | 637 | ops->vidioc_try_fmt_sliced_vbi_out))) |
| 638 | 638 | set_bit(_IOC_NR(VIDIOC_TRY_FMT), valid_ioctls); |
| 639 | 639 | SET_VALID_IOCTL(ops, VIDIOC_G_SLICED_VBI_CAP, vidioc_g_sliced_vbi_cap); |
| 640 | − } else if (is_sdr) { | |
| 641 | − /* SDR specific ioctls */ | |
| 640 | + } else if (is_sdr && is_rx) { | |
| 641 | + /* SDR receiver specific ioctls */ | |
| 642 | 642 | if (ops->vidioc_enum_fmt_sdr_cap) |
| 643 | 643 | set_bit(_IOC_NR(VIDIOC_ENUM_FMT), valid_ioctls); |
| 644 | 644 | if (ops->vidioc_g_fmt_sdr_cap) |
| @@ -647,6 +647,16 @@ static void determine_valid_ioctls(struct video_device *vdev) · 2 unmodified lines | ||
| 647 | 647 | set_bit(_IOC_NR(VIDIOC_S_FMT), valid_ioctls); |
| 648 | 648 | if (ops->vidioc_try_fmt_sdr_cap) |
| 649 | 649 | set_bit(_IOC_NR(VIDIOC_TRY_FMT), valid_ioctls); |
| 650 | + } else if (is_sdr && is_tx) { | |
| 651 | + /* SDR transmitter specific ioctls */ | |
| 652 | + if (ops->vidioc_enum_fmt_sdr_out) | |
| 653 | + set_bit(_IOC_NR(VIDIOC_ENUM_FMT), valid_ioctls); | |
| 654 | + if (ops->vidioc_g_fmt_sdr_out) | |
| 655 | + set_bit(_IOC_NR(VIDIOC_G_FMT), valid_ioctls); | |
| 656 | + if (ops->vidioc_s_fmt_sdr_out) | |
| 657 | + set_bit(_IOC_NR(VIDIOC_S_FMT), valid_ioctls); | |
| 658 | + if (ops->vidioc_try_fmt_sdr_out) | |
| 659 | + set_bit(_IOC_NR(VIDIOC_TRY_FMT), valid_ioctls); | |
| 650 | 660 | } |
| 651 | 661 | |
| 652 | 662 | if (is_vid || is_vbi || is_sdr) { |
| @@ -153,6 +153,7 @@ const char *v4l2_type_names[] = { · 152 unmodified lines | ||
| 153 | 153 | [V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE] = "vid-cap-mplane", |
| 154 | 154 | [V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE] = "vid-out-mplane", |
| 155 | 155 | [V4L2_BUF_TYPE_SDR_CAPTURE] = "sdr-cap", |
| 156 | + [V4L2_BUF_TYPE_SDR_OUTPUT] = "sdr-out", | |
| 156 | 157 | }; |
| 157 | 158 | EXPORT_SYMBOL(v4l2_type_names); |
| 158 | 159 | |
| @@ -326,6 +327,7 @@ static void v4l_print_format(const void *arg, bool write_only) · 167 unmodified lines | ||
| 326 | 327 | sliced->service_lines[1][i]); |
| 327 | 328 | break; |
| 328 | 329 | case V4L2_BUF_TYPE_SDR_CAPTURE: |
| 330 | + case V4L2_BUF_TYPE_SDR_OUTPUT: | |
| 329 | 331 | sdr = &p->fmt.sdr; |
| 330 | 332 | pr_cont(", pixelformat=%c%c%c%c\n", |
| 331 | 333 | (sdr->pixelformat >> 0) & 0xff, |
| @@ -974,6 +976,10 @@ static int check_fmt(struct file *file, enum v4l2_buf_type type) · 642 unmodified lines | ||
| 974 | 976 | if (is_sdr && is_rx && ops->vidioc_g_fmt_sdr_cap) |
| 975 | 977 | return 0; |
| 976 | 978 | break; |
| 979 | + case V4L2_BUF_TYPE_SDR_OUTPUT: | |
| 980 | + if (is_sdr && is_tx && ops->vidioc_g_fmt_sdr_out) | |
| 981 | + return 0; | |
| 982 | + break; | |
| 977 | 983 | default: |
| 978 | 984 | break; |
| 979 | 985 | } |
| @@ -1324,6 +1330,11 @@ static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops, · 344 unmodified lines | ||
| 1324 | 1330 | break; |
| 1325 | 1331 | ret = ops->vidioc_enum_fmt_sdr_cap(file, fh, arg); |
| 1326 | 1332 | break; |
| 1333 | + case V4L2_BUF_TYPE_SDR_OUTPUT: | |
| 1334 | + if (unlikely(!is_tx || !is_sdr || !ops->vidioc_enum_fmt_sdr_out)) | |
| 1335 | + break; | |
| 1336 | + ret = ops->vidioc_enum_fmt_sdr_out(file, fh, arg); | |
| 1337 | + break; | |
| 1327 | 1338 | } |
| 1328 | 1339 | if (ret == 0) |
| 1329 | 1340 | v4l_fill_fmtdesc(p); |
| @@ -1418,6 +1429,10 @@ static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops, · 88 unmodified lines | ||
| 1418 | 1429 | if (unlikely(!is_rx || !is_sdr || !ops->vidioc_g_fmt_sdr_cap)) |
| 1419 | 1430 | break; |
| 1420 | 1431 | return ops->vidioc_g_fmt_sdr_cap(file, fh, arg); |
| 1432 | + case V4L2_BUF_TYPE_SDR_OUTPUT: | |
| 1433 | + if (unlikely(!is_tx || !is_sdr || !ops->vidioc_g_fmt_sdr_out)) | |
| 1434 | + break; | |
| 1435 | + return ops->vidioc_g_fmt_sdr_out(file, fh, arg); | |
| 1421 | 1436 | } |
| 1422 | 1437 | return -EINVAL; |
| 1423 | 1438 | } |
| @@ -1497,6 +1512,11 @@ static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops, · 73 unmodified lines | ||
| 1497 | 1512 | break; |
| 1498 | 1513 | CLEAR_AFTER_FIELD(p, fmt.sdr); |
| 1499 | 1514 | return ops->vidioc_s_fmt_sdr_cap(file, fh, arg); |
| 1515 | + case V4L2_BUF_TYPE_SDR_OUTPUT: | |
| 1516 | + if (unlikely(!is_tx || !is_sdr || !ops->vidioc_s_fmt_sdr_out)) | |
| 1517 | + break; | |
| 1518 | + CLEAR_AFTER_FIELD(p, fmt.sdr); | |
| 1519 | + return ops->vidioc_s_fmt_sdr_out(file, fh, arg); | |
| 1500 | 1520 | } |
| 1501 | 1521 | return -EINVAL; |
| 1502 | 1522 | } |
| @@ -1576,6 +1596,11 @@ static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops, · 73 unmodified lines | ||
| 1576 | 1596 | break; |
| 1577 | 1597 | CLEAR_AFTER_FIELD(p, fmt.sdr); |
| 1578 | 1598 | return ops->vidioc_try_fmt_sdr_cap(file, fh, arg); |
| 1599 | + case V4L2_BUF_TYPE_SDR_OUTPUT: | |
| 1600 | + if (unlikely(!is_tx || !is_sdr || !ops->vidioc_try_fmt_sdr_out)) | |
| 1601 | + break; | |
| 1602 | + CLEAR_AFTER_FIELD(p, fmt.sdr); | |
| 1603 | + return ops->vidioc_try_fmt_sdr_out(file, fh, arg); | |
| 1579 | 1604 | } |
| 1580 | 1605 | return -EINVAL; |
| 1581 | 1606 | } |
| @@ -576,7 +576,8 @@ int videobuf_qbuf(struct videobuf_queue *q, struct v4l2_buffer *b) · 575 unmodified lines | ||
| 576 | 576 | } |
| 577 | 577 | if (q->type == V4L2_BUF_TYPE_VIDEO_OUTPUT |
| 578 | 578 | || q->type == V4L2_BUF_TYPE_VBI_OUTPUT |
| 579 | − || q->type == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) { | |
| 579 | + || q->type == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT | |
| 580 | + || q->type == V4L2_BUF_TYPE_SDR_OUTPUT) { | |
| 580 | 581 | buf->size = b->bytesused; |
| 581 | 582 | buf->field = b->field; |
| 582 | 583 | buf->ts = b->timestamp; |
| @@ -1154,6 +1155,7 @@ unsigned int videobuf_poll_stream(struct file *file, · 571 unmodified lines | ||
| 1154 | 1155 | case V4L2_BUF_TYPE_VIDEO_OUTPUT: |
| 1155 | 1156 | case V4L2_BUF_TYPE_VBI_OUTPUT: |
| 1156 | 1157 | case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT: |
| 1158 | + case V4L2_BUF_TYPE_SDR_OUTPUT: | |
| 1157 | 1159 | rc = POLLOUT | POLLWRNORM; |
| 1158 | 1160 | break; |
| 1159 | 1161 | default: |
| @@ -36,6 +36,8 @@ struct v4l2_ioctl_ops { · 35 unmodified lines | ||
| 36 | 36 | struct v4l2_fmtdesc *f); |
| 37 | 37 | int (*vidioc_enum_fmt_sdr_cap) (struct file *file, void *fh, |
| 38 | 38 | struct v4l2_fmtdesc *f); |
| 39 | + int (*vidioc_enum_fmt_sdr_out) (struct file *file, void *fh, | |
| 40 | + struct v4l2_fmtdesc *f); | |
| 39 | 41 | |
| 40 | 42 | /* VIDIOC_G_FMT handlers */ |
| 41 | 43 | int (*vidioc_g_fmt_vid_cap) (struct file *file, void *fh, |
| @@ -60,6 +62,8 @@ struct v4l2_ioctl_ops { · 18 unmodified lines | ||
| 60 | 62 | struct v4l2_format *f); |
| 61 | 63 | int (*vidioc_g_fmt_sdr_cap) (struct file *file, void *fh, |
| 62 | 64 | struct v4l2_format *f); |
| 65 | + int (*vidioc_g_fmt_sdr_out) (struct file *file, void *fh, | |
| 66 | + struct v4l2_format *f); | |
| 63 | 67 | |
| 64 | 68 | /* VIDIOC_S_FMT handlers */ |
| 65 | 69 | int (*vidioc_s_fmt_vid_cap) (struct file *file, void *fh, |
| @@ -84,6 +88,8 @@ struct v4l2_ioctl_ops { · 18 unmodified lines | ||
| 84 | 88 | struct v4l2_format *f); |
| 85 | 89 | int (*vidioc_s_fmt_sdr_cap) (struct file *file, void *fh, |
| 86 | 90 | struct v4l2_format *f); |
| 91 | + int (*vidioc_s_fmt_sdr_out) (struct file *file, void *fh, | |
| 92 | + struct v4l2_format *f); | |
| 87 | 93 | |
| 88 | 94 | /* VIDIOC_TRY_FMT handlers */ |
| 89 | 95 | int (*vidioc_try_fmt_vid_cap) (struct file *file, void *fh, |
| @@ -108,6 +114,8 @@ struct v4l2_ioctl_ops { · 18 unmodified lines | ||
| 108 | 114 | struct v4l2_format *f); |
| 109 | 115 | int (*vidioc_try_fmt_sdr_cap) (struct file *file, void *fh, |
| 110 | 116 | struct v4l2_format *f); |
| 117 | + int (*vidioc_try_fmt_sdr_out) (struct file *file, void *fh, | |
| 118 | + struct v4l2_format *f); | |
| 111 | 119 | |
| 112 | 120 | /* Buffer handlers */ |
| 113 | 121 | int (*vidioc_reqbufs) (struct file *file, void *fh, struct v4l2_requestbuffers *b); |
| @@ -28,6 +28,7 @@ · 27 unmodified lines | ||
| 28 | 28 | EM( V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE, "VIDEO_CAPTURE_MPLANE" ) \ |
| 29 | 29 | EM( V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE, "VIDEO_OUTPUT_MPLANE" ) \ |
| 30 | 30 | EM( V4L2_BUF_TYPE_SDR_CAPTURE, "SDR_CAPTURE" ) \ |
| 31 | + EM( V4L2_BUF_TYPE_SDR_OUTPUT, "SDR_OUTPUT" ) \ | |
| 31 | 32 | EMe(V4L2_BUF_TYPE_PRIVATE, "PRIVATE" ) |
| 32 | 33 | |
| 33 | 34 | SHOW_TYPE |
| @@ -145,6 +145,7 @@ enum v4l2_buf_type { · 144 unmodified lines | ||
| 145 | 145 | V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE = 9, |
| 146 | 146 | V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE = 10, |
| 147 | 147 | V4L2_BUF_TYPE_SDR_CAPTURE = 11, |
| 148 | + V4L2_BUF_TYPE_SDR_OUTPUT = 12, | |
| 148 | 149 | /* Deprecated, do not use */ |
| 149 | 150 | V4L2_BUF_TYPE_PRIVATE = 0x80, |
| 150 | 151 | }; |
| @@ -159,7 +160,8 @@ enum v4l2_buf_type { · 8 unmodified lines | ||
| 159 | 160 | || (type) == V4L2_BUF_TYPE_VIDEO_OVERLAY \ |
| 160 | 161 | || (type) == V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY \ |
| 161 | 162 | || (type) == V4L2_BUF_TYPE_VBI_OUTPUT \ |
| 162 | − || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT) | |
| 163 | + || (type) == V4L2_BUF_TYPE_SLICED_VBI_OUTPUT \ | |
| 164 | + || (type) == V4L2_BUF_TYPE_SDR_OUTPUT) | |
| 163 | 165 | |
| 164 | 166 | enum v4l2_tuner_type { |
| 165 | 167 | V4L2_TUNER_RADIO = 1, |
| @@ -435,6 +437,7 @@ struct v4l2_capability { · 269 unmodified lines | ||
| 435 | 437 | |
| 436 | 438 | #define V4L2_CAP_SDR_CAPTURE 0x00100000 /* Is a SDR capture device */ |
| 437 | 439 | #define V4L2_CAP_EXT_PIX_FORMAT 0x00200000 /* Supports the extended pixel format */ |
| 440 | +#define V4L2_CAP_SDR_OUTPUT 0x00400000 /* Is a SDR output device */ | |
| 438 | 441 | |
| 439 | 442 | #define V4L2_CAP_READWRITE 0x01000000 /* read/write systemcalls */ |
| 440 | 443 | #define V4L2_CAP_ASYNCIO 0x02000000 /* async I/O */ |