linux/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2016 MediaTek Inc.
 * Author: Ming Hsiu Tsai <[email protected]>
 *         Rick Chang <[email protected]>
 *         Xia Jiang <[email protected]>
 */

#include <linux/clk.h>
#include <linux/err.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <media/v4l2-event.h>
#include <media/v4l2-mem2mem.h>
#include <media/v4l2-ioctl.h>
#include <media/videobuf2-core.h>
#include <media/videobuf2-dma-contig.h>

#include "mtk_jpeg_enc_hw.h"
#include "mtk_jpeg_dec_hw.h"
#include "mtk_jpeg_core.h"
#include "mtk_jpeg_dec_parse.h"

static struct mtk_jpeg_fmt mtk_jpeg_enc_formats[] =;

static struct mtk_jpeg_fmt mtk_jpeg_dec_formats[] =;

#define MTK_JPEG_ENC_NUM_FORMATS
#define MTK_JPEG_DEC_NUM_FORMATS
#define MTK_JPEG_MAX_RETRY_TIME

enum {};

static int debug;
module_param(debug, int, 0644);

static inline struct mtk_jpeg_ctx *ctrl_to_ctx(struct v4l2_ctrl *ctrl)
{}

static inline struct mtk_jpeg_ctx *mtk_jpeg_fh_to_ctx(struct v4l2_fh *fh)
{}

static inline struct mtk_jpeg_src_buf *mtk_jpeg_vb2_to_srcbuf(
							struct vb2_buffer *vb)
{}

static int mtk_jpeg_querycap(struct file *file, void *priv,
			     struct v4l2_capability *cap)
{}

static int vidioc_jpeg_enc_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops mtk_jpeg_enc_ctrl_ops =;

static int mtk_jpeg_enc_ctrls_setup(struct mtk_jpeg_ctx *ctx)
{}

static int mtk_jpeg_enum_fmt(struct mtk_jpeg_fmt *mtk_jpeg_formats, int n,
			     struct v4l2_fmtdesc *f, u32 type)
{}

static int mtk_jpeg_enum_fmt_vid_cap(struct file *file, void *priv,
				     struct v4l2_fmtdesc *f)
{}

static int mtk_jpeg_enum_fmt_vid_out(struct file *file, void *priv,
				     struct v4l2_fmtdesc *f)
{}

static struct mtk_jpeg_q_data *mtk_jpeg_get_q_data(struct mtk_jpeg_ctx *ctx,
						   enum v4l2_buf_type type)
{}

static struct mtk_jpeg_fmt *
mtk_jpeg_find_format(struct mtk_jpeg_fmt *mtk_jpeg_formats, int num_formats,
		     u32 pixelformat, unsigned int fmt_type)
{}

static int mtk_jpeg_try_fmt_mplane(struct v4l2_pix_format_mplane *pix_mp,
				   struct mtk_jpeg_fmt *fmt)
{}

static int mtk_jpeg_g_fmt_vid_mplane(struct file *file, void *priv,
				     struct v4l2_format *f)
{}

static int mtk_jpeg_try_fmt_vid_cap_mplane(struct file *file, void *priv,
					   struct v4l2_format *f)
{}

static int mtk_jpeg_try_fmt_vid_out_mplane(struct file *file, void *priv,
					   struct v4l2_format *f)
{}

static int mtk_jpeg_s_fmt_mplane(struct mtk_jpeg_ctx *ctx,
				 struct v4l2_format *f, unsigned int fmt_type)
{}

static int mtk_jpeg_s_fmt_vid_out_mplane(struct file *file, void *priv,
					 struct v4l2_format *f)
{}

static int mtk_jpeg_s_fmt_vid_cap_mplane(struct file *file, void *priv,
					 struct v4l2_format *f)
{}

static void mtk_jpeg_queue_src_chg_event(struct mtk_jpeg_ctx *ctx)
{}

static int mtk_jpeg_subscribe_event(struct v4l2_fh *fh,
				    const struct v4l2_event_subscription *sub)
{}

static int mtk_jpeg_enc_g_selection(struct file *file, void *priv,
				    struct v4l2_selection *s)
{}

static int mtk_jpeg_dec_g_selection(struct file *file, void *priv,
				    struct v4l2_selection *s)
{}

static int mtk_jpeg_enc_s_selection(struct file *file, void *priv,
				    struct v4l2_selection *s)
{}

static int mtk_jpeg_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
{}

static const struct v4l2_ioctl_ops mtk_jpeg_enc_ioctl_ops =;

static const struct v4l2_ioctl_ops mtk_jpeg_dec_ioctl_ops =;

static int mtk_jpeg_queue_setup(struct vb2_queue *q,
				unsigned int *num_buffers,
				unsigned int *num_planes,
				unsigned int sizes[],
				struct device *alloc_ctxs[])
{}

static int mtk_jpeg_buf_prepare(struct vb2_buffer *vb)
{}

static bool mtk_jpeg_check_resolution_change(struct mtk_jpeg_ctx *ctx,
					     struct mtk_jpeg_dec_param *param)
{}

static void mtk_jpeg_set_queue_data(struct mtk_jpeg_ctx *ctx,
				    struct mtk_jpeg_dec_param *param)
{}

static void mtk_jpeg_enc_buf_queue(struct vb2_buffer *vb)
{}

static void mtk_jpeg_dec_buf_queue(struct vb2_buffer *vb)
{}

static struct vb2_v4l2_buffer *mtk_jpeg_buf_remove(struct mtk_jpeg_ctx *ctx,
				 enum v4l2_buf_type type)
{}

static void mtk_jpeg_enc_stop_streaming(struct vb2_queue *q)
{}

static void mtk_jpeg_dec_stop_streaming(struct vb2_queue *q)
{}

static const struct vb2_ops mtk_jpeg_dec_qops =;

static const struct vb2_ops mtk_jpeg_enc_qops =;

static void mtk_jpeg_set_dec_src(struct mtk_jpeg_ctx *ctx,
				 struct vb2_buffer *src_buf,
				 struct mtk_jpeg_bs *bs)
{}

static int mtk_jpeg_set_dec_dst(struct mtk_jpeg_ctx *ctx,
				struct mtk_jpeg_dec_param *param,
				struct vb2_buffer *dst_buf,
				struct mtk_jpeg_fb *fb)
{}

static void mtk_jpeg_enc_device_run(void *priv)
{}

static void mtk_jpeg_multicore_enc_device_run(void *priv)
{}

static void mtk_jpeg_multicore_dec_device_run(void *priv)
{}

static void mtk_jpeg_dec_device_run(void *priv)
{}

static int mtk_jpeg_dec_job_ready(void *priv)
{}

static const struct v4l2_m2m_ops mtk_jpeg_enc_m2m_ops =;

static const struct v4l2_m2m_ops mtk_jpeg_multicore_enc_m2m_ops =;

static const struct v4l2_m2m_ops mtk_jpeg_multicore_dec_m2m_ops =;

static const struct v4l2_m2m_ops mtk_jpeg_dec_m2m_ops =;

static int mtk_jpeg_queue_init(void *priv, struct vb2_queue *src_vq,
			       struct vb2_queue *dst_vq)
{}

static void mtk_jpeg_clk_on(struct mtk_jpeg_dev *jpeg)
{}

static void mtk_jpeg_clk_off(struct mtk_jpeg_dev *jpeg)
{}

static void mtk_jpeg_set_default_params(struct mtk_jpeg_ctx *ctx)
{}

static int mtk_jpeg_open(struct file *file)
{}

static int mtk_jpeg_release(struct file *file)
{}

static const struct v4l2_file_operations mtk_jpeg_fops =;

static void mtk_jpeg_job_timeout_work(struct work_struct *work)
{}

static int mtk_jpeg_single_core_init(struct platform_device *pdev,
				     struct mtk_jpeg_dev *jpeg_dev)
{}

static int mtk_jpeg_probe(struct platform_device *pdev)
{}

static void mtk_jpeg_remove(struct platform_device *pdev)
{}

static __maybe_unused int mtk_jpeg_pm_suspend(struct device *dev)
{}

static __maybe_unused int mtk_jpeg_pm_resume(struct device *dev)
{}

static __maybe_unused int mtk_jpeg_suspend(struct device *dev)
{}

static __maybe_unused int mtk_jpeg_resume(struct device *dev)
{}

static const struct dev_pm_ops mtk_jpeg_pm_ops =;

static int mtk_jpegenc_get_hw(struct mtk_jpeg_ctx *ctx)
{}

static int mtk_jpegenc_set_hw_param(struct mtk_jpeg_ctx *ctx,
				    int hw_id,
				    struct vb2_v4l2_buffer *src_buf,
				    struct vb2_v4l2_buffer *dst_buf)
{}

static int mtk_jpegenc_put_hw(struct mtk_jpeg_dev *jpeg, int hw_id)
{}

static int mtk_jpegdec_get_hw(struct mtk_jpeg_ctx *ctx)
{}

static int mtk_jpegdec_put_hw(struct mtk_jpeg_dev *jpeg, int hw_id)
{}

static int mtk_jpegdec_set_hw_param(struct mtk_jpeg_ctx *ctx,
				    int hw_id,
				    struct vb2_v4l2_buffer *src_buf,
				    struct vb2_v4l2_buffer *dst_buf)
{}

static irqreturn_t mtk_jpeg_enc_done(struct mtk_jpeg_dev *jpeg)
{}

static void mtk_jpegenc_worker(struct work_struct *work)
{}

static void mtk_jpegdec_worker(struct work_struct *work)
{}

static irqreturn_t mtk_jpeg_enc_irq(int irq, void *priv)
{}

static irqreturn_t mtk_jpeg_dec_irq(int irq, void *priv)
{}

static struct clk_bulk_data mtk_jpeg_clocks[] =;

static struct clk_bulk_data mt8173_jpeg_dec_clocks[] =;

static const struct mtk_jpeg_variant mt8173_jpeg_drvdata =;

static const struct mtk_jpeg_variant mtk_jpeg_drvdata =;

static struct mtk_jpeg_variant mtk8195_jpegenc_drvdata =;

static const struct mtk_jpeg_variant mtk8195_jpegdec_drvdata =;

static const struct of_device_id mtk_jpeg_match[] =;

MODULE_DEVICE_TABLE(of, mtk_jpeg_match);

static struct platform_driver mtk_jpeg_driver =;

module_platform_driver();

MODULE_DESCRIPTION();
MODULE_LICENSE();