#include <linux/module.h>
#include <linux/workqueue.h>
#include <media/v4l2-common.h>
#include <media/v4l2-event.h>
#include <media/videobuf2-dma-contig.h>
#include "tw5864.h"
#include "tw5864-reg.h"
#define QUANTIZATION_TABLE_LEN …
#define VLC_LOOKUP_TABLE_LEN …
static const u16 forward_quantization_table[QUANTIZATION_TABLE_LEN] = …;
static const u16 inverse_quantization_table[QUANTIZATION_TABLE_LEN] = …;
static const u16 encoder_vlc_lookup_table[VLC_LOOKUP_TABLE_LEN] = …;
static const unsigned int lambda_lookup_table[] = …;
static const unsigned int intra4x4_lambda3[] = …;
static v4l2_std_id tw5864_get_v4l2_std(enum tw5864_vid_std std);
static enum tw5864_vid_std tw5864_from_v4l2_std(v4l2_std_id v4l2_std);
static void tw5864_handle_frame_work(struct work_struct *t);
static void tw5864_handle_frame(struct tw5864_h264_frame *frame);
static void tw5864_frame_interval_set(struct tw5864_input *input);
static int tw5864_queue_setup(struct vb2_queue *q, unsigned int *num_buffers,
unsigned int *num_planes, unsigned int sizes[],
struct device *alloc_ctxs[])
{ … }
static void tw5864_buf_queue(struct vb2_buffer *vb)
{ … }
static int tw5864_input_std_get(struct tw5864_input *input,
enum tw5864_vid_std *std)
{ … }
static int tw5864_enable_input(struct tw5864_input *input)
{ … }
void tw5864_request_encoded_frame(struct tw5864_input *input)
{ … }
static int tw5864_disable_input(struct tw5864_input *input)
{ … }
static int tw5864_start_streaming(struct vb2_queue *q, unsigned int count)
{ … }
static void tw5864_stop_streaming(struct vb2_queue *q)
{ … }
static const struct vb2_ops tw5864_video_qops = …;
static int tw5864_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static int tw5864_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int tw5864_enum_input(struct file *file, void *priv,
struct v4l2_input *i)
{ … }
static int tw5864_g_input(struct file *file, void *priv, unsigned int *i)
{ … }
static int tw5864_s_input(struct file *file, void *priv, unsigned int i)
{ … }
static int tw5864_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{ … }
static int tw5864_querystd(struct file *file, void *priv, v4l2_std_id *std)
{ … }
static int tw5864_g_std(struct file *file, void *priv, v4l2_std_id *std)
{ … }
static int tw5864_s_std(struct file *file, void *priv, v4l2_std_id std)
{ … }
static int tw5864_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{ … }
static int tw5864_subscribe_event(struct v4l2_fh *fh,
const struct v4l2_event_subscription *sub)
{ … }
static void tw5864_frame_interval_set(struct tw5864_input *input)
{ … }
static int tw5864_frameinterval_get(struct tw5864_input *input,
struct v4l2_fract *frameinterval)
{ … }
static int tw5864_enum_framesizes(struct file *file, void *priv,
struct v4l2_frmsizeenum *fsize)
{ … }
static int tw5864_enum_frameintervals(struct file *file, void *priv,
struct v4l2_frmivalenum *fintv)
{ … }
static int tw5864_g_parm(struct file *file, void *priv,
struct v4l2_streamparm *sp)
{ … }
static int tw5864_s_parm(struct file *file, void *priv,
struct v4l2_streamparm *sp)
{ … }
static const struct v4l2_ctrl_ops tw5864_ctrl_ops = …;
static const struct v4l2_file_operations video_fops = …;
#ifdef CONFIG_VIDEO_ADV_DEBUG
#define INDIR_SPACE_MAP_SHIFT …
static int tw5864_g_reg(struct file *file, void *fh,
struct v4l2_dbg_register *reg)
{ … }
static int tw5864_s_reg(struct file *file, void *fh,
const struct v4l2_dbg_register *reg)
{ … }
#endif
static const struct v4l2_ioctl_ops video_ioctl_ops = …;
static const struct video_device tw5864_video_template = …;
static const struct v4l2_ctrl_config tw5864_md_thresholds = …;
static int tw5864_video_input_init(struct tw5864_input *dev, int video_nr);
static void tw5864_video_input_fini(struct tw5864_input *dev);
static void tw5864_encoder_tables_upload(struct tw5864_dev *dev);
int tw5864_video_init(struct tw5864_dev *dev, int *video_nr)
{ … }
static int tw5864_video_input_init(struct tw5864_input *input, int video_nr)
{ … }
static void tw5864_video_input_fini(struct tw5864_input *dev)
{ … }
void tw5864_video_fini(struct tw5864_dev *dev)
{ … }
void tw5864_prepare_frame_headers(struct tw5864_input *input)
{ … }
static unsigned int tw5864_md_metric_from_mvd(u32 mvd)
{ … }
static int tw5864_is_motion_triggered(struct tw5864_h264_frame *frame)
{ … }
static void tw5864_handle_frame_work(struct work_struct *t)
{ … }
#ifdef DEBUG
static u32 tw5864_vlc_checksum(u32 *data, int len)
{
u32 val, count_len = len;
val = *data++;
while (((count_len >> 2) - 1) > 0) {
val ^= *data++;
count_len -= 4;
}
val ^= htonl((len >> 2));
return val;
}
#endif
static void tw5864_handle_frame(struct tw5864_h264_frame *frame)
{ … }
static v4l2_std_id tw5864_get_v4l2_std(enum tw5864_vid_std std)
{ … }
static enum tw5864_vid_std tw5864_from_v4l2_std(v4l2_std_id v4l2_std)
{ … }
static void tw5864_encoder_tables_upload(struct tw5864_dev *dev)
{ … }