18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0-only 28c2ecf20Sopenharmony_ci/* Copyright (c) 2013 Samsung Electronics Co., Ltd. 38c2ecf20Sopenharmony_ci * http://www.samsung.com/ 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Author: Jacek Anaszewski <j.anaszewski@samsung.com> 68c2ecf20Sopenharmony_ci * 78c2ecf20Sopenharmony_ci * Register interface file for JPEG driver on Exynos4x12. 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci#include <linux/io.h> 108c2ecf20Sopenharmony_ci#include <linux/delay.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci#include "jpeg-core.h" 138c2ecf20Sopenharmony_ci#include "jpeg-hw-exynos4.h" 148c2ecf20Sopenharmony_ci#include "jpeg-regs.h" 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_civoid exynos4_jpeg_sw_reset(void __iomem *base) 178c2ecf20Sopenharmony_ci{ 188c2ecf20Sopenharmony_ci unsigned int reg; 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_JPEG_CNTL_REG); 218c2ecf20Sopenharmony_ci writel(reg & ~(EXYNOS4_DEC_MODE | EXYNOS4_ENC_MODE), 228c2ecf20Sopenharmony_ci base + EXYNOS4_JPEG_CNTL_REG); 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_JPEG_CNTL_REG); 258c2ecf20Sopenharmony_ci writel(reg & ~EXYNOS4_SOFT_RESET_HI, base + EXYNOS4_JPEG_CNTL_REG); 268c2ecf20Sopenharmony_ci 278c2ecf20Sopenharmony_ci udelay(100); 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci writel(reg | EXYNOS4_SOFT_RESET_HI, base + EXYNOS4_JPEG_CNTL_REG); 308c2ecf20Sopenharmony_ci} 318c2ecf20Sopenharmony_ci 328c2ecf20Sopenharmony_civoid exynos4_jpeg_set_enc_dec_mode(void __iomem *base, unsigned int mode) 338c2ecf20Sopenharmony_ci{ 348c2ecf20Sopenharmony_ci unsigned int reg; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_JPEG_CNTL_REG); 378c2ecf20Sopenharmony_ci /* set exynos4_jpeg mod register */ 388c2ecf20Sopenharmony_ci if (mode == S5P_JPEG_DECODE) { 398c2ecf20Sopenharmony_ci writel((reg & EXYNOS4_ENC_DEC_MODE_MASK) | 408c2ecf20Sopenharmony_ci EXYNOS4_DEC_MODE, 418c2ecf20Sopenharmony_ci base + EXYNOS4_JPEG_CNTL_REG); 428c2ecf20Sopenharmony_ci } else if (mode == S5P_JPEG_ENCODE) {/* encode */ 438c2ecf20Sopenharmony_ci writel((reg & EXYNOS4_ENC_DEC_MODE_MASK) | 448c2ecf20Sopenharmony_ci EXYNOS4_ENC_MODE, 458c2ecf20Sopenharmony_ci base + EXYNOS4_JPEG_CNTL_REG); 468c2ecf20Sopenharmony_ci } else { /* disable both */ 478c2ecf20Sopenharmony_ci writel(reg & EXYNOS4_ENC_DEC_MODE_MASK, 488c2ecf20Sopenharmony_ci base + EXYNOS4_JPEG_CNTL_REG); 498c2ecf20Sopenharmony_ci } 508c2ecf20Sopenharmony_ci} 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_civoid __exynos4_jpeg_set_img_fmt(void __iomem *base, unsigned int img_fmt, 538c2ecf20Sopenharmony_ci unsigned int version) 548c2ecf20Sopenharmony_ci{ 558c2ecf20Sopenharmony_ci unsigned int reg; 568c2ecf20Sopenharmony_ci unsigned int exynos4_swap_chroma_cbcr; 578c2ecf20Sopenharmony_ci unsigned int exynos4_swap_chroma_crcb; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci if (version == SJPEG_EXYNOS4) { 608c2ecf20Sopenharmony_ci exynos4_swap_chroma_cbcr = EXYNOS4_SWAP_CHROMA_CBCR; 618c2ecf20Sopenharmony_ci exynos4_swap_chroma_crcb = EXYNOS4_SWAP_CHROMA_CRCB; 628c2ecf20Sopenharmony_ci } else { 638c2ecf20Sopenharmony_ci exynos4_swap_chroma_cbcr = EXYNOS5433_SWAP_CHROMA_CBCR; 648c2ecf20Sopenharmony_ci exynos4_swap_chroma_crcb = EXYNOS5433_SWAP_CHROMA_CRCB; 658c2ecf20Sopenharmony_ci } 668c2ecf20Sopenharmony_ci 678c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_IMG_FMT_REG) & 688c2ecf20Sopenharmony_ci EXYNOS4_ENC_IN_FMT_MASK; /* clear except enc format */ 698c2ecf20Sopenharmony_ci 708c2ecf20Sopenharmony_ci switch (img_fmt) { 718c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_GREY: 728c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_ENC_GRAY_IMG | EXYNOS4_GRAY_IMG_IP; 738c2ecf20Sopenharmony_ci break; 748c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_RGB32: 758c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_ENC_RGB_IMG | 768c2ecf20Sopenharmony_ci EXYNOS4_RGB_IP_RGB_32BIT_IMG; 778c2ecf20Sopenharmony_ci break; 788c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_RGB565: 798c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_ENC_RGB_IMG | 808c2ecf20Sopenharmony_ci EXYNOS4_RGB_IP_RGB_16BIT_IMG; 818c2ecf20Sopenharmony_ci break; 828c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_NV24: 838c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_ENC_YUV_444_IMG | 848c2ecf20Sopenharmony_ci EXYNOS4_YUV_444_IP_YUV_444_2P_IMG | 858c2ecf20Sopenharmony_ci exynos4_swap_chroma_cbcr; 868c2ecf20Sopenharmony_ci break; 878c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_NV42: 888c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_ENC_YUV_444_IMG | 898c2ecf20Sopenharmony_ci EXYNOS4_YUV_444_IP_YUV_444_2P_IMG | 908c2ecf20Sopenharmony_ci exynos4_swap_chroma_crcb; 918c2ecf20Sopenharmony_ci break; 928c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_YUYV: 938c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_DEC_YUV_422_IMG | 948c2ecf20Sopenharmony_ci EXYNOS4_YUV_422_IP_YUV_422_1P_IMG | 958c2ecf20Sopenharmony_ci exynos4_swap_chroma_cbcr; 968c2ecf20Sopenharmony_ci break; 978c2ecf20Sopenharmony_ci 988c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_YVYU: 998c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_DEC_YUV_422_IMG | 1008c2ecf20Sopenharmony_ci EXYNOS4_YUV_422_IP_YUV_422_1P_IMG | 1018c2ecf20Sopenharmony_ci exynos4_swap_chroma_crcb; 1028c2ecf20Sopenharmony_ci break; 1038c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_NV16: 1048c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_DEC_YUV_422_IMG | 1058c2ecf20Sopenharmony_ci EXYNOS4_YUV_422_IP_YUV_422_2P_IMG | 1068c2ecf20Sopenharmony_ci exynos4_swap_chroma_cbcr; 1078c2ecf20Sopenharmony_ci break; 1088c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_NV61: 1098c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_DEC_YUV_422_IMG | 1108c2ecf20Sopenharmony_ci EXYNOS4_YUV_422_IP_YUV_422_2P_IMG | 1118c2ecf20Sopenharmony_ci exynos4_swap_chroma_crcb; 1128c2ecf20Sopenharmony_ci break; 1138c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_NV12: 1148c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_DEC_YUV_420_IMG | 1158c2ecf20Sopenharmony_ci EXYNOS4_YUV_420_IP_YUV_420_2P_IMG | 1168c2ecf20Sopenharmony_ci exynos4_swap_chroma_cbcr; 1178c2ecf20Sopenharmony_ci break; 1188c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_NV21: 1198c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_DEC_YUV_420_IMG | 1208c2ecf20Sopenharmony_ci EXYNOS4_YUV_420_IP_YUV_420_2P_IMG | 1218c2ecf20Sopenharmony_ci exynos4_swap_chroma_crcb; 1228c2ecf20Sopenharmony_ci break; 1238c2ecf20Sopenharmony_ci case V4L2_PIX_FMT_YUV420: 1248c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_DEC_YUV_420_IMG | 1258c2ecf20Sopenharmony_ci EXYNOS4_YUV_420_IP_YUV_420_3P_IMG | 1268c2ecf20Sopenharmony_ci exynos4_swap_chroma_cbcr; 1278c2ecf20Sopenharmony_ci break; 1288c2ecf20Sopenharmony_ci default: 1298c2ecf20Sopenharmony_ci break; 1308c2ecf20Sopenharmony_ci 1318c2ecf20Sopenharmony_ci } 1328c2ecf20Sopenharmony_ci 1338c2ecf20Sopenharmony_ci writel(reg, base + EXYNOS4_IMG_FMT_REG); 1348c2ecf20Sopenharmony_ci} 1358c2ecf20Sopenharmony_ci 1368c2ecf20Sopenharmony_civoid __exynos4_jpeg_set_enc_out_fmt(void __iomem *base, unsigned int out_fmt, 1378c2ecf20Sopenharmony_ci unsigned int version) 1388c2ecf20Sopenharmony_ci{ 1398c2ecf20Sopenharmony_ci unsigned int reg; 1408c2ecf20Sopenharmony_ci 1418c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_IMG_FMT_REG) & 1428c2ecf20Sopenharmony_ci ~(version == SJPEG_EXYNOS4 ? EXYNOS4_ENC_FMT_MASK : 1438c2ecf20Sopenharmony_ci EXYNOS5433_ENC_FMT_MASK); /* clear enc format */ 1448c2ecf20Sopenharmony_ci 1458c2ecf20Sopenharmony_ci switch (out_fmt) { 1468c2ecf20Sopenharmony_ci case V4L2_JPEG_CHROMA_SUBSAMPLING_GRAY: 1478c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_ENC_FMT_GRAY; 1488c2ecf20Sopenharmony_ci break; 1498c2ecf20Sopenharmony_ci 1508c2ecf20Sopenharmony_ci case V4L2_JPEG_CHROMA_SUBSAMPLING_444: 1518c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_ENC_FMT_YUV_444; 1528c2ecf20Sopenharmony_ci break; 1538c2ecf20Sopenharmony_ci 1548c2ecf20Sopenharmony_ci case V4L2_JPEG_CHROMA_SUBSAMPLING_422: 1558c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_ENC_FMT_YUV_422; 1568c2ecf20Sopenharmony_ci break; 1578c2ecf20Sopenharmony_ci 1588c2ecf20Sopenharmony_ci case V4L2_JPEG_CHROMA_SUBSAMPLING_420: 1598c2ecf20Sopenharmony_ci reg = reg | EXYNOS4_ENC_FMT_YUV_420; 1608c2ecf20Sopenharmony_ci break; 1618c2ecf20Sopenharmony_ci 1628c2ecf20Sopenharmony_ci default: 1638c2ecf20Sopenharmony_ci break; 1648c2ecf20Sopenharmony_ci } 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_ci writel(reg, base + EXYNOS4_IMG_FMT_REG); 1678c2ecf20Sopenharmony_ci} 1688c2ecf20Sopenharmony_ci 1698c2ecf20Sopenharmony_civoid exynos4_jpeg_set_interrupt(void __iomem *base, unsigned int version) 1708c2ecf20Sopenharmony_ci{ 1718c2ecf20Sopenharmony_ci unsigned int reg; 1728c2ecf20Sopenharmony_ci 1738c2ecf20Sopenharmony_ci if (version == SJPEG_EXYNOS4) { 1748c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_INT_EN_REG) & ~EXYNOS4_INT_EN_MASK; 1758c2ecf20Sopenharmony_ci writel(reg | EXYNOS4_INT_EN_ALL, base + EXYNOS4_INT_EN_REG); 1768c2ecf20Sopenharmony_ci } else { 1778c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_INT_EN_REG) & 1788c2ecf20Sopenharmony_ci ~EXYNOS5433_INT_EN_MASK; 1798c2ecf20Sopenharmony_ci writel(reg | EXYNOS5433_INT_EN_ALL, base + EXYNOS4_INT_EN_REG); 1808c2ecf20Sopenharmony_ci } 1818c2ecf20Sopenharmony_ci} 1828c2ecf20Sopenharmony_ci 1838c2ecf20Sopenharmony_ciunsigned int exynos4_jpeg_get_int_status(void __iomem *base) 1848c2ecf20Sopenharmony_ci{ 1858c2ecf20Sopenharmony_ci return readl(base + EXYNOS4_INT_STATUS_REG); 1868c2ecf20Sopenharmony_ci} 1878c2ecf20Sopenharmony_ci 1888c2ecf20Sopenharmony_ciunsigned int exynos4_jpeg_get_fifo_status(void __iomem *base) 1898c2ecf20Sopenharmony_ci{ 1908c2ecf20Sopenharmony_ci return readl(base + EXYNOS4_FIFO_STATUS_REG); 1918c2ecf20Sopenharmony_ci} 1928c2ecf20Sopenharmony_ci 1938c2ecf20Sopenharmony_civoid exynos4_jpeg_set_huf_table_enable(void __iomem *base, int value) 1948c2ecf20Sopenharmony_ci{ 1958c2ecf20Sopenharmony_ci unsigned int reg; 1968c2ecf20Sopenharmony_ci 1978c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_JPEG_CNTL_REG) & ~EXYNOS4_HUF_TBL_EN; 1988c2ecf20Sopenharmony_ci 1998c2ecf20Sopenharmony_ci if (value == 1) 2008c2ecf20Sopenharmony_ci writel(reg | EXYNOS4_HUF_TBL_EN, 2018c2ecf20Sopenharmony_ci base + EXYNOS4_JPEG_CNTL_REG); 2028c2ecf20Sopenharmony_ci else 2038c2ecf20Sopenharmony_ci writel(reg & ~EXYNOS4_HUF_TBL_EN, 2048c2ecf20Sopenharmony_ci base + EXYNOS4_JPEG_CNTL_REG); 2058c2ecf20Sopenharmony_ci} 2068c2ecf20Sopenharmony_ci 2078c2ecf20Sopenharmony_civoid exynos4_jpeg_set_sys_int_enable(void __iomem *base, int value) 2088c2ecf20Sopenharmony_ci{ 2098c2ecf20Sopenharmony_ci unsigned int reg; 2108c2ecf20Sopenharmony_ci 2118c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_JPEG_CNTL_REG) & ~(EXYNOS4_SYS_INT_EN); 2128c2ecf20Sopenharmony_ci 2138c2ecf20Sopenharmony_ci if (value == 1) 2148c2ecf20Sopenharmony_ci writel(reg | EXYNOS4_SYS_INT_EN, base + EXYNOS4_JPEG_CNTL_REG); 2158c2ecf20Sopenharmony_ci else 2168c2ecf20Sopenharmony_ci writel(reg & ~EXYNOS4_SYS_INT_EN, base + EXYNOS4_JPEG_CNTL_REG); 2178c2ecf20Sopenharmony_ci} 2188c2ecf20Sopenharmony_ci 2198c2ecf20Sopenharmony_civoid exynos4_jpeg_set_stream_buf_address(void __iomem *base, 2208c2ecf20Sopenharmony_ci unsigned int address) 2218c2ecf20Sopenharmony_ci{ 2228c2ecf20Sopenharmony_ci writel(address, base + EXYNOS4_OUT_MEM_BASE_REG); 2238c2ecf20Sopenharmony_ci} 2248c2ecf20Sopenharmony_ci 2258c2ecf20Sopenharmony_civoid exynos4_jpeg_set_stream_size(void __iomem *base, 2268c2ecf20Sopenharmony_ci unsigned int x_value, unsigned int y_value) 2278c2ecf20Sopenharmony_ci{ 2288c2ecf20Sopenharmony_ci writel(0x0, base + EXYNOS4_JPEG_IMG_SIZE_REG); /* clear */ 2298c2ecf20Sopenharmony_ci writel(EXYNOS4_X_SIZE(x_value) | EXYNOS4_Y_SIZE(y_value), 2308c2ecf20Sopenharmony_ci base + EXYNOS4_JPEG_IMG_SIZE_REG); 2318c2ecf20Sopenharmony_ci} 2328c2ecf20Sopenharmony_ci 2338c2ecf20Sopenharmony_civoid exynos4_jpeg_set_frame_buf_address(void __iomem *base, 2348c2ecf20Sopenharmony_ci struct s5p_jpeg_addr *exynos4_jpeg_addr) 2358c2ecf20Sopenharmony_ci{ 2368c2ecf20Sopenharmony_ci writel(exynos4_jpeg_addr->y, base + EXYNOS4_IMG_BA_PLANE_1_REG); 2378c2ecf20Sopenharmony_ci writel(exynos4_jpeg_addr->cb, base + EXYNOS4_IMG_BA_PLANE_2_REG); 2388c2ecf20Sopenharmony_ci writel(exynos4_jpeg_addr->cr, base + EXYNOS4_IMG_BA_PLANE_3_REG); 2398c2ecf20Sopenharmony_ci} 2408c2ecf20Sopenharmony_ci 2418c2ecf20Sopenharmony_civoid exynos4_jpeg_set_encode_tbl_select(void __iomem *base, 2428c2ecf20Sopenharmony_ci enum exynos4_jpeg_img_quality_level level) 2438c2ecf20Sopenharmony_ci{ 2448c2ecf20Sopenharmony_ci unsigned int reg; 2458c2ecf20Sopenharmony_ci 2468c2ecf20Sopenharmony_ci reg = EXYNOS4_Q_TBL_COMP1_0 | EXYNOS4_Q_TBL_COMP2_1 | 2478c2ecf20Sopenharmony_ci EXYNOS4_Q_TBL_COMP3_1 | 2488c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP1_AC_0_DC_1 | 2498c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP2_AC_0_DC_0 | 2508c2ecf20Sopenharmony_ci EXYNOS4_HUFF_TBL_COMP3_AC_1_DC_1; 2518c2ecf20Sopenharmony_ci 2528c2ecf20Sopenharmony_ci writel(reg, base + EXYNOS4_TBL_SEL_REG); 2538c2ecf20Sopenharmony_ci} 2548c2ecf20Sopenharmony_ci 2558c2ecf20Sopenharmony_civoid exynos4_jpeg_set_dec_components(void __iomem *base, int n) 2568c2ecf20Sopenharmony_ci{ 2578c2ecf20Sopenharmony_ci unsigned int reg; 2588c2ecf20Sopenharmony_ci 2598c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_TBL_SEL_REG); 2608c2ecf20Sopenharmony_ci 2618c2ecf20Sopenharmony_ci reg |= EXYNOS4_NF(n); 2628c2ecf20Sopenharmony_ci writel(reg, base + EXYNOS4_TBL_SEL_REG); 2638c2ecf20Sopenharmony_ci} 2648c2ecf20Sopenharmony_ci 2658c2ecf20Sopenharmony_civoid exynos4_jpeg_select_dec_q_tbl(void __iomem *base, char c, char x) 2668c2ecf20Sopenharmony_ci{ 2678c2ecf20Sopenharmony_ci unsigned int reg; 2688c2ecf20Sopenharmony_ci 2698c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_TBL_SEL_REG); 2708c2ecf20Sopenharmony_ci 2718c2ecf20Sopenharmony_ci reg |= EXYNOS4_Q_TBL_COMP(c, x); 2728c2ecf20Sopenharmony_ci writel(reg, base + EXYNOS4_TBL_SEL_REG); 2738c2ecf20Sopenharmony_ci} 2748c2ecf20Sopenharmony_ci 2758c2ecf20Sopenharmony_civoid exynos4_jpeg_select_dec_h_tbl(void __iomem *base, char c, char x) 2768c2ecf20Sopenharmony_ci{ 2778c2ecf20Sopenharmony_ci unsigned int reg; 2788c2ecf20Sopenharmony_ci 2798c2ecf20Sopenharmony_ci reg = readl(base + EXYNOS4_TBL_SEL_REG); 2808c2ecf20Sopenharmony_ci 2818c2ecf20Sopenharmony_ci reg |= EXYNOS4_HUFF_TBL_COMP(c, x); 2828c2ecf20Sopenharmony_ci writel(reg, base + EXYNOS4_TBL_SEL_REG); 2838c2ecf20Sopenharmony_ci} 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_civoid exynos4_jpeg_set_encode_hoff_cnt(void __iomem *base, unsigned int fmt) 2868c2ecf20Sopenharmony_ci{ 2878c2ecf20Sopenharmony_ci if (fmt == V4L2_PIX_FMT_GREY) 2888c2ecf20Sopenharmony_ci writel(0xd2, base + EXYNOS4_HUFF_CNT_REG); 2898c2ecf20Sopenharmony_ci else 2908c2ecf20Sopenharmony_ci writel(0x1a2, base + EXYNOS4_HUFF_CNT_REG); 2918c2ecf20Sopenharmony_ci} 2928c2ecf20Sopenharmony_ci 2938c2ecf20Sopenharmony_ciunsigned int exynos4_jpeg_get_stream_size(void __iomem *base) 2948c2ecf20Sopenharmony_ci{ 2958c2ecf20Sopenharmony_ci return readl(base + EXYNOS4_BITSTREAM_SIZE_REG); 2968c2ecf20Sopenharmony_ci} 2978c2ecf20Sopenharmony_ci 2988c2ecf20Sopenharmony_civoid exynos4_jpeg_set_dec_bitstream_size(void __iomem *base, unsigned int size) 2998c2ecf20Sopenharmony_ci{ 3008c2ecf20Sopenharmony_ci writel(size, base + EXYNOS4_BITSTREAM_SIZE_REG); 3018c2ecf20Sopenharmony_ci} 3028c2ecf20Sopenharmony_ci 3038c2ecf20Sopenharmony_civoid exynos4_jpeg_get_frame_size(void __iomem *base, 3048c2ecf20Sopenharmony_ci unsigned int *width, unsigned int *height) 3058c2ecf20Sopenharmony_ci{ 3068c2ecf20Sopenharmony_ci *width = (readl(base + EXYNOS4_DECODE_XY_SIZE_REG) & 3078c2ecf20Sopenharmony_ci EXYNOS4_DECODED_SIZE_MASK); 3088c2ecf20Sopenharmony_ci *height = (readl(base + EXYNOS4_DECODE_XY_SIZE_REG) >> 16) & 3098c2ecf20Sopenharmony_ci EXYNOS4_DECODED_SIZE_MASK; 3108c2ecf20Sopenharmony_ci} 3118c2ecf20Sopenharmony_ci 3128c2ecf20Sopenharmony_ciunsigned int exynos4_jpeg_get_frame_fmt(void __iomem *base) 3138c2ecf20Sopenharmony_ci{ 3148c2ecf20Sopenharmony_ci return readl(base + EXYNOS4_DECODE_IMG_FMT_REG) & 3158c2ecf20Sopenharmony_ci EXYNOS4_JPEG_DECODED_IMG_FMT_MASK; 3168c2ecf20Sopenharmony_ci} 3178c2ecf20Sopenharmony_ci 3188c2ecf20Sopenharmony_civoid exynos4_jpeg_set_timer_count(void __iomem *base, unsigned int size) 3198c2ecf20Sopenharmony_ci{ 3208c2ecf20Sopenharmony_ci writel(size, base + EXYNOS4_INT_TIMER_COUNT_REG); 3218c2ecf20Sopenharmony_ci} 322