Merge branch 'for-linus' of git://git.kernel.dk/linux-block
[pandora-kernel.git] / drivers / staging / gma500 / psb_intel_reg.h
1 /*
2  * Copyright (c) 2009, Intel Corporation.
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms and conditions of the GNU General Public License,
6  * version 2, as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
11  * more details.
12  *
13  * You should have received a copy of the GNU General Public License along with
14  * this program; if not, write to the Free Software Foundation, Inc.,
15  * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
16  */
17 #ifndef __PSB_INTEL_REG_H__
18 #define __PSB_INTEL_REG_H__
19
20 #define BLC_PWM_CTL             0x61254
21 #define BLC_PWM_CTL2            0x61250
22 #define BLC_PWM_CTL_C           0x62254
23 #define BLC_PWM_CTL2_C          0x62250
24 #define BACKLIGHT_MODULATION_FREQ_SHIFT         (17)
25 /*
26  * This is the most significant 15 bits of the number of backlight cycles in a
27  * complete cycle of the modulated backlight control.
28  *
29  * The actual value is this field multiplied by two.
30  */
31 #define BACKLIGHT_MODULATION_FREQ_MASK  (0x7fff << 17)
32 #define BLM_LEGACY_MODE                 (1 << 16)
33 /*
34  * This is the number of cycles out of the backlight modulation cycle for which
35  * the backlight is on.
36  *
37  * This field must be no greater than the number of cycles in the complete
38  * backlight modulation cycle.
39  */
40 #define BACKLIGHT_DUTY_CYCLE_SHIFT      (0)
41 #define BACKLIGHT_DUTY_CYCLE_MASK       (0xffff)
42
43 #define I915_GCFGC                      0xf0
44 #define I915_LOW_FREQUENCY_ENABLE       (1 << 7)
45 #define I915_DISPLAY_CLOCK_190_200_MHZ  (0 << 4)
46 #define I915_DISPLAY_CLOCK_333_MHZ      (4 << 4)
47 #define I915_DISPLAY_CLOCK_MASK         (7 << 4)
48
49 #define I855_HPLLCC                     0xc0
50 #define I855_CLOCK_CONTROL_MASK         (3 << 0)
51 #define I855_CLOCK_133_200              (0 << 0)
52 #define I855_CLOCK_100_200              (1 << 0)
53 #define I855_CLOCK_100_133              (2 << 0)
54 #define I855_CLOCK_166_250              (3 << 0)
55
56 /* I830 CRTC registers */
57 #define HTOTAL_A                0x60000
58 #define HBLANK_A                0x60004
59 #define HSYNC_A                 0x60008
60 #define VTOTAL_A                0x6000c
61 #define VBLANK_A                0x60010
62 #define VSYNC_A                 0x60014
63 #define PIPEASRC                0x6001c
64 #define BCLRPAT_A               0x60020
65 #define VSYNCSHIFT_A            0x60028
66
67 #define HTOTAL_B                0x61000
68 #define HBLANK_B                0x61004
69 #define HSYNC_B                 0x61008
70 #define VTOTAL_B                0x6100c
71 #define VBLANK_B                0x61010
72 #define VSYNC_B                 0x61014
73 #define PIPEBSRC                0x6101c
74 #define BCLRPAT_B               0x61020
75 #define VSYNCSHIFT_B            0x61028
76
77 #define HTOTAL_C                0x62000
78 #define HBLANK_C                0x62004
79 #define HSYNC_C                 0x62008
80 #define VTOTAL_C                0x6200c
81 #define VBLANK_C                0x62010
82 #define VSYNC_C                 0x62014
83 #define PIPECSRC                0x6201c
84 #define BCLRPAT_C               0x62020
85 #define VSYNCSHIFT_C            0x62028
86
87 #define PP_STATUS               0x61200
88 # define PP_ON                          (1 << 31)
89 /*
90  * Indicates that all dependencies of the panel are on:
91  *
92  * - PLL enabled
93  * - pipe enabled
94  * - LVDS/DVOB/DVOC on
95  */
96 #define PP_READY                        (1 << 30)
97 #define PP_SEQUENCE_NONE                (0 << 28)
98 #define PP_SEQUENCE_ON                  (1 << 28)
99 #define PP_SEQUENCE_OFF                 (2 << 28)
100 #define PP_SEQUENCE_MASK                0x30000000
101 #define PP_CONTROL              0x61204
102 #define POWER_TARGET_ON                 (1 << 0)
103
104 #define LVDSPP_ON               0x61208
105 #define LVDSPP_OFF              0x6120c
106 #define PP_CYCLE                0x61210
107
108 #define PFIT_CONTROL            0x61230
109 #define PFIT_ENABLE                     (1 << 31)
110 #define PFIT_PIPE_MASK                  (3 << 29)
111 #define PFIT_PIPE_SHIFT                 29
112 #define PFIT_SCALING_MODE_PILLARBOX     (1 << 27)
113 #define PFIT_SCALING_MODE_LETTERBOX     (3 << 26)
114 #define VERT_INTERP_DISABLE             (0 << 10)
115 #define VERT_INTERP_BILINEAR            (1 << 10)
116 #define VERT_INTERP_MASK                (3 << 10)
117 #define VERT_AUTO_SCALE                 (1 << 9)
118 #define HORIZ_INTERP_DISABLE            (0 << 6)
119 #define HORIZ_INTERP_BILINEAR           (1 << 6)
120 #define HORIZ_INTERP_MASK               (3 << 6)
121 #define HORIZ_AUTO_SCALE                (1 << 5)
122 #define PANEL_8TO6_DITHER_ENABLE        (1 << 3)
123
124 #define PFIT_PGM_RATIOS         0x61234
125 #define PFIT_VERT_SCALE_MASK                    0xfff00000
126 #define PFIT_HORIZ_SCALE_MASK                   0x0000fff0
127
128 #define PFIT_AUTO_RATIOS        0x61238
129
130 #define DPLL_A                  0x06014
131 #define DPLL_B                  0x06018
132 #define DPLL_VCO_ENABLE                 (1 << 31)
133 #define DPLL_DVO_HIGH_SPEED             (1 << 30)
134 #define DPLL_SYNCLOCK_ENABLE            (1 << 29)
135 #define DPLL_VGA_MODE_DIS               (1 << 28)
136 #define DPLLB_MODE_DAC_SERIAL           (1 << 26)       /* i915 */
137 #define DPLLB_MODE_LVDS                 (2 << 26)       /* i915 */
138 #define DPLL_MODE_MASK                  (3 << 26)
139 #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_10 (0 << 24)       /* i915 */
140 #define DPLL_DAC_SERIAL_P2_CLOCK_DIV_5  (1 << 24)       /* i915 */
141 #define DPLLB_LVDS_P2_CLOCK_DIV_14      (0 << 24)       /* i915 */
142 #define DPLLB_LVDS_P2_CLOCK_DIV_7       (1 << 24)       /* i915 */
143 #define DPLL_P2_CLOCK_DIV_MASK          0x03000000      /* i915 */
144 #define DPLL_FPA01_P1_POST_DIV_MASK     0x00ff0000      /* i915 */
145 #define DPLL_LOCK                       (1 << 15)       /* CDV */
146
147 /*
148  *  The i830 generation, in DAC/serial mode, defines p1 as two plus this
149  * bitfield, or just 2 if PLL_P1_DIVIDE_BY_TWO is set.
150  */
151 # define DPLL_FPA01_P1_POST_DIV_MASK_I830       0x001f0000
152 /*
153  * The i830 generation, in LVDS mode, defines P1 as the bit number set within
154  * this field (only one bit may be set).
155  */
156 #define DPLL_FPA01_P1_POST_DIV_MASK_I830_LVDS   0x003f0000
157 #define DPLL_FPA01_P1_POST_DIV_SHIFT    16
158 #define PLL_P2_DIVIDE_BY_4              (1 << 23)       /* i830, required
159                                                          * in DVO non-gang */
160 # define PLL_P1_DIVIDE_BY_TWO           (1 << 21)       /* i830 */
161 #define PLL_REF_INPUT_DREFCLK           (0 << 13)
162 #define PLL_REF_INPUT_TVCLKINA          (1 << 13)       /* i830 */
163 #define PLL_REF_INPUT_TVCLKINBC         (2 << 13)       /* SDVO
164                                                                  * TVCLKIN */
165 #define PLLB_REF_INPUT_SPREADSPECTRUMIN (3 << 13)
166 #define PLL_REF_INPUT_MASK              (3 << 13)
167 #define PLL_LOAD_PULSE_PHASE_SHIFT      9
168 /*
169  * Parallel to Serial Load Pulse phase selection.
170  * Selects the phase for the 10X DPLL clock for the PCIe
171  * digital display port. The range is 4 to 13; 10 or more
172  * is just a flip delay. The default is 6
173  */
174 #define PLL_LOAD_PULSE_PHASE_MASK       (0xf << PLL_LOAD_PULSE_PHASE_SHIFT)
175 #define DISPLAY_RATE_SELECT_FPA1        (1 << 8)
176
177 /*
178  * SDVO multiplier for 945G/GM. Not used on 965.
179  *
180  * DPLL_MD_UDI_MULTIPLIER_MASK
181  */
182 #define SDVO_MULTIPLIER_MASK            0x000000ff
183 #define SDVO_MULTIPLIER_SHIFT_HIRES     4
184 #define SDVO_MULTIPLIER_SHIFT_VGA       0
185
186 /*
187  * PLL_MD
188  */
189 /* Pipe A SDVO/UDI clock multiplier/divider register for G965. */
190 #define DPLL_A_MD               0x0601c
191 /* Pipe B SDVO/UDI clock multiplier/divider register for G965. */
192 #define DPLL_B_MD               0x06020
193 /*
194  * UDI pixel divider, controlling how many pixels are stuffed into a packet.
195  *
196  * Value is pixels minus 1.  Must be set to 1 pixel for SDVO.
197  */
198 #define DPLL_MD_UDI_DIVIDER_MASK        0x3f000000
199 #define DPLL_MD_UDI_DIVIDER_SHIFT       24
200 /* UDI pixel divider for VGA, same as DPLL_MD_UDI_DIVIDER_MASK. */
201 #define DPLL_MD_VGA_UDI_DIVIDER_MASK    0x003f0000
202 #define DPLL_MD_VGA_UDI_DIVIDER_SHIFT   16
203 /*
204  * SDVO/UDI pixel multiplier.
205  *
206  * SDVO requires that the bus clock rate be between 1 and 2 Ghz, and the bus
207  * clock rate is 10 times the DPLL clock.  At low resolution/refresh rate
208  * modes, the bus rate would be below the limits, so SDVO allows for stuffing
209  * dummy bytes in the datastream at an increased clock rate, with both sides of
210  * the link knowing how many bytes are fill.
211  *
212  * So, for a mode with a dotclock of 65Mhz, we would want to double the clock
213  * rate to 130Mhz to get a bus rate of 1.30Ghz.  The DPLL clock rate would be
214  * set to 130Mhz, and the SDVO multiplier set to 2x in this register and
215  * through an SDVO command.
216  *
217  * This register field has values of multiplication factor minus 1, with
218  * a maximum multiplier of 5 for SDVO.
219  */
220 #define DPLL_MD_UDI_MULTIPLIER_MASK     0x00003f00
221 #define DPLL_MD_UDI_MULTIPLIER_SHIFT    8
222 /*
223  * SDVO/UDI pixel multiplier for VGA, same as DPLL_MD_UDI_MULTIPLIER_MASK.
224  * This best be set to the default value (3) or the CRT won't work. No,
225  * I don't entirely understand what this does...
226  */
227 #define DPLL_MD_VGA_UDI_MULTIPLIER_MASK 0x0000003f
228 #define DPLL_MD_VGA_UDI_MULTIPLIER_SHIFT 0
229
230 #define DPLL_TEST               0x606c
231 #define DPLLB_TEST_SDVO_DIV_1           (0 << 22)
232 #define DPLLB_TEST_SDVO_DIV_2           (1 << 22)
233 #define DPLLB_TEST_SDVO_DIV_4           (2 << 22)
234 #define DPLLB_TEST_SDVO_DIV_MASK        (3 << 22)
235 #define DPLLB_TEST_N_BYPASS             (1 << 19)
236 #define DPLLB_TEST_M_BYPASS             (1 << 18)
237 #define DPLLB_INPUT_BUFFER_ENABLE       (1 << 16)
238 #define DPLLA_TEST_N_BYPASS             (1 << 3)
239 #define DPLLA_TEST_M_BYPASS             (1 << 2)
240 #define DPLLA_INPUT_BUFFER_ENABLE       (1 << 0)
241
242 #define ADPA                    0x61100
243 #define ADPA_DAC_ENABLE                 (1 << 31)
244 #define ADPA_DAC_DISABLE                0
245 #define ADPA_PIPE_SELECT_MASK           (1 << 30)
246 #define ADPA_PIPE_A_SELECT              0
247 #define ADPA_PIPE_B_SELECT              (1 << 30)
248 #define ADPA_USE_VGA_HVPOLARITY         (1 << 15)
249 #define ADPA_SETS_HVPOLARITY            0
250 #define ADPA_VSYNC_CNTL_DISABLE         (1 << 11)
251 #define ADPA_VSYNC_CNTL_ENABLE          0
252 #define ADPA_HSYNC_CNTL_DISABLE         (1 << 10)
253 #define ADPA_HSYNC_CNTL_ENABLE          0
254 #define ADPA_VSYNC_ACTIVE_HIGH          (1 << 4)
255 #define ADPA_VSYNC_ACTIVE_LOW           0
256 #define ADPA_HSYNC_ACTIVE_HIGH          (1 << 3)
257 #define ADPA_HSYNC_ACTIVE_LOW           0
258
259 #define FPA0                    0x06040
260 #define FPA1                    0x06044
261 #define FPB0                    0x06048
262 #define FPB1                    0x0604c
263 #define FP_N_DIV_MASK                   0x003f0000
264 #define FP_N_DIV_SHIFT                  16
265 #define FP_M1_DIV_MASK                  0x00003f00
266 #define FP_M1_DIV_SHIFT                 8
267 #define FP_M2_DIV_MASK                  0x0000003f
268 #define FP_M2_DIV_SHIFT                 0
269
270 #define PORT_HOTPLUG_EN         0x61110
271 #define SDVOB_HOTPLUG_INT_EN            (1 << 26)
272 #define SDVOC_HOTPLUG_INT_EN            (1 << 25)
273 #define TV_HOTPLUG_INT_EN               (1 << 18)
274 #define CRT_HOTPLUG_INT_EN              (1 << 9)
275 #define CRT_HOTPLUG_FORCE_DETECT        (1 << 3)
276 /* CDV.. */
277 #define CRT_HOTPLUG_ACTIVATION_PERIOD_64        (1 << 8)
278 #define CRT_HOTPLUG_DAC_ON_TIME_2M              (0 << 7)
279 #define CRT_HOTPLUG_DAC_ON_TIME_4M              (1 << 7)
280 #define CRT_HOTPLUG_VOLTAGE_COMPARE_40          (0 << 5)
281 #define CRT_HOTPLUG_VOLTAGE_COMPARE_50          (1 << 5)
282 #define CRT_HOTPLUG_VOLTAGE_COMPARE_60          (2 << 5)
283 #define CRT_HOTPLUG_VOLTAGE_COMPARE_70          (3 << 5)
284 #define CRT_HOTPLUG_VOLTAGE_COMPARE_MASK        (3 << 5)
285 #define CRT_HOTPLUG_DETECT_DELAY_1G             (0 << 4)
286 #define CRT_HOTPLUG_DETECT_DELAY_2G             (1 << 4)
287 #define CRT_HOTPLUG_DETECT_VOLTAGE_325MV        (0 << 2)
288 #define CRT_HOTPLUG_DETECT_VOLTAGE_475MV        (1 << 2)
289 #define CRT_HOTPLUG_DETECT_MASK                 0x000000F8
290
291 #define PORT_HOTPLUG_STAT       0x61114
292 #define CRT_HOTPLUG_INT_STATUS          (1 << 11)
293 #define TV_HOTPLUG_INT_STATUS           (1 << 10)
294 #define CRT_HOTPLUG_MONITOR_MASK        (3 << 8)
295 #define CRT_HOTPLUG_MONITOR_COLOR       (3 << 8)
296 #define CRT_HOTPLUG_MONITOR_MONO        (2 << 8)
297 #define CRT_HOTPLUG_MONITOR_NONE        (0 << 8)
298 #define SDVOC_HOTPLUG_INT_STATUS        (1 << 7)
299 #define SDVOB_HOTPLUG_INT_STATUS        (1 << 6)
300
301 #define SDVOB                   0x61140
302 #define SDVOC                   0x61160
303 #define SDVO_ENABLE                     (1 << 31)
304 #define SDVO_PIPE_B_SELECT              (1 << 30)
305 #define SDVO_STALL_SELECT               (1 << 29)
306 #define SDVO_INTERRUPT_ENABLE           (1 << 26)
307
308 /**
309  * 915G/GM SDVO pixel multiplier.
310  *
311  * Programmed value is multiplier - 1, up to 5x.
312  *
313  * DPLL_MD_UDI_MULTIPLIER_MASK
314  */
315 #define SDVO_PORT_MULTIPLY_MASK         (7 << 23)
316 #define SDVO_PORT_MULTIPLY_SHIFT        23
317 #define SDVO_PHASE_SELECT_MASK          (15 << 19)
318 #define SDVO_PHASE_SELECT_DEFAULT       (6 << 19)
319 #define SDVO_CLOCK_OUTPUT_INVERT        (1 << 18)
320 #define SDVOC_GANG_MODE                 (1 << 16)
321 #define SDVO_BORDER_ENABLE              (1 << 7)
322 #define SDVOB_PCIE_CONCURRENCY          (1 << 3)
323 #define SDVO_DETECTED                   (1 << 2)
324 /* Bits to be preserved when writing */
325 #define SDVOB_PRESERVE_MASK             ((1 << 17) | (1 << 16) | (1 << 14))
326 #define SDVOC_PRESERVE_MASK             (1 << 17)
327
328 /*
329  * This register controls the LVDS output enable, pipe selection, and data
330  * format selection.
331  *
332  * All of the clock/data pairs are force powered down by power sequencing.
333  */
334 #define LVDS                    0x61180
335 /*
336  * Enables the LVDS port.  This bit must be set before DPLLs are enabled, as
337  * the DPLL semantics change when the LVDS is assigned to that pipe.
338  */
339 #define LVDS_PORT_EN                    (1 << 31)
340 /* Selects pipe B for LVDS data.  Must be set on pre-965. */
341 #define LVDS_PIPEB_SELECT               (1 << 30)
342
343 /* Turns on border drawing to allow centered display. */
344 #define LVDS_BORDER_EN                  (1 << 15)
345
346 /*
347  * Enables the A0-A2 data pairs and CLKA, containing 18 bits of color data per
348  * pixel.
349  */
350 #define LVDS_A0A2_CLKA_POWER_MASK       (3 << 8)
351 #define LVDS_A0A2_CLKA_POWER_DOWN       (0 << 8)
352 #define LVDS_A0A2_CLKA_POWER_UP         (3 << 8)
353 /*
354  * Controls the A3 data pair, which contains the additional LSBs for 24 bit
355  * mode.  Only enabled if LVDS_A0A2_CLKA_POWER_UP also indicates it should be
356  * on.
357  */
358 #define LVDS_A3_POWER_MASK              (3 << 6)
359 #define LVDS_A3_POWER_DOWN              (0 << 6)
360 #define LVDS_A3_POWER_UP                (3 << 6)
361 /*
362  * Controls the CLKB pair.  This should only be set when LVDS_B0B3_POWER_UP
363  * is set.
364  */
365 #define LVDS_CLKB_POWER_MASK            (3 << 4)
366 #define LVDS_CLKB_POWER_DOWN            (0 << 4)
367 #define LVDS_CLKB_POWER_UP              (3 << 4)
368 /*
369  * Controls the B0-B3 data pairs.  This must be set to match the DPLL p2
370  * setting for whether we are in dual-channel mode.  The B3 pair will
371  * additionally only be powered up when LVDS_A3_POWER_UP is set.
372  */
373 #define LVDS_B0B3_POWER_MASK            (3 << 2)
374 #define LVDS_B0B3_POWER_DOWN            (0 << 2)
375 #define LVDS_B0B3_POWER_UP              (3 << 2)
376
377 #define PIPEACONF               0x70008
378 #define PIPEACONF_ENABLE                (1 << 31)
379 #define PIPEACONF_DISABLE               0
380 #define PIPEACONF_DOUBLE_WIDE           (1 << 30)
381 #define PIPECONF_ACTIVE                 (1 << 30)
382 #define I965_PIPECONF_ACTIVE            (1 << 30)
383 #define PIPECONF_DSIPLL_LOCK            (1 << 29)
384 #define PIPEACONF_SINGLE_WIDE           0
385 #define PIPEACONF_PIPE_UNLOCKED         0
386 #define PIPEACONF_DSR                   (1 << 26)
387 #define PIPEACONF_PIPE_LOCKED           (1 << 25)
388 #define PIPEACONF_PALETTE               0
389 #define PIPECONF_FORCE_BORDER           (1 << 25)
390 #define PIPEACONF_GAMMA                 (1 << 24)
391 #define PIPECONF_PROGRESSIVE            (0 << 21)
392 #define PIPECONF_INTERLACE_W_FIELD_INDICATION   (6 << 21)
393 #define PIPECONF_INTERLACE_FIELD_0_ONLY         (7 << 21)
394 #define PIPECONF_PLANE_OFF              (1 << 19)
395 #define PIPECONF_CURSOR_OFF             (1 << 18)
396
397 #define PIPEBCONF               0x71008
398 #define PIPEBCONF_ENABLE                (1 << 31)
399 #define PIPEBCONF_DISABLE               0
400 #define PIPEBCONF_DOUBLE_WIDE           (1 << 30)
401 #define PIPEBCONF_DISABLE               0
402 #define PIPEBCONF_GAMMA                 (1 << 24)
403 #define PIPEBCONF_PALETTE               0
404
405 #define PIPECCONF               0x72008
406
407 #define PIPEBGCMAXRED           0x71010
408 #define PIPEBGCMAXGREEN         0x71014
409 #define PIPEBGCMAXBLUE          0x71018
410
411 #define PIPEASTAT               0x70024
412 #define PIPEBSTAT               0x71024
413 #define PIPECSTAT               0x72024
414 #define PIPE_VBLANK_INTERRUPT_STATUS            (1UL << 1)
415 #define PIPE_START_VBLANK_INTERRUPT_STATUS      (1UL << 2)
416 #define PIPE_VBLANK_CLEAR                       (1 << 1)
417 #define PIPE_VBLANK_STATUS                      (1 << 1)
418 #define PIPE_TE_STATUS                          (1UL << 6)
419 #define PIPE_DPST_EVENT_STATUS                  (1UL << 7)
420 #define PIPE_VSYNC_CLEAR                        (1UL << 9)
421 #define PIPE_VSYNC_STATUS                       (1UL << 9)
422 #define PIPE_HDMI_AUDIO_UNDERRUN_STATUS         (1UL << 10)
423 #define PIPE_HDMI_AUDIO_BUFFER_DONE_STATUS      (1UL << 11)
424 #define PIPE_VBLANK_INTERRUPT_ENABLE            (1UL << 17)
425 #define PIPE_START_VBLANK_INTERRUPT_ENABLE      (1UL << 18)
426 #define PIPE_TE_ENABLE                          (1UL << 22)
427 #define PIPE_DPST_EVENT_ENABLE                  (1UL << 23)
428 #define PIPE_VSYNC_ENABL                        (1UL << 25)
429 #define PIPE_HDMI_AUDIO_UNDERRUN                (1UL << 26)
430 #define PIPE_HDMI_AUDIO_BUFFER_DONE             (1UL << 27)
431 #define PIPE_HDMI_AUDIO_INT_MASK                (PIPE_HDMI_AUDIO_UNDERRUN | \
432                                                 PIPE_HDMI_AUDIO_BUFFER_DONE)
433 #define PIPE_EVENT_MASK ((1 << 29)|(1 << 28)|(1 << 27)|(1 << 26)|(1 << 24)|(1 << 23)|(1 << 22)|(1 << 21)|(1 << 20)|(1 << 16))
434 #define PIPE_VBLANK_MASK ((1 << 25)|(1 << 24)|(1 << 18)|(1 << 17))
435 #define HISTOGRAM_INT_CONTROL           0x61268
436 #define HISTOGRAM_BIN_DATA              0X61264
437 #define HISTOGRAM_LOGIC_CONTROL         0x61260
438 #define PWM_CONTROL_LOGIC               0x61250
439 #define PIPE_HOTPLUG_INTERRUPT_STATUS           (1UL << 10)
440 #define HISTOGRAM_INTERRUPT_ENABLE              (1UL << 31)
441 #define HISTOGRAM_LOGIC_ENABLE                  (1UL << 31)
442 #define PWM_LOGIC_ENABLE                        (1UL << 31)
443 #define PWM_PHASEIN_ENABLE                      (1UL << 25)
444 #define PWM_PHASEIN_INT_ENABLE                  (1UL << 24)
445 #define PWM_PHASEIN_VB_COUNT                    0x00001f00
446 #define PWM_PHASEIN_INC                         0x0000001f
447 #define HISTOGRAM_INT_CTRL_CLEAR                (1UL << 30)
448 #define DPST_YUV_LUMA_MODE                      0
449
450 struct dpst_ie_histogram_control {
451         union {
452                 uint32_t data;
453                 struct {
454                         uint32_t bin_reg_index:7;
455                         uint32_t reserved:4;
456                         uint32_t bin_reg_func_select:1;
457                         uint32_t sync_to_phase_in:1;
458                         uint32_t alt_enhancement_mode:2;
459                         uint32_t reserved1:1;
460                         uint32_t sync_to_phase_in_count:8;
461                         uint32_t histogram_mode_select:1;
462                         uint32_t reserved2:4;
463                         uint32_t ie_pipe_assignment:1;
464                         uint32_t ie_mode_table_enabled:1;
465                         uint32_t ie_histogram_enable:1;
466                 };
467         };
468 };
469
470 struct dpst_guardband {
471         union {
472                 uint32_t data;
473                 struct {
474                         uint32_t guardband:22;
475                         uint32_t guardband_interrupt_delay:8;
476                         uint32_t interrupt_status:1;
477                         uint32_t interrupt_enable:1;
478                 };
479         };
480 };
481
482 #define PIPEAFRAMEHIGH          0x70040
483 #define PIPEAFRAMEPIXEL         0x70044
484 #define PIPEBFRAMEHIGH          0x71040
485 #define PIPEBFRAMEPIXEL         0x71044
486 #define PIPECFRAMEHIGH          0x72040
487 #define PIPECFRAMEPIXEL         0x72044
488 #define PIPE_FRAME_HIGH_MASK    0x0000ffff
489 #define PIPE_FRAME_HIGH_SHIFT   0
490 #define PIPE_FRAME_LOW_MASK     0xff000000
491 #define PIPE_FRAME_LOW_SHIFT    24
492 #define PIPE_PIXEL_MASK         0x00ffffff
493 #define PIPE_PIXEL_SHIFT        0
494
495 #define DSPARB                  0x70030
496 #define DSPFW1                  0x70034
497 #define DSPFW2                  0x70038
498 #define DSPFW3                  0x7003c
499 #define DSPFW4                  0x70050
500 #define DSPFW5                  0x70054
501 #define DSPFW6                  0x70058
502 #define DSPCHICKENBIT           0x70400
503 #define DSPACNTR                0x70180
504 #define DSPBCNTR                0x71180
505 #define DSPCCNTR                0x72180
506 #define DISPLAY_PLANE_ENABLE                    (1 << 31)
507 #define DISPLAY_PLANE_DISABLE                   0
508 #define DISPPLANE_GAMMA_ENABLE                  (1 << 30)
509 #define DISPPLANE_GAMMA_DISABLE                 0
510 #define DISPPLANE_PIXFORMAT_MASK                (0xf << 26)
511 #define DISPPLANE_8BPP                          (0x2 << 26)
512 #define DISPPLANE_15_16BPP                      (0x4 << 26)
513 #define DISPPLANE_16BPP                         (0x5 << 26)
514 #define DISPPLANE_32BPP_NO_ALPHA                (0x6 << 26)
515 #define DISPPLANE_32BPP                         (0x7 << 26)
516 #define DISPPLANE_STEREO_ENABLE                 (1 << 25)
517 #define DISPPLANE_STEREO_DISABLE                0
518 #define DISPPLANE_SEL_PIPE_MASK                 (1 << 24)
519 #define DISPPLANE_SEL_PIPE_POS                  24
520 #define DISPPLANE_SEL_PIPE_A                    0
521 #define DISPPLANE_SEL_PIPE_B                    (1 << 24)
522 #define DISPPLANE_SRC_KEY_ENABLE                (1 << 22)
523 #define DISPPLANE_SRC_KEY_DISABLE               0
524 #define DISPPLANE_LINE_DOUBLE                   (1 << 20)
525 #define DISPPLANE_NO_LINE_DOUBLE                0
526 #define DISPPLANE_STEREO_POLARITY_FIRST         0
527 #define DISPPLANE_STEREO_POLARITY_SECOND        (1 << 18)
528 /* plane B only */
529 #define DISPPLANE_ALPHA_TRANS_ENABLE            (1 << 15)
530 #define DISPPLANE_ALPHA_TRANS_DISABLE           0
531 #define DISPPLANE_SPRITE_ABOVE_DISPLAYA         0
532 #define DISPPLANE_SPRITE_ABOVE_OVERLAY          (1)
533 #define DISPPLANE_BOTTOM                        (4)
534
535 #define DSPABASE                0x70184
536 #define DSPALINOFF              0x70184
537 #define DSPASTRIDE              0x70188
538
539 #define DSPBBASE                0x71184
540 #define DSPBLINOFF              0X71184
541 #define DSPBADDR                DSPBBASE
542 #define DSPBSTRIDE              0x71188
543
544 #define DSPCBASE                0x72184
545 #define DSPCLINOFF              0x72184
546 #define DSPCSTRIDE              0x72188
547
548 #define DSPAKEYVAL              0x70194
549 #define DSPAKEYMASK             0x70198
550
551 #define DSPAPOS                 0x7018C /* reserved */
552 #define DSPASIZE                0x70190
553 #define DSPBPOS                 0x7118C
554 #define DSPBSIZE                0x71190
555 #define DSPCPOS                 0x7218C
556 #define DSPCSIZE                0x72190
557
558 #define DSPASURF                0x7019C
559 #define DSPATILEOFF             0x701A4
560
561 #define DSPBSURF                0x7119C
562 #define DSPBTILEOFF             0x711A4
563
564 #define DSPCSURF                0x7219C
565 #define DSPCTILEOFF             0x721A4
566 #define DSPCKEYMAXVAL           0x721A0
567 #define DSPCKEYMINVAL           0x72194
568 #define DSPCKEYMSK              0x72198
569
570 #define VGACNTRL                0x71400
571 #define VGA_DISP_DISABLE                (1 << 31)
572 #define VGA_2X_MODE                     (1 << 30)
573 #define VGA_PIPE_B_SELECT               (1 << 29)
574
575 /*
576  * Overlay registers
577  */
578 #define OV_C_OFFSET             0x08000
579 #define OV_OVADD                0x30000
580 #define OV_DOVASTA              0x30008
581 # define OV_PIPE_SELECT                 ((1 << 6)|(1 << 7))
582 # define OV_PIPE_SELECT_POS             6
583 # define OV_PIPE_A                      0
584 # define OV_PIPE_C                      1
585 #define OV_OGAMC5               0x30010
586 #define OV_OGAMC4               0x30014
587 #define OV_OGAMC3               0x30018
588 #define OV_OGAMC2               0x3001C
589 #define OV_OGAMC1               0x30020
590 #define OV_OGAMC0               0x30024
591 #define OVC_OVADD               0x38000
592 #define OVC_DOVCSTA             0x38008
593 #define OVC_OGAMC5              0x38010
594 #define OVC_OGAMC4              0x38014
595 #define OVC_OGAMC3              0x38018
596 #define OVC_OGAMC2              0x3801C
597 #define OVC_OGAMC1              0x38020
598 #define OVC_OGAMC0              0x38024
599
600 /*
601  * Some BIOS scratch area registers.  The 845 (and 830?) store the amount
602  * of video memory available to the BIOS in SWF1.
603  */
604 #define SWF0                    0x71410
605 #define SWF1                    0x71414
606 #define SWF2                    0x71418
607 #define SWF3                    0x7141c
608 #define SWF4                    0x71420
609 #define SWF5                    0x71424
610 #define SWF6                    0x71428
611
612 /*
613  * 855 scratch registers.
614  */
615 #define SWF00                   0x70410
616 #define SWF01                   0x70414
617 #define SWF02                   0x70418
618 #define SWF03                   0x7041c
619 #define SWF04                   0x70420
620 #define SWF05                   0x70424
621 #define SWF06                   0x70428
622
623 #define SWF10                   SWF0
624 #define SWF11                   SWF1
625 #define SWF12                   SWF2
626 #define SWF13                   SWF3
627 #define SWF14                   SWF4
628 #define SWF15                   SWF5
629 #define SWF16                   SWF6
630
631 #define SWF30                   0x72414
632 #define SWF31                   0x72418
633 #define SWF32                   0x7241c
634
635
636 /*
637  * Palette registers
638  */
639 #define PALETTE_A               0x0a000
640 #define PALETTE_B               0x0a800
641 #define PALETTE_C               0x0ac00
642
643 /* Cursor A & B regs */
644 #define CURACNTR                0x70080
645 #define CURSOR_MODE_DISABLE             0x00
646 #define CURSOR_MODE_64_32B_AX           0x07
647 #define CURSOR_MODE_64_ARGB_AX          ((1 << 5) | CURSOR_MODE_64_32B_AX)
648 #define MCURSOR_GAMMA_ENABLE            (1 << 26)
649 #define CURABASE                0x70084
650 #define CURAPOS                 0x70088
651 #define CURSOR_POS_MASK                 0x007FF
652 #define CURSOR_POS_SIGN                 0x8000
653 #define CURSOR_X_SHIFT                  0
654 #define CURSOR_Y_SHIFT                  16
655 #define CURBCNTR                0x700c0
656 #define CURBBASE                0x700c4
657 #define CURBPOS                 0x700c8
658 #define CURCCNTR                0x700e0
659 #define CURCBASE                0x700e4
660 #define CURCPOS                 0x700e8
661
662 /*
663  * Interrupt Registers
664  */
665 #define IER                     0x020a0
666 #define IIR                     0x020a4
667 #define IMR                     0x020a8
668 #define ISR                     0x020ac
669
670 /*
671  * MOORESTOWN delta registers
672  */
673 #define MRST_DPLL_A             0x0f014
674 #define MDFLD_DPLL_B            0x0f018
675 #define MDFLD_INPUT_REF_SEL             (1 << 14)
676 #define MDFLD_VCO_SEL                   (1 << 16)
677 #define DPLLA_MODE_LVDS                 (2 << 26)       /* mrst */
678 #define MDFLD_PLL_LATCHEN               (1 << 28)
679 #define MDFLD_PWR_GATE_EN               (1 << 30)
680 #define MDFLD_P1_MASK                   (0x1FF << 17)
681 #define MRST_FPA0               0x0f040
682 #define MRST_FPA1               0x0f044
683 #define MDFLD_DPLL_DIV0         0x0f048
684 #define MDFLD_DPLL_DIV1         0x0f04c
685 #define MRST_PERF_MODE          0x020f4
686
687 /*
688  * MEDFIELD HDMI registers
689  */
690 #define HDMIPHYMISCCTL          0x61134
691 #define HDMI_PHY_POWER_DOWN             0x7f
692 #define HDMIB_CONTROL           0x61140
693 #define HDMIB_PORT_EN                   (1 << 31)
694 #define HDMIB_PIPE_B_SELECT             (1 << 30)
695 #define HDMIB_NULL_PACKET               (1 << 9)
696 #define HDMIB_HDCP_PORT                 (1 << 5)
697
698 /* #define LVDS                 0x61180 */
699 #define MRST_PANEL_8TO6_DITHER_ENABLE   (1 << 25)
700 #define MRST_PANEL_24_DOT_1_FORMAT      (1 << 24)
701 #define LVDS_A3_POWER_UP_0_OUTPUT       (1 << 6)
702
703 #define MIPI                    0x61190
704 #define MIPI_C                  0x62190
705 #define MIPI_PORT_EN                    (1 << 31)
706 /* Turns on border drawing to allow centered display. */
707 #define SEL_FLOPPED_HSTX                (1 << 23)
708 #define PASS_FROM_SPHY_TO_AFE           (1 << 16)
709 #define MIPI_BORDER_EN                  (1 << 15)
710 #define MIPIA_3LANE_MIPIC_1LANE         0x1
711 #define MIPIA_2LANE_MIPIC_2LANE         0x2
712 #define TE_TRIGGER_DSI_PROTOCOL         (1 << 2)
713 #define TE_TRIGGER_GPIO_PIN             (1 << 3)
714 #define MIPI_TE_COUNT           0x61194
715
716 /* #define PP_CONTROL   0x61204 */
717 #define POWER_DOWN_ON_RESET             (1 << 1)
718
719 /* #define PFIT_CONTROL 0x61230 */
720 #define PFIT_PIPE_SELECT                (3 << 29)
721 #define PFIT_PIPE_SELECT_SHIFT          (29)
722
723 /* #define BLC_PWM_CTL          0x61254 */
724 #define MRST_BACKLIGHT_MODULATION_FREQ_SHIFT    (16)
725 #define MRST_BACKLIGHT_MODULATION_FREQ_MASK     (0xffff << 16)
726
727 /* #define PIPEACONF 0x70008 */
728 #define PIPEACONF_PIPE_STATE            (1 << 30)
729 /* #define DSPACNTR             0x70180 */
730
731 #define MRST_DSPABASE           0x7019c
732 #define MRST_DSPBBASE           0x7119c
733 #define MDFLD_DSPCBASE          0x7219c
734
735 /*
736  * Moorestown registers.
737  */
738
739 /*
740  *      MIPI IP registers
741  */
742 #define MIPIC_REG_OFFSET                0x800
743
744 #define DEVICE_READY_REG                0xb000
745 #define LP_OUTPUT_HOLD                          (1 << 16)
746 #define EXIT_ULPS_DEV_READY                     0x3
747 #define LP_OUTPUT_HOLD_RELEASE                  0x810000
748 # define ENTERING_ULPS                          (2 << 1)
749 # define EXITING_ULPS                           (1 << 1)
750 # define ULPS_MASK                              (3 << 1)
751 # define BUS_POSSESSION                         (1 << 3)
752 #define INTR_STAT_REG                   0xb004
753 #define RX_SOT_ERROR                            (1 << 0)
754 #define RX_SOT_SYNC_ERROR                       (1 << 1)
755 #define RX_ESCAPE_MODE_ENTRY_ERROR              (1 << 3)
756 #define RX_LP_TX_SYNC_ERROR                     (1 << 4)
757 #define RX_HS_RECEIVE_TIMEOUT_ERROR             (1 << 5)
758 #define RX_FALSE_CONTROL_ERROR                  (1 << 6)
759 #define RX_ECC_SINGLE_BIT_ERROR                 (1 << 7)
760 #define RX_ECC_MULTI_BIT_ERROR                  (1 << 8)
761 #define RX_CHECKSUM_ERROR                       (1 << 9)
762 #define RX_DSI_DATA_TYPE_NOT_RECOGNIZED         (1 << 10)
763 #define RX_DSI_VC_ID_INVALID                    (1 << 11)
764 #define TX_FALSE_CONTROL_ERROR                  (1 << 12)
765 #define TX_ECC_SINGLE_BIT_ERROR                 (1 << 13)
766 #define TX_ECC_MULTI_BIT_ERROR                  (1 << 14)
767 #define TX_CHECKSUM_ERROR                       (1 << 15)
768 #define TX_DSI_DATA_TYPE_NOT_RECOGNIZED         (1 << 16)
769 #define TX_DSI_VC_ID_INVALID                    (1 << 17)
770 #define HIGH_CONTENTION                         (1 << 18)
771 #define LOW_CONTENTION                          (1 << 19)
772 #define DPI_FIFO_UNDER_RUN                      (1 << 20)
773 #define HS_TX_TIMEOUT                           (1 << 21)
774 #define LP_RX_TIMEOUT                           (1 << 22)
775 #define TURN_AROUND_ACK_TIMEOUT                 (1 << 23)
776 #define ACK_WITH_NO_ERROR                       (1 << 24)
777 #define HS_GENERIC_WR_FIFO_FULL                 (1 << 27)
778 #define LP_GENERIC_WR_FIFO_FULL                 (1 << 28)
779 #define SPL_PKT_SENT                            (1 << 30)
780 #define INTR_EN_REG                     0xb008
781 #define DSI_FUNC_PRG_REG                0xb00c
782 #define DPI_CHANNEL_NUMBER_POS                  0x03
783 #define DBI_CHANNEL_NUMBER_POS                  0x05
784 #define FMT_DPI_POS                             0x07
785 #define FMT_DBI_POS                             0x0A
786 #define DBI_DATA_WIDTH_POS                      0x0D
787
788 /* DPI PIXEL FORMATS */
789 #define RGB_565_FMT                             0x01    /* RGB 565 FORMAT */
790 #define RGB_666_FMT                             0x02    /* RGB 666 FORMAT */
791 #define LRGB_666_FMT                            0x03    /* RGB LOOSELY PACKED
792                                                          * 666 FORMAT
793                                                          */
794 #define RGB_888_FMT                             0x04    /* RGB 888 FORMAT */
795 #define VIRTUAL_CHANNEL_NUMBER_0                0x00    /* Virtual channel 0 */
796 #define VIRTUAL_CHANNEL_NUMBER_1                0x01    /* Virtual channel 1 */
797 #define VIRTUAL_CHANNEL_NUMBER_2                0x02    /* Virtual channel 2 */
798 #define VIRTUAL_CHANNEL_NUMBER_3                0x03    /* Virtual channel 3 */
799
800 #define DBI_NOT_SUPPORTED                       0x00    /* command mode
801                                                          * is not supported
802                                                          */
803 #define DBI_DATA_WIDTH_16BIT                    0x01    /* 16 bit data */
804 #define DBI_DATA_WIDTH_9BIT                     0x02    /* 9 bit data */
805 #define DBI_DATA_WIDTH_8BIT                     0x03    /* 8 bit data */
806 #define DBI_DATA_WIDTH_OPT1                     0x04    /* option 1 */
807 #define DBI_DATA_WIDTH_OPT2                     0x05    /* option 2 */
808
809 #define HS_TX_TIMEOUT_REG               0xb010
810 #define LP_RX_TIMEOUT_REG               0xb014
811 #define TURN_AROUND_TIMEOUT_REG         0xb018
812 #define DEVICE_RESET_REG                0xb01C
813 #define DPI_RESOLUTION_REG              0xb020
814 #define RES_V_POS                               0x10
815 #define DBI_RESOLUTION_REG              0xb024 /* Reserved for MDFLD */
816 #define HORIZ_SYNC_PAD_COUNT_REG        0xb028
817 #define HORIZ_BACK_PORCH_COUNT_REG      0xb02C
818 #define HORIZ_FRONT_PORCH_COUNT_REG     0xb030
819 #define HORIZ_ACTIVE_AREA_COUNT_REG     0xb034
820 #define VERT_SYNC_PAD_COUNT_REG         0xb038
821 #define VERT_BACK_PORCH_COUNT_REG       0xb03c
822 #define VERT_FRONT_PORCH_COUNT_REG      0xb040
823 #define HIGH_LOW_SWITCH_COUNT_REG       0xb044
824 #define DPI_CONTROL_REG                 0xb048
825 #define DPI_SHUT_DOWN                           (1 << 0)
826 #define DPI_TURN_ON                             (1 << 1)
827 #define DPI_COLOR_MODE_ON                       (1 << 2)
828 #define DPI_COLOR_MODE_OFF                      (1 << 3)
829 #define DPI_BACK_LIGHT_ON                       (1 << 4)
830 #define DPI_BACK_LIGHT_OFF                      (1 << 5)
831 #define DPI_LP                                  (1 << 6)
832 #define DPI_DATA_REG                    0xb04c
833 #define DPI_BACK_LIGHT_ON_DATA                  0x07
834 #define DPI_BACK_LIGHT_OFF_DATA                 0x17
835 #define INIT_COUNT_REG                  0xb050
836 #define MAX_RET_PAK_REG                 0xb054
837 #define VIDEO_FMT_REG                   0xb058
838 #define COMPLETE_LAST_PCKT                      (1 << 2)
839 #define EOT_DISABLE_REG                 0xb05c
840 #define ENABLE_CLOCK_STOPPING                   (1 << 1)
841 #define LP_BYTECLK_REG                  0xb060
842 #define LP_GEN_DATA_REG                 0xb064
843 #define HS_GEN_DATA_REG                 0xb068
844 #define LP_GEN_CTRL_REG                 0xb06C
845 #define HS_GEN_CTRL_REG                 0xb070
846 #define DCS_CHANNEL_NUMBER_POS          0x6
847 #define MCS_COMMANDS_POS                0x8
848 #define WORD_COUNTS_POS                 0x8
849 #define MCS_PARAMETER_POS                       0x10
850 #define GEN_FIFO_STAT_REG               0xb074
851 #define HS_DATA_FIFO_FULL                       (1 << 0)
852 #define HS_DATA_FIFO_HALF_EMPTY                 (1 << 1)
853 #define HS_DATA_FIFO_EMPTY                      (1 << 2)
854 #define LP_DATA_FIFO_FULL                       (1 << 8)
855 #define LP_DATA_FIFO_HALF_EMPTY                 (1 << 9)
856 #define LP_DATA_FIFO_EMPTY                      (1 << 10)
857 #define HS_CTRL_FIFO_FULL                       (1 << 16)
858 #define HS_CTRL_FIFO_HALF_EMPTY                 (1 << 17)
859 #define HS_CTRL_FIFO_EMPTY                      (1 << 18)
860 #define LP_CTRL_FIFO_FULL                       (1 << 24)
861 #define LP_CTRL_FIFO_HALF_EMPTY                 (1 << 25)
862 #define LP_CTRL_FIFO_EMPTY                      (1 << 26)
863 #define DBI_FIFO_EMPTY                          (1 << 27)
864 #define DPI_FIFO_EMPTY                          (1 << 28)
865 #define HS_LS_DBI_ENABLE_REG            0xb078
866 #define TXCLKESC_REG                    0xb07c
867 #define DPHY_PARAM_REG                  0xb080
868 #define DBI_BW_CTRL_REG                 0xb084
869 #define CLK_LANE_SWT_REG                0xb088
870
871 /*
872  * MIPI Adapter registers
873  */
874 #define MIPI_CONTROL_REG                0xb104
875 #define MIPI_2X_CLOCK_BITS                      ((1 << 0) | (1 << 1))
876 #define MIPI_DATA_ADDRESS_REG           0xb108
877 #define MIPI_DATA_LENGTH_REG            0xb10C
878 #define MIPI_COMMAND_ADDRESS_REG        0xb110
879 #define MIPI_COMMAND_LENGTH_REG         0xb114
880 #define MIPI_READ_DATA_RETURN_REG0      0xb118
881 #define MIPI_READ_DATA_RETURN_REG1      0xb11C
882 #define MIPI_READ_DATA_RETURN_REG2      0xb120
883 #define MIPI_READ_DATA_RETURN_REG3      0xb124
884 #define MIPI_READ_DATA_RETURN_REG4      0xb128
885 #define MIPI_READ_DATA_RETURN_REG5      0xb12C
886 #define MIPI_READ_DATA_RETURN_REG6      0xb130
887 #define MIPI_READ_DATA_RETURN_REG7      0xb134
888 #define MIPI_READ_DATA_VALID_REG        0xb138
889
890 /* DBI COMMANDS */
891 #define soft_reset                      0x01
892 /*
893  *      The display module performs a software reset.
894  *      Registers are written with their SW Reset default values.
895  */
896 #define get_power_mode                  0x0a
897 /*
898  *      The display module returns the current power mode
899  */
900 #define get_address_mode                0x0b
901 /*
902  *      The display module returns the current status.
903  */
904 #define get_pixel_format                0x0c
905 /*
906  *      This command gets the pixel format for the RGB image data
907  *      used by the interface.
908  */
909 #define get_display_mode                0x0d
910 /*
911  *      The display module returns the Display Image Mode status.
912  */
913 #define get_signal_mode                 0x0e
914 /*
915  *      The display module returns the Display Signal Mode.
916  */
917 #define get_diagnostic_result           0x0f
918 /*
919  *      The display module returns the self-diagnostic results following
920  *      a Sleep Out command.
921  */
922 #define enter_sleep_mode                0x10
923 /*
924  *      This command causes the display module to enter the Sleep mode.
925  *      In this mode, all unnecessary blocks inside the display module are
926  *      disabled except interface communication. This is the lowest power
927  *      mode the display module supports.
928  */
929 #define exit_sleep_mode                 0x11
930 /*
931  *      This command causes the display module to exit Sleep mode.
932  *      All blocks inside the display module are enabled.
933  */
934 #define enter_partial_mode              0x12
935 /*
936  *      This command causes the display module to enter the Partial Display
937  *      Mode. The Partial Display Mode window is described by the
938  *      set_partial_area command.
939  */
940 #define enter_normal_mode               0x13
941 /*
942  *      This command causes the display module to enter the Normal mode.
943  *      Normal Mode is defined as Partial Display mode and Scroll mode are off
944  */
945 #define exit_invert_mode                0x20
946 /*
947  *      This command causes the display module to stop inverting the image
948  *      data on the display device. The frame memory contents remain unchanged.
949  *      No status bits are changed.
950  */
951 #define enter_invert_mode               0x21
952 /*
953  *      This command causes the display module to invert the image data only on
954  *      the display device. The frame memory contents remain unchanged.
955  *      No status bits are changed.
956  */
957 #define set_gamma_curve                 0x26
958 /*
959  *      This command selects the desired gamma curve for the display device.
960  *      Four fixed gamma curves are defined in section DCS spec.
961  */
962 #define set_display_off                 0x28
963 /* ************************************************************************* *\
964 This command causes the display module to stop displaying the image data
965 on the display device. The frame memory contents remain unchanged.
966 No status bits are changed.
967 \* ************************************************************************* */
968 #define set_display_on                  0x29
969 /* ************************************************************************* *\
970 This command causes the display module to start displaying the image data
971 on the display device. The frame memory contents remain unchanged.
972 No status bits are changed.
973 \* ************************************************************************* */
974 #define set_column_address              0x2a
975 /*
976  *      This command defines the column extent of the frame memory accessed by
977  *      the hostprocessor with the read_memory_continue and
978  *      write_memory_continue commands.
979  *      No status bits are changed.
980  */
981 #define set_page_addr                   0x2b
982 /*
983  *      This command defines the page extent of the frame memory accessed by
984  *      the host processor with the write_memory_continue and
985  *      read_memory_continue command.
986  *      No status bits are changed.
987  */
988 #define write_mem_start                 0x2c
989 /*
990  *      This command transfers image data from the host processor to the
991  *      display modules frame memory starting at the pixel location specified
992  *      by preceding set_column_address and set_page_address commands.
993  */
994 #define set_partial_area                0x30
995 /*
996  *      This command defines the Partial Display mode s display area.
997  *      There are two parameters associated with this command, the first
998  *      defines the Start Row (SR) and the second the End Row (ER). SR and ER
999  *      refer to the Frame Memory Line Pointer.
1000  */
1001 #define set_scroll_area                 0x33
1002 /*
1003  *      This command defines the display modules Vertical Scrolling Area.
1004  */
1005 #define set_tear_off                    0x34
1006 /*
1007  *      This command turns off the display modules Tearing Effect output
1008  *      signal on the TE signal line.
1009  */
1010 #define set_tear_on                     0x35
1011 /*
1012  *      This command turns on the display modules Tearing Effect output signal
1013  *      on the TE signal line.
1014  */
1015 #define set_address_mode                0x36
1016 /*
1017  *      This command sets the data order for transfers from the host processor
1018  *      to display modules frame memory,bits B[7:5] and B3, and from the
1019  *      display modules frame memory to the display device, bits B[2:0] and B4.
1020  */
1021 #define set_scroll_start                0x37
1022 /*
1023  *      This command sets the start of the vertical scrolling area in the frame
1024  *      memory. The vertical scrolling area is fully defined when this command
1025  *      is used with the set_scroll_area command The set_scroll_start command
1026  *      has one parameter, the Vertical Scroll Pointer. The VSP defines the
1027  *      line in the frame memory that is written to the display device as the
1028  *      first line of the vertical scroll area.
1029  */
1030 #define exit_idle_mode                  0x38
1031 /*
1032  *      This command causes the display module to exit Idle mode.
1033  */
1034 #define enter_idle_mode                 0x39
1035 /*
1036  *      This command causes the display module to enter Idle Mode.
1037  *      In Idle Mode, color expression is reduced. Colors are shown on the
1038  *      display device using the MSB of each of the R, G and B color
1039  *      components in the frame memory
1040  */
1041 #define set_pixel_format                0x3a
1042 /*
1043  *      This command sets the pixel format for the RGB image data used by the
1044  *      interface.
1045  *      Bits D[6:4]  DPI Pixel Format Definition
1046  *      Bits D[2:0]  DBI Pixel Format Definition
1047  *      Bits D7 and D3 are not used.
1048  */
1049 #define DCS_PIXEL_FORMAT_3bpp           0x1
1050 #define DCS_PIXEL_FORMAT_8bpp           0x2
1051 #define DCS_PIXEL_FORMAT_12bpp          0x3
1052 #define DCS_PIXEL_FORMAT_16bpp          0x5
1053 #define DCS_PIXEL_FORMAT_18bpp          0x6
1054 #define DCS_PIXEL_FORMAT_24bpp          0x7
1055
1056 #define write_mem_cont                  0x3c
1057
1058 /*
1059  *      This command transfers image data from the host processor to the
1060  *      display module's frame memory continuing from the pixel location
1061  *      following the previous write_memory_continue or write_memory_start
1062  *      command.
1063  */
1064 #define set_tear_scanline               0x44
1065 /*
1066  *      This command turns on the display modules Tearing Effect output signal
1067  *      on the TE signal line when the display module reaches line N.
1068  */
1069 #define get_scanline                    0x45
1070 /*
1071  *      The display module returns the current scanline, N, used to update the
1072  *       display device. The total number of scanlines on a display device is
1073  *      defined as VSYNC + VBP + VACT + VFP.The first scanline is defined as
1074  *      the first line of V Sync and is denoted as Line 0.
1075  *      When in Sleep Mode, the value returned by get_scanline is undefined.
1076  */
1077
1078 /* MCS or Generic COMMANDS */
1079 /* MCS/generic data type */
1080 #define GEN_SHORT_WRITE_0       0x03  /* generic short write, no parameters */
1081 #define GEN_SHORT_WRITE_1       0x13  /* generic short write, 1 parameters */
1082 #define GEN_SHORT_WRITE_2       0x23  /* generic short write, 2 parameters */
1083 #define GEN_READ_0              0x04  /* generic read, no parameters */
1084 #define GEN_READ_1              0x14  /* generic read, 1 parameters */
1085 #define GEN_READ_2              0x24  /* generic read, 2 parameters */
1086 #define GEN_LONG_WRITE          0x29  /* generic long write */
1087 #define MCS_SHORT_WRITE_0       0x05  /* MCS short write, no parameters */
1088 #define MCS_SHORT_WRITE_1       0x15  /* MCS short write, 1 parameters */
1089 #define MCS_READ                0x06  /* MCS read, no parameters */
1090 #define MCS_LONG_WRITE          0x39  /* MCS long write */
1091 /* MCS/generic commands */
1092 /* TPO MCS */
1093 #define write_display_profile           0x50
1094 #define write_display_brightness        0x51
1095 #define write_ctrl_display              0x53
1096 #define write_ctrl_cabc                 0x55
1097   #define UI_IMAGE              0x01
1098   #define STILL_IMAGE           0x02
1099   #define MOVING_IMAGE          0x03
1100 #define write_hysteresis                0x57
1101 #define write_gamma_setting             0x58
1102 #define write_cabc_min_bright           0x5e
1103 #define write_kbbc_profile              0x60
1104 /* TMD MCS */
1105 #define tmd_write_display_brightness 0x8c
1106
1107 /*
1108  *      This command is used to control ambient light, panel backlight
1109  *      brightness and gamma settings.
1110  */
1111 #define BRIGHT_CNTL_BLOCK_ON    (1 << 5)
1112 #define AMBIENT_LIGHT_SENSE_ON  (1 << 4)
1113 #define DISPLAY_DIMMING_ON      (1 << 3)
1114 #define BACKLIGHT_ON            (1 << 2)
1115 #define DISPLAY_BRIGHTNESS_AUTO (1 << 1)
1116 #define GAMMA_AUTO              (1 << 0)
1117
1118 /* DCS Interface Pixel Formats */
1119 #define DCS_PIXEL_FORMAT_3BPP   0x1
1120 #define DCS_PIXEL_FORMAT_8BPP   0x2
1121 #define DCS_PIXEL_FORMAT_12BPP  0x3
1122 #define DCS_PIXEL_FORMAT_16BPP  0x5
1123 #define DCS_PIXEL_FORMAT_18BPP  0x6
1124 #define DCS_PIXEL_FORMAT_24BPP  0x7
1125 /* ONE PARAMETER READ DATA */
1126 #define addr_mode_data          0xfc
1127 #define diag_res_data           0x00
1128 #define disp_mode_data          0x23
1129 #define pxl_fmt_data            0x77
1130 #define pwr_mode_data           0x74
1131 #define sig_mode_data           0x00
1132 /* TWO PARAMETERS READ DATA */
1133 #define scanline_data1          0xff
1134 #define scanline_data2          0xff
1135 #define NON_BURST_MODE_SYNC_PULSE       0x01    /* Non Burst Mode
1136                                                  * with Sync Pulse
1137                                                  */
1138 #define NON_BURST_MODE_SYNC_EVENTS      0x02    /* Non Burst Mode
1139                                                  * with Sync events
1140                                                  */
1141 #define BURST_MODE                      0x03    /* Burst Mode */
1142 #define DBI_COMMAND_BUFFER_SIZE         0x240   /* 0x32 */    /* 0x120 */
1143                                                 /* Allocate at least
1144                                                  * 0x100 Byte with 32
1145                                                  * byte alignment
1146                                                  */
1147 #define DBI_DATA_BUFFER_SIZE            0x120   /* Allocate at least
1148                                                  * 0x100 Byte with 32
1149                                                  * byte alignment
1150                                                  */
1151 #define DBI_CB_TIME_OUT                 0xFFFF
1152
1153 #define GEN_FB_TIME_OUT                 2000
1154
1155 #define SKU_83                          0x01
1156 #define SKU_100                         0x02
1157 #define SKU_100L                        0x04
1158 #define SKU_BYPASS                      0x08
1159
1160 /* Some handy macros for playing with bitfields. */
1161 #define PSB_MASK(high, low) (((1<<((high)-(low)+1))-1)<<(low))
1162 #define SET_FIELD(value, field) (((value) << field ## _SHIFT) & field ## _MASK)
1163 #define GET_FIELD(word, field) (((word)  & field ## _MASK) >> field ## _SHIFT)
1164
1165 #define _PIPE(pipe, a, b) ((a) + (pipe)*((b)-(a)))
1166
1167 /* PCI config space */
1168
1169 #define SB_PCKT         0x02100 /* cedarview */
1170 # define SB_OPCODE_MASK                         PSB_MASK(31, 16)
1171 # define SB_OPCODE_SHIFT                        16
1172 # define SB_OPCODE_READ                         0
1173 # define SB_OPCODE_WRITE                        1
1174 # define SB_DEST_MASK                           PSB_MASK(15, 8)
1175 # define SB_DEST_SHIFT                          8
1176 # define SB_DEST_DPLL                           0x88
1177 # define SB_BYTE_ENABLE_MASK                    PSB_MASK(7, 4)
1178 # define SB_BYTE_ENABLE_SHIFT                   4
1179 # define SB_BUSY                                (1 << 0)
1180
1181
1182 /* 32-bit value read/written from the DPIO reg. */
1183 #define SB_DATA         0x02104 /* cedarview */
1184 /* 32-bit address of the DPIO reg to be read/written. */
1185 #define SB_ADDR         0x02108 /* cedarview */
1186 #define DPIO_CFG        0x02110 /* cedarview */
1187 # define DPIO_MODE_SELECT_1                     (1 << 3)
1188 # define DPIO_MODE_SELECT_0                     (1 << 2)
1189 # define DPIO_SFR_BYPASS                        (1 << 1)
1190 /* reset is active low */
1191 # define DPIO_CMN_RESET_N                       (1 << 0)
1192
1193 /* Cedarview sideband registers */
1194 #define _SB_M_A                 0x8008
1195 #define _SB_M_B                 0x8028
1196 #define SB_M(pipe) _PIPE(pipe, _SB_M_A, _SB_M_B)
1197 # define SB_M_DIVIDER_MASK                      (0xFF << 24)
1198 # define SB_M_DIVIDER_SHIFT                     24
1199
1200 #define _SB_N_VCO_A             0x8014
1201 #define _SB_N_VCO_B             0x8034
1202 #define SB_N_VCO(pipe) _PIPE(pipe, _SB_N_VCO_A, _SB_N_VCO_B)
1203 #define SB_N_VCO_SEL_MASK                       PSB_MASK(31, 30)
1204 #define SB_N_VCO_SEL_SHIFT                      30
1205 #define SB_N_DIVIDER_MASK                       PSB_MASK(29, 26)
1206 #define SB_N_DIVIDER_SHIFT                      26
1207 #define SB_N_CB_TUNE_MASK                       PSB_MASK(25, 24)
1208 #define SB_N_CB_TUNE_SHIFT                      24
1209
1210 #define _SB_REF_A               0x8018
1211 #define _SB_REF_B               0x8038
1212 #define SB_REF_SFR(pipe)        _PIPE(pipe, _SB_REF_A, _SB_REF_B)
1213
1214 #define _SB_P_A                 0x801c
1215 #define _SB_P_B                 0x803c
1216 #define SB_P(pipe) _PIPE(pipe, _SB_P_A, _SB_P_B)
1217 #define SB_P2_DIVIDER_MASK                      PSB_MASK(31, 30)
1218 #define SB_P2_DIVIDER_SHIFT                     30
1219 #define SB_P2_10                                0 /* HDMI, DP, DAC */
1220 #define SB_P2_5                         1 /* DAC */
1221 #define SB_P2_14                                2 /* LVDS single */
1222 #define SB_P2_7                         3 /* LVDS double */
1223 #define SB_P1_DIVIDER_MASK                      PSB_MASK(15, 12)
1224 #define SB_P1_DIVIDER_SHIFT                     12
1225
1226 #define PSB_LANE0               0x120
1227 #define PSB_LANE1               0x220
1228 #define PSB_LANE2               0x2320
1229 #define PSB_LANE3               0x2420
1230
1231 #define LANE_PLL_MASK           (0x7 << 20)
1232 #define LANE_PLL_ENABLE         (0x3 << 20)
1233
1234
1235 #endif