#include <linux/clk.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <linux/workqueue.h>
#include <media/v4l2-event.h>
#include <media/v4l2-mem2mem.h>
#include <media/videobuf2-core.h>
#include <media/videobuf2-vmalloc.h>
#include "hantro_v4l2.h"
#include "hantro.h"
#include "hantro_hw.h"
#define DRIVER_NAME …
int hantro_debug;
module_param_named(debug, hantro_debug, int, 0644);
MODULE_PARM_DESC(…) …;
void *hantro_get_ctrl(struct hantro_ctx *ctx, u32 id)
{ … }
dma_addr_t hantro_get_ref(struct hantro_ctx *ctx, u64 ts)
{ … }
static const struct v4l2_event hantro_eos_event = …;
static void hantro_job_finish_no_pm(struct hantro_dev *vpu,
struct hantro_ctx *ctx,
enum vb2_buffer_state result)
{ … }
static void hantro_job_finish(struct hantro_dev *vpu,
struct hantro_ctx *ctx,
enum vb2_buffer_state result)
{ … }
void hantro_irq_done(struct hantro_dev *vpu,
enum vb2_buffer_state result)
{ … }
void hantro_watchdog(struct work_struct *work)
{ … }
void hantro_start_prepare_run(struct hantro_ctx *ctx)
{ … }
void hantro_end_prepare_run(struct hantro_ctx *ctx)
{ … }
static void device_run(void *priv)
{ … }
static const struct v4l2_m2m_ops vpu_m2m_ops = …;
static int
queue_init(void *priv, struct vb2_queue *src_vq, struct vb2_queue *dst_vq)
{ … }
static int hantro_try_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static int hantro_jpeg_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static int hantro_vp9_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static int hantro_hevc_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static int hantro_av1_s_ctrl(struct v4l2_ctrl *ctrl)
{ … }
static const struct v4l2_ctrl_ops hantro_ctrl_ops = …;
static const struct v4l2_ctrl_ops hantro_jpeg_ctrl_ops = …;
static const struct v4l2_ctrl_ops hantro_vp9_ctrl_ops = …;
static const struct v4l2_ctrl_ops hantro_hevc_ctrl_ops = …;
static const struct v4l2_ctrl_ops hantro_av1_ctrl_ops = …;
#define HANTRO_JPEG_ACTIVE_MARKERS …
static const struct hantro_ctrl controls[] = …;
static int hantro_ctrls_setup(struct hantro_dev *vpu,
struct hantro_ctx *ctx,
int allowed_codecs)
{ … }
static int hantro_open(struct file *filp)
{ … }
static int hantro_release(struct file *filp)
{ … }
static const struct v4l2_file_operations hantro_fops = …;
static const struct of_device_id of_hantro_match[] = …;
MODULE_DEVICE_TABLE(of, of_hantro_match);
static int hantro_register_entity(struct media_device *mdev,
struct media_entity *entity,
const char *entity_name,
struct media_pad *pads, int num_pads,
int function, struct video_device *vdev)
{ … }
static int hantro_attach_func(struct hantro_dev *vpu,
struct hantro_func *func)
{ … }
static void hantro_detach_func(struct hantro_func *func)
{ … }
static int hantro_add_func(struct hantro_dev *vpu, unsigned int funcid)
{ … }
static int hantro_add_enc_func(struct hantro_dev *vpu)
{ … }
static int hantro_add_dec_func(struct hantro_dev *vpu)
{ … }
static void hantro_remove_func(struct hantro_dev *vpu,
unsigned int funcid)
{ … }
static void hantro_remove_enc_func(struct hantro_dev *vpu)
{ … }
static void hantro_remove_dec_func(struct hantro_dev *vpu)
{ … }
static const struct media_device_ops hantro_m2m_media_ops = …;
static int hantro_probe(struct platform_device *pdev)
{ … }
static void hantro_remove(struct platform_device *pdev)
{ … }
#ifdef CONFIG_PM
static int hantro_runtime_resume(struct device *dev)
{ … }
#endif
static const struct dev_pm_ops hantro_pm_ops = …;
static struct platform_driver hantro_driver = …;
module_platform_driver(…) …;
MODULE_LICENSE(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;