]> rtime.felk.cvut.cz Git - hercules2020/nv-tegra/linux-4.4.git/commitdiff
v4l2-core: Add sync op to subdev_core_ops
authorBhanu Murthy V <bmurthyv@nvidia.com>
Fri, 10 Jun 2016 23:09:45 +0000 (16:09 -0700)
committermobile promotions <svcmobile_promotions@nvidia.com>
Wed, 14 Jun 2017 11:31:12 +0000 (04:31 -0700)
If multiple sub devices need to be synchronized w.r.t one
sub device state, then this op can be used.

For example in camera system, configuring focuser position and
sensor capture have to be synchronized when the ROI for focuser
ends. Writing focus position on improper boundary causes unexpected
output.

Bug 1754305

Change-Id: I09140cac1c2e3a06de78f08b90c35562d2ec2880
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
Acked-by: Hans Verkuil <hans.verkuil@cisco.com>
Reviewed-on: http://git-master/r/1162762
(cherry picked from commit 03ea0e3544d6768cc84d2ff4b90a218caee6d208)
Reviewed-on: http://git-master/r/1327221
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>
include/media/v4l2-subdev.h

index b273cf9ac0476d27ed9dd9c45a83616fc7d397b6..d889544e076cf803034df271e3892200f82acf3d 100644 (file)
@@ -118,6 +118,9 @@ struct v4l2_subdev_io_pin_config {
        u8 strength;    /* Pin drive strength */
 };
 
+#define V4L2_SYNC_EVENT_FOCUS_POS              (1 << 0)
+#define V4L2_SYNC_EVENT_IRIS_POS               (1 << 1)
+
 /**
  * struct v4l2_subdev_core_ops - Define core ops callbacks for subdevs
  *
@@ -179,6 +182,13 @@ struct v4l2_subdev_io_pin_config {
  *                  for it to be warned when the value of a control changes.
  *
  * @unsubscribe_event: remove event subscription from the control framework.
+ *
+ * @sync: some sub devices can only make certain changes at certain times.
+ *     For example, a sensor can change the focus only during the blanking period.
+ *     This callback can be used to perform these changes when a certain event occurs.
+ *     A master device (usually the bridge driver) will call this callback with the
+ *     event(s) that occurred and the sub device checks the event mask for the event(s)
+ *     on which they have to synchronize their pending changes.
  */
 struct v4l2_subdev_core_ops {
        int (*log_status)(struct v4l2_subdev *sd);
@@ -211,6 +221,7 @@ struct v4l2_subdev_core_ops {
                               struct v4l2_event_subscription *sub);
        int (*unsubscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh,
                                 struct v4l2_event_subscription *sub);
+       int (*sync)(struct v4l2_subdev *sd, unsigned int sync_events);
 };
 
 /**