162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Samsung camera host interface (FIMC) registers definition 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd. 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#ifndef FIMC_REG_H_ 962306a36Sopenharmony_ci#define FIMC_REG_H_ 1062306a36Sopenharmony_ci 1162306a36Sopenharmony_ci#include <linux/bitops.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include "fimc-core.h" 1462306a36Sopenharmony_ci 1562306a36Sopenharmony_ci/* Input source format */ 1662306a36Sopenharmony_ci#define FIMC_REG_CISRCFMT 0x00 1762306a36Sopenharmony_ci#define FIMC_REG_CISRCFMT_ITU601_8BIT BIT(31) 1862306a36Sopenharmony_ci#define FIMC_REG_CISRCFMT_ITU601_16BIT BIT(29) 1962306a36Sopenharmony_ci#define FIMC_REG_CISRCFMT_ORDER422_YCBYCR (0 << 14) 2062306a36Sopenharmony_ci#define FIMC_REG_CISRCFMT_ORDER422_YCRYCB (1 << 14) 2162306a36Sopenharmony_ci#define FIMC_REG_CISRCFMT_ORDER422_CBYCRY (2 << 14) 2262306a36Sopenharmony_ci#define FIMC_REG_CISRCFMT_ORDER422_CRYCBY (3 << 14) 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci/* Window offset */ 2562306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST 0x04 2662306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST_OFF_EN BIT(31) 2762306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST_CLROVFIY BIT(30) 2862306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST_CLROVRLB BIT(29) 2962306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST_HOROFF_MASK (0x7ff << 16) 3062306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST_CLROVFICB BIT(15) 3162306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST_CLROVFICR BIT(14) 3262306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST_VEROFF_MASK (0xfff << 0) 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci/* Global control */ 3562306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL 0x08 3662306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_SWRST BIT(31) 3762306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_CAMRST_A BIT(30) 3862306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_SELCAM_ITU_A BIT(29) 3962306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_TESTPAT_NORMAL (0 << 27) 4062306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_TESTPAT_COLOR_BAR (1 << 27) 4162306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_TESTPAT_HOR_INC (2 << 27) 4262306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_TESTPAT_VER_INC (3 << 27) 4362306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_TESTPAT_MASK (3 << 27) 4462306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_TESTPAT_SHIFT 27 4562306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_INVPOLPCLK BIT(26) 4662306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_INVPOLVSYNC BIT(25) 4762306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_INVPOLHREF BIT(24) 4862306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_IRQ_OVFEN BIT(22) 4962306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_HREF_MASK BIT(21) 5062306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_IRQ_LEVEL BIT(20) 5162306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_IRQ_CLR BIT(19) 5262306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_IRQ_ENABLE BIT(16) 5362306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_SHDW_DISABLE BIT(12) 5462306a36Sopenharmony_ci/* 0 - selects Writeback A (LCD), 1 - selects Writeback B (LCD/ISP) */ 5562306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_SELWB_A BIT(10) 5662306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_CAM_JPEG BIT(8) 5762306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_SELCAM_MIPI_A BIT(7) 5862306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_CAMIF_SELWB BIT(6) 5962306a36Sopenharmony_ci/* 0 - ITU601; 1 - ITU709 */ 6062306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_CSC_ITU601_709 BIT(5) 6162306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_INVPOLHSYNC BIT(4) 6262306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_SELCAM_MIPI BIT(3) 6362306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_INVPOLFIELD BIT(1) 6462306a36Sopenharmony_ci#define FIMC_REG_CIGCTRL_INTERLACE BIT(0) 6562306a36Sopenharmony_ci 6662306a36Sopenharmony_ci/* Window offset 2 */ 6762306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST2 0x14 6862306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST2_HOROFF_MASK (0xfff << 16) 6962306a36Sopenharmony_ci#define FIMC_REG_CIWDOFST2_VEROFF_MASK (0xfff << 0) 7062306a36Sopenharmony_ci 7162306a36Sopenharmony_ci/* Output DMA Y/Cb/Cr plane start addresses */ 7262306a36Sopenharmony_ci#define FIMC_REG_CIOYSA(n) (0x18 + (n) * 4) 7362306a36Sopenharmony_ci#define FIMC_REG_CIOCBSA(n) (0x28 + (n) * 4) 7462306a36Sopenharmony_ci#define FIMC_REG_CIOCRSA(n) (0x38 + (n) * 4) 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci/* Target image format */ 7762306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT 0x48 7862306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_INROT90 BIT(31) 7962306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_YCBCR420 (0 << 29) 8062306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_YCBCR422 (1 << 29) 8162306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_YCBCR422_1P (2 << 29) 8262306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_RGB (3 << 29) 8362306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_FMT_MASK (3 << 29) 8462306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_HSIZE_MASK (0xfff << 16) 8562306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_FLIP_SHIFT 14 8662306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_FLIP_NORMAL (0 << 14) 8762306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_FLIP_X_MIRROR (1 << 14) 8862306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_FLIP_Y_MIRROR (2 << 14) 8962306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_FLIP_180 (3 << 14) 9062306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_FLIP_MASK (3 << 14) 9162306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_OUTROT90 BIT(13) 9262306a36Sopenharmony_ci#define FIMC_REG_CITRGFMT_VSIZE_MASK (0xfff << 0) 9362306a36Sopenharmony_ci 9462306a36Sopenharmony_ci/* Output DMA control */ 9562306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL 0x4c 9662306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ORDER422_MASK (3 << 0) 9762306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ORDER422_YCBYCR (0 << 0) 9862306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ORDER422_YCRYCB (1 << 0) 9962306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ORDER422_CBYCRY (2 << 0) 10062306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ORDER422_CRYCBY (3 << 0) 10162306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_LASTIRQ_ENABLE BIT(2) 10262306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_YCBCR_3PLANE (0 << 3) 10362306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_YCBCR_2PLANE (1 << 3) 10462306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_YCBCR_PLANE_MASK (1 << 3) 10562306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ALPHA_OUT_MASK (0xff << 4) 10662306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_RGB16FMT_MASK (3 << 16) 10762306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_RGB565 (0 << 16) 10862306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ARGB1555 (1 << 16) 10962306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ARGB4444 (2 << 16) 11062306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ORDER2P_SHIFT 24 11162306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ORDER2P_MASK (3 << 24) 11262306a36Sopenharmony_ci#define FIMC_REG_CIOCTRL_ORDER422_2P_LSB_CRCB (0 << 24) 11362306a36Sopenharmony_ci 11462306a36Sopenharmony_ci/* Pre-scaler control 1 */ 11562306a36Sopenharmony_ci#define FIMC_REG_CISCPRERATIO 0x50 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci#define FIMC_REG_CISCPREDST 0x54 11862306a36Sopenharmony_ci 11962306a36Sopenharmony_ci/* Main scaler control */ 12062306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL 0x58 12162306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_SCALERBYPASS BIT(31) 12262306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_SCALEUP_H BIT(30) 12362306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_SCALEUP_V BIT(29) 12462306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_CSCR2Y_WIDE BIT(28) 12562306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_CSCY2R_WIDE BIT(27) 12662306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_LCDPATHEN_FIFO BIT(26) 12762306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_INTERLACE BIT(25) 12862306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_SCALERSTART BIT(15) 12962306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_INRGB_FMT_RGB565 (0 << 13) 13062306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_INRGB_FMT_RGB666 (1 << 13) 13162306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_INRGB_FMT_RGB888 (2 << 13) 13262306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_INRGB_FMT_MASK (3 << 13) 13362306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_OUTRGB_FMT_RGB565 (0 << 11) 13462306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_OUTRGB_FMT_RGB666 (1 << 11) 13562306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_OUTRGB_FMT_RGB888 (2 << 11) 13662306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_OUTRGB_FMT_MASK (3 << 11) 13762306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_RGB_EXT BIT(10) 13862306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_ONE2ONE BIT(9) 13962306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_MHRATIO(x) ((x) << 16) 14062306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_MVRATIO(x) ((x) << 0) 14162306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_MHRATIO_MASK (0x1ff << 16) 14262306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_MVRATIO_MASK (0x1ff << 0) 14362306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_MHRATIO_EXT(x) (((x) >> 6) << 16) 14462306a36Sopenharmony_ci#define FIMC_REG_CISCCTRL_MVRATIO_EXT(x) (((x) >> 6) << 0) 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci/* Target area */ 14762306a36Sopenharmony_ci#define FIMC_REG_CITAREA 0x5c 14862306a36Sopenharmony_ci#define FIMC_REG_CITAREA_MASK 0x0fffffff 14962306a36Sopenharmony_ci 15062306a36Sopenharmony_ci/* General status */ 15162306a36Sopenharmony_ci#define FIMC_REG_CISTATUS 0x64 15262306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_OVFIY BIT(31) 15362306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_OVFICB BIT(30) 15462306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_OVFICR BIT(29) 15562306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_VSYNC BIT(28) 15662306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_FRAMECNT_MASK (3 << 26) 15762306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_FRAMECNT_SHIFT 26 15862306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_WINOFF_EN BIT(25) 15962306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_IMGCPT_EN BIT(22) 16062306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_IMGCPT_SCEN BIT(21) 16162306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_VSYNC_A BIT(20) 16262306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_VSYNC_B BIT(19) 16362306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_OVRLB BIT(18) 16462306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_FRAME_END BIT(17) 16562306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_LASTCAPT_END BIT(16) 16662306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_VVALID_A BIT(15) 16762306a36Sopenharmony_ci#define FIMC_REG_CISTATUS_VVALID_B BIT(14) 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci/* Indexes to the last and the currently processed buffer. */ 17062306a36Sopenharmony_ci#define FIMC_REG_CISTATUS2 0x68 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci/* Image capture control */ 17362306a36Sopenharmony_ci#define FIMC_REG_CIIMGCPT 0xc0 17462306a36Sopenharmony_ci#define FIMC_REG_CIIMGCPT_IMGCPTEN BIT(31) 17562306a36Sopenharmony_ci#define FIMC_REG_CIIMGCPT_IMGCPTEN_SC BIT(30) 17662306a36Sopenharmony_ci#define FIMC_REG_CIIMGCPT_CPT_FREN_ENABLE BIT(25) 17762306a36Sopenharmony_ci#define FIMC_REG_CIIMGCPT_CPT_FRMOD_CNT BIT(18) 17862306a36Sopenharmony_ci 17962306a36Sopenharmony_ci/* Frame capture sequence */ 18062306a36Sopenharmony_ci#define FIMC_REG_CICPTSEQ 0xc4 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci/* Image effect */ 18362306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF 0xd0 18462306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_IE_ENABLE BIT(30) 18562306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_IE_SC_BEFORE (0 << 29) 18662306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_IE_SC_AFTER (1 << 29) 18762306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_FIN_BYPASS (0 << 26) 18862306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_FIN_ARBITRARY (1 << 26) 18962306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_FIN_NEGATIVE (2 << 26) 19062306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_FIN_ARTFREEZE (3 << 26) 19162306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_FIN_EMBOSSING (4 << 26) 19262306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_FIN_SILHOUETTE (5 << 26) 19362306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_FIN_MASK (7 << 26) 19462306a36Sopenharmony_ci#define FIMC_REG_CIIMGEFF_PAT_CBCR_MASK ((0xff << 13) | 0xff) 19562306a36Sopenharmony_ci 19662306a36Sopenharmony_ci/* Input DMA Y/Cb/Cr plane start address 0/1 */ 19762306a36Sopenharmony_ci#define FIMC_REG_CIIYSA(n) (0xd4 + (n) * 0x70) 19862306a36Sopenharmony_ci#define FIMC_REG_CIICBSA(n) (0xd8 + (n) * 0x70) 19962306a36Sopenharmony_ci#define FIMC_REG_CIICRSA(n) (0xdc + (n) * 0x70) 20062306a36Sopenharmony_ci 20162306a36Sopenharmony_ci/* Real input DMA image size */ 20262306a36Sopenharmony_ci#define FIMC_REG_CIREAL_ISIZE 0xf8 20362306a36Sopenharmony_ci#define FIMC_REG_CIREAL_ISIZE_AUTOLOAD_EN BIT(31) 20462306a36Sopenharmony_ci#define FIMC_REG_CIREAL_ISIZE_ADDR_CH_DIS BIT(30) 20562306a36Sopenharmony_ci 20662306a36Sopenharmony_ci/* Input DMA control */ 20762306a36Sopenharmony_ci#define FIMC_REG_MSCTRL 0xfc 20862306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_IN_BURST_COUNT_MASK (0xf << 24) 20962306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_2P_IN_ORDER_MASK (3 << 16) 21062306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_2P_IN_ORDER_SHIFT 16 21162306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_C_INT_IN_3PLANE (0 << 15) 21262306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_C_INT_IN_2PLANE (1 << 15) 21362306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_C_INT_IN_MASK (1 << 15) 21462306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_FLIP_SHIFT 13 21562306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_FLIP_MASK (3 << 13) 21662306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_FLIP_NORMAL (0 << 13) 21762306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_FLIP_X_MIRROR (1 << 13) 21862306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_FLIP_Y_MIRROR (2 << 13) 21962306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_FLIP_180 (3 << 13) 22062306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_FIFO_CTRL_FULL BIT(12) 22162306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_ORDER422_SHIFT 4 22262306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_ORDER422_CRYCBY (0 << 4) 22362306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_ORDER422_YCRYCB (1 << 4) 22462306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_ORDER422_CBYCRY (2 << 4) 22562306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_ORDER422_YCBYCR (3 << 4) 22662306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_ORDER422_MASK (3 << 4) 22762306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_INPUT_EXTCAM (0 << 3) 22862306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_INPUT_MEMORY BIT(3) 22962306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_INPUT_MASK BIT(3) 23062306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_INFORMAT_YCBCR420 (0 << 1) 23162306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_INFORMAT_YCBCR422 (1 << 1) 23262306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_INFORMAT_YCBCR422_1P (2 << 1) 23362306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_INFORMAT_RGB (3 << 1) 23462306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_INFORMAT_MASK (3 << 1) 23562306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_ENVID BIT(0) 23662306a36Sopenharmony_ci#define FIMC_REG_MSCTRL_IN_BURST_COUNT(x) ((x) << 24) 23762306a36Sopenharmony_ci 23862306a36Sopenharmony_ci/* Output DMA Y/Cb/Cr offset */ 23962306a36Sopenharmony_ci#define FIMC_REG_CIOYOFF 0x168 24062306a36Sopenharmony_ci#define FIMC_REG_CIOCBOFF 0x16c 24162306a36Sopenharmony_ci#define FIMC_REG_CIOCROFF 0x170 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci/* Input DMA Y/Cb/Cr offset */ 24462306a36Sopenharmony_ci#define FIMC_REG_CIIYOFF 0x174 24562306a36Sopenharmony_ci#define FIMC_REG_CIICBOFF 0x178 24662306a36Sopenharmony_ci#define FIMC_REG_CIICROFF 0x17c 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_ci/* Input DMA original image size */ 24962306a36Sopenharmony_ci#define FIMC_REG_ORGISIZE 0x180 25062306a36Sopenharmony_ci 25162306a36Sopenharmony_ci/* Output DMA original image size */ 25262306a36Sopenharmony_ci#define FIMC_REG_ORGOSIZE 0x184 25362306a36Sopenharmony_ci 25462306a36Sopenharmony_ci/* Real output DMA image size (extension register) */ 25562306a36Sopenharmony_ci#define FIMC_REG_CIEXTEN 0x188 25662306a36Sopenharmony_ci#define FIMC_REG_CIEXTEN_MHRATIO_EXT(x) (((x) & 0x3f) << 10) 25762306a36Sopenharmony_ci#define FIMC_REG_CIEXTEN_MVRATIO_EXT(x) ((x) & 0x3f) 25862306a36Sopenharmony_ci#define FIMC_REG_CIEXTEN_MHRATIO_EXT_MASK (0x3f << 10) 25962306a36Sopenharmony_ci#define FIMC_REG_CIEXTEN_MVRATIO_EXT_MASK 0x3f 26062306a36Sopenharmony_ci 26162306a36Sopenharmony_ci#define FIMC_REG_CIDMAPARAM 0x18c 26262306a36Sopenharmony_ci#define FIMC_REG_CIDMAPARAM_R_LINEAR (0 << 29) 26362306a36Sopenharmony_ci#define FIMC_REG_CIDMAPARAM_R_64X32 (3 << 29) 26462306a36Sopenharmony_ci#define FIMC_REG_CIDMAPARAM_W_LINEAR (0 << 13) 26562306a36Sopenharmony_ci#define FIMC_REG_CIDMAPARAM_W_64X32 (3 << 13) 26662306a36Sopenharmony_ci#define FIMC_REG_CIDMAPARAM_TILE_MASK ((3 << 29) | (3 << 13)) 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci/* MIPI CSI image format */ 26962306a36Sopenharmony_ci#define FIMC_REG_CSIIMGFMT 0x194 27062306a36Sopenharmony_ci#define FIMC_REG_CSIIMGFMT_YCBCR422_8BIT 0x1e 27162306a36Sopenharmony_ci#define FIMC_REG_CSIIMGFMT_RAW8 0x2a 27262306a36Sopenharmony_ci#define FIMC_REG_CSIIMGFMT_RAW10 0x2b 27362306a36Sopenharmony_ci#define FIMC_REG_CSIIMGFMT_RAW12 0x2c 27462306a36Sopenharmony_ci/* User defined formats. x = 0...16. */ 27562306a36Sopenharmony_ci#define FIMC_REG_CSIIMGFMT_USER(x) (0x30 + x - 1) 27662306a36Sopenharmony_ci 27762306a36Sopenharmony_ci/* Output frame buffer sequence mask */ 27862306a36Sopenharmony_ci#define FIMC_REG_CIFCNTSEQ 0x1fc 27962306a36Sopenharmony_ci 28062306a36Sopenharmony_ci/* SYSREG ISP Writeback register address offsets */ 28162306a36Sopenharmony_ci#define SYSREG_ISPBLK 0x020c 28262306a36Sopenharmony_ci#define SYSREG_ISPBLK_FIFORST_CAM_BLK BIT(7) 28362306a36Sopenharmony_ci 28462306a36Sopenharmony_ci#define SYSREG_CAMBLK 0x0218 28562306a36Sopenharmony_ci#define SYSREG_CAMBLK_FIFORST_ISP BIT(15) 28662306a36Sopenharmony_ci#define SYSREG_CAMBLK_ISPWB_FULL_EN (7 << 20) 28762306a36Sopenharmony_ci 28862306a36Sopenharmony_ci/* 28962306a36Sopenharmony_ci * Function declarations 29062306a36Sopenharmony_ci */ 29162306a36Sopenharmony_civoid fimc_hw_reset(struct fimc_dev *fimc); 29262306a36Sopenharmony_civoid fimc_hw_set_rotation(struct fimc_ctx *ctx); 29362306a36Sopenharmony_civoid fimc_hw_set_target_format(struct fimc_ctx *ctx); 29462306a36Sopenharmony_civoid fimc_hw_set_out_dma(struct fimc_ctx *ctx); 29562306a36Sopenharmony_civoid fimc_hw_en_lastirq(struct fimc_dev *fimc, int enable); 29662306a36Sopenharmony_civoid fimc_hw_en_irq(struct fimc_dev *fimc, int enable); 29762306a36Sopenharmony_civoid fimc_hw_set_prescaler(struct fimc_ctx *ctx); 29862306a36Sopenharmony_civoid fimc_hw_set_mainscaler(struct fimc_ctx *ctx); 29962306a36Sopenharmony_civoid fimc_hw_enable_capture(struct fimc_ctx *ctx); 30062306a36Sopenharmony_civoid fimc_hw_set_effect(struct fimc_ctx *ctx); 30162306a36Sopenharmony_civoid fimc_hw_set_rgb_alpha(struct fimc_ctx *ctx); 30262306a36Sopenharmony_civoid fimc_hw_set_in_dma(struct fimc_ctx *ctx); 30362306a36Sopenharmony_civoid fimc_hw_set_input_path(struct fimc_ctx *ctx); 30462306a36Sopenharmony_civoid fimc_hw_set_output_path(struct fimc_ctx *ctx); 30562306a36Sopenharmony_civoid fimc_hw_set_input_addr(struct fimc_dev *fimc, struct fimc_addr *addr); 30662306a36Sopenharmony_civoid fimc_hw_set_output_addr(struct fimc_dev *fimc, struct fimc_addr *addr, 30762306a36Sopenharmony_ci int index); 30862306a36Sopenharmony_ciint fimc_hw_set_camera_source(struct fimc_dev *fimc, 30962306a36Sopenharmony_ci struct fimc_source_info *cam); 31062306a36Sopenharmony_civoid fimc_hw_set_camera_offset(struct fimc_dev *fimc, struct fimc_frame *f); 31162306a36Sopenharmony_ciint fimc_hw_set_camera_polarity(struct fimc_dev *fimc, 31262306a36Sopenharmony_ci struct fimc_source_info *cam); 31362306a36Sopenharmony_ciint fimc_hw_set_camera_type(struct fimc_dev *fimc, 31462306a36Sopenharmony_ci struct fimc_source_info *cam); 31562306a36Sopenharmony_civoid fimc_hw_clear_irq(struct fimc_dev *dev); 31662306a36Sopenharmony_civoid fimc_hw_enable_scaler(struct fimc_dev *dev, bool on); 31762306a36Sopenharmony_civoid fimc_hw_activate_input_dma(struct fimc_dev *dev, bool on); 31862306a36Sopenharmony_civoid fimc_hw_disable_capture(struct fimc_dev *dev); 31962306a36Sopenharmony_cis32 fimc_hw_get_frame_index(struct fimc_dev *dev); 32062306a36Sopenharmony_cis32 fimc_hw_get_prev_frame_index(struct fimc_dev *dev); 32162306a36Sopenharmony_ciint fimc_hw_camblk_cfg_writeback(struct fimc_dev *fimc); 32262306a36Sopenharmony_civoid fimc_activate_capture(struct fimc_ctx *ctx); 32362306a36Sopenharmony_civoid fimc_deactivate_capture(struct fimc_dev *fimc); 32462306a36Sopenharmony_ci 32562306a36Sopenharmony_ci/** 32662306a36Sopenharmony_ci * fimc_hw_set_dma_seq - configure output DMA buffer sequence 32762306a36Sopenharmony_ci * @dev: fimc device 32862306a36Sopenharmony_ci * @mask: bitmask for the DMA output buffer registers, set to 0 to skip buffer 32962306a36Sopenharmony_ci * This function masks output DMA ring buffers, it allows to select which of 33062306a36Sopenharmony_ci * the 32 available output buffer address registers will be used by the DMA 33162306a36Sopenharmony_ci * engine. 33262306a36Sopenharmony_ci */ 33362306a36Sopenharmony_cistatic inline void fimc_hw_set_dma_seq(struct fimc_dev *dev, u32 mask) 33462306a36Sopenharmony_ci{ 33562306a36Sopenharmony_ci writel(mask, dev->regs + FIMC_REG_CIFCNTSEQ); 33662306a36Sopenharmony_ci} 33762306a36Sopenharmony_ci 33862306a36Sopenharmony_ci#endif /* FIMC_REG_H_ */ 339