diff options
Diffstat (limited to 'include/media/v4l2-subdev.h')
-rw-r--r-- | include/media/v4l2-subdev.h | 55 |
1 files changed, 41 insertions, 14 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index f0f3358d1b1b..c35a3545e273 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -307,6 +307,12 @@ struct v4l2_subdev_video_ops { | |||
307 | struct v4l2_dv_timings *timings); | 307 | struct v4l2_dv_timings *timings); |
308 | int (*g_dv_timings)(struct v4l2_subdev *sd, | 308 | int (*g_dv_timings)(struct v4l2_subdev *sd, |
309 | struct v4l2_dv_timings *timings); | 309 | struct v4l2_dv_timings *timings); |
310 | int (*enum_dv_timings)(struct v4l2_subdev *sd, | ||
311 | struct v4l2_enum_dv_timings *timings); | ||
312 | int (*query_dv_timings)(struct v4l2_subdev *sd, | ||
313 | struct v4l2_dv_timings *timings); | ||
314 | int (*dv_timings_cap)(struct v4l2_subdev *sd, | ||
315 | struct v4l2_dv_timings_cap *cap); | ||
310 | int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, | 316 | int (*enum_mbus_fmt)(struct v4l2_subdev *sd, unsigned int index, |
311 | enum v4l2_mbus_pixelcode *code); | 317 | enum v4l2_mbus_pixelcode *code); |
312 | int (*enum_mbus_fsizes)(struct v4l2_subdev *sd, | 318 | int (*enum_mbus_fsizes)(struct v4l2_subdev *sd, |
@@ -466,6 +472,15 @@ struct v4l2_subdev_pad_ops { | |||
466 | struct v4l2_subdev_crop *crop); | 472 | struct v4l2_subdev_crop *crop); |
467 | int (*get_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | 473 | int (*get_crop)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, |
468 | struct v4l2_subdev_crop *crop); | 474 | struct v4l2_subdev_crop *crop); |
475 | int (*get_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | ||
476 | struct v4l2_subdev_selection *sel); | ||
477 | int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, | ||
478 | struct v4l2_subdev_selection *sel); | ||
479 | #ifdef CONFIG_MEDIA_CONTROLLER | ||
480 | int (*link_validate)(struct v4l2_subdev *sd, struct media_link *link, | ||
481 | struct v4l2_subdev_format *source_fmt, | ||
482 | struct v4l2_subdev_format *sink_fmt); | ||
483 | #endif /* CONFIG_MEDIA_CONTROLLER */ | ||
469 | }; | 484 | }; |
470 | 485 | ||
471 | struct v4l2_subdev_ops { | 486 | struct v4l2_subdev_ops { |
@@ -541,7 +556,7 @@ struct v4l2_subdev { | |||
541 | #define media_entity_to_v4l2_subdev(ent) \ | 556 | #define media_entity_to_v4l2_subdev(ent) \ |
542 | container_of(ent, struct v4l2_subdev, entity) | 557 | container_of(ent, struct v4l2_subdev, entity) |
543 | #define vdev_to_v4l2_subdev(vdev) \ | 558 | #define vdev_to_v4l2_subdev(vdev) \ |
544 | video_get_drvdata(vdev) | 559 | ((struct v4l2_subdev *)video_get_drvdata(vdev)) |
545 | 560 | ||
546 | /* | 561 | /* |
547 | * Used for storing subdev information per file handle | 562 | * Used for storing subdev information per file handle |
@@ -549,8 +564,11 @@ struct v4l2_subdev { | |||
549 | struct v4l2_subdev_fh { | 564 | struct v4l2_subdev_fh { |
550 | struct v4l2_fh vfh; | 565 | struct v4l2_fh vfh; |
551 | #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) | 566 | #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) |
552 | struct v4l2_mbus_framefmt *try_fmt; | 567 | struct { |
553 | struct v4l2_rect *try_crop; | 568 | struct v4l2_mbus_framefmt try_fmt; |
569 | struct v4l2_rect try_crop; | ||
570 | struct v4l2_rect try_compose; | ||
571 | } *pad; | ||
554 | #endif | 572 | #endif |
555 | }; | 573 | }; |
556 | 574 | ||
@@ -558,17 +576,19 @@ struct v4l2_subdev_fh { | |||
558 | container_of(fh, struct v4l2_subdev_fh, vfh) | 576 | container_of(fh, struct v4l2_subdev_fh, vfh) |
559 | 577 | ||
560 | #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) | 578 | #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API) |
561 | static inline struct v4l2_mbus_framefmt * | 579 | #define __V4L2_SUBDEV_MK_GET_TRY(rtype, fun_name, field_name) \ |
562 | v4l2_subdev_get_try_format(struct v4l2_subdev_fh *fh, unsigned int pad) | 580 | static inline struct rtype * \ |
563 | { | 581 | v4l2_subdev_get_try_##fun_name(struct v4l2_subdev_fh *fh, \ |
564 | return &fh->try_fmt[pad]; | 582 | unsigned int pad) \ |
565 | } | 583 | { \ |
566 | 584 | BUG_ON(unlikely(pad >= vdev_to_v4l2_subdev( \ | |
567 | static inline struct v4l2_rect * | 585 | fh->vfh.vdev)->entity.num_pads)); \ |
568 | v4l2_subdev_get_try_crop(struct v4l2_subdev_fh *fh, unsigned int pad) | 586 | return &fh->pad[pad].field_name; \ |
569 | { | 587 | } |
570 | return &fh->try_crop[pad]; | 588 | |
571 | } | 589 | __V4L2_SUBDEV_MK_GET_TRY(v4l2_mbus_framefmt, format, try_fmt) |
590 | __V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, crop, try_compose) | ||
591 | __V4L2_SUBDEV_MK_GET_TRY(v4l2_rect, compose, try_compose) | ||
572 | #endif | 592 | #endif |
573 | 593 | ||
574 | extern const struct v4l2_file_operations v4l2_subdev_fops; | 594 | extern const struct v4l2_file_operations v4l2_subdev_fops; |
@@ -593,6 +613,13 @@ static inline void *v4l2_get_subdev_hostdata(const struct v4l2_subdev *sd) | |||
593 | return sd->host_priv; | 613 | return sd->host_priv; |
594 | } | 614 | } |
595 | 615 | ||
616 | #ifdef CONFIG_MEDIA_CONTROLLER | ||
617 | int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, | ||
618 | struct media_link *link, | ||
619 | struct v4l2_subdev_format *source_fmt, | ||
620 | struct v4l2_subdev_format *sink_fmt); | ||
621 | int v4l2_subdev_link_validate(struct media_link *link); | ||
622 | #endif /* CONFIG_MEDIA_CONTROLLER */ | ||
596 | void v4l2_subdev_init(struct v4l2_subdev *sd, | 623 | void v4l2_subdev_init(struct v4l2_subdev *sd, |
597 | const struct v4l2_subdev_ops *ops); | 624 | const struct v4l2_subdev_ops *ops); |
598 | 625 | ||