#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>
#include "codec-v4l2-fwht.h"
MODULE_DESCRIPTION(…) …;
MODULE_AUTHOR(…) …;
MODULE_LICENSE(…) …;
static bool multiplanar;
module_param(multiplanar, bool, 0444);
MODULE_PARM_DESC(…) …;
static unsigned int debug;
module_param(debug, uint, 0644);
MODULE_PARM_DESC(…) …;
#define VICODEC_NAME …
#define MAX_WIDTH …
#define MIN_WIDTH …
#define MAX_HEIGHT …
#define MIN_HEIGHT …
#define dprintk(dev, fmt, arg...) …
struct pixfmt_info { … };
static const struct v4l2_fwht_pixfmt_info pixfmt_fwht = …;
static const struct v4l2_fwht_pixfmt_info pixfmt_stateless_fwht = …;
static void vicodec_dev_release(struct device *dev)
{ … }
static struct platform_device vicodec_pdev = …;
struct vicodec_q_data { … };
enum { … };
struct vicodec_dev_instance { … };
struct vicodec_dev { … };
struct vicodec_ctx { … };
static const struct v4l2_event vicodec_eos_event = …;
static inline struct vicodec_ctx *file2ctx(struct file *file)
{ … }
static struct vicodec_q_data *get_q_data(struct vicodec_ctx *ctx,
enum v4l2_buf_type type)
{ … }
static void copy_cap_to_ref(const u8 *cap, const struct v4l2_fwht_pixfmt_info *info,
struct v4l2_fwht_state *state)
{ … }
static bool validate_by_version(unsigned int flags, unsigned int version)
{ … }
static bool validate_stateless_params_flags(const struct v4l2_ctrl_fwht_params *params,
const struct v4l2_fwht_pixfmt_info *cur_info)
{ … }
static void update_state_from_header(struct vicodec_ctx *ctx)
{ … }
static int device_process(struct vicodec_ctx *ctx,
struct vb2_v4l2_buffer *src_vb,
struct vb2_v4l2_buffer *dst_vb)
{ … }
static enum vb2_buffer_state get_next_header(struct vicodec_ctx *ctx,
u8 **pp, u32 sz)
{ … }
static void device_run(void *priv)
{ … }
static void job_remove_src_buf(struct vicodec_ctx *ctx, u32 state)
{ … }
static const struct v4l2_fwht_pixfmt_info *
info_from_header(const struct fwht_cframe_hdr *p_hdr)
{ … }
static bool is_header_valid(const struct fwht_cframe_hdr *p_hdr)
{ … }
static void update_capture_data_from_header(struct vicodec_ctx *ctx)
{ … }
static void set_last_buffer(struct vb2_v4l2_buffer *dst_buf,
const struct vb2_v4l2_buffer *src_buf,
struct vicodec_ctx *ctx)
{ … }
static int job_ready(void *priv)
{ … }
static const struct v4l2_fwht_pixfmt_info *find_fmt(u32 fmt)
{ … }
static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{ … }
static int enum_fmt(struct v4l2_fmtdesc *f, struct vicodec_ctx *ctx,
bool is_out)
{ … }
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 vicodec_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 vicodec_ctx *ctx, 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 vicodec_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 vidioc_g_selection(struct file *file, void *priv,
struct v4l2_selection *s)
{ … }
static int vidioc_s_selection(struct file *file, void *priv,
struct v4l2_selection *s)
{ … }
static int vicodec_encoder_cmd(struct file *file, void *fh,
struct v4l2_encoder_cmd *ec)
{ … }
static int vicodec_decoder_cmd(struct file *file, void *fh,
struct v4l2_decoder_cmd *dc)
{ … }
static int vicodec_enum_framesizes(struct file *file, void *fh,
struct v4l2_frmsizeenum *fsize)
{ … }
static int vicodec_subscribe_event(struct v4l2_fh *fh,
const struct v4l2_event_subscription *sub)
{ … }
static const struct v4l2_ioctl_ops vicodec_ioctl_ops = …;
static int vicodec_queue_setup(struct vb2_queue *vq, unsigned int *nbuffers,
unsigned int *nplanes, unsigned int sizes[],
struct device *alloc_devs[])
{ … }
static int vicodec_buf_out_validate(struct vb2_buffer *vb)
{ … }
static int vicodec_buf_prepare(struct vb2_buffer *vb)
{ … }
static void vicodec_buf_queue(struct vb2_buffer *vb)
{ … }
static void vicodec_return_bufs(struct vb2_queue *q, u32 state)
{ … }
static unsigned int total_frame_size(struct vicodec_q_data *q_data)
{ … }
static int vicodec_start_streaming(struct vb2_queue *q,
unsigned int count)
{ … }
static void vicodec_stop_streaming(struct vb2_queue *q)
{ … }
static void vicodec_buf_request_complete(struct vb2_buffer *vb)
{ … }
static const struct vb2_ops vicodec_qops = …;
static int queue_init(void *priv, struct vb2_queue *src_vq,
struct vb2_queue *dst_vq)
{ … }
static int vicodec_try_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static void update_header_from_stateless_params(struct vicodec_ctx *ctx,
const struct v4l2_ctrl_fwht_params *params)
{ … }
static int vicodec_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops vicodec_ctrl_ops = …;
static const struct v4l2_ctrl_config vicodec_ctrl_stateless_state = …;
static int vicodec_open(struct file *file)
{ … }
static int vicodec_release(struct file *file)
{ … }
static int vicodec_request_validate(struct media_request *req)
{ … }
static const struct v4l2_file_operations vicodec_fops = …;
static const struct video_device vicodec_videodev = …;
static const struct media_device_ops vicodec_m2m_media_ops = …;
static const struct v4l2_m2m_ops m2m_ops = …;
static int register_instance(struct vicodec_dev *dev,
struct vicodec_dev_instance *dev_instance,
const char *name, bool is_enc, bool is_stateless)
{ … }
static void vicodec_v4l2_dev_release(struct v4l2_device *v4l2_dev)
{ … }
static int vicodec_probe(struct platform_device *pdev)
{ … }
static void vicodec_remove(struct platform_device *pdev)
{ … }
static struct platform_driver vicodec_pdrv = …;
static void __exit vicodec_exit(void)
{ … }
static int __init vicodec_init(void)
{ … }
module_init(…) …;
module_exit(vicodec_exit);