1*f4104b78SMauro Carvalho Chehab /* SPDX-License-Identifier: GPL-2.0-only */ 2*f4104b78SMauro Carvalho Chehab /* linux/drivers/media/platform/samsung/s5p-jpeg/jpeg-regs.h 3*f4104b78SMauro Carvalho Chehab * 4*f4104b78SMauro Carvalho Chehab * Register definition file for Samsung JPEG codec driver 5*f4104b78SMauro Carvalho Chehab * 6*f4104b78SMauro Carvalho Chehab * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd. 7*f4104b78SMauro Carvalho Chehab * http://www.samsung.com 8*f4104b78SMauro Carvalho Chehab * 9*f4104b78SMauro Carvalho Chehab * Author: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com> 10*f4104b78SMauro Carvalho Chehab * Author: Jacek Anaszewski <j.anaszewski@samsung.com> 11*f4104b78SMauro Carvalho Chehab */ 12*f4104b78SMauro Carvalho Chehab 13*f4104b78SMauro Carvalho Chehab #ifndef JPEG_REGS_H_ 14*f4104b78SMauro Carvalho Chehab #define JPEG_REGS_H_ 15*f4104b78SMauro Carvalho Chehab 16*f4104b78SMauro Carvalho Chehab /* Register and bit definitions for S5PC210 */ 17*f4104b78SMauro Carvalho Chehab 18*f4104b78SMauro Carvalho Chehab /* JPEG mode register */ 19*f4104b78SMauro Carvalho Chehab #define S5P_JPGMOD 0x00 20*f4104b78SMauro Carvalho Chehab #define S5P_PROC_MODE_MASK (0x1 << 3) 21*f4104b78SMauro Carvalho Chehab #define S5P_PROC_MODE_DECOMPR (0x1 << 3) 22*f4104b78SMauro Carvalho Chehab #define S5P_PROC_MODE_COMPR (0x0 << 3) 23*f4104b78SMauro Carvalho Chehab #define S5P_SUBSAMPLING_MODE_MASK 0x7 24*f4104b78SMauro Carvalho Chehab #define S5P_SUBSAMPLING_MODE_444 (0x0 << 0) 25*f4104b78SMauro Carvalho Chehab #define S5P_SUBSAMPLING_MODE_422 (0x1 << 0) 26*f4104b78SMauro Carvalho Chehab #define S5P_SUBSAMPLING_MODE_420 (0x2 << 0) 27*f4104b78SMauro Carvalho Chehab #define S5P_SUBSAMPLING_MODE_GRAY (0x3 << 0) 28*f4104b78SMauro Carvalho Chehab 29*f4104b78SMauro Carvalho Chehab /* JPEG operation status register */ 30*f4104b78SMauro Carvalho Chehab #define S5P_JPGOPR 0x04 31*f4104b78SMauro Carvalho Chehab 32*f4104b78SMauro Carvalho Chehab /* Quantization tables*/ 33*f4104b78SMauro Carvalho Chehab #define S5P_JPG_QTBL 0x08 34*f4104b78SMauro Carvalho Chehab #define S5P_QT_NUMt_SHIFT(t) (((t) - 1) << 1) 35*f4104b78SMauro Carvalho Chehab #define S5P_QT_NUMt_MASK(t) (0x3 << S5P_QT_NUMt_SHIFT(t)) 36*f4104b78SMauro Carvalho Chehab 37*f4104b78SMauro Carvalho Chehab /* Huffman tables */ 38*f4104b78SMauro Carvalho Chehab #define S5P_JPG_HTBL 0x0c 39*f4104b78SMauro Carvalho Chehab #define S5P_HT_NUMt_AC_SHIFT(t) (((t) << 1) - 1) 40*f4104b78SMauro Carvalho Chehab #define S5P_HT_NUMt_AC_MASK(t) (0x1 << S5P_HT_NUMt_AC_SHIFT(t)) 41*f4104b78SMauro Carvalho Chehab 42*f4104b78SMauro Carvalho Chehab #define S5P_HT_NUMt_DC_SHIFT(t) (((t) - 1) << 1) 43*f4104b78SMauro Carvalho Chehab #define S5P_HT_NUMt_DC_MASK(t) (0x1 << S5P_HT_NUMt_DC_SHIFT(t)) 44*f4104b78SMauro Carvalho Chehab 45*f4104b78SMauro Carvalho Chehab /* JPEG restart interval register upper byte */ 46*f4104b78SMauro Carvalho Chehab #define S5P_JPGDRI_U 0x10 47*f4104b78SMauro Carvalho Chehab 48*f4104b78SMauro Carvalho Chehab /* JPEG restart interval register lower byte */ 49*f4104b78SMauro Carvalho Chehab #define S5P_JPGDRI_L 0x14 50*f4104b78SMauro Carvalho Chehab 51*f4104b78SMauro Carvalho Chehab /* JPEG vertical resolution register upper byte */ 52*f4104b78SMauro Carvalho Chehab #define S5P_JPGY_U 0x18 53*f4104b78SMauro Carvalho Chehab 54*f4104b78SMauro Carvalho Chehab /* JPEG vertical resolution register lower byte */ 55*f4104b78SMauro Carvalho Chehab #define S5P_JPGY_L 0x1c 56*f4104b78SMauro Carvalho Chehab 57*f4104b78SMauro Carvalho Chehab /* JPEG horizontal resolution register upper byte */ 58*f4104b78SMauro Carvalho Chehab #define S5P_JPGX_U 0x20 59*f4104b78SMauro Carvalho Chehab 60*f4104b78SMauro Carvalho Chehab /* JPEG horizontal resolution register lower byte */ 61*f4104b78SMauro Carvalho Chehab #define S5P_JPGX_L 0x24 62*f4104b78SMauro Carvalho Chehab 63*f4104b78SMauro Carvalho Chehab /* JPEG byte count register upper byte */ 64*f4104b78SMauro Carvalho Chehab #define S5P_JPGCNT_U 0x28 65*f4104b78SMauro Carvalho Chehab 66*f4104b78SMauro Carvalho Chehab /* JPEG byte count register middle byte */ 67*f4104b78SMauro Carvalho Chehab #define S5P_JPGCNT_M 0x2c 68*f4104b78SMauro Carvalho Chehab 69*f4104b78SMauro Carvalho Chehab /* JPEG byte count register lower byte */ 70*f4104b78SMauro Carvalho Chehab #define S5P_JPGCNT_L 0x30 71*f4104b78SMauro Carvalho Chehab 72*f4104b78SMauro Carvalho Chehab /* JPEG interrupt setting register */ 73*f4104b78SMauro Carvalho Chehab #define S5P_JPGINTSE 0x34 74*f4104b78SMauro Carvalho Chehab #define S5P_RSTm_INT_EN_MASK (0x1 << 7) 75*f4104b78SMauro Carvalho Chehab #define S5P_RSTm_INT_EN (0x1 << 7) 76*f4104b78SMauro Carvalho Chehab #define S5P_DATA_NUM_INT_EN_MASK (0x1 << 6) 77*f4104b78SMauro Carvalho Chehab #define S5P_DATA_NUM_INT_EN (0x1 << 6) 78*f4104b78SMauro Carvalho Chehab #define S5P_FINAL_MCU_NUM_INT_EN_MASK (0x1 << 5) 79*f4104b78SMauro Carvalho Chehab #define S5P_FINAL_MCU_NUM_INT_EN (0x1 << 5) 80*f4104b78SMauro Carvalho Chehab 81*f4104b78SMauro Carvalho Chehab /* JPEG interrupt status register */ 82*f4104b78SMauro Carvalho Chehab #define S5P_JPGINTST 0x38 83*f4104b78SMauro Carvalho Chehab #define S5P_RESULT_STAT_SHIFT 6 84*f4104b78SMauro Carvalho Chehab #define S5P_RESULT_STAT_MASK (0x1 << S5P_RESULT_STAT_SHIFT) 85*f4104b78SMauro Carvalho Chehab #define S5P_STREAM_STAT_SHIFT 5 86*f4104b78SMauro Carvalho Chehab #define S5P_STREAM_STAT_MASK (0x1 << S5P_STREAM_STAT_SHIFT) 87*f4104b78SMauro Carvalho Chehab 88*f4104b78SMauro Carvalho Chehab /* JPEG command register */ 89*f4104b78SMauro Carvalho Chehab #define S5P_JPGCOM 0x4c 90*f4104b78SMauro Carvalho Chehab #define S5P_INT_RELEASE (0x1 << 2) 91*f4104b78SMauro Carvalho Chehab 92*f4104b78SMauro Carvalho Chehab /* Raw image data r/w address register */ 93*f4104b78SMauro Carvalho Chehab #define S5P_JPG_IMGADR 0x50 94*f4104b78SMauro Carvalho Chehab 95*f4104b78SMauro Carvalho Chehab /* JPEG file r/w address register */ 96*f4104b78SMauro Carvalho Chehab #define S5P_JPG_JPGADR 0x58 97*f4104b78SMauro Carvalho Chehab 98*f4104b78SMauro Carvalho Chehab /* Coefficient for RGB-to-YCbCr converter register */ 99*f4104b78SMauro Carvalho Chehab #define S5P_JPG_COEF(n) (0x5c + (((n) - 1) << 2)) 100*f4104b78SMauro Carvalho Chehab #define S5P_COEFn_SHIFT(j) ((3 - (j)) << 3) 101*f4104b78SMauro Carvalho Chehab #define S5P_COEFn_MASK(j) (0xff << S5P_COEFn_SHIFT(j)) 102*f4104b78SMauro Carvalho Chehab 103*f4104b78SMauro Carvalho Chehab /* JPEG color mode register */ 104*f4104b78SMauro Carvalho Chehab #define S5P_JPGCMOD 0x68 105*f4104b78SMauro Carvalho Chehab #define S5P_MOD_SEL_MASK (0x7 << 5) 106*f4104b78SMauro Carvalho Chehab #define S5P_MOD_SEL_422 (0x1 << 5) 107*f4104b78SMauro Carvalho Chehab #define S5P_MOD_SEL_565 (0x2 << 5) 108*f4104b78SMauro Carvalho Chehab #define S5P_MODE_Y16_MASK (0x1 << 1) 109*f4104b78SMauro Carvalho Chehab #define S5P_MODE_Y16 (0x1 << 1) 110*f4104b78SMauro Carvalho Chehab 111*f4104b78SMauro Carvalho Chehab /* JPEG clock control register */ 112*f4104b78SMauro Carvalho Chehab #define S5P_JPGCLKCON 0x6c 113*f4104b78SMauro Carvalho Chehab #define S5P_CLK_DOWN_READY (0x1 << 1) 114*f4104b78SMauro Carvalho Chehab #define S5P_POWER_ON (0x1 << 0) 115*f4104b78SMauro Carvalho Chehab 116*f4104b78SMauro Carvalho Chehab /* JPEG start register */ 117*f4104b78SMauro Carvalho Chehab #define S5P_JSTART 0x70 118*f4104b78SMauro Carvalho Chehab 119*f4104b78SMauro Carvalho Chehab /* JPEG SW reset register */ 120*f4104b78SMauro Carvalho Chehab #define S5P_JPG_SW_RESET 0x78 121*f4104b78SMauro Carvalho Chehab 122*f4104b78SMauro Carvalho Chehab /* JPEG timer setting register */ 123*f4104b78SMauro Carvalho Chehab #define S5P_JPG_TIMER_SE 0x7c 124*f4104b78SMauro Carvalho Chehab #define S5P_TIMER_INT_EN_MASK (0x1UL << 31) 125*f4104b78SMauro Carvalho Chehab #define S5P_TIMER_INT_EN (0x1UL << 31) 126*f4104b78SMauro Carvalho Chehab #define S5P_TIMER_INIT_MASK 0x7fffffff 127*f4104b78SMauro Carvalho Chehab 128*f4104b78SMauro Carvalho Chehab /* JPEG timer status register */ 129*f4104b78SMauro Carvalho Chehab #define S5P_JPG_TIMER_ST 0x80 130*f4104b78SMauro Carvalho Chehab #define S5P_TIMER_INT_STAT_SHIFT 31 131*f4104b78SMauro Carvalho Chehab #define S5P_TIMER_INT_STAT_MASK (0x1UL << S5P_TIMER_INT_STAT_SHIFT) 132*f4104b78SMauro Carvalho Chehab #define S5P_TIMER_CNT_SHIFT 0 133*f4104b78SMauro Carvalho Chehab #define S5P_TIMER_CNT_MASK 0x7fffffff 134*f4104b78SMauro Carvalho Chehab 135*f4104b78SMauro Carvalho Chehab /* JPEG decompression output format register */ 136*f4104b78SMauro Carvalho Chehab #define S5P_JPG_OUTFORM 0x88 137*f4104b78SMauro Carvalho Chehab #define S5P_DEC_OUT_FORMAT_MASK (0x1 << 0) 138*f4104b78SMauro Carvalho Chehab #define S5P_DEC_OUT_FORMAT_422 (0x0 << 0) 139*f4104b78SMauro Carvalho Chehab #define S5P_DEC_OUT_FORMAT_420 (0x1 << 0) 140*f4104b78SMauro Carvalho Chehab 141*f4104b78SMauro Carvalho Chehab /* JPEG version register */ 142*f4104b78SMauro Carvalho Chehab #define S5P_JPG_VERSION 0x8c 143*f4104b78SMauro Carvalho Chehab 144*f4104b78SMauro Carvalho Chehab /* JPEG compressed stream size interrupt setting register */ 145*f4104b78SMauro Carvalho Chehab #define S5P_JPG_ENC_STREAM_INTSE 0x98 146*f4104b78SMauro Carvalho Chehab #define S5P_ENC_STREAM_INT_MASK (0x1 << 24) 147*f4104b78SMauro Carvalho Chehab #define S5P_ENC_STREAM_INT_EN (0x1 << 24) 148*f4104b78SMauro Carvalho Chehab #define S5P_ENC_STREAM_BOUND_MASK 0xffffff 149*f4104b78SMauro Carvalho Chehab 150*f4104b78SMauro Carvalho Chehab /* JPEG compressed stream size interrupt status register */ 151*f4104b78SMauro Carvalho Chehab #define S5P_JPG_ENC_STREAM_INTST 0x9c 152*f4104b78SMauro Carvalho Chehab #define S5P_ENC_STREAM_INT_STAT_MASK 0x1 153*f4104b78SMauro Carvalho Chehab 154*f4104b78SMauro Carvalho Chehab /* JPEG quantizer table register */ 155*f4104b78SMauro Carvalho Chehab #define S5P_JPG_QTBL_CONTENT(n) (0x400 + (n) * 0x100) 156*f4104b78SMauro Carvalho Chehab 157*f4104b78SMauro Carvalho Chehab /* JPEG DC Huffman table register */ 158*f4104b78SMauro Carvalho Chehab #define S5P_JPG_HDCTBL(n) (0x800 + (n) * 0x400) 159*f4104b78SMauro Carvalho Chehab 160*f4104b78SMauro Carvalho Chehab /* JPEG DC Huffman table register */ 161*f4104b78SMauro Carvalho Chehab #define S5P_JPG_HDCTBLG(n) (0x840 + (n) * 0x400) 162*f4104b78SMauro Carvalho Chehab 163*f4104b78SMauro Carvalho Chehab /* JPEG AC Huffman table register */ 164*f4104b78SMauro Carvalho Chehab #define S5P_JPG_HACTBL(n) (0x880 + (n) * 0x400) 165*f4104b78SMauro Carvalho Chehab 166*f4104b78SMauro Carvalho Chehab /* JPEG AC Huffman table register */ 167*f4104b78SMauro Carvalho Chehab #define S5P_JPG_HACTBLG(n) (0x8c0 + (n) * 0x400) 168*f4104b78SMauro Carvalho Chehab 169*f4104b78SMauro Carvalho Chehab 170*f4104b78SMauro Carvalho Chehab /* Register and bit definitions for Exynos 4x12 */ 171*f4104b78SMauro Carvalho Chehab 172*f4104b78SMauro Carvalho Chehab /* JPEG Codec Control Registers */ 173*f4104b78SMauro Carvalho Chehab #define EXYNOS4_JPEG_CNTL_REG 0x00 174*f4104b78SMauro Carvalho Chehab #define EXYNOS4_INT_EN_REG 0x04 175*f4104b78SMauro Carvalho Chehab #define EXYNOS4_INT_TIMER_COUNT_REG 0x08 176*f4104b78SMauro Carvalho Chehab #define EXYNOS4_INT_STATUS_REG 0x0c 177*f4104b78SMauro Carvalho Chehab #define EXYNOS4_OUT_MEM_BASE_REG 0x10 178*f4104b78SMauro Carvalho Chehab #define EXYNOS4_JPEG_IMG_SIZE_REG 0x14 179*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_BA_PLANE_1_REG 0x18 180*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_SO_PLANE_1_REG 0x1c 181*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_PO_PLANE_1_REG 0x20 182*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_BA_PLANE_2_REG 0x24 183*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_SO_PLANE_2_REG 0x28 184*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_PO_PLANE_2_REG 0x2c 185*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_BA_PLANE_3_REG 0x30 186*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_SO_PLANE_3_REG 0x34 187*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_PO_PLANE_3_REG 0x38 188*f4104b78SMauro Carvalho Chehab 189*f4104b78SMauro Carvalho Chehab #define EXYNOS4_TBL_SEL_REG 0x3c 190*f4104b78SMauro Carvalho Chehab 191*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_FMT_REG 0x40 192*f4104b78SMauro Carvalho Chehab 193*f4104b78SMauro Carvalho Chehab #define EXYNOS4_BITSTREAM_SIZE_REG 0x44 194*f4104b78SMauro Carvalho Chehab #define EXYNOS4_PADDING_REG 0x48 195*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_CNT_REG 0x4c 196*f4104b78SMauro Carvalho Chehab #define EXYNOS4_FIFO_STATUS_REG 0x50 197*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DECODE_XY_SIZE_REG 0x54 198*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DECODE_IMG_FMT_REG 0x58 199*f4104b78SMauro Carvalho Chehab 200*f4104b78SMauro Carvalho Chehab #define EXYNOS4_QUAN_TBL_ENTRY_REG 0x100 201*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_ENTRY_REG 0x200 202*f4104b78SMauro Carvalho Chehab 203*f4104b78SMauro Carvalho Chehab 204*f4104b78SMauro Carvalho Chehab /****************************************************************/ 205*f4104b78SMauro Carvalho Chehab /* Bit definition part */ 206*f4104b78SMauro Carvalho Chehab /****************************************************************/ 207*f4104b78SMauro Carvalho Chehab 208*f4104b78SMauro Carvalho Chehab /* JPEG CNTL Register bit */ 209*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_DEC_MODE_MASK (0xfffffffc << 0) 210*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DEC_MODE (1 << 0) 211*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_MODE (1 << 1) 212*f4104b78SMauro Carvalho Chehab #define EXYNOS4_AUTO_RST_MARKER (1 << 2) 213*f4104b78SMauro Carvalho Chehab #define EXYNOS4_RST_INTERVAL_SHIFT 3 214*f4104b78SMauro Carvalho Chehab #define EXYNOS4_RST_INTERVAL(x) (((x) & 0xffff) \ 215*f4104b78SMauro Carvalho Chehab << EXYNOS4_RST_INTERVAL_SHIFT) 216*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUF_TBL_EN (1 << 19) 217*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HOR_SCALING_SHIFT 20 218*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HOR_SCALING_MASK (3 << EXYNOS4_HOR_SCALING_SHIFT) 219*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HOR_SCALING(x) (((x) & 0x3) \ 220*f4104b78SMauro Carvalho Chehab << EXYNOS4_HOR_SCALING_SHIFT) 221*f4104b78SMauro Carvalho Chehab #define EXYNOS4_VER_SCALING_SHIFT 22 222*f4104b78SMauro Carvalho Chehab #define EXYNOS4_VER_SCALING_MASK (3 << EXYNOS4_VER_SCALING_SHIFT) 223*f4104b78SMauro Carvalho Chehab #define EXYNOS4_VER_SCALING(x) (((x) & 0x3) \ 224*f4104b78SMauro Carvalho Chehab << EXYNOS4_VER_SCALING_SHIFT) 225*f4104b78SMauro Carvalho Chehab #define EXYNOS4_PADDING (1 << 27) 226*f4104b78SMauro Carvalho Chehab #define EXYNOS4_SYS_INT_EN (1 << 28) 227*f4104b78SMauro Carvalho Chehab #define EXYNOS4_SOFT_RESET_HI (1 << 29) 228*f4104b78SMauro Carvalho Chehab 229*f4104b78SMauro Carvalho Chehab /* JPEG INT Register bit */ 230*f4104b78SMauro Carvalho Chehab #define EXYNOS4_INT_EN_MASK (0x1f << 0) 231*f4104b78SMauro Carvalho Chehab #define EXYNOS5433_INT_EN_MASK (0x1ff << 0) 232*f4104b78SMauro Carvalho Chehab #define EXYNOS4_PROT_ERR_INT_EN (1 << 0) 233*f4104b78SMauro Carvalho Chehab #define EXYNOS4_IMG_COMPLETION_INT_EN (1 << 1) 234*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DEC_INVALID_FORMAT_EN (1 << 2) 235*f4104b78SMauro Carvalho Chehab #define EXYNOS4_MULTI_SCAN_ERROR_EN (1 << 3) 236*f4104b78SMauro Carvalho Chehab #define EXYNOS4_FRAME_ERR_EN (1 << 4) 237*f4104b78SMauro Carvalho Chehab #define EXYNOS4_INT_EN_ALL (0x1f << 0) 238*f4104b78SMauro Carvalho Chehab #define EXYNOS5433_INT_EN_ALL (0x1b6 << 0) 239*f4104b78SMauro Carvalho Chehab 240*f4104b78SMauro Carvalho Chehab #define EXYNOS4_MOD_REG_PROC_ENC (0 << 3) 241*f4104b78SMauro Carvalho Chehab #define EXYNOS4_MOD_REG_PROC_DEC (1 << 3) 242*f4104b78SMauro Carvalho Chehab 243*f4104b78SMauro Carvalho Chehab #define EXYNOS4_MOD_REG_SUBSAMPLE_444 (0 << 0) 244*f4104b78SMauro Carvalho Chehab #define EXYNOS4_MOD_REG_SUBSAMPLE_422 (1 << 0) 245*f4104b78SMauro Carvalho Chehab #define EXYNOS4_MOD_REG_SUBSAMPLE_420 (2 << 0) 246*f4104b78SMauro Carvalho Chehab #define EXYNOS4_MOD_REG_SUBSAMPLE_GRAY (3 << 0) 247*f4104b78SMauro Carvalho Chehab 248*f4104b78SMauro Carvalho Chehab 249*f4104b78SMauro Carvalho Chehab /* JPEG IMAGE SIZE Register bit */ 250*f4104b78SMauro Carvalho Chehab #define EXYNOS4_X_SIZE_SHIFT 0 251*f4104b78SMauro Carvalho Chehab #define EXYNOS4_X_SIZE_MASK (0xffff << EXYNOS4_X_SIZE_SHIFT) 252*f4104b78SMauro Carvalho Chehab #define EXYNOS4_X_SIZE(x) (((x) & 0xffff) << EXYNOS4_X_SIZE_SHIFT) 253*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Y_SIZE_SHIFT 16 254*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Y_SIZE_MASK (0xffff << EXYNOS4_Y_SIZE_SHIFT) 255*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Y_SIZE(x) (((x) & 0xffff) << EXYNOS4_Y_SIZE_SHIFT) 256*f4104b78SMauro Carvalho Chehab 257*f4104b78SMauro Carvalho Chehab /* JPEG IMAGE FORMAT Register bit */ 258*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_IN_FMT_MASK 0xffff0000 259*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_GRAY_IMG (0 << 0) 260*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_RGB_IMG (1 << 0) 261*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_YUV_444_IMG (2 << 0) 262*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_YUV_422_IMG (3 << 0) 263*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_YUV_440_IMG (4 << 0) 264*f4104b78SMauro Carvalho Chehab 265*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DEC_GRAY_IMG (0 << 0) 266*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DEC_RGB_IMG (1 << 0) 267*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DEC_YUV_444_IMG (2 << 0) 268*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DEC_YUV_422_IMG (3 << 0) 269*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DEC_YUV_420_IMG (4 << 0) 270*f4104b78SMauro Carvalho Chehab 271*f4104b78SMauro Carvalho Chehab #define EXYNOS4_GRAY_IMG_IP_SHIFT 3 272*f4104b78SMauro Carvalho Chehab #define EXYNOS4_GRAY_IMG_IP_MASK (7 << EXYNOS4_GRAY_IMG_IP_SHIFT) 273*f4104b78SMauro Carvalho Chehab #define EXYNOS4_GRAY_IMG_IP (4 << EXYNOS4_GRAY_IMG_IP_SHIFT) 274*f4104b78SMauro Carvalho Chehab 275*f4104b78SMauro Carvalho Chehab #define EXYNOS4_RGB_IP_SHIFT 6 276*f4104b78SMauro Carvalho Chehab #define EXYNOS4_RGB_IP_MASK (7 << EXYNOS4_RGB_IP_SHIFT) 277*f4104b78SMauro Carvalho Chehab #define EXYNOS4_RGB_IP_RGB_16BIT_IMG (4 << EXYNOS4_RGB_IP_SHIFT) 278*f4104b78SMauro Carvalho Chehab #define EXYNOS4_RGB_IP_RGB_32BIT_IMG (5 << EXYNOS4_RGB_IP_SHIFT) 279*f4104b78SMauro Carvalho Chehab 280*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_444_IP_SHIFT 9 281*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_444_IP_MASK (7 << EXYNOS4_YUV_444_IP_SHIFT) 282*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_444_IP_YUV_444_2P_IMG (4 << EXYNOS4_YUV_444_IP_SHIFT) 283*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_444_IP_YUV_444_3P_IMG (5 << EXYNOS4_YUV_444_IP_SHIFT) 284*f4104b78SMauro Carvalho Chehab 285*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_422_IP_SHIFT 12 286*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_422_IP_MASK (7 << EXYNOS4_YUV_422_IP_SHIFT) 287*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_422_IP_YUV_422_1P_IMG (4 << EXYNOS4_YUV_422_IP_SHIFT) 288*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_422_IP_YUV_422_2P_IMG (5 << EXYNOS4_YUV_422_IP_SHIFT) 289*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_422_IP_YUV_422_3P_IMG (6 << EXYNOS4_YUV_422_IP_SHIFT) 290*f4104b78SMauro Carvalho Chehab 291*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_420_IP_SHIFT 15 292*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_420_IP_MASK (7 << EXYNOS4_YUV_420_IP_SHIFT) 293*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_420_IP_YUV_420_2P_IMG (4 << EXYNOS4_YUV_420_IP_SHIFT) 294*f4104b78SMauro Carvalho Chehab #define EXYNOS4_YUV_420_IP_YUV_420_3P_IMG (5 << EXYNOS4_YUV_420_IP_SHIFT) 295*f4104b78SMauro Carvalho Chehab 296*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_FMT_SHIFT 24 297*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_FMT_MASK (3 << EXYNOS4_ENC_FMT_SHIFT) 298*f4104b78SMauro Carvalho Chehab #define EXYNOS5433_ENC_FMT_MASK (7 << EXYNOS4_ENC_FMT_SHIFT) 299*f4104b78SMauro Carvalho Chehab 300*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_FMT_GRAY (0 << EXYNOS4_ENC_FMT_SHIFT) 301*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_FMT_YUV_444 (1 << EXYNOS4_ENC_FMT_SHIFT) 302*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_FMT_YUV_422 (2 << EXYNOS4_ENC_FMT_SHIFT) 303*f4104b78SMauro Carvalho Chehab #define EXYNOS4_ENC_FMT_YUV_420 (3 << EXYNOS4_ENC_FMT_SHIFT) 304*f4104b78SMauro Carvalho Chehab 305*f4104b78SMauro Carvalho Chehab #define EXYNOS4_JPEG_DECODED_IMG_FMT_MASK 0x03 306*f4104b78SMauro Carvalho Chehab 307*f4104b78SMauro Carvalho Chehab #define EXYNOS4_SWAP_CHROMA_CRCB (1 << 26) 308*f4104b78SMauro Carvalho Chehab #define EXYNOS4_SWAP_CHROMA_CBCR (0 << 26) 309*f4104b78SMauro Carvalho Chehab #define EXYNOS5433_SWAP_CHROMA_CRCB (1 << 27) 310*f4104b78SMauro Carvalho Chehab #define EXYNOS5433_SWAP_CHROMA_CBCR (0 << 27) 311*f4104b78SMauro Carvalho Chehab 312*f4104b78SMauro Carvalho Chehab /* JPEG HUFF count Register bit */ 313*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_COUNT_MASK 0xffff 314*f4104b78SMauro Carvalho Chehab 315*f4104b78SMauro Carvalho Chehab /* JPEG Decoded_img_x_y_size Register bit */ 316*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DECODED_SIZE_MASK 0x0000ffff 317*f4104b78SMauro Carvalho Chehab 318*f4104b78SMauro Carvalho Chehab /* JPEG Decoded image format Register bit */ 319*f4104b78SMauro Carvalho Chehab #define EXYNOS4_DECODED_IMG_FMT_MASK 0x3 320*f4104b78SMauro Carvalho Chehab 321*f4104b78SMauro Carvalho Chehab /* JPEG TBL SEL Register bit */ 322*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP(c, n) ((n) << (((c) - 1) << 1)) 323*f4104b78SMauro Carvalho Chehab 324*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP1_0 EXYNOS4_Q_TBL_COMP(1, 0) 325*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP1_1 EXYNOS4_Q_TBL_COMP(1, 1) 326*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP1_2 EXYNOS4_Q_TBL_COMP(1, 2) 327*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP1_3 EXYNOS4_Q_TBL_COMP(1, 3) 328*f4104b78SMauro Carvalho Chehab 329*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP2_0 EXYNOS4_Q_TBL_COMP(2, 0) 330*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP2_1 EXYNOS4_Q_TBL_COMP(2, 1) 331*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP2_2 EXYNOS4_Q_TBL_COMP(2, 2) 332*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP2_3 EXYNOS4_Q_TBL_COMP(2, 3) 333*f4104b78SMauro Carvalho Chehab 334*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP3_0 EXYNOS4_Q_TBL_COMP(3, 0) 335*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP3_1 EXYNOS4_Q_TBL_COMP(3, 1) 336*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP3_2 EXYNOS4_Q_TBL_COMP(3, 2) 337*f4104b78SMauro Carvalho Chehab #define EXYNOS4_Q_TBL_COMP3_3 EXYNOS4_Q_TBL_COMP(3, 3) 338*f4104b78SMauro Carvalho Chehab 339*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP(c, n) ((n) << ((((c) - 1) << 1) + 6)) 340*f4104b78SMauro Carvalho Chehab 341*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP1_AC_0_DC_0 \ 342*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(1, 0) 343*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP1_AC_0_DC_1 \ 344*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(1, 1) 345*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP1_AC_1_DC_0 \ 346*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(1, 2) 347*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP1_AC_1_DC_1 \ 348*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(1, 3) 349*f4104b78SMauro Carvalho Chehab 350*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP2_AC_0_DC_0 \ 351*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(2, 0) 352*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP2_AC_0_DC_1 \ 353*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(2, 1) 354*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP2_AC_1_DC_0 \ 355*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(2, 2) 356*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP2_AC_1_DC_1 \ 357*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(2, 3) 358*f4104b78SMauro Carvalho Chehab 359*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP3_AC_0_DC_0 \ 360*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(3, 0) 361*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP3_AC_0_DC_1 \ 362*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(3, 1) 363*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP3_AC_1_DC_0 \ 364*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(3, 2) 365*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_COMP3_AC_1_DC_1 \ 366*f4104b78SMauro Carvalho Chehab EXYNOS4_HUFF_TBL_COMP(3, 3) 367*f4104b78SMauro Carvalho Chehab 368*f4104b78SMauro Carvalho Chehab #define EXYNOS4_NF_SHIFT 16 369*f4104b78SMauro Carvalho Chehab #define EXYNOS4_NF_MASK 0xff 370*f4104b78SMauro Carvalho Chehab #define EXYNOS4_NF(x) \ 371*f4104b78SMauro Carvalho Chehab (((x) & EXYNOS4_NF_MASK) << EXYNOS4_NF_SHIFT) 372*f4104b78SMauro Carvalho Chehab 373*f4104b78SMauro Carvalho Chehab /* JPEG quantizer table register */ 374*f4104b78SMauro Carvalho Chehab #define EXYNOS4_QTBL_CONTENT(n) (0x100 + (n) * 0x40) 375*f4104b78SMauro Carvalho Chehab 376*f4104b78SMauro Carvalho Chehab /* JPEG DC luminance (code length) Huffman table register */ 377*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_HDCLL 0x200 378*f4104b78SMauro Carvalho Chehab 379*f4104b78SMauro Carvalho Chehab /* JPEG DC luminance (values) Huffman table register */ 380*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_HDCLV 0x210 381*f4104b78SMauro Carvalho Chehab 382*f4104b78SMauro Carvalho Chehab /* JPEG DC chrominance (code length) Huffman table register */ 383*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_HDCCL 0x220 384*f4104b78SMauro Carvalho Chehab 385*f4104b78SMauro Carvalho Chehab /* JPEG DC chrominance (values) Huffman table register */ 386*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_HDCCV 0x230 387*f4104b78SMauro Carvalho Chehab 388*f4104b78SMauro Carvalho Chehab /* JPEG AC luminance (code length) Huffman table register */ 389*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_HACLL 0x240 390*f4104b78SMauro Carvalho Chehab 391*f4104b78SMauro Carvalho Chehab /* JPEG AC luminance (values) Huffman table register */ 392*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_HACLV 0x250 393*f4104b78SMauro Carvalho Chehab 394*f4104b78SMauro Carvalho Chehab /* JPEG AC chrominance (code length) Huffman table register */ 395*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_HACCL 0x300 396*f4104b78SMauro Carvalho Chehab 397*f4104b78SMauro Carvalho Chehab /* JPEG AC chrominance (values) Huffman table register */ 398*f4104b78SMauro Carvalho Chehab #define EXYNOS4_HUFF_TBL_HACCV 0x310 399*f4104b78SMauro Carvalho Chehab 400*f4104b78SMauro Carvalho Chehab /* Register and bit definitions for Exynos 3250 */ 401*f4104b78SMauro Carvalho Chehab 402*f4104b78SMauro Carvalho Chehab /* JPEG mode register */ 403*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGMOD 0x00 404*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_PROC_MODE_MASK (0x1 << 3) 405*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_PROC_MODE_DECOMPR (0x1 << 3) 406*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_PROC_MODE_COMPR (0x0 << 3) 407*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SUBSAMPLING_MODE_MASK (0x7 << 0) 408*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SUBSAMPLING_MODE_444 (0x0 << 0) 409*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SUBSAMPLING_MODE_422 (0x1 << 0) 410*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SUBSAMPLING_MODE_420 (0x2 << 0) 411*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SUBSAMPLING_MODE_411 (0x6 << 0) 412*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SUBSAMPLING_MODE_GRAY (0x3 << 0) 413*f4104b78SMauro Carvalho Chehab 414*f4104b78SMauro Carvalho Chehab /* JPEG operation status register */ 415*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGOPR 0x04 416*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGOPR_MASK 0x01 417*f4104b78SMauro Carvalho Chehab 418*f4104b78SMauro Carvalho Chehab /* Quantization and Huffman tables register */ 419*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_QHTBL 0x08 420*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_QT_NUM_SHIFT(t) ((((t) - 1) << 1) + 8) 421*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_QT_NUM_MASK(t) (0x3 << EXYNOS3250_QT_NUM_SHIFT(t)) 422*f4104b78SMauro Carvalho Chehab 423*f4104b78SMauro Carvalho Chehab /* Huffman tables */ 424*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_HT_NUM_AC_SHIFT(t) (((t) << 1) - 1) 425*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_HT_NUM_AC_MASK(t) (0x1 << EXYNOS3250_HT_NUM_AC_SHIFT(t)) 426*f4104b78SMauro Carvalho Chehab 427*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_HT_NUM_DC_SHIFT(t) (((t) - 1) << 1) 428*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_HT_NUM_DC_MASK(t) (0x1 << EXYNOS3250_HT_NUM_DC_SHIFT(t)) 429*f4104b78SMauro Carvalho Chehab 430*f4104b78SMauro Carvalho Chehab /* JPEG restart interval register */ 431*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGDRI 0x0c 432*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGDRI_MASK 0xffff 433*f4104b78SMauro Carvalho Chehab 434*f4104b78SMauro Carvalho Chehab /* JPEG vertical resolution register */ 435*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGY 0x10 436*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGY_MASK 0xffff 437*f4104b78SMauro Carvalho Chehab 438*f4104b78SMauro Carvalho Chehab /* JPEG horizontal resolution register */ 439*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGX 0x14 440*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGX_MASK 0xffff 441*f4104b78SMauro Carvalho Chehab 442*f4104b78SMauro Carvalho Chehab /* JPEG byte count register */ 443*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGCNT 0x18 444*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGCNT_MASK 0xffffff 445*f4104b78SMauro Carvalho Chehab 446*f4104b78SMauro Carvalho Chehab /* JPEG interrupt mask register */ 447*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGINTSE 0x1c 448*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPEG_DONE_EN (1 << 11) 449*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_WDMA_DONE_EN (1 << 10) 450*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_RDMA_DONE_EN (1 << 9) 451*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_ENC_STREAM_INT_EN (1 << 8) 452*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CORE_DONE_EN (1 << 5) 453*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_ERR_INT_EN (1 << 4) 454*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_HEAD_INT_EN (1 << 3) 455*f4104b78SMauro Carvalho Chehab 456*f4104b78SMauro Carvalho Chehab /* JPEG interrupt status register */ 457*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGINTST 0x20 458*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPEG_DONE (1 << 11) 459*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_WDMA_DONE (1 << 10) 460*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_RDMA_DONE (1 << 9) 461*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_ENC_STREAM_STAT (1 << 8) 462*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_RESULT_STAT (1 << 5) 463*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_STREAM_STAT (1 << 4) 464*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_HEADER_STAT (1 << 3) 465*f4104b78SMauro Carvalho Chehab 466*f4104b78SMauro Carvalho Chehab /* 467*f4104b78SMauro Carvalho Chehab * Base address of the luma component DMA buffer 468*f4104b78SMauro Carvalho Chehab * of the raw input or output image. 469*f4104b78SMauro Carvalho Chehab */ 470*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_LUMA_BASE 0x100 471*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SRC_TILE_EN_MASK 0x100 472*f4104b78SMauro Carvalho Chehab 473*f4104b78SMauro Carvalho Chehab /* Stride of source or destination luma raw image buffer */ 474*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_LUMA_STRIDE 0x104 475*f4104b78SMauro Carvalho Chehab 476*f4104b78SMauro Carvalho Chehab /* Horizontal/vertical offset of active region in luma raw image buffer */ 477*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_LUMA_XY_OFFSET 0x108 478*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_LUMA_YY_OFFSET_SHIFT 18 479*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_LUMA_YY_OFFSET_MASK (0x1fff << EXYNOS3250_LUMA_YY_OFFSET_SHIFT) 480*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_LUMA_YX_OFFSET_SHIFT 2 481*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_LUMA_YX_OFFSET_MASK (0x1fff << EXYNOS3250_LUMA_YX_OFFSET_SHIFT) 482*f4104b78SMauro Carvalho Chehab 483*f4104b78SMauro Carvalho Chehab /* 484*f4104b78SMauro Carvalho Chehab * Base address of the chroma(Cb) component DMA buffer 485*f4104b78SMauro Carvalho Chehab * of the raw input or output image. 486*f4104b78SMauro Carvalho Chehab */ 487*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_BASE 0x10c 488*f4104b78SMauro Carvalho Chehab 489*f4104b78SMauro Carvalho Chehab /* Stride of source or destination chroma(Cb) raw image buffer */ 490*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_STRIDE 0x110 491*f4104b78SMauro Carvalho Chehab 492*f4104b78SMauro Carvalho Chehab /* Horizontal/vertical offset of active region in chroma(Cb) raw image buffer */ 493*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_XY_OFFSET 0x114 494*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_YY_OFFSET_SHIFT 18 495*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_YY_OFFSET_MASK (0x1fff << EXYNOS3250_CHROMA_YY_OFFSET_SHIFT) 496*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_YX_OFFSET_SHIFT 2 497*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_YX_OFFSET_MASK (0x1fff << EXYNOS3250_CHROMA_YX_OFFSET_SHIFT) 498*f4104b78SMauro Carvalho Chehab 499*f4104b78SMauro Carvalho Chehab /* 500*f4104b78SMauro Carvalho Chehab * Base address of the chroma(Cr) component DMA buffer 501*f4104b78SMauro Carvalho Chehab * of the raw input or output image. 502*f4104b78SMauro Carvalho Chehab */ 503*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_CR_BASE 0x118 504*f4104b78SMauro Carvalho Chehab 505*f4104b78SMauro Carvalho Chehab /* Stride of source or destination chroma(Cr) raw image buffer */ 506*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_CR_STRIDE 0x11c 507*f4104b78SMauro Carvalho Chehab 508*f4104b78SMauro Carvalho Chehab /* Horizontal/vertical offset of active region in chroma(Cb) raw image buffer */ 509*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_CR_XY_OFFSET 0x120 510*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_CR_YY_OFFSET_SHIFT 18 511*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_CR_YY_OFFSET_MASK (0x1fff << EXYNOS3250_CHROMA_CR_YY_OFFSET_SHIFT) 512*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_CR_YX_OFFSET_SHIFT 2 513*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CHROMA_CR_YX_OFFSET_MASK (0x1fff << EXYNOS3250_CHROMA_CR_YX_OFFSET_SHIFT) 514*f4104b78SMauro Carvalho Chehab 515*f4104b78SMauro Carvalho Chehab /* Raw image data r/w address register */ 516*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPG_IMGADR 0x50 517*f4104b78SMauro Carvalho Chehab 518*f4104b78SMauro Carvalho Chehab /* Source or destination JPEG file DMA buffer address */ 519*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPG_JPGADR 0x124 520*f4104b78SMauro Carvalho Chehab 521*f4104b78SMauro Carvalho Chehab /* Coefficients for RGB-to-YCbCr converter register */ 522*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPG_COEF(n) (0x128 + (((n) - 1) << 2)) 523*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_COEF_SHIFT(j) ((3 - (j)) << 3) 524*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_COEF_MASK(j) (0xff << EXYNOS3250_COEF_SHIFT(j)) 525*f4104b78SMauro Carvalho Chehab 526*f4104b78SMauro Carvalho Chehab /* Raw input format setting */ 527*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGCMOD 0x134 528*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SRC_TILE_EN (0x1 << 10) 529*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SRC_NV_MASK (0x1 << 9) 530*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SRC_NV12 (0x0 << 9) 531*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SRC_NV21 (0x1 << 9) 532*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SRC_BIG_ENDIAN_MASK (0x1 << 8) 533*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SRC_BIG_ENDIAN (0x1 << 8) 534*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_MODE_SEL_MASK (0x7 << 5) 535*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_MODE_SEL_420_2P (0x0 << 5) 536*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_MODE_SEL_422_1P_LUM_CHR (0x1 << 5) 537*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_MODE_SEL_RGB565 (0x2 << 5) 538*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_MODE_SEL_422_1P_CHR_LUM (0x3 << 5) 539*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_MODE_SEL_ARGB8888 (0x4 << 5) 540*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_MODE_SEL_420_3P (0x5 << 5) 541*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SRC_SWAP_RGB (0x1 << 3) 542*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SRC_SWAP_UV (0x1 << 2) 543*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_MODE_Y16_MASK (0x1 << 1) 544*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_MODE_Y16 (0x1 << 1) 545*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_HALF_EN_MASK (0x1 << 0) 546*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_HALF_EN (0x1 << 0) 547*f4104b78SMauro Carvalho Chehab 548*f4104b78SMauro Carvalho Chehab /* Power on/off and clock down control */ 549*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPGCLKCON 0x138 550*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CLK_DOWN_READY (0x1 << 1) 551*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_POWER_ON (0x1 << 0) 552*f4104b78SMauro Carvalho Chehab 553*f4104b78SMauro Carvalho Chehab /* Start compression or decompression */ 554*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JSTART 0x13c 555*f4104b78SMauro Carvalho Chehab 556*f4104b78SMauro Carvalho Chehab /* Restart decompression after header analysis */ 557*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JRSTART 0x140 558*f4104b78SMauro Carvalho Chehab 559*f4104b78SMauro Carvalho Chehab /* JPEG SW reset register */ 560*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_SW_RESET 0x144 561*f4104b78SMauro Carvalho Chehab 562*f4104b78SMauro Carvalho Chehab /* JPEG timer setting register */ 563*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_TIMER_SE 0x148 564*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_TIMER_INT_EN_SHIFT 31 565*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_TIMER_INT_EN (1UL << EXYNOS3250_TIMER_INT_EN_SHIFT) 566*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_TIMER_INIT_MASK 0x7fffffff 567*f4104b78SMauro Carvalho Chehab 568*f4104b78SMauro Carvalho Chehab /* JPEG timer status register */ 569*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_TIMER_ST 0x14c 570*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_TIMER_INT_STAT_SHIFT 31 571*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_TIMER_INT_STAT (1UL << EXYNOS3250_TIMER_INT_STAT_SHIFT) 572*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_TIMER_CNT_SHIFT 0 573*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_TIMER_CNT_MASK 0x7fffffff 574*f4104b78SMauro Carvalho Chehab 575*f4104b78SMauro Carvalho Chehab /* Command status register */ 576*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_COMSTAT 0x150 577*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CUR_PROC_MODE (0x1 << 1) 578*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CUR_COM_MODE (0x1 << 0) 579*f4104b78SMauro Carvalho Chehab 580*f4104b78SMauro Carvalho Chehab /* JPEG decompression output format register */ 581*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUTFORM 0x154 582*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_ALPHA_MASK (0xff << 24) 583*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_TILE_EN (0x1 << 10) 584*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_NV_MASK (0x1 << 9) 585*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_NV12 (0x0 << 9) 586*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_NV21 (0x1 << 9) 587*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_BIG_ENDIAN_MASK (0x1 << 8) 588*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_BIG_ENDIAN (0x1 << 8) 589*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_SWAP_RGB (0x1 << 7) 590*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_SWAP_UV (0x1 << 6) 591*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_FMT_MASK (0x7 << 0) 592*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_FMT_420_2P (0x0 << 0) 593*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_FMT_422_1P_LUM_CHR (0x1 << 0) 594*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_FMT_422_1P_CHR_LUM (0x3 << 0) 595*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_FMT_420_3P (0x4 << 0) 596*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_FMT_RGB565 (0x5 << 0) 597*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_OUT_FMT_ARGB8888 (0x6 << 0) 598*f4104b78SMauro Carvalho Chehab 599*f4104b78SMauro Carvalho Chehab /* Input JPEG stream byte size for decompression */ 600*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DEC_STREAM_SIZE 0x158 601*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DEC_STREAM_MASK 0x1fffffff 602*f4104b78SMauro Carvalho Chehab 603*f4104b78SMauro Carvalho Chehab /* The upper bound of the byte size of output compressed stream */ 604*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_ENC_STREAM_BOUND 0x15c 605*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_ENC_STREAM_BOUND_MASK 0xffffc0 606*f4104b78SMauro Carvalho Chehab 607*f4104b78SMauro Carvalho Chehab /* Scale-down ratio when decoding */ 608*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DEC_SCALING_RATIO 0x160 609*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DEC_SCALE_FACTOR_MASK 0x3 610*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DEC_SCALE_FACTOR_8_8 0x0 611*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DEC_SCALE_FACTOR_4_8 0x1 612*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DEC_SCALE_FACTOR_2_8 0x2 613*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DEC_SCALE_FACTOR_1_8 0x3 614*f4104b78SMauro Carvalho Chehab 615*f4104b78SMauro Carvalho Chehab /* Error check */ 616*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_CRC_RESULT 0x164 617*f4104b78SMauro Carvalho Chehab 618*f4104b78SMauro Carvalho Chehab /* RDMA and WDMA operation status register */ 619*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DMA_OPER_STATUS 0x168 620*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_WDMA_OPER_STATUS (0x1 << 1) 621*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_RDMA_OPER_STATUS (0x1 << 0) 622*f4104b78SMauro Carvalho Chehab 623*f4104b78SMauro Carvalho Chehab /* DMA issue gathering number and issue number settings */ 624*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DMA_ISSUE_NUM 0x16c 625*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_WDMA_ISSUE_NUM_SHIFT 16 626*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_WDMA_ISSUE_NUM_MASK (0x7 << EXYNOS3250_WDMA_ISSUE_NUM_SHIFT) 627*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_RDMA_ISSUE_NUM_SHIFT 8 628*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_RDMA_ISSUE_NUM_MASK (0x7 << EXYNOS3250_RDMA_ISSUE_NUM_SHIFT) 629*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_ISSUE_GATHER_NUM_SHIFT 0 630*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_ISSUE_GATHER_NUM_MASK (0x7 << EXYNOS3250_ISSUE_GATHER_NUM_SHIFT) 631*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_DMA_MO_COUNT 0x7 632*f4104b78SMauro Carvalho Chehab 633*f4104b78SMauro Carvalho Chehab /* Version register */ 634*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_VERSION 0x1fc 635*f4104b78SMauro Carvalho Chehab 636*f4104b78SMauro Carvalho Chehab /* RGB <-> YUV conversion coefficients */ 637*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPEG_ENC_COEF1 0x01352e1e 638*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPEG_ENC_COEF2 0x00b0ae83 639*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPEG_ENC_COEF3 0x020cdc13 640*f4104b78SMauro Carvalho Chehab 641*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPEG_DEC_COEF1 0x04a80199 642*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPEG_DEC_COEF2 0x04a9a064 643*f4104b78SMauro Carvalho Chehab #define EXYNOS3250_JPEG_DEC_COEF3 0x04a80102 644*f4104b78SMauro Carvalho Chehab 645*f4104b78SMauro Carvalho Chehab #endif /* JPEG_REGS_H_ */ 646*f4104b78SMauro Carvalho Chehab 647