18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 28c2ecf20Sopenharmony_ci/* linux/drivers/media/platform/s5p-jpeg/jpeg-regs.h 38c2ecf20Sopenharmony_ci * 48c2ecf20Sopenharmony_ci * Register definition file for Samsung JPEG codec driver 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (c) 2011-2014 Samsung Electronics Co., Ltd. 78c2ecf20Sopenharmony_ci * http://www.samsung.com 88c2ecf20Sopenharmony_ci * 98c2ecf20Sopenharmony_ci * Author: Andrzej Pietrasiewicz <andrzejtp2010@gmail.com> 108c2ecf20Sopenharmony_ci * Author: Jacek Anaszewski <j.anaszewski@samsung.com> 118c2ecf20Sopenharmony_ci */ 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#ifndef JPEG_REGS_H_ 148c2ecf20Sopenharmony_ci#define JPEG_REGS_H_ 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ci/* Register and bit definitions for S5PC210 */ 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci/* JPEG mode register */ 198c2ecf20Sopenharmony_ci#define S5P_JPGMOD 0x00 208c2ecf20Sopenharmony_ci#define S5P_PROC_MODE_MASK (0x1 << 3) 218c2ecf20Sopenharmony_ci#define S5P_PROC_MODE_DECOMPR (0x1 << 3) 228c2ecf20Sopenharmony_ci#define S5P_PROC_MODE_COMPR (0x0 << 3) 238c2ecf20Sopenharmony_ci#define S5P_SUBSAMPLING_MODE_MASK 0x7 248c2ecf20Sopenharmony_ci#define S5P_SUBSAMPLING_MODE_444 (0x0 << 0) 258c2ecf20Sopenharmony_ci#define S5P_SUBSAMPLING_MODE_422 (0x1 << 0) 268c2ecf20Sopenharmony_ci#define S5P_SUBSAMPLING_MODE_420 (0x2 << 0) 278c2ecf20Sopenharmony_ci#define S5P_SUBSAMPLING_MODE_GRAY (0x3 << 0) 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci/* JPEG operation status register */ 308c2ecf20Sopenharmony_ci#define S5P_JPGOPR 0x04 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_ci/* Quantization tables*/ 338c2ecf20Sopenharmony_ci#define S5P_JPG_QTBL 0x08 348c2ecf20Sopenharmony_ci#define S5P_QT_NUMt_SHIFT(t) (((t) - 1) << 1) 358c2ecf20Sopenharmony_ci#define S5P_QT_NUMt_MASK(t) (0x3 << S5P_QT_NUMt_SHIFT(t)) 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ci/* Huffman tables */ 388c2ecf20Sopenharmony_ci#define S5P_JPG_HTBL 0x0c 398c2ecf20Sopenharmony_ci#define S5P_HT_NUMt_AC_SHIFT(t) (((t) << 1) - 1) 408c2ecf20Sopenharmony_ci#define S5P_HT_NUMt_AC_MASK(t) (0x1 << S5P_HT_NUMt_AC_SHIFT(t)) 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci#define S5P_HT_NUMt_DC_SHIFT(t) (((t) - 1) << 1) 438c2ecf20Sopenharmony_ci#define S5P_HT_NUMt_DC_MASK(t) (0x1 << S5P_HT_NUMt_DC_SHIFT(t)) 448c2ecf20Sopenharmony_ci 458c2ecf20Sopenharmony_ci/* JPEG restart interval register upper byte */ 468c2ecf20Sopenharmony_ci#define S5P_JPGDRI_U 0x10 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci/* JPEG restart interval register lower byte */ 498c2ecf20Sopenharmony_ci#define S5P_JPGDRI_L 0x14 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci/* JPEG vertical resolution register upper byte */ 528c2ecf20Sopenharmony_ci#define S5P_JPGY_U 0x18 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ci/* JPEG vertical resolution register lower byte */ 558c2ecf20Sopenharmony_ci#define S5P_JPGY_L 0x1c 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci/* JPEG horizontal resolution register upper byte */ 588c2ecf20Sopenharmony_ci#define S5P_JPGX_U 0x20 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci/* JPEG horizontal resolution register lower byte */ 618c2ecf20Sopenharmony_ci#define S5P_JPGX_L 0x24 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ci/* JPEG byte count register upper byte */ 648c2ecf20Sopenharmony_ci#define S5P_JPGCNT_U 0x28 658c2ecf20Sopenharmony_ci 668c2ecf20Sopenharmony_ci/* JPEG byte count register middle byte */ 678c2ecf20Sopenharmony_ci#define S5P_JPGCNT_M 0x2c 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci/* JPEG byte count register lower byte */ 708c2ecf20Sopenharmony_ci#define S5P_JPGCNT_L 0x30 718c2ecf20Sopenharmony_ci 728c2ecf20Sopenharmony_ci/* JPEG interrupt setting register */ 738c2ecf20Sopenharmony_ci#define S5P_JPGINTSE 0x34 748c2ecf20Sopenharmony_ci#define S5P_RSTm_INT_EN_MASK (0x1 << 7) 758c2ecf20Sopenharmony_ci#define S5P_RSTm_INT_EN (0x1 << 7) 768c2ecf20Sopenharmony_ci#define S5P_DATA_NUM_INT_EN_MASK (0x1 << 6) 778c2ecf20Sopenharmony_ci#define S5P_DATA_NUM_INT_EN (0x1 << 6) 788c2ecf20Sopenharmony_ci#define S5P_FINAL_MCU_NUM_INT_EN_MASK (0x1 << 5) 798c2ecf20Sopenharmony_ci#define S5P_FINAL_MCU_NUM_INT_EN (0x1 << 5) 808c2ecf20Sopenharmony_ci 818c2ecf20Sopenharmony_ci/* JPEG interrupt status register */ 828c2ecf20Sopenharmony_ci#define S5P_JPGINTST 0x38 838c2ecf20Sopenharmony_ci#define S5P_RESULT_STAT_SHIFT 6 848c2ecf20Sopenharmony_ci#define S5P_RESULT_STAT_MASK (0x1 << S5P_RESULT_STAT_SHIFT) 858c2ecf20Sopenharmony_ci#define S5P_STREAM_STAT_SHIFT 5 868c2ecf20Sopenharmony_ci#define S5P_STREAM_STAT_MASK (0x1 << S5P_STREAM_STAT_SHIFT) 878c2ecf20Sopenharmony_ci 888c2ecf20Sopenharmony_ci/* JPEG command register */ 898c2ecf20Sopenharmony_ci#define S5P_JPGCOM 0x4c 908c2ecf20Sopenharmony_ci#define S5P_INT_RELEASE (0x1 << 2) 918c2ecf20Sopenharmony_ci 928c2ecf20Sopenharmony_ci/* Raw image data r/w address register */ 938c2ecf20Sopenharmony_ci#define S5P_JPG_IMGADR 0x50 948c2ecf20Sopenharmony_ci 958c2ecf20Sopenharmony_ci/* JPEG file r/w address register */ 968c2ecf20Sopenharmony_ci#define S5P_JPG_JPGADR 0x58 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci/* Coefficient for RGB-to-YCbCr converter register */ 998c2ecf20Sopenharmony_ci#define S5P_JPG_COEF(n) (0x5c + (((n) - 1) << 2)) 1008c2ecf20Sopenharmony_ci#define S5P_COEFn_SHIFT(j) ((3 - (j)) << 3) 1018c2ecf20Sopenharmony_ci#define S5P_COEFn_MASK(j) (0xff << S5P_COEFn_SHIFT(j)) 1028c2ecf20Sopenharmony_ci 1038c2ecf20Sopenharmony_ci/* JPEG color mode register */ 1048c2ecf20Sopenharmony_ci#define S5P_JPGCMOD 0x68 1058c2ecf20Sopenharmony_ci#define S5P_MOD_SEL_MASK (0x7 << 5) 1068c2ecf20Sopenharmony_ci#define S5P_MOD_SEL_422 (0x1 << 5) 1078c2ecf20Sopenharmony_ci#define S5P_MOD_SEL_565 (0x2 << 5) 1088c2ecf20Sopenharmony_ci#define S5P_MODE_Y16_MASK (0x1 << 1) 1098c2ecf20Sopenharmony_ci#define S5P_MODE_Y16 (0x1 << 1) 1108c2ecf20Sopenharmony_ci 1118c2ecf20Sopenharmony_ci/* JPEG clock control register */ 1128c2ecf20Sopenharmony_ci#define S5P_JPGCLKCON 0x6c 1138c2ecf20Sopenharmony_ci#define S5P_CLK_DOWN_READY (0x1 << 1) 1148c2ecf20Sopenharmony_ci#define S5P_POWER_ON (0x1 << 0) 1158c2ecf20Sopenharmony_ci 1168c2ecf20Sopenharmony_ci/* JPEG start register */ 1178c2ecf20Sopenharmony_ci#define S5P_JSTART 0x70 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci/* JPEG SW reset register */ 1208c2ecf20Sopenharmony_ci#define S5P_JPG_SW_RESET 0x78 1218c2ecf20Sopenharmony_ci 1228c2ecf20Sopenharmony_ci/* JPEG timer setting register */ 1238c2ecf20Sopenharmony_ci#define S5P_JPG_TIMER_SE 0x7c 1248c2ecf20Sopenharmony_ci#define S5P_TIMER_INT_EN_MASK (0x1UL << 31) 1258c2ecf20Sopenharmony_ci#define S5P_TIMER_INT_EN (0x1UL << 31) 1268c2ecf20Sopenharmony_ci#define S5P_TIMER_INIT_MASK 0x7fffffff 1278c2ecf20Sopenharmony_ci 1288c2ecf20Sopenharmony_ci/* JPEG timer status register */ 1298c2ecf20Sopenharmony_ci#define S5P_JPG_TIMER_ST 0x80 1308c2ecf20Sopenharmony_ci#define S5P_TIMER_INT_STAT_SHIFT 31 1318c2ecf20Sopenharmony_ci#define S5P_TIMER_INT_STAT_MASK (0x1UL << S5P_TIMER_INT_STAT_SHIFT) 1328c2ecf20Sopenharmony_ci#define S5P_TIMER_CNT_SHIFT 0 1338c2ecf20Sopenharmony_ci#define S5P_TIMER_CNT_MASK 0x7fffffff 1348c2ecf20Sopenharmony_ci 1358c2ecf20Sopenharmony_ci/* JPEG decompression output format register */ 1368c2ecf20Sopenharmony_ci#define S5P_JPG_OUTFORM 0x88 1378c2ecf20Sopenharmony_ci#define S5P_DEC_OUT_FORMAT_MASK (0x1 << 0) 1388c2ecf20Sopenharmony_ci#define S5P_DEC_OUT_FORMAT_422 (0x0 << 0) 1398c2ecf20Sopenharmony_ci#define S5P_DEC_OUT_FORMAT_420 (0x1 << 0) 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci/* JPEG version register */ 1428c2ecf20Sopenharmony_ci#define S5P_JPG_VERSION 0x8c 1438c2ecf20Sopenharmony_ci 1448c2ecf20Sopenharmony_ci/* JPEG compressed stream size interrupt setting register */ 1458c2ecf20Sopenharmony_ci#define S5P_JPG_ENC_STREAM_INTSE 0x98 1468c2ecf20Sopenharmony_ci#define S5P_ENC_STREAM_INT_MASK (0x1 << 24) 1478c2ecf20Sopenharmony_ci#define S5P_ENC_STREAM_INT_EN (0x1 << 24) 1488c2ecf20Sopenharmony_ci#define S5P_ENC_STREAM_BOUND_MASK 0xffffff 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci/* JPEG compressed stream size interrupt status register */ 1518c2ecf20Sopenharmony_ci#define S5P_JPG_ENC_STREAM_INTST 0x9c 1528c2ecf20Sopenharmony_ci#define S5P_ENC_STREAM_INT_STAT_MASK 0x1 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci/* JPEG quantizer table register */ 1558c2ecf20Sopenharmony_ci#define S5P_JPG_QTBL_CONTENT(n) (0x400 + (n) * 0x100) 1568c2ecf20Sopenharmony_ci 1578c2ecf20Sopenharmony_ci/* JPEG DC Huffman table register */ 1588c2ecf20Sopenharmony_ci#define S5P_JPG_HDCTBL(n) (0x800 + (n) * 0x400) 1598c2ecf20Sopenharmony_ci 1608c2ecf20Sopenharmony_ci/* JPEG DC Huffman table register */ 1618c2ecf20Sopenharmony_ci#define S5P_JPG_HDCTBLG(n) (0x840 + (n) * 0x400) 1628c2ecf20Sopenharmony_ci 1638c2ecf20Sopenharmony_ci/* JPEG AC Huffman table register */ 1648c2ecf20Sopenharmony_ci#define S5P_JPG_HACTBL(n) (0x880 + (n) * 0x400) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci/* JPEG AC Huffman table register */ 1678c2ecf20Sopenharmony_ci#define S5P_JPG_HACTBLG(n) (0x8c0 + (n) * 0x400) 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_ci 1708c2ecf20Sopenharmony_ci/* Register and bit definitions for Exynos 4x12 */ 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci/* JPEG Codec Control Registers */ 1738c2ecf20Sopenharmony_ci#define EXYNOS4_JPEG_CNTL_REG 0x00 1748c2ecf20Sopenharmony_ci#define EXYNOS4_INT_EN_REG 0x04 1758c2ecf20Sopenharmony_ci#define EXYNOS4_INT_TIMER_COUNT_REG 0x08 1768c2ecf20Sopenharmony_ci#define EXYNOS4_INT_STATUS_REG 0x0c 1778c2ecf20Sopenharmony_ci#define EXYNOS4_OUT_MEM_BASE_REG 0x10 1788c2ecf20Sopenharmony_ci#define EXYNOS4_JPEG_IMG_SIZE_REG 0x14 1798c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_BA_PLANE_1_REG 0x18 1808c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_SO_PLANE_1_REG 0x1c 1818c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_PO_PLANE_1_REG 0x20 1828c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_BA_PLANE_2_REG 0x24 1838c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_SO_PLANE_2_REG 0x28 1848c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_PO_PLANE_2_REG 0x2c 1858c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_BA_PLANE_3_REG 0x30 1868c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_SO_PLANE_3_REG 0x34 1878c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_PO_PLANE_3_REG 0x38 1888c2ecf20Sopenharmony_ci 1898c2ecf20Sopenharmony_ci#define EXYNOS4_TBL_SEL_REG 0x3c 1908c2ecf20Sopenharmony_ci 1918c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_FMT_REG 0x40 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_ci#define EXYNOS4_BITSTREAM_SIZE_REG 0x44 1948c2ecf20Sopenharmony_ci#define EXYNOS4_PADDING_REG 0x48 1958c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_CNT_REG 0x4c 1968c2ecf20Sopenharmony_ci#define EXYNOS4_FIFO_STATUS_REG 0x50 1978c2ecf20Sopenharmony_ci#define EXYNOS4_DECODE_XY_SIZE_REG 0x54 1988c2ecf20Sopenharmony_ci#define EXYNOS4_DECODE_IMG_FMT_REG 0x58 1998c2ecf20Sopenharmony_ci 2008c2ecf20Sopenharmony_ci#define EXYNOS4_QUAN_TBL_ENTRY_REG 0x100 2018c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_ENTRY_REG 0x200 2028c2ecf20Sopenharmony_ci 2038c2ecf20Sopenharmony_ci 2048c2ecf20Sopenharmony_ci/****************************************************************/ 2058c2ecf20Sopenharmony_ci/* Bit definition part */ 2068c2ecf20Sopenharmony_ci/****************************************************************/ 2078c2ecf20Sopenharmony_ci 2088c2ecf20Sopenharmony_ci/* JPEG CNTL Register bit */ 2098c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_DEC_MODE_MASK (0xfffffffc << 0) 2108c2ecf20Sopenharmony_ci#define EXYNOS4_DEC_MODE (1 << 0) 2118c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_MODE (1 << 1) 2128c2ecf20Sopenharmony_ci#define EXYNOS4_AUTO_RST_MARKER (1 << 2) 2138c2ecf20Sopenharmony_ci#define EXYNOS4_RST_INTERVAL_SHIFT 3 2148c2ecf20Sopenharmony_ci#define EXYNOS4_RST_INTERVAL(x) (((x) & 0xffff) \ 2158c2ecf20Sopenharmony_ci << EXYNOS4_RST_INTERVAL_SHIFT) 2168c2ecf20Sopenharmony_ci#define EXYNOS4_HUF_TBL_EN (1 << 19) 2178c2ecf20Sopenharmony_ci#define EXYNOS4_HOR_SCALING_SHIFT 20 2188c2ecf20Sopenharmony_ci#define EXYNOS4_HOR_SCALING_MASK (3 << EXYNOS4_HOR_SCALING_SHIFT) 2198c2ecf20Sopenharmony_ci#define EXYNOS4_HOR_SCALING(x) (((x) & 0x3) \ 2208c2ecf20Sopenharmony_ci << EXYNOS4_HOR_SCALING_SHIFT) 2218c2ecf20Sopenharmony_ci#define EXYNOS4_VER_SCALING_SHIFT 22 2228c2ecf20Sopenharmony_ci#define EXYNOS4_VER_SCALING_MASK (3 << EXYNOS4_VER_SCALING_SHIFT) 2238c2ecf20Sopenharmony_ci#define EXYNOS4_VER_SCALING(x) (((x) & 0x3) \ 2248c2ecf20Sopenharmony_ci << EXYNOS4_VER_SCALING_SHIFT) 2258c2ecf20Sopenharmony_ci#define EXYNOS4_PADDING (1 << 27) 2268c2ecf20Sopenharmony_ci#define EXYNOS4_SYS_INT_EN (1 << 28) 2278c2ecf20Sopenharmony_ci#define EXYNOS4_SOFT_RESET_HI (1 << 29) 2288c2ecf20Sopenharmony_ci 2298c2ecf20Sopenharmony_ci/* JPEG INT Register bit */ 2308c2ecf20Sopenharmony_ci#define EXYNOS4_INT_EN_MASK (0x1f << 0) 2318c2ecf20Sopenharmony_ci#define EXYNOS5433_INT_EN_MASK (0x1ff << 0) 2328c2ecf20Sopenharmony_ci#define EXYNOS4_PROT_ERR_INT_EN (1 << 0) 2338c2ecf20Sopenharmony_ci#define EXYNOS4_IMG_COMPLETION_INT_EN (1 << 1) 2348c2ecf20Sopenharmony_ci#define EXYNOS4_DEC_INVALID_FORMAT_EN (1 << 2) 2358c2ecf20Sopenharmony_ci#define EXYNOS4_MULTI_SCAN_ERROR_EN (1 << 3) 2368c2ecf20Sopenharmony_ci#define EXYNOS4_FRAME_ERR_EN (1 << 4) 2378c2ecf20Sopenharmony_ci#define EXYNOS4_INT_EN_ALL (0x1f << 0) 2388c2ecf20Sopenharmony_ci#define EXYNOS5433_INT_EN_ALL (0x1b6 << 0) 2398c2ecf20Sopenharmony_ci 2408c2ecf20Sopenharmony_ci#define EXYNOS4_MOD_REG_PROC_ENC (0 << 3) 2418c2ecf20Sopenharmony_ci#define EXYNOS4_MOD_REG_PROC_DEC (1 << 3) 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_ci#define EXYNOS4_MOD_REG_SUBSAMPLE_444 (0 << 0) 2448c2ecf20Sopenharmony_ci#define EXYNOS4_MOD_REG_SUBSAMPLE_422 (1 << 0) 2458c2ecf20Sopenharmony_ci#define EXYNOS4_MOD_REG_SUBSAMPLE_420 (2 << 0) 2468c2ecf20Sopenharmony_ci#define EXYNOS4_MOD_REG_SUBSAMPLE_GRAY (3 << 0) 2478c2ecf20Sopenharmony_ci 2488c2ecf20Sopenharmony_ci 2498c2ecf20Sopenharmony_ci/* JPEG IMAGE SIZE Register bit */ 2508c2ecf20Sopenharmony_ci#define EXYNOS4_X_SIZE_SHIFT 0 2518c2ecf20Sopenharmony_ci#define EXYNOS4_X_SIZE_MASK (0xffff << EXYNOS4_X_SIZE_SHIFT) 2528c2ecf20Sopenharmony_ci#define EXYNOS4_X_SIZE(x) (((x) & 0xffff) << EXYNOS4_X_SIZE_SHIFT) 2538c2ecf20Sopenharmony_ci#define EXYNOS4_Y_SIZE_SHIFT 16 2548c2ecf20Sopenharmony_ci#define EXYNOS4_Y_SIZE_MASK (0xffff << EXYNOS4_Y_SIZE_SHIFT) 2558c2ecf20Sopenharmony_ci#define EXYNOS4_Y_SIZE(x) (((x) & 0xffff) << EXYNOS4_Y_SIZE_SHIFT) 2568c2ecf20Sopenharmony_ci 2578c2ecf20Sopenharmony_ci/* JPEG IMAGE FORMAT Register bit */ 2588c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_IN_FMT_MASK 0xffff0000 2598c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_GRAY_IMG (0 << 0) 2608c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_RGB_IMG (1 << 0) 2618c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_YUV_444_IMG (2 << 0) 2628c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_YUV_422_IMG (3 << 0) 2638c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_YUV_440_IMG (4 << 0) 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_ci#define EXYNOS4_DEC_GRAY_IMG (0 << 0) 2668c2ecf20Sopenharmony_ci#define EXYNOS4_DEC_RGB_IMG (1 << 0) 2678c2ecf20Sopenharmony_ci#define EXYNOS4_DEC_YUV_444_IMG (2 << 0) 2688c2ecf20Sopenharmony_ci#define EXYNOS4_DEC_YUV_422_IMG (3 << 0) 2698c2ecf20Sopenharmony_ci#define EXYNOS4_DEC_YUV_420_IMG (4 << 0) 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci#define EXYNOS4_GRAY_IMG_IP_SHIFT 3 2728c2ecf20Sopenharmony_ci#define EXYNOS4_GRAY_IMG_IP_MASK (7 << EXYNOS4_GRAY_IMG_IP_SHIFT) 2738c2ecf20Sopenharmony_ci#define EXYNOS4_GRAY_IMG_IP (4 << EXYNOS4_GRAY_IMG_IP_SHIFT) 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_ci#define EXYNOS4_RGB_IP_SHIFT 6 2768c2ecf20Sopenharmony_ci#define EXYNOS4_RGB_IP_MASK (7 << EXYNOS4_RGB_IP_SHIFT) 2778c2ecf20Sopenharmony_ci#define EXYNOS4_RGB_IP_RGB_16BIT_IMG (4 << EXYNOS4_RGB_IP_SHIFT) 2788c2ecf20Sopenharmony_ci#define EXYNOS4_RGB_IP_RGB_32BIT_IMG (5 << EXYNOS4_RGB_IP_SHIFT) 2798c2ecf20Sopenharmony_ci 2808c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_444_IP_SHIFT 9 2818c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_444_IP_MASK (7 << EXYNOS4_YUV_444_IP_SHIFT) 2828c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_444_IP_YUV_444_2P_IMG (4 << EXYNOS4_YUV_444_IP_SHIFT) 2838c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_444_IP_YUV_444_3P_IMG (5 << EXYNOS4_YUV_444_IP_SHIFT) 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_422_IP_SHIFT 12 2868c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_422_IP_MASK (7 << EXYNOS4_YUV_422_IP_SHIFT) 2878c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_422_IP_YUV_422_1P_IMG (4 << EXYNOS4_YUV_422_IP_SHIFT) 2888c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_422_IP_YUV_422_2P_IMG (5 << EXYNOS4_YUV_422_IP_SHIFT) 2898c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_422_IP_YUV_422_3P_IMG (6 << EXYNOS4_YUV_422_IP_SHIFT) 2908c2ecf20Sopenharmony_ci 2918c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_420_IP_SHIFT 15 2928c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_420_IP_MASK (7 << EXYNOS4_YUV_420_IP_SHIFT) 2938c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_420_IP_YUV_420_2P_IMG (4 << EXYNOS4_YUV_420_IP_SHIFT) 2948c2ecf20Sopenharmony_ci#define EXYNOS4_YUV_420_IP_YUV_420_3P_IMG (5 << EXYNOS4_YUV_420_IP_SHIFT) 2958c2ecf20Sopenharmony_ci 2968c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_FMT_SHIFT 24 2978c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_FMT_MASK (3 << EXYNOS4_ENC_FMT_SHIFT) 2988c2ecf20Sopenharmony_ci#define EXYNOS5433_ENC_FMT_MASK (7 << EXYNOS4_ENC_FMT_SHIFT) 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_FMT_GRAY (0 << EXYNOS4_ENC_FMT_SHIFT) 3018c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_FMT_YUV_444 (1 << EXYNOS4_ENC_FMT_SHIFT) 3028c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_FMT_YUV_422 (2 << EXYNOS4_ENC_FMT_SHIFT) 3038c2ecf20Sopenharmony_ci#define EXYNOS4_ENC_FMT_YUV_420 (3 << EXYNOS4_ENC_FMT_SHIFT) 3048c2ecf20Sopenharmony_ci 3058c2ecf20Sopenharmony_ci#define EXYNOS4_JPEG_DECODED_IMG_FMT_MASK 0x03 3068c2ecf20Sopenharmony_ci 3078c2ecf20Sopenharmony_ci#define EXYNOS4_SWAP_CHROMA_CRCB (1 << 26) 3088c2ecf20Sopenharmony_ci#define EXYNOS4_SWAP_CHROMA_CBCR (0 << 26) 3098c2ecf20Sopenharmony_ci#define EXYNOS5433_SWAP_CHROMA_CRCB (1 << 27) 3108c2ecf20Sopenharmony_ci#define EXYNOS5433_SWAP_CHROMA_CBCR (0 << 27) 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ci/* JPEG HUFF count Register bit */ 3138c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_COUNT_MASK 0xffff 3148c2ecf20Sopenharmony_ci 3158c2ecf20Sopenharmony_ci/* JPEG Decoded_img_x_y_size Register bit */ 3168c2ecf20Sopenharmony_ci#define EXYNOS4_DECODED_SIZE_MASK 0x0000ffff 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_ci/* JPEG Decoded image format Register bit */ 3198c2ecf20Sopenharmony_ci#define EXYNOS4_DECODED_IMG_FMT_MASK 0x3 3208c2ecf20Sopenharmony_ci 3218c2ecf20Sopenharmony_ci/* JPEG TBL SEL Register bit */ 3228c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP(c, n) ((n) << (((c) - 1) << 1)) 3238c2ecf20Sopenharmony_ci 3248c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP1_0 EXYNOS4_Q_TBL_COMP(1, 0) 3258c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP1_1 EXYNOS4_Q_TBL_COMP(1, 1) 3268c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP1_2 EXYNOS4_Q_TBL_COMP(1, 2) 3278c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP1_3 EXYNOS4_Q_TBL_COMP(1, 3) 3288c2ecf20Sopenharmony_ci 3298c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP2_0 EXYNOS4_Q_TBL_COMP(2, 0) 3308c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP2_1 EXYNOS4_Q_TBL_COMP(2, 1) 3318c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP2_2 EXYNOS4_Q_TBL_COMP(2, 2) 3328c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP2_3 EXYNOS4_Q_TBL_COMP(2, 3) 3338c2ecf20Sopenharmony_ci 3348c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP3_0 EXYNOS4_Q_TBL_COMP(3, 0) 3358c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP3_1 EXYNOS4_Q_TBL_COMP(3, 1) 3368c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP3_2 EXYNOS4_Q_TBL_COMP(3, 2) 3378c2ecf20Sopenharmony_ci#define EXYNOS4_Q_TBL_COMP3_3 EXYNOS4_Q_TBL_COMP(3, 3) 3388c2ecf20Sopenharmony_ci 3398c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP(c, n) ((n) << ((((c) - 1) << 1) + 6)) 3408c2ecf20Sopenharmony_ci 3418c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP1_AC_0_DC_0 \ 3428c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(1, 0) 3438c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP1_AC_0_DC_1 \ 3448c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(1, 1) 3458c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP1_AC_1_DC_0 \ 3468c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(1, 2) 3478c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP1_AC_1_DC_1 \ 3488c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(1, 3) 3498c2ecf20Sopenharmony_ci 3508c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP2_AC_0_DC_0 \ 3518c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(2, 0) 3528c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP2_AC_0_DC_1 \ 3538c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(2, 1) 3548c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP2_AC_1_DC_0 \ 3558c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(2, 2) 3568c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP2_AC_1_DC_1 \ 3578c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(2, 3) 3588c2ecf20Sopenharmony_ci 3598c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP3_AC_0_DC_0 \ 3608c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(3, 0) 3618c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP3_AC_0_DC_1 \ 3628c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(3, 1) 3638c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP3_AC_1_DC_0 \ 3648c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(3, 2) 3658c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_COMP3_AC_1_DC_1 \ 3668c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP(3, 3) 3678c2ecf20Sopenharmony_ci 3688c2ecf20Sopenharmony_ci#define EXYNOS4_NF_SHIFT 16 3698c2ecf20Sopenharmony_ci#define EXYNOS4_NF_MASK 0xff 3708c2ecf20Sopenharmony_ci#define EXYNOS4_NF(x) \ 3718c2ecf20Sopenharmony_ci (((x) & EXYNOS4_NF_MASK) << EXYNOS4_NF_SHIFT) 3728c2ecf20Sopenharmony_ci 3738c2ecf20Sopenharmony_ci/* JPEG quantizer table register */ 3748c2ecf20Sopenharmony_ci#define EXYNOS4_QTBL_CONTENT(n) (0x100 + (n) * 0x40) 3758c2ecf20Sopenharmony_ci 3768c2ecf20Sopenharmony_ci/* JPEG DC luminance (code length) Huffman table register */ 3778c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_HDCLL 0x200 3788c2ecf20Sopenharmony_ci 3798c2ecf20Sopenharmony_ci/* JPEG DC luminance (values) Huffman table register */ 3808c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_HDCLV 0x210 3818c2ecf20Sopenharmony_ci 3828c2ecf20Sopenharmony_ci/* JPEG DC chrominance (code length) Huffman table register */ 3838c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_HDCCL 0x220 3848c2ecf20Sopenharmony_ci 3858c2ecf20Sopenharmony_ci/* JPEG DC chrominance (values) Huffman table register */ 3868c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_HDCCV 0x230 3878c2ecf20Sopenharmony_ci 3888c2ecf20Sopenharmony_ci/* JPEG AC luminance (code length) Huffman table register */ 3898c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_HACLL 0x240 3908c2ecf20Sopenharmony_ci 3918c2ecf20Sopenharmony_ci/* JPEG AC luminance (values) Huffman table register */ 3928c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_HACLV 0x250 3938c2ecf20Sopenharmony_ci 3948c2ecf20Sopenharmony_ci/* JPEG AC chrominance (code length) Huffman table register */ 3958c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_HACCL 0x300 3968c2ecf20Sopenharmony_ci 3978c2ecf20Sopenharmony_ci/* JPEG AC chrominance (values) Huffman table register */ 3988c2ecf20Sopenharmony_ci#define EXYNOS4_HUFF_TBL_HACCV 0x310 3998c2ecf20Sopenharmony_ci 4008c2ecf20Sopenharmony_ci/* Register and bit definitions for Exynos 3250 */ 4018c2ecf20Sopenharmony_ci 4028c2ecf20Sopenharmony_ci/* JPEG mode register */ 4038c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGMOD 0x00 4048c2ecf20Sopenharmony_ci#define EXYNOS3250_PROC_MODE_MASK (0x1 << 3) 4058c2ecf20Sopenharmony_ci#define EXYNOS3250_PROC_MODE_DECOMPR (0x1 << 3) 4068c2ecf20Sopenharmony_ci#define EXYNOS3250_PROC_MODE_COMPR (0x0 << 3) 4078c2ecf20Sopenharmony_ci#define EXYNOS3250_SUBSAMPLING_MODE_MASK (0x7 << 0) 4088c2ecf20Sopenharmony_ci#define EXYNOS3250_SUBSAMPLING_MODE_444 (0x0 << 0) 4098c2ecf20Sopenharmony_ci#define EXYNOS3250_SUBSAMPLING_MODE_422 (0x1 << 0) 4108c2ecf20Sopenharmony_ci#define EXYNOS3250_SUBSAMPLING_MODE_420 (0x2 << 0) 4118c2ecf20Sopenharmony_ci#define EXYNOS3250_SUBSAMPLING_MODE_411 (0x6 << 0) 4128c2ecf20Sopenharmony_ci#define EXYNOS3250_SUBSAMPLING_MODE_GRAY (0x3 << 0) 4138c2ecf20Sopenharmony_ci 4148c2ecf20Sopenharmony_ci/* JPEG operation status register */ 4158c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGOPR 0x04 4168c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGOPR_MASK 0x01 4178c2ecf20Sopenharmony_ci 4188c2ecf20Sopenharmony_ci/* Quantization and Huffman tables register */ 4198c2ecf20Sopenharmony_ci#define EXYNOS3250_QHTBL 0x08 4208c2ecf20Sopenharmony_ci#define EXYNOS3250_QT_NUM_SHIFT(t) ((((t) - 1) << 1) + 8) 4218c2ecf20Sopenharmony_ci#define EXYNOS3250_QT_NUM_MASK(t) (0x3 << EXYNOS3250_QT_NUM_SHIFT(t)) 4228c2ecf20Sopenharmony_ci 4238c2ecf20Sopenharmony_ci/* Huffman tables */ 4248c2ecf20Sopenharmony_ci#define EXYNOS3250_HT_NUM_AC_SHIFT(t) (((t) << 1) - 1) 4258c2ecf20Sopenharmony_ci#define EXYNOS3250_HT_NUM_AC_MASK(t) (0x1 << EXYNOS3250_HT_NUM_AC_SHIFT(t)) 4268c2ecf20Sopenharmony_ci 4278c2ecf20Sopenharmony_ci#define EXYNOS3250_HT_NUM_DC_SHIFT(t) (((t) - 1) << 1) 4288c2ecf20Sopenharmony_ci#define EXYNOS3250_HT_NUM_DC_MASK(t) (0x1 << EXYNOS3250_HT_NUM_DC_SHIFT(t)) 4298c2ecf20Sopenharmony_ci 4308c2ecf20Sopenharmony_ci/* JPEG restart interval register */ 4318c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGDRI 0x0c 4328c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGDRI_MASK 0xffff 4338c2ecf20Sopenharmony_ci 4348c2ecf20Sopenharmony_ci/* JPEG vertical resolution register */ 4358c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGY 0x10 4368c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGY_MASK 0xffff 4378c2ecf20Sopenharmony_ci 4388c2ecf20Sopenharmony_ci/* JPEG horizontal resolution register */ 4398c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGX 0x14 4408c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGX_MASK 0xffff 4418c2ecf20Sopenharmony_ci 4428c2ecf20Sopenharmony_ci/* JPEG byte count register */ 4438c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGCNT 0x18 4448c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGCNT_MASK 0xffffff 4458c2ecf20Sopenharmony_ci 4468c2ecf20Sopenharmony_ci/* JPEG interrupt mask register */ 4478c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGINTSE 0x1c 4488c2ecf20Sopenharmony_ci#define EXYNOS3250_JPEG_DONE_EN (1 << 11) 4498c2ecf20Sopenharmony_ci#define EXYNOS3250_WDMA_DONE_EN (1 << 10) 4508c2ecf20Sopenharmony_ci#define EXYNOS3250_RDMA_DONE_EN (1 << 9) 4518c2ecf20Sopenharmony_ci#define EXYNOS3250_ENC_STREAM_INT_EN (1 << 8) 4528c2ecf20Sopenharmony_ci#define EXYNOS3250_CORE_DONE_EN (1 << 5) 4538c2ecf20Sopenharmony_ci#define EXYNOS3250_ERR_INT_EN (1 << 4) 4548c2ecf20Sopenharmony_ci#define EXYNOS3250_HEAD_INT_EN (1 << 3) 4558c2ecf20Sopenharmony_ci 4568c2ecf20Sopenharmony_ci/* JPEG interrupt status register */ 4578c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGINTST 0x20 4588c2ecf20Sopenharmony_ci#define EXYNOS3250_JPEG_DONE (1 << 11) 4598c2ecf20Sopenharmony_ci#define EXYNOS3250_WDMA_DONE (1 << 10) 4608c2ecf20Sopenharmony_ci#define EXYNOS3250_RDMA_DONE (1 << 9) 4618c2ecf20Sopenharmony_ci#define EXYNOS3250_ENC_STREAM_STAT (1 << 8) 4628c2ecf20Sopenharmony_ci#define EXYNOS3250_RESULT_STAT (1 << 5) 4638c2ecf20Sopenharmony_ci#define EXYNOS3250_STREAM_STAT (1 << 4) 4648c2ecf20Sopenharmony_ci#define EXYNOS3250_HEADER_STAT (1 << 3) 4658c2ecf20Sopenharmony_ci 4668c2ecf20Sopenharmony_ci/* 4678c2ecf20Sopenharmony_ci * Base address of the luma component DMA buffer 4688c2ecf20Sopenharmony_ci * of the raw input or output image. 4698c2ecf20Sopenharmony_ci */ 4708c2ecf20Sopenharmony_ci#define EXYNOS3250_LUMA_BASE 0x100 4718c2ecf20Sopenharmony_ci#define EXYNOS3250_SRC_TILE_EN_MASK 0x100 4728c2ecf20Sopenharmony_ci 4738c2ecf20Sopenharmony_ci/* Stride of source or destination luma raw image buffer */ 4748c2ecf20Sopenharmony_ci#define EXYNOS3250_LUMA_STRIDE 0x104 4758c2ecf20Sopenharmony_ci 4768c2ecf20Sopenharmony_ci/* Horizontal/vertical offset of active region in luma raw image buffer */ 4778c2ecf20Sopenharmony_ci#define EXYNOS3250_LUMA_XY_OFFSET 0x108 4788c2ecf20Sopenharmony_ci#define EXYNOS3250_LUMA_YY_OFFSET_SHIFT 18 4798c2ecf20Sopenharmony_ci#define EXYNOS3250_LUMA_YY_OFFSET_MASK (0x1fff << EXYNOS3250_LUMA_YY_OFFSET_SHIFT) 4808c2ecf20Sopenharmony_ci#define EXYNOS3250_LUMA_YX_OFFSET_SHIFT 2 4818c2ecf20Sopenharmony_ci#define EXYNOS3250_LUMA_YX_OFFSET_MASK (0x1fff << EXYNOS3250_LUMA_YX_OFFSET_SHIFT) 4828c2ecf20Sopenharmony_ci 4838c2ecf20Sopenharmony_ci/* 4848c2ecf20Sopenharmony_ci * Base address of the chroma(Cb) component DMA buffer 4858c2ecf20Sopenharmony_ci * of the raw input or output image. 4868c2ecf20Sopenharmony_ci */ 4878c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_BASE 0x10c 4888c2ecf20Sopenharmony_ci 4898c2ecf20Sopenharmony_ci/* Stride of source or destination chroma(Cb) raw image buffer */ 4908c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_STRIDE 0x110 4918c2ecf20Sopenharmony_ci 4928c2ecf20Sopenharmony_ci/* Horizontal/vertical offset of active region in chroma(Cb) raw image buffer */ 4938c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_XY_OFFSET 0x114 4948c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_YY_OFFSET_SHIFT 18 4958c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_YY_OFFSET_MASK (0x1fff << EXYNOS3250_CHROMA_YY_OFFSET_SHIFT) 4968c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_YX_OFFSET_SHIFT 2 4978c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_YX_OFFSET_MASK (0x1fff << EXYNOS3250_CHROMA_YX_OFFSET_SHIFT) 4988c2ecf20Sopenharmony_ci 4998c2ecf20Sopenharmony_ci/* 5008c2ecf20Sopenharmony_ci * Base address of the chroma(Cr) component DMA buffer 5018c2ecf20Sopenharmony_ci * of the raw input or output image. 5028c2ecf20Sopenharmony_ci */ 5038c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_CR_BASE 0x118 5048c2ecf20Sopenharmony_ci 5058c2ecf20Sopenharmony_ci/* Stride of source or destination chroma(Cr) raw image buffer */ 5068c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_CR_STRIDE 0x11c 5078c2ecf20Sopenharmony_ci 5088c2ecf20Sopenharmony_ci/* Horizontal/vertical offset of active region in chroma(Cb) raw image buffer */ 5098c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_CR_XY_OFFSET 0x120 5108c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_CR_YY_OFFSET_SHIFT 18 5118c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_CR_YY_OFFSET_MASK (0x1fff << EXYNOS3250_CHROMA_CR_YY_OFFSET_SHIFT) 5128c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_CR_YX_OFFSET_SHIFT 2 5138c2ecf20Sopenharmony_ci#define EXYNOS3250_CHROMA_CR_YX_OFFSET_MASK (0x1fff << EXYNOS3250_CHROMA_CR_YX_OFFSET_SHIFT) 5148c2ecf20Sopenharmony_ci 5158c2ecf20Sopenharmony_ci/* Raw image data r/w address register */ 5168c2ecf20Sopenharmony_ci#define EXYNOS3250_JPG_IMGADR 0x50 5178c2ecf20Sopenharmony_ci 5188c2ecf20Sopenharmony_ci/* Source or destination JPEG file DMA buffer address */ 5198c2ecf20Sopenharmony_ci#define EXYNOS3250_JPG_JPGADR 0x124 5208c2ecf20Sopenharmony_ci 5218c2ecf20Sopenharmony_ci/* Coefficients for RGB-to-YCbCr converter register */ 5228c2ecf20Sopenharmony_ci#define EXYNOS3250_JPG_COEF(n) (0x128 + (((n) - 1) << 2)) 5238c2ecf20Sopenharmony_ci#define EXYNOS3250_COEF_SHIFT(j) ((3 - (j)) << 3) 5248c2ecf20Sopenharmony_ci#define EXYNOS3250_COEF_MASK(j) (0xff << EXYNOS3250_COEF_SHIFT(j)) 5258c2ecf20Sopenharmony_ci 5268c2ecf20Sopenharmony_ci/* Raw input format setting */ 5278c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGCMOD 0x134 5288c2ecf20Sopenharmony_ci#define EXYNOS3250_SRC_TILE_EN (0x1 << 10) 5298c2ecf20Sopenharmony_ci#define EXYNOS3250_SRC_NV_MASK (0x1 << 9) 5308c2ecf20Sopenharmony_ci#define EXYNOS3250_SRC_NV12 (0x0 << 9) 5318c2ecf20Sopenharmony_ci#define EXYNOS3250_SRC_NV21 (0x1 << 9) 5328c2ecf20Sopenharmony_ci#define EXYNOS3250_SRC_BIG_ENDIAN_MASK (0x1 << 8) 5338c2ecf20Sopenharmony_ci#define EXYNOS3250_SRC_BIG_ENDIAN (0x1 << 8) 5348c2ecf20Sopenharmony_ci#define EXYNOS3250_MODE_SEL_MASK (0x7 << 5) 5358c2ecf20Sopenharmony_ci#define EXYNOS3250_MODE_SEL_420_2P (0x0 << 5) 5368c2ecf20Sopenharmony_ci#define EXYNOS3250_MODE_SEL_422_1P_LUM_CHR (0x1 << 5) 5378c2ecf20Sopenharmony_ci#define EXYNOS3250_MODE_SEL_RGB565 (0x2 << 5) 5388c2ecf20Sopenharmony_ci#define EXYNOS3250_MODE_SEL_422_1P_CHR_LUM (0x3 << 5) 5398c2ecf20Sopenharmony_ci#define EXYNOS3250_MODE_SEL_ARGB8888 (0x4 << 5) 5408c2ecf20Sopenharmony_ci#define EXYNOS3250_MODE_SEL_420_3P (0x5 << 5) 5418c2ecf20Sopenharmony_ci#define EXYNOS3250_SRC_SWAP_RGB (0x1 << 3) 5428c2ecf20Sopenharmony_ci#define EXYNOS3250_SRC_SWAP_UV (0x1 << 2) 5438c2ecf20Sopenharmony_ci#define EXYNOS3250_MODE_Y16_MASK (0x1 << 1) 5448c2ecf20Sopenharmony_ci#define EXYNOS3250_MODE_Y16 (0x1 << 1) 5458c2ecf20Sopenharmony_ci#define EXYNOS3250_HALF_EN_MASK (0x1 << 0) 5468c2ecf20Sopenharmony_ci#define EXYNOS3250_HALF_EN (0x1 << 0) 5478c2ecf20Sopenharmony_ci 5488c2ecf20Sopenharmony_ci/* Power on/off and clock down control */ 5498c2ecf20Sopenharmony_ci#define EXYNOS3250_JPGCLKCON 0x138 5508c2ecf20Sopenharmony_ci#define EXYNOS3250_CLK_DOWN_READY (0x1 << 1) 5518c2ecf20Sopenharmony_ci#define EXYNOS3250_POWER_ON (0x1 << 0) 5528c2ecf20Sopenharmony_ci 5538c2ecf20Sopenharmony_ci/* Start compression or decompression */ 5548c2ecf20Sopenharmony_ci#define EXYNOS3250_JSTART 0x13c 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_ci/* Restart decompression after header analysis */ 5578c2ecf20Sopenharmony_ci#define EXYNOS3250_JRSTART 0x140 5588c2ecf20Sopenharmony_ci 5598c2ecf20Sopenharmony_ci/* JPEG SW reset register */ 5608c2ecf20Sopenharmony_ci#define EXYNOS3250_SW_RESET 0x144 5618c2ecf20Sopenharmony_ci 5628c2ecf20Sopenharmony_ci/* JPEG timer setting register */ 5638c2ecf20Sopenharmony_ci#define EXYNOS3250_TIMER_SE 0x148 5648c2ecf20Sopenharmony_ci#define EXYNOS3250_TIMER_INT_EN_SHIFT 31 5658c2ecf20Sopenharmony_ci#define EXYNOS3250_TIMER_INT_EN (1UL << EXYNOS3250_TIMER_INT_EN_SHIFT) 5668c2ecf20Sopenharmony_ci#define EXYNOS3250_TIMER_INIT_MASK 0x7fffffff 5678c2ecf20Sopenharmony_ci 5688c2ecf20Sopenharmony_ci/* JPEG timer status register */ 5698c2ecf20Sopenharmony_ci#define EXYNOS3250_TIMER_ST 0x14c 5708c2ecf20Sopenharmony_ci#define EXYNOS3250_TIMER_INT_STAT_SHIFT 31 5718c2ecf20Sopenharmony_ci#define EXYNOS3250_TIMER_INT_STAT (1UL << EXYNOS3250_TIMER_INT_STAT_SHIFT) 5728c2ecf20Sopenharmony_ci#define EXYNOS3250_TIMER_CNT_SHIFT 0 5738c2ecf20Sopenharmony_ci#define EXYNOS3250_TIMER_CNT_MASK 0x7fffffff 5748c2ecf20Sopenharmony_ci 5758c2ecf20Sopenharmony_ci/* Command status register */ 5768c2ecf20Sopenharmony_ci#define EXYNOS3250_COMSTAT 0x150 5778c2ecf20Sopenharmony_ci#define EXYNOS3250_CUR_PROC_MODE (0x1 << 1) 5788c2ecf20Sopenharmony_ci#define EXYNOS3250_CUR_COM_MODE (0x1 << 0) 5798c2ecf20Sopenharmony_ci 5808c2ecf20Sopenharmony_ci/* JPEG decompression output format register */ 5818c2ecf20Sopenharmony_ci#define EXYNOS3250_OUTFORM 0x154 5828c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_ALPHA_MASK (0xff << 24) 5838c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_TILE_EN (0x1 << 10) 5848c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_NV_MASK (0x1 << 9) 5858c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_NV12 (0x0 << 9) 5868c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_NV21 (0x1 << 9) 5878c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_BIG_ENDIAN_MASK (0x1 << 8) 5888c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_BIG_ENDIAN (0x1 << 8) 5898c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_SWAP_RGB (0x1 << 7) 5908c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_SWAP_UV (0x1 << 6) 5918c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_FMT_MASK (0x7 << 0) 5928c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_FMT_420_2P (0x0 << 0) 5938c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_FMT_422_1P_LUM_CHR (0x1 << 0) 5948c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_FMT_422_1P_CHR_LUM (0x3 << 0) 5958c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_FMT_420_3P (0x4 << 0) 5968c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_FMT_RGB565 (0x5 << 0) 5978c2ecf20Sopenharmony_ci#define EXYNOS3250_OUT_FMT_ARGB8888 (0x6 << 0) 5988c2ecf20Sopenharmony_ci 5998c2ecf20Sopenharmony_ci/* Input JPEG stream byte size for decompression */ 6008c2ecf20Sopenharmony_ci#define EXYNOS3250_DEC_STREAM_SIZE 0x158 6018c2ecf20Sopenharmony_ci#define EXYNOS3250_DEC_STREAM_MASK 0x1fffffff 6028c2ecf20Sopenharmony_ci 6038c2ecf20Sopenharmony_ci/* The upper bound of the byte size of output compressed stream */ 6048c2ecf20Sopenharmony_ci#define EXYNOS3250_ENC_STREAM_BOUND 0x15c 6058c2ecf20Sopenharmony_ci#define EXYNOS3250_ENC_STREAM_BOUND_MASK 0xffffc0 6068c2ecf20Sopenharmony_ci 6078c2ecf20Sopenharmony_ci/* Scale-down ratio when decoding */ 6088c2ecf20Sopenharmony_ci#define EXYNOS3250_DEC_SCALING_RATIO 0x160 6098c2ecf20Sopenharmony_ci#define EXYNOS3250_DEC_SCALE_FACTOR_MASK 0x3 6108c2ecf20Sopenharmony_ci#define EXYNOS3250_DEC_SCALE_FACTOR_8_8 0x0 6118c2ecf20Sopenharmony_ci#define EXYNOS3250_DEC_SCALE_FACTOR_4_8 0x1 6128c2ecf20Sopenharmony_ci#define EXYNOS3250_DEC_SCALE_FACTOR_2_8 0x2 6138c2ecf20Sopenharmony_ci#define EXYNOS3250_DEC_SCALE_FACTOR_1_8 0x3 6148c2ecf20Sopenharmony_ci 6158c2ecf20Sopenharmony_ci/* Error check */ 6168c2ecf20Sopenharmony_ci#define EXYNOS3250_CRC_RESULT 0x164 6178c2ecf20Sopenharmony_ci 6188c2ecf20Sopenharmony_ci/* RDMA and WDMA operation status register */ 6198c2ecf20Sopenharmony_ci#define EXYNOS3250_DMA_OPER_STATUS 0x168 6208c2ecf20Sopenharmony_ci#define EXYNOS3250_WDMA_OPER_STATUS (0x1 << 1) 6218c2ecf20Sopenharmony_ci#define EXYNOS3250_RDMA_OPER_STATUS (0x1 << 0) 6228c2ecf20Sopenharmony_ci 6238c2ecf20Sopenharmony_ci/* DMA issue gathering number and issue number settings */ 6248c2ecf20Sopenharmony_ci#define EXYNOS3250_DMA_ISSUE_NUM 0x16c 6258c2ecf20Sopenharmony_ci#define EXYNOS3250_WDMA_ISSUE_NUM_SHIFT 16 6268c2ecf20Sopenharmony_ci#define EXYNOS3250_WDMA_ISSUE_NUM_MASK (0x7 << EXYNOS3250_WDMA_ISSUE_NUM_SHIFT) 6278c2ecf20Sopenharmony_ci#define EXYNOS3250_RDMA_ISSUE_NUM_SHIFT 8 6288c2ecf20Sopenharmony_ci#define EXYNOS3250_RDMA_ISSUE_NUM_MASK (0x7 << EXYNOS3250_RDMA_ISSUE_NUM_SHIFT) 6298c2ecf20Sopenharmony_ci#define EXYNOS3250_ISSUE_GATHER_NUM_SHIFT 0 6308c2ecf20Sopenharmony_ci#define EXYNOS3250_ISSUE_GATHER_NUM_MASK (0x7 << EXYNOS3250_ISSUE_GATHER_NUM_SHIFT) 6318c2ecf20Sopenharmony_ci#define EXYNOS3250_DMA_MO_COUNT 0x7 6328c2ecf20Sopenharmony_ci 6338c2ecf20Sopenharmony_ci/* Version register */ 6348c2ecf20Sopenharmony_ci#define EXYNOS3250_VERSION 0x1fc 6358c2ecf20Sopenharmony_ci 6368c2ecf20Sopenharmony_ci/* RGB <-> YUV conversion coefficients */ 6378c2ecf20Sopenharmony_ci#define EXYNOS3250_JPEG_ENC_COEF1 0x01352e1e 6388c2ecf20Sopenharmony_ci#define EXYNOS3250_JPEG_ENC_COEF2 0x00b0ae83 6398c2ecf20Sopenharmony_ci#define EXYNOS3250_JPEG_ENC_COEF3 0x020cdc13 6408c2ecf20Sopenharmony_ci 6418c2ecf20Sopenharmony_ci#define EXYNOS3250_JPEG_DEC_COEF1 0x04a80199 6428c2ecf20Sopenharmony_ci#define EXYNOS3250_JPEG_DEC_COEF2 0x04a9a064 6438c2ecf20Sopenharmony_ci#define EXYNOS3250_JPEG_DEC_COEF3 0x04a80102 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_ci#endif /* JPEG_REGS_H_ */ 6468c2ecf20Sopenharmony_ci 647