#include <linux/init.h>
#include <linux/delay.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <media/v4l2-common.h>
#include <media/v4l2-event.h>
#include <media/videobuf2-dma-contig.h>
#include <media/videobuf2-dma-sg.h>
#include <media/videobuf2-vmalloc.h>
#include "tw686x.h"
#include "tw686x-regs.h"
#define TW686X_INPUTS_PER_CH …
#define TW686X_VIDEO_WIDTH …
#define TW686X_VIDEO_HEIGHT(id) …
#define TW686X_MAX_FPS(id) …
#define TW686X_MAX_SG_ENTRY_SIZE …
#define TW686X_MAX_SG_DESC_COUNT …
#define TW686X_SG_TABLE_SIZE …
static const struct tw686x_format formats[] = …;
static void tw686x_buf_done(struct tw686x_video_channel *vc,
unsigned int pb)
{ … }
static void tw686x_memcpy_dma_free(struct tw686x_video_channel *vc,
unsigned int pb)
{ … }
static int tw686x_memcpy_dma_alloc(struct tw686x_video_channel *vc,
unsigned int pb)
{ … }
static void tw686x_memcpy_buf_refill(struct tw686x_video_channel *vc,
unsigned int pb)
{ … }
static const struct tw686x_dma_ops memcpy_dma_ops = …;
static void tw686x_contig_buf_refill(struct tw686x_video_channel *vc,
unsigned int pb)
{ … }
static const struct tw686x_dma_ops contig_dma_ops = …;
static int tw686x_sg_desc_fill(struct tw686x_sg_desc *descs,
struct tw686x_v4l2_buf *buf,
unsigned int buf_len)
{ … }
static void tw686x_sg_buf_refill(struct tw686x_video_channel *vc,
unsigned int pb)
{ … }
static void tw686x_sg_dma_free(struct tw686x_video_channel *vc,
unsigned int pb)
{ … }
static int tw686x_sg_dma_alloc(struct tw686x_video_channel *vc,
unsigned int pb)
{ … }
static int tw686x_sg_setup(struct tw686x_dev *dev)
{ … }
static const struct tw686x_dma_ops sg_dma_ops = …;
static const unsigned int fps_map[15] = …;
static unsigned int tw686x_real_fps(unsigned int index, unsigned int max_fps)
{ … }
static unsigned int tw686x_fps_idx(unsigned int fps, unsigned int max_fps)
{ … }
static void tw686x_set_framerate(struct tw686x_video_channel *vc,
unsigned int fps)
{ … }
static const struct tw686x_format *format_by_fourcc(unsigned int fourcc)
{ … }
static int tw686x_queue_setup(struct vb2_queue *vq,
unsigned int *nbuffers, unsigned int *nplanes,
unsigned int sizes[], struct device *alloc_devs[])
{ … }
static void tw686x_buf_queue(struct vb2_buffer *vb)
{ … }
static void tw686x_clear_queue(struct tw686x_video_channel *vc,
enum vb2_buffer_state state)
{ … }
static int tw686x_start_streaming(struct vb2_queue *vq, unsigned int count)
{ … }
static void tw686x_stop_streaming(struct vb2_queue *vq)
{ … }
static int tw686x_buf_prepare(struct vb2_buffer *vb)
{ … }
static const struct vb2_ops tw686x_video_qops = …;
static int tw686x_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops ctrl_ops = …;
static int tw686x_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int tw686x_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int tw686x_set_format(struct tw686x_video_channel *vc,
unsigned int pixelformat, unsigned int width,
unsigned int height, bool realloc)
{ … }
static int tw686x_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int tw686x_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{ … }
static int tw686x_set_standard(struct tw686x_video_channel *vc, v4l2_std_id id)
{ … }
static int tw686x_s_std(struct file *file, void *priv, v4l2_std_id id)
{ … }
static int tw686x_querystd(struct file *file, void *priv, v4l2_std_id *std)
{ … }
static int tw686x_g_std(struct file *file, void *priv, v4l2_std_id *id)
{ … }
static int tw686x_enum_framesizes(struct file *file, void *priv,
struct v4l2_frmsizeenum *fsize)
{ … }
static int tw686x_enum_frameintervals(struct file *file, void *priv,
struct v4l2_frmivalenum *ival)
{ … }
static int tw686x_g_parm(struct file *file, void *priv,
struct v4l2_streamparm *sp)
{ … }
static int tw686x_s_parm(struct file *file, void *priv,
struct v4l2_streamparm *sp)
{ … }
static int tw686x_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{ … }
static void tw686x_set_input(struct tw686x_video_channel *vc, unsigned int i)
{ … }
static int tw686x_s_input(struct file *file, void *priv, unsigned int i)
{ … }
static int tw686x_g_input(struct file *file, void *priv, unsigned int *i)
{ … }
static int tw686x_enum_input(struct file *file, void *priv,
struct v4l2_input *i)
{ … }
static const struct v4l2_file_operations tw686x_video_fops = …;
static const struct v4l2_ioctl_ops tw686x_video_ioctl_ops = …;
void tw686x_video_irq(struct tw686x_dev *dev, unsigned long requests,
unsigned int pb_status, unsigned int fifo_status,
unsigned int *reset_ch)
{ … }
void tw686x_video_free(struct tw686x_dev *dev)
{ … }
int tw686x_video_init(struct tw686x_dev *dev)
{ … }