// SPDX-License-Identifier: GPL-2.0+ /* * TI OMAP4 ISS V4L2 Driver - ISP IPIPEIF 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_ipipeif.h" static const unsigned int ipipeif_fmts[] = …; /* * ipipeif_print_status - Print current IPIPEIF Module register values. * @ipipeif: Pointer to ISS ISP IPIPEIF device. * * Also prints other debug information stored in the IPIPEIF module. */ #define IPIPEIF_PRINT_REGISTER(iss, name) … #define ISIF_PRINT_REGISTER(iss, name) … #define ISP5_PRINT_REGISTER(iss, name) … static void ipipeif_print_status(struct iss_ipipeif_device *ipipeif) { … } static void ipipeif_write_enable(struct iss_ipipeif_device *ipipeif, u8 enable) { … } /* * ipipeif_enable - Enable/Disable IPIPEIF. * @enable: enable flag * */ static void ipipeif_enable(struct iss_ipipeif_device *ipipeif, u8 enable) { … } /* ----------------------------------------------------------------------------- * Format- and pipeline-related configuration helpers */ /* * ipipeif_set_outaddr - Set memory address to save output image * @ipipeif: Pointer to ISP IPIPEIF device. * @addr: 32-bit memory address aligned on 32 byte boundary. * * Sets the memory address where the output will be saved. */ static void ipipeif_set_outaddr(struct iss_ipipeif_device *ipipeif, u32 addr) { … } static void ipipeif_configure(struct iss_ipipeif_device *ipipeif) { … } /* ----------------------------------------------------------------------------- * Interrupt handling */ static void ipipeif_isr_buffer(struct iss_ipipeif_device *ipipeif) { … } /* * omap4iss_ipipeif_isr - Configure ipipeif during interframe time. * @ipipeif: Pointer to ISP IPIPEIF device. * @events: IPIPEIF events */ void omap4iss_ipipeif_isr(struct iss_ipipeif_device *ipipeif, u32 events) { … } /* ----------------------------------------------------------------------------- * ISP video operations */ static int ipipeif_video_queue(struct iss_video *video, struct iss_buffer *buffer) { … } static const struct iss_video_operations ipipeif_video_ops = …; /* ----------------------------------------------------------------------------- * V4L2 subdev operations */ #define IPIPEIF_DRV_SUBCLK_MASK … /* * ipipeif_set_stream - Enable/Disable streaming on the IPIPEIF module * @sd: ISP IPIPEIF V4L2 subdevice * @enable: Enable/disable stream */ static int ipipeif_set_stream(struct v4l2_subdev *sd, int enable) { … } static struct v4l2_mbus_framefmt * __ipipeif_get_format(struct iss_ipipeif_device *ipipeif, struct v4l2_subdev_state *sd_state, unsigned int pad, enum v4l2_subdev_format_whence which) { … } /* * ipipeif_try_format - Try video format on a pad * @ipipeif: ISS IPIPEIF device * @sd_state: V4L2 subdev state * @pad: Pad number * @fmt: Format */ static void ipipeif_try_format(struct iss_ipipeif_device *ipipeif, struct v4l2_subdev_state *sd_state, unsigned int pad, struct v4l2_mbus_framefmt *fmt, enum v4l2_subdev_format_whence which) { … } /* * ipipeif_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 ipipeif_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) { … } static int ipipeif_enum_frame_size(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_frame_size_enum *fse) { … } /* * ipipeif_get_format - Retrieve the video format on a pad * @sd : ISP IPIPEIF 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 ipipeif_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) { … } /* * ipipeif_set_format - Set the video format on a pad * @sd : ISP IPIPEIF 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 ipipeif_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) { … } static int ipipeif_link_validate(struct v4l2_subdev *sd, struct media_link *link, struct v4l2_subdev_format *source_fmt, struct v4l2_subdev_format *sink_fmt) { … } /* * ipipeif_init_formats - Initialize formats on all pads * @sd: ISP IPIPEIF 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 ipipeif_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { … } /* V4L2 subdev video operations */ static const struct v4l2_subdev_video_ops ipipeif_v4l2_video_ops = …; /* V4L2 subdev pad operations */ static const struct v4l2_subdev_pad_ops ipipeif_v4l2_pad_ops = …; /* V4L2 subdev operations */ static const struct v4l2_subdev_ops ipipeif_v4l2_ops = …; /* V4L2 subdev internal operations */ static const struct v4l2_subdev_internal_ops ipipeif_v4l2_internal_ops = …; /* ----------------------------------------------------------------------------- * Media entity operations */ /* * ipipeif_link_setup - Setup IPIPEIF connections * @entity: IPIPEIF 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 ipipeif_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 ipipeif_media_ops = …; /* * ipipeif_init_entities - Initialize V4L2 subdev and media entity * @ipipeif: ISS ISP IPIPEIF module * * Return 0 on success and a negative error code on failure. */ static int ipipeif_init_entities(struct iss_ipipeif_device *ipipeif) { … } void omap4iss_ipipeif_unregister_entities(struct iss_ipipeif_device *ipipeif) { … } int omap4iss_ipipeif_register_entities(struct iss_ipipeif_device *ipipeif, struct v4l2_device *vdev) { … } /* ----------------------------------------------------------------------------- * ISP IPIPEIF initialisation and cleanup */ /* * omap4iss_ipipeif_init - IPIPEIF 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_ipipeif_init(struct iss_device *iss) { … } /* * omap4iss_ipipeif_create_links() - IPIPEIF pads links creation * @iss: Pointer to ISS device * * return negative error code or zero on success */ int omap4iss_ipipeif_create_links(struct iss_device *iss) { … } /* * omap4iss_ipipeif_cleanup - IPIPEIF module cleanup. * @iss: Device pointer specific to the OMAP4 ISS. */ void omap4iss_ipipeif_cleanup(struct iss_device *iss) { … }