linux/drivers/media/platform/samsung/s3c-camif/camif-core.h

/* SPDX-License-Identifier: GPL-2.0-only */
/*
 * s3c24xx/s3c64xx SoC series Camera Interface (CAMIF) driver
 *
 * Copyright (C) 2012 Sylwester Nawrocki <[email protected]>
 * Copyright (C) 2012 Tomasz Figa <[email protected]>
*/

#ifndef CAMIF_CORE_H_
#define CAMIF_CORE_H_

#include <linux/io.h>
#include <linux/irq.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/v4l2-ctrls.h>
#include <media/v4l2-dev.h>
#include <media/v4l2-device.h>
#include <media/v4l2-mediabus.h>
#include <media/videobuf2-v4l2.h>
#include <media/drv-intf/s3c_camif.h>

#define S3C_CAMIF_DRIVER_NAME
#define CAMIF_REQ_BUFS_MIN
#define CAMIF_MAX_OUT_BUFS
#define CAMIF_MAX_PIX_WIDTH
#define CAMIF_MAX_PIX_HEIGHT
#define SCALER_MAX_RATIO
#define CAMIF_DEF_WIDTH
#define CAMIF_DEF_HEIGHT
#define CAMIF_STOP_TIMEOUT

#define S3C244X_CAMIF_IP_REV
#define S3C2450_CAMIF_IP_REV
#define S3C6400_CAMIF_IP_REV
#define S3C6410_CAMIF_IP_REV

/* struct camif_vp::state */

#define ST_VP_PENDING
#define ST_VP_RUNNING
#define ST_VP_STREAMING
#define ST_VP_SENSOR_STREAMING

#define ST_VP_ABORTING
#define ST_VP_OFF
#define ST_VP_LASTIRQ

#define ST_VP_CONFIG

#define CAMIF_SD_PAD_SINK
#define CAMIF_SD_PAD_SOURCE_C
#define CAMIF_SD_PAD_SOURCE_P
#define CAMIF_SD_PADS_NUM

enum img_fmt {};

#define img_fmt_is_rgb(x)
#define img_fmt_is_ycbcr(x)

/* Possible values for struct camif_fmt::flags */
#define FMT_FL_S3C24XX_CODEC
#define FMT_FL_S3C24XX_PREVIEW
#define FMT_FL_S3C64XX

/**
 * struct camif_fmt - pixel format description
 * @fourcc:    fourcc code for this format, 0 if not applicable
 * @color:     a corresponding enum img_fmt
 * @colplanes: number of physically contiguous data planes
 * @flags:     indicate for which SoCs revisions this format is valid
 * @depth:     bits per pixel (total)
 * @ybpp:      number of luminance bytes per pixel
 */
struct camif_fmt {};

/**
 * struct camif_dma_offset - pixel offset information for DMA
 * @initial: offset (in pixels) to first pixel
 * @line: offset (in pixels) from end of line to start of next line
 */
struct camif_dma_offset {};

/**
 * struct camif_frame - source/target frame properties
 * @f_width: full pixel width
 * @f_height: full pixel height
 * @rect: crop/composition rectangle
 * @dma_offset: DMA offset configuration
 */
struct camif_frame {};

/* CAMIF clocks enumeration */
enum {};

struct vp_pix_limits {};

struct camif_pix_limits {};

/**
 * struct s3c_camif_variant - CAMIF variant structure
 * @vp_pix_limits:    pixel limits for the codec and preview paths
 * @pix_limits:       pixel limits for the camera input interface
 * @ip_revision:      the CAMIF IP revision: 0x20 for s3c244x, 0x32 for s3c6410
 * @has_img_effect:   supports image effects
 * @vp_offset:        register offset
 */
struct s3c_camif_variant {};

struct s3c_camif_drvdata {};

struct camif_scaler {};

struct camif_dev;

/**
 * struct camif_vp - CAMIF data processing path structure (codec/preview)
 * @irq_queue:	    interrupt handling waitqueue
 * @irq:	    interrupt number for this data path
 * @camif:	    pointer to the camif structure
 * @pad:	    media pad for the video node
 * @vdev:           video device
 * @ctrl_handler:   video node controls handler
 * @owner:	    file handle that own the streaming
 * @vb_queue:       vb2 buffer queue
 * @pending_buf_q:  pending (empty) buffers queue head
 * @active_buf_q:   active (being written) buffers queue head
 * @active_buffers: counter of buffer set up at the DMA engine
 * @buf_index:	    identifier of a last empty buffer set up in H/W
 * @frame_sequence: image frame sequence counter
 * @reqbufs_count:  the number of buffers requested
 * @scaler:	    the scaler structure
 * @out_fmt:	    pixel format at this video path output
 * @payload:	    the output data frame payload size
 * @out_frame:	    the output pixel resolution
 * @state:	    the video path's state
 * @fmt_flags:	    flags determining supported pixel formats
 * @id:		    CAMIF id, 0 - codec, 1 - preview
 * @rotation:	    current image rotation value
 * @hflip:	    apply horizontal flip if set
 * @vflip:	    apply vertical flip if set
 * @offset:	    register offset
 */
struct camif_vp {};

/* Video processing path enumeration */
#define VP_CODEC
#define VP_PREVIEW
#define CAMIF_VP_NUM

/**
 * struct camif_dev - the CAMIF driver private data structure
 * @media_dev:    top-level media device structure
 * @v4l2_dev:	  root v4l2_device
 * @subdev:       camera interface ("catchcam") subdev
 * @mbus_fmt:	  camera input media bus format
 * @camif_crop:   camera input interface crop rectangle
 * @pads:	  the camif subdev's media pads
 * @stream_count: the camera interface streaming reference counter
 * @sensor:       image sensor data structure
 * @m_pipeline:	  video entity pipeline description
 * @ctrl_handler: v4l2 control handler (owned by @subdev)
 * @ctrl_test_pattern: V4L2_CID_TEST_PATTERN control
 * @ctrl_colorfx: V4L2_CID_COLORFX control
 * @ctrl_colorfx_cbcr:  V4L2_CID_COLORFX_CBCR control
 * @test_pattern: test pattern
 * @colorfx:	  color effect
 * @colorfx_cb:   Cb value for V4L2_COLORFX_SET_CBCR
 * @colorfx_cr:   Cr value for V4L2_COLORFX_SET_CBCR
 * @vp:           video path (DMA) description (codec/preview)
 * @variant:      variant information for this device
 * @dev:	  pointer to the CAMIF device struct
 * @pdata:	  a copy of the driver's platform data
 * @clock:	  clocks required for the CAMIF operation
 * @lock:	  mutex protecting this data structure
 * @slock:	  spinlock protecting CAMIF registers
 * @io_base:	  start address of the mmapped CAMIF registers
 */
struct camif_dev {};

/**
 * struct camif_addr - Y/Cb/Cr DMA start address structure
 * @y:	 luminance plane dma address
 * @cb:	 Cb plane dma address
 * @cr:	 Cr plane dma address
 */
struct camif_addr {};

/**
 * struct camif_buffer - the camif video buffer structure
 * @vb:    vb2 buffer
 * @list:  list head for the buffers queue
 * @paddr: DMA start addresses
 * @index: an identifier of this buffer at the DMA engine
 */
struct camif_buffer {};

const struct camif_fmt *s3c_camif_find_format(struct camif_vp *vp,
	      const u32 *pixelformat, int index);
int s3c_camif_register_video_node(struct camif_dev *camif, int idx);
void s3c_camif_unregister_video_node(struct camif_dev *camif, int idx);
irqreturn_t s3c_camif_irq_handler(int irq, void *priv);
int s3c_camif_create_subdev(struct camif_dev *camif);
void s3c_camif_unregister_subdev(struct camif_dev *camif);
int s3c_camif_set_defaults(struct camif_dev *camif);
int s3c_camif_get_scaler_config(struct camif_vp *vp,
				struct camif_scaler *scaler);

static inline void camif_active_queue_add(struct camif_vp *vp,
					  struct camif_buffer *buf)
{}

static inline struct camif_buffer *camif_active_queue_pop(
					struct camif_vp *vp)
{}

static inline struct camif_buffer *camif_active_queue_peek(
			   struct camif_vp *vp, int index)
{}

static inline void camif_pending_queue_add(struct camif_vp *vp,
					   struct camif_buffer *buf)
{}

static inline struct camif_buffer *camif_pending_queue_pop(
					struct camif_vp *vp)
{}

#endif /* CAMIF_CORE_H_ */