18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ATMEL_ISC_REGS_H
38c2ecf20Sopenharmony_ci#define __ATMEL_ISC_REGS_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <linux/bitops.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/* ISC Control Enable Register 0 */
88c2ecf20Sopenharmony_ci#define ISC_CTRLEN      0x00000000
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci/* ISC Control Disable Register 0 */
118c2ecf20Sopenharmony_ci#define ISC_CTRLDIS     0x00000004
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci/* ISC Control Status Register 0 */
148c2ecf20Sopenharmony_ci#define ISC_CTRLSR      0x00000008
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#define ISC_CTRL_CAPTURE	BIT(0)
178c2ecf20Sopenharmony_ci#define ISC_CTRL_UPPRO		BIT(1)
188c2ecf20Sopenharmony_ci#define ISC_CTRL_HISREQ		BIT(2)
198c2ecf20Sopenharmony_ci#define ISC_CTRL_HISCLR		BIT(3)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci/* ISC Parallel Front End Configuration 0 Register */
228c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0    0x0000000c
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_HPOL_LOW   BIT(0)
258c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_VPOL_LOW   BIT(1)
268c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_PPOL_LOW   BIT(2)
278c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_CCIR656    BIT(9)
288c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_CCIR_CRC   BIT(10)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_MODE_PROGRESSIVE   (0x0 << 4)
318c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_MODE_MASK          GENMASK(6, 4)
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_BPS_EIGHT  (0x4 << 28)
348c2ecf20Sopenharmony_ci#define ISC_PFG_CFG0_BPS_NINE   (0x3 << 28)
358c2ecf20Sopenharmony_ci#define ISC_PFG_CFG0_BPS_TEN    (0x2 << 28)
368c2ecf20Sopenharmony_ci#define ISC_PFG_CFG0_BPS_ELEVEN (0x1 << 28)
378c2ecf20Sopenharmony_ci#define ISC_PFG_CFG0_BPS_TWELVE (0x0 << 28)
388c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_BPS_MASK   GENMASK(30, 28)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_COLEN	BIT(12)
418c2ecf20Sopenharmony_ci#define ISC_PFE_CFG0_ROWEN	BIT(13)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* ISC Parallel Front End Configuration 1 Register */
448c2ecf20Sopenharmony_ci#define ISC_PFE_CFG1    0x00000010
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#define ISC_PFE_CFG1_COLMIN(v)		((v))
478c2ecf20Sopenharmony_ci#define ISC_PFE_CFG1_COLMIN_MASK	GENMASK(15, 0)
488c2ecf20Sopenharmony_ci#define ISC_PFE_CFG1_COLMAX(v)		((v) << 16)
498c2ecf20Sopenharmony_ci#define ISC_PFE_CFG1_COLMAX_MASK	GENMASK(31, 16)
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ci/* ISC Parallel Front End Configuration 2 Register */
528c2ecf20Sopenharmony_ci#define ISC_PFE_CFG2    0x00000014
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define ISC_PFE_CFG2_ROWMIN(v)		((v))
558c2ecf20Sopenharmony_ci#define ISC_PFE_CFG2_ROWMIN_MASK	GENMASK(15, 0)
568c2ecf20Sopenharmony_ci#define ISC_PFE_CFG2_ROWMAX(v)		((v) << 16)
578c2ecf20Sopenharmony_ci#define ISC_PFE_CFG2_ROWMAX_MASK	GENMASK(31, 16)
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci/* ISC Clock Enable Register */
608c2ecf20Sopenharmony_ci#define ISC_CLKEN               0x00000018
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ci/* ISC Clock Disable Register */
638c2ecf20Sopenharmony_ci#define ISC_CLKDIS              0x0000001c
648c2ecf20Sopenharmony_ci
658c2ecf20Sopenharmony_ci/* ISC Clock Status Register */
668c2ecf20Sopenharmony_ci#define ISC_CLKSR               0x00000020
678c2ecf20Sopenharmony_ci#define ISC_CLKSR_SIP		BIT(31)
688c2ecf20Sopenharmony_ci
698c2ecf20Sopenharmony_ci#define ISC_CLK(n)		BIT(n)
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci/* ISC Clock Configuration Register */
728c2ecf20Sopenharmony_ci#define ISC_CLKCFG              0x00000024
738c2ecf20Sopenharmony_ci#define ISC_CLKCFG_DIV_SHIFT(n) ((n)*16)
748c2ecf20Sopenharmony_ci#define ISC_CLKCFG_DIV_MASK(n)  GENMASK(((n)*16 + 7), (n)*16)
758c2ecf20Sopenharmony_ci#define ISC_CLKCFG_SEL_SHIFT(n) ((n)*16 + 8)
768c2ecf20Sopenharmony_ci#define ISC_CLKCFG_SEL_MASK(n)  GENMASK(((n)*17 + 8), ((n)*16 + 8))
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ci/* ISC Interrupt Enable Register */
798c2ecf20Sopenharmony_ci#define ISC_INTEN       0x00000028
808c2ecf20Sopenharmony_ci
818c2ecf20Sopenharmony_ci/* ISC Interrupt Disable Register */
828c2ecf20Sopenharmony_ci#define ISC_INTDIS      0x0000002c
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci/* ISC Interrupt Mask Register */
858c2ecf20Sopenharmony_ci#define ISC_INTMASK     0x00000030
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ci/* ISC Interrupt Status Register */
888c2ecf20Sopenharmony_ci#define ISC_INTSR       0x00000034
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci#define ISC_INT_DDONE		BIT(8)
918c2ecf20Sopenharmony_ci#define ISC_INT_HISDONE		BIT(12)
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ci/* ISC White Balance Control Register */
948c2ecf20Sopenharmony_ci#define ISC_WB_CTRL     0x00000058
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci/* ISC White Balance Configuration Register */
978c2ecf20Sopenharmony_ci#define ISC_WB_CFG      0x0000005c
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci/* ISC White Balance Offset for R, GR Register */
1008c2ecf20Sopenharmony_ci#define ISC_WB_O_RGR	0x00000060
1018c2ecf20Sopenharmony_ci
1028c2ecf20Sopenharmony_ci/* ISC White Balance Offset for B, GB Register */
1038c2ecf20Sopenharmony_ci#define ISC_WB_O_BGB	0x00000064
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci/* ISC White Balance Gain for R, GR Register */
1068c2ecf20Sopenharmony_ci#define ISC_WB_G_RGR	0x00000068
1078c2ecf20Sopenharmony_ci
1088c2ecf20Sopenharmony_ci/* ISC White Balance Gain for B, GB Register */
1098c2ecf20Sopenharmony_ci#define ISC_WB_G_BGB	0x0000006c
1108c2ecf20Sopenharmony_ci
1118c2ecf20Sopenharmony_ci/* ISC Color Filter Array Control Register */
1128c2ecf20Sopenharmony_ci#define ISC_CFA_CTRL    0x00000070
1138c2ecf20Sopenharmony_ci
1148c2ecf20Sopenharmony_ci/* ISC Color Filter Array Configuration Register */
1158c2ecf20Sopenharmony_ci#define ISC_CFA_CFG     0x00000074
1168c2ecf20Sopenharmony_ci#define ISC_CFA_CFG_EITPOL	BIT(4)
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci#define ISC_BAY_CFG_GRGR	0x0
1198c2ecf20Sopenharmony_ci#define ISC_BAY_CFG_RGRG	0x1
1208c2ecf20Sopenharmony_ci#define ISC_BAY_CFG_GBGB	0x2
1218c2ecf20Sopenharmony_ci#define ISC_BAY_CFG_BGBG	0x3
1228c2ecf20Sopenharmony_ci
1238c2ecf20Sopenharmony_ci/* ISC Color Correction Control Register */
1248c2ecf20Sopenharmony_ci#define ISC_CC_CTRL     0x00000078
1258c2ecf20Sopenharmony_ci
1268c2ecf20Sopenharmony_ci/* ISC Color Correction RR RG Register */
1278c2ecf20Sopenharmony_ci#define ISC_CC_RR_RG	0x0000007c
1288c2ecf20Sopenharmony_ci
1298c2ecf20Sopenharmony_ci/* ISC Color Correction RB OR Register */
1308c2ecf20Sopenharmony_ci#define ISC_CC_RB_OR	0x00000080
1318c2ecf20Sopenharmony_ci
1328c2ecf20Sopenharmony_ci/* ISC Color Correction GR GG Register */
1338c2ecf20Sopenharmony_ci#define ISC_CC_GR_GG	0x00000084
1348c2ecf20Sopenharmony_ci
1358c2ecf20Sopenharmony_ci/* ISC Color Correction GB OG Register */
1368c2ecf20Sopenharmony_ci#define ISC_CC_GB_OG	0x00000088
1378c2ecf20Sopenharmony_ci
1388c2ecf20Sopenharmony_ci/* ISC Color Correction BR BG Register */
1398c2ecf20Sopenharmony_ci#define ISC_CC_BR_BG	0x0000008c
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ci/* ISC Color Correction BB OB Register */
1428c2ecf20Sopenharmony_ci#define ISC_CC_BB_OB	0x00000090
1438c2ecf20Sopenharmony_ci
1448c2ecf20Sopenharmony_ci/* ISC Gamma Correction Control Register */
1458c2ecf20Sopenharmony_ci#define ISC_GAM_CTRL    0x00000094
1468c2ecf20Sopenharmony_ci
1478c2ecf20Sopenharmony_ci/* ISC_Gamma Correction Blue Entry Register */
1488c2ecf20Sopenharmony_ci#define ISC_GAM_BENTRY	0x00000098
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci/* ISC_Gamma Correction Green Entry Register */
1518c2ecf20Sopenharmony_ci#define ISC_GAM_GENTRY	0x00000198
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ci/* ISC_Gamma Correction Green Entry Register */
1548c2ecf20Sopenharmony_ci#define ISC_GAM_RENTRY	0x00000298
1558c2ecf20Sopenharmony_ci
1568c2ecf20Sopenharmony_ci/* Color Space Conversion Control Register */
1578c2ecf20Sopenharmony_ci#define ISC_CSC_CTRL    0x00000398
1588c2ecf20Sopenharmony_ci
1598c2ecf20Sopenharmony_ci/* Color Space Conversion YR YG Register */
1608c2ecf20Sopenharmony_ci#define ISC_CSC_YR_YG	0x0000039c
1618c2ecf20Sopenharmony_ci
1628c2ecf20Sopenharmony_ci/* Color Space Conversion YB OY Register */
1638c2ecf20Sopenharmony_ci#define ISC_CSC_YB_OY	0x000003a0
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci/* Color Space Conversion CBR CBG Register */
1668c2ecf20Sopenharmony_ci#define ISC_CSC_CBR_CBG	0x000003a4
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci/* Color Space Conversion CBB OCB Register */
1698c2ecf20Sopenharmony_ci#define ISC_CSC_CBB_OCB	0x000003a8
1708c2ecf20Sopenharmony_ci
1718c2ecf20Sopenharmony_ci/* Color Space Conversion CRR CRG Register */
1728c2ecf20Sopenharmony_ci#define ISC_CSC_CRR_CRG	0x000003ac
1738c2ecf20Sopenharmony_ci
1748c2ecf20Sopenharmony_ci/* Color Space Conversion CRB OCR Register */
1758c2ecf20Sopenharmony_ci#define ISC_CSC_CRB_OCR	0x000003b0
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci/* Contrast And Brightness Control Register */
1788c2ecf20Sopenharmony_ci#define ISC_CBC_CTRL    0x000003b4
1798c2ecf20Sopenharmony_ci
1808c2ecf20Sopenharmony_ci/* Contrast And Brightness Configuration Register */
1818c2ecf20Sopenharmony_ci#define ISC_CBC_CFG	0x000003b8
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* Brightness Register */
1848c2ecf20Sopenharmony_ci#define ISC_CBC_BRIGHT	0x000003bc
1858c2ecf20Sopenharmony_ci#define ISC_CBC_BRIGHT_MASK	GENMASK(10, 0)
1868c2ecf20Sopenharmony_ci
1878c2ecf20Sopenharmony_ci/* Contrast Register */
1888c2ecf20Sopenharmony_ci#define ISC_CBC_CONTRAST	0x000003c0
1898c2ecf20Sopenharmony_ci#define ISC_CBC_CONTRAST_MASK	GENMASK(11, 0)
1908c2ecf20Sopenharmony_ci
1918c2ecf20Sopenharmony_ci/* Subsampling 4:4:4 to 4:2:2 Control Register */
1928c2ecf20Sopenharmony_ci#define ISC_SUB422_CTRL 0x000003c4
1938c2ecf20Sopenharmony_ci
1948c2ecf20Sopenharmony_ci/* Subsampling 4:2:2 to 4:2:0 Control Register */
1958c2ecf20Sopenharmony_ci#define ISC_SUB420_CTRL 0x000003cc
1968c2ecf20Sopenharmony_ci
1978c2ecf20Sopenharmony_ci/* Rounding, Limiting and Packing Configuration Register */
1988c2ecf20Sopenharmony_ci#define ISC_RLP_CFG     0x000003d0
1998c2ecf20Sopenharmony_ci
2008c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_DAT8           0x0
2018c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_DAT9           0x1
2028c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_DAT10          0x2
2038c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_DAT11          0x3
2048c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_DAT12          0x4
2058c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_DATY8          0x5
2068c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_DATY10         0x6
2078c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_ARGB444        0x7
2088c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_ARGB555        0x8
2098c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_RGB565         0x9
2108c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_ARGB32         0xa
2118c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_YYCC           0xb
2128c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_YYCC_LIMITED   0xc
2138c2ecf20Sopenharmony_ci#define ISC_RLP_CFG_MODE_MASK           GENMASK(3, 0)
2148c2ecf20Sopenharmony_ci
2158c2ecf20Sopenharmony_ci/* Histogram Control Register */
2168c2ecf20Sopenharmony_ci#define ISC_HIS_CTRL	0x000003d4
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci#define ISC_HIS_CTRL_EN			BIT(0)
2198c2ecf20Sopenharmony_ci#define ISC_HIS_CTRL_DIS		0x0
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci/* Histogram Configuration Register */
2228c2ecf20Sopenharmony_ci#define ISC_HIS_CFG	0x000003d8
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci#define ISC_HIS_CFG_MODE_GR		0x0
2258c2ecf20Sopenharmony_ci#define ISC_HIS_CFG_MODE_R		0x1
2268c2ecf20Sopenharmony_ci#define ISC_HIS_CFG_MODE_GB		0x2
2278c2ecf20Sopenharmony_ci#define ISC_HIS_CFG_MODE_B		0x3
2288c2ecf20Sopenharmony_ci#define ISC_HIS_CFG_MODE_Y		0x4
2298c2ecf20Sopenharmony_ci#define ISC_HIS_CFG_MODE_RAW		0x5
2308c2ecf20Sopenharmony_ci#define ISC_HIS_CFG_MODE_YCCIR656	0x6
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_ci#define ISC_HIS_CFG_BAYSEL_SHIFT	4
2338c2ecf20Sopenharmony_ci
2348c2ecf20Sopenharmony_ci#define ISC_HIS_CFG_RAR			BIT(8)
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci/* DMA Configuration Register */
2378c2ecf20Sopenharmony_ci#define ISC_DCFG        0x000003e0
2388c2ecf20Sopenharmony_ci#define ISC_DCFG_IMODE_PACKED8          0x0
2398c2ecf20Sopenharmony_ci#define ISC_DCFG_IMODE_PACKED16         0x1
2408c2ecf20Sopenharmony_ci#define ISC_DCFG_IMODE_PACKED32         0x2
2418c2ecf20Sopenharmony_ci#define ISC_DCFG_IMODE_YC422SP          0x3
2428c2ecf20Sopenharmony_ci#define ISC_DCFG_IMODE_YC422P           0x4
2438c2ecf20Sopenharmony_ci#define ISC_DCFG_IMODE_YC420SP          0x5
2448c2ecf20Sopenharmony_ci#define ISC_DCFG_IMODE_YC420P           0x6
2458c2ecf20Sopenharmony_ci#define ISC_DCFG_IMODE_MASK             GENMASK(2, 0)
2468c2ecf20Sopenharmony_ci
2478c2ecf20Sopenharmony_ci#define ISC_DCFG_YMBSIZE_SINGLE         (0x0 << 4)
2488c2ecf20Sopenharmony_ci#define ISC_DCFG_YMBSIZE_BEATS4         (0x1 << 4)
2498c2ecf20Sopenharmony_ci#define ISC_DCFG_YMBSIZE_BEATS8         (0x2 << 4)
2508c2ecf20Sopenharmony_ci#define ISC_DCFG_YMBSIZE_BEATS16        (0x3 << 4)
2518c2ecf20Sopenharmony_ci#define ISC_DCFG_YMBSIZE_MASK           GENMASK(5, 4)
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci#define ISC_DCFG_CMBSIZE_SINGLE         (0x0 << 8)
2548c2ecf20Sopenharmony_ci#define ISC_DCFG_CMBSIZE_BEATS4         (0x1 << 8)
2558c2ecf20Sopenharmony_ci#define ISC_DCFG_CMBSIZE_BEATS8         (0x2 << 8)
2568c2ecf20Sopenharmony_ci#define ISC_DCFG_CMBSIZE_BEATS16        (0x3 << 8)
2578c2ecf20Sopenharmony_ci#define ISC_DCFG_CMBSIZE_MASK           GENMASK(9, 8)
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_ci/* DMA Control Register */
2608c2ecf20Sopenharmony_ci#define ISC_DCTRL       0x000003e4
2618c2ecf20Sopenharmony_ci
2628c2ecf20Sopenharmony_ci#define ISC_DCTRL_DVIEW_PACKED          (0x0 << 1)
2638c2ecf20Sopenharmony_ci#define ISC_DCTRL_DVIEW_SEMIPLANAR      (0x1 << 1)
2648c2ecf20Sopenharmony_ci#define ISC_DCTRL_DVIEW_PLANAR          (0x2 << 1)
2658c2ecf20Sopenharmony_ci#define ISC_DCTRL_DVIEW_MASK            GENMASK(2, 1)
2668c2ecf20Sopenharmony_ci
2678c2ecf20Sopenharmony_ci#define ISC_DCTRL_IE_IS			(0x0 << 4)
2688c2ecf20Sopenharmony_ci
2698c2ecf20Sopenharmony_ci/* DMA Descriptor Address Register */
2708c2ecf20Sopenharmony_ci#define ISC_DNDA        0x000003e8
2718c2ecf20Sopenharmony_ci
2728c2ecf20Sopenharmony_ci/* DMA Address 0 Register */
2738c2ecf20Sopenharmony_ci#define ISC_DAD0        0x000003ec
2748c2ecf20Sopenharmony_ci
2758c2ecf20Sopenharmony_ci/* DMA Address 1 Register */
2768c2ecf20Sopenharmony_ci#define ISC_DAD1        0x000003f4
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci/* DMA Address 2 Register */
2798c2ecf20Sopenharmony_ci#define ISC_DAD2        0x000003fc
2808c2ecf20Sopenharmony_ci
2818c2ecf20Sopenharmony_ci/* Histogram Entry */
2828c2ecf20Sopenharmony_ci#define ISC_HIS_ENTRY	0x00000410
2838c2ecf20Sopenharmony_ci
2848c2ecf20Sopenharmony_ci#endif
285