#include <linux/ioctl.h>
#include <linux/pm_runtime.h>
#include <linux/videodev2.h>
#include <media/media-device.h>
#include <media/v4l2-common.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-fh.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-core.h>
#include <media/videobuf2-dma-contig.h>
#include "cal.h"
static char *fourcc_to_str(u32 fmt)
{ … }
static int cal_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{ … }
static int cal_g_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static const struct cal_format_info *find_format_by_pix(struct cal_ctx *ctx,
u32 pixelformat)
{ … }
static const struct cal_format_info *find_format_by_code(struct cal_ctx *ctx,
u32 code)
{ … }
static int cal_legacy_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{ … }
static int __subdev_get_format(struct cal_ctx *ctx,
struct v4l2_mbus_framefmt *fmt)
{ … }
static int __subdev_set_format(struct cal_ctx *ctx,
struct v4l2_mbus_framefmt *fmt)
{ … }
static void cal_calc_format_size(struct cal_ctx *ctx,
const struct cal_format_info *fmtinfo,
struct v4l2_format *f)
{ … }
static int cal_legacy_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int cal_legacy_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int cal_legacy_enum_framesizes(struct file *file, void *fh,
struct v4l2_frmsizeenum *fsize)
{ … }
static int cal_legacy_enum_input(struct file *file, void *priv,
struct v4l2_input *inp)
{ … }
static int cal_legacy_g_input(struct file *file, void *priv, unsigned int *i)
{ … }
static int cal_legacy_s_input(struct file *file, void *priv, unsigned int i)
{ … }
static int cal_legacy_enum_frameintervals(struct file *file, void *priv,
struct v4l2_frmivalenum *fival)
{ … }
static int cal_legacy_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
{ … }
static int cal_legacy_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
{ … }
static const struct v4l2_ioctl_ops cal_ioctl_legacy_ops = …;
static int cal_mc_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{ … }
static void cal_mc_try_fmt(struct cal_ctx *ctx, struct v4l2_format *f,
const struct cal_format_info **info)
{ … }
static int cal_mc_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int cal_mc_s_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int cal_mc_enum_framesizes(struct file *file, void *fh,
struct v4l2_frmsizeenum *fsize)
{ … }
static const struct v4l2_ioctl_ops cal_ioctl_mc_ops = …;
static int cal_queue_setup(struct vb2_queue *vq,
unsigned int *nbuffers, unsigned int *nplanes,
unsigned int sizes[], struct device *alloc_devs[])
{ … }
static int cal_buffer_prepare(struct vb2_buffer *vb)
{ … }
static void cal_buffer_queue(struct vb2_buffer *vb)
{ … }
static void cal_release_buffers(struct cal_ctx *ctx,
enum vb2_buffer_state state)
{ … }
static int cal_video_check_format(struct cal_ctx *ctx)
{ … }
static int cal_start_streaming(struct vb2_queue *vq, unsigned int count)
{ … }
static void cal_stop_streaming(struct vb2_queue *vq)
{ … }
static const struct vb2_ops cal_video_qops = …;
static const struct v4l2_file_operations cal_fops = …;
static int cal_ctx_v4l2_init_formats(struct cal_ctx *ctx)
{ … }
static int cal_ctx_v4l2_init_mc_format(struct cal_ctx *ctx)
{ … }
int cal_ctx_v4l2_register(struct cal_ctx *ctx)
{ … }
void cal_ctx_v4l2_unregister(struct cal_ctx *ctx)
{ … }
int cal_ctx_v4l2_init(struct cal_ctx *ctx)
{ … }
void cal_ctx_v4l2_cleanup(struct cal_ctx *ctx)
{ … }