linux/drivers/media/platform/chips-media/coda/coda-common.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Coda multi-standard codec IP
 *
 * Copyright (C) 2012 Vista Silicon S.L.
 *    Javier Martin, <[email protected]>
 *    Xavier Duret
 */

#include <linux/clk.h>
#include <linux/debugfs.h>
#include <linux/delay.h>
#include <linux/firmware.h>
#include <linux/gcd.h>
#include <linux/genalloc.h>
#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/kfifo.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/slab.h>
#include <linux/videodev2.h>
#include <linux/ratelimit.h>
#include <linux/reset.h>

#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h>
#include <media/v4l2-mem2mem.h>
#include <media/videobuf2-v4l2.h>
#include <media/videobuf2-dma-contig.h>
#include <media/videobuf2-vmalloc.h>

#include "coda.h"
#include "imx-vdoa.h"

#define CODA_NAME

#define CODADX6_MAX_INSTANCES
#define CODA_MAX_FORMATS

#define CODA_ISRAM_SIZE

#define MIN_W
#define MIN_H

#define S_ALIGN
#define W_ALIGN
#define H_ALIGN

#define fh_to_ctx(__fh)

int coda_debug;
module_param(coda_debug, int, 0644);
MODULE_PARM_DESC();

static int disable_tiling;
module_param(disable_tiling, int, 0644);
MODULE_PARM_DESC();

static int disable_vdoa;
module_param(disable_vdoa, int, 0644);
MODULE_PARM_DESC();

static int enable_bwb =;
module_param(enable_bwb, int, 0644);
MODULE_PARM_DESC();

void coda_write(struct coda_dev *dev, u32 data, u32 reg)
{}

unsigned int coda_read(struct coda_dev *dev, u32 reg)
{}

void coda_write_base(struct coda_ctx *ctx, struct coda_q_data *q_data,
		     struct vb2_v4l2_buffer *buf, unsigned int reg_y)
{}

#define CODA_CODEC(mode, src_fourcc, dst_fourcc, max_w, max_h)

/*
 * Arrays of codecs supported by each given version of Coda:
 *  i.MX27 -> codadx6
 *  i.MX51 -> codahx4
 *  i.MX53 -> coda7
 *  i.MX6  -> coda960
 * Use V4L2_PIX_FMT_YUV420 as placeholder for all supported YUV 4:2:0 variants
 */
static const struct coda_codec codadx6_codecs[] =;

static const struct coda_codec codahx4_codecs[] =;

static const struct coda_codec coda7_codecs[] =;

static const struct coda_codec coda9_codecs[] =;

struct coda_video_device {};

static const struct coda_video_device coda_bit_encoder =;

static const struct coda_video_device coda_bit_jpeg_encoder =;

static const struct coda_video_device coda_bit_decoder =;

static const struct coda_video_device coda_bit_jpeg_decoder =;

static const struct coda_video_device coda9_jpeg_encoder =;

static const struct coda_video_device coda9_jpeg_decoder =;

static const struct coda_video_device *codadx6_video_devices[] =;

static const struct coda_video_device *codahx4_video_devices[] =;

static const struct coda_video_device *coda7_video_devices[] =;

static const struct coda_video_device *coda9_video_devices[] =;

/*
 * Normalize all supported YUV 4:2:0 formats to the value used in the codec
 * tables.
 */
static u32 coda_format_normalize_yuv(u32 fourcc)
{}

static const struct coda_codec *coda_find_codec(struct coda_dev *dev,
						int src_fourcc, int dst_fourcc)
{}

static void coda_get_max_dimensions(struct coda_dev *dev,
				    const struct coda_codec *codec,
				    int *max_w, int *max_h)
{}

static const struct coda_video_device *to_coda_video_device(struct video_device
							    *vdev)
{}

const char *coda_product_name(int product)
{}

static struct vdoa_data *coda_get_vdoa_data(void)
{}

/*
 * V4L2 ioctl() operations.
 */
static int coda_querycap(struct file *file, void *priv,
			 struct v4l2_capability *cap)
{}

static const u32 coda_formats_420[CODA_MAX_FORMATS] =;

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

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

static int coda_try_pixelformat(struct coda_ctx *ctx, struct v4l2_format *f)
{}

static int coda_try_fmt_vdoa(struct coda_ctx *ctx, struct v4l2_format *f,
			     bool *use_vdoa)
{}

static unsigned int coda_estimate_sizeimage(struct coda_ctx *ctx, u32 sizeimage,
					    u32 width, u32 height)
{}

static int coda_try_fmt(struct coda_ctx *ctx, const struct coda_codec *codec,
			struct v4l2_format *f)
{}

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

static void coda_set_default_colorspace(struct v4l2_pix_format *fmt)
{}

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

static int coda_s_fmt(struct coda_ctx *ctx, struct v4l2_format *f,
		      struct v4l2_rect *r)
{}

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

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

static int coda_reqbufs(struct file *file, void *priv,
			struct v4l2_requestbuffers *rb)
{}

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

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

void coda_m2m_buf_done(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
		       enum vb2_buffer_state state)
{}

static int coda_g_selection(struct file *file, void *fh,
			    struct v4l2_selection *s)
{}

static int coda_s_selection(struct file *file, void *fh,
			    struct v4l2_selection *s)
{}

static void coda_wake_up_capture_queue(struct coda_ctx *ctx)
{}

static int coda_encoder_cmd(struct file *file, void *fh,
			    struct v4l2_encoder_cmd *ec)
{}

static bool coda_mark_last_meta(struct coda_ctx *ctx)
{}

static bool coda_mark_last_dst_buf(struct coda_ctx *ctx)
{}

static int coda_decoder_cmd(struct file *file, void *fh,
			    struct v4l2_decoder_cmd *dc)
{}

static int coda_enum_framesizes(struct file *file, void *fh,
				struct v4l2_frmsizeenum *fsize)
{}

static int coda_enum_frameintervals(struct file *file, void *fh,
				    struct v4l2_frmivalenum *f)
{}

static int coda_g_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
{}

/*
 * Approximate timeperframe v4l2_fract with values that can be written
 * into the 16-bit CODA_FRATE_DIV and CODA_FRATE_RES fields.
 */
static void coda_approximate_timeperframe(struct v4l2_fract *timeperframe)
{}

static uint32_t coda_timeperframe_to_frate(struct v4l2_fract *timeperframe)
{}

static int coda_s_parm(struct file *file, void *fh, struct v4l2_streamparm *a)
{}

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

static const struct v4l2_ioctl_ops coda_ioctl_ops =;

/*
 * Mem-to-mem operations.
 */

static void coda_device_run(void *m2m_priv)
{}

static void coda_pic_run_work(struct work_struct *work)
{}

static int coda_job_ready(void *m2m_priv)
{}

static void coda_job_abort(void *priv)
{}

static const struct v4l2_m2m_ops coda_m2m_ops =;

static void set_default_params(struct coda_ctx *ctx)
{}

/*
 * Queue operations
 */
static int coda_queue_setup(struct vb2_queue *vq,
				unsigned int *nbuffers, unsigned int *nplanes,
				unsigned int sizes[], struct device *alloc_devs[])
{}

static int coda_buf_prepare(struct vb2_buffer *vb)
{}

static void coda_update_menu_ctrl(struct v4l2_ctrl *ctrl, int value)
{}

void coda_update_profile_level_ctrls(struct coda_ctx *ctx, u8 profile_idc,
				     u8 level_idc)
{}

static void coda_queue_source_change_event(struct coda_ctx *ctx)
{}

static void coda_buf_queue(struct vb2_buffer *vb)
{}

int coda_alloc_aux_buf(struct coda_dev *dev, struct coda_aux_buf *buf,
		       size_t size, const char *name, struct dentry *parent)
{}

void coda_free_aux_buf(struct coda_dev *dev,
		       struct coda_aux_buf *buf)
{}

static int coda_start_streaming(struct vb2_queue *q, unsigned int count)
{}

static void coda_stop_streaming(struct vb2_queue *q)
{}

static const struct vb2_ops coda_qops =;

static int coda_s_ctrl(struct v4l2_ctrl *ctrl)
{}

static const struct v4l2_ctrl_ops coda_ctrl_ops =;

static void coda_encode_ctrls(struct coda_ctx *ctx)
{}

static void coda_jpeg_encode_ctrls(struct coda_ctx *ctx)
{}

static void coda_decode_ctrls(struct coda_ctx *ctx)
{}

static const struct v4l2_ctrl_config coda_mb_err_cnt_ctrl_config =;

static int coda_ctrls_setup(struct coda_ctx *ctx)
{}

static int coda_queue_init(struct coda_ctx *ctx, struct vb2_queue *vq)
{}

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

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

/*
 * File operations
 */

static int coda_open(struct file *file)
{}

static int coda_release(struct file *file)
{}

static const struct v4l2_file_operations coda_fops =;

static int coda_hw_init(struct coda_dev *dev)
{}

static int coda_register_device(struct coda_dev *dev, int i)
{}

static void coda_copy_firmware(struct coda_dev *dev, const u8 * const buf,
			       size_t size)
{}

static void coda_fw_callback(const struct firmware *fw, void *context);

static int coda_firmware_request(struct coda_dev *dev)
{}

static void coda_fw_callback(const struct firmware *fw, void *context)
{}

enum coda_platform {};

static const struct coda_devtype coda_devdata[] =;

static const struct of_device_id coda_dt_ids[] =;
MODULE_DEVICE_TABLE(of, coda_dt_ids);

static int coda_probe(struct platform_device *pdev)
{}

static void coda_remove(struct platform_device *pdev)
{}

#ifdef CONFIG_PM
static int coda_runtime_resume(struct device *dev)
{}
#endif

static const struct dev_pm_ops coda_pm_ops =;

static struct platform_driver coda_driver =;

module_platform_driver();

MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();