1*e7b8153eSMauro Carvalho Chehab /* SPDX-License-Identifier: GPL-2.0 */ 2*e7b8153eSMauro Carvalho Chehab /* 3*e7b8153eSMauro Carvalho Chehab * Copyright (C) STMicroelectronics SA 2014 4*e7b8153eSMauro Carvalho Chehab * Authors: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics. 5*e7b8153eSMauro Carvalho Chehab */ 6*e7b8153eSMauro Carvalho Chehab 7*e7b8153eSMauro Carvalho Chehab struct bdisp_node { 8*e7b8153eSMauro Carvalho Chehab /* 0 - General */ 9*e7b8153eSMauro Carvalho Chehab u32 nip; 10*e7b8153eSMauro Carvalho Chehab u32 cic; 11*e7b8153eSMauro Carvalho Chehab u32 ins; 12*e7b8153eSMauro Carvalho Chehab u32 ack; 13*e7b8153eSMauro Carvalho Chehab /* 1 - Target */ 14*e7b8153eSMauro Carvalho Chehab u32 tba; 15*e7b8153eSMauro Carvalho Chehab u32 tty; 16*e7b8153eSMauro Carvalho Chehab u32 txy; 17*e7b8153eSMauro Carvalho Chehab u32 tsz; 18*e7b8153eSMauro Carvalho Chehab /* 2 - Color Fill */ 19*e7b8153eSMauro Carvalho Chehab u32 s1cf; 20*e7b8153eSMauro Carvalho Chehab u32 s2cf; 21*e7b8153eSMauro Carvalho Chehab /* 3 - Source 1 */ 22*e7b8153eSMauro Carvalho Chehab u32 s1ba; 23*e7b8153eSMauro Carvalho Chehab u32 s1ty; 24*e7b8153eSMauro Carvalho Chehab u32 s1xy; 25*e7b8153eSMauro Carvalho Chehab u32 s1sz_tsz; 26*e7b8153eSMauro Carvalho Chehab /* 4 - Source 2 */ 27*e7b8153eSMauro Carvalho Chehab u32 s2ba; 28*e7b8153eSMauro Carvalho Chehab u32 s2ty; 29*e7b8153eSMauro Carvalho Chehab u32 s2xy; 30*e7b8153eSMauro Carvalho Chehab u32 s2sz; 31*e7b8153eSMauro Carvalho Chehab /* 5 - Source 3 */ 32*e7b8153eSMauro Carvalho Chehab u32 s3ba; 33*e7b8153eSMauro Carvalho Chehab u32 s3ty; 34*e7b8153eSMauro Carvalho Chehab u32 s3xy; 35*e7b8153eSMauro Carvalho Chehab u32 s3sz; 36*e7b8153eSMauro Carvalho Chehab /* 6 - Clipping */ 37*e7b8153eSMauro Carvalho Chehab u32 cwo; 38*e7b8153eSMauro Carvalho Chehab u32 cws; 39*e7b8153eSMauro Carvalho Chehab /* 7 - CLUT */ 40*e7b8153eSMauro Carvalho Chehab u32 cco; 41*e7b8153eSMauro Carvalho Chehab u32 cml; 42*e7b8153eSMauro Carvalho Chehab /* 8 - Filter & Mask */ 43*e7b8153eSMauro Carvalho Chehab u32 fctl; 44*e7b8153eSMauro Carvalho Chehab u32 pmk; 45*e7b8153eSMauro Carvalho Chehab /* 9 - Chroma Filter */ 46*e7b8153eSMauro Carvalho Chehab u32 rsf; 47*e7b8153eSMauro Carvalho Chehab u32 rzi; 48*e7b8153eSMauro Carvalho Chehab u32 hfp; 49*e7b8153eSMauro Carvalho Chehab u32 vfp; 50*e7b8153eSMauro Carvalho Chehab /* 10 - Luma Filter */ 51*e7b8153eSMauro Carvalho Chehab u32 y_rsf; 52*e7b8153eSMauro Carvalho Chehab u32 y_rzi; 53*e7b8153eSMauro Carvalho Chehab u32 y_hfp; 54*e7b8153eSMauro Carvalho Chehab u32 y_vfp; 55*e7b8153eSMauro Carvalho Chehab /* 11 - Flicker */ 56*e7b8153eSMauro Carvalho Chehab u32 ff0; 57*e7b8153eSMauro Carvalho Chehab u32 ff1; 58*e7b8153eSMauro Carvalho Chehab u32 ff2; 59*e7b8153eSMauro Carvalho Chehab u32 ff3; 60*e7b8153eSMauro Carvalho Chehab /* 12 - Color Key */ 61*e7b8153eSMauro Carvalho Chehab u32 key1; 62*e7b8153eSMauro Carvalho Chehab u32 key2; 63*e7b8153eSMauro Carvalho Chehab /* 14 - Static Address & User */ 64*e7b8153eSMauro Carvalho Chehab u32 sar; 65*e7b8153eSMauro Carvalho Chehab u32 usr; 66*e7b8153eSMauro Carvalho Chehab /* 15 - Input Versatile Matrix */ 67*e7b8153eSMauro Carvalho Chehab u32 ivmx0; 68*e7b8153eSMauro Carvalho Chehab u32 ivmx1; 69*e7b8153eSMauro Carvalho Chehab u32 ivmx2; 70*e7b8153eSMauro Carvalho Chehab u32 ivmx3; 71*e7b8153eSMauro Carvalho Chehab /* 16 - Output Versatile Matrix */ 72*e7b8153eSMauro Carvalho Chehab u32 ovmx0; 73*e7b8153eSMauro Carvalho Chehab u32 ovmx1; 74*e7b8153eSMauro Carvalho Chehab u32 ovmx2; 75*e7b8153eSMauro Carvalho Chehab u32 ovmx3; 76*e7b8153eSMauro Carvalho Chehab /* 17 - Pace */ 77*e7b8153eSMauro Carvalho Chehab u32 pace; 78*e7b8153eSMauro Carvalho Chehab /* 18 - VC1R & DEI */ 79*e7b8153eSMauro Carvalho Chehab u32 vc1r; 80*e7b8153eSMauro Carvalho Chehab u32 dei; 81*e7b8153eSMauro Carvalho Chehab /* 19 - Gradient Fill */ 82*e7b8153eSMauro Carvalho Chehab u32 hgf; 83*e7b8153eSMauro Carvalho Chehab u32 vgf; 84*e7b8153eSMauro Carvalho Chehab }; 85*e7b8153eSMauro Carvalho Chehab 86*e7b8153eSMauro Carvalho Chehab /* HW registers : static */ 87*e7b8153eSMauro Carvalho Chehab #define BLT_CTL 0x0A00 88*e7b8153eSMauro Carvalho Chehab #define BLT_ITS 0x0A04 89*e7b8153eSMauro Carvalho Chehab #define BLT_STA1 0x0A08 90*e7b8153eSMauro Carvalho Chehab #define BLT_AQ1_CTL 0x0A60 91*e7b8153eSMauro Carvalho Chehab #define BLT_AQ1_IP 0x0A64 92*e7b8153eSMauro Carvalho Chehab #define BLT_AQ1_LNA 0x0A68 93*e7b8153eSMauro Carvalho Chehab #define BLT_AQ1_STA 0x0A6C 94*e7b8153eSMauro Carvalho Chehab #define BLT_ITM0 0x0AD0 95*e7b8153eSMauro Carvalho Chehab /* HW registers : plugs */ 96*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS1_OP2 0x0B04 97*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS1_CHZ 0x0B08 98*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS1_MSZ 0x0B0C 99*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS1_PGZ 0x0B10 100*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS2_OP2 0x0B24 101*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS2_CHZ 0x0B28 102*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS2_MSZ 0x0B2C 103*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS2_PGZ 0x0B30 104*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS3_OP2 0x0B44 105*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS3_CHZ 0x0B48 106*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS3_MSZ 0x0B4C 107*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGS3_PGZ 0x0B50 108*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGT_OP2 0x0B84 109*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGT_CHZ 0x0B88 110*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGT_MSZ 0x0B8C 111*e7b8153eSMauro Carvalho Chehab #define BLT_PLUGT_PGZ 0x0B90 112*e7b8153eSMauro Carvalho Chehab /* HW registers : node */ 113*e7b8153eSMauro Carvalho Chehab #define BLT_NIP 0x0C00 114*e7b8153eSMauro Carvalho Chehab #define BLT_CIC 0x0C04 115*e7b8153eSMauro Carvalho Chehab #define BLT_INS 0x0C08 116*e7b8153eSMauro Carvalho Chehab #define BLT_ACK 0x0C0C 117*e7b8153eSMauro Carvalho Chehab #define BLT_TBA 0x0C10 118*e7b8153eSMauro Carvalho Chehab #define BLT_TTY 0x0C14 119*e7b8153eSMauro Carvalho Chehab #define BLT_TXY 0x0C18 120*e7b8153eSMauro Carvalho Chehab #define BLT_TSZ 0x0C1C 121*e7b8153eSMauro Carvalho Chehab #define BLT_S1BA 0x0C28 122*e7b8153eSMauro Carvalho Chehab #define BLT_S1TY 0x0C2C 123*e7b8153eSMauro Carvalho Chehab #define BLT_S1XY 0x0C30 124*e7b8153eSMauro Carvalho Chehab #define BLT_S2BA 0x0C38 125*e7b8153eSMauro Carvalho Chehab #define BLT_S2TY 0x0C3C 126*e7b8153eSMauro Carvalho Chehab #define BLT_S2XY 0x0C40 127*e7b8153eSMauro Carvalho Chehab #define BLT_S2SZ 0x0C44 128*e7b8153eSMauro Carvalho Chehab #define BLT_S3BA 0x0C48 129*e7b8153eSMauro Carvalho Chehab #define BLT_S3TY 0x0C4C 130*e7b8153eSMauro Carvalho Chehab #define BLT_S3XY 0x0C50 131*e7b8153eSMauro Carvalho Chehab #define BLT_S3SZ 0x0C54 132*e7b8153eSMauro Carvalho Chehab #define BLT_FCTL 0x0C68 133*e7b8153eSMauro Carvalho Chehab #define BLT_RSF 0x0C70 134*e7b8153eSMauro Carvalho Chehab #define BLT_RZI 0x0C74 135*e7b8153eSMauro Carvalho Chehab #define BLT_HFP 0x0C78 136*e7b8153eSMauro Carvalho Chehab #define BLT_VFP 0x0C7C 137*e7b8153eSMauro Carvalho Chehab #define BLT_Y_RSF 0x0C80 138*e7b8153eSMauro Carvalho Chehab #define BLT_Y_RZI 0x0C84 139*e7b8153eSMauro Carvalho Chehab #define BLT_Y_HFP 0x0C88 140*e7b8153eSMauro Carvalho Chehab #define BLT_Y_VFP 0x0C8C 141*e7b8153eSMauro Carvalho Chehab #define BLT_IVMX0 0x0CC0 142*e7b8153eSMauro Carvalho Chehab #define BLT_IVMX1 0x0CC4 143*e7b8153eSMauro Carvalho Chehab #define BLT_IVMX2 0x0CC8 144*e7b8153eSMauro Carvalho Chehab #define BLT_IVMX3 0x0CCC 145*e7b8153eSMauro Carvalho Chehab #define BLT_OVMX0 0x0CD0 146*e7b8153eSMauro Carvalho Chehab #define BLT_OVMX1 0x0CD4 147*e7b8153eSMauro Carvalho Chehab #define BLT_OVMX2 0x0CD8 148*e7b8153eSMauro Carvalho Chehab #define BLT_OVMX3 0x0CDC 149*e7b8153eSMauro Carvalho Chehab #define BLT_DEI 0x0CEC 150*e7b8153eSMauro Carvalho Chehab /* HW registers : filters */ 151*e7b8153eSMauro Carvalho Chehab #define BLT_HFC_N 0x0D00 152*e7b8153eSMauro Carvalho Chehab #define BLT_VFC_N 0x0D90 153*e7b8153eSMauro Carvalho Chehab #define BLT_Y_HFC_N 0x0E00 154*e7b8153eSMauro Carvalho Chehab #define BLT_Y_VFC_N 0x0E90 155*e7b8153eSMauro Carvalho Chehab #define BLT_NB_H_COEF 16 156*e7b8153eSMauro Carvalho Chehab #define BLT_NB_V_COEF 10 157*e7b8153eSMauro Carvalho Chehab 158*e7b8153eSMauro Carvalho Chehab /* Registers values */ 159*e7b8153eSMauro Carvalho Chehab #define BLT_CTL_RESET BIT(31) /* Global soft reset */ 160*e7b8153eSMauro Carvalho Chehab 161*e7b8153eSMauro Carvalho Chehab #define BLT_ITS_AQ1_LNA BIT(12) /* AQ1 LNA reached */ 162*e7b8153eSMauro Carvalho Chehab 163*e7b8153eSMauro Carvalho Chehab #define BLT_STA1_IDLE BIT(0) /* BDISP idle */ 164*e7b8153eSMauro Carvalho Chehab 165*e7b8153eSMauro Carvalho Chehab #define BLT_AQ1_CTL_CFG 0x80400003 /* Enable, P3, LNA reached */ 166*e7b8153eSMauro Carvalho Chehab 167*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S1_MASK (BIT(0) | BIT(1) | BIT(2)) 168*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S1_OFF 0x00000000 /* src1 disabled */ 169*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S1_MEM 0x00000001 /* src1 fetched from memory */ 170*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S1_CF 0x00000003 /* src1 color fill */ 171*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S1_COPY 0x00000004 /* src1 direct copy */ 172*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S1_FILL 0x00000007 /* src1 firect fill */ 173*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S2_MASK (BIT(3) | BIT(4)) 174*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S2_OFF 0x00000000 /* src2 disabled */ 175*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S2_MEM 0x00000008 /* src2 fetched from memory */ 176*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S2_CF 0x00000018 /* src2 color fill */ 177*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S3_MASK BIT(5) 178*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S3_OFF 0x00000000 /* src3 disabled */ 179*e7b8153eSMauro Carvalho Chehab #define BLT_INS_S3_MEM 0x00000020 /* src3 fetched from memory */ 180*e7b8153eSMauro Carvalho Chehab #define BLT_INS_IVMX BIT(6) /* Input versatile matrix */ 181*e7b8153eSMauro Carvalho Chehab #define BLT_INS_CLUT BIT(7) /* Color Look Up Table */ 182*e7b8153eSMauro Carvalho Chehab #define BLT_INS_SCALE BIT(8) /* Scaling */ 183*e7b8153eSMauro Carvalho Chehab #define BLT_INS_FLICK BIT(9) /* Flicker filter */ 184*e7b8153eSMauro Carvalho Chehab #define BLT_INS_CLIP BIT(10) /* Clipping */ 185*e7b8153eSMauro Carvalho Chehab #define BLT_INS_CKEY BIT(11) /* Color key */ 186*e7b8153eSMauro Carvalho Chehab #define BLT_INS_OVMX BIT(12) /* Output versatile matrix */ 187*e7b8153eSMauro Carvalho Chehab #define BLT_INS_DEI BIT(13) /* Deinterlace */ 188*e7b8153eSMauro Carvalho Chehab #define BLT_INS_PMASK BIT(14) /* Plane mask */ 189*e7b8153eSMauro Carvalho Chehab #define BLT_INS_VC1R BIT(17) /* VC1 Range mapping */ 190*e7b8153eSMauro Carvalho Chehab #define BLT_INS_ROTATE BIT(18) /* Rotation */ 191*e7b8153eSMauro Carvalho Chehab #define BLT_INS_GRAD BIT(19) /* Gradient fill */ 192*e7b8153eSMauro Carvalho Chehab #define BLT_INS_AQLOCK BIT(29) /* AQ lock */ 193*e7b8153eSMauro Carvalho Chehab #define BLT_INS_PACE BIT(30) /* Pace down */ 194*e7b8153eSMauro Carvalho Chehab #define BLT_INS_IRQ BIT(31) /* Raise IRQ when node done */ 195*e7b8153eSMauro Carvalho Chehab #define BLT_CIC_ALL_GRP 0x000FDFFC /* all valid groups present */ 196*e7b8153eSMauro Carvalho Chehab #define BLT_ACK_BYPASS_S2S3 0x00000007 /* Bypass src2 and src3 */ 197*e7b8153eSMauro Carvalho Chehab 198*e7b8153eSMauro Carvalho Chehab #define BLT_TTY_COL_SHIFT 16 /* Color format */ 199*e7b8153eSMauro Carvalho Chehab #define BLT_TTY_COL_MASK 0x001F0000 /* Color format mask */ 200*e7b8153eSMauro Carvalho Chehab #define BLT_TTY_ALPHA_R BIT(21) /* Alpha range */ 201*e7b8153eSMauro Carvalho Chehab #define BLT_TTY_CR_NOT_CB BIT(22) /* CR not Cb */ 202*e7b8153eSMauro Carvalho Chehab #define BLT_TTY_MB BIT(23) /* MB frame / field*/ 203*e7b8153eSMauro Carvalho Chehab #define BLT_TTY_HSO BIT(24) /* H scan order */ 204*e7b8153eSMauro Carvalho Chehab #define BLT_TTY_VSO BIT(25) /* V scan order */ 205*e7b8153eSMauro Carvalho Chehab #define BLT_TTY_DITHER BIT(26) /* Dithering */ 206*e7b8153eSMauro Carvalho Chehab #define BLT_TTY_CHROMA BIT(27) /* Write chroma / luma */ 207*e7b8153eSMauro Carvalho Chehab #define BLT_TTY_BIG_END BIT(30) /* Big endianness */ 208*e7b8153eSMauro Carvalho Chehab 209*e7b8153eSMauro Carvalho Chehab #define BLT_S1TY_A1_SUBSET BIT(22) /* A1 subset */ 210*e7b8153eSMauro Carvalho Chehab #define BLT_S1TY_CHROMA_EXT BIT(26) /* Chroma Extended */ 211*e7b8153eSMauro Carvalho Chehab #define BTL_S1TY_SUBBYTE BIT(28) /* Sub-byte fmt, pixel order */ 212*e7b8153eSMauro Carvalho Chehab #define BLT_S1TY_RGB_EXP BIT(29) /* RGB expansion mode */ 213*e7b8153eSMauro Carvalho Chehab 214*e7b8153eSMauro Carvalho Chehab #define BLT_S2TY_A1_SUBSET BIT(22) /* A1 subset */ 215*e7b8153eSMauro Carvalho Chehab #define BLT_S2TY_CHROMA_EXT BIT(26) /* Chroma Extended */ 216*e7b8153eSMauro Carvalho Chehab #define BTL_S2TY_SUBBYTE BIT(28) /* Sub-byte fmt, pixel order */ 217*e7b8153eSMauro Carvalho Chehab #define BLT_S2TY_RGB_EXP BIT(29) /* RGB expansion mode */ 218*e7b8153eSMauro Carvalho Chehab 219*e7b8153eSMauro Carvalho Chehab #define BLT_S3TY_BLANK_ACC BIT(26) /* Blank access */ 220*e7b8153eSMauro Carvalho Chehab 221*e7b8153eSMauro Carvalho Chehab #define BLT_FCTL_HV_SCALE 0x00000055 /* H/V resize + color filter */ 222*e7b8153eSMauro Carvalho Chehab #define BLT_FCTL_Y_HV_SCALE 0x33000000 /* Luma version */ 223*e7b8153eSMauro Carvalho Chehab 224*e7b8153eSMauro Carvalho Chehab #define BLT_FCTL_HV_SAMPLE 0x00000044 /* H/V resize */ 225*e7b8153eSMauro Carvalho Chehab #define BLT_FCTL_Y_HV_SAMPLE 0x22000000 /* Luma version */ 226*e7b8153eSMauro Carvalho Chehab 227*e7b8153eSMauro Carvalho Chehab #define BLT_RZI_DEFAULT 0x20003000 /* H/VNB_repeat = 3/2 */ 228*e7b8153eSMauro Carvalho Chehab 229*e7b8153eSMauro Carvalho Chehab /* Color format */ 230*e7b8153eSMauro Carvalho Chehab #define BDISP_RGB565 0x00 /* RGB565 */ 231*e7b8153eSMauro Carvalho Chehab #define BDISP_RGB888 0x01 /* RGB888 */ 232*e7b8153eSMauro Carvalho Chehab #define BDISP_XRGB8888 0x02 /* RGB888_32 */ 233*e7b8153eSMauro Carvalho Chehab #define BDISP_ARGB8888 0x05 /* ARGB888 */ 234*e7b8153eSMauro Carvalho Chehab #define BDISP_NV12 0x16 /* YCbCr42x R2B */ 235*e7b8153eSMauro Carvalho Chehab #define BDISP_YUV_3B 0x1E /* YUV (3 buffer) */ 236