/* SPDX-License-Identifier: GPL-2.0-only */ /* * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver * * Copyright (C) 2013 Samsung Electronics Co., Ltd. * * Authors: Sylwester Nawrocki <[email protected]> * Younghwan Joo <[email protected]> */ #ifndef FIMC_ISP_H_ #define FIMC_ISP_H_ #include <linux/io.h> #include <linux/platform_device.h> #include <linux/sched.h> #include <linux/spinlock.h> #include <linux/types.h> #include <linux/videodev2.h> #include <media/media-entity.h> #include <media/videobuf2-v4l2.h> #include <media/v4l2-device.h> #include <media/v4l2-mediabus.h> #include <media/drv-intf/exynos-fimc.h> extern int fimc_isp_debug; #define isp_dbg(level, dev, fmt, arg...) … /* FIXME: revisit these constraints */ #define FIMC_ISP_SINK_WIDTH_MIN … #define FIMC_ISP_SINK_HEIGHT_MIN … #define FIMC_ISP_SOURCE_WIDTH_MIN … #define FIMC_ISP_SOURCE_HEIGHT_MIN … #define FIMC_ISP_CAC_MARGIN_WIDTH … #define FIMC_ISP_CAC_MARGIN_HEIGHT … #define FIMC_ISP_SINK_WIDTH_MAX … #define FIMC_ISP_SINK_HEIGHT_MAX … #define FIMC_ISP_SOURCE_WIDTH_MAX … #define FIMC_ISP_SOURCE_HEIGHT_MAX … #define FIMC_ISP_NUM_FORMATS … #define FIMC_ISP_REQ_BUFS_MIN … #define FIMC_ISP_REQ_BUFS_MAX … #define FIMC_ISP_SD_PAD_SINK … #define FIMC_ISP_SD_PAD_SRC_FIFO … #define FIMC_ISP_SD_PAD_SRC_DMA … #define FIMC_ISP_SD_PADS_NUM … #define FIMC_ISP_MAX_PLANES … /** * struct fimc_isp_frame - source/target frame properties * @width: full image width * @height: full image height * @rect: crop/composition rectangle */ struct fimc_isp_frame { … }; struct fimc_isp_ctrls { … }; struct isp_video_buf { … }; #define to_isp_video_buf(_b) … #define FIMC_ISP_MAX_BUFS … /** * struct fimc_is_video - fimc-is video device structure * @ve: video_device structure and media pipeline * @type: video device type (CAPTURE/OUTPUT) * @pad: video device media (sink) pad * @pending_buf_q: pending buffers queue head * @active_buf_q: a queue head of buffers scheduled in hardware * @vb_queue: vb2 buffer queue * @reqbufs_count: the number of buffers requested in REQBUFS ioctl * @buf_count: number of video buffers scheduled in hardware * @buf_mask: bitmask of the queued video buffer indices * @frame_count: counter of frames dequeued to user space * @streaming: is streaming in progress? * @buffers: buffer info * @format: current fimc pixel format * @pixfmt: current pixel format */ struct fimc_is_video { … }; /* struct fimc_isp:state bit definitions */ #define ST_ISP_VID_CAP_BUF_PREP … #define ST_ISP_VID_CAP_STREAMING … /** * struct fimc_isp - FIMC-IS ISP data structure * @pdev: pointer to FIMC-IS platform device * @subdev: ISP v4l2_subdev * @subdev_pads: the ISP subdev media pads * @src_fmt: source mediabus format * @sink_fmt: sink mediabus format * @test_pattern: test pattern controls * @ctrls: v4l2 controls structure * @video_lock: mutex serializing video device operations * @subdev_lock: mutex serializing subdev operations * @cac_margin_x: horizontal CAC margin in pixels * @cac_margin_y: vertical CAC margin in pixels * @state: driver state flags * @video_capture: the ISP block video capture device */ struct fimc_isp { … }; #define ctrl_to_fimc_isp(_ctrl) … struct fimc_is; int fimc_isp_subdev_create(struct fimc_isp *isp); void fimc_isp_subdev_destroy(struct fimc_isp *isp); void fimc_isp_irq_handler(struct fimc_is *is); int fimc_is_create_controls(struct fimc_isp *isp); int fimc_is_delete_controls(struct fimc_isp *isp); const struct fimc_fmt *fimc_isp_find_format(const u32 *pixelformat, const u32 *mbus_code, int index); #endif /* FIMC_ISP_H_ */