18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) STMicroelectronics SA 2014
48c2ecf20Sopenharmony_ci * Authors: Fabien Dessenne <fabien.dessenne@st.com> for STMicroelectronics.
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_cistruct bdisp_node {
88c2ecf20Sopenharmony_ci	/* 0 - General */
98c2ecf20Sopenharmony_ci	u32 nip;
108c2ecf20Sopenharmony_ci	u32 cic;
118c2ecf20Sopenharmony_ci	u32 ins;
128c2ecf20Sopenharmony_ci	u32 ack;
138c2ecf20Sopenharmony_ci	/* 1 - Target */
148c2ecf20Sopenharmony_ci	u32 tba;
158c2ecf20Sopenharmony_ci	u32 tty;
168c2ecf20Sopenharmony_ci	u32 txy;
178c2ecf20Sopenharmony_ci	u32 tsz;
188c2ecf20Sopenharmony_ci	/* 2 - Color Fill */
198c2ecf20Sopenharmony_ci	u32 s1cf;
208c2ecf20Sopenharmony_ci	u32 s2cf;
218c2ecf20Sopenharmony_ci	/* 3 - Source 1 */
228c2ecf20Sopenharmony_ci	u32 s1ba;
238c2ecf20Sopenharmony_ci	u32 s1ty;
248c2ecf20Sopenharmony_ci	u32 s1xy;
258c2ecf20Sopenharmony_ci	u32 s1sz_tsz;
268c2ecf20Sopenharmony_ci	/* 4 - Source 2 */
278c2ecf20Sopenharmony_ci	u32 s2ba;
288c2ecf20Sopenharmony_ci	u32 s2ty;
298c2ecf20Sopenharmony_ci	u32 s2xy;
308c2ecf20Sopenharmony_ci	u32 s2sz;
318c2ecf20Sopenharmony_ci	/* 5 - Source 3 */
328c2ecf20Sopenharmony_ci	u32 s3ba;
338c2ecf20Sopenharmony_ci	u32 s3ty;
348c2ecf20Sopenharmony_ci	u32 s3xy;
358c2ecf20Sopenharmony_ci	u32 s3sz;
368c2ecf20Sopenharmony_ci	/* 6 - Clipping */
378c2ecf20Sopenharmony_ci	u32 cwo;
388c2ecf20Sopenharmony_ci	u32 cws;
398c2ecf20Sopenharmony_ci	/* 7 - CLUT */
408c2ecf20Sopenharmony_ci	u32 cco;
418c2ecf20Sopenharmony_ci	u32 cml;
428c2ecf20Sopenharmony_ci	/* 8 - Filter & Mask */
438c2ecf20Sopenharmony_ci	u32 fctl;
448c2ecf20Sopenharmony_ci	u32 pmk;
458c2ecf20Sopenharmony_ci	/* 9 - Chroma Filter */
468c2ecf20Sopenharmony_ci	u32 rsf;
478c2ecf20Sopenharmony_ci	u32 rzi;
488c2ecf20Sopenharmony_ci	u32 hfp;
498c2ecf20Sopenharmony_ci	u32 vfp;
508c2ecf20Sopenharmony_ci	/* 10 - Luma Filter */
518c2ecf20Sopenharmony_ci	u32 y_rsf;
528c2ecf20Sopenharmony_ci	u32 y_rzi;
538c2ecf20Sopenharmony_ci	u32 y_hfp;
548c2ecf20Sopenharmony_ci	u32 y_vfp;
558c2ecf20Sopenharmony_ci	/* 11 - Flicker */
568c2ecf20Sopenharmony_ci	u32 ff0;
578c2ecf20Sopenharmony_ci	u32 ff1;
588c2ecf20Sopenharmony_ci	u32 ff2;
598c2ecf20Sopenharmony_ci	u32 ff3;
608c2ecf20Sopenharmony_ci	/* 12 - Color Key */
618c2ecf20Sopenharmony_ci	u32 key1;
628c2ecf20Sopenharmony_ci	u32 key2;
638c2ecf20Sopenharmony_ci	/* 14 - Static Address & User */
648c2ecf20Sopenharmony_ci	u32 sar;
658c2ecf20Sopenharmony_ci	u32 usr;
668c2ecf20Sopenharmony_ci	/* 15 - Input Versatile Matrix */
678c2ecf20Sopenharmony_ci	u32 ivmx0;
688c2ecf20Sopenharmony_ci	u32 ivmx1;
698c2ecf20Sopenharmony_ci	u32 ivmx2;
708c2ecf20Sopenharmony_ci	u32 ivmx3;
718c2ecf20Sopenharmony_ci	/* 16 - Output Versatile Matrix */
728c2ecf20Sopenharmony_ci	u32 ovmx0;
738c2ecf20Sopenharmony_ci	u32 ovmx1;
748c2ecf20Sopenharmony_ci	u32 ovmx2;
758c2ecf20Sopenharmony_ci	u32 ovmx3;
768c2ecf20Sopenharmony_ci	/* 17 - Pace */
778c2ecf20Sopenharmony_ci	u32 pace;
788c2ecf20Sopenharmony_ci	/* 18 - VC1R & DEI */
798c2ecf20Sopenharmony_ci	u32 vc1r;
808c2ecf20Sopenharmony_ci	u32 dei;
818c2ecf20Sopenharmony_ci	/* 19 - Gradient Fill */
828c2ecf20Sopenharmony_ci	u32 hgf;
838c2ecf20Sopenharmony_ci	u32 vgf;
848c2ecf20Sopenharmony_ci};
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/* HW registers : static */
878c2ecf20Sopenharmony_ci#define BLT_CTL                 0x0A00
888c2ecf20Sopenharmony_ci#define BLT_ITS                 0x0A04
898c2ecf20Sopenharmony_ci#define BLT_STA1                0x0A08
908c2ecf20Sopenharmony_ci#define BLT_AQ1_CTL             0x0A60
918c2ecf20Sopenharmony_ci#define BLT_AQ1_IP              0x0A64
928c2ecf20Sopenharmony_ci#define BLT_AQ1_LNA             0x0A68
938c2ecf20Sopenharmony_ci#define BLT_AQ1_STA             0x0A6C
948c2ecf20Sopenharmony_ci#define BLT_ITM0                0x0AD0
958c2ecf20Sopenharmony_ci/* HW registers : plugs */
968c2ecf20Sopenharmony_ci#define BLT_PLUGS1_OP2          0x0B04
978c2ecf20Sopenharmony_ci#define BLT_PLUGS1_CHZ          0x0B08
988c2ecf20Sopenharmony_ci#define BLT_PLUGS1_MSZ          0x0B0C
998c2ecf20Sopenharmony_ci#define BLT_PLUGS1_PGZ          0x0B10
1008c2ecf20Sopenharmony_ci#define BLT_PLUGS2_OP2          0x0B24
1018c2ecf20Sopenharmony_ci#define BLT_PLUGS2_CHZ          0x0B28
1028c2ecf20Sopenharmony_ci#define BLT_PLUGS2_MSZ          0x0B2C
1038c2ecf20Sopenharmony_ci#define BLT_PLUGS2_PGZ          0x0B30
1048c2ecf20Sopenharmony_ci#define BLT_PLUGS3_OP2          0x0B44
1058c2ecf20Sopenharmony_ci#define BLT_PLUGS3_CHZ          0x0B48
1068c2ecf20Sopenharmony_ci#define BLT_PLUGS3_MSZ          0x0B4C
1078c2ecf20Sopenharmony_ci#define BLT_PLUGS3_PGZ          0x0B50
1088c2ecf20Sopenharmony_ci#define BLT_PLUGT_OP2           0x0B84
1098c2ecf20Sopenharmony_ci#define BLT_PLUGT_CHZ           0x0B88
1108c2ecf20Sopenharmony_ci#define BLT_PLUGT_MSZ           0x0B8C
1118c2ecf20Sopenharmony_ci#define BLT_PLUGT_PGZ           0x0B90
1128c2ecf20Sopenharmony_ci/* HW registers : node */
1138c2ecf20Sopenharmony_ci#define BLT_NIP                 0x0C00
1148c2ecf20Sopenharmony_ci#define BLT_CIC                 0x0C04
1158c2ecf20Sopenharmony_ci#define BLT_INS                 0x0C08
1168c2ecf20Sopenharmony_ci#define BLT_ACK                 0x0C0C
1178c2ecf20Sopenharmony_ci#define BLT_TBA                 0x0C10
1188c2ecf20Sopenharmony_ci#define BLT_TTY                 0x0C14
1198c2ecf20Sopenharmony_ci#define BLT_TXY                 0x0C18
1208c2ecf20Sopenharmony_ci#define BLT_TSZ                 0x0C1C
1218c2ecf20Sopenharmony_ci#define BLT_S1BA                0x0C28
1228c2ecf20Sopenharmony_ci#define BLT_S1TY                0x0C2C
1238c2ecf20Sopenharmony_ci#define BLT_S1XY                0x0C30
1248c2ecf20Sopenharmony_ci#define BLT_S2BA                0x0C38
1258c2ecf20Sopenharmony_ci#define BLT_S2TY                0x0C3C
1268c2ecf20Sopenharmony_ci#define BLT_S2XY                0x0C40
1278c2ecf20Sopenharmony_ci#define BLT_S2SZ                0x0C44
1288c2ecf20Sopenharmony_ci#define BLT_S3BA                0x0C48
1298c2ecf20Sopenharmony_ci#define BLT_S3TY                0x0C4C
1308c2ecf20Sopenharmony_ci#define BLT_S3XY                0x0C50
1318c2ecf20Sopenharmony_ci#define BLT_S3SZ                0x0C54
1328c2ecf20Sopenharmony_ci#define BLT_FCTL                0x0C68
1338c2ecf20Sopenharmony_ci#define BLT_RSF                 0x0C70
1348c2ecf20Sopenharmony_ci#define BLT_RZI                 0x0C74
1358c2ecf20Sopenharmony_ci#define BLT_HFP                 0x0C78
1368c2ecf20Sopenharmony_ci#define BLT_VFP                 0x0C7C
1378c2ecf20Sopenharmony_ci#define BLT_Y_RSF               0x0C80
1388c2ecf20Sopenharmony_ci#define BLT_Y_RZI               0x0C84
1398c2ecf20Sopenharmony_ci#define BLT_Y_HFP               0x0C88
1408c2ecf20Sopenharmony_ci#define BLT_Y_VFP               0x0C8C
1418c2ecf20Sopenharmony_ci#define BLT_IVMX0               0x0CC0
1428c2ecf20Sopenharmony_ci#define BLT_IVMX1               0x0CC4
1438c2ecf20Sopenharmony_ci#define BLT_IVMX2               0x0CC8
1448c2ecf20Sopenharmony_ci#define BLT_IVMX3               0x0CCC
1458c2ecf20Sopenharmony_ci#define BLT_OVMX0               0x0CD0
1468c2ecf20Sopenharmony_ci#define BLT_OVMX1               0x0CD4
1478c2ecf20Sopenharmony_ci#define BLT_OVMX2               0x0CD8
1488c2ecf20Sopenharmony_ci#define BLT_OVMX3               0x0CDC
1498c2ecf20Sopenharmony_ci#define BLT_DEI                 0x0CEC
1508c2ecf20Sopenharmony_ci/* HW registers : filters */
1518c2ecf20Sopenharmony_ci#define BLT_HFC_N               0x0D00
1528c2ecf20Sopenharmony_ci#define BLT_VFC_N               0x0D90
1538c2ecf20Sopenharmony_ci#define BLT_Y_HFC_N             0x0E00
1548c2ecf20Sopenharmony_ci#define BLT_Y_VFC_N             0x0E90
1558c2ecf20Sopenharmony_ci#define BLT_NB_H_COEF           16
1568c2ecf20Sopenharmony_ci#define BLT_NB_V_COEF           10
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci/* Registers values */
1598c2ecf20Sopenharmony_ci#define BLT_CTL_RESET           BIT(31)         /* Global soft reset */
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci#define BLT_ITS_AQ1_LNA         BIT(12)         /* AQ1 LNA reached */
1628c2ecf20Sopenharmony_ci
1638c2ecf20Sopenharmony_ci#define BLT_STA1_IDLE           BIT(0)          /* BDISP idle */
1648c2ecf20Sopenharmony_ci
1658c2ecf20Sopenharmony_ci#define BLT_AQ1_CTL_CFG         0x80400003      /* Enable, P3, LNA reached */
1668c2ecf20Sopenharmony_ci
1678c2ecf20Sopenharmony_ci#define BLT_INS_S1_MASK         (BIT(0) | BIT(1) | BIT(2))
1688c2ecf20Sopenharmony_ci#define BLT_INS_S1_OFF          0x00000000      /* src1 disabled */
1698c2ecf20Sopenharmony_ci#define BLT_INS_S1_MEM          0x00000001      /* src1 fetched from memory */
1708c2ecf20Sopenharmony_ci#define BLT_INS_S1_CF           0x00000003      /* src1 color fill */
1718c2ecf20Sopenharmony_ci#define BLT_INS_S1_COPY         0x00000004      /* src1 direct copy */
1728c2ecf20Sopenharmony_ci#define BLT_INS_S1_FILL         0x00000007      /* src1 firect fill */
1738c2ecf20Sopenharmony_ci#define BLT_INS_S2_MASK         (BIT(3) | BIT(4))
1748c2ecf20Sopenharmony_ci#define BLT_INS_S2_OFF          0x00000000      /* src2 disabled */
1758c2ecf20Sopenharmony_ci#define BLT_INS_S2_MEM          0x00000008      /* src2 fetched from memory */
1768c2ecf20Sopenharmony_ci#define BLT_INS_S2_CF           0x00000018      /* src2 color fill */
1778c2ecf20Sopenharmony_ci#define BLT_INS_S3_MASK         BIT(5)
1788c2ecf20Sopenharmony_ci#define BLT_INS_S3_OFF          0x00000000      /* src3 disabled */
1798c2ecf20Sopenharmony_ci#define BLT_INS_S3_MEM          0x00000020      /* src3 fetched from memory */
1808c2ecf20Sopenharmony_ci#define BLT_INS_IVMX            BIT(6)          /* Input versatile matrix */
1818c2ecf20Sopenharmony_ci#define BLT_INS_CLUT            BIT(7)          /* Color Look Up Table */
1828c2ecf20Sopenharmony_ci#define BLT_INS_SCALE           BIT(8)          /* Scaling */
1838c2ecf20Sopenharmony_ci#define BLT_INS_FLICK           BIT(9)          /* Flicker filter */
1848c2ecf20Sopenharmony_ci#define BLT_INS_CLIP            BIT(10)         /* Clipping */
1858c2ecf20Sopenharmony_ci#define BLT_INS_CKEY            BIT(11)         /* Color key */
1868c2ecf20Sopenharmony_ci#define BLT_INS_OVMX            BIT(12)         /* Output versatile matrix */
1878c2ecf20Sopenharmony_ci#define BLT_INS_DEI             BIT(13)         /* Deinterlace */
1888c2ecf20Sopenharmony_ci#define BLT_INS_PMASK           BIT(14)         /* Plane mask */
1898c2ecf20Sopenharmony_ci#define BLT_INS_VC1R            BIT(17)         /* VC1 Range mapping */
1908c2ecf20Sopenharmony_ci#define BLT_INS_ROTATE          BIT(18)         /* Rotation */
1918c2ecf20Sopenharmony_ci#define BLT_INS_GRAD            BIT(19)         /* Gradient fill */
1928c2ecf20Sopenharmony_ci#define BLT_INS_AQLOCK          BIT(29)         /* AQ lock */
1938c2ecf20Sopenharmony_ci#define BLT_INS_PACE            BIT(30)         /* Pace down */
1948c2ecf20Sopenharmony_ci#define BLT_INS_IRQ             BIT(31)         /* Raise IRQ when node done */
1958c2ecf20Sopenharmony_ci#define BLT_CIC_ALL_GRP         0x000FDFFC      /* all valid groups present */
1968c2ecf20Sopenharmony_ci#define BLT_ACK_BYPASS_S2S3     0x00000007      /* Bypass src2 and src3 */
1978c2ecf20Sopenharmony_ci
1988c2ecf20Sopenharmony_ci#define BLT_TTY_COL_SHIFT       16              /* Color format */
1998c2ecf20Sopenharmony_ci#define BLT_TTY_COL_MASK        0x001F0000      /* Color format mask */
2008c2ecf20Sopenharmony_ci#define BLT_TTY_ALPHA_R         BIT(21)         /* Alpha range */
2018c2ecf20Sopenharmony_ci#define BLT_TTY_CR_NOT_CB       BIT(22)         /* CR not Cb */
2028c2ecf20Sopenharmony_ci#define BLT_TTY_MB              BIT(23)         /* MB frame / field*/
2038c2ecf20Sopenharmony_ci#define BLT_TTY_HSO             BIT(24)         /* H scan order */
2048c2ecf20Sopenharmony_ci#define BLT_TTY_VSO             BIT(25)         /* V scan order */
2058c2ecf20Sopenharmony_ci#define BLT_TTY_DITHER          BIT(26)         /* Dithering */
2068c2ecf20Sopenharmony_ci#define BLT_TTY_CHROMA          BIT(27)         /* Write chroma / luma */
2078c2ecf20Sopenharmony_ci#define BLT_TTY_BIG_END         BIT(30)         /* Big endianness */
2088c2ecf20Sopenharmony_ci
2098c2ecf20Sopenharmony_ci#define BLT_S1TY_A1_SUBSET      BIT(22)         /* A1 subset */
2108c2ecf20Sopenharmony_ci#define BLT_S1TY_CHROMA_EXT     BIT(26)         /* Chroma Extended */
2118c2ecf20Sopenharmony_ci#define BTL_S1TY_SUBBYTE        BIT(28)         /* Sub-byte fmt, pixel order */
2128c2ecf20Sopenharmony_ci#define BLT_S1TY_RGB_EXP        BIT(29)         /* RGB expansion mode */
2138c2ecf20Sopenharmony_ci
2148c2ecf20Sopenharmony_ci#define BLT_S2TY_A1_SUBSET      BIT(22)         /* A1 subset */
2158c2ecf20Sopenharmony_ci#define BLT_S2TY_CHROMA_EXT     BIT(26)         /* Chroma Extended */
2168c2ecf20Sopenharmony_ci#define BTL_S2TY_SUBBYTE        BIT(28)         /* Sub-byte fmt, pixel order */
2178c2ecf20Sopenharmony_ci#define BLT_S2TY_RGB_EXP        BIT(29)         /* RGB expansion mode */
2188c2ecf20Sopenharmony_ci
2198c2ecf20Sopenharmony_ci#define BLT_S3TY_BLANK_ACC      BIT(26)         /* Blank access */
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci#define BLT_FCTL_HV_SCALE       0x00000055      /* H/V resize + color filter */
2228c2ecf20Sopenharmony_ci#define BLT_FCTL_Y_HV_SCALE     0x33000000      /* Luma version */
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci#define BLT_FCTL_HV_SAMPLE      0x00000044      /* H/V resize */
2258c2ecf20Sopenharmony_ci#define BLT_FCTL_Y_HV_SAMPLE    0x22000000      /* Luma version */
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci#define BLT_RZI_DEFAULT         0x20003000      /* H/VNB_repeat = 3/2 */
2288c2ecf20Sopenharmony_ci
2298c2ecf20Sopenharmony_ci/* Color format */
2308c2ecf20Sopenharmony_ci#define BDISP_RGB565            0x00            /* RGB565 */
2318c2ecf20Sopenharmony_ci#define BDISP_RGB888            0x01            /* RGB888 */
2328c2ecf20Sopenharmony_ci#define BDISP_XRGB8888          0x02            /* RGB888_32 */
2338c2ecf20Sopenharmony_ci#define BDISP_ARGB8888          0x05            /* ARGB888 */
2348c2ecf20Sopenharmony_ci#define BDISP_NV12              0x16            /* YCbCr42x R2B */
2358c2ecf20Sopenharmony_ci#define BDISP_YUV_3B            0x1E            /* YUV (3 buffer) */
236