// SPDX-License-Identifier: GPL-2.0+ /* * TI OMAP4 ISS V4L2 Driver - ISP RESIZER 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_resizer.h" static const unsigned int resizer_fmts[] = …; /* * resizer_print_status - Print current RESIZER Module register values. * @resizer: Pointer to ISS ISP RESIZER device. * * Also prints other debug information stored in the RESIZER module. */ #define RSZ_PRINT_REGISTER(iss, name) … #define RZA_PRINT_REGISTER(iss, name) … static void resizer_print_status(struct iss_resizer_device *resizer) { … } /* * resizer_enable - Enable/Disable RESIZER. * @enable: enable flag * */ static void resizer_enable(struct iss_resizer_device *resizer, u8 enable) { … } /* ----------------------------------------------------------------------------- * Format- and pipeline-related configuration helpers */ /* * resizer_set_outaddr - Set memory address to save output image * @resizer: Pointer to ISP RESIZER device. * @addr: 32-bit memory address aligned on 32 byte boundary. * * Sets the memory address where the output will be saved. */ static void resizer_set_outaddr(struct iss_resizer_device *resizer, u32 addr) { … } static void resizer_configure(struct iss_resizer_device *resizer) { … } /* ----------------------------------------------------------------------------- * Interrupt handling */ static void resizer_isr_buffer(struct iss_resizer_device *resizer) { … } /* * omap4iss_resizer_isr - Configure resizer during interframe time. * @resizer: Pointer to ISP RESIZER device. * @events: RESIZER events */ void omap4iss_resizer_isr(struct iss_resizer_device *resizer, u32 events) { … } /* ----------------------------------------------------------------------------- * ISS video operations */ static int resizer_video_queue(struct iss_video *video, struct iss_buffer *buffer) { … } static const struct iss_video_operations resizer_video_ops = …; /* ----------------------------------------------------------------------------- * V4L2 subdev operations */ /* * resizer_set_stream - Enable/Disable streaming on the RESIZER module * @sd: ISP RESIZER V4L2 subdevice * @enable: Enable/disable stream */ static int resizer_set_stream(struct v4l2_subdev *sd, int enable) { … } static struct v4l2_mbus_framefmt * __resizer_get_format(struct iss_resizer_device *resizer, struct v4l2_subdev_state *sd_state, unsigned int pad, enum v4l2_subdev_format_whence which) { … } /* * resizer_try_format - Try video format on a pad * @resizer: ISS RESIZER device * @sd_state: V4L2 subdev state * @pad: Pad number * @fmt: Format */ static void resizer_try_format(struct iss_resizer_device *resizer, struct v4l2_subdev_state *sd_state, unsigned int pad, struct v4l2_mbus_framefmt *fmt, enum v4l2_subdev_format_whence which) { … } /* * resizer_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 resizer_enum_mbus_code(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_mbus_code_enum *code) { … } static int resizer_enum_frame_size(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_frame_size_enum *fse) { … } /* * resizer_get_format - Retrieve the video format on a pad * @sd : ISP RESIZER 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 resizer_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) { … } /* * resizer_set_format - Set the video format on a pad * @sd : ISP RESIZER 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 resizer_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_state *sd_state, struct v4l2_subdev_format *fmt) { … } static int resizer_link_validate(struct v4l2_subdev *sd, struct media_link *link, struct v4l2_subdev_format *source_fmt, struct v4l2_subdev_format *sink_fmt) { … } /* * resizer_init_formats - Initialize formats on all pads * @sd: ISP RESIZER 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 resizer_init_formats(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) { … } /* V4L2 subdev video operations */ static const struct v4l2_subdev_video_ops resizer_v4l2_video_ops = …; /* V4L2 subdev pad operations */ static const struct v4l2_subdev_pad_ops resizer_v4l2_pad_ops = …; /* V4L2 subdev operations */ static const struct v4l2_subdev_ops resizer_v4l2_ops = …; /* V4L2 subdev internal operations */ static const struct v4l2_subdev_internal_ops resizer_v4l2_internal_ops = …; /* ----------------------------------------------------------------------------- * Media entity operations */ /* * resizer_link_setup - Setup RESIZER connections * @entity: RESIZER 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 resizer_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 resizer_media_ops = …; /* * resizer_init_entities - Initialize V4L2 subdev and media entity * @resizer: ISS ISP RESIZER module * * Return 0 on success and a negative error code on failure. */ static int resizer_init_entities(struct iss_resizer_device *resizer) { … } void omap4iss_resizer_unregister_entities(struct iss_resizer_device *resizer) { … } int omap4iss_resizer_register_entities(struct iss_resizer_device *resizer, struct v4l2_device *vdev) { … } /* ----------------------------------------------------------------------------- * ISP RESIZER initialisation and cleanup */ /* * omap4iss_resizer_init - RESIZER 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_resizer_init(struct iss_device *iss) { … } /* * omap4iss_resizer_create_links() - RESIZER pads links creation * @iss: Pointer to ISS device * * return negative error code or zero on success */ int omap4iss_resizer_create_links(struct iss_device *iss) { … } /* * omap4iss_resizer_cleanup - RESIZER module cleanup. * @iss: Device pointer specific to the OMAP4 ISS. */ void omap4iss_resizer_cleanup(struct iss_device *iss) { … }