#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-event.h>
#include <media/v4l2-mem2mem.h>
#include "hantro.h"
#include "hantro_hw.h"
#include "hantro_v4l2.h"
#define HANTRO_DEFAULT_BIT_DEPTH …
static int hantro_set_fmt_out(struct hantro_ctx *ctx,
struct v4l2_pix_format_mplane *pix_mp,
bool need_postproc);
static int hantro_set_fmt_cap(struct hantro_ctx *ctx,
struct v4l2_pix_format_mplane *pix_mp);
static const struct hantro_fmt *
hantro_get_formats(const struct hantro_ctx *ctx, unsigned int *num_fmts, bool need_postproc)
{ … }
static const struct hantro_fmt *
hantro_get_postproc_formats(const struct hantro_ctx *ctx,
unsigned int *num_fmts)
{ … }
int hantro_get_format_depth(u32 fourcc)
{ … }
static bool
hantro_check_depth_match(const struct hantro_fmt *fmt, int bit_depth)
{ … }
static const struct hantro_fmt *
hantro_find_format(const struct hantro_ctx *ctx, u32 fourcc)
{ … }
const struct hantro_fmt *
hantro_get_default_fmt(const struct hantro_ctx *ctx, bool bitstream,
int bit_depth, bool need_postproc)
{ … }
static int vidioc_querycap(struct file *file, void *priv,
struct v4l2_capability *cap)
{ … }
static int vidioc_enum_framesizes(struct file *file, void *priv,
struct v4l2_frmsizeenum *fsize)
{ … }
static int vidioc_enum_fmt(struct file *file, void *priv,
struct v4l2_fmtdesc *f, bool capture)
{ … }
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_out_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int vidioc_g_fmt_cap_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int hantro_try_fmt(const struct hantro_ctx *ctx,
struct v4l2_pix_format_mplane *pix_mp,
enum v4l2_buf_type type)
{ … }
static int vidioc_try_fmt_cap_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static int vidioc_try_fmt_out_mplane(struct file *file, void *priv,
struct v4l2_format *f)
{ … }
static void
hantro_reset_fmt(struct v4l2_pix_format_mplane *fmt,
const struct hantro_fmt *vpu_fmt)
{ … }
static void
hantro_reset_encoded_fmt(struct hantro_ctx *ctx)
{ … }
int
hantro_reset_raw_fmt(struct hantro_ctx *ctx, int bit_depth, bool need_postproc)
{ … }
void hantro_reset_fmts(struct hantro_ctx *ctx)
{ … }
static void
hantro_update_requires_request(struct hantro_ctx *ctx, u32 fourcc)
{ … }
static void
hantro_update_requires_hold_capture_buf(struct hantro_ctx *ctx, u32 fourcc)
{ … }
static int hantro_set_fmt_out(struct hantro_ctx *ctx,
struct v4l2_pix_format_mplane *pix_mp,
bool need_postproc)
{ … }
static int hantro_set_fmt_cap(struct hantro_ctx *ctx,
struct v4l2_pix_format_mplane *pix_mp)
{ … }
static int
vidioc_s_fmt_out_mplane(struct file *file, void *priv, struct v4l2_format *f)
{ … }
static int
vidioc_s_fmt_cap_mplane(struct file *file, void *priv, struct v4l2_format *f)
{ … }
static int vidioc_g_selection(struct file *file, void *priv,
struct v4l2_selection *sel)
{ … }
static int vidioc_s_selection(struct file *file, void *priv,
struct v4l2_selection *sel)
{ … }
static const struct v4l2_event hantro_eos_event = …;
static int vidioc_encoder_cmd(struct file *file, void *priv,
struct v4l2_encoder_cmd *ec)
{ … }
const struct v4l2_ioctl_ops hantro_ioctl_ops = …;
static int
hantro_queue_setup(struct vb2_queue *vq, unsigned int *num_buffers,
unsigned int *num_planes, unsigned int sizes[],
struct device *alloc_devs[])
{ … }
static int
hantro_buf_plane_check(struct vb2_buffer *vb,
struct v4l2_pix_format_mplane *pixfmt)
{ … }
static int hantro_buf_prepare(struct vb2_buffer *vb)
{ … }
static void hantro_buf_queue(struct vb2_buffer *vb)
{ … }
static bool hantro_vq_is_coded(struct vb2_queue *q)
{ … }
static int hantro_start_streaming(struct vb2_queue *q, unsigned int count)
{ … }
static void
hantro_return_bufs(struct vb2_queue *q,
struct vb2_v4l2_buffer *(*buf_remove)(struct v4l2_m2m_ctx *))
{ … }
static void hantro_stop_streaming(struct vb2_queue *q)
{ … }
static void hantro_buf_request_complete(struct vb2_buffer *vb)
{ … }
static int hantro_buf_out_validate(struct vb2_buffer *vb)
{ … }
const struct vb2_ops hantro_queue_ops = …;