#include <linux/module.h>
#include <linux/clk.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/platform_device.h>
#include <media/v4l2-mem2mem.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-dma-contig.h>
#include <linux/sizes.h>
#define EMMAPRP_MODULE_NAME …
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_VERSION(…) …;
static bool debug;
module_param(debug, bool, 0644);
#define MIN_W …
#define MIN_H …
#define MAX_W …
#define MAX_H …
#define S_ALIGN …
#define W_ALIGN_YUV420 …
#define W_ALIGN_OTHERS …
#define H_ALIGN …
#define MEM2MEM_CAPTURE …
#define MEM2MEM_OUTPUT …
#define MEM2MEM_NAME …
#define MEM2MEM_VID_MEM_LIMIT …
#define dprintk(dev, fmt, arg...) …
#define PRP_CNTL …
#define PRP_INTR_CNTL …
#define PRP_INTRSTATUS …
#define PRP_SOURCE_Y_PTR …
#define PRP_SOURCE_CB_PTR …
#define PRP_SOURCE_CR_PTR …
#define PRP_DEST_RGB1_PTR …
#define PRP_DEST_RGB2_PTR …
#define PRP_DEST_Y_PTR …
#define PRP_DEST_CB_PTR …
#define PRP_DEST_CR_PTR …
#define PRP_SRC_FRAME_SIZE …
#define PRP_DEST_CH1_LINE_STRIDE …
#define PRP_SRC_PIXEL_FORMAT_CNTL …
#define PRP_CH1_PIXEL_FORMAT_CNTL …
#define PRP_CH1_OUT_IMAGE_SIZE …
#define PRP_CH2_OUT_IMAGE_SIZE …
#define PRP_SRC_LINE_STRIDE …
#define PRP_CSC_COEF_012 …
#define PRP_CSC_COEF_345 …
#define PRP_CSC_COEF_678 …
#define PRP_CH1_RZ_HORI_COEF1 …
#define PRP_CH1_RZ_HORI_COEF2 …
#define PRP_CH1_RZ_HORI_VALID …
#define PRP_CH1_RZ_VERT_COEF1 …
#define PRP_CH1_RZ_VERT_COEF2 …
#define PRP_CH1_RZ_VERT_VALID …
#define PRP_CH2_RZ_HORI_COEF1 …
#define PRP_CH2_RZ_HORI_COEF2 …
#define PRP_CH2_RZ_HORI_VALID …
#define PRP_CH2_RZ_VERT_COEF1 …
#define PRP_CH2_RZ_VERT_COEF2 …
#define PRP_CH2_RZ_VERT_VALID …
#define PRP_CNTL_CH1EN …
#define PRP_CNTL_CH2EN …
#define PRP_CNTL_CSIEN …
#define PRP_CNTL_DATA_IN_YUV420 …
#define PRP_CNTL_DATA_IN_YUV422 …
#define PRP_CNTL_DATA_IN_RGB16 …
#define PRP_CNTL_DATA_IN_RGB32 …
#define PRP_CNTL_CH1_OUT_RGB8 …
#define PRP_CNTL_CH1_OUT_RGB16 …
#define PRP_CNTL_CH1_OUT_RGB32 …
#define PRP_CNTL_CH1_OUT_YUV422 …
#define PRP_CNTL_CH2_OUT_YUV420 …
#define PRP_CNTL_CH2_OUT_YUV422 …
#define PRP_CNTL_CH2_OUT_YUV444 …
#define PRP_CNTL_CH1_LEN …
#define PRP_CNTL_CH2_LEN …
#define PRP_CNTL_SKIP_FRAME …
#define PRP_CNTL_SWRST …
#define PRP_CNTL_CLKEN …
#define PRP_CNTL_WEN …
#define PRP_CNTL_CH1BYP …
#define PRP_CNTL_IN_TSKIP(x) …
#define PRP_CNTL_CH1_TSKIP(x) …
#define PRP_CNTL_CH2_TSKIP(x) …
#define PRP_CNTL_INPUT_FIFO_LEVEL(x) …
#define PRP_CNTL_RZ_FIFO_LEVEL(x) …
#define PRP_CNTL_CH2B1EN …
#define PRP_CNTL_CH2B2EN …
#define PRP_CNTL_CH2FEN …
#define PRP_SIZE_HEIGHT(x) …
#define PRP_SIZE_WIDTH(x) …
#define PRP_INTR_RDERR …
#define PRP_INTR_CH1WERR …
#define PRP_INTR_CH2WERR …
#define PRP_INTR_CH1FC …
#define PRP_INTR_CH2FC …
#define PRP_INTR_LBOVF …
#define PRP_INTR_CH2OVF …
#define PRP_INTR_ST_RDERR …
#define PRP_INTR_ST_CH1WERR …
#define PRP_INTR_ST_CH2WERR …
#define PRP_INTR_ST_CH2B2CI …
#define PRP_INTR_ST_CH2B1CI …
#define PRP_INTR_ST_CH1B2CI …
#define PRP_INTR_ST_CH1B1CI …
#define PRP_INTR_ST_LBOVF …
#define PRP_INTR_ST_CH2OVF …
struct emmaprp_fmt { … };
static struct emmaprp_fmt formats[] = …;
struct emmaprp_q_data { … };
enum { … };
#define NUM_FORMATS …
static struct emmaprp_fmt *find_format(struct v4l2_format *f)
{ … }
struct emmaprp_dev { … };
struct emmaprp_ctx { … };
static struct emmaprp_q_data *get_q_data(struct emmaprp_ctx *ctx,
enum v4l2_buf_type type)
{ … }
static void emmaprp_job_abort(void *priv)
{ … }
static inline void emmaprp_dump_regs(struct emmaprp_dev *pcdev)
{ … }
static void emmaprp_device_run(void *priv)
{ … }
static irqreturn_t emmaprp_irq(int irq_emma, void *data)
{ … }
static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{ … }
static int enum_fmt(struct v4l2_fmtdesc *f, u32 type)
{ … }
static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{ … }
static int vidioc_enum_fmt_vid_out(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{ … }
static int vidioc_g_fmt(struct emmaprp_ctx *ctx, struct v4l2_format *f)
{ … }
static int vidioc_g_fmt_vid_out(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int vidioc_try_fmt(struct v4l2_format *f)
{ … }
static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int vidioc_try_fmt_vid_out(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int vidioc_s_fmt(struct emmaprp_ctx *ctx, struct v4l2_format *f)
{ … }
static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int vidioc_s_fmt_vid_out(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static const struct v4l2_ioctl_ops emmaprp_ioctl_ops = …;
static int emmaprp_queue_setup(struct vb2_queue *vq,
unsigned int *nbuffers, unsigned int *nplanes,
unsigned int sizes[], struct device *alloc_devs[])
{ … }
static int emmaprp_buf_prepare(struct vb2_buffer *vb)
{ … }
static void emmaprp_buf_queue(struct vb2_buffer *vb)
{ … }
static const struct vb2_ops emmaprp_qops = …;
static int queue_init(void *priv, struct vb2_queue *src_vq,
struct vb2_queue *dst_vq)
{ … }
static int emmaprp_open(struct file *file)
{ … }
static int emmaprp_release(struct file *file)
{ … }
static const struct v4l2_file_operations emmaprp_fops = …;
static const struct video_device emmaprp_videodev = …;
static const struct v4l2_m2m_ops m2m_ops = …;
static int emmaprp_probe(struct platform_device *pdev)
{ … }
static void emmaprp_remove(struct platform_device *pdev)
{ … }
static struct platform_driver emmaprp_pdrv = …;
module_platform_driver(…) …;