From bef7f602a470d81f5187c408746ce9feb3a9b4eb Mon Sep 17 00:00:00 2001 From: Bhanu Murthy V Date: Fri, 10 Jun 2016 16:09:45 -0700 Subject: [PATCH] v4l2-core: Add sync op to subdev_core_ops 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 Acked-by: Hans Verkuil 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 --- include/media/v4l2-subdev.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index b273cf9ac047..d889544e076c 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -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); }; /** -- 2.39.2