FILE
mtk_vcodec_cmn_drv.h
File preview with syntax highlighting.
linux-6.19.14/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_cmn_drv.h
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Copyright (c) 2023 MediaTek Inc. 4 * Author: Yunfei Dong <yunfei.dong@mediatek.com> 5 */ 6 7#ifndef _MTK_VCODEC_COM_DRV_H_ 8#define _MTK_VCODEC_COM_DRV_H_ 9 10#include <linux/platform_device.h> 11#include <linux/videodev2.h> 12#include <media/v4l2-ctrls.h> 13#include <media/v4l2-device.h> 14#include <media/v4l2-ioctl.h> 15#include <media/v4l2-mem2mem.h> 16#include <media/videobuf2-core.h> 17 18#define MTK_VCODEC_MAX_PLANES 3 19 20#define WAIT_INTR_TIMEOUT_MS 1000 21 22/* 23 * enum mtk_q_type - Type of queue 24 */ 25enum mtk_q_type { 26 MTK_Q_DATA_SRC = 0, 27 MTK_Q_DATA_DST = 1, 28}; 29 30/* 31 * enum mtk_hw_reg_idx - MTK hw register base index 32 */ 33enum mtk_hw_reg_idx { 34 VDEC_SYS, 35 VDEC_MISC, 36 VDEC_LD, 37 VDEC_TOP, 38 VDEC_CM, 39 VDEC_AD, 40 VDEC_AV, 41 VDEC_PP, 42 VDEC_HWD, 43 VDEC_HWQ, 44 VDEC_HWB, 45 VDEC_HWG, 46 NUM_MAX_VDEC_REG_BASE, 47 /* h264 encoder */ 48 VENC_SYS = NUM_MAX_VDEC_REG_BASE, 49 /* vp8 encoder */ 50 VENC_LT_SYS, 51 NUM_MAX_VCODEC_REG_BASE 52}; 53 54/* 55 * struct mtk_vcodec_clk_info - Structure used to store clock name 56 */ 57struct mtk_vcodec_clk_info { 58 const char *clk_name; 59 struct clk *vcodec_clk; 60}; 61 62/* 63 * struct mtk_vcodec_clk - Structure used to store vcodec clock information 64 */ 65struct mtk_vcodec_clk { 66 struct mtk_vcodec_clk_info *clk_info; 67 int clk_num; 68}; 69 70/* 71 * struct mtk_vcodec_pm - Power management data structure 72 */ 73struct mtk_vcodec_pm { 74 struct mtk_vcodec_clk vdec_clk; 75 struct mtk_vcodec_clk venc_clk; 76 struct device *dev; 77}; 78 79/* 80 * enum mtk_vdec_hw_id - Hardware index used to separate 81 * different hardware 82 */ 83enum mtk_vdec_hw_id { 84 MTK_VDEC_CORE, 85 MTK_VDEC_LAT0, 86 MTK_VDEC_LAT1, 87 MTK_VDEC_LAT_SOC, 88 MTK_VDEC_HW_MAX, 89}; 90 91/** 92 * enum mtk_instance_state - The state of an MTK Vcodec instance. 93 * @MTK_STATE_FREE: default state when instance is created 94 * @MTK_STATE_INIT: vcodec instance is initialized 95 * @MTK_STATE_HEADER: vdec had sps/pps header parsed or venc 96 * had sps/pps header encoded 97 * @MTK_STATE_FLUSH: vdec is flushing. Only used by decoder 98 * @MTK_STATE_ABORT: vcodec should be aborted 99 */ 100enum mtk_instance_state { 101 MTK_STATE_FREE = 0, 102 MTK_STATE_INIT = 1, 103 MTK_STATE_HEADER = 2, 104 MTK_STATE_FLUSH = 3, 105 MTK_STATE_ABORT = 4, 106}; 107 108enum mtk_fmt_type { 109 MTK_FMT_DEC = 0, 110 MTK_FMT_ENC = 1, 111 MTK_FMT_FRAME = 2, 112}; 113 114/* 115 * struct mtk_video_fmt - Structure used to store information about pixelformats 116 */ 117struct mtk_video_fmt { 118 u32 fourcc; 119 enum mtk_fmt_type type; 120 u32 num_planes; 121 u32 flags; 122 struct v4l2_frmsize_stepwise frmsize; 123}; 124 125/* 126 * struct mtk_q_data - Structure used to store information about queue 127 */ 128struct mtk_q_data { 129 unsigned int visible_width; 130 unsigned int visible_height; 131 unsigned int coded_width; 132 unsigned int coded_height; 133 enum v4l2_field field; 134 unsigned int bytesperline[MTK_VCODEC_MAX_PLANES]; 135 unsigned int sizeimage[MTK_VCODEC_MAX_PLANES]; 136 const struct mtk_video_fmt *fmt; 137}; 138 139/* 140 * enum mtk_instance_type - The type of an MTK Vcodec instance. 141 */ 142enum mtk_instance_type { 143 MTK_INST_DECODER = 0, 144 MTK_INST_ENCODER = 1, 145}; 146 147#endif /* _MTK_VCODEC_COM_DRV_H_ */
~/
Read-only file preview.