aboutsummaryrefslogtreecommitdiffstats
path: root/include/media
diff options
context:
space:
mode:
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-subdev.h53
1 files changed, 33 insertions, 20 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 5beeb8744fd1..d9404df80482 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -482,6 +482,18 @@ struct v4l2_subdev_ir_ops {
482 struct v4l2_subdev_ir_parameters *params); 482 struct v4l2_subdev_ir_parameters *params);
483}; 483};
484 484
485/*
486 * Used for storing subdev pad information. This structure only needs
487 * to be passed to the pad op if the 'which' field of the main argument
488 * is set to V4L2_SUBDEV_FORMAT_TRY. For V4L2_SUBDEV_FORMAT_ACTIVE it is
489 * safe to pass NULL.
490 */
491struct v4l2_subdev_pad_config {
492 struct v4l2_mbus_framefmt try_fmt;
493 struct v4l2_rect try_crop;
494 struct v4l2_rect try_compose;
495};
496
485/** 497/**
486 * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations 498 * struct v4l2_subdev_pad_ops - v4l2-subdev pad level operations
487 * @get_frame_desc: get the current low level media bus frame parameters. 499 * @get_frame_desc: get the current low level media bus frame parameters.
@@ -489,21 +501,26 @@ struct v4l2_subdev_ir_ops {
489 * may be adjusted by the subdev driver to device capabilities. 501 * may be adjusted by the subdev driver to device capabilities.
490 */ 502 */
491struct v4l2_subdev_pad_ops { 503struct v4l2_subdev_pad_ops {
492 int (*enum_mbus_code)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 504 int (*enum_mbus_code)(struct v4l2_subdev *sd,
505 struct v4l2_subdev_pad_config *cfg,
493 struct v4l2_subdev_mbus_code_enum *code); 506 struct v4l2_subdev_mbus_code_enum *code);
494 int (*enum_frame_size)(struct v4l2_subdev *sd, 507 int (*enum_frame_size)(struct v4l2_subdev *sd,
495 struct v4l2_subdev_fh *fh, 508 struct v4l2_subdev_pad_config *cfg,
496 struct v4l2_subdev_frame_size_enum *fse); 509 struct v4l2_subdev_frame_size_enum *fse);
497 int (*enum_frame_interval)(struct v4l2_subdev *sd, 510 int (*enum_frame_interval)(struct v4l2_subdev *sd,
498 struct v4l2_subdev_fh *fh, 511 struct v4l2_subdev_pad_config *cfg,
499 struct v4l2_subdev_frame_interval_enum *fie); 512 struct v4l2_subdev_frame_interval_enum *fie);
500 int (*get_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 513 int (*get_fmt)(struct v4l2_subdev *sd,
514 struct v4l2_subdev_pad_config *cfg,
501 struct v4l2_subdev_format *format); 515 struct v4l2_subdev_format *format);
502 int (*set_fmt)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 516 int (*set_fmt)(struct v4l2_subdev *sd,
517 struct v4l2_subdev_pad_config *cfg,
503 struct v4l2_subdev_format *format); 518 struct v4l2_subdev_format *format);
504 int (*get_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 519 int (*get_selection)(struct v4l2_subdev *sd,
520 struct v4l2_subdev_pad_config *cfg,
505 struct v4l2_subdev_selection *sel); 521 struct v4l2_subdev_selection *sel);
506 int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 522 int (*set_selection)(struct v4l2_subdev *sd,
523 struct v4l2_subdev_pad_config *cfg,
507 struct v4l2_subdev_selection *sel); 524 struct v4l2_subdev_selection *sel);
508 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); 525 int (*get_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
509 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid); 526 int (*set_edid)(struct v4l2_subdev *sd, struct v4l2_edid *edid);
@@ -625,11 +642,7 @@ struct v4l2_subdev {
625struct v4l2_subdev_fh { 642struct v4l2_subdev_fh {
626 struct v4l2_fh vfh; 643 struct v4l2_fh vfh;
627#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) 644#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
628 struct { 645 struct v4l2_subdev_pad_config *pad;
629 struct v4l2_mbus_framefmt try_fmt;
630 struct v4l2_rect try_crop;
631 struct v4l2_rect try_compose;
632 } *pad;
633#endif 646#endif
634}; 647};
635 648
@@ -639,17 +652,17 @@ struct v4l2_subdev_fh {
639#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) 652#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
640#define __V4L2_SUBDEV_MK_GET_TRY(rtype, fun_name, field_name) \ 653#define __V4L2_SUBDEV_MK_GET_TRY(rtype, fun_name, field_name) \
641 static inline struct rtype * \ 654 static inline struct rtype * \
642 v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \ 655 fun_name(struct v4l2_subdev *sd, \
643 unsigned int pad) \ 656 struct v4l2_subdev_pad_config *cfg, \
657 unsigned int pad) \
644 { \ 658 { \
645 BUG_ON(pad >= vdev_to_v4l2_subdev( \ 659 BUG_ON(pad >= sd->entity.num_pads); \
646 fh->vfh.vdev)->entity.num_pads); \ 660 return &cfg[pad].field_name; \
647 return &fh->pad[pad].field_name; \
648 } 661 }
649 662
650__V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt, format, try_fmt) 663__V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt, v4l2_subdev_get_try_format, try_fmt)
651__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, crop, try_crop) 664__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, v4l2_subdev_get_try_crop, try_crop)
652__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, compose, try_compose) 665__V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, v4l2_subdev_get_try_compose, try_compose)
653#endif 666#endif
654 667
655extern const struct v4l2_file_operations v4l2_subdev_fops; 668extern const struct v4l2_file_operations v4l2_subdev_fops;