// SPDX-License-Identifier: GPL-2.0+ /* * TI OMAP4 ISS V4L2 Driver - ISP IPIPE module * * Copyright (C) 2012 Texas Instruments, Inc. * * Author: Sergio Aguirre <[email protected]> */ #include <linux/module.h> #include <linux/uaccess.h> #include <linux/delay.h> #include <linux/device.h> #include <linux/dma-mapping.h> #include <linux/mm.h> #include <linux/sched.h> #include "iss.h" #include "iss_regs.h" #include "iss_ipipe.h" static struct v4l2_mbus_framefmt * __ipipe_get_format(struct iss_ipipe_device *ipipe, struct v4l2_subdev_state *sd_state, unsigned int pad, enum v4l2_subdev_format_whence which); static const unsigned int ipipe_fmts[] = …; /* * ipipe_print_status - Print current IPIPE Module register values. * @ipipe: Pointer to ISS ISP IPIPE device. * * Also prints other debug information stored in the IPIPE module. */ #define IPIPE_PRINT_REGISTER(iss, name) … static void ipipe_print_status(struct iss_ipipe_device *ipipe) { … } /* * ipipe_enable - Enable/Disable IPIPE. * @enable: enable flag * */ static void ipipe_enable(struct iss_ipipe_device *ipipe, u8 enable) { … } /* ----------------------------------------------------------------------------- * Format- and pipeline-related configuration helpers */ static void ipipe_configure(struct iss_ipipe_device *ipipe) { … } /* ----------------------------------------------------------------------------- * V4L2 subdev operations */ /* * ipipe_set_stream - Enable/Disable streaming on the IPIPE module * @sd: ISP IPIPE V4L2 subdevice * @enable: Enable/disable stream */ static int ipipe_set_stream(struct v4l2_subdev *sd, int enable) { … } static struct v4l2_mbus_framefmt * __ipipe_get_format(struct iss_ipipe_device *ipipe, struct v4l2_subdev_state *sd_state, unsigned int pad, enum v4l2_subdev_format_whence which) { … } /* * ipipe_try_format - Try video format on a pad * @ipipe: ISS IPIPE device * @sd_state: V4L2 subdev state * @pad: Pad number * @fmt: Format */ static void ipipe_try_format(struct iss_ipipe_device *ipipe, struct v4l2_subdev_state *sd_state, unsigned int pad, struct v4l2_mbus_framefmt *fmt, enum v4l2_subdev_format_whence which) { … } /* * ipipe_enum_mbus_code - Handle pixel format enumeration * @sd : pointer to v4l2 subdev structure * @sd_state: V4L2 subdev state * @code : pointer to v4l2_subdev_mbus_code_enum structure * return -EINVAL or zero on success */ static int ipipe_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) { … } static int ipipe_enum_frame_size(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_frame_size_enum *fse) { … } /* * ipipe_get_format - Retrieve the video format on a pad * @sd : ISP IPIPE V4L2 subdevice * @sd_state: V4L2 subdev state * @fmt: Format * * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond * to the format type. */ static int ipipe_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) { … } /* * ipipe_set_format - Set the video format on a pad * @sd : ISP IPIPE V4L2 subdevice * @sd_state: V4L2 subdev state * @fmt: Format * * Return 0 on success or -EINVAL if the pad is invalid or doesn't correspond * to the format type. */ static int ipipe_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) { … } static int ipipe_link_validate(struct v4l2_subdev *sd, struct media_link *link, struct v4l2_subdev_format *source_fmt, struct v4l2_subdev_format *sink_fmt) { … } /* * ipipe_init_formats - Initialize formats on all pads * @sd: ISP IPIPE V4L2 subdevice * @fh: V4L2 subdev file handle * * Initialize all pad formats with default values. If fh is not NULL, try * formats are initialized on the file handle. Otherwise active formats are * initialized on the device. */ static int ipipe_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { … } /* V4L2 subdev video operations */ static const struct v4l2_subdev_video_ops ipipe_v4l2_video_ops = …; /* V4L2 subdev pad operations */ static const struct v4l2_subdev_pad_ops ipipe_v4l2_pad_ops = …; /* V4L2 subdev operations */ static const struct v4l2_subdev_ops ipipe_v4l2_ops = …; /* V4L2 subdev internal operations */ static const struct v4l2_subdev_internal_ops ipipe_v4l2_internal_ops = …; /* ----------------------------------------------------------------------------- * Media entity operations */ /* * ipipe_link_setup - Setup IPIPE connections * @entity: IPIPE media entity * @local: Pad at the local end of the link * @remote: Pad at the remote end of the link * @flags: Link flags * * return -EINVAL or zero on success */ static int ipipe_link_setup(struct media_entity *entity, const struct media_pad *local, const struct media_pad *remote, u32 flags) { … } /* media operations */ static const struct media_entity_operations ipipe_media_ops = …; /* * ipipe_init_entities - Initialize V4L2 subdev and media entity * @ipipe: ISS ISP IPIPE module * * Return 0 on success and a negative error code on failure. */ static int ipipe_init_entities(struct iss_ipipe_device *ipipe) { … } void omap4iss_ipipe_unregister_entities(struct iss_ipipe_device *ipipe) { … } int omap4iss_ipipe_register_entities(struct iss_ipipe_device *ipipe, struct v4l2_device *vdev) { … } /* ----------------------------------------------------------------------------- * ISP IPIPE initialisation and cleanup */ /* * omap4iss_ipipe_init - IPIPE module initialization. * @iss: Device pointer specific to the OMAP4 ISS. * * TODO: Get the initialisation values from platform data. * * Return 0 on success or a negative error code otherwise. */ int omap4iss_ipipe_init(struct iss_device *iss) { … } /* * omap4iss_ipipe_cleanup - IPIPE module cleanup. * @iss: Device pointer specific to the OMAP4 ISS. */ void omap4iss_ipipe_cleanup(struct iss_device *iss) { … }