#include <linux/module.h>
#include <linux/delay.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/platform_device.h>
#include <media/v4l2-mem2mem.h>
#include <media/v4l2-device.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/videobuf2-vmalloc.h>
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
MODULE_VERSION(…) …;
MODULE_ALIAS(…) …;
static unsigned int debug;
module_param(debug, uint, 0644);
MODULE_PARM_DESC(…) …;
static unsigned int default_transtime = …;
module_param(default_transtime, uint, 0644);
MODULE_PARM_DESC(…) …;
#define MIN_W …
#define MIN_H …
#define MAX_W …
#define MAX_H …
#define WIDTH_ALIGN …
#define HEIGHT_ALIGN …
#define BAYER_WIDTH_ALIGN …
#define BAYER_HEIGHT_ALIGN …
#define MEM2MEM_CAPTURE …
#define MEM2MEM_OUTPUT …
#define MEM2MEM_NAME …
#define MEM2MEM_DEF_NUM_BUFS …
#define MEM2MEM_VID_MEM_LIMIT …
#define MEM2MEM_HFLIP …
#define MEM2MEM_VFLIP …
#define dprintk(dev, lvl, fmt, arg...) …
static void vim2m_dev_release(struct device *dev)
{ … }
static struct platform_device vim2m_pdev = …;
struct vim2m_fmt { … };
static struct vim2m_fmt formats[] = …;
#define NUM_FORMATS …
struct vim2m_q_data { … };
enum { … };
#define V4L2_CID_TRANS_TIME_MSEC …
#define V4L2_CID_TRANS_NUM_BUFS …
static struct vim2m_fmt *find_format(u32 fourcc)
{ … }
static void get_alignment(u32 fourcc,
unsigned int *walign, unsigned int *halign)
{ … }
struct vim2m_dev { … };
struct vim2m_ctx { … };
static inline struct vim2m_ctx *file2ctx(struct file *file)
{ … }
static struct vim2m_q_data *get_q_data(struct vim2m_ctx *ctx,
enum v4l2_buf_type type)
{ … }
static const char *type_name(enum v4l2_buf_type type)
{ … }
#define CLIP(__color) …
static void copy_line(struct vim2m_q_data *q_data_out,
u8 *src, u8 *dst, bool reverse)
{ … }
static void copy_two_pixels(struct vim2m_q_data *q_data_in,
struct vim2m_q_data *q_data_out,
u8 *src[2], u8 **dst, int ypos, bool reverse)
{ … }
static int device_process(struct vim2m_ctx *ctx,
struct vb2_v4l2_buffer *in_vb,
struct vb2_v4l2_buffer *out_vb)
{ … }
static int job_ready(void *priv)
{ … }
static void job_abort(void *priv)
{ … }
static void device_run(void *priv)
{ … }
static void device_work(struct work_struct *w)
{ … }
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_enum_framesizes(struct file *file, void *priv,
struct v4l2_frmsizeenum *fsize)
{ … }
static int vidioc_g_fmt(struct vim2m_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, struct vim2m_fmt *fmt)
{ … }
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 vim2m_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 int vim2m_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops vim2m_ctrl_ops = …;
static const struct v4l2_ioctl_ops vim2m_ioctl_ops = …;
static int vim2m_queue_setup(struct vb2_queue *vq,
unsigned int *nbuffers,
unsigned int *nplanes,
unsigned int sizes[],
struct device *alloc_devs[])
{ … }
static int vim2m_buf_out_validate(struct vb2_buffer *vb)
{ … }
static int vim2m_buf_prepare(struct vb2_buffer *vb)
{ … }
static void vim2m_buf_queue(struct vb2_buffer *vb)
{ … }
static int vim2m_start_streaming(struct vb2_queue *q, unsigned int count)
{ … }
static void vim2m_stop_streaming(struct vb2_queue *q)
{ … }
static void vim2m_buf_request_complete(struct vb2_buffer *vb)
{ … }
static const struct vb2_ops vim2m_qops = …;
static int queue_init(void *priv, struct vb2_queue *src_vq,
struct vb2_queue *dst_vq)
{ … }
static struct v4l2_ctrl_config vim2m_ctrl_trans_time_msec = …;
static const struct v4l2_ctrl_config vim2m_ctrl_trans_num_bufs = …;
static int vim2m_open(struct file *file)
{ … }
static int vim2m_release(struct file *file)
{ … }
static void vim2m_device_release(struct video_device *vdev)
{ … }
static const struct v4l2_file_operations vim2m_fops = …;
static const struct video_device vim2m_videodev = …;
static const struct v4l2_m2m_ops m2m_ops = …;
static const struct media_device_ops m2m_media_ops = …;
static int vim2m_probe(struct platform_device *pdev)
{ … }
static void vim2m_remove(struct platform_device *pdev)
{ … }
static struct platform_driver vim2m_pdrv = …;
static void __exit vim2m_exit(void)
{ … }
static int __init vim2m_init(void)
{ … }
module_init(…) …;
module_exit(vim2m_exit);