linux/drivers/media/platform/chips-media/coda/coda.h

/* 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
 * Copyright (C) 2012-2014 Philipp Zabel, Pengutronix
 */

#ifndef __CODA_H__
#define __CODA_H__

#include <linux/debugfs.h>
#include <linux/idr.h>
#include <linux/irqreturn.h>
#include <linux/mutex.h>
#include <linux/kfifo.h>
#include <linux/videodev2.h>
#include <linux/ratelimit.h>

#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-fh.h>
#include <media/videobuf2-v4l2.h>

#include "coda_regs.h"

#define CODA_MAX_FRAMEBUFFERS
#define FMO_SLICE_SAVE_BUF_SIZE

/*
 * This control allows applications to read the per-stream
 * (i.e. per-context) Macroblocks Error Count. This value
 * is CODA specific.
 */
#define V4L2_CID_CODA_MB_ERR_CNT

enum {};

enum coda_inst_type {};

enum coda_product {};

struct coda_video_device;

struct coda_devtype {};

struct coda_aux_buf {};

struct coda_dev {};

struct coda_codec {};

struct coda_huff_tab;

struct coda_params {};

struct coda_buffer_meta {};

/* Per-queue, driver-specific private data */
struct coda_q_data {};

struct coda_iram_info {};

#define GDI_LINEAR_FRAME_MAP
#define GDI_TILED_FRAME_MB_RASTER_MAP

struct coda_ctx;

struct coda_context_ops {};

struct coda_internal_frame {};

struct coda_ctx {};

extern int coda_debug;

#define coda_dbg(level, ctx, fmt, arg...)

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);

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);

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);

int coda_hw_reset(struct coda_ctx *ctx);

void coda_fill_bitstream(struct coda_ctx *ctx, struct list_head *buffer_list);

void coda_set_gdi_regs(struct coda_ctx *ctx);

static inline struct coda_q_data *get_q_data(struct coda_ctx *ctx,
					     enum v4l2_buf_type type)
{}

const char *coda_product_name(int product);

int coda_check_firmware(struct coda_dev *dev);

static inline unsigned int coda_get_bitstream_payload(struct coda_ctx *ctx)
{}

/*
 * The bitstream prefetcher needs to read at least 2 256 byte periods past
 * the desired bitstream position for all data to reach the decoder.
 */
static inline bool coda_bitstream_can_fetch_past(struct coda_ctx *ctx,
						 unsigned int pos)
{}

bool coda_bitstream_can_fetch_past(struct coda_ctx *ctx, unsigned int pos);
int coda_bitstream_flush(struct coda_ctx *ctx);

void coda_bit_stream_end_flag(struct coda_ctx *ctx);

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

int coda_h264_filler_nal(int size, char *p);
int coda_h264_padding(int size, char *p);
int coda_h264_profile(int profile_idc);
int coda_h264_level(int level_idc);
int coda_sps_parse_profile(struct coda_ctx *ctx, struct vb2_buffer *vb);
int coda_h264_sps_fixup(struct coda_ctx *ctx, int width, int height, char *buf,
			int *size, int max_size);

int coda_mpeg2_profile(int profile_idc);
int coda_mpeg2_level(int level_idc);
u32 coda_mpeg2_parse_headers(struct coda_ctx *ctx, u8 *buf, u32 size);
int coda_mpeg4_profile(int profile_idc);
int coda_mpeg4_level(int level_idc);
u32 coda_mpeg4_parse_headers(struct coda_ctx *ctx, u8 *buf, u32 size);

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

static inline int coda_jpeg_scale(int src, int dst)
{}

bool coda_jpeg_check_buffer(struct coda_ctx *ctx, struct vb2_buffer *vb);
int coda_jpeg_decode_header(struct coda_ctx *ctx, struct vb2_buffer *vb);
int coda_jpeg_write_tables(struct coda_ctx *ctx);
void coda_set_jpeg_compression_quality(struct coda_ctx *ctx, int quality);

extern const struct coda_context_ops coda_bit_encode_ops;
extern const struct coda_context_ops coda_bit_decode_ops;
extern const struct coda_context_ops coda9_jpeg_encode_ops;
extern const struct coda_context_ops coda9_jpeg_decode_ops;

irqreturn_t coda_irq_handler(int irq, void *data);
irqreturn_t coda9_jpeg_irq_handler(int irq, void *data);

#endif /* __CODA_H__ */