xref: /openbmc/linux/drivers/gpu/drm/i915/display/intel_tv_regs.h (revision 1ac731c529cd4d6adbce134754b51ff7d822b145)
1*f84a27f9SJani Nikula /* SPDX-License-Identifier: MIT */
2*f84a27f9SJani Nikula /*
3*f84a27f9SJani Nikula  * Copyright © 2023 Intel Corporation
4*f84a27f9SJani Nikula  */
5*f84a27f9SJani Nikula 
6*f84a27f9SJani Nikula #ifndef __INTEL_TV_REGS_H__
7*f84a27f9SJani Nikula #define __INTEL_TV_REGS_H__
8*f84a27f9SJani Nikula 
9*f84a27f9SJani Nikula #include "intel_display_reg_defs.h"
10*f84a27f9SJani Nikula 
11*f84a27f9SJani Nikula /* TV port control */
12*f84a27f9SJani Nikula #define TV_CTL			_MMIO(0x68000)
13*f84a27f9SJani Nikula /* Enables the TV encoder */
14*f84a27f9SJani Nikula # define TV_ENC_ENABLE			(1 << 31)
15*f84a27f9SJani Nikula /* Sources the TV encoder input from pipe B instead of A. */
16*f84a27f9SJani Nikula # define TV_ENC_PIPE_SEL_SHIFT		30
17*f84a27f9SJani Nikula # define TV_ENC_PIPE_SEL_MASK		(1 << 30)
18*f84a27f9SJani Nikula # define TV_ENC_PIPE_SEL(pipe)		((pipe) << 30)
19*f84a27f9SJani Nikula /* Outputs composite video (DAC A only) */
20*f84a27f9SJani Nikula # define TV_ENC_OUTPUT_COMPOSITE	(0 << 28)
21*f84a27f9SJani Nikula /* Outputs SVideo video (DAC B/C) */
22*f84a27f9SJani Nikula # define TV_ENC_OUTPUT_SVIDEO		(1 << 28)
23*f84a27f9SJani Nikula /* Outputs Component video (DAC A/B/C) */
24*f84a27f9SJani Nikula # define TV_ENC_OUTPUT_COMPONENT	(2 << 28)
25*f84a27f9SJani Nikula /* Outputs Composite and SVideo (DAC A/B/C) */
26*f84a27f9SJani Nikula # define TV_ENC_OUTPUT_SVIDEO_COMPOSITE	(3 << 28)
27*f84a27f9SJani Nikula # define TV_TRILEVEL_SYNC		(1 << 21)
28*f84a27f9SJani Nikula /* Enables slow sync generation (945GM only) */
29*f84a27f9SJani Nikula # define TV_SLOW_SYNC			(1 << 20)
30*f84a27f9SJani Nikula /* Selects 4x oversampling for 480i and 576p */
31*f84a27f9SJani Nikula # define TV_OVERSAMPLE_4X		(0 << 18)
32*f84a27f9SJani Nikula /* Selects 2x oversampling for 720p and 1080i */
33*f84a27f9SJani Nikula # define TV_OVERSAMPLE_2X		(1 << 18)
34*f84a27f9SJani Nikula /* Selects no oversampling for 1080p */
35*f84a27f9SJani Nikula # define TV_OVERSAMPLE_NONE		(2 << 18)
36*f84a27f9SJani Nikula /* Selects 8x oversampling */
37*f84a27f9SJani Nikula # define TV_OVERSAMPLE_8X		(3 << 18)
38*f84a27f9SJani Nikula # define TV_OVERSAMPLE_MASK		(3 << 18)
39*f84a27f9SJani Nikula /* Selects progressive mode rather than interlaced */
40*f84a27f9SJani Nikula # define TV_PROGRESSIVE			(1 << 17)
41*f84a27f9SJani Nikula /* Sets the colorburst to PAL mode.  Required for non-M PAL modes. */
42*f84a27f9SJani Nikula # define TV_PAL_BURST			(1 << 16)
43*f84a27f9SJani Nikula /* Field for setting delay of Y compared to C */
44*f84a27f9SJani Nikula # define TV_YC_SKEW_MASK		(7 << 12)
45*f84a27f9SJani Nikula /* Enables a fix for 480p/576p standard definition modes on the 915GM only */
46*f84a27f9SJani Nikula # define TV_ENC_SDP_FIX			(1 << 11)
47*f84a27f9SJani Nikula /*
48*f84a27f9SJani Nikula  * Enables a fix for the 915GM only.
49*f84a27f9SJani Nikula  *
50*f84a27f9SJani Nikula  * Not sure what it does.
51*f84a27f9SJani Nikula  */
52*f84a27f9SJani Nikula # define TV_ENC_C0_FIX			(1 << 10)
53*f84a27f9SJani Nikula /* Bits that must be preserved by software */
54*f84a27f9SJani Nikula # define TV_CTL_SAVE			((1 << 11) | (3 << 9) | (7 << 6) | 0xf)
55*f84a27f9SJani Nikula # define TV_FUSE_STATE_MASK		(3 << 4)
56*f84a27f9SJani Nikula /* Read-only state that reports all features enabled */
57*f84a27f9SJani Nikula # define TV_FUSE_STATE_ENABLED		(0 << 4)
58*f84a27f9SJani Nikula /* Read-only state that reports that Macrovision is disabled in hardware*/
59*f84a27f9SJani Nikula # define TV_FUSE_STATE_NO_MACROVISION	(1 << 4)
60*f84a27f9SJani Nikula /* Read-only state that reports that TV-out is disabled in hardware. */
61*f84a27f9SJani Nikula # define TV_FUSE_STATE_DISABLED		(2 << 4)
62*f84a27f9SJani Nikula /* Normal operation */
63*f84a27f9SJani Nikula # define TV_TEST_MODE_NORMAL		(0 << 0)
64*f84a27f9SJani Nikula /* Encoder test pattern 1 - combo pattern */
65*f84a27f9SJani Nikula # define TV_TEST_MODE_PATTERN_1		(1 << 0)
66*f84a27f9SJani Nikula /* Encoder test pattern 2 - full screen vertical 75% color bars */
67*f84a27f9SJani Nikula # define TV_TEST_MODE_PATTERN_2		(2 << 0)
68*f84a27f9SJani Nikula /* Encoder test pattern 3 - full screen horizontal 75% color bars */
69*f84a27f9SJani Nikula # define TV_TEST_MODE_PATTERN_3		(3 << 0)
70*f84a27f9SJani Nikula /* Encoder test pattern 4 - random noise */
71*f84a27f9SJani Nikula # define TV_TEST_MODE_PATTERN_4		(4 << 0)
72*f84a27f9SJani Nikula /* Encoder test pattern 5 - linear color ramps */
73*f84a27f9SJani Nikula # define TV_TEST_MODE_PATTERN_5		(5 << 0)
74*f84a27f9SJani Nikula /*
75*f84a27f9SJani Nikula  * This test mode forces the DACs to 50% of full output.
76*f84a27f9SJani Nikula  *
77*f84a27f9SJani Nikula  * This is used for load detection in combination with TVDAC_SENSE_MASK
78*f84a27f9SJani Nikula  */
79*f84a27f9SJani Nikula # define TV_TEST_MODE_MONITOR_DETECT	(7 << 0)
80*f84a27f9SJani Nikula # define TV_TEST_MODE_MASK		(7 << 0)
81*f84a27f9SJani Nikula 
82*f84a27f9SJani Nikula #define TV_DAC			_MMIO(0x68004)
83*f84a27f9SJani Nikula # define TV_DAC_SAVE		0x00ffff00
84*f84a27f9SJani Nikula /*
85*f84a27f9SJani Nikula  * Reports that DAC state change logic has reported change (RO).
86*f84a27f9SJani Nikula  *
87*f84a27f9SJani Nikula  * This gets cleared when TV_DAC_STATE_EN is cleared
88*f84a27f9SJani Nikula */
89*f84a27f9SJani Nikula # define TVDAC_STATE_CHG		(1 << 31)
90*f84a27f9SJani Nikula # define TVDAC_SENSE_MASK		(7 << 28)
91*f84a27f9SJani Nikula /* Reports that DAC A voltage is above the detect threshold */
92*f84a27f9SJani Nikula # define TVDAC_A_SENSE			(1 << 30)
93*f84a27f9SJani Nikula /* Reports that DAC B voltage is above the detect threshold */
94*f84a27f9SJani Nikula # define TVDAC_B_SENSE			(1 << 29)
95*f84a27f9SJani Nikula /* Reports that DAC C voltage is above the detect threshold */
96*f84a27f9SJani Nikula # define TVDAC_C_SENSE			(1 << 28)
97*f84a27f9SJani Nikula /*
98*f84a27f9SJani Nikula  * Enables DAC state detection logic, for load-based TV detection.
99*f84a27f9SJani Nikula  *
100*f84a27f9SJani Nikula  * The PLL of the chosen pipe (in TV_CTL) must be running, and the encoder set
101*f84a27f9SJani Nikula  * to off, for load detection to work.
102*f84a27f9SJani Nikula  */
103*f84a27f9SJani Nikula # define TVDAC_STATE_CHG_EN		(1 << 27)
104*f84a27f9SJani Nikula /* Sets the DAC A sense value to high */
105*f84a27f9SJani Nikula # define TVDAC_A_SENSE_CTL		(1 << 26)
106*f84a27f9SJani Nikula /* Sets the DAC B sense value to high */
107*f84a27f9SJani Nikula # define TVDAC_B_SENSE_CTL		(1 << 25)
108*f84a27f9SJani Nikula /* Sets the DAC C sense value to high */
109*f84a27f9SJani Nikula # define TVDAC_C_SENSE_CTL		(1 << 24)
110*f84a27f9SJani Nikula /* Overrides the ENC_ENABLE and DAC voltage levels */
111*f84a27f9SJani Nikula # define DAC_CTL_OVERRIDE		(1 << 7)
112*f84a27f9SJani Nikula /* Sets the slew rate.  Must be preserved in software */
113*f84a27f9SJani Nikula # define ENC_TVDAC_SLEW_FAST		(1 << 6)
114*f84a27f9SJani Nikula # define DAC_A_1_3_V			(0 << 4)
115*f84a27f9SJani Nikula # define DAC_A_1_1_V			(1 << 4)
116*f84a27f9SJani Nikula # define DAC_A_0_7_V			(2 << 4)
117*f84a27f9SJani Nikula # define DAC_A_MASK			(3 << 4)
118*f84a27f9SJani Nikula # define DAC_B_1_3_V			(0 << 2)
119*f84a27f9SJani Nikula # define DAC_B_1_1_V			(1 << 2)
120*f84a27f9SJani Nikula # define DAC_B_0_7_V			(2 << 2)
121*f84a27f9SJani Nikula # define DAC_B_MASK			(3 << 2)
122*f84a27f9SJani Nikula # define DAC_C_1_3_V			(0 << 0)
123*f84a27f9SJani Nikula # define DAC_C_1_1_V			(1 << 0)
124*f84a27f9SJani Nikula # define DAC_C_0_7_V			(2 << 0)
125*f84a27f9SJani Nikula # define DAC_C_MASK			(3 << 0)
126*f84a27f9SJani Nikula 
127*f84a27f9SJani Nikula /*
128*f84a27f9SJani Nikula  * CSC coefficients are stored in a floating point format with 9 bits of
129*f84a27f9SJani Nikula  * mantissa and 2 or 3 bits of exponent.  The exponent is represented as 2**-n,
130*f84a27f9SJani Nikula  * where 2-bit exponents are unsigned n, and 3-bit exponents are signed n with
131*f84a27f9SJani Nikula  * -1 (0x3) being the only legal negative value.
132*f84a27f9SJani Nikula  */
133*f84a27f9SJani Nikula #define TV_CSC_Y		_MMIO(0x68010)
134*f84a27f9SJani Nikula # define TV_RY_MASK			0x07ff0000
135*f84a27f9SJani Nikula # define TV_RY_SHIFT			16
136*f84a27f9SJani Nikula # define TV_GY_MASK			0x00000fff
137*f84a27f9SJani Nikula # define TV_GY_SHIFT			0
138*f84a27f9SJani Nikula 
139*f84a27f9SJani Nikula #define TV_CSC_Y2		_MMIO(0x68014)
140*f84a27f9SJani Nikula # define TV_BY_MASK			0x07ff0000
141*f84a27f9SJani Nikula # define TV_BY_SHIFT			16
142*f84a27f9SJani Nikula /*
143*f84a27f9SJani Nikula  * Y attenuation for component video.
144*f84a27f9SJani Nikula  *
145*f84a27f9SJani Nikula  * Stored in 1.9 fixed point.
146*f84a27f9SJani Nikula  */
147*f84a27f9SJani Nikula # define TV_AY_MASK			0x000003ff
148*f84a27f9SJani Nikula # define TV_AY_SHIFT			0
149*f84a27f9SJani Nikula 
150*f84a27f9SJani Nikula #define TV_CSC_U		_MMIO(0x68018)
151*f84a27f9SJani Nikula # define TV_RU_MASK			0x07ff0000
152*f84a27f9SJani Nikula # define TV_RU_SHIFT			16
153*f84a27f9SJani Nikula # define TV_GU_MASK			0x000007ff
154*f84a27f9SJani Nikula # define TV_GU_SHIFT			0
155*f84a27f9SJani Nikula 
156*f84a27f9SJani Nikula #define TV_CSC_U2		_MMIO(0x6801c)
157*f84a27f9SJani Nikula # define TV_BU_MASK			0x07ff0000
158*f84a27f9SJani Nikula # define TV_BU_SHIFT			16
159*f84a27f9SJani Nikula /*
160*f84a27f9SJani Nikula  * U attenuation for component video.
161*f84a27f9SJani Nikula  *
162*f84a27f9SJani Nikula  * Stored in 1.9 fixed point.
163*f84a27f9SJani Nikula  */
164*f84a27f9SJani Nikula # define TV_AU_MASK			0x000003ff
165*f84a27f9SJani Nikula # define TV_AU_SHIFT			0
166*f84a27f9SJani Nikula 
167*f84a27f9SJani Nikula #define TV_CSC_V		_MMIO(0x68020)
168*f84a27f9SJani Nikula # define TV_RV_MASK			0x0fff0000
169*f84a27f9SJani Nikula # define TV_RV_SHIFT			16
170*f84a27f9SJani Nikula # define TV_GV_MASK			0x000007ff
171*f84a27f9SJani Nikula # define TV_GV_SHIFT			0
172*f84a27f9SJani Nikula 
173*f84a27f9SJani Nikula #define TV_CSC_V2		_MMIO(0x68024)
174*f84a27f9SJani Nikula # define TV_BV_MASK			0x07ff0000
175*f84a27f9SJani Nikula # define TV_BV_SHIFT			16
176*f84a27f9SJani Nikula /*
177*f84a27f9SJani Nikula  * V attenuation for component video.
178*f84a27f9SJani Nikula  *
179*f84a27f9SJani Nikula  * Stored in 1.9 fixed point.
180*f84a27f9SJani Nikula  */
181*f84a27f9SJani Nikula # define TV_AV_MASK			0x000007ff
182*f84a27f9SJani Nikula # define TV_AV_SHIFT			0
183*f84a27f9SJani Nikula 
184*f84a27f9SJani Nikula #define TV_CLR_KNOBS		_MMIO(0x68028)
185*f84a27f9SJani Nikula /* 2s-complement brightness adjustment */
186*f84a27f9SJani Nikula # define TV_BRIGHTNESS_MASK		0xff000000
187*f84a27f9SJani Nikula # define TV_BRIGHTNESS_SHIFT		24
188*f84a27f9SJani Nikula /* Contrast adjustment, as a 2.6 unsigned floating point number */
189*f84a27f9SJani Nikula # define TV_CONTRAST_MASK		0x00ff0000
190*f84a27f9SJani Nikula # define TV_CONTRAST_SHIFT		16
191*f84a27f9SJani Nikula /* Saturation adjustment, as a 2.6 unsigned floating point number */
192*f84a27f9SJani Nikula # define TV_SATURATION_MASK		0x0000ff00
193*f84a27f9SJani Nikula # define TV_SATURATION_SHIFT		8
194*f84a27f9SJani Nikula /* Hue adjustment, as an integer phase angle in degrees */
195*f84a27f9SJani Nikula # define TV_HUE_MASK			0x000000ff
196*f84a27f9SJani Nikula # define TV_HUE_SHIFT			0
197*f84a27f9SJani Nikula 
198*f84a27f9SJani Nikula #define TV_CLR_LEVEL		_MMIO(0x6802c)
199*f84a27f9SJani Nikula /* Controls the DAC level for black */
200*f84a27f9SJani Nikula # define TV_BLACK_LEVEL_MASK		0x01ff0000
201*f84a27f9SJani Nikula # define TV_BLACK_LEVEL_SHIFT		16
202*f84a27f9SJani Nikula /* Controls the DAC level for blanking */
203*f84a27f9SJani Nikula # define TV_BLANK_LEVEL_MASK		0x000001ff
204*f84a27f9SJani Nikula # define TV_BLANK_LEVEL_SHIFT		0
205*f84a27f9SJani Nikula 
206*f84a27f9SJani Nikula #define TV_H_CTL_1		_MMIO(0x68030)
207*f84a27f9SJani Nikula /* Number of pixels in the hsync. */
208*f84a27f9SJani Nikula # define TV_HSYNC_END_MASK		0x1fff0000
209*f84a27f9SJani Nikula # define TV_HSYNC_END_SHIFT		16
210*f84a27f9SJani Nikula /* Total number of pixels minus one in the line (display and blanking). */
211*f84a27f9SJani Nikula # define TV_HTOTAL_MASK			0x00001fff
212*f84a27f9SJani Nikula # define TV_HTOTAL_SHIFT		0
213*f84a27f9SJani Nikula 
214*f84a27f9SJani Nikula #define TV_H_CTL_2		_MMIO(0x68034)
215*f84a27f9SJani Nikula /* Enables the colorburst (needed for non-component color) */
216*f84a27f9SJani Nikula # define TV_BURST_ENA			(1 << 31)
217*f84a27f9SJani Nikula /* Offset of the colorburst from the start of hsync, in pixels minus one. */
218*f84a27f9SJani Nikula # define TV_HBURST_START_SHIFT		16
219*f84a27f9SJani Nikula # define TV_HBURST_START_MASK		0x1fff0000
220*f84a27f9SJani Nikula /* Length of the colorburst */
221*f84a27f9SJani Nikula # define TV_HBURST_LEN_SHIFT		0
222*f84a27f9SJani Nikula # define TV_HBURST_LEN_MASK		0x0001fff
223*f84a27f9SJani Nikula 
224*f84a27f9SJani Nikula #define TV_H_CTL_3		_MMIO(0x68038)
225*f84a27f9SJani Nikula /* End of hblank, measured in pixels minus one from start of hsync */
226*f84a27f9SJani Nikula # define TV_HBLANK_END_SHIFT		16
227*f84a27f9SJani Nikula # define TV_HBLANK_END_MASK		0x1fff0000
228*f84a27f9SJani Nikula /* Start of hblank, measured in pixels minus one from start of hsync */
229*f84a27f9SJani Nikula # define TV_HBLANK_START_SHIFT		0
230*f84a27f9SJani Nikula # define TV_HBLANK_START_MASK		0x0001fff
231*f84a27f9SJani Nikula 
232*f84a27f9SJani Nikula #define TV_V_CTL_1		_MMIO(0x6803c)
233*f84a27f9SJani Nikula /* XXX */
234*f84a27f9SJani Nikula # define TV_NBR_END_SHIFT		16
235*f84a27f9SJani Nikula # define TV_NBR_END_MASK		0x07ff0000
236*f84a27f9SJani Nikula /* XXX */
237*f84a27f9SJani Nikula # define TV_VI_END_F1_SHIFT		8
238*f84a27f9SJani Nikula # define TV_VI_END_F1_MASK		0x00003f00
239*f84a27f9SJani Nikula /* XXX */
240*f84a27f9SJani Nikula # define TV_VI_END_F2_SHIFT		0
241*f84a27f9SJani Nikula # define TV_VI_END_F2_MASK		0x0000003f
242*f84a27f9SJani Nikula 
243*f84a27f9SJani Nikula #define TV_V_CTL_2		_MMIO(0x68040)
244*f84a27f9SJani Nikula /* Length of vsync, in half lines */
245*f84a27f9SJani Nikula # define TV_VSYNC_LEN_MASK		0x07ff0000
246*f84a27f9SJani Nikula # define TV_VSYNC_LEN_SHIFT		16
247*f84a27f9SJani Nikula /* Offset of the start of vsync in field 1, measured in one less than the
248*f84a27f9SJani Nikula  * number of half lines.
249*f84a27f9SJani Nikula  */
250*f84a27f9SJani Nikula # define TV_VSYNC_START_F1_MASK		0x00007f00
251*f84a27f9SJani Nikula # define TV_VSYNC_START_F1_SHIFT	8
252*f84a27f9SJani Nikula /*
253*f84a27f9SJani Nikula  * Offset of the start of vsync in field 2, measured in one less than the
254*f84a27f9SJani Nikula  * number of half lines.
255*f84a27f9SJani Nikula  */
256*f84a27f9SJani Nikula # define TV_VSYNC_START_F2_MASK		0x0000007f
257*f84a27f9SJani Nikula # define TV_VSYNC_START_F2_SHIFT	0
258*f84a27f9SJani Nikula 
259*f84a27f9SJani Nikula #define TV_V_CTL_3		_MMIO(0x68044)
260*f84a27f9SJani Nikula /* Enables generation of the equalization signal */
261*f84a27f9SJani Nikula # define TV_EQUAL_ENA			(1 << 31)
262*f84a27f9SJani Nikula /* Length of vsync, in half lines */
263*f84a27f9SJani Nikula # define TV_VEQ_LEN_MASK		0x007f0000
264*f84a27f9SJani Nikula # define TV_VEQ_LEN_SHIFT		16
265*f84a27f9SJani Nikula /* Offset of the start of equalization in field 1, measured in one less than
266*f84a27f9SJani Nikula  * the number of half lines.
267*f84a27f9SJani Nikula  */
268*f84a27f9SJani Nikula # define TV_VEQ_START_F1_MASK		0x0007f00
269*f84a27f9SJani Nikula # define TV_VEQ_START_F1_SHIFT		8
270*f84a27f9SJani Nikula /*
271*f84a27f9SJani Nikula  * Offset of the start of equalization in field 2, measured in one less than
272*f84a27f9SJani Nikula  * the number of half lines.
273*f84a27f9SJani Nikula  */
274*f84a27f9SJani Nikula # define TV_VEQ_START_F2_MASK		0x000007f
275*f84a27f9SJani Nikula # define TV_VEQ_START_F2_SHIFT		0
276*f84a27f9SJani Nikula 
277*f84a27f9SJani Nikula #define TV_V_CTL_4		_MMIO(0x68048)
278*f84a27f9SJani Nikula /*
279*f84a27f9SJani Nikula  * Offset to start of vertical colorburst, measured in one less than the
280*f84a27f9SJani Nikula  * number of lines from vertical start.
281*f84a27f9SJani Nikula  */
282*f84a27f9SJani Nikula # define TV_VBURST_START_F1_MASK	0x003f0000
283*f84a27f9SJani Nikula # define TV_VBURST_START_F1_SHIFT	16
284*f84a27f9SJani Nikula /*
285*f84a27f9SJani Nikula  * Offset to the end of vertical colorburst, measured in one less than the
286*f84a27f9SJani Nikula  * number of lines from the start of NBR.
287*f84a27f9SJani Nikula  */
288*f84a27f9SJani Nikula # define TV_VBURST_END_F1_MASK		0x000000ff
289*f84a27f9SJani Nikula # define TV_VBURST_END_F1_SHIFT		0
290*f84a27f9SJani Nikula 
291*f84a27f9SJani Nikula #define TV_V_CTL_5		_MMIO(0x6804c)
292*f84a27f9SJani Nikula /*
293*f84a27f9SJani Nikula  * Offset to start of vertical colorburst, measured in one less than the
294*f84a27f9SJani Nikula  * number of lines from vertical start.
295*f84a27f9SJani Nikula  */
296*f84a27f9SJani Nikula # define TV_VBURST_START_F2_MASK	0x003f0000
297*f84a27f9SJani Nikula # define TV_VBURST_START_F2_SHIFT	16
298*f84a27f9SJani Nikula /*
299*f84a27f9SJani Nikula  * Offset to the end of vertical colorburst, measured in one less than the
300*f84a27f9SJani Nikula  * number of lines from the start of NBR.
301*f84a27f9SJani Nikula  */
302*f84a27f9SJani Nikula # define TV_VBURST_END_F2_MASK		0x000000ff
303*f84a27f9SJani Nikula # define TV_VBURST_END_F2_SHIFT		0
304*f84a27f9SJani Nikula 
305*f84a27f9SJani Nikula #define TV_V_CTL_6		_MMIO(0x68050)
306*f84a27f9SJani Nikula /*
307*f84a27f9SJani Nikula  * Offset to start of vertical colorburst, measured in one less than the
308*f84a27f9SJani Nikula  * number of lines from vertical start.
309*f84a27f9SJani Nikula  */
310*f84a27f9SJani Nikula # define TV_VBURST_START_F3_MASK	0x003f0000
311*f84a27f9SJani Nikula # define TV_VBURST_START_F3_SHIFT	16
312*f84a27f9SJani Nikula /*
313*f84a27f9SJani Nikula  * Offset to the end of vertical colorburst, measured in one less than the
314*f84a27f9SJani Nikula  * number of lines from the start of NBR.
315*f84a27f9SJani Nikula  */
316*f84a27f9SJani Nikula # define TV_VBURST_END_F3_MASK		0x000000ff
317*f84a27f9SJani Nikula # define TV_VBURST_END_F3_SHIFT		0
318*f84a27f9SJani Nikula 
319*f84a27f9SJani Nikula #define TV_V_CTL_7		_MMIO(0x68054)
320*f84a27f9SJani Nikula /*
321*f84a27f9SJani Nikula  * Offset to start of vertical colorburst, measured in one less than the
322*f84a27f9SJani Nikula  * number of lines from vertical start.
323*f84a27f9SJani Nikula  */
324*f84a27f9SJani Nikula # define TV_VBURST_START_F4_MASK	0x003f0000
325*f84a27f9SJani Nikula # define TV_VBURST_START_F4_SHIFT	16
326*f84a27f9SJani Nikula /*
327*f84a27f9SJani Nikula  * Offset to the end of vertical colorburst, measured in one less than the
328*f84a27f9SJani Nikula  * number of lines from the start of NBR.
329*f84a27f9SJani Nikula  */
330*f84a27f9SJani Nikula # define TV_VBURST_END_F4_MASK		0x000000ff
331*f84a27f9SJani Nikula # define TV_VBURST_END_F4_SHIFT		0
332*f84a27f9SJani Nikula 
333*f84a27f9SJani Nikula #define TV_SC_CTL_1		_MMIO(0x68060)
334*f84a27f9SJani Nikula /* Turns on the first subcarrier phase generation DDA */
335*f84a27f9SJani Nikula # define TV_SC_DDA1_EN			(1 << 31)
336*f84a27f9SJani Nikula /* Turns on the first subcarrier phase generation DDA */
337*f84a27f9SJani Nikula # define TV_SC_DDA2_EN			(1 << 30)
338*f84a27f9SJani Nikula /* Turns on the first subcarrier phase generation DDA */
339*f84a27f9SJani Nikula # define TV_SC_DDA3_EN			(1 << 29)
340*f84a27f9SJani Nikula /* Sets the subcarrier DDA to reset frequency every other field */
341*f84a27f9SJani Nikula # define TV_SC_RESET_EVERY_2		(0 << 24)
342*f84a27f9SJani Nikula /* Sets the subcarrier DDA to reset frequency every fourth field */
343*f84a27f9SJani Nikula # define TV_SC_RESET_EVERY_4		(1 << 24)
344*f84a27f9SJani Nikula /* Sets the subcarrier DDA to reset frequency every eighth field */
345*f84a27f9SJani Nikula # define TV_SC_RESET_EVERY_8		(2 << 24)
346*f84a27f9SJani Nikula /* Sets the subcarrier DDA to never reset the frequency */
347*f84a27f9SJani Nikula # define TV_SC_RESET_NEVER		(3 << 24)
348*f84a27f9SJani Nikula /* Sets the peak amplitude of the colorburst.*/
349*f84a27f9SJani Nikula # define TV_BURST_LEVEL_MASK		0x00ff0000
350*f84a27f9SJani Nikula # define TV_BURST_LEVEL_SHIFT		16
351*f84a27f9SJani Nikula /* Sets the increment of the first subcarrier phase generation DDA */
352*f84a27f9SJani Nikula # define TV_SCDDA1_INC_MASK		0x00000fff
353*f84a27f9SJani Nikula # define TV_SCDDA1_INC_SHIFT		0
354*f84a27f9SJani Nikula 
355*f84a27f9SJani Nikula #define TV_SC_CTL_2		_MMIO(0x68064)
356*f84a27f9SJani Nikula /* Sets the rollover for the second subcarrier phase generation DDA */
357*f84a27f9SJani Nikula # define TV_SCDDA2_SIZE_MASK		0x7fff0000
358*f84a27f9SJani Nikula # define TV_SCDDA2_SIZE_SHIFT		16
359*f84a27f9SJani Nikula /* Sets the increent of the second subcarrier phase generation DDA */
360*f84a27f9SJani Nikula # define TV_SCDDA2_INC_MASK		0x00007fff
361*f84a27f9SJani Nikula # define TV_SCDDA2_INC_SHIFT		0
362*f84a27f9SJani Nikula 
363*f84a27f9SJani Nikula #define TV_SC_CTL_3		_MMIO(0x68068)
364*f84a27f9SJani Nikula /* Sets the rollover for the third subcarrier phase generation DDA */
365*f84a27f9SJani Nikula # define TV_SCDDA3_SIZE_MASK		0x7fff0000
366*f84a27f9SJani Nikula # define TV_SCDDA3_SIZE_SHIFT		16
367*f84a27f9SJani Nikula /* Sets the increent of the third subcarrier phase generation DDA */
368*f84a27f9SJani Nikula # define TV_SCDDA3_INC_MASK		0x00007fff
369*f84a27f9SJani Nikula # define TV_SCDDA3_INC_SHIFT		0
370*f84a27f9SJani Nikula 
371*f84a27f9SJani Nikula #define TV_WIN_POS		_MMIO(0x68070)
372*f84a27f9SJani Nikula /* X coordinate of the display from the start of horizontal active */
373*f84a27f9SJani Nikula # define TV_XPOS_MASK			0x1fff0000
374*f84a27f9SJani Nikula # define TV_XPOS_SHIFT			16
375*f84a27f9SJani Nikula /* Y coordinate of the display from the start of vertical active (NBR) */
376*f84a27f9SJani Nikula # define TV_YPOS_MASK			0x00000fff
377*f84a27f9SJani Nikula # define TV_YPOS_SHIFT			0
378*f84a27f9SJani Nikula 
379*f84a27f9SJani Nikula #define TV_WIN_SIZE		_MMIO(0x68074)
380*f84a27f9SJani Nikula /* Horizontal size of the display window, measured in pixels*/
381*f84a27f9SJani Nikula # define TV_XSIZE_MASK			0x1fff0000
382*f84a27f9SJani Nikula # define TV_XSIZE_SHIFT			16
383*f84a27f9SJani Nikula /*
384*f84a27f9SJani Nikula  * Vertical size of the display window, measured in pixels.
385*f84a27f9SJani Nikula  *
386*f84a27f9SJani Nikula  * Must be even for interlaced modes.
387*f84a27f9SJani Nikula  */
388*f84a27f9SJani Nikula # define TV_YSIZE_MASK			0x00000fff
389*f84a27f9SJani Nikula # define TV_YSIZE_SHIFT			0
390*f84a27f9SJani Nikula 
391*f84a27f9SJani Nikula #define TV_FILTER_CTL_1		_MMIO(0x68080)
392*f84a27f9SJani Nikula /*
393*f84a27f9SJani Nikula  * Enables automatic scaling calculation.
394*f84a27f9SJani Nikula  *
395*f84a27f9SJani Nikula  * If set, the rest of the registers are ignored, and the calculated values can
396*f84a27f9SJani Nikula  * be read back from the register.
397*f84a27f9SJani Nikula  */
398*f84a27f9SJani Nikula # define TV_AUTO_SCALE			(1 << 31)
399*f84a27f9SJani Nikula /*
400*f84a27f9SJani Nikula  * Disables the vertical filter.
401*f84a27f9SJani Nikula  *
402*f84a27f9SJani Nikula  * This is required on modes more than 1024 pixels wide */
403*f84a27f9SJani Nikula # define TV_V_FILTER_BYPASS		(1 << 29)
404*f84a27f9SJani Nikula /* Enables adaptive vertical filtering */
405*f84a27f9SJani Nikula # define TV_VADAPT			(1 << 28)
406*f84a27f9SJani Nikula # define TV_VADAPT_MODE_MASK		(3 << 26)
407*f84a27f9SJani Nikula /* Selects the least adaptive vertical filtering mode */
408*f84a27f9SJani Nikula # define TV_VADAPT_MODE_LEAST		(0 << 26)
409*f84a27f9SJani Nikula /* Selects the moderately adaptive vertical filtering mode */
410*f84a27f9SJani Nikula # define TV_VADAPT_MODE_MODERATE	(1 << 26)
411*f84a27f9SJani Nikula /* Selects the most adaptive vertical filtering mode */
412*f84a27f9SJani Nikula # define TV_VADAPT_MODE_MOST		(3 << 26)
413*f84a27f9SJani Nikula /*
414*f84a27f9SJani Nikula  * Sets the horizontal scaling factor.
415*f84a27f9SJani Nikula  *
416*f84a27f9SJani Nikula  * This should be the fractional part of the horizontal scaling factor divided
417*f84a27f9SJani Nikula  * by the oversampling rate.  TV_HSCALE should be less than 1, and set to:
418*f84a27f9SJani Nikula  *
419*f84a27f9SJani Nikula  * (src width - 1) / ((oversample * dest width) - 1)
420*f84a27f9SJani Nikula  */
421*f84a27f9SJani Nikula # define TV_HSCALE_FRAC_MASK		0x00003fff
422*f84a27f9SJani Nikula # define TV_HSCALE_FRAC_SHIFT		0
423*f84a27f9SJani Nikula 
424*f84a27f9SJani Nikula #define TV_FILTER_CTL_2		_MMIO(0x68084)
425*f84a27f9SJani Nikula /*
426*f84a27f9SJani Nikula  * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
427*f84a27f9SJani Nikula  *
428*f84a27f9SJani Nikula  * TV_VSCALE should be (src height - 1) / ((interlace * dest height) - 1)
429*f84a27f9SJani Nikula  */
430*f84a27f9SJani Nikula # define TV_VSCALE_INT_MASK		0x00038000
431*f84a27f9SJani Nikula # define TV_VSCALE_INT_SHIFT		15
432*f84a27f9SJani Nikula /*
433*f84a27f9SJani Nikula  * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
434*f84a27f9SJani Nikula  *
435*f84a27f9SJani Nikula  * \sa TV_VSCALE_INT_MASK
436*f84a27f9SJani Nikula  */
437*f84a27f9SJani Nikula # define TV_VSCALE_FRAC_MASK		0x00007fff
438*f84a27f9SJani Nikula # define TV_VSCALE_FRAC_SHIFT		0
439*f84a27f9SJani Nikula 
440*f84a27f9SJani Nikula #define TV_FILTER_CTL_3		_MMIO(0x68088)
441*f84a27f9SJani Nikula /*
442*f84a27f9SJani Nikula  * Sets the integer part of the 3.15 fixed-point vertical scaling factor.
443*f84a27f9SJani Nikula  *
444*f84a27f9SJani Nikula  * TV_VSCALE should be (src height - 1) / (1/4 * (dest height - 1))
445*f84a27f9SJani Nikula  *
446*f84a27f9SJani Nikula  * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
447*f84a27f9SJani Nikula  */
448*f84a27f9SJani Nikula # define TV_VSCALE_IP_INT_MASK		0x00038000
449*f84a27f9SJani Nikula # define TV_VSCALE_IP_INT_SHIFT		15
450*f84a27f9SJani Nikula /*
451*f84a27f9SJani Nikula  * Sets the fractional part of the 3.15 fixed-point vertical scaling factor.
452*f84a27f9SJani Nikula  *
453*f84a27f9SJani Nikula  * For progressive modes, TV_VSCALE_IP_INT should be set to zeroes.
454*f84a27f9SJani Nikula  *
455*f84a27f9SJani Nikula  * \sa TV_VSCALE_IP_INT_MASK
456*f84a27f9SJani Nikula  */
457*f84a27f9SJani Nikula # define TV_VSCALE_IP_FRAC_MASK		0x00007fff
458*f84a27f9SJani Nikula # define TV_VSCALE_IP_FRAC_SHIFT		0
459*f84a27f9SJani Nikula 
460*f84a27f9SJani Nikula #define TV_CC_CONTROL		_MMIO(0x68090)
461*f84a27f9SJani Nikula # define TV_CC_ENABLE			(1 << 31)
462*f84a27f9SJani Nikula /*
463*f84a27f9SJani Nikula  * Specifies which field to send the CC data in.
464*f84a27f9SJani Nikula  *
465*f84a27f9SJani Nikula  * CC data is usually sent in field 0.
466*f84a27f9SJani Nikula  */
467*f84a27f9SJani Nikula # define TV_CC_FID_MASK			(1 << 27)
468*f84a27f9SJani Nikula # define TV_CC_FID_SHIFT		27
469*f84a27f9SJani Nikula /* Sets the horizontal position of the CC data.  Usually 135. */
470*f84a27f9SJani Nikula # define TV_CC_HOFF_MASK		0x03ff0000
471*f84a27f9SJani Nikula # define TV_CC_HOFF_SHIFT		16
472*f84a27f9SJani Nikula /* Sets the vertical position of the CC data.  Usually 21 */
473*f84a27f9SJani Nikula # define TV_CC_LINE_MASK		0x0000003f
474*f84a27f9SJani Nikula # define TV_CC_LINE_SHIFT		0
475*f84a27f9SJani Nikula 
476*f84a27f9SJani Nikula #define TV_CC_DATA		_MMIO(0x68094)
477*f84a27f9SJani Nikula # define TV_CC_RDY			(1 << 31)
478*f84a27f9SJani Nikula /* Second word of CC data to be transmitted. */
479*f84a27f9SJani Nikula # define TV_CC_DATA_2_MASK		0x007f0000
480*f84a27f9SJani Nikula # define TV_CC_DATA_2_SHIFT		16
481*f84a27f9SJani Nikula /* First word of CC data to be transmitted. */
482*f84a27f9SJani Nikula # define TV_CC_DATA_1_MASK		0x0000007f
483*f84a27f9SJani Nikula # define TV_CC_DATA_1_SHIFT		0
484*f84a27f9SJani Nikula 
485*f84a27f9SJani Nikula #define TV_H_LUMA(i)		_MMIO(0x68100 + (i) * 4) /* 60 registers */
486*f84a27f9SJani Nikula #define TV_H_CHROMA(i)		_MMIO(0x68200 + (i) * 4) /* 60 registers */
487*f84a27f9SJani Nikula #define TV_V_LUMA(i)		_MMIO(0x68300 + (i) * 4) /* 43 registers */
488*f84a27f9SJani Nikula #define TV_V_CHROMA(i)		_MMIO(0x68400 + (i) * 4) /* 43 registers */
489*f84a27f9SJani Nikula 
490*f84a27f9SJani Nikula #endif /* __INTEL_TV_REGS_H__ */
491