162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */ 262306a36Sopenharmony_ci/* include/video/samsung_fimd.h 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Copyright 2008 Openmoko, Inc. 562306a36Sopenharmony_ci * Copyright 2008 Simtec Electronics 662306a36Sopenharmony_ci * http://armlinux.simtec.co.uk/ 762306a36Sopenharmony_ci * Ben Dooks <ben@simtec.co.uk> 862306a36Sopenharmony_ci * 962306a36Sopenharmony_ci * S3C Platform - new-style fimd and framebuffer register definitions 1062306a36Sopenharmony_ci * 1162306a36Sopenharmony_ci * This is the register set for the fimd and new style framebuffer interface 1262306a36Sopenharmony_ci * found from the S3C2443 onwards into the S3C2416, S3C2450, the 1362306a36Sopenharmony_ci * S3C64XX series such as the S3C6400 and S3C6410, and Exynos series. 1462306a36Sopenharmony_ci*/ 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* VIDCON0 */ 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define VIDCON0 0x00 1962306a36Sopenharmony_ci#define VIDCON0_DSI_EN (1 << 30) 2062306a36Sopenharmony_ci#define VIDCON0_INTERLACE (1 << 29) 2162306a36Sopenharmony_ci#define VIDCON0_VIDOUT_MASK (0x7 << 26) 2262306a36Sopenharmony_ci#define VIDCON0_VIDOUT_SHIFT 26 2362306a36Sopenharmony_ci#define VIDCON0_VIDOUT_RGB (0x0 << 26) 2462306a36Sopenharmony_ci#define VIDCON0_VIDOUT_TV (0x1 << 26) 2562306a36Sopenharmony_ci#define VIDCON0_VIDOUT_I80_LDI0 (0x2 << 26) 2662306a36Sopenharmony_ci#define VIDCON0_VIDOUT_I80_LDI1 (0x3 << 26) 2762306a36Sopenharmony_ci#define VIDCON0_VIDOUT_WB_RGB (0x4 << 26) 2862306a36Sopenharmony_ci#define VIDCON0_VIDOUT_WB_I80_LDI0 (0x6 << 26) 2962306a36Sopenharmony_ci#define VIDCON0_VIDOUT_WB_I80_LDI1 (0x7 << 26) 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci#define VIDCON0_L1_DATA_MASK (0x7 << 23) 3262306a36Sopenharmony_ci#define VIDCON0_L1_DATA_SHIFT 23 3362306a36Sopenharmony_ci#define VIDCON0_L1_DATA_16BPP (0x0 << 23) 3462306a36Sopenharmony_ci#define VIDCON0_L1_DATA_18BPP16 (0x1 << 23) 3562306a36Sopenharmony_ci#define VIDCON0_L1_DATA_18BPP9 (0x2 << 23) 3662306a36Sopenharmony_ci#define VIDCON0_L1_DATA_24BPP (0x3 << 23) 3762306a36Sopenharmony_ci#define VIDCON0_L1_DATA_18BPP (0x4 << 23) 3862306a36Sopenharmony_ci#define VIDCON0_L1_DATA_16BPP8 (0x5 << 23) 3962306a36Sopenharmony_ci 4062306a36Sopenharmony_ci#define VIDCON0_L0_DATA_MASK (0x7 << 20) 4162306a36Sopenharmony_ci#define VIDCON0_L0_DATA_SHIFT 20 4262306a36Sopenharmony_ci#define VIDCON0_L0_DATA_16BPP (0x0 << 20) 4362306a36Sopenharmony_ci#define VIDCON0_L0_DATA_18BPP16 (0x1 << 20) 4462306a36Sopenharmony_ci#define VIDCON0_L0_DATA_18BPP9 (0x2 << 20) 4562306a36Sopenharmony_ci#define VIDCON0_L0_DATA_24BPP (0x3 << 20) 4662306a36Sopenharmony_ci#define VIDCON0_L0_DATA_18BPP (0x4 << 20) 4762306a36Sopenharmony_ci#define VIDCON0_L0_DATA_16BPP8 (0x5 << 20) 4862306a36Sopenharmony_ci 4962306a36Sopenharmony_ci#define VIDCON0_PNRMODE_MASK (0x3 << 17) 5062306a36Sopenharmony_ci#define VIDCON0_PNRMODE_SHIFT 17 5162306a36Sopenharmony_ci#define VIDCON0_PNRMODE_RGB (0x0 << 17) 5262306a36Sopenharmony_ci#define VIDCON0_PNRMODE_BGR (0x1 << 17) 5362306a36Sopenharmony_ci#define VIDCON0_PNRMODE_SERIAL_RGB (0x2 << 17) 5462306a36Sopenharmony_ci#define VIDCON0_PNRMODE_SERIAL_BGR (0x3 << 17) 5562306a36Sopenharmony_ci 5662306a36Sopenharmony_ci#define VIDCON0_CLKVALUP (1 << 16) 5762306a36Sopenharmony_ci#define VIDCON0_CLKVAL_F_MASK (0xff << 6) 5862306a36Sopenharmony_ci#define VIDCON0_CLKVAL_F_SHIFT 6 5962306a36Sopenharmony_ci#define VIDCON0_CLKVAL_F_LIMIT 0xff 6062306a36Sopenharmony_ci#define VIDCON0_CLKVAL_F(_x) ((_x) << 6) 6162306a36Sopenharmony_ci#define VIDCON0_VLCKFREE (1 << 5) 6262306a36Sopenharmony_ci#define VIDCON0_CLKDIR (1 << 4) 6362306a36Sopenharmony_ci 6462306a36Sopenharmony_ci#define VIDCON0_CLKSEL_MASK (0x3 << 2) 6562306a36Sopenharmony_ci#define VIDCON0_CLKSEL_SHIFT 2 6662306a36Sopenharmony_ci#define VIDCON0_CLKSEL_HCLK (0x0 << 2) 6762306a36Sopenharmony_ci#define VIDCON0_CLKSEL_LCD (0x1 << 2) 6862306a36Sopenharmony_ci#define VIDCON0_CLKSEL_27M (0x3 << 2) 6962306a36Sopenharmony_ci 7062306a36Sopenharmony_ci#define VIDCON0_ENVID (1 << 1) 7162306a36Sopenharmony_ci#define VIDCON0_ENVID_F (1 << 0) 7262306a36Sopenharmony_ci 7362306a36Sopenharmony_ci#define VIDCON1 0x04 7462306a36Sopenharmony_ci#define VIDCON1_LINECNT_MASK (0x7ff << 16) 7562306a36Sopenharmony_ci#define VIDCON1_LINECNT_SHIFT 16 7662306a36Sopenharmony_ci#define VIDCON1_LINECNT_GET(_v) (((_v) >> 16) & 0x7ff) 7762306a36Sopenharmony_ci#define VIDCON1_FSTATUS_EVEN (1 << 15) 7862306a36Sopenharmony_ci#define VIDCON1_VSTATUS_MASK (0x3 << 13) 7962306a36Sopenharmony_ci#define VIDCON1_VSTATUS_SHIFT 13 8062306a36Sopenharmony_ci#define VIDCON1_VSTATUS_VSYNC (0x0 << 13) 8162306a36Sopenharmony_ci#define VIDCON1_VSTATUS_BACKPORCH (0x1 << 13) 8262306a36Sopenharmony_ci#define VIDCON1_VSTATUS_ACTIVE (0x2 << 13) 8362306a36Sopenharmony_ci#define VIDCON1_VSTATUS_FRONTPORCH (0x3 << 13) 8462306a36Sopenharmony_ci#define VIDCON1_VCLK_MASK (0x3 << 9) 8562306a36Sopenharmony_ci#define VIDCON1_VCLK_HOLD (0x0 << 9) 8662306a36Sopenharmony_ci#define VIDCON1_VCLK_RUN (0x1 << 9) 8762306a36Sopenharmony_ci 8862306a36Sopenharmony_ci#define VIDCON1_INV_VCLK (1 << 7) 8962306a36Sopenharmony_ci#define VIDCON1_INV_HSYNC (1 << 6) 9062306a36Sopenharmony_ci#define VIDCON1_INV_VSYNC (1 << 5) 9162306a36Sopenharmony_ci#define VIDCON1_INV_VDEN (1 << 4) 9262306a36Sopenharmony_ci 9362306a36Sopenharmony_ci/* VIDCON2 */ 9462306a36Sopenharmony_ci 9562306a36Sopenharmony_ci#define VIDCON2 0x08 9662306a36Sopenharmony_ci#define VIDCON2_EN601 (1 << 23) 9762306a36Sopenharmony_ci#define VIDCON2_TVFMTSEL_SW (1 << 14) 9862306a36Sopenharmony_ci 9962306a36Sopenharmony_ci#define VIDCON2_TVFMTSEL1_MASK (0x3 << 12) 10062306a36Sopenharmony_ci#define VIDCON2_TVFMTSEL1_SHIFT 12 10162306a36Sopenharmony_ci#define VIDCON2_TVFMTSEL1_RGB (0x0 << 12) 10262306a36Sopenharmony_ci#define VIDCON2_TVFMTSEL1_YUV422 (0x1 << 12) 10362306a36Sopenharmony_ci#define VIDCON2_TVFMTSEL1_YUV444 (0x2 << 12) 10462306a36Sopenharmony_ci 10562306a36Sopenharmony_ci#define VIDCON2_ORGYCbCr (1 << 8) 10662306a36Sopenharmony_ci#define VIDCON2_YUVORDCrCb (1 << 7) 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci/* PRTCON (S3C6410) 10962306a36Sopenharmony_ci * Might not be present in the S3C6410 documentation, 11062306a36Sopenharmony_ci * but tests prove it's there almost for sure; shouldn't hurt in any case. 11162306a36Sopenharmony_ci */ 11262306a36Sopenharmony_ci#define PRTCON 0x0c 11362306a36Sopenharmony_ci#define PRTCON_PROTECT (1 << 11) 11462306a36Sopenharmony_ci 11562306a36Sopenharmony_ci/* VIDTCON0 */ 11662306a36Sopenharmony_ci 11762306a36Sopenharmony_ci#define VIDTCON0 0x10 11862306a36Sopenharmony_ci#define VIDTCON0_VBPDE_MASK (0xff << 24) 11962306a36Sopenharmony_ci#define VIDTCON0_VBPDE_SHIFT 24 12062306a36Sopenharmony_ci#define VIDTCON0_VBPDE_LIMIT 0xff 12162306a36Sopenharmony_ci#define VIDTCON0_VBPDE(_x) ((_x) << 24) 12262306a36Sopenharmony_ci 12362306a36Sopenharmony_ci#define VIDTCON0_VBPD_MASK (0xff << 16) 12462306a36Sopenharmony_ci#define VIDTCON0_VBPD_SHIFT 16 12562306a36Sopenharmony_ci#define VIDTCON0_VBPD_LIMIT 0xff 12662306a36Sopenharmony_ci#define VIDTCON0_VBPD(_x) ((_x) << 16) 12762306a36Sopenharmony_ci 12862306a36Sopenharmony_ci#define VIDTCON0_VFPD_MASK (0xff << 8) 12962306a36Sopenharmony_ci#define VIDTCON0_VFPD_SHIFT 8 13062306a36Sopenharmony_ci#define VIDTCON0_VFPD_LIMIT 0xff 13162306a36Sopenharmony_ci#define VIDTCON0_VFPD(_x) ((_x) << 8) 13262306a36Sopenharmony_ci 13362306a36Sopenharmony_ci#define VIDTCON0_VSPW_MASK (0xff << 0) 13462306a36Sopenharmony_ci#define VIDTCON0_VSPW_SHIFT 0 13562306a36Sopenharmony_ci#define VIDTCON0_VSPW_LIMIT 0xff 13662306a36Sopenharmony_ci#define VIDTCON0_VSPW(_x) ((_x) << 0) 13762306a36Sopenharmony_ci 13862306a36Sopenharmony_ci/* VIDTCON1 */ 13962306a36Sopenharmony_ci 14062306a36Sopenharmony_ci#define VIDTCON1 0x14 14162306a36Sopenharmony_ci#define VIDTCON1_VFPDE_MASK (0xff << 24) 14262306a36Sopenharmony_ci#define VIDTCON1_VFPDE_SHIFT 24 14362306a36Sopenharmony_ci#define VIDTCON1_VFPDE_LIMIT 0xff 14462306a36Sopenharmony_ci#define VIDTCON1_VFPDE(_x) ((_x) << 24) 14562306a36Sopenharmony_ci 14662306a36Sopenharmony_ci#define VIDTCON1_HBPD_MASK (0xff << 16) 14762306a36Sopenharmony_ci#define VIDTCON1_HBPD_SHIFT 16 14862306a36Sopenharmony_ci#define VIDTCON1_HBPD_LIMIT 0xff 14962306a36Sopenharmony_ci#define VIDTCON1_HBPD(_x) ((_x) << 16) 15062306a36Sopenharmony_ci 15162306a36Sopenharmony_ci#define VIDTCON1_HFPD_MASK (0xff << 8) 15262306a36Sopenharmony_ci#define VIDTCON1_HFPD_SHIFT 8 15362306a36Sopenharmony_ci#define VIDTCON1_HFPD_LIMIT 0xff 15462306a36Sopenharmony_ci#define VIDTCON1_HFPD(_x) ((_x) << 8) 15562306a36Sopenharmony_ci 15662306a36Sopenharmony_ci#define VIDTCON1_HSPW_MASK (0xff << 0) 15762306a36Sopenharmony_ci#define VIDTCON1_HSPW_SHIFT 0 15862306a36Sopenharmony_ci#define VIDTCON1_HSPW_LIMIT 0xff 15962306a36Sopenharmony_ci#define VIDTCON1_HSPW(_x) ((_x) << 0) 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci#define VIDTCON2 0x18 16262306a36Sopenharmony_ci#define VIDTCON2_LINEVAL_E(_x) ((((_x) & 0x800) >> 11) << 23) 16362306a36Sopenharmony_ci#define VIDTCON2_LINEVAL_MASK (0x7ff << 11) 16462306a36Sopenharmony_ci#define VIDTCON2_LINEVAL_SHIFT 11 16562306a36Sopenharmony_ci#define VIDTCON2_LINEVAL_LIMIT 0x7ff 16662306a36Sopenharmony_ci#define VIDTCON2_LINEVAL(_x) (((_x) & 0x7ff) << 11) 16762306a36Sopenharmony_ci 16862306a36Sopenharmony_ci#define VIDTCON2_HOZVAL_E(_x) ((((_x) & 0x800) >> 11) << 22) 16962306a36Sopenharmony_ci#define VIDTCON2_HOZVAL_MASK (0x7ff << 0) 17062306a36Sopenharmony_ci#define VIDTCON2_HOZVAL_SHIFT 0 17162306a36Sopenharmony_ci#define VIDTCON2_HOZVAL_LIMIT 0x7ff 17262306a36Sopenharmony_ci#define VIDTCON2_HOZVAL(_x) (((_x) & 0x7ff) << 0) 17362306a36Sopenharmony_ci 17462306a36Sopenharmony_ci/* WINCONx */ 17562306a36Sopenharmony_ci 17662306a36Sopenharmony_ci#define WINCON(_win) (0x20 + ((_win) * 4)) 17762306a36Sopenharmony_ci#define WINCONx_CSCCON_EQ601 (0x0 << 28) 17862306a36Sopenharmony_ci#define WINCONx_CSCCON_EQ709 (0x1 << 28) 17962306a36Sopenharmony_ci#define WINCONx_CSCWIDTH_MASK (0x3 << 26) 18062306a36Sopenharmony_ci#define WINCONx_CSCWIDTH_SHIFT 26 18162306a36Sopenharmony_ci#define WINCONx_CSCWIDTH_WIDE (0x0 << 26) 18262306a36Sopenharmony_ci#define WINCONx_CSCWIDTH_NARROW (0x3 << 26) 18362306a36Sopenharmony_ci#define WINCONx_ENLOCAL (1 << 22) 18462306a36Sopenharmony_ci#define WINCONx_BUFSTATUS (1 << 21) 18562306a36Sopenharmony_ci#define WINCONx_BUFSEL (1 << 20) 18662306a36Sopenharmony_ci#define WINCONx_BUFAUTOEN (1 << 19) 18762306a36Sopenharmony_ci#define WINCONx_BITSWP (1 << 18) 18862306a36Sopenharmony_ci#define WINCONx_BYTSWP (1 << 17) 18962306a36Sopenharmony_ci#define WINCONx_HAWSWP (1 << 16) 19062306a36Sopenharmony_ci#define WINCONx_WSWP (1 << 15) 19162306a36Sopenharmony_ci#define WINCONx_YCbCr (1 << 13) 19262306a36Sopenharmony_ci#define WINCONx_BURSTLEN_MASK (0x3 << 9) 19362306a36Sopenharmony_ci#define WINCONx_BURSTLEN_SHIFT 9 19462306a36Sopenharmony_ci#define WINCONx_BURSTLEN_16WORD (0x0 << 9) 19562306a36Sopenharmony_ci#define WINCONx_BURSTLEN_8WORD (0x1 << 9) 19662306a36Sopenharmony_ci#define WINCONx_BURSTLEN_4WORD (0x2 << 9) 19762306a36Sopenharmony_ci#define WINCONx_ENWIN (1 << 0) 19862306a36Sopenharmony_ci#define WINCONx_BLEND_MODE_MASK (0xc2) 19962306a36Sopenharmony_ci 20062306a36Sopenharmony_ci#define WINCON0_BPPMODE_MASK (0xf << 2) 20162306a36Sopenharmony_ci#define WINCON0_BPPMODE_SHIFT 2 20262306a36Sopenharmony_ci#define WINCON0_BPPMODE_1BPP (0x0 << 2) 20362306a36Sopenharmony_ci#define WINCON0_BPPMODE_2BPP (0x1 << 2) 20462306a36Sopenharmony_ci#define WINCON0_BPPMODE_4BPP (0x2 << 2) 20562306a36Sopenharmony_ci#define WINCON0_BPPMODE_8BPP_PALETTE (0x3 << 2) 20662306a36Sopenharmony_ci#define WINCON0_BPPMODE_16BPP_565 (0x5 << 2) 20762306a36Sopenharmony_ci#define WINCON0_BPPMODE_16BPP_1555 (0x7 << 2) 20862306a36Sopenharmony_ci#define WINCON0_BPPMODE_18BPP_666 (0x8 << 2) 20962306a36Sopenharmony_ci#define WINCON0_BPPMODE_24BPP_888 (0xb << 2) 21062306a36Sopenharmony_ci 21162306a36Sopenharmony_ci#define WINCON1_LOCALSEL_CAMIF (1 << 23) 21262306a36Sopenharmony_ci#define WINCON1_ALPHA_MUL (1 << 7) 21362306a36Sopenharmony_ci#define WINCON1_BLD_PIX (1 << 6) 21462306a36Sopenharmony_ci#define WINCON1_BPPMODE_MASK (0xf << 2) 21562306a36Sopenharmony_ci#define WINCON1_BPPMODE_SHIFT 2 21662306a36Sopenharmony_ci#define WINCON1_BPPMODE_1BPP (0x0 << 2) 21762306a36Sopenharmony_ci#define WINCON1_BPPMODE_2BPP (0x1 << 2) 21862306a36Sopenharmony_ci#define WINCON1_BPPMODE_4BPP (0x2 << 2) 21962306a36Sopenharmony_ci#define WINCON1_BPPMODE_8BPP_PALETTE (0x3 << 2) 22062306a36Sopenharmony_ci#define WINCON1_BPPMODE_8BPP_1232 (0x4 << 2) 22162306a36Sopenharmony_ci#define WINCON1_BPPMODE_16BPP_565 (0x5 << 2) 22262306a36Sopenharmony_ci#define WINCON1_BPPMODE_16BPP_A1555 (0x6 << 2) 22362306a36Sopenharmony_ci#define WINCON1_BPPMODE_16BPP_I1555 (0x7 << 2) 22462306a36Sopenharmony_ci#define WINCON1_BPPMODE_18BPP_666 (0x8 << 2) 22562306a36Sopenharmony_ci#define WINCON1_BPPMODE_18BPP_A1665 (0x9 << 2) 22662306a36Sopenharmony_ci#define WINCON1_BPPMODE_19BPP_A1666 (0xa << 2) 22762306a36Sopenharmony_ci#define WINCON1_BPPMODE_24BPP_888 (0xb << 2) 22862306a36Sopenharmony_ci#define WINCON1_BPPMODE_24BPP_A1887 (0xc << 2) 22962306a36Sopenharmony_ci#define WINCON1_BPPMODE_25BPP_A1888 (0xd << 2) 23062306a36Sopenharmony_ci#define WINCON1_BPPMODE_28BPP_A4888 (0xd << 2) 23162306a36Sopenharmony_ci#define WINCON1_ALPHA_SEL (1 << 1) 23262306a36Sopenharmony_ci 23362306a36Sopenharmony_ci/* S5PV210 */ 23462306a36Sopenharmony_ci#define SHADOWCON 0x34 23562306a36Sopenharmony_ci#define SHADOWCON_WINx_PROTECT(_win) (1 << (10 + (_win))) 23662306a36Sopenharmony_ci/* DMA channels (all windows) */ 23762306a36Sopenharmony_ci#define SHADOWCON_CHx_ENABLE(_win) (1 << (_win)) 23862306a36Sopenharmony_ci/* Local input channels (windows 0-2) */ 23962306a36Sopenharmony_ci#define SHADOWCON_CHx_LOCAL_ENABLE(_win) (1 << (5 + (_win))) 24062306a36Sopenharmony_ci 24162306a36Sopenharmony_ci/* VIDOSDx */ 24262306a36Sopenharmony_ci 24362306a36Sopenharmony_ci#define VIDOSD_BASE 0x40 24462306a36Sopenharmony_ci#define VIDOSDxA_TOPLEFT_X_E(_x) ((((_x) & 0x800) >> 11) << 23) 24562306a36Sopenharmony_ci#define VIDOSDxA_TOPLEFT_X_MASK (0x7ff << 11) 24662306a36Sopenharmony_ci#define VIDOSDxA_TOPLEFT_X_SHIFT 11 24762306a36Sopenharmony_ci#define VIDOSDxA_TOPLEFT_X_LIMIT 0x7ff 24862306a36Sopenharmony_ci#define VIDOSDxA_TOPLEFT_X(_x) (((_x) & 0x7ff) << 11) 24962306a36Sopenharmony_ci 25062306a36Sopenharmony_ci#define VIDOSDxA_TOPLEFT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22) 25162306a36Sopenharmony_ci#define VIDOSDxA_TOPLEFT_Y_MASK (0x7ff << 0) 25262306a36Sopenharmony_ci#define VIDOSDxA_TOPLEFT_Y_SHIFT 0 25362306a36Sopenharmony_ci#define VIDOSDxA_TOPLEFT_Y_LIMIT 0x7ff 25462306a36Sopenharmony_ci#define VIDOSDxA_TOPLEFT_Y(_x) (((_x) & 0x7ff) << 0) 25562306a36Sopenharmony_ci 25662306a36Sopenharmony_ci#define VIDOSDxB_BOTRIGHT_X_E(_x) ((((_x) & 0x800) >> 11) << 23) 25762306a36Sopenharmony_ci#define VIDOSDxB_BOTRIGHT_X_MASK (0x7ff << 11) 25862306a36Sopenharmony_ci#define VIDOSDxB_BOTRIGHT_X_SHIFT 11 25962306a36Sopenharmony_ci#define VIDOSDxB_BOTRIGHT_X_LIMIT 0x7ff 26062306a36Sopenharmony_ci#define VIDOSDxB_BOTRIGHT_X(_x) (((_x) & 0x7ff) << 11) 26162306a36Sopenharmony_ci 26262306a36Sopenharmony_ci#define VIDOSDxB_BOTRIGHT_Y_E(_x) ((((_x) & 0x800) >> 11) << 22) 26362306a36Sopenharmony_ci#define VIDOSDxB_BOTRIGHT_Y_MASK (0x7ff << 0) 26462306a36Sopenharmony_ci#define VIDOSDxB_BOTRIGHT_Y_SHIFT 0 26562306a36Sopenharmony_ci#define VIDOSDxB_BOTRIGHT_Y_LIMIT 0x7ff 26662306a36Sopenharmony_ci#define VIDOSDxB_BOTRIGHT_Y(_x) (((_x) & 0x7ff) << 0) 26762306a36Sopenharmony_ci 26862306a36Sopenharmony_ci/* For VIDOSD[1..4]C */ 26962306a36Sopenharmony_ci#define VIDISD14C_ALPHA0_R(_x) ((_x) << 20) 27062306a36Sopenharmony_ci#define VIDISD14C_ALPHA0_G_MASK (0xf << 16) 27162306a36Sopenharmony_ci#define VIDISD14C_ALPHA0_G_SHIFT 16 27262306a36Sopenharmony_ci#define VIDISD14C_ALPHA0_G_LIMIT 0xf 27362306a36Sopenharmony_ci#define VIDISD14C_ALPHA0_G(_x) ((_x) << 16) 27462306a36Sopenharmony_ci#define VIDISD14C_ALPHA0_B_MASK (0xf << 12) 27562306a36Sopenharmony_ci#define VIDISD14C_ALPHA0_B_SHIFT 12 27662306a36Sopenharmony_ci#define VIDISD14C_ALPHA0_B_LIMIT 0xf 27762306a36Sopenharmony_ci#define VIDISD14C_ALPHA0_B(_x) ((_x) << 12) 27862306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_R_MASK (0xf << 8) 27962306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_R_SHIFT 8 28062306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_R_LIMIT 0xf 28162306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_R(_x) ((_x) << 8) 28262306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_G_MASK (0xf << 4) 28362306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_G_SHIFT 4 28462306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_G_LIMIT 0xf 28562306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_G(_x) ((_x) << 4) 28662306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_B_MASK (0xf << 0) 28762306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_B_SHIFT 0 28862306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_B_LIMIT 0xf 28962306a36Sopenharmony_ci#define VIDISD14C_ALPHA1_B(_x) ((_x) << 0) 29062306a36Sopenharmony_ci 29162306a36Sopenharmony_ci#define VIDW_ALPHA 0x021c 29262306a36Sopenharmony_ci#define VIDW_ALPHA_R(_x) ((_x) << 16) 29362306a36Sopenharmony_ci#define VIDW_ALPHA_G(_x) ((_x) << 8) 29462306a36Sopenharmony_ci#define VIDW_ALPHA_B(_x) ((_x) << 0) 29562306a36Sopenharmony_ci 29662306a36Sopenharmony_ci/* Video buffer addresses */ 29762306a36Sopenharmony_ci#define VIDW_BUF_START(_buff) (0xA0 + ((_buff) * 8)) 29862306a36Sopenharmony_ci#define VIDW_BUF_START_S(_buff) (0x40A0 + ((_buff) * 8)) 29962306a36Sopenharmony_ci#define VIDW_BUF_START1(_buff) (0xA4 + ((_buff) * 8)) 30062306a36Sopenharmony_ci#define VIDW_BUF_END(_buff) (0xD0 + ((_buff) * 8)) 30162306a36Sopenharmony_ci#define VIDW_BUF_END1(_buff) (0xD4 + ((_buff) * 8)) 30262306a36Sopenharmony_ci#define VIDW_BUF_SIZE(_buff) (0x100 + ((_buff) * 4)) 30362306a36Sopenharmony_ci 30462306a36Sopenharmony_ci#define VIDW_BUF_SIZE_OFFSET_E(_x) ((((_x) & 0x2000) >> 13) << 27) 30562306a36Sopenharmony_ci#define VIDW_BUF_SIZE_OFFSET_MASK (0x1fff << 13) 30662306a36Sopenharmony_ci#define VIDW_BUF_SIZE_OFFSET_SHIFT 13 30762306a36Sopenharmony_ci#define VIDW_BUF_SIZE_OFFSET_LIMIT 0x1fff 30862306a36Sopenharmony_ci#define VIDW_BUF_SIZE_OFFSET(_x) (((_x) & 0x1fff) << 13) 30962306a36Sopenharmony_ci 31062306a36Sopenharmony_ci#define VIDW_BUF_SIZE_PAGEWIDTH_E(_x) ((((_x) & 0x2000) >> 13) << 26) 31162306a36Sopenharmony_ci#define VIDW_BUF_SIZE_PAGEWIDTH_MASK (0x1fff << 0) 31262306a36Sopenharmony_ci#define VIDW_BUF_SIZE_PAGEWIDTH_SHIFT 0 31362306a36Sopenharmony_ci#define VIDW_BUF_SIZE_PAGEWIDTH_LIMIT 0x1fff 31462306a36Sopenharmony_ci#define VIDW_BUF_SIZE_PAGEWIDTH(_x) (((_x) & 0x1fff) << 0) 31562306a36Sopenharmony_ci 31662306a36Sopenharmony_ci/* Interrupt controls and status */ 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_ci#define VIDINTCON0 0x130 31962306a36Sopenharmony_ci#define VIDINTCON0_FIFOINTERVAL_MASK (0x3f << 20) 32062306a36Sopenharmony_ci#define VIDINTCON0_FIFOINTERVAL_SHIFT 20 32162306a36Sopenharmony_ci#define VIDINTCON0_FIFOINTERVAL_LIMIT 0x3f 32262306a36Sopenharmony_ci#define VIDINTCON0_FIFOINTERVAL(_x) ((_x) << 20) 32362306a36Sopenharmony_ci 32462306a36Sopenharmony_ci#define VIDINTCON0_INT_SYSMAINCON (1 << 19) 32562306a36Sopenharmony_ci#define VIDINTCON0_INT_SYSSUBCON (1 << 18) 32662306a36Sopenharmony_ci#define VIDINTCON0_INT_I80IFDONE (1 << 17) 32762306a36Sopenharmony_ci 32862306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL0_MASK (0x3 << 15) 32962306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL0_SHIFT 15 33062306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL0_BACKPORCH (0x0 << 15) 33162306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL0_VSYNC (0x1 << 15) 33262306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL0_ACTIVE (0x2 << 15) 33362306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL0_FRONTPORCH (0x3 << 15) 33462306a36Sopenharmony_ci 33562306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL1 (1 << 13) 33662306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL1_MASK (0x3 << 13) 33762306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL1_NONE (0x0 << 13) 33862306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL1_BACKPORCH (0x1 << 13) 33962306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL1_VSYNC (0x2 << 13) 34062306a36Sopenharmony_ci#define VIDINTCON0_FRAMESEL1_FRONTPORCH (0x3 << 13) 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_ci#define VIDINTCON0_INT_FRAME (1 << 12) 34362306a36Sopenharmony_ci#define VIDINTCON0_FIFIOSEL_MASK (0x7f << 5) 34462306a36Sopenharmony_ci#define VIDINTCON0_FIFIOSEL_SHIFT 5 34562306a36Sopenharmony_ci#define VIDINTCON0_FIFIOSEL_WINDOW0 (0x1 << 5) 34662306a36Sopenharmony_ci#define VIDINTCON0_FIFIOSEL_WINDOW1 (0x2 << 5) 34762306a36Sopenharmony_ci#define VIDINTCON0_FIFIOSEL_WINDOW2 (0x10 << 5) 34862306a36Sopenharmony_ci#define VIDINTCON0_FIFIOSEL_WINDOW3 (0x20 << 5) 34962306a36Sopenharmony_ci#define VIDINTCON0_FIFIOSEL_WINDOW4 (0x40 << 5) 35062306a36Sopenharmony_ci 35162306a36Sopenharmony_ci#define VIDINTCON0_FIFOLEVEL_MASK (0x7 << 2) 35262306a36Sopenharmony_ci#define VIDINTCON0_FIFOLEVEL_SHIFT 2 35362306a36Sopenharmony_ci#define VIDINTCON0_FIFOLEVEL_TO25PC (0x0 << 2) 35462306a36Sopenharmony_ci#define VIDINTCON0_FIFOLEVEL_TO50PC (0x1 << 2) 35562306a36Sopenharmony_ci#define VIDINTCON0_FIFOLEVEL_TO75PC (0x2 << 2) 35662306a36Sopenharmony_ci#define VIDINTCON0_FIFOLEVEL_EMPTY (0x3 << 2) 35762306a36Sopenharmony_ci#define VIDINTCON0_FIFOLEVEL_FULL (0x4 << 2) 35862306a36Sopenharmony_ci 35962306a36Sopenharmony_ci#define VIDINTCON0_INT_FIFO_MASK (0x3 << 0) 36062306a36Sopenharmony_ci#define VIDINTCON0_INT_FIFO_SHIFT 0 36162306a36Sopenharmony_ci#define VIDINTCON0_INT_ENABLE (1 << 0) 36262306a36Sopenharmony_ci 36362306a36Sopenharmony_ci#define VIDINTCON1 0x134 36462306a36Sopenharmony_ci#define VIDINTCON1_INT_I80 (1 << 2) 36562306a36Sopenharmony_ci#define VIDINTCON1_INT_FRAME (1 << 1) 36662306a36Sopenharmony_ci#define VIDINTCON1_INT_FIFO (1 << 0) 36762306a36Sopenharmony_ci 36862306a36Sopenharmony_ci/* Window colour-key control registers */ 36962306a36Sopenharmony_ci#define WKEYCON 0x140 37062306a36Sopenharmony_ci 37162306a36Sopenharmony_ci#define WKEYCON0 0x00 37262306a36Sopenharmony_ci#define WKEYCON1 0x04 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ci#define WxKEYCON0_KEYBL_EN (1 << 26) 37562306a36Sopenharmony_ci#define WxKEYCON0_KEYEN_F (1 << 25) 37662306a36Sopenharmony_ci#define WxKEYCON0_DIRCON (1 << 24) 37762306a36Sopenharmony_ci#define WxKEYCON0_COMPKEY_MASK (0xffffff << 0) 37862306a36Sopenharmony_ci#define WxKEYCON0_COMPKEY_SHIFT 0 37962306a36Sopenharmony_ci#define WxKEYCON0_COMPKEY_LIMIT 0xffffff 38062306a36Sopenharmony_ci#define WxKEYCON0_COMPKEY(_x) ((_x) << 0) 38162306a36Sopenharmony_ci#define WxKEYCON1_COLVAL_MASK (0xffffff << 0) 38262306a36Sopenharmony_ci#define WxKEYCON1_COLVAL_SHIFT 0 38362306a36Sopenharmony_ci#define WxKEYCON1_COLVAL_LIMIT 0xffffff 38462306a36Sopenharmony_ci#define WxKEYCON1_COLVAL(_x) ((_x) << 0) 38562306a36Sopenharmony_ci 38662306a36Sopenharmony_ci/* Dithering control */ 38762306a36Sopenharmony_ci#define DITHMODE 0x170 38862306a36Sopenharmony_ci#define DITHMODE_R_POS_MASK (0x3 << 5) 38962306a36Sopenharmony_ci#define DITHMODE_R_POS_SHIFT 5 39062306a36Sopenharmony_ci#define DITHMODE_R_POS_8BIT (0x0 << 5) 39162306a36Sopenharmony_ci#define DITHMODE_R_POS_6BIT (0x1 << 5) 39262306a36Sopenharmony_ci#define DITHMODE_R_POS_5BIT (0x2 << 5) 39362306a36Sopenharmony_ci#define DITHMODE_G_POS_MASK (0x3 << 3) 39462306a36Sopenharmony_ci#define DITHMODE_G_POS_SHIFT 3 39562306a36Sopenharmony_ci#define DITHMODE_G_POS_8BIT (0x0 << 3) 39662306a36Sopenharmony_ci#define DITHMODE_G_POS_6BIT (0x1 << 3) 39762306a36Sopenharmony_ci#define DITHMODE_G_POS_5BIT (0x2 << 3) 39862306a36Sopenharmony_ci#define DITHMODE_B_POS_MASK (0x3 << 1) 39962306a36Sopenharmony_ci#define DITHMODE_B_POS_SHIFT 1 40062306a36Sopenharmony_ci#define DITHMODE_B_POS_8BIT (0x0 << 1) 40162306a36Sopenharmony_ci#define DITHMODE_B_POS_6BIT (0x1 << 1) 40262306a36Sopenharmony_ci#define DITHMODE_B_POS_5BIT (0x2 << 1) 40362306a36Sopenharmony_ci#define DITHMODE_DITH_EN (1 << 0) 40462306a36Sopenharmony_ci 40562306a36Sopenharmony_ci/* Window blanking (MAP) */ 40662306a36Sopenharmony_ci#define WINxMAP(_win) (0x180 + ((_win) * 4)) 40762306a36Sopenharmony_ci#define WINxMAP_MAP (1 << 24) 40862306a36Sopenharmony_ci#define WINxMAP_MAP_COLOUR_MASK (0xffffff << 0) 40962306a36Sopenharmony_ci#define WINxMAP_MAP_COLOUR_SHIFT 0 41062306a36Sopenharmony_ci#define WINxMAP_MAP_COLOUR_LIMIT 0xffffff 41162306a36Sopenharmony_ci#define WINxMAP_MAP_COLOUR(_x) ((_x) << 0) 41262306a36Sopenharmony_ci 41362306a36Sopenharmony_ci/* Winodw palette control */ 41462306a36Sopenharmony_ci#define WPALCON 0x1A0 41562306a36Sopenharmony_ci#define WPALCON_PAL_UPDATE (1 << 9) 41662306a36Sopenharmony_ci#define WPALCON_W4PAL_16BPP_A555 (1 << 8) 41762306a36Sopenharmony_ci#define WPALCON_W3PAL_16BPP_A555 (1 << 7) 41862306a36Sopenharmony_ci#define WPALCON_W2PAL_16BPP_A555 (1 << 6) 41962306a36Sopenharmony_ci#define WPALCON_W1PAL_MASK (0x7 << 3) 42062306a36Sopenharmony_ci#define WPALCON_W1PAL_SHIFT 3 42162306a36Sopenharmony_ci#define WPALCON_W1PAL_25BPP_A888 (0x0 << 3) 42262306a36Sopenharmony_ci#define WPALCON_W1PAL_24BPP (0x1 << 3) 42362306a36Sopenharmony_ci#define WPALCON_W1PAL_19BPP_A666 (0x2 << 3) 42462306a36Sopenharmony_ci#define WPALCON_W1PAL_18BPP_A665 (0x3 << 3) 42562306a36Sopenharmony_ci#define WPALCON_W1PAL_18BPP (0x4 << 3) 42662306a36Sopenharmony_ci#define WPALCON_W1PAL_16BPP_A555 (0x5 << 3) 42762306a36Sopenharmony_ci#define WPALCON_W1PAL_16BPP_565 (0x6 << 3) 42862306a36Sopenharmony_ci#define WPALCON_W0PAL_MASK (0x7 << 0) 42962306a36Sopenharmony_ci#define WPALCON_W0PAL_SHIFT 0 43062306a36Sopenharmony_ci#define WPALCON_W0PAL_25BPP_A888 (0x0 << 0) 43162306a36Sopenharmony_ci#define WPALCON_W0PAL_24BPP (0x1 << 0) 43262306a36Sopenharmony_ci#define WPALCON_W0PAL_19BPP_A666 (0x2 << 0) 43362306a36Sopenharmony_ci#define WPALCON_W0PAL_18BPP_A665 (0x3 << 0) 43462306a36Sopenharmony_ci#define WPALCON_W0PAL_18BPP (0x4 << 0) 43562306a36Sopenharmony_ci#define WPALCON_W0PAL_16BPP_A555 (0x5 << 0) 43662306a36Sopenharmony_ci#define WPALCON_W0PAL_16BPP_565 (0x6 << 0) 43762306a36Sopenharmony_ci 43862306a36Sopenharmony_ci/* Blending equation control */ 43962306a36Sopenharmony_ci#define BLENDEQx(_win) (0x244 + ((_win - 1) * 4)) 44062306a36Sopenharmony_ci#define BLENDEQ_ZERO 0x0 44162306a36Sopenharmony_ci#define BLENDEQ_ONE 0x1 44262306a36Sopenharmony_ci#define BLENDEQ_ALPHA_A 0x2 44362306a36Sopenharmony_ci#define BLENDEQ_ONE_MINUS_ALPHA_A 0x3 44462306a36Sopenharmony_ci#define BLENDEQ_ALPHA0 0x6 44562306a36Sopenharmony_ci#define BLENDEQ_B_FUNC_F(_x) (_x << 6) 44662306a36Sopenharmony_ci#define BLENDEQ_A_FUNC_F(_x) (_x << 0) 44762306a36Sopenharmony_ci#define BLENDCON 0x260 44862306a36Sopenharmony_ci#define BLENDCON_NEW_MASK (1 << 0) 44962306a36Sopenharmony_ci#define BLENDCON_NEW_8BIT_ALPHA_VALUE (1 << 0) 45062306a36Sopenharmony_ci#define BLENDCON_NEW_4BIT_ALPHA_VALUE (0 << 0) 45162306a36Sopenharmony_ci 45262306a36Sopenharmony_ci/* Display port clock control */ 45362306a36Sopenharmony_ci#define DP_MIE_CLKCON 0x27c 45462306a36Sopenharmony_ci#define DP_MIE_CLK_DISABLE 0x0 45562306a36Sopenharmony_ci#define DP_MIE_CLK_DP_ENABLE 0x2 45662306a36Sopenharmony_ci#define DP_MIE_CLK_MIE_ENABLE 0x3 45762306a36Sopenharmony_ci 45862306a36Sopenharmony_ci/* Notes on per-window bpp settings 45962306a36Sopenharmony_ci * 46062306a36Sopenharmony_ci * Value Win0 Win1 Win2 Win3 Win 4 46162306a36Sopenharmony_ci * 0000 1(P) 1(P) 1(P) 1(P) 1(P) 46262306a36Sopenharmony_ci * 0001 2(P) 2(P) 2(P) 2(P) 2(P) 46362306a36Sopenharmony_ci * 0010 4(P) 4(P) 4(P) 4(P) -none- 46462306a36Sopenharmony_ci * 0011 8(P) 8(P) -none- -none- -none- 46562306a36Sopenharmony_ci * 0100 -none- 8(A232) 8(A232) -none- -none- 46662306a36Sopenharmony_ci * 0101 16(565) 16(565) 16(565) 16(565) 16(565) 46762306a36Sopenharmony_ci * 0110 -none- 16(A555) 16(A555) 16(A555) 16(A555) 46862306a36Sopenharmony_ci * 0111 16(I555) 16(I565) 16(I555) 16(I555) 16(I555) 46962306a36Sopenharmony_ci * 1000 18(666) 18(666) 18(666) 18(666) 18(666) 47062306a36Sopenharmony_ci * 1001 -none- 18(A665) 18(A665) 18(A665) 16(A665) 47162306a36Sopenharmony_ci * 1010 -none- 19(A666) 19(A666) 19(A666) 19(A666) 47262306a36Sopenharmony_ci * 1011 24(888) 24(888) 24(888) 24(888) 24(888) 47362306a36Sopenharmony_ci * 1100 -none- 24(A887) 24(A887) 24(A887) 24(A887) 47462306a36Sopenharmony_ci * 1101 -none- 25(A888) 25(A888) 25(A888) 25(A888) 47562306a36Sopenharmony_ci * 1110 -none- -none- -none- -none- -none- 47662306a36Sopenharmony_ci * 1111 -none- -none- -none- -none- -none- 47762306a36Sopenharmony_ci*/ 47862306a36Sopenharmony_ci 47962306a36Sopenharmony_ci#define WIN_RGB_ORDER(_win) (0x2020 + ((_win) * 4)) 48062306a36Sopenharmony_ci#define WIN_RGB_ORDER_FORWARD (0 << 11) 48162306a36Sopenharmony_ci#define WIN_RGB_ORDER_REVERSE (1 << 11) 48262306a36Sopenharmony_ci 48362306a36Sopenharmony_ci/* FIMD Version 8 register offset definitions */ 48462306a36Sopenharmony_ci#define FIMD_V8_VIDTCON0 0x20010 48562306a36Sopenharmony_ci#define FIMD_V8_VIDTCON1 0x20014 48662306a36Sopenharmony_ci#define FIMD_V8_VIDTCON2 0x20018 48762306a36Sopenharmony_ci#define FIMD_V8_VIDTCON3 0x2001C 48862306a36Sopenharmony_ci#define FIMD_V8_VIDCON1 0x20004 489