162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci *  Copyright © 2014-2015 Broadcom
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci
662306a36Sopenharmony_ci#ifndef VC4_REGS_H
762306a36Sopenharmony_ci#define VC4_REGS_H
862306a36Sopenharmony_ci
962306a36Sopenharmony_ci#include <linux/bitfield.h>
1062306a36Sopenharmony_ci#include <linux/bitops.h>
1162306a36Sopenharmony_ci
1262306a36Sopenharmony_ci#define VC4_MASK(high, low) ((u32)GENMASK(high, low))
1362306a36Sopenharmony_ci/* Using the GNU statement expression extension */
1462306a36Sopenharmony_ci#define VC4_SET_FIELD(value, field)					\
1562306a36Sopenharmony_ci	({								\
1662306a36Sopenharmony_ci		WARN_ON(!FIELD_FIT(field##_MASK, value));		\
1762306a36Sopenharmony_ci		FIELD_PREP(field##_MASK, value);			\
1862306a36Sopenharmony_ci	 })
1962306a36Sopenharmony_ci
2062306a36Sopenharmony_ci#define VC4_GET_FIELD(word, field) FIELD_GET(field##_MASK, word)
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ci#define V3D_IDENT0   0x00000
2362306a36Sopenharmony_ci# define V3D_EXPECTED_IDENT0 \
2462306a36Sopenharmony_ci	((2 << 24) | \
2562306a36Sopenharmony_ci	('V' << 0) | \
2662306a36Sopenharmony_ci	('3' << 8) | \
2762306a36Sopenharmony_ci	 ('D' << 16))
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ci#define V3D_IDENT1   0x00004
3062306a36Sopenharmony_ci/* Multiples of 1kb */
3162306a36Sopenharmony_ci# define V3D_IDENT1_VPM_SIZE_MASK                      VC4_MASK(31, 28)
3262306a36Sopenharmony_ci# define V3D_IDENT1_VPM_SIZE_SHIFT                     28
3362306a36Sopenharmony_ci# define V3D_IDENT1_NSEM_MASK                          VC4_MASK(23, 16)
3462306a36Sopenharmony_ci# define V3D_IDENT1_NSEM_SHIFT                         16
3562306a36Sopenharmony_ci# define V3D_IDENT1_TUPS_MASK                          VC4_MASK(15, 12)
3662306a36Sopenharmony_ci# define V3D_IDENT1_TUPS_SHIFT                         12
3762306a36Sopenharmony_ci# define V3D_IDENT1_QUPS_MASK                          VC4_MASK(11, 8)
3862306a36Sopenharmony_ci# define V3D_IDENT1_QUPS_SHIFT                         8
3962306a36Sopenharmony_ci# define V3D_IDENT1_NSLC_MASK                          VC4_MASK(7, 4)
4062306a36Sopenharmony_ci# define V3D_IDENT1_NSLC_SHIFT                         4
4162306a36Sopenharmony_ci# define V3D_IDENT1_REV_MASK                           VC4_MASK(3, 0)
4262306a36Sopenharmony_ci# define V3D_IDENT1_REV_SHIFT                          0
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ci#define V3D_IDENT2   0x00008
4562306a36Sopenharmony_ci#define V3D_SCRATCH  0x00010
4662306a36Sopenharmony_ci#define V3D_L2CACTL  0x00020
4762306a36Sopenharmony_ci# define V3D_L2CACTL_L2CCLR                            BIT(2)
4862306a36Sopenharmony_ci# define V3D_L2CACTL_L2CDIS                            BIT(1)
4962306a36Sopenharmony_ci# define V3D_L2CACTL_L2CENA                            BIT(0)
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ci#define V3D_SLCACTL  0x00024
5262306a36Sopenharmony_ci# define V3D_SLCACTL_T1CC_MASK                         VC4_MASK(27, 24)
5362306a36Sopenharmony_ci# define V3D_SLCACTL_T1CC_SHIFT                        24
5462306a36Sopenharmony_ci# define V3D_SLCACTL_T0CC_MASK                         VC4_MASK(19, 16)
5562306a36Sopenharmony_ci# define V3D_SLCACTL_T0CC_SHIFT                        16
5662306a36Sopenharmony_ci# define V3D_SLCACTL_UCC_MASK                          VC4_MASK(11, 8)
5762306a36Sopenharmony_ci# define V3D_SLCACTL_UCC_SHIFT                         8
5862306a36Sopenharmony_ci# define V3D_SLCACTL_ICC_MASK                          VC4_MASK(3, 0)
5962306a36Sopenharmony_ci# define V3D_SLCACTL_ICC_SHIFT                         0
6062306a36Sopenharmony_ci
6162306a36Sopenharmony_ci#define V3D_INTCTL   0x00030
6262306a36Sopenharmony_ci#define V3D_INTENA   0x00034
6362306a36Sopenharmony_ci#define V3D_INTDIS   0x00038
6462306a36Sopenharmony_ci# define V3D_INT_SPILLUSE                              BIT(3)
6562306a36Sopenharmony_ci# define V3D_INT_OUTOMEM                               BIT(2)
6662306a36Sopenharmony_ci# define V3D_INT_FLDONE                                BIT(1)
6762306a36Sopenharmony_ci# define V3D_INT_FRDONE                                BIT(0)
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci#define V3D_CT0CS    0x00100
7062306a36Sopenharmony_ci#define V3D_CT1CS    0x00104
7162306a36Sopenharmony_ci#define V3D_CTNCS(n) (V3D_CT0CS + 4 * n)
7262306a36Sopenharmony_ci# define V3D_CTRSTA      BIT(15)
7362306a36Sopenharmony_ci# define V3D_CTSEMA      BIT(12)
7462306a36Sopenharmony_ci# define V3D_CTRTSD      BIT(8)
7562306a36Sopenharmony_ci# define V3D_CTRUN       BIT(5)
7662306a36Sopenharmony_ci# define V3D_CTSUBS      BIT(4)
7762306a36Sopenharmony_ci# define V3D_CTERR       BIT(3)
7862306a36Sopenharmony_ci# define V3D_CTMODE      BIT(0)
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ci#define V3D_CT0EA    0x00108
8162306a36Sopenharmony_ci#define V3D_CT1EA    0x0010c
8262306a36Sopenharmony_ci#define V3D_CTNEA(n) (V3D_CT0EA + 4 * (n))
8362306a36Sopenharmony_ci#define V3D_CT0CA    0x00110
8462306a36Sopenharmony_ci#define V3D_CT1CA    0x00114
8562306a36Sopenharmony_ci#define V3D_CTNCA(n) (V3D_CT0CA + 4 * (n))
8662306a36Sopenharmony_ci#define V3D_CT00RA0  0x00118
8762306a36Sopenharmony_ci#define V3D_CT01RA0  0x0011c
8862306a36Sopenharmony_ci#define V3D_CTNRA0(n) (V3D_CT00RA0 + 4 * (n))
8962306a36Sopenharmony_ci#define V3D_CT0LC    0x00120
9062306a36Sopenharmony_ci#define V3D_CT1LC    0x00124
9162306a36Sopenharmony_ci#define V3D_CTNLC(n) (V3D_CT0LC + 4 * (n))
9262306a36Sopenharmony_ci#define V3D_CT0PC    0x00128
9362306a36Sopenharmony_ci#define V3D_CT1PC    0x0012c
9462306a36Sopenharmony_ci#define V3D_CTNPC(n) (V3D_CT0PC + 4 * (n))
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci#define V3D_PCS      0x00130
9762306a36Sopenharmony_ci# define V3D_BMOOM       BIT(8)
9862306a36Sopenharmony_ci# define V3D_RMBUSY      BIT(3)
9962306a36Sopenharmony_ci# define V3D_RMACTIVE    BIT(2)
10062306a36Sopenharmony_ci# define V3D_BMBUSY      BIT(1)
10162306a36Sopenharmony_ci# define V3D_BMACTIVE    BIT(0)
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ci#define V3D_BFC      0x00134
10462306a36Sopenharmony_ci#define V3D_RFC      0x00138
10562306a36Sopenharmony_ci#define V3D_BPCA     0x00300
10662306a36Sopenharmony_ci#define V3D_BPCS     0x00304
10762306a36Sopenharmony_ci#define V3D_BPOA     0x00308
10862306a36Sopenharmony_ci#define V3D_BPOS     0x0030c
10962306a36Sopenharmony_ci#define V3D_BXCF     0x00310
11062306a36Sopenharmony_ci#define V3D_SQRSV0   0x00410
11162306a36Sopenharmony_ci#define V3D_SQRSV1   0x00414
11262306a36Sopenharmony_ci#define V3D_SQCNTL   0x00418
11362306a36Sopenharmony_ci#define V3D_SRQPC    0x00430
11462306a36Sopenharmony_ci#define V3D_SRQUA    0x00434
11562306a36Sopenharmony_ci#define V3D_SRQUL    0x00438
11662306a36Sopenharmony_ci#define V3D_SRQCS    0x0043c
11762306a36Sopenharmony_ci#define V3D_VPACNTL  0x00500
11862306a36Sopenharmony_ci#define V3D_VPMBASE  0x00504
11962306a36Sopenharmony_ci#define V3D_PCTRC    0x00670
12062306a36Sopenharmony_ci#define V3D_PCTRE    0x00674
12162306a36Sopenharmony_ci# define V3D_PCTRE_EN	BIT(31)
12262306a36Sopenharmony_ci#define V3D_PCTR(x)  (0x00680 + ((x) * 8))
12362306a36Sopenharmony_ci#define V3D_PCTRS(x) (0x00684 + ((x) * 8))
12462306a36Sopenharmony_ci#define V3D_DBGE     0x00f00
12562306a36Sopenharmony_ci#define V3D_FDBGO    0x00f04
12662306a36Sopenharmony_ci#define V3D_FDBGB    0x00f08
12762306a36Sopenharmony_ci#define V3D_FDBGR    0x00f0c
12862306a36Sopenharmony_ci#define V3D_FDBGS    0x00f10
12962306a36Sopenharmony_ci#define V3D_ERRSTAT  0x00f20
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ci#define PV_CONTROL				0x00
13262306a36Sopenharmony_ci# define PV5_CONTROL_FIFO_LEVEL_HIGH_MASK	VC4_MASK(26, 25)
13362306a36Sopenharmony_ci# define PV5_CONTROL_FIFO_LEVEL_HIGH_SHIFT	25
13462306a36Sopenharmony_ci# define PV_CONTROL_FORMAT_MASK			VC4_MASK(23, 21)
13562306a36Sopenharmony_ci# define PV_CONTROL_FORMAT_SHIFT		21
13662306a36Sopenharmony_ci# define PV_CONTROL_FORMAT_24			0
13762306a36Sopenharmony_ci# define PV_CONTROL_FORMAT_DSIV_16		1
13862306a36Sopenharmony_ci# define PV_CONTROL_FORMAT_DSIC_16		2
13962306a36Sopenharmony_ci# define PV_CONTROL_FORMAT_DSIV_18		3
14062306a36Sopenharmony_ci# define PV_CONTROL_FORMAT_DSIV_24		4
14162306a36Sopenharmony_ci
14262306a36Sopenharmony_ci# define PV_CONTROL_FIFO_LEVEL_MASK		VC4_MASK(20, 15)
14362306a36Sopenharmony_ci# define PV_CONTROL_FIFO_LEVEL_SHIFT		15
14462306a36Sopenharmony_ci# define PV_CONTROL_CLR_AT_START		BIT(14)
14562306a36Sopenharmony_ci# define PV_CONTROL_TRIGGER_UNDERFLOW		BIT(13)
14662306a36Sopenharmony_ci# define PV_CONTROL_WAIT_HSTART			BIT(12)
14762306a36Sopenharmony_ci# define PV_CONTROL_PIXEL_REP_MASK		VC4_MASK(5, 4)
14862306a36Sopenharmony_ci# define PV_CONTROL_PIXEL_REP_SHIFT		4
14962306a36Sopenharmony_ci# define PV_CONTROL_CLK_SELECT_DSI		0
15062306a36Sopenharmony_ci# define PV_CONTROL_CLK_SELECT_DPI_SMI_HDMI	1
15162306a36Sopenharmony_ci# define PV_CONTROL_CLK_SELECT_VEC		2
15262306a36Sopenharmony_ci# define PV_CONTROL_CLK_SELECT_MASK		VC4_MASK(3, 2)
15362306a36Sopenharmony_ci# define PV_CONTROL_CLK_SELECT_SHIFT		2
15462306a36Sopenharmony_ci# define PV_CONTROL_FIFO_CLR			BIT(1)
15562306a36Sopenharmony_ci# define PV_CONTROL_EN				BIT(0)
15662306a36Sopenharmony_ci
15762306a36Sopenharmony_ci#define PV_V_CONTROL				0x04
15862306a36Sopenharmony_ci# define PV_VCONTROL_ODD_DELAY_MASK		VC4_MASK(22, 6)
15962306a36Sopenharmony_ci# define PV_VCONTROL_ODD_DELAY_SHIFT		6
16062306a36Sopenharmony_ci# define PV_VCONTROL_ODD_FIRST			BIT(5)
16162306a36Sopenharmony_ci# define PV_VCONTROL_INTERLACE			BIT(4)
16262306a36Sopenharmony_ci# define PV_VCONTROL_DSI			BIT(3)
16362306a36Sopenharmony_ci# define PV_VCONTROL_COMMAND			BIT(2)
16462306a36Sopenharmony_ci# define PV_VCONTROL_CONTINUOUS			BIT(1)
16562306a36Sopenharmony_ci# define PV_VCONTROL_VIDEN			BIT(0)
16662306a36Sopenharmony_ci
16762306a36Sopenharmony_ci#define PV_VSYNCD_EVEN				0x08
16862306a36Sopenharmony_ci
16962306a36Sopenharmony_ci#define PV_HORZA				0x0c
17062306a36Sopenharmony_ci# define PV_HORZA_HBP_MASK			VC4_MASK(31, 16)
17162306a36Sopenharmony_ci# define PV_HORZA_HBP_SHIFT			16
17262306a36Sopenharmony_ci# define PV_HORZA_HSYNC_MASK			VC4_MASK(15, 0)
17362306a36Sopenharmony_ci# define PV_HORZA_HSYNC_SHIFT			0
17462306a36Sopenharmony_ci
17562306a36Sopenharmony_ci#define PV_HORZB				0x10
17662306a36Sopenharmony_ci# define PV_HORZB_HFP_MASK			VC4_MASK(31, 16)
17762306a36Sopenharmony_ci# define PV_HORZB_HFP_SHIFT			16
17862306a36Sopenharmony_ci# define PV_HORZB_HACTIVE_MASK			VC4_MASK(15, 0)
17962306a36Sopenharmony_ci# define PV_HORZB_HACTIVE_SHIFT			0
18062306a36Sopenharmony_ci
18162306a36Sopenharmony_ci#define PV_VERTA				0x14
18262306a36Sopenharmony_ci# define PV_VERTA_VBP_MASK			VC4_MASK(31, 16)
18362306a36Sopenharmony_ci# define PV_VERTA_VBP_SHIFT			16
18462306a36Sopenharmony_ci# define PV_VERTA_VSYNC_MASK			VC4_MASK(15, 0)
18562306a36Sopenharmony_ci# define PV_VERTA_VSYNC_SHIFT			0
18662306a36Sopenharmony_ci
18762306a36Sopenharmony_ci#define PV_VERTB				0x18
18862306a36Sopenharmony_ci# define PV_VERTB_VFP_MASK			VC4_MASK(31, 16)
18962306a36Sopenharmony_ci# define PV_VERTB_VFP_SHIFT			16
19062306a36Sopenharmony_ci# define PV_VERTB_VACTIVE_MASK			VC4_MASK(15, 0)
19162306a36Sopenharmony_ci# define PV_VERTB_VACTIVE_SHIFT			0
19262306a36Sopenharmony_ci
19362306a36Sopenharmony_ci#define PV_VERTA_EVEN				0x1c
19462306a36Sopenharmony_ci#define PV_VERTB_EVEN				0x20
19562306a36Sopenharmony_ci
19662306a36Sopenharmony_ci#define PV_INTEN				0x24
19762306a36Sopenharmony_ci#define PV_INTSTAT				0x28
19862306a36Sopenharmony_ci# define PV_INT_VID_IDLE			BIT(9)
19962306a36Sopenharmony_ci# define PV_INT_VFP_END				BIT(8)
20062306a36Sopenharmony_ci# define PV_INT_VFP_START			BIT(7)
20162306a36Sopenharmony_ci# define PV_INT_VACT_START			BIT(6)
20262306a36Sopenharmony_ci# define PV_INT_VBP_START			BIT(5)
20362306a36Sopenharmony_ci# define PV_INT_VSYNC_START			BIT(4)
20462306a36Sopenharmony_ci# define PV_INT_HFP_START			BIT(3)
20562306a36Sopenharmony_ci# define PV_INT_HACT_START			BIT(2)
20662306a36Sopenharmony_ci# define PV_INT_HBP_START			BIT(1)
20762306a36Sopenharmony_ci# define PV_INT_HSYNC_START			BIT(0)
20862306a36Sopenharmony_ci
20962306a36Sopenharmony_ci#define PV_STAT					0x2c
21062306a36Sopenharmony_ci
21162306a36Sopenharmony_ci#define PV_HACT_ACT				0x30
21262306a36Sopenharmony_ci
21362306a36Sopenharmony_ci#define PV_MUX_CFG				0x34
21462306a36Sopenharmony_ci# define PV_MUX_CFG_RGB_PIXEL_MUX_MODE_MASK	VC4_MASK(5, 2)
21562306a36Sopenharmony_ci# define PV_MUX_CFG_RGB_PIXEL_MUX_MODE_SHIFT	2
21662306a36Sopenharmony_ci# define PV_MUX_CFG_RGB_PIXEL_MUX_MODE_NO_SWAP	8
21762306a36Sopenharmony_ci
21862306a36Sopenharmony_ci#define SCALER_CHANNELS_COUNT			3
21962306a36Sopenharmony_ci
22062306a36Sopenharmony_ci#define SCALER_DISPCTRL                         0x00000000
22162306a36Sopenharmony_ci/* Global register for clock gating the HVS */
22262306a36Sopenharmony_ci# define SCALER_DISPCTRL_ENABLE			BIT(31)
22362306a36Sopenharmony_ci# define SCALER_DISPCTRL_PANIC0_MASK		VC4_MASK(25, 24)
22462306a36Sopenharmony_ci# define SCALER_DISPCTRL_PANIC0_SHIFT		24
22562306a36Sopenharmony_ci# define SCALER_DISPCTRL_PANIC1_MASK		VC4_MASK(27, 26)
22662306a36Sopenharmony_ci# define SCALER_DISPCTRL_PANIC1_SHIFT		26
22762306a36Sopenharmony_ci# define SCALER_DISPCTRL_PANIC2_MASK		VC4_MASK(29, 28)
22862306a36Sopenharmony_ci# define SCALER_DISPCTRL_PANIC2_SHIFT		28
22962306a36Sopenharmony_ci# define SCALER_DISPCTRL_DSP3_MUX_MASK		VC4_MASK(19, 18)
23062306a36Sopenharmony_ci# define SCALER_DISPCTRL_DSP3_MUX_SHIFT		18
23162306a36Sopenharmony_ci
23262306a36Sopenharmony_ci/* Enables Display 0 short line and underrun contribution to
23362306a36Sopenharmony_ci * SCALER_DISPSTAT_IRQDISP0.  Note that short frame contributions are
23462306a36Sopenharmony_ci * always enabled.
23562306a36Sopenharmony_ci */
23662306a36Sopenharmony_ci# define SCALER_DISPCTRL_DSPEISLUR(x)		BIT(13 + (x))
23762306a36Sopenharmony_ci# define SCALER5_DISPCTRL_DSPEISLUR(x)		BIT(9 + ((x) * 4))
23862306a36Sopenharmony_ci/* Enables Display 0 end-of-line-N contribution to
23962306a36Sopenharmony_ci * SCALER_DISPSTAT_IRQDISP0
24062306a36Sopenharmony_ci */
24162306a36Sopenharmony_ci# define SCALER_DISPCTRL_DSPEIEOLN(x)		BIT(8 + ((x) * 2))
24262306a36Sopenharmony_ci# define SCALER5_DISPCTRL_DSPEIEOLN(x)		BIT(8 + ((x) * 4))
24362306a36Sopenharmony_ci/* Enables Display 0 EOF contribution to SCALER_DISPSTAT_IRQDISP0 */
24462306a36Sopenharmony_ci# define SCALER_DISPCTRL_DSPEIEOF(x)		BIT(7 + ((x) * 2))
24562306a36Sopenharmony_ci# define SCALER5_DISPCTRL_DSPEIEOF(x)		BIT(7 + ((x) * 4))
24662306a36Sopenharmony_ci
24762306a36Sopenharmony_ci# define SCALER5_DISPCTRL_DSPEIVST(x)		BIT(6 + ((x) * 4))
24862306a36Sopenharmony_ci
24962306a36Sopenharmony_ci# define SCALER_DISPCTRL_SLVRDEIRQ		BIT(6)	/* HVS4 only */
25062306a36Sopenharmony_ci# define SCALER_DISPCTRL_SLVWREIRQ		BIT(5)	/* HVS4 only */
25162306a36Sopenharmony_ci# define SCALER5_DISPCTRL_SLVEIRQ		BIT(5)
25262306a36Sopenharmony_ci# define SCALER_DISPCTRL_DMAEIRQ		BIT(4)
25362306a36Sopenharmony_ci/* Enables interrupt generation on the enabled EOF/EOLN/EISLUR
25462306a36Sopenharmony_ci * bits and short frames..
25562306a36Sopenharmony_ci */
25662306a36Sopenharmony_ci# define SCALER_DISPCTRL_DISPEIRQ(x)		BIT(1 + (x))
25762306a36Sopenharmony_ci/* Enables interrupt generation on scaler profiler interrupt. */
25862306a36Sopenharmony_ci# define SCALER_DISPCTRL_SCLEIRQ		BIT(0)
25962306a36Sopenharmony_ci
26062306a36Sopenharmony_ci#define SCALER_DISPSTAT                         0x00000004
26162306a36Sopenharmony_ci# define SCALER_DISPSTAT_RESP_MASK		VC4_MASK(15, 14)
26262306a36Sopenharmony_ci# define SCALER_DISPSTAT_RESP_SHIFT		14
26362306a36Sopenharmony_ci# define SCALER_DISPSTAT_RESP_OKAY		0
26462306a36Sopenharmony_ci# define SCALER_DISPSTAT_RESP_EXOKAY		1
26562306a36Sopenharmony_ci# define SCALER_DISPSTAT_RESP_SLVERR		2
26662306a36Sopenharmony_ci# define SCALER_DISPSTAT_RESP_DECERR		3
26762306a36Sopenharmony_ci
26862306a36Sopenharmony_ci# define SCALER_DISPSTAT_COBLOW(x)		BIT(13 + ((x) * 8))
26962306a36Sopenharmony_ci/* Set when the DISPEOLN line is done compositing. */
27062306a36Sopenharmony_ci# define SCALER_DISPSTAT_EOLN(x)		BIT(12 + ((x) * 8))
27162306a36Sopenharmony_ci/* Set when VSTART is seen but there are still pixels in the current
27262306a36Sopenharmony_ci * output line.
27362306a36Sopenharmony_ci */
27462306a36Sopenharmony_ci# define SCALER_DISPSTAT_ESFRAME(x)		BIT(11 + ((x) * 8))
27562306a36Sopenharmony_ci/* Set when HSTART is seen but there are still pixels in the current
27662306a36Sopenharmony_ci * output line.
27762306a36Sopenharmony_ci */
27862306a36Sopenharmony_ci# define SCALER_DISPSTAT_ESLINE(x)		BIT(10 + ((x) * 8))
27962306a36Sopenharmony_ci/* Set when the downstream tries to read from the display FIFO
28062306a36Sopenharmony_ci * while it's empty.
28162306a36Sopenharmony_ci */
28262306a36Sopenharmony_ci# define SCALER_DISPSTAT_EUFLOW(x)		BIT(9 + ((x) * 8))
28362306a36Sopenharmony_ci/* Set when the display mode changes from RUN to EOF */
28462306a36Sopenharmony_ci# define SCALER_DISPSTAT_EOF(x)			BIT(8 + ((x) * 8))
28562306a36Sopenharmony_ci
28662306a36Sopenharmony_ci# define SCALER_DISPSTAT_IRQMASK(x)		VC4_MASK(13 + ((x) * 8), \
28762306a36Sopenharmony_ci							 8 + ((x) * 8))
28862306a36Sopenharmony_ci
28962306a36Sopenharmony_ci/* Set on AXI invalid DMA ID error. */
29062306a36Sopenharmony_ci# define SCALER_DISPSTAT_DMA_ERROR		BIT(7)
29162306a36Sopenharmony_ci/* Set on AXI slave read decode error */
29262306a36Sopenharmony_ci# define SCALER_DISPSTAT_IRQSLVRD		BIT(6)
29362306a36Sopenharmony_ci/* Set on AXI slave write decode error */
29462306a36Sopenharmony_ci# define SCALER_DISPSTAT_IRQSLVWR		BIT(5)
29562306a36Sopenharmony_ci/* Set when SCALER_DISPSTAT_DMA_ERROR is set, or
29662306a36Sopenharmony_ci * SCALER_DISPSTAT_RESP_ERROR is not SCALER_DISPSTAT_RESP_OKAY.
29762306a36Sopenharmony_ci */
29862306a36Sopenharmony_ci# define SCALER_DISPSTAT_IRQDMA			BIT(4)
29962306a36Sopenharmony_ci/* Set when any of the EOF/EOLN/ESFRAME/ESLINE bits are set and their
30062306a36Sopenharmony_ci * corresponding interrupt bit is enabled in DISPCTRL.
30162306a36Sopenharmony_ci */
30262306a36Sopenharmony_ci# define SCALER_DISPSTAT_IRQDISP(x)		BIT(1 + (x))
30362306a36Sopenharmony_ci/* On read, the profiler interrupt.  On write, clear *all* interrupt bits. */
30462306a36Sopenharmony_ci# define SCALER_DISPSTAT_IRQSCL			BIT(0)
30562306a36Sopenharmony_ci
30662306a36Sopenharmony_ci#define SCALER_DISPID                           0x00000008
30762306a36Sopenharmony_ci#define SCALER_DISPECTRL                        0x0000000c
30862306a36Sopenharmony_ci# define SCALER_DISPECTRL_DSP2_MUX_SHIFT	31
30962306a36Sopenharmony_ci# define SCALER_DISPECTRL_DSP2_MUX_MASK		VC4_MASK(31, 31)
31062306a36Sopenharmony_ci
31162306a36Sopenharmony_ci#define SCALER_DISPPROF                         0x00000010
31262306a36Sopenharmony_ci
31362306a36Sopenharmony_ci#define SCALER_DISPDITHER                       0x00000014
31462306a36Sopenharmony_ci# define SCALER_DISPDITHER_DSP5_MUX_SHIFT	30
31562306a36Sopenharmony_ci# define SCALER_DISPDITHER_DSP5_MUX_MASK	VC4_MASK(31, 30)
31662306a36Sopenharmony_ci
31762306a36Sopenharmony_ci#define SCALER_DISPEOLN                         0x00000018
31862306a36Sopenharmony_ci# define SCALER_DISPEOLN_DSP4_MUX_SHIFT		30
31962306a36Sopenharmony_ci# define SCALER_DISPEOLN_DSP4_MUX_MASK		VC4_MASK(31, 30)
32062306a36Sopenharmony_ci
32162306a36Sopenharmony_ci#define SCALER_DISPLIST0                        0x00000020
32262306a36Sopenharmony_ci#define SCALER_DISPLIST1                        0x00000024
32362306a36Sopenharmony_ci#define SCALER_DISPLIST2                        0x00000028
32462306a36Sopenharmony_ci#define SCALER_DISPLSTAT                        0x0000002c
32562306a36Sopenharmony_ci#define SCALER_DISPLISTX(x)			(SCALER_DISPLIST0 +	\
32662306a36Sopenharmony_ci						 (x) * (SCALER_DISPLIST1 - \
32762306a36Sopenharmony_ci							SCALER_DISPLIST0))
32862306a36Sopenharmony_ci
32962306a36Sopenharmony_ci#define SCALER_DISPLACT0                        0x00000030
33062306a36Sopenharmony_ci#define SCALER_DISPLACT1                        0x00000034
33162306a36Sopenharmony_ci#define SCALER_DISPLACT2                        0x00000038
33262306a36Sopenharmony_ci#define SCALER_DISPLACTX(x)			(SCALER_DISPLACT0 +	\
33362306a36Sopenharmony_ci						 (x) * (SCALER_DISPLACT1 - \
33462306a36Sopenharmony_ci							SCALER_DISPLACT0))
33562306a36Sopenharmony_ci
33662306a36Sopenharmony_ci#define SCALER_DISPCTRL0                        0x00000040
33762306a36Sopenharmony_ci# define SCALER_DISPCTRLX_ENABLE		BIT(31)
33862306a36Sopenharmony_ci# define SCALER_DISPCTRLX_RESET			BIT(30)
33962306a36Sopenharmony_ci/* Generates a single frame when VSTART is seen and stops at the last
34062306a36Sopenharmony_ci * pixel read from the FIFO.
34162306a36Sopenharmony_ci */
34262306a36Sopenharmony_ci# define SCALER_DISPCTRLX_ONESHOT		BIT(29)
34362306a36Sopenharmony_ci/* Processes a single context in the dlist and then task switch,
34462306a36Sopenharmony_ci * instead of an entire line.
34562306a36Sopenharmony_ci */
34662306a36Sopenharmony_ci# define SCALER_DISPCTRLX_ONECTX		BIT(28)
34762306a36Sopenharmony_ci/* Set to have DISPSLAVE return 2 16bpp pixels and no status data. */
34862306a36Sopenharmony_ci# define SCALER_DISPCTRLX_FIFO32		BIT(27)
34962306a36Sopenharmony_ci/* Turns on output to the DISPSLAVE register instead of the normal
35062306a36Sopenharmony_ci * FIFO.
35162306a36Sopenharmony_ci */
35262306a36Sopenharmony_ci# define SCALER_DISPCTRLX_FIFOREG		BIT(26)
35362306a36Sopenharmony_ci
35462306a36Sopenharmony_ci# define SCALER_DISPCTRLX_WIDTH_MASK		VC4_MASK(23, 12)
35562306a36Sopenharmony_ci# define SCALER_DISPCTRLX_WIDTH_SHIFT		12
35662306a36Sopenharmony_ci# define SCALER_DISPCTRLX_HEIGHT_MASK		VC4_MASK(11, 0)
35762306a36Sopenharmony_ci# define SCALER_DISPCTRLX_HEIGHT_SHIFT		0
35862306a36Sopenharmony_ci
35962306a36Sopenharmony_ci# define SCALER5_DISPCTRLX_WIDTH_MASK		VC4_MASK(28, 16)
36062306a36Sopenharmony_ci# define SCALER5_DISPCTRLX_WIDTH_SHIFT		16
36162306a36Sopenharmony_ci/* Generates a single frame when VSTART is seen and stops at the last
36262306a36Sopenharmony_ci * pixel read from the FIFO.
36362306a36Sopenharmony_ci */
36462306a36Sopenharmony_ci# define SCALER5_DISPCTRLX_ONESHOT		BIT(15)
36562306a36Sopenharmony_ci/* Processes a single context in the dlist and then task switch,
36662306a36Sopenharmony_ci * instead of an entire line.
36762306a36Sopenharmony_ci */
36862306a36Sopenharmony_ci# define SCALER5_DISPCTRLX_ONECTX_MASK		VC4_MASK(14, 13)
36962306a36Sopenharmony_ci# define SCALER5_DISPCTRLX_ONECTX_SHIFT		13
37062306a36Sopenharmony_ci# define SCALER5_DISPCTRLX_HEIGHT_MASK		VC4_MASK(12, 0)
37162306a36Sopenharmony_ci# define SCALER5_DISPCTRLX_HEIGHT_SHIFT		0
37262306a36Sopenharmony_ci
37362306a36Sopenharmony_ci#define SCALER_DISPBKGND0                       0x00000044
37462306a36Sopenharmony_ci# define SCALER_DISPBKGND_AUTOHS		BIT(31)
37562306a36Sopenharmony_ci# define SCALER5_DISPBKGND_BCK2BCK		BIT(31)
37662306a36Sopenharmony_ci# define SCALER_DISPBKGND_INTERLACE		BIT(30)
37762306a36Sopenharmony_ci# define SCALER_DISPBKGND_GAMMA			BIT(29)
37862306a36Sopenharmony_ci# define SCALER_DISPBKGND_TESTMODE_MASK		VC4_MASK(28, 25)
37962306a36Sopenharmony_ci# define SCALER_DISPBKGND_TESTMODE_SHIFT	25
38062306a36Sopenharmony_ci/* Enables filling the scaler line with the RGB value in the low 24
38162306a36Sopenharmony_ci * bits before compositing.  Costs cycles, so should be skipped if
38262306a36Sopenharmony_ci * opaque display planes will cover everything.
38362306a36Sopenharmony_ci */
38462306a36Sopenharmony_ci# define SCALER_DISPBKGND_FILL			BIT(24)
38562306a36Sopenharmony_ci
38662306a36Sopenharmony_ci#define SCALER_DISPSTAT0                        0x00000048
38762306a36Sopenharmony_ci# define SCALER_DISPSTATX_MODE_MASK		VC4_MASK(31, 30)
38862306a36Sopenharmony_ci# define SCALER_DISPSTATX_MODE_SHIFT		30
38962306a36Sopenharmony_ci# define SCALER_DISPSTATX_MODE_DISABLED		0
39062306a36Sopenharmony_ci# define SCALER_DISPSTATX_MODE_INIT		1
39162306a36Sopenharmony_ci# define SCALER_DISPSTATX_MODE_RUN		2
39262306a36Sopenharmony_ci# define SCALER_DISPSTATX_MODE_EOF		3
39362306a36Sopenharmony_ci# define SCALER_DISPSTATX_FULL			BIT(29)
39462306a36Sopenharmony_ci# define SCALER_DISPSTATX_EMPTY			BIT(28)
39562306a36Sopenharmony_ci# define SCALER_DISPSTATX_LINE_MASK		VC4_MASK(11, 0)
39662306a36Sopenharmony_ci# define SCALER_DISPSTATX_LINE_SHIFT		0
39762306a36Sopenharmony_ci
39862306a36Sopenharmony_ci#define SCALER_DISPBASE0                        0x0000004c
39962306a36Sopenharmony_ci/* Last pixel in the COB (display FIFO memory) allocated to this HVS
40062306a36Sopenharmony_ci * channel.  Must be 4-pixel aligned (and thus 4 pixels less than the
40162306a36Sopenharmony_ci * next COB base).
40262306a36Sopenharmony_ci */
40362306a36Sopenharmony_ci# define SCALER_DISPBASEX_TOP_MASK		VC4_MASK(31, 16)
40462306a36Sopenharmony_ci# define SCALER_DISPBASEX_TOP_SHIFT		16
40562306a36Sopenharmony_ci/* First pixel in the COB (display FIFO memory) allocated to this HVS
40662306a36Sopenharmony_ci * channel.  Must be 4-pixel aligned.
40762306a36Sopenharmony_ci */
40862306a36Sopenharmony_ci# define SCALER_DISPBASEX_BASE_MASK		VC4_MASK(15, 0)
40962306a36Sopenharmony_ci# define SCALER_DISPBASEX_BASE_SHIFT		0
41062306a36Sopenharmony_ci
41162306a36Sopenharmony_ci#define SCALER_DISPCTRL1                        0x00000050
41262306a36Sopenharmony_ci#define SCALER_DISPBKGND1                       0x00000054
41362306a36Sopenharmony_ci#define SCALER_DISPBKGNDX(x)			(SCALER_DISPBKGND0 +        \
41462306a36Sopenharmony_ci						 (x) * (SCALER_DISPBKGND1 - \
41562306a36Sopenharmony_ci							SCALER_DISPBKGND0))
41662306a36Sopenharmony_ci#define SCALER_DISPSTAT1                        0x00000058
41762306a36Sopenharmony_ci# define SCALER_DISPSTAT1_FRCNT0_MASK		VC4_MASK(23, 18)
41862306a36Sopenharmony_ci# define SCALER_DISPSTAT1_FRCNT0_SHIFT		18
41962306a36Sopenharmony_ci# define SCALER_DISPSTAT1_FRCNT1_MASK		VC4_MASK(17, 12)
42062306a36Sopenharmony_ci# define SCALER_DISPSTAT1_FRCNT1_SHIFT		12
42162306a36Sopenharmony_ci
42262306a36Sopenharmony_ci#define SCALER_DISPSTATX(x)			(SCALER_DISPSTAT0 +        \
42362306a36Sopenharmony_ci						 (x) * (SCALER_DISPSTAT1 - \
42462306a36Sopenharmony_ci							SCALER_DISPSTAT0))
42562306a36Sopenharmony_ci
42662306a36Sopenharmony_ci#define SCALER_DISPBASE1                        0x0000005c
42762306a36Sopenharmony_ci#define SCALER_DISPBASEX(x)			(SCALER_DISPBASE0 +        \
42862306a36Sopenharmony_ci						 (x) * (SCALER_DISPBASE1 - \
42962306a36Sopenharmony_ci							SCALER_DISPBASE0))
43062306a36Sopenharmony_ci#define SCALER_DISPCTRL2                        0x00000060
43162306a36Sopenharmony_ci#define SCALER_DISPCTRLX(x)			(SCALER_DISPCTRL0 +        \
43262306a36Sopenharmony_ci						 (x) * (SCALER_DISPCTRL1 - \
43362306a36Sopenharmony_ci							SCALER_DISPCTRL0))
43462306a36Sopenharmony_ci#define SCALER_DISPBKGND2                       0x00000064
43562306a36Sopenharmony_ci
43662306a36Sopenharmony_ci#define SCALER_DISPSTAT2                        0x00000068
43762306a36Sopenharmony_ci# define SCALER_DISPSTAT2_FRCNT2_MASK		VC4_MASK(17, 12)
43862306a36Sopenharmony_ci# define SCALER_DISPSTAT2_FRCNT2_SHIFT		12
43962306a36Sopenharmony_ci
44062306a36Sopenharmony_ci#define SCALER_DISPBASE2                        0x0000006c
44162306a36Sopenharmony_ci#define SCALER_DISPALPHA2                       0x00000070
44262306a36Sopenharmony_ci#define SCALER_GAMADDR                          0x00000078
44362306a36Sopenharmony_ci# define SCALER_GAMADDR_AUTOINC			BIT(31)
44462306a36Sopenharmony_ci/* Enables all gamma ramp SRAMs, not just those of CRTCs with gamma
44562306a36Sopenharmony_ci * enabled.
44662306a36Sopenharmony_ci */
44762306a36Sopenharmony_ci# define SCALER_GAMADDR_SRAMENB			BIT(30)
44862306a36Sopenharmony_ci
44962306a36Sopenharmony_ci#define SCALER_OLEDOFFS                         0x00000080
45062306a36Sopenharmony_ci/* Clamps R to [16,235] and G/B to [16,240]. */
45162306a36Sopenharmony_ci# define SCALER_OLEDOFFS_YUVCLAMP               BIT(31)
45262306a36Sopenharmony_ci
45362306a36Sopenharmony_ci/* Chooses which display FIFO the matrix applies to. */
45462306a36Sopenharmony_ci# define SCALER_OLEDOFFS_DISPFIFO_MASK          VC4_MASK(25, 24)
45562306a36Sopenharmony_ci# define SCALER_OLEDOFFS_DISPFIFO_SHIFT         24
45662306a36Sopenharmony_ci# define SCALER_OLEDOFFS_DISPFIFO_DISABLED      0
45762306a36Sopenharmony_ci# define SCALER_OLEDOFFS_DISPFIFO_0             1
45862306a36Sopenharmony_ci# define SCALER_OLEDOFFS_DISPFIFO_1             2
45962306a36Sopenharmony_ci# define SCALER_OLEDOFFS_DISPFIFO_2             3
46062306a36Sopenharmony_ci
46162306a36Sopenharmony_ci/* Offsets are 8-bit 2s-complement. */
46262306a36Sopenharmony_ci# define SCALER_OLEDOFFS_RED_MASK               VC4_MASK(23, 16)
46362306a36Sopenharmony_ci# define SCALER_OLEDOFFS_RED_SHIFT              16
46462306a36Sopenharmony_ci# define SCALER_OLEDOFFS_GREEN_MASK             VC4_MASK(15, 8)
46562306a36Sopenharmony_ci# define SCALER_OLEDOFFS_GREEN_SHIFT            8
46662306a36Sopenharmony_ci# define SCALER_OLEDOFFS_BLUE_MASK              VC4_MASK(7, 0)
46762306a36Sopenharmony_ci# define SCALER_OLEDOFFS_BLUE_SHIFT             0
46862306a36Sopenharmony_ci
46962306a36Sopenharmony_ci/* The coefficients are S0.9 fractions. */
47062306a36Sopenharmony_ci#define SCALER_OLEDCOEF0                        0x00000084
47162306a36Sopenharmony_ci# define SCALER_OLEDCOEF0_B_TO_R_MASK           VC4_MASK(29, 20)
47262306a36Sopenharmony_ci# define SCALER_OLEDCOEF0_B_TO_R_SHIFT          20
47362306a36Sopenharmony_ci# define SCALER_OLEDCOEF0_B_TO_G_MASK           VC4_MASK(19, 10)
47462306a36Sopenharmony_ci# define SCALER_OLEDCOEF0_B_TO_G_SHIFT          10
47562306a36Sopenharmony_ci# define SCALER_OLEDCOEF0_B_TO_B_MASK           VC4_MASK(9, 0)
47662306a36Sopenharmony_ci# define SCALER_OLEDCOEF0_B_TO_B_SHIFT          0
47762306a36Sopenharmony_ci
47862306a36Sopenharmony_ci#define SCALER_OLEDCOEF1                        0x00000088
47962306a36Sopenharmony_ci# define SCALER_OLEDCOEF1_G_TO_R_MASK           VC4_MASK(29, 20)
48062306a36Sopenharmony_ci# define SCALER_OLEDCOEF1_G_TO_R_SHIFT          20
48162306a36Sopenharmony_ci# define SCALER_OLEDCOEF1_G_TO_G_MASK           VC4_MASK(19, 10)
48262306a36Sopenharmony_ci# define SCALER_OLEDCOEF1_G_TO_G_SHIFT          10
48362306a36Sopenharmony_ci# define SCALER_OLEDCOEF1_G_TO_B_MASK           VC4_MASK(9, 0)
48462306a36Sopenharmony_ci# define SCALER_OLEDCOEF1_G_TO_B_SHIFT          0
48562306a36Sopenharmony_ci
48662306a36Sopenharmony_ci#define SCALER_OLEDCOEF2                        0x0000008c
48762306a36Sopenharmony_ci# define SCALER_OLEDCOEF2_R_TO_R_MASK           VC4_MASK(29, 20)
48862306a36Sopenharmony_ci# define SCALER_OLEDCOEF2_R_TO_R_SHIFT          20
48962306a36Sopenharmony_ci# define SCALER_OLEDCOEF2_R_TO_G_MASK           VC4_MASK(19, 10)
49062306a36Sopenharmony_ci# define SCALER_OLEDCOEF2_R_TO_G_SHIFT          10
49162306a36Sopenharmony_ci# define SCALER_OLEDCOEF2_R_TO_B_MASK           VC4_MASK(9, 0)
49262306a36Sopenharmony_ci# define SCALER_OLEDCOEF2_R_TO_B_SHIFT          0
49362306a36Sopenharmony_ci
49462306a36Sopenharmony_ci/* Slave addresses for DMAing from HVS composition output to other
49562306a36Sopenharmony_ci * devices.  The top bits are valid only in !FIFO32 mode.
49662306a36Sopenharmony_ci */
49762306a36Sopenharmony_ci#define SCALER_DISPSLAVE0                       0x000000c0
49862306a36Sopenharmony_ci#define SCALER_DISPSLAVE1                       0x000000c9
49962306a36Sopenharmony_ci#define SCALER_DISPSLAVE2                       0x000000d0
50062306a36Sopenharmony_ci# define SCALER_DISPSLAVE_ISSUE_VSTART          BIT(31)
50162306a36Sopenharmony_ci# define SCALER_DISPSLAVE_ISSUE_HSTART          BIT(30)
50262306a36Sopenharmony_ci/* Set when the current line has been read and an HSTART is required. */
50362306a36Sopenharmony_ci# define SCALER_DISPSLAVE_EOL                   BIT(26)
50462306a36Sopenharmony_ci/* Set when the display FIFO is empty. */
50562306a36Sopenharmony_ci# define SCALER_DISPSLAVE_EMPTY                 BIT(25)
50662306a36Sopenharmony_ci/* Set when there is RGB data ready to read. */
50762306a36Sopenharmony_ci# define SCALER_DISPSLAVE_VALID                 BIT(24)
50862306a36Sopenharmony_ci# define SCALER_DISPSLAVE_RGB_MASK              VC4_MASK(23, 0)
50962306a36Sopenharmony_ci# define SCALER_DISPSLAVE_RGB_SHIFT             0
51062306a36Sopenharmony_ci
51162306a36Sopenharmony_ci#define SCALER_GAMDATA                          0x000000e0
51262306a36Sopenharmony_ci#define SCALER_DLIST_START                      0x00002000
51362306a36Sopenharmony_ci#define SCALER_DLIST_SIZE                       0x00004000
51462306a36Sopenharmony_ci
51562306a36Sopenharmony_ci#define SCALER5_DLIST_START			0x00004000
51662306a36Sopenharmony_ci
51762306a36Sopenharmony_ci# define VC4_HDMI_SW_RESET_FORMAT_DETECT	BIT(1)
51862306a36Sopenharmony_ci# define VC4_HDMI_SW_RESET_HDMI			BIT(0)
51962306a36Sopenharmony_ci
52062306a36Sopenharmony_ci# define VC4_HDMI_HOTPLUG_CONNECTED		BIT(0)
52162306a36Sopenharmony_ci
52262306a36Sopenharmony_ci# define VC4_HDMI_MAI_CONFIG_FORMAT_REVERSE		BIT(27)
52362306a36Sopenharmony_ci# define VC4_HDMI_MAI_CONFIG_BIT_REVERSE		BIT(26)
52462306a36Sopenharmony_ci# define VC4_HDMI_MAI_CHANNEL_MASK_MASK			VC4_MASK(15, 0)
52562306a36Sopenharmony_ci# define VC4_HDMI_MAI_CHANNEL_MASK_SHIFT		0
52662306a36Sopenharmony_ci
52762306a36Sopenharmony_ci# define VC4_HDMI_AUDIO_PACKET_ZERO_DATA_ON_SAMPLE_FLAT		BIT(29)
52862306a36Sopenharmony_ci# define VC4_HDMI_AUDIO_PACKET_ZERO_DATA_ON_INACTIVE_CHANNELS	BIT(24)
52962306a36Sopenharmony_ci# define VC4_HDMI_AUDIO_PACKET_FORCE_SAMPLE_PRESENT		BIT(19)
53062306a36Sopenharmony_ci# define VC4_HDMI_AUDIO_PACKET_FORCE_B_FRAME			BIT(18)
53162306a36Sopenharmony_ci# define VC4_HDMI_AUDIO_PACKET_B_FRAME_IDENTIFIER_MASK		VC4_MASK(13, 10)
53262306a36Sopenharmony_ci# define VC4_HDMI_AUDIO_PACKET_B_FRAME_IDENTIFIER_SHIFT		10
53362306a36Sopenharmony_ci/* If set, then multichannel, otherwise 2 channel. */
53462306a36Sopenharmony_ci# define VC4_HDMI_AUDIO_PACKET_AUDIO_LAYOUT			BIT(9)
53562306a36Sopenharmony_ci/* If set, then AUDIO_LAYOUT overrides audio_cea_mask */
53662306a36Sopenharmony_ci# define VC4_HDMI_AUDIO_PACKET_FORCE_AUDIO_LAYOUT		BIT(8)
53762306a36Sopenharmony_ci# define VC4_HDMI_AUDIO_PACKET_CEA_MASK_MASK			VC4_MASK(7, 0)
53862306a36Sopenharmony_ci# define VC4_HDMI_AUDIO_PACKET_CEA_MASK_SHIFT			0
53962306a36Sopenharmony_ci
54062306a36Sopenharmony_ci# define VC4_HDMI_MAI_FORMAT_AUDIO_FORMAT_MASK		VC4_MASK(23, 16)
54162306a36Sopenharmony_ci# define VC4_HDMI_MAI_FORMAT_AUDIO_FORMAT_SHIFT		16
54262306a36Sopenharmony_ci
54362306a36Sopenharmony_cienum {
54462306a36Sopenharmony_ci	VC4_HDMI_MAI_FORMAT_PCM = 2,
54562306a36Sopenharmony_ci	VC4_HDMI_MAI_FORMAT_HBR = 200,
54662306a36Sopenharmony_ci};
54762306a36Sopenharmony_ci
54862306a36Sopenharmony_ci# define VC4_HDMI_MAI_FORMAT_SAMPLE_RATE_MASK		VC4_MASK(15, 8)
54962306a36Sopenharmony_ci# define VC4_HDMI_MAI_FORMAT_SAMPLE_RATE_SHIFT		8
55062306a36Sopenharmony_ci
55162306a36Sopenharmony_cienum {
55262306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_NOT_INDICATED = 0,
55362306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_8000 = 1,
55462306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_11025 = 2,
55562306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_12000 = 3,
55662306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_16000 = 4,
55762306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_22050 = 5,
55862306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_24000 = 6,
55962306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_32000 = 7,
56062306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_44100 = 8,
56162306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_48000 = 9,
56262306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_64000 = 10,
56362306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_88200 = 11,
56462306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_96000 = 12,
56562306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_128000 = 13,
56662306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_176400 = 14,
56762306a36Sopenharmony_ci	VC4_HDMI_MAI_SAMPLE_RATE_192000 = 15,
56862306a36Sopenharmony_ci};
56962306a36Sopenharmony_ci
57062306a36Sopenharmony_ci# define VC4_HDMI_RAM_PACKET_ENABLE		BIT(16)
57162306a36Sopenharmony_ci
57262306a36Sopenharmony_ci/* When set, the CTS_PERIOD counts based on MAI bus sync pulse instead
57362306a36Sopenharmony_ci * of pixel clock.
57462306a36Sopenharmony_ci */
57562306a36Sopenharmony_ci# define VC4_HDMI_CRP_USE_MAI_BUS_SYNC_FOR_CTS	BIT(26)
57662306a36Sopenharmony_ci/* When set, no CRP packets will be sent. */
57762306a36Sopenharmony_ci# define VC4_HDMI_CRP_CFG_DISABLE		BIT(25)
57862306a36Sopenharmony_ci/* If set, generates CTS values based on N, audio clock, and video
57962306a36Sopenharmony_ci * clock.  N must be divisible by 128.
58062306a36Sopenharmony_ci */
58162306a36Sopenharmony_ci# define VC4_HDMI_CRP_CFG_EXTERNAL_CTS_EN	BIT(24)
58262306a36Sopenharmony_ci# define VC4_HDMI_CRP_CFG_N_MASK		VC4_MASK(19, 0)
58362306a36Sopenharmony_ci# define VC4_HDMI_CRP_CFG_N_SHIFT		0
58462306a36Sopenharmony_ci
58562306a36Sopenharmony_ci# define VC4_HDMI_HORZA_VPOS			BIT(14)
58662306a36Sopenharmony_ci# define VC4_HDMI_HORZA_HPOS			BIT(13)
58762306a36Sopenharmony_ci/* Horizontal active pixels (hdisplay). */
58862306a36Sopenharmony_ci# define VC4_HDMI_HORZA_HAP_MASK		VC4_MASK(12, 0)
58962306a36Sopenharmony_ci# define VC4_HDMI_HORZA_HAP_SHIFT		0
59062306a36Sopenharmony_ci
59162306a36Sopenharmony_ci/* Horizontal pack porch (htotal - hsync_end). */
59262306a36Sopenharmony_ci# define VC4_HDMI_HORZB_HBP_MASK		VC4_MASK(29, 20)
59362306a36Sopenharmony_ci# define VC4_HDMI_HORZB_HBP_SHIFT		20
59462306a36Sopenharmony_ci/* Horizontal sync pulse (hsync_end - hsync_start). */
59562306a36Sopenharmony_ci# define VC4_HDMI_HORZB_HSP_MASK		VC4_MASK(19, 10)
59662306a36Sopenharmony_ci# define VC4_HDMI_HORZB_HSP_SHIFT		10
59762306a36Sopenharmony_ci/* Horizontal front porch (hsync_start - hdisplay). */
59862306a36Sopenharmony_ci# define VC4_HDMI_HORZB_HFP_MASK		VC4_MASK(9, 0)
59962306a36Sopenharmony_ci# define VC4_HDMI_HORZB_HFP_SHIFT		0
60062306a36Sopenharmony_ci
60162306a36Sopenharmony_ci# define VC4_HDMI_FIFO_CTL_RECENTER_DONE	BIT(14)
60262306a36Sopenharmony_ci# define VC4_HDMI_FIFO_CTL_USE_EMPTY		BIT(13)
60362306a36Sopenharmony_ci# define VC4_HDMI_FIFO_CTL_ON_VB		BIT(7)
60462306a36Sopenharmony_ci# define VC4_HDMI_FIFO_CTL_RECENTER		BIT(6)
60562306a36Sopenharmony_ci# define VC4_HDMI_FIFO_CTL_FIFO_RESET		BIT(5)
60662306a36Sopenharmony_ci# define VC4_HDMI_FIFO_CTL_USE_PLL_LOCK		BIT(4)
60762306a36Sopenharmony_ci# define VC4_HDMI_FIFO_CTL_INV_CLK_XFR		BIT(3)
60862306a36Sopenharmony_ci# define VC4_HDMI_FIFO_CTL_CAPTURE_PTR		BIT(2)
60962306a36Sopenharmony_ci# define VC4_HDMI_FIFO_CTL_USE_FULL		BIT(1)
61062306a36Sopenharmony_ci# define VC4_HDMI_FIFO_CTL_MASTER_SLAVE_N	BIT(0)
61162306a36Sopenharmony_ci# define VC4_HDMI_FIFO_VALID_WRITE_MASK		0xefff
61262306a36Sopenharmony_ci
61362306a36Sopenharmony_ci# define VC4_HDMI_SCHEDULER_CONTROL_MANUAL_FORMAT BIT(15)
61462306a36Sopenharmony_ci# define VC4_HDMI_SCHEDULER_CONTROL_IGNORE_VSYNC_PREDICTS BIT(5)
61562306a36Sopenharmony_ci# define VC4_HDMI_SCHEDULER_CONTROL_VERT_ALWAYS_KEEPOUT	BIT(3)
61662306a36Sopenharmony_ci# define VC4_HDMI_SCHEDULER_CONTROL_HDMI_ACTIVE	BIT(1)
61762306a36Sopenharmony_ci# define VC4_HDMI_SCHEDULER_CONTROL_MODE_HDMI	BIT(0)
61862306a36Sopenharmony_ci
61962306a36Sopenharmony_ci/* Vertical sync pulse (vsync_end - vsync_start). */
62062306a36Sopenharmony_ci# define VC4_HDMI_VERTA_VSP_MASK		VC4_MASK(24, 20)
62162306a36Sopenharmony_ci# define VC4_HDMI_VERTA_VSP_SHIFT		20
62262306a36Sopenharmony_ci/* Vertical front porch (vsync_start - vdisplay). */
62362306a36Sopenharmony_ci# define VC4_HDMI_VERTA_VFP_MASK		VC4_MASK(19, 13)
62462306a36Sopenharmony_ci# define VC4_HDMI_VERTA_VFP_SHIFT		13
62562306a36Sopenharmony_ci/* Vertical active lines (vdisplay). */
62662306a36Sopenharmony_ci# define VC4_HDMI_VERTA_VAL_MASK		VC4_MASK(12, 0)
62762306a36Sopenharmony_ci# define VC4_HDMI_VERTA_VAL_SHIFT		0
62862306a36Sopenharmony_ci
62962306a36Sopenharmony_ci/* Vertical sync pulse offset (for interlaced) */
63062306a36Sopenharmony_ci# define VC4_HDMI_VERTB_VSPO_MASK		VC4_MASK(21, 9)
63162306a36Sopenharmony_ci# define VC4_HDMI_VERTB_VSPO_SHIFT		9
63262306a36Sopenharmony_ci/* Vertical pack porch (vtotal - vsync_end). */
63362306a36Sopenharmony_ci# define VC4_HDMI_VERTB_VBP_MASK		VC4_MASK(8, 0)
63462306a36Sopenharmony_ci# define VC4_HDMI_VERTB_VBP_SHIFT		0
63562306a36Sopenharmony_ci
63662306a36Sopenharmony_ci/* Set when the transmission has ended. */
63762306a36Sopenharmony_ci# define VC4_HDMI_CEC_TX_EOM			BIT(31)
63862306a36Sopenharmony_ci/* If set, transmission was acked on the 1st or 2nd attempt (only one
63962306a36Sopenharmony_ci * retry is attempted).  If in continuous mode, this means TX needs to
64062306a36Sopenharmony_ci * be filled if !TX_EOM.
64162306a36Sopenharmony_ci */
64262306a36Sopenharmony_ci# define VC4_HDMI_CEC_TX_STATUS_GOOD		BIT(30)
64362306a36Sopenharmony_ci# define VC4_HDMI_CEC_RX_EOM			BIT(29)
64462306a36Sopenharmony_ci# define VC4_HDMI_CEC_RX_STATUS_GOOD		BIT(28)
64562306a36Sopenharmony_ci/* Number of bytes received for the message. */
64662306a36Sopenharmony_ci# define VC4_HDMI_CEC_REC_WRD_CNT_MASK		VC4_MASK(27, 24)
64762306a36Sopenharmony_ci# define VC4_HDMI_CEC_REC_WRD_CNT_SHIFT		24
64862306a36Sopenharmony_ci/* Sets continuous receive mode.  Generates interrupt after each 8
64962306a36Sopenharmony_ci * bytes to signal that RX_DATA should be consumed, and at RX_EOM.
65062306a36Sopenharmony_ci *
65162306a36Sopenharmony_ci * If disabled, maximum 16 bytes will be received (including header),
65262306a36Sopenharmony_ci * and interrupt at RX_EOM.  Later bytes will be acked but not put
65362306a36Sopenharmony_ci * into the RX_DATA.
65462306a36Sopenharmony_ci */
65562306a36Sopenharmony_ci# define VC4_HDMI_CEC_RX_CONTINUE		BIT(23)
65662306a36Sopenharmony_ci# define VC4_HDMI_CEC_TX_CONTINUE		BIT(22)
65762306a36Sopenharmony_ci/* Set this after a CEC interrupt. */
65862306a36Sopenharmony_ci# define VC4_HDMI_CEC_CLEAR_RECEIVE_OFF		BIT(21)
65962306a36Sopenharmony_ci/* Starts a TX.  Will wait for appropriate idel time before CEC
66062306a36Sopenharmony_ci * activity. Must be cleared in between transmits.
66162306a36Sopenharmony_ci */
66262306a36Sopenharmony_ci# define VC4_HDMI_CEC_START_XMIT_BEGIN		BIT(20)
66362306a36Sopenharmony_ci# define VC4_HDMI_CEC_MESSAGE_LENGTH_MASK	VC4_MASK(19, 16)
66462306a36Sopenharmony_ci# define VC4_HDMI_CEC_MESSAGE_LENGTH_SHIFT	16
66562306a36Sopenharmony_ci/* Device's CEC address */
66662306a36Sopenharmony_ci# define VC4_HDMI_CEC_ADDR_MASK			VC4_MASK(15, 12)
66762306a36Sopenharmony_ci# define VC4_HDMI_CEC_ADDR_SHIFT		12
66862306a36Sopenharmony_ci/* Divides off of HSM clock to generate CEC bit clock. */
66962306a36Sopenharmony_ci/* With the current defaults the CEC bit clock is 40 kHz = 25 usec */
67062306a36Sopenharmony_ci# define VC4_HDMI_CEC_DIV_CLK_CNT_MASK		VC4_MASK(11, 0)
67162306a36Sopenharmony_ci# define VC4_HDMI_CEC_DIV_CLK_CNT_SHIFT		0
67262306a36Sopenharmony_ci
67362306a36Sopenharmony_ci/* Set these fields to how many bit clock cycles get to that many
67462306a36Sopenharmony_ci * microseconds.
67562306a36Sopenharmony_ci */
67662306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_1500_US_MASK	VC4_MASK(30, 24)
67762306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_1500_US_SHIFT	24
67862306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_1300_US_MASK	VC4_MASK(23, 17)
67962306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_1300_US_SHIFT	17
68062306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_800_US_MASK	VC4_MASK(16, 11)
68162306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_800_US_SHIFT	11
68262306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_600_US_MASK	VC4_MASK(10, 5)
68362306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_600_US_SHIFT	5
68462306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_400_US_MASK	VC4_MASK(4, 0)
68562306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_400_US_SHIFT	0
68662306a36Sopenharmony_ci
68762306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_2750_US_MASK	VC4_MASK(31, 24)
68862306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_2750_US_SHIFT	24
68962306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_2400_US_MASK	VC4_MASK(23, 16)
69062306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_2400_US_SHIFT	16
69162306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_2050_US_MASK	VC4_MASK(15, 8)
69262306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_2050_US_SHIFT	8
69362306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_1700_US_MASK	VC4_MASK(7, 0)
69462306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_1700_US_SHIFT	0
69562306a36Sopenharmony_ci
69662306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_4300_US_MASK	VC4_MASK(31, 24)
69762306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_4300_US_SHIFT	24
69862306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_3900_US_MASK	VC4_MASK(23, 16)
69962306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_3900_US_SHIFT	16
70062306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_3600_US_MASK	VC4_MASK(15, 8)
70162306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_3600_US_SHIFT	8
70262306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_3500_US_MASK	VC4_MASK(7, 0)
70362306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_3500_US_SHIFT	0
70462306a36Sopenharmony_ci
70562306a36Sopenharmony_ci# define VC4_HDMI_CEC_TX_SW_RESET		BIT(27)
70662306a36Sopenharmony_ci# define VC4_HDMI_CEC_RX_SW_RESET		BIT(26)
70762306a36Sopenharmony_ci# define VC4_HDMI_CEC_PAD_SW_RESET		BIT(25)
70862306a36Sopenharmony_ci# define VC4_HDMI_CEC_MUX_TP_OUT_CEC		BIT(24)
70962306a36Sopenharmony_ci# define VC4_HDMI_CEC_RX_CEC_INT		BIT(23)
71062306a36Sopenharmony_ci# define VC4_HDMI_CEC_CLK_PRELOAD_MASK		VC4_MASK(22, 16)
71162306a36Sopenharmony_ci# define VC4_HDMI_CEC_CLK_PRELOAD_SHIFT		16
71262306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_4700_US_MASK	VC4_MASK(15, 8)
71362306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_4700_US_SHIFT	8
71462306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_4500_US_MASK	VC4_MASK(7, 0)
71562306a36Sopenharmony_ci# define VC4_HDMI_CEC_CNT_TO_4500_US_SHIFT	0
71662306a36Sopenharmony_ci
71762306a36Sopenharmony_ci# define VC4_HDMI_TX_PHY_RNG_PWRDN		BIT(25)
71862306a36Sopenharmony_ci
71962306a36Sopenharmony_ci# define VC4_HDMI_CPU_CEC			BIT(6)
72062306a36Sopenharmony_ci# define VC4_HDMI_CPU_HOTPLUG			BIT(0)
72162306a36Sopenharmony_ci
72262306a36Sopenharmony_ci/* Debug: Current receive value on the CEC pad. */
72362306a36Sopenharmony_ci# define VC4_HD_CECRXD				BIT(9)
72462306a36Sopenharmony_ci/* Debug: Override CEC output to 0. */
72562306a36Sopenharmony_ci# define VC4_HD_CECOVR				BIT(8)
72662306a36Sopenharmony_ci# define VC4_HD_M_REGISTER_FILE_STANDBY		(3 << 6)
72762306a36Sopenharmony_ci# define VC4_HD_M_RAM_STANDBY			(3 << 4)
72862306a36Sopenharmony_ci# define VC4_HD_M_SW_RST			BIT(2)
72962306a36Sopenharmony_ci# define VC4_HD_M_ENABLE			BIT(0)
73062306a36Sopenharmony_ci
73162306a36Sopenharmony_ci/* Set when audio stream is received at a slower rate than the
73262306a36Sopenharmony_ci * sampling period, so MAI fifo goes empty.  Write 1 to clear.
73362306a36Sopenharmony_ci */
73462306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_DLATE			BIT(15)
73562306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_BUSY			BIT(14)
73662306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_CHALIGN			BIT(13)
73762306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_WHOLSMP			BIT(12)
73862306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_FULL			BIT(11)
73962306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_EMPTY			BIT(10)
74062306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_FLUSH			BIT(9)
74162306a36Sopenharmony_ci/* If set, MAI bus generates SPDIF (bit 31) parity instead of passing
74262306a36Sopenharmony_ci * through.
74362306a36Sopenharmony_ci */
74462306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_PAREN			BIT(8)
74562306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_CHNUM_MASK		VC4_MASK(7, 4)
74662306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_CHNUM_SHIFT		4
74762306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_ENABLE			BIT(3)
74862306a36Sopenharmony_ci/* Underflow error status bit, write 1 to clear. */
74962306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_ERRORE			BIT(2)
75062306a36Sopenharmony_ci/* Overflow error status bit, write 1 to clear. */
75162306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_ERRORF			BIT(1)
75262306a36Sopenharmony_ci/* Single-shot reset bit.  Read value is undefined. */
75362306a36Sopenharmony_ci# define VC4_HD_MAI_CTL_RESET			BIT(0)
75462306a36Sopenharmony_ci
75562306a36Sopenharmony_ci# define VC4_HD_MAI_THR_PANICHIGH_MASK		VC4_MASK(29, 24)
75662306a36Sopenharmony_ci# define VC4_HD_MAI_THR_PANICHIGH_SHIFT		24
75762306a36Sopenharmony_ci# define VC4_HD_MAI_THR_PANICLOW_MASK		VC4_MASK(21, 16)
75862306a36Sopenharmony_ci# define VC4_HD_MAI_THR_PANICLOW_SHIFT		16
75962306a36Sopenharmony_ci# define VC4_HD_MAI_THR_DREQHIGH_MASK		VC4_MASK(13, 8)
76062306a36Sopenharmony_ci# define VC4_HD_MAI_THR_DREQHIGH_SHIFT		8
76162306a36Sopenharmony_ci# define VC4_HD_MAI_THR_DREQLOW_MASK		VC4_MASK(5, 0)
76262306a36Sopenharmony_ci# define VC4_HD_MAI_THR_DREQLOW_SHIFT		0
76362306a36Sopenharmony_ci
76462306a36Sopenharmony_ci/* Divider from HDMI HSM clock to MAI serial clock.  Sampling period
76562306a36Sopenharmony_ci * converges to N / (M + 1) cycles.
76662306a36Sopenharmony_ci */
76762306a36Sopenharmony_ci# define VC4_HD_MAI_SMP_N_MASK			VC4_MASK(31, 8)
76862306a36Sopenharmony_ci# define VC4_HD_MAI_SMP_N_SHIFT			8
76962306a36Sopenharmony_ci# define VC4_HD_MAI_SMP_M_MASK			VC4_MASK(7, 0)
77062306a36Sopenharmony_ci# define VC4_HD_MAI_SMP_M_SHIFT			0
77162306a36Sopenharmony_ci
77262306a36Sopenharmony_ci# define VC4_HD_VID_CTL_ENABLE			BIT(31)
77362306a36Sopenharmony_ci# define VC4_HD_VID_CTL_UNDERFLOW_ENABLE	BIT(30)
77462306a36Sopenharmony_ci# define VC4_HD_VID_CTL_FRAME_COUNTER_RESET	BIT(29)
77562306a36Sopenharmony_ci# define VC4_HD_VID_CTL_VSYNC_LOW		BIT(28)
77662306a36Sopenharmony_ci# define VC4_HD_VID_CTL_HSYNC_LOW		BIT(27)
77762306a36Sopenharmony_ci# define VC4_HD_VID_CTL_CLRSYNC			BIT(24)
77862306a36Sopenharmony_ci# define VC4_HD_VID_CTL_CLRRGB			BIT(23)
77962306a36Sopenharmony_ci# define VC4_HD_VID_CTL_BLANKPIX		BIT(18)
78062306a36Sopenharmony_ci
78162306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_ORDER_MASK		VC4_MASK(7, 5)
78262306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_ORDER_SHIFT		5
78362306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_ORDER_RGB		0
78462306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_ORDER_BGR		1
78562306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_ORDER_BRG		2
78662306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_ORDER_GRB		3
78762306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_ORDER_GBR		4
78862306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_ORDER_RBG		5
78962306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_PADMSB			BIT(4)
79062306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_MODE_MASK		VC4_MASK(3, 2)
79162306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_MODE_SHIFT		2
79262306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_MODE_RGB_TO_SD_YPRPB	0
79362306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_MODE_RGB_TO_HD_YPRPB	1
79462306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_MODE_CUSTOM		3
79562306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_RGB2YCC			BIT(1)
79662306a36Sopenharmony_ci# define VC4_HD_CSC_CTL_ENABLE			BIT(0)
79762306a36Sopenharmony_ci
79862306a36Sopenharmony_ci# define VC5_MT_CP_CSC_CTL_USE_444_TO_422	BIT(6)
79962306a36Sopenharmony_ci# define VC5_MT_CP_CSC_CTL_FILTER_MODE_444_TO_422_MASK \
80062306a36Sopenharmony_ci						VC4_MASK(5, 4)
80162306a36Sopenharmony_ci# define VC5_MT_CP_CSC_CTL_FILTER_MODE_444_TO_422_STANDARD \
80262306a36Sopenharmony_ci						3
80362306a36Sopenharmony_ci# define VC5_MT_CP_CSC_CTL_USE_RNG_SUPPRESSION	BIT(3)
80462306a36Sopenharmony_ci# define VC5_MT_CP_CSC_CTL_ENABLE		BIT(2)
80562306a36Sopenharmony_ci# define VC5_MT_CP_CSC_CTL_MODE_MASK		VC4_MASK(1, 0)
80662306a36Sopenharmony_ci
80762306a36Sopenharmony_ci# define VC5_MT_CP_CHANNEL_CTL_OUTPUT_REMAP_MASK \
80862306a36Sopenharmony_ci						VC4_MASK(7, 6)
80962306a36Sopenharmony_ci# define VC5_MT_CP_CHANNEL_CTL_OUTPUT_REMAP_LEGACY_STYLE \
81062306a36Sopenharmony_ci						2
81162306a36Sopenharmony_ci
81262306a36Sopenharmony_ci# define VC4_DVP_HT_CLOCK_STOP_PIXEL		BIT(1)
81362306a36Sopenharmony_ci
81462306a36Sopenharmony_ci# define VC5_DVP_HT_VEC_INTERFACE_CFG_SEL_422_MASK \
81562306a36Sopenharmony_ci						VC4_MASK(3, 2)
81662306a36Sopenharmony_ci# define VC5_DVP_HT_VEC_INTERFACE_CFG_SEL_422_FORMAT_422_LEGACY \
81762306a36Sopenharmony_ci						2
81862306a36Sopenharmony_ci
81962306a36Sopenharmony_ci/* HVS display list information. */
82062306a36Sopenharmony_ci#define HVS_BOOTLOADER_DLIST_END                32
82162306a36Sopenharmony_ci
82262306a36Sopenharmony_cienum hvs_pixel_format {
82362306a36Sopenharmony_ci	/* 8bpp */
82462306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_RGB332 = 0,
82562306a36Sopenharmony_ci	/* 16bpp */
82662306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_RGBA4444 = 1,
82762306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_RGB555 = 2,
82862306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_RGBA5551 = 3,
82962306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_RGB565 = 4,
83062306a36Sopenharmony_ci	/* 24bpp */
83162306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_RGB888 = 5,
83262306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_RGBA6666 = 6,
83362306a36Sopenharmony_ci	/* 32bpp */
83462306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_RGBA8888 = 7,
83562306a36Sopenharmony_ci
83662306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_YCBCR_YUV420_3PLANE = 8,
83762306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_YCBCR_YUV420_2PLANE = 9,
83862306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_YCBCR_YUV422_3PLANE = 10,
83962306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_YCBCR_YUV422_2PLANE = 11,
84062306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_H264 = 12,
84162306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_PALETTE = 13,
84262306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_YUV444_RGB = 14,
84362306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_AYUV444_RGB = 15,
84462306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_RGBA1010102 = 16,
84562306a36Sopenharmony_ci	HVS_PIXEL_FORMAT_YCBCR_10BIT = 17,
84662306a36Sopenharmony_ci};
84762306a36Sopenharmony_ci
84862306a36Sopenharmony_ci/* Note: the LSB is the rightmost character shown.  Only valid for
84962306a36Sopenharmony_ci * HVS_PIXEL_FORMAT_RGB8888, not RGB888.
85062306a36Sopenharmony_ci */
85162306a36Sopenharmony_ci/* For modes 332, 4444, 555, 5551, 6666, 8888, 10:10:10:2 */
85262306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_RGBA			0
85362306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_BGRA			1
85462306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_ARGB			2
85562306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_ABGR			3
85662306a36Sopenharmony_ci
85762306a36Sopenharmony_ci/* For modes 666 and 888 (4 & 5) */
85862306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_XBRG			0
85962306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_XRBG			1
86062306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_XRGB			2
86162306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_XBGR			3
86262306a36Sopenharmony_ci
86362306a36Sopenharmony_ci/* For YCbCr modes (8-12, and 17) */
86462306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_XYCBCR			0
86562306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_XYCRCB			1
86662306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_YXCBCR			2
86762306a36Sopenharmony_ci#define HVS_PIXEL_ORDER_YXCRCB			3
86862306a36Sopenharmony_ci
86962306a36Sopenharmony_ci#define SCALER_CTL0_END				BIT(31)
87062306a36Sopenharmony_ci#define SCALER_CTL0_VALID			BIT(30)
87162306a36Sopenharmony_ci
87262306a36Sopenharmony_ci#define SCALER_CTL0_SIZE_MASK			VC4_MASK(29, 24)
87362306a36Sopenharmony_ci#define SCALER_CTL0_SIZE_SHIFT			24
87462306a36Sopenharmony_ci
87562306a36Sopenharmony_ci#define SCALER_CTL0_TILING_MASK			VC4_MASK(21, 20)
87662306a36Sopenharmony_ci#define SCALER_CTL0_TILING_SHIFT		20
87762306a36Sopenharmony_ci#define SCALER_CTL0_TILING_LINEAR		0
87862306a36Sopenharmony_ci#define SCALER_CTL0_TILING_64B			1
87962306a36Sopenharmony_ci#define SCALER_CTL0_TILING_128B			2
88062306a36Sopenharmony_ci#define SCALER_CTL0_TILING_256B_OR_T		3
88162306a36Sopenharmony_ci
88262306a36Sopenharmony_ci#define SCALER_CTL0_ALPHA_MASK                  BIT(19)
88362306a36Sopenharmony_ci#define SCALER_CTL0_HFLIP                       BIT(16)
88462306a36Sopenharmony_ci#define SCALER_CTL0_VFLIP                       BIT(15)
88562306a36Sopenharmony_ci
88662306a36Sopenharmony_ci#define SCALER_CTL0_KEY_MODE_MASK		VC4_MASK(18, 17)
88762306a36Sopenharmony_ci#define SCALER_CTL0_KEY_MODE_SHIFT		17
88862306a36Sopenharmony_ci#define SCALER_CTL0_KEY_DISABLED		0
88962306a36Sopenharmony_ci#define SCALER_CTL0_KEY_LUMA_OR_COMMON_RGB	1
89062306a36Sopenharmony_ci#define SCALER_CTL0_KEY_MATCH			2 /* turn transparent */
89162306a36Sopenharmony_ci#define SCALER_CTL0_KEY_REPLACE			3 /* replace with value from key mask word 2 */
89262306a36Sopenharmony_ci
89362306a36Sopenharmony_ci#define SCALER_CTL0_ORDER_MASK			VC4_MASK(14, 13)
89462306a36Sopenharmony_ci#define SCALER_CTL0_ORDER_SHIFT			13
89562306a36Sopenharmony_ci
89662306a36Sopenharmony_ci#define SCALER_CTL0_RGBA_EXPAND_MASK		VC4_MASK(12, 11)
89762306a36Sopenharmony_ci#define SCALER_CTL0_RGBA_EXPAND_SHIFT		11
89862306a36Sopenharmony_ci#define SCALER_CTL0_RGBA_EXPAND_ZERO		0
89962306a36Sopenharmony_ci#define SCALER_CTL0_RGBA_EXPAND_LSB		1
90062306a36Sopenharmony_ci#define SCALER_CTL0_RGBA_EXPAND_MSB		2
90162306a36Sopenharmony_ci#define SCALER_CTL0_RGBA_EXPAND_ROUND		3
90262306a36Sopenharmony_ci
90362306a36Sopenharmony_ci#define SCALER5_CTL0_ALPHA_EXPAND		BIT(12)
90462306a36Sopenharmony_ci
90562306a36Sopenharmony_ci#define SCALER5_CTL0_RGB_EXPAND			BIT(11)
90662306a36Sopenharmony_ci
90762306a36Sopenharmony_ci#define SCALER_CTL0_SCL1_MASK			VC4_MASK(10, 8)
90862306a36Sopenharmony_ci#define SCALER_CTL0_SCL1_SHIFT			8
90962306a36Sopenharmony_ci
91062306a36Sopenharmony_ci#define SCALER_CTL0_SCL0_MASK			VC4_MASK(7, 5)
91162306a36Sopenharmony_ci#define SCALER_CTL0_SCL0_SHIFT			5
91262306a36Sopenharmony_ci
91362306a36Sopenharmony_ci#define SCALER_CTL0_SCL_H_PPF_V_PPF		0
91462306a36Sopenharmony_ci#define SCALER_CTL0_SCL_H_TPZ_V_PPF		1
91562306a36Sopenharmony_ci#define SCALER_CTL0_SCL_H_PPF_V_TPZ		2
91662306a36Sopenharmony_ci#define SCALER_CTL0_SCL_H_TPZ_V_TPZ		3
91762306a36Sopenharmony_ci#define SCALER_CTL0_SCL_H_PPF_V_NONE		4
91862306a36Sopenharmony_ci#define SCALER_CTL0_SCL_H_NONE_V_PPF		5
91962306a36Sopenharmony_ci#define SCALER_CTL0_SCL_H_NONE_V_TPZ		6
92062306a36Sopenharmony_ci#define SCALER_CTL0_SCL_H_TPZ_V_NONE		7
92162306a36Sopenharmony_ci
92262306a36Sopenharmony_ci/* Set to indicate no scaling. */
92362306a36Sopenharmony_ci#define SCALER_CTL0_UNITY			BIT(4)
92462306a36Sopenharmony_ci#define SCALER5_CTL0_UNITY			BIT(15)
92562306a36Sopenharmony_ci
92662306a36Sopenharmony_ci#define SCALER_CTL0_PIXEL_FORMAT_MASK		VC4_MASK(3, 0)
92762306a36Sopenharmony_ci#define SCALER_CTL0_PIXEL_FORMAT_SHIFT		0
92862306a36Sopenharmony_ci
92962306a36Sopenharmony_ci#define SCALER5_CTL0_PIXEL_FORMAT_MASK		VC4_MASK(4, 0)
93062306a36Sopenharmony_ci
93162306a36Sopenharmony_ci#define SCALER_POS0_FIXED_ALPHA_MASK		VC4_MASK(31, 24)
93262306a36Sopenharmony_ci#define SCALER_POS0_FIXED_ALPHA_SHIFT		24
93362306a36Sopenharmony_ci
93462306a36Sopenharmony_ci#define SCALER_POS0_START_Y_MASK		VC4_MASK(23, 12)
93562306a36Sopenharmony_ci#define SCALER_POS0_START_Y_SHIFT		12
93662306a36Sopenharmony_ci
93762306a36Sopenharmony_ci#define SCALER_POS0_START_X_MASK		VC4_MASK(11, 0)
93862306a36Sopenharmony_ci#define SCALER_POS0_START_X_SHIFT		0
93962306a36Sopenharmony_ci
94062306a36Sopenharmony_ci#define SCALER5_POS0_START_Y_MASK		VC4_MASK(27, 16)
94162306a36Sopenharmony_ci#define SCALER5_POS0_START_Y_SHIFT		16
94262306a36Sopenharmony_ci
94362306a36Sopenharmony_ci#define SCALER5_POS0_START_X_MASK		VC4_MASK(13, 0)
94462306a36Sopenharmony_ci#define SCALER5_POS0_START_X_SHIFT		0
94562306a36Sopenharmony_ci
94662306a36Sopenharmony_ci#define SCALER5_POS0_VFLIP			BIT(31)
94762306a36Sopenharmony_ci#define SCALER5_POS0_HFLIP			BIT(15)
94862306a36Sopenharmony_ci
94962306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_MODE_MASK		VC4_MASK(31, 30)
95062306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_MODE_SHIFT		30
95162306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_MODE_PIPELINE		0
95262306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_MODE_FIXED		1
95362306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_MODE_FIXED_NONZERO	2
95462306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_MODE_FIXED_OVER_0x07	3
95562306a36Sopenharmony_ci
95662306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_PREMULT		BIT(29)
95762306a36Sopenharmony_ci
95862306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_MIX			BIT(28)
95962306a36Sopenharmony_ci
96062306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_LOC			BIT(25)
96162306a36Sopenharmony_ci
96262306a36Sopenharmony_ci#define SCALER5_CTL2_MAP_SEL_MASK		VC4_MASK(18, 17)
96362306a36Sopenharmony_ci#define SCALER5_CTL2_MAP_SEL_SHIFT		17
96462306a36Sopenharmony_ci
96562306a36Sopenharmony_ci#define SCALER5_CTL2_GAMMA			BIT(16)
96662306a36Sopenharmony_ci
96762306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_MASK			VC4_MASK(15, 4)
96862306a36Sopenharmony_ci#define SCALER5_CTL2_ALPHA_SHIFT		4
96962306a36Sopenharmony_ci
97062306a36Sopenharmony_ci#define SCALER_POS1_SCL_HEIGHT_MASK		VC4_MASK(27, 16)
97162306a36Sopenharmony_ci#define SCALER_POS1_SCL_HEIGHT_SHIFT		16
97262306a36Sopenharmony_ci
97362306a36Sopenharmony_ci#define SCALER_POS1_SCL_WIDTH_MASK		VC4_MASK(11, 0)
97462306a36Sopenharmony_ci#define SCALER_POS1_SCL_WIDTH_SHIFT		0
97562306a36Sopenharmony_ci
97662306a36Sopenharmony_ci#define SCALER5_POS1_SCL_HEIGHT_MASK		VC4_MASK(28, 16)
97762306a36Sopenharmony_ci#define SCALER5_POS1_SCL_HEIGHT_SHIFT		16
97862306a36Sopenharmony_ci
97962306a36Sopenharmony_ci#define SCALER5_POS1_SCL_WIDTH_MASK		VC4_MASK(12, 0)
98062306a36Sopenharmony_ci#define SCALER5_POS1_SCL_WIDTH_SHIFT		0
98162306a36Sopenharmony_ci
98262306a36Sopenharmony_ci#define SCALER_POS2_ALPHA_MODE_MASK		VC4_MASK(31, 30)
98362306a36Sopenharmony_ci#define SCALER_POS2_ALPHA_MODE_SHIFT		30
98462306a36Sopenharmony_ci#define SCALER_POS2_ALPHA_MODE_PIPELINE		0
98562306a36Sopenharmony_ci#define SCALER_POS2_ALPHA_MODE_FIXED		1
98662306a36Sopenharmony_ci#define SCALER_POS2_ALPHA_MODE_FIXED_NONZERO	2
98762306a36Sopenharmony_ci#define SCALER_POS2_ALPHA_MODE_FIXED_OVER_0x07	3
98862306a36Sopenharmony_ci#define SCALER_POS2_ALPHA_PREMULT		BIT(29)
98962306a36Sopenharmony_ci#define SCALER_POS2_ALPHA_MIX			BIT(28)
99062306a36Sopenharmony_ci
99162306a36Sopenharmony_ci#define SCALER_POS2_HEIGHT_MASK			VC4_MASK(27, 16)
99262306a36Sopenharmony_ci#define SCALER_POS2_HEIGHT_SHIFT		16
99362306a36Sopenharmony_ci
99462306a36Sopenharmony_ci#define SCALER_POS2_WIDTH_MASK			VC4_MASK(11, 0)
99562306a36Sopenharmony_ci#define SCALER_POS2_WIDTH_SHIFT			0
99662306a36Sopenharmony_ci
99762306a36Sopenharmony_ci#define SCALER5_POS2_HEIGHT_MASK		VC4_MASK(28, 16)
99862306a36Sopenharmony_ci#define SCALER5_POS2_HEIGHT_SHIFT		16
99962306a36Sopenharmony_ci
100062306a36Sopenharmony_ci#define SCALER5_POS2_WIDTH_MASK			VC4_MASK(12, 0)
100162306a36Sopenharmony_ci#define SCALER5_POS2_WIDTH_SHIFT		0
100262306a36Sopenharmony_ci
100362306a36Sopenharmony_ci/* Color Space Conversion words.  Some values are S2.8 signed
100462306a36Sopenharmony_ci * integers, except that the 2 integer bits map as {0x0: 0, 0x1: 1,
100562306a36Sopenharmony_ci * 0x2: 2, 0x3: -1}
100662306a36Sopenharmony_ci */
100762306a36Sopenharmony_ci/* bottom 8 bits of S2.8 contribution of Cr to Blue */
100862306a36Sopenharmony_ci#define SCALER_CSC0_COEF_CR_BLU_MASK		VC4_MASK(31, 24)
100962306a36Sopenharmony_ci#define SCALER_CSC0_COEF_CR_BLU_SHIFT		24
101062306a36Sopenharmony_ci/* Signed offset to apply to Y before CSC. (Y' = Y + YY_OFS) */
101162306a36Sopenharmony_ci#define SCALER_CSC0_COEF_YY_OFS_MASK		VC4_MASK(23, 16)
101262306a36Sopenharmony_ci#define SCALER_CSC0_COEF_YY_OFS_SHIFT		16
101362306a36Sopenharmony_ci/* Signed offset to apply to CB before CSC (Cb' = Cb - 128 + CB_OFS). */
101462306a36Sopenharmony_ci#define SCALER_CSC0_COEF_CB_OFS_MASK		VC4_MASK(15, 8)
101562306a36Sopenharmony_ci#define SCALER_CSC0_COEF_CB_OFS_SHIFT		8
101662306a36Sopenharmony_ci/* Signed offset to apply to CB before CSC (Cr' = Cr - 128 + CR_OFS). */
101762306a36Sopenharmony_ci#define SCALER_CSC0_COEF_CR_OFS_MASK		VC4_MASK(7, 0)
101862306a36Sopenharmony_ci#define SCALER_CSC0_COEF_CR_OFS_SHIFT		0
101962306a36Sopenharmony_ci#define SCALER_CSC0_ITR_R_601_5			0x00f00000
102062306a36Sopenharmony_ci#define SCALER_CSC0_ITR_R_709_3			0x00f00000
102162306a36Sopenharmony_ci#define SCALER_CSC0_ITR_R_2020			0x00f00000
102262306a36Sopenharmony_ci#define SCALER_CSC0_JPEG_JFIF			0x00000000
102362306a36Sopenharmony_ci#define SCALER_CSC0_ITR_R_709_3_FR		0x00000000
102462306a36Sopenharmony_ci#define SCALER_CSC0_ITR_R_2020_FR		0x00000000
102562306a36Sopenharmony_ci
102662306a36Sopenharmony_ci/* S2.8 contribution of Cb to Green */
102762306a36Sopenharmony_ci#define SCALER_CSC1_COEF_CB_GRN_MASK		VC4_MASK(31, 22)
102862306a36Sopenharmony_ci#define SCALER_CSC1_COEF_CB_GRN_SHIFT		22
102962306a36Sopenharmony_ci/* S2.8 contribution of Cr to Green */
103062306a36Sopenharmony_ci#define SCALER_CSC1_COEF_CR_GRN_MASK		VC4_MASK(21, 12)
103162306a36Sopenharmony_ci#define SCALER_CSC1_COEF_CR_GRN_SHIFT		12
103262306a36Sopenharmony_ci/* S2.8 contribution of Y to all of RGB */
103362306a36Sopenharmony_ci#define SCALER_CSC1_COEF_YY_ALL_MASK		VC4_MASK(11, 2)
103462306a36Sopenharmony_ci#define SCALER_CSC1_COEF_YY_ALL_SHIFT		2
103562306a36Sopenharmony_ci/* top 2 bits of S2.8 contribution of Cr to Blue */
103662306a36Sopenharmony_ci#define SCALER_CSC1_COEF_CR_BLU_MASK		VC4_MASK(1, 0)
103762306a36Sopenharmony_ci#define SCALER_CSC1_COEF_CR_BLU_SHIFT		0
103862306a36Sopenharmony_ci#define SCALER_CSC1_ITR_R_601_5			0xe73304a8
103962306a36Sopenharmony_ci#define SCALER_CSC1_ITR_R_709_3			0xf27784a8
104062306a36Sopenharmony_ci#define SCALER_CSC1_ITR_R_2020			0xf43594a8
104162306a36Sopenharmony_ci#define SCALER_CSC1_JPEG_JFIF			0xea349400
104262306a36Sopenharmony_ci#define SCALER_CSC1_ITR_R_709_3_FR		0xf4388400
104362306a36Sopenharmony_ci#define SCALER_CSC1_ITR_R_2020_FR		0xf5b6d400
104462306a36Sopenharmony_ci
104562306a36Sopenharmony_ci/* S2.8 contribution of Cb to Red */
104662306a36Sopenharmony_ci#define SCALER_CSC2_COEF_CB_RED_MASK		VC4_MASK(29, 20)
104762306a36Sopenharmony_ci#define SCALER_CSC2_COEF_CB_RED_SHIFT		20
104862306a36Sopenharmony_ci/* S2.8 contribution of Cr to Red */
104962306a36Sopenharmony_ci#define SCALER_CSC2_COEF_CR_RED_MASK		VC4_MASK(19, 10)
105062306a36Sopenharmony_ci#define SCALER_CSC2_COEF_CR_RED_SHIFT		10
105162306a36Sopenharmony_ci/* S2.8 contribution of Cb to Blue */
105262306a36Sopenharmony_ci#define SCALER_CSC2_COEF_CB_BLU_MASK		VC4_MASK(19, 10)
105362306a36Sopenharmony_ci#define SCALER_CSC2_COEF_CB_BLU_SHIFT		10
105462306a36Sopenharmony_ci#define SCALER_CSC2_ITR_R_601_5			0x00066604
105562306a36Sopenharmony_ci#define SCALER_CSC2_ITR_R_709_3			0x00072e1d
105662306a36Sopenharmony_ci#define SCALER_CSC2_ITR_R_2020			0x0006b624
105762306a36Sopenharmony_ci#define SCALER_CSC2_JPEG_JFIF			0x00059dc6
105862306a36Sopenharmony_ci#define SCALER_CSC2_ITR_R_709_3_FR		0x00064ddb
105962306a36Sopenharmony_ci#define SCALER_CSC2_ITR_R_2020_FR		0x0005e5e2
106062306a36Sopenharmony_ci
106162306a36Sopenharmony_ci#define SCALER_TPZ0_VERT_RECALC			BIT(31)
106262306a36Sopenharmony_ci#define SCALER_TPZ0_SCALE_MASK			VC4_MASK(28, 8)
106362306a36Sopenharmony_ci#define SCALER_TPZ0_SCALE_SHIFT			8
106462306a36Sopenharmony_ci#define SCALER_TPZ0_IPHASE_MASK			VC4_MASK(7, 0)
106562306a36Sopenharmony_ci#define SCALER_TPZ0_IPHASE_SHIFT		0
106662306a36Sopenharmony_ci#define SCALER_TPZ1_RECIP_MASK			VC4_MASK(15, 0)
106762306a36Sopenharmony_ci#define SCALER_TPZ1_RECIP_SHIFT			0
106862306a36Sopenharmony_ci
106962306a36Sopenharmony_ci/* Skips interpolating coefficients to 64 phases, so just 8 are used.
107062306a36Sopenharmony_ci * Required for nearest neighbor.
107162306a36Sopenharmony_ci */
107262306a36Sopenharmony_ci#define SCALER_PPF_NOINTERP			BIT(31)
107362306a36Sopenharmony_ci/* Replaes the highest valued coefficient with one that makes all 4
107462306a36Sopenharmony_ci * sum to unity.
107562306a36Sopenharmony_ci */
107662306a36Sopenharmony_ci#define SCALER_PPF_AGC				BIT(30)
107762306a36Sopenharmony_ci#define SCALER_PPF_SCALE_MASK			VC4_MASK(24, 8)
107862306a36Sopenharmony_ci#define SCALER_PPF_SCALE_SHIFT			8
107962306a36Sopenharmony_ci#define SCALER_PPF_IPHASE_MASK			VC4_MASK(6, 0)
108062306a36Sopenharmony_ci#define SCALER_PPF_IPHASE_SHIFT			0
108162306a36Sopenharmony_ci
108262306a36Sopenharmony_ci#define SCALER_PPF_KERNEL_OFFSET_MASK		VC4_MASK(13, 0)
108362306a36Sopenharmony_ci#define SCALER_PPF_KERNEL_OFFSET_SHIFT		0
108462306a36Sopenharmony_ci#define SCALER_PPF_KERNEL_UNCACHED		BIT(31)
108562306a36Sopenharmony_ci
108662306a36Sopenharmony_ci/* PITCH0/1/2 fields for raster. */
108762306a36Sopenharmony_ci#define SCALER_SRC_PITCH_MASK			VC4_MASK(15, 0)
108862306a36Sopenharmony_ci#define SCALER_SRC_PITCH_SHIFT			0
108962306a36Sopenharmony_ci
109062306a36Sopenharmony_ci/* PITCH0/1/2 fields for tiled (SAND). */
109162306a36Sopenharmony_ci#define SCALER_TILE_SKIP_0_MASK			VC4_MASK(18, 16)
109262306a36Sopenharmony_ci#define SCALER_TILE_SKIP_0_SHIFT		16
109362306a36Sopenharmony_ci#define SCALER_TILE_HEIGHT_MASK			VC4_MASK(15, 0)
109462306a36Sopenharmony_ci#define SCALER_TILE_HEIGHT_SHIFT		0
109562306a36Sopenharmony_ci
109662306a36Sopenharmony_ci/* Common PITCH0 fields */
109762306a36Sopenharmony_ci#define SCALER_PITCH0_SINK_PIX_MASK		VC4_MASK(31, 26)
109862306a36Sopenharmony_ci#define SCALER_PITCH0_SINK_PIX_SHIFT		26
109962306a36Sopenharmony_ci
110062306a36Sopenharmony_ci/* PITCH0 fields for T-tiled. */
110162306a36Sopenharmony_ci#define SCALER_PITCH0_TILE_WIDTH_L_MASK		VC4_MASK(22, 16)
110262306a36Sopenharmony_ci#define SCALER_PITCH0_TILE_WIDTH_L_SHIFT	16
110362306a36Sopenharmony_ci#define SCALER_PITCH0_TILE_LINE_DIR		BIT(15)
110462306a36Sopenharmony_ci#define SCALER_PITCH0_TILE_INITIAL_LINE_DIR	BIT(14)
110562306a36Sopenharmony_ci/* Y offset within a tile. */
110662306a36Sopenharmony_ci#define SCALER_PITCH0_TILE_Y_OFFSET_MASK	VC4_MASK(13, 8)
110762306a36Sopenharmony_ci#define SCALER_PITCH0_TILE_Y_OFFSET_SHIFT	8
110862306a36Sopenharmony_ci#define SCALER_PITCH0_TILE_WIDTH_R_MASK		VC4_MASK(6, 0)
110962306a36Sopenharmony_ci#define SCALER_PITCH0_TILE_WIDTH_R_SHIFT	0
111062306a36Sopenharmony_ci
111162306a36Sopenharmony_ci#endif /* VC4_REGS_H */
1112