Merge tag 'regmap-fix-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux/fpc-iii.git] / drivers / media / platform / mtk-jpeg / mtk_jpeg_enc_hw.h
blob61c60e4e58ea925275f489648360b0ad48588584
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (c) 2019 MediaTek Inc.
4 * Author: Xia Jiang <xia.jiang@mediatek.com>
6 */
8 #ifndef _MTK_JPEG_ENC_HW_H
9 #define _MTK_JPEG_ENC_HW_H
11 #include <media/videobuf2-core.h>
13 #include "mtk_jpeg_core.h"
15 #define JPEG_ENC_INT_STATUS_DONE BIT(0)
16 #define JPEG_ENC_INT_STATUS_MASK_ALLIRQ 0x13
18 #define JPEG_ENC_DST_ADDR_OFFSET_MASK GENMASK(3, 0)
20 #define JPEG_ENC_CTRL_YUV_FORMAT_MASK 0x18
21 #define JPEG_ENC_CTRL_RESTART_EN_BIT BIT(10)
22 #define JPEG_ENC_CTRL_FILE_FORMAT_BIT BIT(5)
23 #define JPEG_ENC_CTRL_INT_EN_BIT BIT(2)
24 #define JPEG_ENC_CTRL_ENABLE_BIT BIT(0)
25 #define JPEG_ENC_RESET_BIT BIT(0)
27 #define JPEG_ENC_YUV_FORMAT_YUYV 0
28 #define JPEG_ENC_YUV_FORMAT_YVYU 1
29 #define JPEG_ENC_YUV_FORMAT_NV12 2
30 #define JEPG_ENC_YUV_FORMAT_NV21 3
32 #define JPEG_ENC_QUALITY_Q60 0x0
33 #define JPEG_ENC_QUALITY_Q80 0x1
34 #define JPEG_ENC_QUALITY_Q90 0x2
35 #define JPEG_ENC_QUALITY_Q95 0x3
36 #define JPEG_ENC_QUALITY_Q39 0x4
37 #define JPEG_ENC_QUALITY_Q68 0x5
38 #define JPEG_ENC_QUALITY_Q84 0x6
39 #define JPEG_ENC_QUALITY_Q92 0x7
40 #define JPEG_ENC_QUALITY_Q48 0x8
41 #define JPEG_ENC_QUALITY_Q74 0xa
42 #define JPEG_ENC_QUALITY_Q87 0xb
43 #define JPEG_ENC_QUALITY_Q34 0xc
44 #define JPEG_ENC_QUALITY_Q64 0xe
45 #define JPEG_ENC_QUALITY_Q82 0xf
46 #define JPEG_ENC_QUALITY_Q97 0x10
48 #define JPEG_ENC_RSTB 0x100
49 #define JPEG_ENC_CTRL 0x104
50 #define JPEG_ENC_QUALITY 0x108
51 #define JPEG_ENC_BLK_NUM 0x10C
52 #define JPEG_ENC_BLK_CNT 0x110
53 #define JPEG_ENC_INT_STS 0x11c
54 #define JPEG_ENC_DST_ADDR0 0x120
55 #define JPEG_ENC_DMA_ADDR0 0x124
56 #define JPEG_ENC_STALL_ADDR0 0x128
57 #define JPEG_ENC_OFFSET_ADDR 0x138
58 #define JPEG_ENC_RST_MCU_NUM 0x150
59 #define JPEG_ENC_IMG_SIZE 0x154
60 #define JPEG_ENC_DEBUG_INFO0 0x160
61 #define JPEG_ENC_DEBUG_INFO1 0x164
62 #define JPEG_ENC_TOTAL_CYCLE 0x168
63 #define JPEG_ENC_BYTE_OFFSET_MASK 0x16c
64 #define JPEG_ENC_SRC_LUMA_ADDR 0x170
65 #define JPEG_ENC_SRC_CHROMA_ADDR 0x174
66 #define JPEG_ENC_STRIDE 0x178
67 #define JPEG_ENC_IMG_STRIDE 0x17c
68 #define JPEG_ENC_DCM_CTRL 0x300
69 #define JPEG_ENC_CODEC_SEL 0x314
70 #define JPEG_ENC_ULTRA_THRES 0x318
72 /**
73 * struct mtk_jpeg_enc_qlt - JPEG encoder quality data
74 * @quality_param: quality value
75 * @hardware_value: hardware value of quality
77 struct mtk_jpeg_enc_qlt {
78 u8 quality_param;
79 u8 hardware_value;
82 void mtk_jpeg_enc_reset(void __iomem *base);
83 u32 mtk_jpeg_enc_get_file_size(void __iomem *base);
84 void mtk_jpeg_enc_start(void __iomem *enc_reg_base);
85 void mtk_jpeg_set_enc_src(struct mtk_jpeg_ctx *ctx, void __iomem *base,
86 struct vb2_buffer *src_buf);
87 void mtk_jpeg_set_enc_dst(struct mtk_jpeg_ctx *ctx, void __iomem *base,
88 struct vb2_buffer *dst_buf);
89 void mtk_jpeg_set_enc_params(struct mtk_jpeg_ctx *ctx, void __iomem *base);
91 #endif /* _MTK_JPEG_ENC_HW_H */