summaryrefslogtreecommitdiff
path: root/include/media
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2022-04-12 10:42:48 +0100
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-04-24 08:23:23 +0100
commit14a6fca77ad122208a6db10e2abda2d7369c48a4 (patch)
treeba7234c4ce7b635a40cbcca6024c4adf55e8e229 /include/media
parentb2ac238724af5c40d74391c2af1b9e9d565d41c5 (diff)
media: subdev: add v4l2_subdev_get_fmt() helper function
Add v4l2_subdev_get_fmt() helper function which implements v4l2_subdev_pad_ops.get_fmt using active state. Subdev drivers that support active state and do not need to do anything special in their get_fmt op can use this helper directly for v4l2_subdev_pad_ops.get_fmt. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Diffstat (limited to 'include/media')
-rw-r--r--include/media/v4l2-subdev.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index f967c27e41c3..33a7201edb61 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -1303,6 +1303,27 @@ v4l2_subdev_lock_and_get_active_state(struct v4l2_subdev *sd)
return sd->active_state;
}
+#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
+
+/**
+ * v4l2_subdev_get_fmt() - Fill format based on state
+ * @sd: subdevice
+ * @state: subdevice state
+ * @format: pointer to &struct v4l2_subdev_format
+ *
+ * Fill @format->format field based on the information in the @format struct.
+ *
+ * This function can be used by the subdev drivers which support active state to
+ * implement v4l2_subdev_pad_ops.get_fmt if the subdev driver does not need to
+ * do anything special in their get_fmt op.
+ *
+ * Returns 0 on success, error value otherwise.
+ */
+int v4l2_subdev_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state,
+ struct v4l2_subdev_format *format);
+
+#endif /* CONFIG_VIDEO_V4L2_SUBDEV_API */
+
#endif /* CONFIG_MEDIA_CONTROLLER */
/**