18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2009, Intel Corporation.
48c2ecf20Sopenharmony_ci */
58c2ecf20Sopenharmony_ci#ifndef __PSB_INTEL_REG_H__
68c2ecf20Sopenharmony_ci#define __PSB_INTEL_REG_H__
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci/*
98c2ecf20Sopenharmony_ci * GPIO regs
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci#define GPIOA			0x5010
128c2ecf20Sopenharmony_ci#define GPIOB			0x5014
138c2ecf20Sopenharmony_ci#define GPIOC			0x5018
148c2ecf20Sopenharmony_ci#define GPIOD			0x501c
158c2ecf20Sopenharmony_ci#define GPIOE			0x5020
168c2ecf20Sopenharmony_ci#define GPIOF			0x5024
178c2ecf20Sopenharmony_ci#define GPIOG			0x5028
188c2ecf20Sopenharmony_ci#define GPIOH			0x502c
198c2ecf20Sopenharmony_ci# define GPIO_CLOCK_DIR_MASK		(1 << 0)
208c2ecf20Sopenharmony_ci# define GPIO_CLOCK_DIR_IN		(0 << 1)
218c2ecf20Sopenharmony_ci# define GPIO_CLOCK_DIR_OUT		(1 << 1)
228c2ecf20Sopenharmony_ci# define GPIO_CLOCK_VAL_MASK		(1 << 2)
238c2ecf20Sopenharmony_ci# define GPIO_CLOCK_VAL_OUT		(1 << 3)
248c2ecf20Sopenharmony_ci# define GPIO_CLOCK_VAL_IN		(1 << 4)
258c2ecf20Sopenharmony_ci# define GPIO_CLOCK_PULLUP_DISABLE	(1 << 5)
268c2ecf20Sopenharmony_ci# define GPIO_DATA_DIR_MASK		(1 << 8)
278c2ecf20Sopenharmony_ci# define GPIO_DATA_DIR_IN		(0 << 9)
288c2ecf20Sopenharmony_ci# define GPIO_DATA_DIR_OUT		(1 << 9)
298c2ecf20Sopenharmony_ci# define GPIO_DATA_VAL_MASK		(1 << 10)
308c2ecf20Sopenharmony_ci# define GPIO_DATA_VAL_OUT		(1 << 11)
318c2ecf20Sopenharmony_ci# define GPIO_DATA_VAL_IN		(1 << 12)
328c2ecf20Sopenharmony_ci# define GPIO_DATA_PULLUP_DISABLE	(1 << 13)
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#define GMBUS0			0x5100 /* clock/port select */
358c2ecf20Sopenharmony_ci#define   GMBUS_RATE_100KHZ	(0<<8)
368c2ecf20Sopenharmony_ci#define   GMBUS_RATE_50KHZ	(1<<8)
378c2ecf20Sopenharmony_ci#define   GMBUS_RATE_400KHZ	(2<<8) /* reserved on Pineview */
388c2ecf20Sopenharmony_ci#define   GMBUS_RATE_1MHZ	(3<<8) /* reserved on Pineview */
398c2ecf20Sopenharmony_ci#define   GMBUS_HOLD_EXT	(1<<7) /* 300ns hold time, rsvd on Pineview */
408c2ecf20Sopenharmony_ci#define   GMBUS_PORT_DISABLED	0
418c2ecf20Sopenharmony_ci#define   GMBUS_PORT_SSC	1
428c2ecf20Sopenharmony_ci#define   GMBUS_PORT_VGADDC	2
438c2ecf20Sopenharmony_ci#define   GMBUS_PORT_PANEL	3
448c2ecf20Sopenharmony_ci#define   GMBUS_PORT_DPC	4 /* HDMIC */
458c2ecf20Sopenharmony_ci#define   GMBUS_PORT_DPB	5 /* SDVO, HDMIB */
468c2ecf20Sopenharmony_ci				  /* 6 reserved */
478c2ecf20Sopenharmony_ci#define   GMBUS_PORT_DPD	7 /* HDMID */
488c2ecf20Sopenharmony_ci#define   GMBUS_NUM_PORTS       8
498c2ecf20Sopenharmony_ci#define GMBUS1			0x5104 /* command/status */
508c2ecf20Sopenharmony_ci#define   GMBUS_SW_CLR_INT	(1<<31)
518c2ecf20Sopenharmony_ci#define   GMBUS_SW_RDY		(1<<30)
528c2ecf20Sopenharmony_ci#define   GMBUS_ENT		(1<<29) /* enable timeout */
538c2ecf20Sopenharmony_ci#define   GMBUS_CYCLE_NONE	(0<<25)
548c2ecf20Sopenharmony_ci#define   GMBUS_CYCLE_WAIT	(1<<25)
558c2ecf20Sopenharmony_ci#define   GMBUS_CYCLE_INDEX	(2<<25)
568c2ecf20Sopenharmony_ci#define   GMBUS_CYCLE_STOP	(4<<25)
578c2ecf20Sopenharmony_ci#define   GMBUS_BYTE_COUNT_SHIFT 16
588c2ecf20Sopenharmony_ci#define   GMBUS_SLAVE_INDEX_SHIFT 8
598c2ecf20Sopenharmony_ci#define   GMBUS_SLAVE_ADDR_SHIFT 1
608c2ecf20Sopenharmony_ci#define   GMBUS_SLAVE_READ	(1<<0)
618c2ecf20Sopenharmony_ci#define   GMBUS_SLAVE_WRITE	(0<<0)
628c2ecf20Sopenharmony_ci#define GMBUS2			0x5108 /* status */
638c2ecf20Sopenharmony_ci#define   GMBUS_INUSE		(1<<15)
648c2ecf20Sopenharmony_ci#define   GMBUS_HW_WAIT_PHASE	(1<<14)
658c2ecf20Sopenharmony_ci#define   GMBUS_STALL_TIMEOUT	(1<<13)
668c2ecf20Sopenharmony_ci#define   GMBUS_INT		(1<<12)
678c2ecf20Sopenharmony_ci#define   GMBUS_HW_RDY		(1<<11)
688c2ecf20Sopenharmony_ci#define   GMBUS_SATOER		(1<<10)
698c2ecf20Sopenharmony_ci#define   GMBUS_ACTIVE		(1<<9)
708c2ecf20Sopenharmony_ci#define GMBUS3			0x510c /* data buffer bytes 3-0 */
718c2ecf20Sopenharmony_ci#define GMBUS4			0x5110 /* interrupt mask (Pineview+) */
728c2ecf20Sopenharmony_ci#define   GMBUS_SLAVE_TIMEOUT_EN (1<<4)
738c2ecf20Sopenharmony_ci#define   GMBUS_NAK_EN		(1<<3)
748c2ecf20Sopenharmony_ci#define   GMBUS_IDLE_EN		(1<<2)
758c2ecf20Sopenharmony_ci#define   GMBUS_HW_WAIT_EN	(1<<1)
768c2ecf20Sopenharmony_ci#define   GMBUS_HW_RDY_EN	(1<<0)
778c2ecf20Sopenharmony_ci#define GMBUS5			0x5120 /* byte index */
788c2ecf20Sopenharmony_ci#define   GMBUS_2BYTE_INDEX_EN	(1<<31)
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci#define BLC_PWM_CTL		0x61254
818c2ecf20Sopenharmony_ci#define BLC_PWM_CTL2		0x61250
828c2ecf20Sopenharmony_ci#define  PWM_ENABLE		(1 << 31)
838c2ecf20Sopenharmony_ci#define  PWM_LEGACY_MODE	(1 << 30)
848c2ecf20Sopenharmony_ci#define  PWM_PIPE_B		(1 << 29)
858c2ecf20Sopenharmony_ci#define BLC_PWM_CTL_C		0x62254
868c2ecf20Sopenharmony_ci#define BLC_PWM_CTL2_C		0x62250
878c2ecf20Sopenharmony_ci#define BACKLIGHT_MODULATION_FREQ_SHIFT		(17)
888c2ecf20Sopenharmony_ci/*
898c2ecf20Sopenharmony_ci * This is the most significant 15 bits of the number of backlight cycles in a
908c2ecf20Sopenharmony_ci * complete cycle of the modulated backlight control.
918c2ecf20Sopenharmony_ci *
928c2ecf20Sopenharmony_ci * The actual value is this field multiplied by two.
938c2ecf20Sopenharmony_ci */
948c2ecf20Sopenharmony_ci#define BACKLIGHT_MODULATION_FREQ_MASK	(0x7fff << 17)
958c2ecf20Sopenharmony_ci#define BLM_LEGACY_MODE			(1 << 16)
968c2ecf20Sopenharmony_ci/*
978c2ecf20Sopenharmony_ci * This is the number of cycles out of the backlight modulation cycle for which
988c2ecf20Sopenharmony_ci * the backlight is on.
998c2ecf20Sopenharmony_ci *
1008c2ecf20Sopenharmony_ci * This field must be no greater than the number of cycles in the complete
1018c2ecf20Sopenharmony_ci * backlight modulation cycle.
1028c2ecf20Sopenharmony_ci */
1038c2ecf20Sopenharmony_ci#define BACKLIGHT_DUTY_CYCLE_SHIFT	(0)
1048c2ecf20Sopenharmony_ci#define BACKLIGHT_DUTY_CYCLE_MASK	(0xffff)
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci#define I915_GCFGC			0xf0
1078c2ecf20Sopenharmony_ci#define I915_LOW_FREQUENCY_ENABLE	(1 << 7)
1088c2ecf20Sopenharmony_ci#define I915_DISPLAY_CLOCK_190_200_MHZ	(0 << 4)
1098c2ecf20Sopenharmony_ci#define I915_DISPLAY_CLOCK_333_MHZ	(4 << 4)
1108c2ecf20Sopenharmony_ci#define I915_DISPLAY_CLOCK_MASK		(7 << 4)
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci#define I855_HPLLCC			0xc0
1138c2ecf20Sopenharmony_ci#define I855_CLOCK_CONTROL_MASK		(3 << 0)
1148c2ecf20Sopenharmony_ci#define I855_CLOCK_133_200		(0 << 0)
1158c2ecf20Sopenharmony_ci#define I855_CLOCK_100_200		(1 << 0)
1168c2ecf20Sopenharmony_ci#define I855_CLOCK_100_133		(2 << 0)
1178c2ecf20Sopenharmony_ci#define I855_CLOCK_166_250		(3 << 0)
1188c2ecf20Sopenharmony_ci
1198c2ecf20Sopenharmony_ci/* I830 CRTC registers */
1208c2ecf20Sopenharmony_ci#define HTOTAL_A		0x60000
1218c2ecf20Sopenharmony_ci#define HBLANK_A		0x60004
1228c2ecf20Sopenharmony_ci#define HSYNC_A			0x60008
1238c2ecf20Sopenharmony_ci#define VTOTAL_A		0x6000c
1248c2ecf20Sopenharmony_ci#define VBLANK_A		0x60010
1258c2ecf20Sopenharmony_ci#define VSYNC_A			0x60014
1268c2ecf20Sopenharmony_ci#define PIPEASRC		0x6001c
1278c2ecf20Sopenharmony_ci#define BCLRPAT_A		0x60020
1288c2ecf20Sopenharmony_ci#define VSYNCSHIFT_A		0x60028
1298c2ecf20Sopenharmony_ci
1308c2ecf20Sopenharmony_ci#define HTOTAL_B		0x61000
1318c2ecf20Sopenharmony_ci#define HBLANK_B		0x61004
1328c2ecf20Sopenharmony_ci#define HSYNC_B			0x61008
1338c2ecf20Sopenharmony_ci#define VTOTAL_B		0x6100c
1348c2ecf20Sopenharmony_ci#define VBLANK_B		0x61010
1358c2ecf20Sopenharmony_ci#define VSYNC_B			0x61014
1368c2ecf20Sopenharmony_ci#define PIPEBSRC		0x6101c
1378c2ecf20Sopenharmony_ci#define BCLRPAT_B		0x61020
1388c2ecf20Sopenharmony_ci#define VSYNCSHIFT_B		0x61028
1398c2ecf20Sopenharmony_ci
1408c2ecf20Sopenharmony_ci#define HTOTAL_C		0x62000
1418c2ecf20Sopenharmony_ci#define HBLANK_C		0x62004
1428c2ecf20Sopenharmony_ci#define HSYNC_C			0x62008
1438c2ecf20Sopenharmony_ci#define VTOTAL_C		0x6200c
1448c2ecf20Sopenharmony_ci#define VBLANK_C		0x62010
1458c2ecf20Sopenharmony_ci#define VSYNC_C			0x62014
1468c2ecf20Sopenharmony_ci#define PIPECSRC		0x6201c
1478c2ecf20Sopenharmony_ci#define BCLRPAT_C		0x62020
1488c2ecf20Sopenharmony_ci#define VSYNCSHIFT_C		0x62028
1498c2ecf20Sopenharmony_ci
1508c2ecf20Sopenharmony_ci#define PP_STATUS		0x61200
1518c2ecf20Sopenharmony_ci# define PP_ON				(1 << 31)
1528c2ecf20Sopenharmony_ci/*
1538c2ecf20Sopenharmony_ci * Indicates that all dependencies of the panel are on:
1548c2ecf20Sopenharmony_ci *
1558c2ecf20Sopenharmony_ci * - PLL enabled
1568c2ecf20Sopenharmony_ci * - pipe enabled
1578c2ecf20Sopenharmony_ci * - LVDS/DVOB/DVOC on
1588c2ecf20Sopenharmony_ci */
1598c2ecf20Sopenharmony_ci#define PP_READY			(1 << 30)
1608c2ecf20Sopenharmony_ci#define PP_SEQUENCE_NONE		(0 << 28)
1618c2ecf20Sopenharmony_ci#define PP_SEQUENCE_ON			(1 << 28)
1628c2ecf20Sopenharmony_ci#define PP_SEQUENCE_OFF			(2 << 28)
1638c2ecf20Sopenharmony_ci#define PP_SEQUENCE_MASK		0x30000000
1648c2ecf20Sopenharmony_ci#define	PP_CYCLE_DELAY_ACTIVE		(1 << 27)
1658c2ecf20Sopenharmony_ci#define	PP_SEQUENCE_STATE_ON_IDLE	(1 << 3)
1668c2ecf20Sopenharmony_ci#define	PP_SEQUENCE_STATE_MASK		0x0000000f
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#define PP_CONTROL		0x61204
1698c2ecf20Sopenharmony_ci#define POWER_TARGET_ON			(1 << 0)
1708c2ecf20Sopenharmony_ci#define	PANEL_UNLOCK_REGS		(0xabcd << 16)
1718c2ecf20Sopenharmony_ci#define	PANEL_UNLOCK_MASK		(0xffff << 16)
1728c2ecf20Sopenharmony_ci#define	EDP_FORCE_VDD			(1 << 3)
1738c2ecf20Sopenharmony_ci#define	EDP_BLC_ENABLE			(1 << 2)
1748c2ecf20Sopenharmony_ci#define	PANEL_POWER_RESET		(1 << 1)
1758c2ecf20Sopenharmony_ci#define	PANEL_POWER_OFF			(0 << 0)
1768c2ecf20Sopenharmony_ci#define	PANEL_POWER_ON			(1 << 0)
1778c2ecf20Sopenharmony_ci
1788c2ecf20Sopenharmony_ci/* Poulsbo/Oaktrail */
1798c2ecf20Sopenharmony_ci#define LVDSPP_ON		0x61208
1808c2ecf20Sopenharmony_ci#define LVDSPP_OFF		0x6120c
1818c2ecf20Sopenharmony_ci#define PP_CYCLE		0x61210
1828c2ecf20Sopenharmony_ci
1838c2ecf20Sopenharmony_ci/* Cedartrail */
1848c2ecf20Sopenharmony_ci#define PP_ON_DELAYS		0x61208		/* Cedartrail */
1858c2ecf20Sopenharmony_ci#define PANEL_PORT_SELECT_MASK 		(3 << 30)
1868c2ecf20Sopenharmony_ci#define PANEL_PORT_SELECT_LVDS 		(0 << 30)
1878c2ecf20Sopenharmony_ci#define PANEL_PORT_SELECT_EDP		(1 << 30)
1888c2ecf20Sopenharmony_ci#define PANEL_POWER_UP_DELAY_MASK	(0x1fff0000)
1898c2ecf20Sopenharmony_ci#define PANEL_POWER_UP_DELAY_SHIFT	16
1908c2ecf20Sopenharmony_ci#define PANEL_LIGHT_ON_DELAY_MASK	(0x1fff)
1918c2ecf20Sopenharmony_ci#define PANEL_LIGHT_ON_DELAY_SHIFT	0
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci#define PP_OFF_DELAYS		0x6120c		/* Cedartrail */
1948c2ecf20Sopenharmony_ci#define PANEL_POWER_DOWN_DELAY_MASK	(0x1fff0000)
1958c2ecf20Sopenharmony_ci#define PANEL_POWER_DOWN_DELAY_SHIFT	16
1968c2ecf20Sopenharmony_ci#define PANEL_LIGHT_OFF_DELAY_MASK	(0x1fff)
1978c2ecf20Sopenharmony_ci#define PANEL_LIGHT_OFF_DELAY_SHIFT	0
1988c2ecf20Sopenharmony_ci
1998c2ecf20Sopenharmony_ci#define PP_DIVISOR		0x61210		/* Cedartrail */
2008c2ecf20Sopenharmony_ci#define  PP_REFERENCE_DIVIDER_MASK	(0xffffff00)
2018c2ecf20Sopenharmony_ci#define  PP_REFERENCE_DIVIDER_SHIFT	8
2028c2ecf20Sopenharmony_ci#define  PANEL_POWER_CYCLE_DELAY_MASK	(0x1f)
2038c2ecf20Sopenharmony_ci#define  PANEL_POWER_CYCLE_DELAY_SHIFT	0
2048c2ecf20Sopenharmony_ci
2058c2ecf20Sopenharmony_ci#define PFIT_CONTROL		0x61230
2068c2ecf20Sopenharmony_ci#define PFIT_ENABLE			(1 << 31)
2078c2ecf20Sopenharmony_ci#define PFIT_PIPE_MASK			(3 << 29)
2088c2ecf20Sopenharmony_ci#define PFIT_PIPE_SHIFT			29
2098c2ecf20Sopenharmony_ci#define PFIT_SCALING_MODE_PILLARBOX	(1 << 27)
2108c2ecf20Sopenharmony_ci#define PFIT_SCALING_MODE_LETTERBOX	(3 << 26)
2118c2ecf20Sopenharmony_ci#define VERT_INTERP_DISABLE		(0 << 10)
2128c2ecf20Sopenharmony_ci#define VERT_INTERP_BILINEAR		(1 << 10)
2138c2ecf20Sopenharmony_ci#define VERT_INTERP_MASK		(3 << 10)
2148c2ecf20Sopenharmony_ci#define VERT_AUTO_SCALE			(1 << 9)
2158c2ecf20Sopenharmony_ci#define HORIZ_INTERP_DISABLE		(0 << 6)
2168c2ecf20Sopenharmony_ci#define HORIZ_INTERP_BILINEAR		(1 << 6)
2178c2ecf20Sopenharmony_ci#define HORIZ_INTERP_MASK		(3 << 6)
2188c2ecf20Sopenharmony_ci#define HORIZ_AUTO_SCALE		(1 << 5)
2198c2ecf20Sopenharmony_ci#define PANEL_8TO6_DITHER_ENABLE	(1 << 3)
2208c2ecf20Sopenharmony_ci
2218c2ecf20Sopenharmony_ci#define PFIT_PGM_RATIOS		0x61234
2228c2ecf20Sopenharmony_ci#define PFIT_VERT_SCALE_MASK			0xfff00000
2238c2ecf20Sopenharmony_ci#define PFIT_HORIZ_SCALE_MASK			0x0000fff0
2248c2ecf20Sopenharmony_ci
2258c2ecf20Sopenharmony_ci#define PFIT_AUTO_RATIOS	0x61238
2268c2ecf20Sopenharmony_ci
2278c2ecf20Sopenharmony_ci#define DPLL_A			0x06014
2288c2ecf20Sopenharmony_ci#define DPLL_B			0x06018
2298c2ecf20Sopenharmony_ci#define DPLL_VCO_ENABLE			(1 << 31)
2308c2ecf20Sopenharmony_ci#define DPLL_DVO_HIGH_SPEED		(1 << 30)
2318c2ecf20Sopenharmony_ci#define DPLL_SYNCLOCK_ENABLE		(1 << 29)
2328c2ecf20Sopenharmony_ci#define DPLL_VGA_MODE_DIS		(1 << 28)
2338c2ecf20Sopenharmony_ci#define DPLLB_MODE_DAC_SERIAL		(1 << 26)	/* i915 */
2348c2ecf20Sopenharmony_ci#define DPLLB_MODE_LVDS			(2 << 26)	/* i915 */
2358c2ecf20Sopenharmony_ci#define DPLL_MODE_MASK			(3 << 26)
2368c2ecf20Sopenharmony_ci#define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10	(0 << 24)	/* i915 */
2378c2ecf20Sopenharmony_ci#define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5	(1 << 24)	/* i915 */
2388c2ecf20Sopenharmony_ci#define DPLLB_LVDS_P2_CLOCK_DIV_14	(0 << 24)	/* i915 */
2398c2ecf20Sopenharmony_ci#define DPLLB_LVDS_P2_CLOCK_DIV_7	(1 << 24)	/* i915 */
2408c2ecf20Sopenharmony_ci#define DPLL_P2_CLOCK_DIV_MASK		0x03000000	/* i915 */
2418c2ecf20Sopenharmony_ci#define DPLL_FPA0h1_P1_POST_DIV_MASK	0x00ff0000	/* i915 */
2428c2ecf20Sopenharmony_ci#define DPLL_LOCK			(1 << 15)	/* CDV */
2438c2ecf20Sopenharmony_ci
2448c2ecf20Sopenharmony_ci/*
2458c2ecf20Sopenharmony_ci *  The i830 generation, in DAC/serial mode, defines p1 as two plus this
2468c2ecf20Sopenharmony_ci * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
2478c2ecf20Sopenharmony_ci */
2488c2ecf20Sopenharmony_ci# define DPLL_FPA01_P1_POST_DIV_MASK_I830	0x001f0000
2498c2ecf20Sopenharmony_ci/*
2508c2ecf20Sopenharmony_ci * The i830 generation, in LVDS mode, defines P1 as the bit number set within
2518c2ecf20Sopenharmony_ci * this field (only one bit may be set).
2528c2ecf20Sopenharmony_ci */
2538c2ecf20Sopenharmony_ci#define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS	0x003f0000
2548c2ecf20Sopenharmony_ci#define DPLL_FPA01_P1_POST_DIV_SHIFT	16
2558c2ecf20Sopenharmony_ci#define PLL_P2_DIVIDE_BY_4		(1 << 23)	/* i830, required
2568c2ecf20Sopenharmony_ci							 * in DVO non-gang */
2578c2ecf20Sopenharmony_ci# define PLL_P1_DIVIDE_BY_TWO		(1 << 21)	/* i830 */
2588c2ecf20Sopenharmony_ci#define PLL_REF_INPUT_DREFCLK		(0 << 13)
2598c2ecf20Sopenharmony_ci#define PLL_REF_INPUT_TVCLKINA		(1 << 13)	/* i830 */
2608c2ecf20Sopenharmony_ci#define PLL_REF_INPUT_TVCLKINBC		(2 << 13)	/* SDVO
2618c2ecf20Sopenharmony_ci								 * TVCLKIN */
2628c2ecf20Sopenharmony_ci#define PLLB_REF_INPUT_SPREADSPECTRUMIN	(3 << 13)
2638c2ecf20Sopenharmony_ci#define PLL_REF_INPUT_MASK		(3 << 13)
2648c2ecf20Sopenharmony_ci#define PLL_LOAD_PULSE_PHASE_SHIFT	9
2658c2ecf20Sopenharmony_ci/*
2668c2ecf20Sopenharmony_ci * Parallel to Serial Load Pulse phase selection.
2678c2ecf20Sopenharmony_ci * Selects the phase for the 10X DPLL clock for the PCIe
2688c2ecf20Sopenharmony_ci * digital display port. The range is 4 to 13; 10 or more
2698c2ecf20Sopenharmony_ci * is just a flip delay. The default is 6
2708c2ecf20Sopenharmony_ci */
2718c2ecf20Sopenharmony_ci#define PLL_LOAD_PULSE_PHASE_MASK	(0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
2728c2ecf20Sopenharmony_ci#define DISPLAY_RATE_SELECT_FPA1	(1 << 8)
2738c2ecf20Sopenharmony_ci
2748c2ecf20Sopenharmony_ci/*
2758c2ecf20Sopenharmony_ci * SDVO multiplier for 945G/GM. Not used on 965.
2768c2ecf20Sopenharmony_ci *
2778c2ecf20Sopenharmony_ci * DPLL_MD_UDI_MULTIPLIER_MASK
2788c2ecf20Sopenharmony_ci */
2798c2ecf20Sopenharmony_ci#define SDVO_MULTIPLIER_MASK		0x000000ff
2808c2ecf20Sopenharmony_ci#define SDVO_MULTIPLIER_SHIFT_HIRES	4
2818c2ecf20Sopenharmony_ci#define SDVO_MULTIPLIER_SHIFT_VGA	0
2828c2ecf20Sopenharmony_ci
2838c2ecf20Sopenharmony_ci/*
2848c2ecf20Sopenharmony_ci * PLL_MD
2858c2ecf20Sopenharmony_ci */
2868c2ecf20Sopenharmony_ci/* Pipe A SDVO/UDI clock multiplier/divider register for G965. */
2878c2ecf20Sopenharmony_ci#define DPLL_A_MD		0x0601c
2888c2ecf20Sopenharmony_ci/* Pipe B SDVO/UDI clock multiplier/divider register for G965. */
2898c2ecf20Sopenharmony_ci#define DPLL_B_MD		0x06020
2908c2ecf20Sopenharmony_ci/*
2918c2ecf20Sopenharmony_ci * UDI pixel divider, controlling how many pixels are stuffed into a packet.
2928c2ecf20Sopenharmony_ci *
2938c2ecf20Sopenharmony_ci * Value is pixels minus 1.  Must be set to 1 pixel for SDVO.
2948c2ecf20Sopenharmony_ci */
2958c2ecf20Sopenharmony_ci#define DPLL_MD_UDI_DIVIDER_MASK	0x3f000000
2968c2ecf20Sopenharmony_ci#define DPLL_MD_UDI_DIVIDER_SHIFT	24
2978c2ecf20Sopenharmony_ci/* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
2988c2ecf20Sopenharmony_ci#define DPLL_MD_VGA_UDI_DIVIDER_MASK	0x003f0000
2998c2ecf20Sopenharmony_ci#define DPLL_MD_VGA_UDI_DIVIDER_SHIFT	16
3008c2ecf20Sopenharmony_ci/*
3018c2ecf20Sopenharmony_ci * SDVO/UDI pixel multiplier.
3028c2ecf20Sopenharmony_ci *
3038c2ecf20Sopenharmony_ci * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
3048c2ecf20Sopenharmony_ci * clock rate is 10 times the DPLL clock.  At low resolution/refresh rate
3058c2ecf20Sopenharmony_ci * modes, the bus rate would be below the limits, so SDVO allows for stuffing
3068c2ecf20Sopenharmony_ci * dummy bytes in the datastream at an increased clock rate, with both sides of
3078c2ecf20Sopenharmony_ci * the link knowing how many bytes are fill.
3088c2ecf20Sopenharmony_ci *
3098c2ecf20Sopenharmony_ci * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
3108c2ecf20Sopenharmony_ci * rate to 130Mhz to get a bus rate of 1.30Ghz.  The DPLL clock rate would be
3118c2ecf20Sopenharmony_ci * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
3128c2ecf20Sopenharmony_ci * through an SDVO command.
3138c2ecf20Sopenharmony_ci *
3148c2ecf20Sopenharmony_ci * This register field has values of multiplication factor minus 1, with
3158c2ecf20Sopenharmony_ci * a maximum multiplier of 5 for SDVO.
3168c2ecf20Sopenharmony_ci */
3178c2ecf20Sopenharmony_ci#define DPLL_MD_UDI_MULTIPLIER_MASK	0x00003f00
3188c2ecf20Sopenharmony_ci#define DPLL_MD_UDI_MULTIPLIER_SHIFT	8
3198c2ecf20Sopenharmony_ci/*
3208c2ecf20Sopenharmony_ci * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
3218c2ecf20Sopenharmony_ci * This best be set to the default value (3) or the CRT won't work. No,
3228c2ecf20Sopenharmony_ci * I don't entirely understand what this does...
3238c2ecf20Sopenharmony_ci */
3248c2ecf20Sopenharmony_ci#define DPLL_MD_VGA_UDI_MULTIPLIER_MASK	0x0000003f
3258c2ecf20Sopenharmony_ci#define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
3268c2ecf20Sopenharmony_ci
3278c2ecf20Sopenharmony_ci#define DPLL_TEST		0x606c
3288c2ecf20Sopenharmony_ci#define DPLLB_TEST_SDVO_DIV_1		(0 << 22)
3298c2ecf20Sopenharmony_ci#define DPLLB_TEST_SDVO_DIV_2		(1 << 22)
3308c2ecf20Sopenharmony_ci#define DPLLB_TEST_SDVO_DIV_4		(2 << 22)
3318c2ecf20Sopenharmony_ci#define DPLLB_TEST_SDVO_DIV_MASK	(3 << 22)
3328c2ecf20Sopenharmony_ci#define DPLLB_TEST_N_BYPASS		(1 << 19)
3338c2ecf20Sopenharmony_ci#define DPLLB_TEST_M_BYPASS		(1 << 18)
3348c2ecf20Sopenharmony_ci#define DPLLB_INPUT_BUFFER_ENABLE	(1 << 16)
3358c2ecf20Sopenharmony_ci#define DPLLA_TEST_N_BYPASS		(1 << 3)
3368c2ecf20Sopenharmony_ci#define DPLLA_TEST_M_BYPASS		(1 << 2)
3378c2ecf20Sopenharmony_ci#define DPLLA_INPUT_BUFFER_ENABLE	(1 << 0)
3388c2ecf20Sopenharmony_ci
3398c2ecf20Sopenharmony_ci#define ADPA			0x61100
3408c2ecf20Sopenharmony_ci#define ADPA_DAC_ENABLE			(1 << 31)
3418c2ecf20Sopenharmony_ci#define ADPA_DAC_DISABLE		0
3428c2ecf20Sopenharmony_ci#define ADPA_PIPE_SELECT_MASK		(1 << 30)
3438c2ecf20Sopenharmony_ci#define ADPA_PIPE_A_SELECT		0
3448c2ecf20Sopenharmony_ci#define ADPA_PIPE_B_SELECT		(1 << 30)
3458c2ecf20Sopenharmony_ci#define ADPA_USE_VGA_HVPOLARITY		(1 << 15)
3468c2ecf20Sopenharmony_ci#define ADPA_SETS_HVPOLARITY		0
3478c2ecf20Sopenharmony_ci#define ADPA_VSYNC_CNTL_DISABLE		(1 << 11)
3488c2ecf20Sopenharmony_ci#define ADPA_VSYNC_CNTL_ENABLE		0
3498c2ecf20Sopenharmony_ci#define ADPA_HSYNC_CNTL_DISABLE		(1 << 10)
3508c2ecf20Sopenharmony_ci#define ADPA_HSYNC_CNTL_ENABLE		0
3518c2ecf20Sopenharmony_ci#define ADPA_VSYNC_ACTIVE_HIGH		(1 << 4)
3528c2ecf20Sopenharmony_ci#define ADPA_VSYNC_ACTIVE_LOW		0
3538c2ecf20Sopenharmony_ci#define ADPA_HSYNC_ACTIVE_HIGH		(1 << 3)
3548c2ecf20Sopenharmony_ci#define ADPA_HSYNC_ACTIVE_LOW		0
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci#define FPA0			0x06040
3578c2ecf20Sopenharmony_ci#define FPA1			0x06044
3588c2ecf20Sopenharmony_ci#define FPB0			0x06048
3598c2ecf20Sopenharmony_ci#define FPB1			0x0604c
3608c2ecf20Sopenharmony_ci#define FP_N_DIV_MASK			0x003f0000
3618c2ecf20Sopenharmony_ci#define FP_N_DIV_SHIFT			16
3628c2ecf20Sopenharmony_ci#define FP_M1_DIV_MASK			0x00003f00
3638c2ecf20Sopenharmony_ci#define FP_M1_DIV_SHIFT			8
3648c2ecf20Sopenharmony_ci#define FP_M2_DIV_MASK			0x0000003f
3658c2ecf20Sopenharmony_ci#define FP_M2_DIV_SHIFT			0
3668c2ecf20Sopenharmony_ci
3678c2ecf20Sopenharmony_ci#define PORT_HOTPLUG_EN		0x61110
3688c2ecf20Sopenharmony_ci#define HDMIB_HOTPLUG_INT_EN		(1 << 29)
3698c2ecf20Sopenharmony_ci#define HDMIC_HOTPLUG_INT_EN		(1 << 28)
3708c2ecf20Sopenharmony_ci#define HDMID_HOTPLUG_INT_EN		(1 << 27)
3718c2ecf20Sopenharmony_ci#define SDVOB_HOTPLUG_INT_EN		(1 << 26)
3728c2ecf20Sopenharmony_ci#define SDVOC_HOTPLUG_INT_EN		(1 << 25)
3738c2ecf20Sopenharmony_ci#define TV_HOTPLUG_INT_EN		(1 << 18)
3748c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_INT_EN		(1 << 9)
3758c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_FORCE_DETECT	(1 << 3)
3768c2ecf20Sopenharmony_ci/* CDV.. */
3778c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_ACTIVATION_PERIOD_64	(1 << 8)
3788c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_DAC_ON_TIME_2M		(0 << 7)
3798c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_DAC_ON_TIME_4M		(1 << 7)
3808c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_VOLTAGE_COMPARE_40		(0 << 5)
3818c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_VOLTAGE_COMPARE_50		(1 << 5)
3828c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_VOLTAGE_COMPARE_60		(2 << 5)
3838c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_VOLTAGE_COMPARE_70		(3 << 5)
3848c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK	(3 << 5)
3858c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_DETECT_DELAY_1G		(0 << 4)
3868c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_DETECT_DELAY_2G		(1 << 4)
3878c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_DETECT_VOLTAGE_325MV	(0 << 2)
3888c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_DETECT_VOLTAGE_475MV	(1 << 2)
3898c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_DETECT_MASK			0x000000F8
3908c2ecf20Sopenharmony_ci
3918c2ecf20Sopenharmony_ci#define PORT_HOTPLUG_STAT	0x61114
3928c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_INT_STATUS		(1 << 11)
3938c2ecf20Sopenharmony_ci#define TV_HOTPLUG_INT_STATUS		(1 << 10)
3948c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_MONITOR_MASK	(3 << 8)
3958c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_MONITOR_COLOR	(3 << 8)
3968c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_MONITOR_MONO	(2 << 8)
3978c2ecf20Sopenharmony_ci#define CRT_HOTPLUG_MONITOR_NONE	(0 << 8)
3988c2ecf20Sopenharmony_ci#define SDVOC_HOTPLUG_INT_STATUS	(1 << 7)
3998c2ecf20Sopenharmony_ci#define SDVOB_HOTPLUG_INT_STATUS	(1 << 6)
4008c2ecf20Sopenharmony_ci
4018c2ecf20Sopenharmony_ci#define SDVOB			0x61140
4028c2ecf20Sopenharmony_ci#define SDVOC			0x61160
4038c2ecf20Sopenharmony_ci#define SDVO_ENABLE			(1 << 31)
4048c2ecf20Sopenharmony_ci#define SDVO_PIPE_B_SELECT		(1 << 30)
4058c2ecf20Sopenharmony_ci#define SDVO_STALL_SELECT		(1 << 29)
4068c2ecf20Sopenharmony_ci#define SDVO_INTERRUPT_ENABLE		(1 << 26)
4078c2ecf20Sopenharmony_ci#define SDVO_COLOR_RANGE_16_235		(1 << 8)
4088c2ecf20Sopenharmony_ci#define SDVO_AUDIO_ENABLE		(1 << 6)
4098c2ecf20Sopenharmony_ci
4108c2ecf20Sopenharmony_ci/**
4118c2ecf20Sopenharmony_ci * 915G/GM SDVO pixel multiplier.
4128c2ecf20Sopenharmony_ci *
4138c2ecf20Sopenharmony_ci * Programmed value is multiplier - 1, up to 5x.
4148c2ecf20Sopenharmony_ci *
4158c2ecf20Sopenharmony_ci * DPLL_MD_UDI_MULTIPLIER_MASK
4168c2ecf20Sopenharmony_ci */
4178c2ecf20Sopenharmony_ci#define SDVO_PORT_MULTIPLY_MASK		(7 << 23)
4188c2ecf20Sopenharmony_ci#define SDVO_PORT_MULTIPLY_SHIFT	23
4198c2ecf20Sopenharmony_ci#define SDVO_PHASE_SELECT_MASK		(15 << 19)
4208c2ecf20Sopenharmony_ci#define SDVO_PHASE_SELECT_DEFAULT	(6 << 19)
4218c2ecf20Sopenharmony_ci#define SDVO_CLOCK_OUTPUT_INVERT	(1 << 18)
4228c2ecf20Sopenharmony_ci#define SDVOC_GANG_MODE			(1 << 16)
4238c2ecf20Sopenharmony_ci#define SDVO_BORDER_ENABLE		(1 << 7)
4248c2ecf20Sopenharmony_ci#define SDVOB_PCIE_CONCURRENCY		(1 << 3)
4258c2ecf20Sopenharmony_ci#define SDVO_DETECTED			(1 << 2)
4268c2ecf20Sopenharmony_ci/* Bits to be preserved when writing */
4278c2ecf20Sopenharmony_ci#define SDVOB_PRESERVE_MASK		((1 << 17) | (1 << 16) | (1 << 14))
4288c2ecf20Sopenharmony_ci#define SDVOC_PRESERVE_MASK		(1 << 17)
4298c2ecf20Sopenharmony_ci
4308c2ecf20Sopenharmony_ci/*
4318c2ecf20Sopenharmony_ci * This register controls the LVDS output enable, pipe selection, and data
4328c2ecf20Sopenharmony_ci * format selection.
4338c2ecf20Sopenharmony_ci *
4348c2ecf20Sopenharmony_ci * All of the clock/data pairs are force powered down by power sequencing.
4358c2ecf20Sopenharmony_ci */
4368c2ecf20Sopenharmony_ci#define LVDS			0x61180
4378c2ecf20Sopenharmony_ci/*
4388c2ecf20Sopenharmony_ci * Enables the LVDS port.  This bit must be set before DPLLs are enabled, as
4398c2ecf20Sopenharmony_ci * the DPLL semantics change when the LVDS is assigned to that pipe.
4408c2ecf20Sopenharmony_ci */
4418c2ecf20Sopenharmony_ci#define LVDS_PORT_EN			(1 << 31)
4428c2ecf20Sopenharmony_ci/* Selects pipe B for LVDS data.  Must be set on pre-965. */
4438c2ecf20Sopenharmony_ci#define LVDS_PIPEB_SELECT		(1 << 30)
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci/* Turns on border drawing to allow centered display. */
4468c2ecf20Sopenharmony_ci#define LVDS_BORDER_EN			(1 << 15)
4478c2ecf20Sopenharmony_ci
4488c2ecf20Sopenharmony_ci/*
4498c2ecf20Sopenharmony_ci * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
4508c2ecf20Sopenharmony_ci * pixel.
4518c2ecf20Sopenharmony_ci */
4528c2ecf20Sopenharmony_ci#define LVDS_A0A2_CLKA_POWER_MASK	(3 << 8)
4538c2ecf20Sopenharmony_ci#define LVDS_A0A2_CLKA_POWER_DOWN	(0 << 8)
4548c2ecf20Sopenharmony_ci#define LVDS_A0A2_CLKA_POWER_UP		(3 << 8)
4558c2ecf20Sopenharmony_ci/*
4568c2ecf20Sopenharmony_ci * Controls the A3 data pair, which contains the additional LSBs for 24 bit
4578c2ecf20Sopenharmony_ci * mode.  Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
4588c2ecf20Sopenharmony_ci * on.
4598c2ecf20Sopenharmony_ci */
4608c2ecf20Sopenharmony_ci#define LVDS_A3_POWER_MASK		(3 << 6)
4618c2ecf20Sopenharmony_ci#define LVDS_A3_POWER_DOWN		(0 << 6)
4628c2ecf20Sopenharmony_ci#define LVDS_A3_POWER_UP		(3 << 6)
4638c2ecf20Sopenharmony_ci/*
4648c2ecf20Sopenharmony_ci * Controls the CLKB pair.  This should only be set when LVDS_B0B3_POWER_UP
4658c2ecf20Sopenharmony_ci * is set.
4668c2ecf20Sopenharmony_ci */
4678c2ecf20Sopenharmony_ci#define LVDS_CLKB_POWER_MASK		(3 << 4)
4688c2ecf20Sopenharmony_ci#define LVDS_CLKB_POWER_DOWN		(0 << 4)
4698c2ecf20Sopenharmony_ci#define LVDS_CLKB_POWER_UP		(3 << 4)
4708c2ecf20Sopenharmony_ci/*
4718c2ecf20Sopenharmony_ci * Controls the B0-B3 data pairs.  This must be set to match the DPLL p2
4728c2ecf20Sopenharmony_ci * setting for whether we are in dual-channel mode.  The B3 pair will
4738c2ecf20Sopenharmony_ci * additionally only be powered up when LVDS_A3_POWER_UP is set.
4748c2ecf20Sopenharmony_ci */
4758c2ecf20Sopenharmony_ci#define LVDS_B0B3_POWER_MASK		(3 << 2)
4768c2ecf20Sopenharmony_ci#define LVDS_B0B3_POWER_DOWN		(0 << 2)
4778c2ecf20Sopenharmony_ci#define LVDS_B0B3_POWER_UP		(3 << 2)
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_ci#define PIPEACONF		0x70008
4808c2ecf20Sopenharmony_ci#define PIPEACONF_ENABLE		(1 << 31)
4818c2ecf20Sopenharmony_ci#define PIPEACONF_DISABLE		0
4828c2ecf20Sopenharmony_ci#define PIPEACONF_DOUBLE_WIDE		(1 << 30)
4838c2ecf20Sopenharmony_ci#define PIPECONF_ACTIVE			(1 << 30)
4848c2ecf20Sopenharmony_ci#define PIPECONF_DSIPLL_LOCK		(1 << 29)
4858c2ecf20Sopenharmony_ci#define PIPEACONF_SINGLE_WIDE		0
4868c2ecf20Sopenharmony_ci#define PIPEACONF_PIPE_UNLOCKED		0
4878c2ecf20Sopenharmony_ci#define PIPEACONF_DSR			(1 << 26)
4888c2ecf20Sopenharmony_ci#define PIPEACONF_PIPE_LOCKED		(1 << 25)
4898c2ecf20Sopenharmony_ci#define PIPEACONF_PALETTE		0
4908c2ecf20Sopenharmony_ci#define PIPECONF_FORCE_BORDER		(1 << 25)
4918c2ecf20Sopenharmony_ci#define PIPEACONF_GAMMA			(1 << 24)
4928c2ecf20Sopenharmony_ci#define PIPECONF_PROGRESSIVE		(0 << 21)
4938c2ecf20Sopenharmony_ci#define PIPECONF_INTERLACE_W_FIELD_INDICATION	(6 << 21)
4948c2ecf20Sopenharmony_ci#define PIPECONF_INTERLACE_FIELD_0_ONLY		(7 << 21)
4958c2ecf20Sopenharmony_ci#define PIPECONF_PLANE_OFF		(1 << 19)
4968c2ecf20Sopenharmony_ci#define PIPECONF_CURSOR_OFF		(1 << 18)
4978c2ecf20Sopenharmony_ci
4988c2ecf20Sopenharmony_ci#define PIPEBCONF		0x71008
4998c2ecf20Sopenharmony_ci#define PIPEBCONF_ENABLE		(1 << 31)
5008c2ecf20Sopenharmony_ci#define PIPEBCONF_DISABLE		0
5018c2ecf20Sopenharmony_ci#define PIPEBCONF_DOUBLE_WIDE		(1 << 30)
5028c2ecf20Sopenharmony_ci#define PIPEBCONF_DISABLE		0
5038c2ecf20Sopenharmony_ci#define PIPEBCONF_GAMMA			(1 << 24)
5048c2ecf20Sopenharmony_ci#define PIPEBCONF_PALETTE		0
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci#define PIPECCONF		0x72008
5078c2ecf20Sopenharmony_ci
5088c2ecf20Sopenharmony_ci#define PIPEBGCMAXRED		0x71010
5098c2ecf20Sopenharmony_ci#define PIPEBGCMAXGREEN		0x71014
5108c2ecf20Sopenharmony_ci#define PIPEBGCMAXBLUE		0x71018
5118c2ecf20Sopenharmony_ci
5128c2ecf20Sopenharmony_ci#define PIPEASTAT		0x70024
5138c2ecf20Sopenharmony_ci#define PIPEBSTAT		0x71024
5148c2ecf20Sopenharmony_ci#define PIPECSTAT		0x72024
5158c2ecf20Sopenharmony_ci#define PIPE_VBLANK_INTERRUPT_STATUS		(1UL << 1)
5168c2ecf20Sopenharmony_ci#define PIPE_START_VBLANK_INTERRUPT_STATUS	(1UL << 2)
5178c2ecf20Sopenharmony_ci#define PIPE_VBLANK_CLEAR			(1 << 1)
5188c2ecf20Sopenharmony_ci#define PIPE_VBLANK_STATUS			(1 << 1)
5198c2ecf20Sopenharmony_ci#define PIPE_TE_STATUS				(1UL << 6)
5208c2ecf20Sopenharmony_ci#define PIPE_DPST_EVENT_STATUS			(1UL << 7)
5218c2ecf20Sopenharmony_ci#define PIPE_VSYNC_CLEAR			(1UL << 9)
5228c2ecf20Sopenharmony_ci#define PIPE_VSYNC_STATUS			(1UL << 9)
5238c2ecf20Sopenharmony_ci#define PIPE_HDMI_AUDIO_UNDERRUN_STATUS		(1UL << 10)
5248c2ecf20Sopenharmony_ci#define PIPE_HDMI_AUDIO_BUFFER_DONE_STATUS	(1UL << 11)
5258c2ecf20Sopenharmony_ci#define PIPE_VBLANK_INTERRUPT_ENABLE		(1UL << 17)
5268c2ecf20Sopenharmony_ci#define PIPE_START_VBLANK_INTERRUPT_ENABLE	(1UL << 18)
5278c2ecf20Sopenharmony_ci#define PIPE_TE_ENABLE				(1UL << 22)
5288c2ecf20Sopenharmony_ci#define PIPE_LEGACY_BLC_EVENT_ENABLE		(1UL << 22)
5298c2ecf20Sopenharmony_ci#define PIPE_DPST_EVENT_ENABLE			(1UL << 23)
5308c2ecf20Sopenharmony_ci#define PIPE_VSYNC_ENABL			(1UL << 25)
5318c2ecf20Sopenharmony_ci#define PIPE_HDMI_AUDIO_UNDERRUN		(1UL << 26)
5328c2ecf20Sopenharmony_ci#define PIPE_HDMI_AUDIO_BUFFER_DONE		(1UL << 27)
5338c2ecf20Sopenharmony_ci#define PIPE_FIFO_UNDERRUN			(1UL << 31)
5348c2ecf20Sopenharmony_ci#define PIPE_HDMI_AUDIO_INT_MASK		(PIPE_HDMI_AUDIO_UNDERRUN | \
5358c2ecf20Sopenharmony_ci						PIPE_HDMI_AUDIO_BUFFER_DONE)
5368c2ecf20Sopenharmony_ci#define PIPE_EVENT_MASK ((1 << 29)|(1 << 28)|(1 << 27)|(1 << 26)|(1 << 24)|(1 << 23)|(1 << 22)|(1 << 21)|(1 << 20)|(1 << 16))
5378c2ecf20Sopenharmony_ci#define PIPE_VBLANK_MASK ((1 << 25)|(1 << 24)|(1 << 18)|(1 << 17))
5388c2ecf20Sopenharmony_ci#define HISTOGRAM_INT_CONTROL		0x61268
5398c2ecf20Sopenharmony_ci#define HISTOGRAM_BIN_DATA		0X61264
5408c2ecf20Sopenharmony_ci#define HISTOGRAM_LOGIC_CONTROL		0x61260
5418c2ecf20Sopenharmony_ci#define PWM_CONTROL_LOGIC		0x61250
5428c2ecf20Sopenharmony_ci#define PIPE_HOTPLUG_INTERRUPT_STATUS		(1UL << 10)
5438c2ecf20Sopenharmony_ci#define HISTOGRAM_INTERRUPT_ENABLE		(1UL << 31)
5448c2ecf20Sopenharmony_ci#define HISTOGRAM_LOGIC_ENABLE			(1UL << 31)
5458c2ecf20Sopenharmony_ci#define PWM_LOGIC_ENABLE			(1UL << 31)
5468c2ecf20Sopenharmony_ci#define PWM_PHASEIN_ENABLE			(1UL << 25)
5478c2ecf20Sopenharmony_ci#define PWM_PHASEIN_INT_ENABLE			(1UL << 24)
5488c2ecf20Sopenharmony_ci#define PWM_PHASEIN_VB_COUNT			0x00001f00
5498c2ecf20Sopenharmony_ci#define PWM_PHASEIN_INC				0x0000001f
5508c2ecf20Sopenharmony_ci#define HISTOGRAM_INT_CTRL_CLEAR		(1UL << 30)
5518c2ecf20Sopenharmony_ci#define DPST_YUV_LUMA_MODE			0
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_cistruct dpst_ie_histogram_control {
5548c2ecf20Sopenharmony_ci	union {
5558c2ecf20Sopenharmony_ci		uint32_t data;
5568c2ecf20Sopenharmony_ci		struct {
5578c2ecf20Sopenharmony_ci			uint32_t bin_reg_index:7;
5588c2ecf20Sopenharmony_ci			uint32_t reserved:4;
5598c2ecf20Sopenharmony_ci			uint32_t bin_reg_func_select:1;
5608c2ecf20Sopenharmony_ci			uint32_t sync_to_phase_in:1;
5618c2ecf20Sopenharmony_ci			uint32_t alt_enhancement_mode:2;
5628c2ecf20Sopenharmony_ci			uint32_t reserved1:1;
5638c2ecf20Sopenharmony_ci			uint32_t sync_to_phase_in_count:8;
5648c2ecf20Sopenharmony_ci			uint32_t histogram_mode_select:1;
5658c2ecf20Sopenharmony_ci			uint32_t reserved2:4;
5668c2ecf20Sopenharmony_ci			uint32_t ie_pipe_assignment:1;
5678c2ecf20Sopenharmony_ci			uint32_t ie_mode_table_enabled:1;
5688c2ecf20Sopenharmony_ci			uint32_t ie_histogram_enable:1;
5698c2ecf20Sopenharmony_ci		};
5708c2ecf20Sopenharmony_ci	};
5718c2ecf20Sopenharmony_ci};
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_cistruct dpst_guardband {
5748c2ecf20Sopenharmony_ci	union {
5758c2ecf20Sopenharmony_ci		uint32_t data;
5768c2ecf20Sopenharmony_ci		struct {
5778c2ecf20Sopenharmony_ci			uint32_t guardband:22;
5788c2ecf20Sopenharmony_ci			uint32_t guardband_interrupt_delay:8;
5798c2ecf20Sopenharmony_ci			uint32_t interrupt_status:1;
5808c2ecf20Sopenharmony_ci			uint32_t interrupt_enable:1;
5818c2ecf20Sopenharmony_ci		};
5828c2ecf20Sopenharmony_ci	};
5838c2ecf20Sopenharmony_ci};
5848c2ecf20Sopenharmony_ci
5858c2ecf20Sopenharmony_ci#define PIPEAFRAMEHIGH		0x70040
5868c2ecf20Sopenharmony_ci#define PIPEAFRAMEPIXEL		0x70044
5878c2ecf20Sopenharmony_ci#define PIPEBFRAMEHIGH		0x71040
5888c2ecf20Sopenharmony_ci#define PIPEBFRAMEPIXEL		0x71044
5898c2ecf20Sopenharmony_ci#define PIPECFRAMEHIGH		0x72040
5908c2ecf20Sopenharmony_ci#define PIPECFRAMEPIXEL		0x72044
5918c2ecf20Sopenharmony_ci#define PIPE_FRAME_HIGH_MASK	0x0000ffff
5928c2ecf20Sopenharmony_ci#define PIPE_FRAME_HIGH_SHIFT	0
5938c2ecf20Sopenharmony_ci#define PIPE_FRAME_LOW_MASK	0xff000000
5948c2ecf20Sopenharmony_ci#define PIPE_FRAME_LOW_SHIFT	24
5958c2ecf20Sopenharmony_ci#define PIPE_PIXEL_MASK		0x00ffffff
5968c2ecf20Sopenharmony_ci#define PIPE_PIXEL_SHIFT	0
5978c2ecf20Sopenharmony_ci
5988c2ecf20Sopenharmony_ci#define FW_BLC_SELF		0x20e0
5998c2ecf20Sopenharmony_ci#define FW_BLC_SELF_EN          (1<<15)
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_ci#define DSPARB			0x70030
6028c2ecf20Sopenharmony_ci#define DSPFW1			0x70034
6038c2ecf20Sopenharmony_ci#define DSP_FIFO_SR_WM_MASK		0xFF800000
6048c2ecf20Sopenharmony_ci#define DSP_FIFO_SR_WM_SHIFT		23
6058c2ecf20Sopenharmony_ci#define CURSOR_B_FIFO_WM_MASK		0x003F0000
6068c2ecf20Sopenharmony_ci#define CURSOR_B_FIFO_WM_SHIFT		16
6078c2ecf20Sopenharmony_ci#define DSPFW2			0x70038
6088c2ecf20Sopenharmony_ci#define CURSOR_A_FIFO_WM_MASK		0x3F00
6098c2ecf20Sopenharmony_ci#define CURSOR_A_FIFO_WM_SHIFT		8
6108c2ecf20Sopenharmony_ci#define DSP_PLANE_C_FIFO_WM_MASK	0x7F
6118c2ecf20Sopenharmony_ci#define DSP_PLANE_C_FIFO_WM_SHIFT	0
6128c2ecf20Sopenharmony_ci#define DSPFW3			0x7003c
6138c2ecf20Sopenharmony_ci#define DSPFW4			0x70050
6148c2ecf20Sopenharmony_ci#define DSPFW5			0x70054
6158c2ecf20Sopenharmony_ci#define DSP_PLANE_B_FIFO_WM1_SHIFT	24
6168c2ecf20Sopenharmony_ci#define DSP_PLANE_A_FIFO_WM1_SHIFT	16
6178c2ecf20Sopenharmony_ci#define CURSOR_B_FIFO_WM1_SHIFT		8
6188c2ecf20Sopenharmony_ci#define CURSOR_FIFO_SR_WM1_SHIFT	0
6198c2ecf20Sopenharmony_ci#define DSPFW6			0x70058
6208c2ecf20Sopenharmony_ci#define DSPCHICKENBIT		0x70400
6218c2ecf20Sopenharmony_ci#define DSPACNTR		0x70180
6228c2ecf20Sopenharmony_ci#define DSPBCNTR		0x71180
6238c2ecf20Sopenharmony_ci#define DSPCCNTR		0x72180
6248c2ecf20Sopenharmony_ci#define DISPLAY_PLANE_ENABLE			(1 << 31)
6258c2ecf20Sopenharmony_ci#define DISPLAY_PLANE_DISABLE			0
6268c2ecf20Sopenharmony_ci#define DISPPLANE_GAMMA_ENABLE			(1 << 30)
6278c2ecf20Sopenharmony_ci#define DISPPLANE_GAMMA_DISABLE			0
6288c2ecf20Sopenharmony_ci#define DISPPLANE_PIXFORMAT_MASK		(0xf << 26)
6298c2ecf20Sopenharmony_ci#define DISPPLANE_8BPP				(0x2 << 26)
6308c2ecf20Sopenharmony_ci#define DISPPLANE_15_16BPP			(0x4 << 26)
6318c2ecf20Sopenharmony_ci#define DISPPLANE_16BPP				(0x5 << 26)
6328c2ecf20Sopenharmony_ci#define DISPPLANE_32BPP_NO_ALPHA		(0x6 << 26)
6338c2ecf20Sopenharmony_ci#define DISPPLANE_32BPP				(0x7 << 26)
6348c2ecf20Sopenharmony_ci#define DISPPLANE_STEREO_ENABLE			(1 << 25)
6358c2ecf20Sopenharmony_ci#define DISPPLANE_STEREO_DISABLE		0
6368c2ecf20Sopenharmony_ci#define DISPPLANE_SEL_PIPE_MASK			(1 << 24)
6378c2ecf20Sopenharmony_ci#define DISPPLANE_SEL_PIPE_POS			24
6388c2ecf20Sopenharmony_ci#define DISPPLANE_SEL_PIPE_A			0
6398c2ecf20Sopenharmony_ci#define DISPPLANE_SEL_PIPE_B			(1 << 24)
6408c2ecf20Sopenharmony_ci#define DISPPLANE_SRC_KEY_ENABLE		(1 << 22)
6418c2ecf20Sopenharmony_ci#define DISPPLANE_SRC_KEY_DISABLE		0
6428c2ecf20Sopenharmony_ci#define DISPPLANE_LINE_DOUBLE			(1 << 20)
6438c2ecf20Sopenharmony_ci#define DISPPLANE_NO_LINE_DOUBLE		0
6448c2ecf20Sopenharmony_ci#define DISPPLANE_STEREO_POLARITY_FIRST		0
6458c2ecf20Sopenharmony_ci#define DISPPLANE_STEREO_POLARITY_SECOND	(1 << 18)
6468c2ecf20Sopenharmony_ci/* plane B only */
6478c2ecf20Sopenharmony_ci#define DISPPLANE_ALPHA_TRANS_ENABLE		(1 << 15)
6488c2ecf20Sopenharmony_ci#define DISPPLANE_ALPHA_TRANS_DISABLE		0
6498c2ecf20Sopenharmony_ci#define DISPPLANE_SPRITE_ABOVE_DISPLAYA		0
6508c2ecf20Sopenharmony_ci#define DISPPLANE_SPRITE_ABOVE_OVERLAY		(1)
6518c2ecf20Sopenharmony_ci#define DISPPLANE_BOTTOM			(4)
6528c2ecf20Sopenharmony_ci
6538c2ecf20Sopenharmony_ci#define DSPABASE		0x70184
6548c2ecf20Sopenharmony_ci#define DSPALINOFF		0x70184
6558c2ecf20Sopenharmony_ci#define DSPASTRIDE		0x70188
6568c2ecf20Sopenharmony_ci
6578c2ecf20Sopenharmony_ci#define DSPBBASE		0x71184
6588c2ecf20Sopenharmony_ci#define DSPBLINOFF		0X71184
6598c2ecf20Sopenharmony_ci#define DSPBADDR		DSPBBASE
6608c2ecf20Sopenharmony_ci#define DSPBSTRIDE		0x71188
6618c2ecf20Sopenharmony_ci
6628c2ecf20Sopenharmony_ci#define DSPCBASE		0x72184
6638c2ecf20Sopenharmony_ci#define DSPCLINOFF		0x72184
6648c2ecf20Sopenharmony_ci#define DSPCSTRIDE		0x72188
6658c2ecf20Sopenharmony_ci
6668c2ecf20Sopenharmony_ci#define DSPAKEYVAL		0x70194
6678c2ecf20Sopenharmony_ci#define DSPAKEYMASK		0x70198
6688c2ecf20Sopenharmony_ci
6698c2ecf20Sopenharmony_ci#define DSPAPOS			0x7018C	/* reserved */
6708c2ecf20Sopenharmony_ci#define DSPASIZE		0x70190
6718c2ecf20Sopenharmony_ci#define DSPBPOS			0x7118C
6728c2ecf20Sopenharmony_ci#define DSPBSIZE		0x71190
6738c2ecf20Sopenharmony_ci#define DSPCPOS			0x7218C
6748c2ecf20Sopenharmony_ci#define DSPCSIZE		0x72190
6758c2ecf20Sopenharmony_ci
6768c2ecf20Sopenharmony_ci#define DSPASURF		0x7019C
6778c2ecf20Sopenharmony_ci#define DSPATILEOFF		0x701A4
6788c2ecf20Sopenharmony_ci
6798c2ecf20Sopenharmony_ci#define DSPBSURF		0x7119C
6808c2ecf20Sopenharmony_ci#define DSPBTILEOFF		0x711A4
6818c2ecf20Sopenharmony_ci
6828c2ecf20Sopenharmony_ci#define DSPCSURF		0x7219C
6838c2ecf20Sopenharmony_ci#define DSPCTILEOFF		0x721A4
6848c2ecf20Sopenharmony_ci#define DSPCKEYMAXVAL		0x721A0
6858c2ecf20Sopenharmony_ci#define DSPCKEYMINVAL		0x72194
6868c2ecf20Sopenharmony_ci#define DSPCKEYMSK		0x72198
6878c2ecf20Sopenharmony_ci
6888c2ecf20Sopenharmony_ci#define VGACNTRL		0x71400
6898c2ecf20Sopenharmony_ci#define VGA_DISP_DISABLE		(1 << 31)
6908c2ecf20Sopenharmony_ci#define VGA_2X_MODE			(1 << 30)
6918c2ecf20Sopenharmony_ci#define VGA_PIPE_B_SELECT		(1 << 29)
6928c2ecf20Sopenharmony_ci
6938c2ecf20Sopenharmony_ci/*
6948c2ecf20Sopenharmony_ci * Overlay registers
6958c2ecf20Sopenharmony_ci */
6968c2ecf20Sopenharmony_ci#define OV_C_OFFSET		0x08000
6978c2ecf20Sopenharmony_ci#define OV_OVADD		0x30000
6988c2ecf20Sopenharmony_ci#define OV_DOVASTA		0x30008
6998c2ecf20Sopenharmony_ci# define OV_PIPE_SELECT			((1 << 6)|(1 << 7))
7008c2ecf20Sopenharmony_ci# define OV_PIPE_SELECT_POS		6
7018c2ecf20Sopenharmony_ci# define OV_PIPE_A			0
7028c2ecf20Sopenharmony_ci# define OV_PIPE_C			1
7038c2ecf20Sopenharmony_ci#define OV_OGAMC5		0x30010
7048c2ecf20Sopenharmony_ci#define OV_OGAMC4		0x30014
7058c2ecf20Sopenharmony_ci#define OV_OGAMC3		0x30018
7068c2ecf20Sopenharmony_ci#define OV_OGAMC2		0x3001C
7078c2ecf20Sopenharmony_ci#define OV_OGAMC1		0x30020
7088c2ecf20Sopenharmony_ci#define OV_OGAMC0		0x30024
7098c2ecf20Sopenharmony_ci#define OVC_OVADD		0x38000
7108c2ecf20Sopenharmony_ci#define OVC_DOVCSTA		0x38008
7118c2ecf20Sopenharmony_ci#define OVC_OGAMC5		0x38010
7128c2ecf20Sopenharmony_ci#define OVC_OGAMC4		0x38014
7138c2ecf20Sopenharmony_ci#define OVC_OGAMC3		0x38018
7148c2ecf20Sopenharmony_ci#define OVC_OGAMC2		0x3801C
7158c2ecf20Sopenharmony_ci#define OVC_OGAMC1		0x38020
7168c2ecf20Sopenharmony_ci#define OVC_OGAMC0		0x38024
7178c2ecf20Sopenharmony_ci
7188c2ecf20Sopenharmony_ci/*
7198c2ecf20Sopenharmony_ci * Some BIOS scratch area registers.  The 845 (and 830?) store the amount
7208c2ecf20Sopenharmony_ci * of video memory available to the BIOS in SWF1.
7218c2ecf20Sopenharmony_ci */
7228c2ecf20Sopenharmony_ci#define SWF0			0x71410
7238c2ecf20Sopenharmony_ci#define SWF1			0x71414
7248c2ecf20Sopenharmony_ci#define SWF2			0x71418
7258c2ecf20Sopenharmony_ci#define SWF3			0x7141c
7268c2ecf20Sopenharmony_ci#define SWF4			0x71420
7278c2ecf20Sopenharmony_ci#define SWF5			0x71424
7288c2ecf20Sopenharmony_ci#define SWF6			0x71428
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci/*
7318c2ecf20Sopenharmony_ci * 855 scratch registers.
7328c2ecf20Sopenharmony_ci */
7338c2ecf20Sopenharmony_ci#define SWF00			0x70410
7348c2ecf20Sopenharmony_ci#define SWF01			0x70414
7358c2ecf20Sopenharmony_ci#define SWF02			0x70418
7368c2ecf20Sopenharmony_ci#define SWF03			0x7041c
7378c2ecf20Sopenharmony_ci#define SWF04			0x70420
7388c2ecf20Sopenharmony_ci#define SWF05			0x70424
7398c2ecf20Sopenharmony_ci#define SWF06			0x70428
7408c2ecf20Sopenharmony_ci
7418c2ecf20Sopenharmony_ci#define SWF10			SWF0
7428c2ecf20Sopenharmony_ci#define SWF11			SWF1
7438c2ecf20Sopenharmony_ci#define SWF12			SWF2
7448c2ecf20Sopenharmony_ci#define SWF13			SWF3
7458c2ecf20Sopenharmony_ci#define SWF14			SWF4
7468c2ecf20Sopenharmony_ci#define SWF15			SWF5
7478c2ecf20Sopenharmony_ci#define SWF16			SWF6
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci#define SWF30			0x72414
7508c2ecf20Sopenharmony_ci#define SWF31			0x72418
7518c2ecf20Sopenharmony_ci#define SWF32			0x7241c
7528c2ecf20Sopenharmony_ci
7538c2ecf20Sopenharmony_ci
7548c2ecf20Sopenharmony_ci/*
7558c2ecf20Sopenharmony_ci * Palette registers
7568c2ecf20Sopenharmony_ci */
7578c2ecf20Sopenharmony_ci#define PALETTE_A		0x0a000
7588c2ecf20Sopenharmony_ci#define PALETTE_B		0x0a800
7598c2ecf20Sopenharmony_ci#define PALETTE_C		0x0ac00
7608c2ecf20Sopenharmony_ci
7618c2ecf20Sopenharmony_ci/* Cursor A & B regs */
7628c2ecf20Sopenharmony_ci#define CURACNTR		0x70080
7638c2ecf20Sopenharmony_ci#define CURSOR_MODE_DISABLE		0x00
7648c2ecf20Sopenharmony_ci#define CURSOR_MODE_64_32B_AX		0x07
7658c2ecf20Sopenharmony_ci#define CURSOR_MODE_64_ARGB_AX		((1 << 5) | CURSOR_MODE_64_32B_AX)
7668c2ecf20Sopenharmony_ci#define MCURSOR_GAMMA_ENABLE		(1 << 26)
7678c2ecf20Sopenharmony_ci#define CURABASE		0x70084
7688c2ecf20Sopenharmony_ci#define CURAPOS			0x70088
7698c2ecf20Sopenharmony_ci#define CURSOR_POS_MASK			0x007FF
7708c2ecf20Sopenharmony_ci#define CURSOR_POS_SIGN			0x8000
7718c2ecf20Sopenharmony_ci#define CURSOR_X_SHIFT			0
7728c2ecf20Sopenharmony_ci#define CURSOR_Y_SHIFT			16
7738c2ecf20Sopenharmony_ci#define CURBCNTR		0x700c0
7748c2ecf20Sopenharmony_ci#define CURBBASE		0x700c4
7758c2ecf20Sopenharmony_ci#define CURBPOS			0x700c8
7768c2ecf20Sopenharmony_ci#define CURCCNTR		0x700e0
7778c2ecf20Sopenharmony_ci#define CURCBASE		0x700e4
7788c2ecf20Sopenharmony_ci#define CURCPOS			0x700e8
7798c2ecf20Sopenharmony_ci
7808c2ecf20Sopenharmony_ci/*
7818c2ecf20Sopenharmony_ci * Interrupt Registers
7828c2ecf20Sopenharmony_ci */
7838c2ecf20Sopenharmony_ci#define IER			0x020a0
7848c2ecf20Sopenharmony_ci#define IIR			0x020a4
7858c2ecf20Sopenharmony_ci#define IMR			0x020a8
7868c2ecf20Sopenharmony_ci#define ISR			0x020ac
7878c2ecf20Sopenharmony_ci
7888c2ecf20Sopenharmony_ci/*
7898c2ecf20Sopenharmony_ci * MOORESTOWN delta registers
7908c2ecf20Sopenharmony_ci */
7918c2ecf20Sopenharmony_ci#define MRST_DPLL_A		0x0f014
7928c2ecf20Sopenharmony_ci#define MDFLD_DPLL_B		0x0f018
7938c2ecf20Sopenharmony_ci#define MDFLD_INPUT_REF_SEL		(1 << 14)
7948c2ecf20Sopenharmony_ci#define MDFLD_VCO_SEL			(1 << 16)
7958c2ecf20Sopenharmony_ci#define DPLLA_MODE_LVDS			(2 << 26)	/* mrst */
7968c2ecf20Sopenharmony_ci#define MDFLD_PLL_LATCHEN		(1 << 28)
7978c2ecf20Sopenharmony_ci#define MDFLD_PWR_GATE_EN		(1 << 30)
7988c2ecf20Sopenharmony_ci#define MDFLD_P1_MASK			(0x1FF << 17)
7998c2ecf20Sopenharmony_ci#define MRST_FPA0		0x0f040
8008c2ecf20Sopenharmony_ci#define MRST_FPA1		0x0f044
8018c2ecf20Sopenharmony_ci#define MDFLD_DPLL_DIV0		0x0f048
8028c2ecf20Sopenharmony_ci#define MDFLD_DPLL_DIV1		0x0f04c
8038c2ecf20Sopenharmony_ci#define MRST_PERF_MODE		0x020f4
8048c2ecf20Sopenharmony_ci
8058c2ecf20Sopenharmony_ci/*
8068c2ecf20Sopenharmony_ci * MEDFIELD HDMI registers
8078c2ecf20Sopenharmony_ci */
8088c2ecf20Sopenharmony_ci#define HDMIPHYMISCCTL		0x61134
8098c2ecf20Sopenharmony_ci#define HDMI_PHY_POWER_DOWN		0x7f
8108c2ecf20Sopenharmony_ci#define HDMIB_CONTROL		0x61140
8118c2ecf20Sopenharmony_ci#define HDMIB_PORT_EN			(1 << 31)
8128c2ecf20Sopenharmony_ci#define HDMIB_PIPE_B_SELECT		(1 << 30)
8138c2ecf20Sopenharmony_ci#define HDMIB_NULL_PACKET		(1 << 9)
8148c2ecf20Sopenharmony_ci#define HDMIB_HDCP_PORT			(1 << 5)
8158c2ecf20Sopenharmony_ci
8168c2ecf20Sopenharmony_ci/* #define LVDS			0x61180 */
8178c2ecf20Sopenharmony_ci#define MRST_PANEL_8TO6_DITHER_ENABLE	(1 << 25)
8188c2ecf20Sopenharmony_ci#define MRST_PANEL_24_DOT_1_FORMAT	(1 << 24)
8198c2ecf20Sopenharmony_ci#define LVDS_A3_POWER_UP_0_OUTPUT	(1 << 6)
8208c2ecf20Sopenharmony_ci
8218c2ecf20Sopenharmony_ci#define MIPI			0x61190
8228c2ecf20Sopenharmony_ci#define MIPI_C			0x62190
8238c2ecf20Sopenharmony_ci#define MIPI_PORT_EN			(1 << 31)
8248c2ecf20Sopenharmony_ci/* Turns on border drawing to allow centered display. */
8258c2ecf20Sopenharmony_ci#define SEL_FLOPPED_HSTX		(1 << 23)
8268c2ecf20Sopenharmony_ci#define PASS_FROM_SPHY_TO_AFE		(1 << 16)
8278c2ecf20Sopenharmony_ci#define MIPI_BORDER_EN			(1 << 15)
8288c2ecf20Sopenharmony_ci#define MIPIA_3LANE_MIPIC_1LANE		0x1
8298c2ecf20Sopenharmony_ci#define MIPIA_2LANE_MIPIC_2LANE		0x2
8308c2ecf20Sopenharmony_ci#define TE_TRIGGER_DSI_PROTOCOL		(1 << 2)
8318c2ecf20Sopenharmony_ci#define TE_TRIGGER_GPIO_PIN		(1 << 3)
8328c2ecf20Sopenharmony_ci#define MIPI_TE_COUNT		0x61194
8338c2ecf20Sopenharmony_ci
8348c2ecf20Sopenharmony_ci/* #define PP_CONTROL	0x61204 */
8358c2ecf20Sopenharmony_ci#define POWER_DOWN_ON_RESET		(1 << 1)
8368c2ecf20Sopenharmony_ci
8378c2ecf20Sopenharmony_ci/* #define PFIT_CONTROL	0x61230 */
8388c2ecf20Sopenharmony_ci#define PFIT_PIPE_SELECT		(3 << 29)
8398c2ecf20Sopenharmony_ci#define PFIT_PIPE_SELECT_SHIFT		(29)
8408c2ecf20Sopenharmony_ci
8418c2ecf20Sopenharmony_ci/* #define BLC_PWM_CTL		0x61254 */
8428c2ecf20Sopenharmony_ci#define MRST_BACKLIGHT_MODULATION_FREQ_SHIFT	(16)
8438c2ecf20Sopenharmony_ci#define MRST_BACKLIGHT_MODULATION_FREQ_MASK	(0xffff << 16)
8448c2ecf20Sopenharmony_ci
8458c2ecf20Sopenharmony_ci/* #define PIPEACONF 0x70008 */
8468c2ecf20Sopenharmony_ci#define PIPEACONF_PIPE_STATE		(1 << 30)
8478c2ecf20Sopenharmony_ci/* #define DSPACNTR		0x70180 */
8488c2ecf20Sopenharmony_ci
8498c2ecf20Sopenharmony_ci#define MRST_DSPABASE		0x7019c
8508c2ecf20Sopenharmony_ci#define MRST_DSPBBASE		0x7119c
8518c2ecf20Sopenharmony_ci#define MDFLD_DSPCBASE		0x7219c
8528c2ecf20Sopenharmony_ci
8538c2ecf20Sopenharmony_ci/*
8548c2ecf20Sopenharmony_ci * Moorestown registers.
8558c2ecf20Sopenharmony_ci */
8568c2ecf20Sopenharmony_ci
8578c2ecf20Sopenharmony_ci/*
8588c2ecf20Sopenharmony_ci *	MIPI IP registers
8598c2ecf20Sopenharmony_ci */
8608c2ecf20Sopenharmony_ci#define MIPIC_REG_OFFSET		0x800
8618c2ecf20Sopenharmony_ci
8628c2ecf20Sopenharmony_ci#define DEVICE_READY_REG		0xb000
8638c2ecf20Sopenharmony_ci#define LP_OUTPUT_HOLD				(1 << 16)
8648c2ecf20Sopenharmony_ci#define EXIT_ULPS_DEV_READY			0x3
8658c2ecf20Sopenharmony_ci#define LP_OUTPUT_HOLD_RELEASE			0x810000
8668c2ecf20Sopenharmony_ci# define ENTERING_ULPS				(2 << 1)
8678c2ecf20Sopenharmony_ci# define EXITING_ULPS				(1 << 1)
8688c2ecf20Sopenharmony_ci# define ULPS_MASK				(3 << 1)
8698c2ecf20Sopenharmony_ci# define BUS_POSSESSION				(1 << 3)
8708c2ecf20Sopenharmony_ci#define INTR_STAT_REG			0xb004
8718c2ecf20Sopenharmony_ci#define RX_SOT_ERROR				(1 << 0)
8728c2ecf20Sopenharmony_ci#define RX_SOT_SYNC_ERROR			(1 << 1)
8738c2ecf20Sopenharmony_ci#define RX_ESCAPE_MODE_ENTRY_ERROR		(1 << 3)
8748c2ecf20Sopenharmony_ci#define RX_LP_TX_SYNC_ERROR			(1 << 4)
8758c2ecf20Sopenharmony_ci#define RX_HS_RECEIVE_TIMEOUT_ERROR		(1 << 5)
8768c2ecf20Sopenharmony_ci#define RX_FALSE_CONTROL_ERROR			(1 << 6)
8778c2ecf20Sopenharmony_ci#define RX_ECC_SINGLE_BIT_ERROR			(1 << 7)
8788c2ecf20Sopenharmony_ci#define RX_ECC_MULTI_BIT_ERROR			(1 << 8)
8798c2ecf20Sopenharmony_ci#define RX_CHECKSUM_ERROR			(1 << 9)
8808c2ecf20Sopenharmony_ci#define RX_DSI_DATA_TYPE_NOT_RECOGNIZED		(1 << 10)
8818c2ecf20Sopenharmony_ci#define RX_DSI_VC_ID_INVALID			(1 << 11)
8828c2ecf20Sopenharmony_ci#define TX_FALSE_CONTROL_ERROR			(1 << 12)
8838c2ecf20Sopenharmony_ci#define TX_ECC_SINGLE_BIT_ERROR			(1 << 13)
8848c2ecf20Sopenharmony_ci#define TX_ECC_MULTI_BIT_ERROR			(1 << 14)
8858c2ecf20Sopenharmony_ci#define TX_CHECKSUM_ERROR			(1 << 15)
8868c2ecf20Sopenharmony_ci#define TX_DSI_DATA_TYPE_NOT_RECOGNIZED		(1 << 16)
8878c2ecf20Sopenharmony_ci#define TX_DSI_VC_ID_INVALID			(1 << 17)
8888c2ecf20Sopenharmony_ci#define HIGH_CONTENTION				(1 << 18)
8898c2ecf20Sopenharmony_ci#define LOW_CONTENTION				(1 << 19)
8908c2ecf20Sopenharmony_ci#define DPI_FIFO_UNDER_RUN			(1 << 20)
8918c2ecf20Sopenharmony_ci#define HS_TX_TIMEOUT				(1 << 21)
8928c2ecf20Sopenharmony_ci#define LP_RX_TIMEOUT				(1 << 22)
8938c2ecf20Sopenharmony_ci#define TURN_AROUND_ACK_TIMEOUT			(1 << 23)
8948c2ecf20Sopenharmony_ci#define ACK_WITH_NO_ERROR			(1 << 24)
8958c2ecf20Sopenharmony_ci#define HS_GENERIC_WR_FIFO_FULL			(1 << 27)
8968c2ecf20Sopenharmony_ci#define LP_GENERIC_WR_FIFO_FULL			(1 << 28)
8978c2ecf20Sopenharmony_ci#define SPL_PKT_SENT				(1 << 30)
8988c2ecf20Sopenharmony_ci#define INTR_EN_REG			0xb008
8998c2ecf20Sopenharmony_ci#define DSI_FUNC_PRG_REG		0xb00c
9008c2ecf20Sopenharmony_ci#define DPI_CHANNEL_NUMBER_POS			0x03
9018c2ecf20Sopenharmony_ci#define DBI_CHANNEL_NUMBER_POS			0x05
9028c2ecf20Sopenharmony_ci#define FMT_DPI_POS				0x07
9038c2ecf20Sopenharmony_ci#define FMT_DBI_POS				0x0A
9048c2ecf20Sopenharmony_ci#define DBI_DATA_WIDTH_POS			0x0D
9058c2ecf20Sopenharmony_ci
9068c2ecf20Sopenharmony_ci/* DPI PIXEL FORMATS */
9078c2ecf20Sopenharmony_ci#define RGB_565_FMT				0x01	/* RGB 565 FORMAT */
9088c2ecf20Sopenharmony_ci#define RGB_666_FMT				0x02	/* RGB 666 FORMAT */
9098c2ecf20Sopenharmony_ci#define LRGB_666_FMT				0x03	/* RGB LOOSELY PACKED
9108c2ecf20Sopenharmony_ci							 * 666 FORMAT
9118c2ecf20Sopenharmony_ci							 */
9128c2ecf20Sopenharmony_ci#define RGB_888_FMT				0x04	/* RGB 888 FORMAT */
9138c2ecf20Sopenharmony_ci#define VIRTUAL_CHANNEL_NUMBER_0		0x00	/* Virtual channel 0 */
9148c2ecf20Sopenharmony_ci#define VIRTUAL_CHANNEL_NUMBER_1		0x01	/* Virtual channel 1 */
9158c2ecf20Sopenharmony_ci#define VIRTUAL_CHANNEL_NUMBER_2		0x02	/* Virtual channel 2 */
9168c2ecf20Sopenharmony_ci#define VIRTUAL_CHANNEL_NUMBER_3		0x03	/* Virtual channel 3 */
9178c2ecf20Sopenharmony_ci
9188c2ecf20Sopenharmony_ci#define DBI_NOT_SUPPORTED			0x00	/* command mode
9198c2ecf20Sopenharmony_ci							 * is not supported
9208c2ecf20Sopenharmony_ci							 */
9218c2ecf20Sopenharmony_ci#define DBI_DATA_WIDTH_16BIT			0x01	/* 16 bit data */
9228c2ecf20Sopenharmony_ci#define DBI_DATA_WIDTH_9BIT			0x02	/* 9 bit data */
9238c2ecf20Sopenharmony_ci#define DBI_DATA_WIDTH_8BIT			0x03	/* 8 bit data */
9248c2ecf20Sopenharmony_ci#define DBI_DATA_WIDTH_OPT1			0x04	/* option 1 */
9258c2ecf20Sopenharmony_ci#define DBI_DATA_WIDTH_OPT2			0x05	/* option 2 */
9268c2ecf20Sopenharmony_ci
9278c2ecf20Sopenharmony_ci#define HS_TX_TIMEOUT_REG		0xb010
9288c2ecf20Sopenharmony_ci#define LP_RX_TIMEOUT_REG		0xb014
9298c2ecf20Sopenharmony_ci#define TURN_AROUND_TIMEOUT_REG		0xb018
9308c2ecf20Sopenharmony_ci#define DEVICE_RESET_REG		0xb01C
9318c2ecf20Sopenharmony_ci#define DPI_RESOLUTION_REG		0xb020
9328c2ecf20Sopenharmony_ci#define RES_V_POS				0x10
9338c2ecf20Sopenharmony_ci#define DBI_RESOLUTION_REG		0xb024 /* Reserved for MDFLD */
9348c2ecf20Sopenharmony_ci#define HORIZ_SYNC_PAD_COUNT_REG	0xb028
9358c2ecf20Sopenharmony_ci#define HORIZ_BACK_PORCH_COUNT_REG	0xb02C
9368c2ecf20Sopenharmony_ci#define HORIZ_FRONT_PORCH_COUNT_REG	0xb030
9378c2ecf20Sopenharmony_ci#define HORIZ_ACTIVE_AREA_COUNT_REG	0xb034
9388c2ecf20Sopenharmony_ci#define VERT_SYNC_PAD_COUNT_REG		0xb038
9398c2ecf20Sopenharmony_ci#define VERT_BACK_PORCH_COUNT_REG	0xb03c
9408c2ecf20Sopenharmony_ci#define VERT_FRONT_PORCH_COUNT_REG	0xb040
9418c2ecf20Sopenharmony_ci#define HIGH_LOW_SWITCH_COUNT_REG	0xb044
9428c2ecf20Sopenharmony_ci#define DPI_CONTROL_REG			0xb048
9438c2ecf20Sopenharmony_ci#define DPI_SHUT_DOWN				(1 << 0)
9448c2ecf20Sopenharmony_ci#define DPI_TURN_ON				(1 << 1)
9458c2ecf20Sopenharmony_ci#define DPI_COLOR_MODE_ON			(1 << 2)
9468c2ecf20Sopenharmony_ci#define DPI_COLOR_MODE_OFF			(1 << 3)
9478c2ecf20Sopenharmony_ci#define DPI_BACK_LIGHT_ON			(1 << 4)
9488c2ecf20Sopenharmony_ci#define DPI_BACK_LIGHT_OFF			(1 << 5)
9498c2ecf20Sopenharmony_ci#define DPI_LP					(1 << 6)
9508c2ecf20Sopenharmony_ci#define DPI_DATA_REG			0xb04c
9518c2ecf20Sopenharmony_ci#define DPI_BACK_LIGHT_ON_DATA			0x07
9528c2ecf20Sopenharmony_ci#define DPI_BACK_LIGHT_OFF_DATA			0x17
9538c2ecf20Sopenharmony_ci#define INIT_COUNT_REG			0xb050
9548c2ecf20Sopenharmony_ci#define MAX_RET_PAK_REG			0xb054
9558c2ecf20Sopenharmony_ci#define VIDEO_FMT_REG			0xb058
9568c2ecf20Sopenharmony_ci#define COMPLETE_LAST_PCKT			(1 << 2)
9578c2ecf20Sopenharmony_ci#define EOT_DISABLE_REG			0xb05c
9588c2ecf20Sopenharmony_ci#define ENABLE_CLOCK_STOPPING			(1 << 1)
9598c2ecf20Sopenharmony_ci#define LP_BYTECLK_REG			0xb060
9608c2ecf20Sopenharmony_ci#define LP_GEN_DATA_REG			0xb064
9618c2ecf20Sopenharmony_ci#define HS_GEN_DATA_REG			0xb068
9628c2ecf20Sopenharmony_ci#define LP_GEN_CTRL_REG			0xb06C
9638c2ecf20Sopenharmony_ci#define HS_GEN_CTRL_REG			0xb070
9648c2ecf20Sopenharmony_ci#define DCS_CHANNEL_NUMBER_POS		0x6
9658c2ecf20Sopenharmony_ci#define MCS_COMMANDS_POS		0x8
9668c2ecf20Sopenharmony_ci#define WORD_COUNTS_POS			0x8
9678c2ecf20Sopenharmony_ci#define MCS_PARAMETER_POS			0x10
9688c2ecf20Sopenharmony_ci#define GEN_FIFO_STAT_REG		0xb074
9698c2ecf20Sopenharmony_ci#define HS_DATA_FIFO_FULL			(1 << 0)
9708c2ecf20Sopenharmony_ci#define HS_DATA_FIFO_HALF_EMPTY			(1 << 1)
9718c2ecf20Sopenharmony_ci#define HS_DATA_FIFO_EMPTY			(1 << 2)
9728c2ecf20Sopenharmony_ci#define LP_DATA_FIFO_FULL			(1 << 8)
9738c2ecf20Sopenharmony_ci#define LP_DATA_FIFO_HALF_EMPTY			(1 << 9)
9748c2ecf20Sopenharmony_ci#define LP_DATA_FIFO_EMPTY			(1 << 10)
9758c2ecf20Sopenharmony_ci#define HS_CTRL_FIFO_FULL			(1 << 16)
9768c2ecf20Sopenharmony_ci#define HS_CTRL_FIFO_HALF_EMPTY			(1 << 17)
9778c2ecf20Sopenharmony_ci#define HS_CTRL_FIFO_EMPTY			(1 << 18)
9788c2ecf20Sopenharmony_ci#define LP_CTRL_FIFO_FULL			(1 << 24)
9798c2ecf20Sopenharmony_ci#define LP_CTRL_FIFO_HALF_EMPTY			(1 << 25)
9808c2ecf20Sopenharmony_ci#define LP_CTRL_FIFO_EMPTY			(1 << 26)
9818c2ecf20Sopenharmony_ci#define DBI_FIFO_EMPTY				(1 << 27)
9828c2ecf20Sopenharmony_ci#define DPI_FIFO_EMPTY				(1 << 28)
9838c2ecf20Sopenharmony_ci#define HS_LS_DBI_ENABLE_REG		0xb078
9848c2ecf20Sopenharmony_ci#define TXCLKESC_REG			0xb07c
9858c2ecf20Sopenharmony_ci#define DPHY_PARAM_REG			0xb080
9868c2ecf20Sopenharmony_ci#define DBI_BW_CTRL_REG			0xb084
9878c2ecf20Sopenharmony_ci#define CLK_LANE_SWT_REG		0xb088
9888c2ecf20Sopenharmony_ci
9898c2ecf20Sopenharmony_ci/*
9908c2ecf20Sopenharmony_ci * MIPI Adapter registers
9918c2ecf20Sopenharmony_ci */
9928c2ecf20Sopenharmony_ci#define MIPI_CONTROL_REG		0xb104
9938c2ecf20Sopenharmony_ci#define MIPI_2X_CLOCK_BITS			((1 << 0) | (1 << 1))
9948c2ecf20Sopenharmony_ci#define MIPI_DATA_ADDRESS_REG		0xb108
9958c2ecf20Sopenharmony_ci#define MIPI_DATA_LENGTH_REG		0xb10C
9968c2ecf20Sopenharmony_ci#define MIPI_COMMAND_ADDRESS_REG	0xb110
9978c2ecf20Sopenharmony_ci#define MIPI_COMMAND_LENGTH_REG		0xb114
9988c2ecf20Sopenharmony_ci#define MIPI_READ_DATA_RETURN_REG0	0xb118
9998c2ecf20Sopenharmony_ci#define MIPI_READ_DATA_RETURN_REG1	0xb11C
10008c2ecf20Sopenharmony_ci#define MIPI_READ_DATA_RETURN_REG2	0xb120
10018c2ecf20Sopenharmony_ci#define MIPI_READ_DATA_RETURN_REG3	0xb124
10028c2ecf20Sopenharmony_ci#define MIPI_READ_DATA_RETURN_REG4	0xb128
10038c2ecf20Sopenharmony_ci#define MIPI_READ_DATA_RETURN_REG5	0xb12C
10048c2ecf20Sopenharmony_ci#define MIPI_READ_DATA_RETURN_REG6	0xb130
10058c2ecf20Sopenharmony_ci#define MIPI_READ_DATA_RETURN_REG7	0xb134
10068c2ecf20Sopenharmony_ci#define MIPI_READ_DATA_VALID_REG	0xb138
10078c2ecf20Sopenharmony_ci
10088c2ecf20Sopenharmony_ci/* DBI COMMANDS */
10098c2ecf20Sopenharmony_ci#define soft_reset			0x01
10108c2ecf20Sopenharmony_ci/*
10118c2ecf20Sopenharmony_ci *	The display module performs a software reset.
10128c2ecf20Sopenharmony_ci *	Registers are written with their SW Reset default values.
10138c2ecf20Sopenharmony_ci */
10148c2ecf20Sopenharmony_ci#define get_power_mode			0x0a
10158c2ecf20Sopenharmony_ci/*
10168c2ecf20Sopenharmony_ci *	The display module returns the current power mode
10178c2ecf20Sopenharmony_ci */
10188c2ecf20Sopenharmony_ci#define get_address_mode		0x0b
10198c2ecf20Sopenharmony_ci/*
10208c2ecf20Sopenharmony_ci *	The display module returns the current status.
10218c2ecf20Sopenharmony_ci */
10228c2ecf20Sopenharmony_ci#define get_pixel_format		0x0c
10238c2ecf20Sopenharmony_ci/*
10248c2ecf20Sopenharmony_ci *	This command gets the pixel format for the RGB image data
10258c2ecf20Sopenharmony_ci *	used by the interface.
10268c2ecf20Sopenharmony_ci */
10278c2ecf20Sopenharmony_ci#define get_display_mode		0x0d
10288c2ecf20Sopenharmony_ci/*
10298c2ecf20Sopenharmony_ci *	The display module returns the Display Image Mode status.
10308c2ecf20Sopenharmony_ci */
10318c2ecf20Sopenharmony_ci#define get_signal_mode			0x0e
10328c2ecf20Sopenharmony_ci/*
10338c2ecf20Sopenharmony_ci *	The display module returns the Display Signal Mode.
10348c2ecf20Sopenharmony_ci */
10358c2ecf20Sopenharmony_ci#define get_diagnostic_result		0x0f
10368c2ecf20Sopenharmony_ci/*
10378c2ecf20Sopenharmony_ci *	The display module returns the self-diagnostic results following
10388c2ecf20Sopenharmony_ci *	a Sleep Out command.
10398c2ecf20Sopenharmony_ci */
10408c2ecf20Sopenharmony_ci#define enter_sleep_mode		0x10
10418c2ecf20Sopenharmony_ci/*
10428c2ecf20Sopenharmony_ci *	This command causes the display module to enter the Sleep mode.
10438c2ecf20Sopenharmony_ci *	In this mode, all unnecessary blocks inside the display module are
10448c2ecf20Sopenharmony_ci *	disabled except interface communication. This is the lowest power
10458c2ecf20Sopenharmony_ci *	mode the display module supports.
10468c2ecf20Sopenharmony_ci */
10478c2ecf20Sopenharmony_ci#define exit_sleep_mode			0x11
10488c2ecf20Sopenharmony_ci/*
10498c2ecf20Sopenharmony_ci *	This command causes the display module to exit Sleep mode.
10508c2ecf20Sopenharmony_ci *	All blocks inside the display module are enabled.
10518c2ecf20Sopenharmony_ci */
10528c2ecf20Sopenharmony_ci#define enter_partial_mode		0x12
10538c2ecf20Sopenharmony_ci/*
10548c2ecf20Sopenharmony_ci *	This command causes the display module to enter the Partial Display
10558c2ecf20Sopenharmony_ci *	Mode. The Partial Display Mode window is described by the
10568c2ecf20Sopenharmony_ci *	set_partial_area command.
10578c2ecf20Sopenharmony_ci */
10588c2ecf20Sopenharmony_ci#define enter_normal_mode		0x13
10598c2ecf20Sopenharmony_ci/*
10608c2ecf20Sopenharmony_ci *	This command causes the display module to enter the Normal mode.
10618c2ecf20Sopenharmony_ci *	Normal Mode is defined as Partial Display mode and Scroll mode are off
10628c2ecf20Sopenharmony_ci */
10638c2ecf20Sopenharmony_ci#define exit_invert_mode		0x20
10648c2ecf20Sopenharmony_ci/*
10658c2ecf20Sopenharmony_ci *	This command causes the display module to stop inverting the image
10668c2ecf20Sopenharmony_ci *	data on the display device. The frame memory contents remain unchanged.
10678c2ecf20Sopenharmony_ci *	No status bits are changed.
10688c2ecf20Sopenharmony_ci */
10698c2ecf20Sopenharmony_ci#define enter_invert_mode		0x21
10708c2ecf20Sopenharmony_ci/*
10718c2ecf20Sopenharmony_ci *	This command causes the display module to invert the image data only on
10728c2ecf20Sopenharmony_ci *	the display device. The frame memory contents remain unchanged.
10738c2ecf20Sopenharmony_ci *	No status bits are changed.
10748c2ecf20Sopenharmony_ci */
10758c2ecf20Sopenharmony_ci#define set_gamma_curve			0x26
10768c2ecf20Sopenharmony_ci/*
10778c2ecf20Sopenharmony_ci *	This command selects the desired gamma curve for the display device.
10788c2ecf20Sopenharmony_ci *	Four fixed gamma curves are defined in section DCS spec.
10798c2ecf20Sopenharmony_ci */
10808c2ecf20Sopenharmony_ci#define set_display_off			0x28
10818c2ecf20Sopenharmony_ci/* ************************************************************************* *\
10828c2ecf20Sopenharmony_ciThis command causes the display module to stop displaying the image data
10838c2ecf20Sopenharmony_cion the display device. The frame memory contents remain unchanged.
10848c2ecf20Sopenharmony_ciNo status bits are changed.
10858c2ecf20Sopenharmony_ci\* ************************************************************************* */
10868c2ecf20Sopenharmony_ci#define set_display_on			0x29
10878c2ecf20Sopenharmony_ci/* ************************************************************************* *\
10888c2ecf20Sopenharmony_ciThis command causes the display module to start displaying the image data
10898c2ecf20Sopenharmony_cion the display device. The frame memory contents remain unchanged.
10908c2ecf20Sopenharmony_ciNo status bits are changed.
10918c2ecf20Sopenharmony_ci\* ************************************************************************* */
10928c2ecf20Sopenharmony_ci#define set_column_address		0x2a
10938c2ecf20Sopenharmony_ci/*
10948c2ecf20Sopenharmony_ci *	This command defines the column extent of the frame memory accessed by
10958c2ecf20Sopenharmony_ci *	the hostprocessor with the read_memory_continue and
10968c2ecf20Sopenharmony_ci *	write_memory_continue commands.
10978c2ecf20Sopenharmony_ci *	No status bits are changed.
10988c2ecf20Sopenharmony_ci */
10998c2ecf20Sopenharmony_ci#define set_page_addr			0x2b
11008c2ecf20Sopenharmony_ci/*
11018c2ecf20Sopenharmony_ci *	This command defines the page extent of the frame memory accessed by
11028c2ecf20Sopenharmony_ci *	the host processor with the write_memory_continue and
11038c2ecf20Sopenharmony_ci *	read_memory_continue command.
11048c2ecf20Sopenharmony_ci *	No status bits are changed.
11058c2ecf20Sopenharmony_ci */
11068c2ecf20Sopenharmony_ci#define write_mem_start			0x2c
11078c2ecf20Sopenharmony_ci/*
11088c2ecf20Sopenharmony_ci *	This command transfers image data from the host processor to the
11098c2ecf20Sopenharmony_ci *	display modules frame memory starting at the pixel location specified
11108c2ecf20Sopenharmony_ci *	by preceding set_column_address and set_page_address commands.
11118c2ecf20Sopenharmony_ci */
11128c2ecf20Sopenharmony_ci#define set_partial_area		0x30
11138c2ecf20Sopenharmony_ci/*
11148c2ecf20Sopenharmony_ci *	This command defines the Partial Display mode s display area.
11158c2ecf20Sopenharmony_ci *	There are two parameters associated with this command, the first
11168c2ecf20Sopenharmony_ci *	defines the Start Row (SR) and the second the End Row (ER). SR and ER
11178c2ecf20Sopenharmony_ci *	refer to the Frame Memory Line Pointer.
11188c2ecf20Sopenharmony_ci */
11198c2ecf20Sopenharmony_ci#define set_scroll_area			0x33
11208c2ecf20Sopenharmony_ci/*
11218c2ecf20Sopenharmony_ci *	This command defines the display modules Vertical Scrolling Area.
11228c2ecf20Sopenharmony_ci */
11238c2ecf20Sopenharmony_ci#define set_tear_off			0x34
11248c2ecf20Sopenharmony_ci/*
11258c2ecf20Sopenharmony_ci *	This command turns off the display modules Tearing Effect output
11268c2ecf20Sopenharmony_ci *	signal on the TE signal line.
11278c2ecf20Sopenharmony_ci */
11288c2ecf20Sopenharmony_ci#define set_tear_on			0x35
11298c2ecf20Sopenharmony_ci/*
11308c2ecf20Sopenharmony_ci *	This command turns on the display modules Tearing Effect output signal
11318c2ecf20Sopenharmony_ci *	on the TE signal line.
11328c2ecf20Sopenharmony_ci */
11338c2ecf20Sopenharmony_ci#define set_address_mode		0x36
11348c2ecf20Sopenharmony_ci/*
11358c2ecf20Sopenharmony_ci *	This command sets the data order for transfers from the host processor
11368c2ecf20Sopenharmony_ci *	to display modules frame memory,bits B[7:5] and B3, and from the
11378c2ecf20Sopenharmony_ci *	display modules frame memory to the display device, bits B[2:0] and B4.
11388c2ecf20Sopenharmony_ci */
11398c2ecf20Sopenharmony_ci#define set_scroll_start		0x37
11408c2ecf20Sopenharmony_ci/*
11418c2ecf20Sopenharmony_ci *	This command sets the start of the vertical scrolling area in the frame
11428c2ecf20Sopenharmony_ci *	memory. The vertical scrolling area is fully defined when this command
11438c2ecf20Sopenharmony_ci *	is used with the set_scroll_area command The set_scroll_start command
11448c2ecf20Sopenharmony_ci *	has one parameter, the Vertical Scroll Pointer. The VSP defines the
11458c2ecf20Sopenharmony_ci *	line in the frame memory that is written to the display device as the
11468c2ecf20Sopenharmony_ci *	first line of the vertical scroll area.
11478c2ecf20Sopenharmony_ci */
11488c2ecf20Sopenharmony_ci#define exit_idle_mode			0x38
11498c2ecf20Sopenharmony_ci/*
11508c2ecf20Sopenharmony_ci *	This command causes the display module to exit Idle mode.
11518c2ecf20Sopenharmony_ci */
11528c2ecf20Sopenharmony_ci#define enter_idle_mode			0x39
11538c2ecf20Sopenharmony_ci/*
11548c2ecf20Sopenharmony_ci *	This command causes the display module to enter Idle Mode.
11558c2ecf20Sopenharmony_ci *	In Idle Mode, color expression is reduced. Colors are shown on the
11568c2ecf20Sopenharmony_ci *	display device using the MSB of each of the R, G and B color
11578c2ecf20Sopenharmony_ci *	components in the frame memory
11588c2ecf20Sopenharmony_ci */
11598c2ecf20Sopenharmony_ci#define set_pixel_format		0x3a
11608c2ecf20Sopenharmony_ci/*
11618c2ecf20Sopenharmony_ci *	This command sets the pixel format for the RGB image data used by the
11628c2ecf20Sopenharmony_ci *	interface.
11638c2ecf20Sopenharmony_ci *	Bits D[6:4]  DPI Pixel Format Definition
11648c2ecf20Sopenharmony_ci *	Bits D[2:0]  DBI Pixel Format Definition
11658c2ecf20Sopenharmony_ci *	Bits D7 and D3 are not used.
11668c2ecf20Sopenharmony_ci */
11678c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_3bpp		0x1
11688c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_8bpp		0x2
11698c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_12bpp		0x3
11708c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_16bpp		0x5
11718c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_18bpp		0x6
11728c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_24bpp		0x7
11738c2ecf20Sopenharmony_ci
11748c2ecf20Sopenharmony_ci#define write_mem_cont			0x3c
11758c2ecf20Sopenharmony_ci
11768c2ecf20Sopenharmony_ci/*
11778c2ecf20Sopenharmony_ci *	This command transfers image data from the host processor to the
11788c2ecf20Sopenharmony_ci *	display module's frame memory continuing from the pixel location
11798c2ecf20Sopenharmony_ci *	following the previous write_memory_continue or write_memory_start
11808c2ecf20Sopenharmony_ci *	command.
11818c2ecf20Sopenharmony_ci */
11828c2ecf20Sopenharmony_ci#define set_tear_scanline		0x44
11838c2ecf20Sopenharmony_ci/*
11848c2ecf20Sopenharmony_ci *	This command turns on the display modules Tearing Effect output signal
11858c2ecf20Sopenharmony_ci *	on the TE signal line when the display module reaches line N.
11868c2ecf20Sopenharmony_ci */
11878c2ecf20Sopenharmony_ci#define get_scanline			0x45
11888c2ecf20Sopenharmony_ci/*
11898c2ecf20Sopenharmony_ci *	The display module returns the current scanline, N, used to update the
11908c2ecf20Sopenharmony_ci *	 display device. The total number of scanlines on a display device is
11918c2ecf20Sopenharmony_ci *	defined as VSYNC + VBP + VACT + VFP.The first scanline is defined as
11928c2ecf20Sopenharmony_ci *	the first line of V Sync and is denoted as Line 0.
11938c2ecf20Sopenharmony_ci *	When in Sleep Mode, the value returned by get_scanline is undefined.
11948c2ecf20Sopenharmony_ci */
11958c2ecf20Sopenharmony_ci
11968c2ecf20Sopenharmony_ci/* MCS or Generic COMMANDS */
11978c2ecf20Sopenharmony_ci/* MCS/generic data type */
11988c2ecf20Sopenharmony_ci#define GEN_SHORT_WRITE_0	0x03  /* generic short write, no parameters */
11998c2ecf20Sopenharmony_ci#define GEN_SHORT_WRITE_1	0x13  /* generic short write, 1 parameters */
12008c2ecf20Sopenharmony_ci#define GEN_SHORT_WRITE_2	0x23  /* generic short write, 2 parameters */
12018c2ecf20Sopenharmony_ci#define GEN_READ_0		0x04  /* generic read, no parameters */
12028c2ecf20Sopenharmony_ci#define GEN_READ_1		0x14  /* generic read, 1 parameters */
12038c2ecf20Sopenharmony_ci#define GEN_READ_2		0x24  /* generic read, 2 parameters */
12048c2ecf20Sopenharmony_ci#define GEN_LONG_WRITE		0x29  /* generic long write */
12058c2ecf20Sopenharmony_ci#define MCS_SHORT_WRITE_0	0x05  /* MCS short write, no parameters */
12068c2ecf20Sopenharmony_ci#define MCS_SHORT_WRITE_1	0x15  /* MCS short write, 1 parameters */
12078c2ecf20Sopenharmony_ci#define MCS_READ		0x06  /* MCS read, no parameters */
12088c2ecf20Sopenharmony_ci#define MCS_LONG_WRITE		0x39  /* MCS long write */
12098c2ecf20Sopenharmony_ci/* MCS/generic commands */
12108c2ecf20Sopenharmony_ci/* TPO MCS */
12118c2ecf20Sopenharmony_ci#define write_display_profile		0x50
12128c2ecf20Sopenharmony_ci#define write_display_brightness	0x51
12138c2ecf20Sopenharmony_ci#define write_ctrl_display		0x53
12148c2ecf20Sopenharmony_ci#define write_ctrl_cabc			0x55
12158c2ecf20Sopenharmony_ci  #define UI_IMAGE		0x01
12168c2ecf20Sopenharmony_ci  #define STILL_IMAGE		0x02
12178c2ecf20Sopenharmony_ci  #define MOVING_IMAGE		0x03
12188c2ecf20Sopenharmony_ci#define write_hysteresis		0x57
12198c2ecf20Sopenharmony_ci#define write_gamma_setting		0x58
12208c2ecf20Sopenharmony_ci#define write_cabc_min_bright		0x5e
12218c2ecf20Sopenharmony_ci#define write_kbbc_profile		0x60
12228c2ecf20Sopenharmony_ci/* TMD MCS */
12238c2ecf20Sopenharmony_ci#define tmd_write_display_brightness 0x8c
12248c2ecf20Sopenharmony_ci
12258c2ecf20Sopenharmony_ci/*
12268c2ecf20Sopenharmony_ci *	This command is used to control ambient light, panel backlight
12278c2ecf20Sopenharmony_ci *	brightness and gamma settings.
12288c2ecf20Sopenharmony_ci */
12298c2ecf20Sopenharmony_ci#define BRIGHT_CNTL_BLOCK_ON	(1 << 5)
12308c2ecf20Sopenharmony_ci#define AMBIENT_LIGHT_SENSE_ON	(1 << 4)
12318c2ecf20Sopenharmony_ci#define DISPLAY_DIMMING_ON	(1 << 3)
12328c2ecf20Sopenharmony_ci#define BACKLIGHT_ON		(1 << 2)
12338c2ecf20Sopenharmony_ci#define DISPLAY_BRIGHTNESS_AUTO	(1 << 1)
12348c2ecf20Sopenharmony_ci#define GAMMA_AUTO		(1 << 0)
12358c2ecf20Sopenharmony_ci
12368c2ecf20Sopenharmony_ci/* DCS Interface Pixel Formats */
12378c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_3BPP	0x1
12388c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_8BPP	0x2
12398c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_12BPP	0x3
12408c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_16BPP	0x5
12418c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_18BPP	0x6
12428c2ecf20Sopenharmony_ci#define DCS_PIXEL_FORMAT_24BPP	0x7
12438c2ecf20Sopenharmony_ci/* ONE PARAMETER READ DATA */
12448c2ecf20Sopenharmony_ci#define addr_mode_data		0xfc
12458c2ecf20Sopenharmony_ci#define diag_res_data		0x00
12468c2ecf20Sopenharmony_ci#define disp_mode_data		0x23
12478c2ecf20Sopenharmony_ci#define pxl_fmt_data		0x77
12488c2ecf20Sopenharmony_ci#define pwr_mode_data		0x74
12498c2ecf20Sopenharmony_ci#define sig_mode_data		0x00
12508c2ecf20Sopenharmony_ci/* TWO PARAMETERS READ DATA */
12518c2ecf20Sopenharmony_ci#define scanline_data1		0xff
12528c2ecf20Sopenharmony_ci#define scanline_data2		0xff
12538c2ecf20Sopenharmony_ci#define NON_BURST_MODE_SYNC_PULSE	0x01	/* Non Burst Mode
12548c2ecf20Sopenharmony_ci						 * with Sync Pulse
12558c2ecf20Sopenharmony_ci						 */
12568c2ecf20Sopenharmony_ci#define NON_BURST_MODE_SYNC_EVENTS	0x02	/* Non Burst Mode
12578c2ecf20Sopenharmony_ci						 * with Sync events
12588c2ecf20Sopenharmony_ci						 */
12598c2ecf20Sopenharmony_ci#define BURST_MODE			0x03	/* Burst Mode */
12608c2ecf20Sopenharmony_ci#define DBI_COMMAND_BUFFER_SIZE		0x240   /* 0x32 */    /* 0x120 */
12618c2ecf20Sopenharmony_ci						/* Allocate at least
12628c2ecf20Sopenharmony_ci						 * 0x100 Byte with 32
12638c2ecf20Sopenharmony_ci						 * byte alignment
12648c2ecf20Sopenharmony_ci						 */
12658c2ecf20Sopenharmony_ci#define DBI_DATA_BUFFER_SIZE		0x120	/* Allocate at least
12668c2ecf20Sopenharmony_ci						 * 0x100 Byte with 32
12678c2ecf20Sopenharmony_ci						 * byte alignment
12688c2ecf20Sopenharmony_ci						 */
12698c2ecf20Sopenharmony_ci#define DBI_CB_TIME_OUT			0xFFFF
12708c2ecf20Sopenharmony_ci
12718c2ecf20Sopenharmony_ci#define GEN_FB_TIME_OUT			2000
12728c2ecf20Sopenharmony_ci
12738c2ecf20Sopenharmony_ci#define SKU_83				0x01
12748c2ecf20Sopenharmony_ci#define SKU_100				0x02
12758c2ecf20Sopenharmony_ci#define SKU_100L			0x04
12768c2ecf20Sopenharmony_ci#define SKU_BYPASS			0x08
12778c2ecf20Sopenharmony_ci
12788c2ecf20Sopenharmony_ci/* Some handy macros for playing with bitfields. */
12798c2ecf20Sopenharmony_ci#define PSB_MASK(high, low) (((1<<((high)-(low)+1))-1)<<(low))
12808c2ecf20Sopenharmony_ci#define SET_FIELD(value, field) (((value) << field ## _SHIFT) & field ## _MASK)
12818c2ecf20Sopenharmony_ci#define GET_FIELD(word, field) (((word)  & field ## _MASK) >> field ## _SHIFT)
12828c2ecf20Sopenharmony_ci
12838c2ecf20Sopenharmony_ci#define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
12848c2ecf20Sopenharmony_ci
12858c2ecf20Sopenharmony_ci/* PCI config space */
12868c2ecf20Sopenharmony_ci
12878c2ecf20Sopenharmony_ci#define SB_PCKT         0x02100 /* cedarview */
12888c2ecf20Sopenharmony_ci# define SB_OPCODE_MASK                         PSB_MASK(31, 16)
12898c2ecf20Sopenharmony_ci# define SB_OPCODE_SHIFT                        16
12908c2ecf20Sopenharmony_ci# define SB_OPCODE_READ                         0
12918c2ecf20Sopenharmony_ci# define SB_OPCODE_WRITE                        1
12928c2ecf20Sopenharmony_ci# define SB_DEST_MASK                           PSB_MASK(15, 8)
12938c2ecf20Sopenharmony_ci# define SB_DEST_SHIFT                          8
12948c2ecf20Sopenharmony_ci# define SB_DEST_DPLL                           0x88
12958c2ecf20Sopenharmony_ci# define SB_BYTE_ENABLE_MASK                    PSB_MASK(7, 4)
12968c2ecf20Sopenharmony_ci# define SB_BYTE_ENABLE_SHIFT                   4
12978c2ecf20Sopenharmony_ci# define SB_BUSY                                (1 << 0)
12988c2ecf20Sopenharmony_ci
12998c2ecf20Sopenharmony_ci#define DSPCLK_GATE_D		0x6200
13008c2ecf20Sopenharmony_ci# define VRHUNIT_CLOCK_GATE_DISABLE		(1 << 28) /* Fixed value on CDV */
13018c2ecf20Sopenharmony_ci# define DPOUNIT_CLOCK_GATE_DISABLE		(1 << 11)
13028c2ecf20Sopenharmony_ci# define DPIOUNIT_CLOCK_GATE_DISABLE		(1 << 6)
13038c2ecf20Sopenharmony_ci# define DPUNIT_PIPEB_GATE_DISABLE		(1 << 30)
13048c2ecf20Sopenharmony_ci# define DPUNIT_PIPEA_GATE_DISABLE		(1 << 25)
13058c2ecf20Sopenharmony_ci# define DPCUNIT_CLOCK_GATE_DISABLE		(1 << 24)
13068c2ecf20Sopenharmony_ci# define DPLSUNIT_CLOCK_GATE_DISABLE		(1 << 13)
13078c2ecf20Sopenharmony_ci
13088c2ecf20Sopenharmony_ci#define RAMCLK_GATE_D		0x6210
13098c2ecf20Sopenharmony_ci
13108c2ecf20Sopenharmony_ci/* 32-bit value read/written from the DPIO reg. */
13118c2ecf20Sopenharmony_ci#define SB_DATA		0x02104 /* cedarview */
13128c2ecf20Sopenharmony_ci/* 32-bit address of the DPIO reg to be read/written. */
13138c2ecf20Sopenharmony_ci#define SB_ADDR		0x02108 /* cedarview */
13148c2ecf20Sopenharmony_ci#define DPIO_CFG	0x02110 /* cedarview */
13158c2ecf20Sopenharmony_ci# define DPIO_MODE_SELECT_1			(1 << 3)
13168c2ecf20Sopenharmony_ci# define DPIO_MODE_SELECT_0			(1 << 2)
13178c2ecf20Sopenharmony_ci# define DPIO_SFR_BYPASS			(1 << 1)
13188c2ecf20Sopenharmony_ci/* reset is active low */
13198c2ecf20Sopenharmony_ci# define DPIO_CMN_RESET_N			(1 << 0)
13208c2ecf20Sopenharmony_ci
13218c2ecf20Sopenharmony_ci/* Cedarview sideband registers */
13228c2ecf20Sopenharmony_ci#define _SB_M_A			0x8008
13238c2ecf20Sopenharmony_ci#define _SB_M_B			0x8028
13248c2ecf20Sopenharmony_ci#define SB_M(pipe) _PIPE(pipe, _SB_M_A, _SB_M_B)
13258c2ecf20Sopenharmony_ci# define SB_M_DIVIDER_MASK			(0xFF << 24)
13268c2ecf20Sopenharmony_ci# define SB_M_DIVIDER_SHIFT			24
13278c2ecf20Sopenharmony_ci
13288c2ecf20Sopenharmony_ci#define _SB_N_VCO_A		0x8014
13298c2ecf20Sopenharmony_ci#define _SB_N_VCO_B		0x8034
13308c2ecf20Sopenharmony_ci#define SB_N_VCO(pipe) _PIPE(pipe, _SB_N_VCO_A, _SB_N_VCO_B)
13318c2ecf20Sopenharmony_ci#define SB_N_VCO_SEL_MASK			PSB_MASK(31, 30)
13328c2ecf20Sopenharmony_ci#define SB_N_VCO_SEL_SHIFT			30
13338c2ecf20Sopenharmony_ci#define SB_N_DIVIDER_MASK			PSB_MASK(29, 26)
13348c2ecf20Sopenharmony_ci#define SB_N_DIVIDER_SHIFT			26
13358c2ecf20Sopenharmony_ci#define SB_N_CB_TUNE_MASK			PSB_MASK(25, 24)
13368c2ecf20Sopenharmony_ci#define SB_N_CB_TUNE_SHIFT			24
13378c2ecf20Sopenharmony_ci
13388c2ecf20Sopenharmony_ci/* the bit 14:13 is used to select between the different reference clock for Pipe A/B */
13398c2ecf20Sopenharmony_ci#define SB_REF_DPLLA		0x8010
13408c2ecf20Sopenharmony_ci#define SB_REF_DPLLB		0x8030
13418c2ecf20Sopenharmony_ci#define	REF_CLK_MASK		(0x3 << 13)
13428c2ecf20Sopenharmony_ci#define REF_CLK_CORE		(0 << 13)
13438c2ecf20Sopenharmony_ci#define REF_CLK_DPLL		(1 << 13)
13448c2ecf20Sopenharmony_ci#define REF_CLK_DPLLA		(2 << 13)
13458c2ecf20Sopenharmony_ci/* For the DPLL B, it will use the reference clk from DPLL A when using (2 << 13) */
13468c2ecf20Sopenharmony_ci
13478c2ecf20Sopenharmony_ci#define _SB_REF_A		0x8018
13488c2ecf20Sopenharmony_ci#define _SB_REF_B		0x8038
13498c2ecf20Sopenharmony_ci#define SB_REF_SFR(pipe)	_PIPE(pipe, _SB_REF_A, _SB_REF_B)
13508c2ecf20Sopenharmony_ci
13518c2ecf20Sopenharmony_ci#define _SB_P_A			0x801c
13528c2ecf20Sopenharmony_ci#define _SB_P_B			0x803c
13538c2ecf20Sopenharmony_ci#define SB_P(pipe) _PIPE(pipe, _SB_P_A, _SB_P_B)
13548c2ecf20Sopenharmony_ci#define SB_P2_DIVIDER_MASK			PSB_MASK(31, 30)
13558c2ecf20Sopenharmony_ci#define SB_P2_DIVIDER_SHIFT			30
13568c2ecf20Sopenharmony_ci#define SB_P2_10				0 /* HDMI, DP, DAC */
13578c2ecf20Sopenharmony_ci#define SB_P2_5				1 /* DAC */
13588c2ecf20Sopenharmony_ci#define SB_P2_14				2 /* LVDS single */
13598c2ecf20Sopenharmony_ci#define SB_P2_7				3 /* LVDS double */
13608c2ecf20Sopenharmony_ci#define SB_P1_DIVIDER_MASK			PSB_MASK(15, 12)
13618c2ecf20Sopenharmony_ci#define SB_P1_DIVIDER_SHIFT			12
13628c2ecf20Sopenharmony_ci
13638c2ecf20Sopenharmony_ci#define PSB_LANE0		0x120
13648c2ecf20Sopenharmony_ci#define PSB_LANE1		0x220
13658c2ecf20Sopenharmony_ci#define PSB_LANE2		0x2320
13668c2ecf20Sopenharmony_ci#define PSB_LANE3		0x2420
13678c2ecf20Sopenharmony_ci
13688c2ecf20Sopenharmony_ci#define LANE_PLL_MASK		(0x7 << 20)
13698c2ecf20Sopenharmony_ci#define LANE_PLL_ENABLE		(0x3 << 20)
13708c2ecf20Sopenharmony_ci#define LANE_PLL_PIPE(p)	(((p) == 0) ? (1 << 21) : (0 << 21))
13718c2ecf20Sopenharmony_ci
13728c2ecf20Sopenharmony_ci#define DP_B				0x64100
13738c2ecf20Sopenharmony_ci#define DP_C				0x64200
13748c2ecf20Sopenharmony_ci
13758c2ecf20Sopenharmony_ci#define   DP_PORT_EN			(1 << 31)
13768c2ecf20Sopenharmony_ci#define   DP_PIPEB_SELECT		(1 << 30)
13778c2ecf20Sopenharmony_ci#define   DP_PIPE_MASK			(1 << 30)
13788c2ecf20Sopenharmony_ci
13798c2ecf20Sopenharmony_ci/* Link training mode - select a suitable mode for each stage */
13808c2ecf20Sopenharmony_ci#define   DP_LINK_TRAIN_PAT_1		(0 << 28)
13818c2ecf20Sopenharmony_ci#define   DP_LINK_TRAIN_PAT_2		(1 << 28)
13828c2ecf20Sopenharmony_ci#define   DP_LINK_TRAIN_PAT_IDLE	(2 << 28)
13838c2ecf20Sopenharmony_ci#define   DP_LINK_TRAIN_OFF		(3 << 28)
13848c2ecf20Sopenharmony_ci#define   DP_LINK_TRAIN_MASK		(3 << 28)
13858c2ecf20Sopenharmony_ci#define   DP_LINK_TRAIN_SHIFT		28
13868c2ecf20Sopenharmony_ci
13878c2ecf20Sopenharmony_ci/* Signal voltages. These are mostly controlled by the other end */
13888c2ecf20Sopenharmony_ci#define   DP_VOLTAGE_0_4		(0 << 25)
13898c2ecf20Sopenharmony_ci#define   DP_VOLTAGE_0_6		(1 << 25)
13908c2ecf20Sopenharmony_ci#define   DP_VOLTAGE_0_8		(2 << 25)
13918c2ecf20Sopenharmony_ci#define   DP_VOLTAGE_1_2		(3 << 25)
13928c2ecf20Sopenharmony_ci#define   DP_VOLTAGE_MASK		(7 << 25)
13938c2ecf20Sopenharmony_ci#define   DP_VOLTAGE_SHIFT		25
13948c2ecf20Sopenharmony_ci
13958c2ecf20Sopenharmony_ci/* Signal pre-emphasis levels, like voltages, the other end tells us what
13968c2ecf20Sopenharmony_ci * they want
13978c2ecf20Sopenharmony_ci */
13988c2ecf20Sopenharmony_ci#define   DP_PRE_EMPHASIS_0		(0 << 22)
13998c2ecf20Sopenharmony_ci#define   DP_PRE_EMPHASIS_3_5		(1 << 22)
14008c2ecf20Sopenharmony_ci#define   DP_PRE_EMPHASIS_6		(2 << 22)
14018c2ecf20Sopenharmony_ci#define   DP_PRE_EMPHASIS_9_5		(3 << 22)
14028c2ecf20Sopenharmony_ci#define   DP_PRE_EMPHASIS_MASK		(7 << 22)
14038c2ecf20Sopenharmony_ci#define   DP_PRE_EMPHASIS_SHIFT		22
14048c2ecf20Sopenharmony_ci
14058c2ecf20Sopenharmony_ci/* How many wires to use. I guess 3 was too hard */
14068c2ecf20Sopenharmony_ci#define   DP_PORT_WIDTH_1		(0 << 19)
14078c2ecf20Sopenharmony_ci#define   DP_PORT_WIDTH_2		(1 << 19)
14088c2ecf20Sopenharmony_ci#define   DP_PORT_WIDTH_4		(3 << 19)
14098c2ecf20Sopenharmony_ci#define   DP_PORT_WIDTH_MASK		(7 << 19)
14108c2ecf20Sopenharmony_ci
14118c2ecf20Sopenharmony_ci/* Mystic DPCD version 1.1 special mode */
14128c2ecf20Sopenharmony_ci#define   DP_ENHANCED_FRAMING		(1 << 18)
14138c2ecf20Sopenharmony_ci
14148c2ecf20Sopenharmony_ci/** locked once port is enabled */
14158c2ecf20Sopenharmony_ci#define   DP_PORT_REVERSAL		(1 << 15)
14168c2ecf20Sopenharmony_ci
14178c2ecf20Sopenharmony_ci/** sends the clock on lane 15 of the PEG for debug */
14188c2ecf20Sopenharmony_ci#define   DP_CLOCK_OUTPUT_ENABLE	(1 << 13)
14198c2ecf20Sopenharmony_ci
14208c2ecf20Sopenharmony_ci#define   DP_SCRAMBLING_DISABLE		(1 << 12)
14218c2ecf20Sopenharmony_ci#define   DP_SCRAMBLING_DISABLE_IRONLAKE	(1 << 7)
14228c2ecf20Sopenharmony_ci
14238c2ecf20Sopenharmony_ci/** limit RGB values to avoid confusing TVs */
14248c2ecf20Sopenharmony_ci#define   DP_COLOR_RANGE_16_235		(1 << 8)
14258c2ecf20Sopenharmony_ci
14268c2ecf20Sopenharmony_ci/** Turn on the audio link */
14278c2ecf20Sopenharmony_ci#define   DP_AUDIO_OUTPUT_ENABLE	(1 << 6)
14288c2ecf20Sopenharmony_ci
14298c2ecf20Sopenharmony_ci/** vs and hs sync polarity */
14308c2ecf20Sopenharmony_ci#define   DP_SYNC_VS_HIGH		(1 << 4)
14318c2ecf20Sopenharmony_ci#define   DP_SYNC_HS_HIGH		(1 << 3)
14328c2ecf20Sopenharmony_ci
14338c2ecf20Sopenharmony_ci/** A fantasy */
14348c2ecf20Sopenharmony_ci#define   DP_DETECTED			(1 << 2)
14358c2ecf20Sopenharmony_ci
14368c2ecf20Sopenharmony_ci/** The aux channel provides a way to talk to the
14378c2ecf20Sopenharmony_ci * signal sink for DDC etc. Max packet size supported
14388c2ecf20Sopenharmony_ci * is 20 bytes in each direction, hence the 5 fixed
14398c2ecf20Sopenharmony_ci * data registers
14408c2ecf20Sopenharmony_ci */
14418c2ecf20Sopenharmony_ci#define DPB_AUX_CH_CTL			0x64110
14428c2ecf20Sopenharmony_ci#define DPB_AUX_CH_DATA1		0x64114
14438c2ecf20Sopenharmony_ci#define DPB_AUX_CH_DATA2		0x64118
14448c2ecf20Sopenharmony_ci#define DPB_AUX_CH_DATA3		0x6411c
14458c2ecf20Sopenharmony_ci#define DPB_AUX_CH_DATA4		0x64120
14468c2ecf20Sopenharmony_ci#define DPB_AUX_CH_DATA5		0x64124
14478c2ecf20Sopenharmony_ci
14488c2ecf20Sopenharmony_ci#define DPC_AUX_CH_CTL			0x64210
14498c2ecf20Sopenharmony_ci#define DPC_AUX_CH_DATA1		0x64214
14508c2ecf20Sopenharmony_ci#define DPC_AUX_CH_DATA2		0x64218
14518c2ecf20Sopenharmony_ci#define DPC_AUX_CH_DATA3		0x6421c
14528c2ecf20Sopenharmony_ci#define DPC_AUX_CH_DATA4		0x64220
14538c2ecf20Sopenharmony_ci#define DPC_AUX_CH_DATA5		0x64224
14548c2ecf20Sopenharmony_ci
14558c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_SEND_BUSY	    (1 << 31)
14568c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_DONE		    (1 << 30)
14578c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_INTERRUPT	    (1 << 29)
14588c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_TIME_OUT_ERROR	    (1 << 28)
14598c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_TIME_OUT_400us	    (0 << 26)
14608c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_TIME_OUT_600us	    (1 << 26)
14618c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_TIME_OUT_800us	    (2 << 26)
14628c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_TIME_OUT_1600us	    (3 << 26)
14638c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_TIME_OUT_MASK	    (3 << 26)
14648c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_RECEIVE_ERROR	    (1 << 25)
14658c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_MESSAGE_SIZE_MASK    (0x1f << 20)
14668c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_MESSAGE_SIZE_SHIFT   20
14678c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_PRECHARGE_2US_MASK   (0xf << 16)
14688c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_PRECHARGE_2US_SHIFT  16
14698c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_AUX_AKSV_SELECT	    (1 << 15)
14708c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_MANCHESTER_TEST	    (1 << 14)
14718c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_SYNC_TEST	    (1 << 13)
14728c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_DEGLITCH_TEST	    (1 << 12)
14738c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_PRECHARGE_TEST	    (1 << 11)
14748c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_BIT_CLOCK_2X_MASK    (0x7ff)
14758c2ecf20Sopenharmony_ci#define   DP_AUX_CH_CTL_BIT_CLOCK_2X_SHIFT   0
14768c2ecf20Sopenharmony_ci
14778c2ecf20Sopenharmony_ci/*
14788c2ecf20Sopenharmony_ci * Computing GMCH M and N values for the Display Port link
14798c2ecf20Sopenharmony_ci *
14808c2ecf20Sopenharmony_ci * GMCH M/N = dot clock * bytes per pixel / ls_clk * # of lanes
14818c2ecf20Sopenharmony_ci *
14828c2ecf20Sopenharmony_ci * ls_clk (we assume) is the DP link clock (1.62 or 2.7 GHz)
14838c2ecf20Sopenharmony_ci *
14848c2ecf20Sopenharmony_ci * The GMCH value is used internally
14858c2ecf20Sopenharmony_ci *
14868c2ecf20Sopenharmony_ci * bytes_per_pixel is the number of bytes coming out of the plane,
14878c2ecf20Sopenharmony_ci * which is after the LUTs, so we want the bytes for our color format.
14888c2ecf20Sopenharmony_ci * For our current usage, this is always 3, one byte for R, G and B.
14898c2ecf20Sopenharmony_ci */
14908c2ecf20Sopenharmony_ci
14918c2ecf20Sopenharmony_ci#define _PIPEA_GMCH_DATA_M			0x70050
14928c2ecf20Sopenharmony_ci#define _PIPEB_GMCH_DATA_M			0x71050
14938c2ecf20Sopenharmony_ci
14948c2ecf20Sopenharmony_ci/* Transfer unit size for display port - 1, default is 0x3f (for TU size 64) */
14958c2ecf20Sopenharmony_ci#define   PIPE_GMCH_DATA_M_TU_SIZE_MASK		(0x3f << 25)
14968c2ecf20Sopenharmony_ci#define   PIPE_GMCH_DATA_M_TU_SIZE_SHIFT	25
14978c2ecf20Sopenharmony_ci
14988c2ecf20Sopenharmony_ci#define   PIPE_GMCH_DATA_M_MASK			(0xffffff)
14998c2ecf20Sopenharmony_ci
15008c2ecf20Sopenharmony_ci#define _PIPEA_GMCH_DATA_N			0x70054
15018c2ecf20Sopenharmony_ci#define _PIPEB_GMCH_DATA_N			0x71054
15028c2ecf20Sopenharmony_ci#define   PIPE_GMCH_DATA_N_MASK			(0xffffff)
15038c2ecf20Sopenharmony_ci
15048c2ecf20Sopenharmony_ci/*
15058c2ecf20Sopenharmony_ci * Computing Link M and N values for the Display Port link
15068c2ecf20Sopenharmony_ci *
15078c2ecf20Sopenharmony_ci * Link M / N = pixel_clock / ls_clk
15088c2ecf20Sopenharmony_ci *
15098c2ecf20Sopenharmony_ci * (the DP spec calls pixel_clock the 'strm_clk')
15108c2ecf20Sopenharmony_ci *
15118c2ecf20Sopenharmony_ci * The Link value is transmitted in the Main Stream
15128c2ecf20Sopenharmony_ci * Attributes and VB-ID.
15138c2ecf20Sopenharmony_ci */
15148c2ecf20Sopenharmony_ci
15158c2ecf20Sopenharmony_ci#define _PIPEA_DP_LINK_M				0x70060
15168c2ecf20Sopenharmony_ci#define _PIPEB_DP_LINK_M				0x71060
15178c2ecf20Sopenharmony_ci#define   PIPEA_DP_LINK_M_MASK			(0xffffff)
15188c2ecf20Sopenharmony_ci
15198c2ecf20Sopenharmony_ci#define _PIPEA_DP_LINK_N				0x70064
15208c2ecf20Sopenharmony_ci#define _PIPEB_DP_LINK_N				0x71064
15218c2ecf20Sopenharmony_ci#define   PIPEA_DP_LINK_N_MASK			(0xffffff)
15228c2ecf20Sopenharmony_ci
15238c2ecf20Sopenharmony_ci#define PIPE_GMCH_DATA_M(pipe) _PIPE(pipe, _PIPEA_GMCH_DATA_M, _PIPEB_GMCH_DATA_M)
15248c2ecf20Sopenharmony_ci#define PIPE_GMCH_DATA_N(pipe) _PIPE(pipe, _PIPEA_GMCH_DATA_N, _PIPEB_GMCH_DATA_N)
15258c2ecf20Sopenharmony_ci#define PIPE_DP_LINK_M(pipe) _PIPE(pipe, _PIPEA_DP_LINK_M, _PIPEB_DP_LINK_M)
15268c2ecf20Sopenharmony_ci#define PIPE_DP_LINK_N(pipe) _PIPE(pipe, _PIPEA_DP_LINK_N, _PIPEB_DP_LINK_N)
15278c2ecf20Sopenharmony_ci
15288c2ecf20Sopenharmony_ci#define   PIPE_BPC_MASK				(7 << 5)
15298c2ecf20Sopenharmony_ci#define   PIPE_8BPC				(0 << 5)
15308c2ecf20Sopenharmony_ci#define   PIPE_10BPC				(1 << 5)
15318c2ecf20Sopenharmony_ci#define   PIPE_6BPC				(2 << 5)
15328c2ecf20Sopenharmony_ci
15338c2ecf20Sopenharmony_ci#endif
1534