[PATCH v3 07/29] media: v4l2-subdev: Add frame descriptor passthrough for CSI-2 and DVP
Sakari Ailus <[email protected]>
| Newsgroups | org.kernel.vger.linux-media |
|---|---|
| Organization | Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo |
| Message-ID | <[email protected]> |
Add frame descriptor pass-through functions specific to MIPI CSI-2 and DVP (parallel) interfaces. The two new functions are needed in order to support frame descriptor-less sub-device drivers. Signed-off-by: Sakari Ailus <[email protected]> --- drivers/media/v4l2-core/v4l2-subdev.c | 20 +++++++++++ include/media/v4l2-subdev.h | 49 +++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 071657459202..f5fa62038754 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -2672,6 +2672,26 @@ int v4l2_subdev_get_frame_desc_passthrough(struct v4l2_subdev *sd, } EXPORT_SYMBOL_GPL(v4l2_subdev_get_frame_desc_passthrough); +int v4l2_subdev_get_frame_desc_passthrough_dvp(struct v4l2_subdev *sd, + unsigned int pad, + struct v4l2_mbus_frame_desc *fd) +{ + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_PARALLEL; + + return v4l2_subdev_get_frame_desc_passthrough(sd, pad, fd); +} +EXPORT_SYMBOL_GPL(v4l2_subdev_get_frame_desc_passthrough_dvp); + +int v4l2_subdev_get_frame_desc_passthrough_csi2(struct v4l2_subdev *sd, + unsigned int pad, + struct v4l2_mbus_frame_desc *fd) +{ + fd->type = V4L2_MBUS_FRAME_DESC_TYPE_CSI2; + + return v4l2_subdev_get_frame_desc_passthrough(sd, pad, fd); +} +EXPORT_SYMBOL_GPL(v4l2_subdev_get_frame_desc_passthrough_csi2); + struct v4l2_mbus_frame_desc * v4l2_subdev_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, enum v4l2_mbus_frame_desc_type type) diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index daebf8982c43..80ae7649f5c7 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h @@ -1795,6 +1795,55 @@ int v4l2_subdev_get_frame_desc_passthrough(struct v4l2_subdev *sd, unsigned int pad, struct v4l2_mbus_frame_desc *fd); +/** + * v4l2_subdev_get_frame_desc_passthrough_dvp() - Helper to implement the subdev + * get_frame_desc operation in simple passthrough cases for DVP + * @sd: The subdevice + * @pad: The source pad index + * @fd: The mbus frame desc + * + * This function locks the subdevice's active state, calls + * __v4l2_subdev_get_frame_desc_passthrough(), and unlocks the state. + * + * This function can be assigned directly as the .get_frame_desc callback in + * &v4l2_subdev_pad_ops for subdevices that pass streams through without + * modification. Drivers that need to perform additional work should use + * __v4l2_subdev_get_frame_desc_passthrough() in their custom + * .get_frame_desc implementation instead. + * + * This callback can be used for the DVP (Digital Video Port), also often called + * simply the "parallel interface". + * + * Return: 0 on success, or a negative error code otherwise. + */ +int v4l2_subdev_get_frame_desc_passthrough_dvp(struct v4l2_subdev *sd, + unsigned int pad, + struct v4l2_mbus_frame_desc *fd); + +/** + * v4l2_subdev_get_frame_desc_passthrough_csi2() - Helper to implement the subdev + * get_frame_desc operation in simple passthrough cases for MIPI CSI-2 + * @sd: The subdevice + * @pad: The source pad index + * @fd: The mbus frame desc + * + * This function locks the subdevice's active state, calls + * __v4l2_subdev_get_frame_desc_passthrough(), and unlocks the state. + * + * This function can be assigned directly as the .get_frame_desc callback in + * &v4l2_subdev_pad_ops for subdevices that pass streams through without + * modification. Drivers that need to perform additional work should use + * __v4l2_subdev_get_frame_desc_passthrough() in their custom + * .get_frame_desc implementation instead. + * + * This callback can be used for the MIPI CSI-2 interface. + * + * Return: 0 on success, or a negative error code otherwise. + */ +int v4l2_subdev_get_frame_desc_passthrough_csi2(struct v4l2_subdev *sd, + unsigned int pad, + struct v4l2_mbus_frame_desc *fd); + /** * v4l2_subdev_get_frame_desc() - Get a frame descriptor for a pad * @sd: The sub-device -- 2.47.3