diff options
author | Zhenyu Wang <zhenyuw@linux.intel.com> | 2009-10-21 03:27:01 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2009-10-23 14:31:26 -0400 |
commit | 4204878179c99d419d392d78d817729992b4c442 (patch) | |
tree | f99427dec4fecef2653497a00bf5b65f7b60d4f4 /drivers/gpu | |
parent | fe798b9718bea5c48938fc38fa78ae9503b8de6c (diff) |
drm/i915: Ironlake suspend/resume support
This adds registers save/restore for Ironlake to make suspend work.
Signed-off-by: Guo, Chaohong <chaohong.guo@intel.com>
[zhenyuw: some code re-orgnization, and add more save/restore for
FDI link and transcoder registers, also fix palette register for Ironlake]
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/i915/i915_drv.h | 30 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/i915_suspend.c | 281 |
2 files changed, 256 insertions, 55 deletions
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h index f6a3587ad065..9c67f0650a2a 100644 --- a/drivers/gpu/drm/i915/i915_drv.h +++ b/drivers/gpu/drm/i915/i915_drv.h | |||
@@ -296,6 +296,12 @@ typedef struct drm_i915_private { | |||
296 | u32 saveVBLANK_A; | 296 | u32 saveVBLANK_A; |
297 | u32 saveVSYNC_A; | 297 | u32 saveVSYNC_A; |
298 | u32 saveBCLRPAT_A; | 298 | u32 saveBCLRPAT_A; |
299 | u32 saveTRANS_HTOTAL_A; | ||
300 | u32 saveTRANS_HBLANK_A; | ||
301 | u32 saveTRANS_HSYNC_A; | ||
302 | u32 saveTRANS_VTOTAL_A; | ||
303 | u32 saveTRANS_VBLANK_A; | ||
304 | u32 saveTRANS_VSYNC_A; | ||
299 | u32 savePIPEASTAT; | 305 | u32 savePIPEASTAT; |
300 | u32 saveDSPASTRIDE; | 306 | u32 saveDSPASTRIDE; |
301 | u32 saveDSPASIZE; | 307 | u32 saveDSPASIZE; |
@@ -307,6 +313,8 @@ typedef struct drm_i915_private { | |||
307 | u32 saveBLC_HIST_CTL; | 313 | u32 saveBLC_HIST_CTL; |
308 | u32 saveBLC_PWM_CTL; | 314 | u32 saveBLC_PWM_CTL; |
309 | u32 saveBLC_PWM_CTL2; | 315 | u32 saveBLC_PWM_CTL2; |
316 | u32 saveBLC_CPU_PWM_CTL; | ||
317 | u32 saveBLC_CPU_PWM_CTL2; | ||
310 | u32 saveFPB0; | 318 | u32 saveFPB0; |
311 | u32 saveFPB1; | 319 | u32 saveFPB1; |
312 | u32 saveDPLL_B; | 320 | u32 saveDPLL_B; |
@@ -318,6 +326,12 @@ typedef struct drm_i915_private { | |||
318 | u32 saveVBLANK_B; | 326 | u32 saveVBLANK_B; |
319 | u32 saveVSYNC_B; | 327 | u32 saveVSYNC_B; |
320 | u32 saveBCLRPAT_B; | 328 | u32 saveBCLRPAT_B; |
329 | u32 saveTRANS_HTOTAL_B; | ||
330 | u32 saveTRANS_HBLANK_B; | ||
331 | u32 saveTRANS_HSYNC_B; | ||
332 | u32 saveTRANS_VTOTAL_B; | ||
333 | u32 saveTRANS_VBLANK_B; | ||
334 | u32 saveTRANS_VSYNC_B; | ||
321 | u32 savePIPEBSTAT; | 335 | u32 savePIPEBSTAT; |
322 | u32 saveDSPBSTRIDE; | 336 | u32 saveDSPBSTRIDE; |
323 | u32 saveDSPBSIZE; | 337 | u32 saveDSPBSIZE; |
@@ -351,6 +365,12 @@ typedef struct drm_i915_private { | |||
351 | u32 saveIER; | 365 | u32 saveIER; |
352 | u32 saveIIR; | 366 | u32 saveIIR; |
353 | u32 saveIMR; | 367 | u32 saveIMR; |
368 | u32 saveDEIER; | ||
369 | u32 saveDEIMR; | ||
370 | u32 saveGTIER; | ||
371 | u32 saveGTIMR; | ||
372 | u32 saveFDI_RXA_IMR; | ||
373 | u32 saveFDI_RXB_IMR; | ||
354 | u32 saveCACHE_MODE_0; | 374 | u32 saveCACHE_MODE_0; |
355 | u32 saveD_STATE; | 375 | u32 saveD_STATE; |
356 | u32 saveDSPCLK_GATE_D; | 376 | u32 saveDSPCLK_GATE_D; |
@@ -384,6 +404,16 @@ typedef struct drm_i915_private { | |||
384 | u32 savePIPEB_DP_LINK_M; | 404 | u32 savePIPEB_DP_LINK_M; |
385 | u32 savePIPEA_DP_LINK_N; | 405 | u32 savePIPEA_DP_LINK_N; |
386 | u32 savePIPEB_DP_LINK_N; | 406 | u32 savePIPEB_DP_LINK_N; |
407 | u32 saveFDI_RXA_CTL; | ||
408 | u32 saveFDI_TXA_CTL; | ||
409 | u32 saveFDI_RXB_CTL; | ||
410 | u32 saveFDI_TXB_CTL; | ||
411 | u32 savePFA_CTL_1; | ||
412 | u32 savePFB_CTL_1; | ||
413 | u32 savePFA_WIN_SZ; | ||
414 | u32 savePFB_WIN_SZ; | ||
415 | u32 savePFA_WIN_POS; | ||
416 | u32 savePFB_WIN_POS; | ||
387 | 417 | ||
388 | struct { | 418 | struct { |
389 | struct drm_mm gtt_space; | 419 | struct drm_mm gtt_space; |
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c index 75c5bed48be0..992d5617e798 100644 --- a/drivers/gpu/drm/i915/i915_suspend.c +++ b/drivers/gpu/drm/i915/i915_suspend.c | |||
@@ -32,11 +32,15 @@ | |||
32 | static bool i915_pipe_enabled(struct drm_device *dev, enum pipe pipe) | 32 | static bool i915_pipe_enabled(struct drm_device *dev, enum pipe pipe) |
33 | { | 33 | { |
34 | struct drm_i915_private *dev_priv = dev->dev_private; | 34 | struct drm_i915_private *dev_priv = dev->dev_private; |
35 | u32 dpll_reg; | ||
35 | 36 | ||
36 | if (pipe == PIPE_A) | 37 | if (IS_IGDNG(dev)) { |
37 | return (I915_READ(DPLL_A) & DPLL_VCO_ENABLE); | 38 | dpll_reg = (pipe == PIPE_A) ? PCH_DPLL_A: PCH_DPLL_B; |
38 | else | 39 | } else { |
39 | return (I915_READ(DPLL_B) & DPLL_VCO_ENABLE); | 40 | dpll_reg = (pipe == PIPE_A) ? DPLL_A: DPLL_B; |
41 | } | ||
42 | |||
43 | return (I915_READ(dpll_reg) & DPLL_VCO_ENABLE); | ||
40 | } | 44 | } |
41 | 45 | ||
42 | static void i915_save_palette(struct drm_device *dev, enum pipe pipe) | 46 | static void i915_save_palette(struct drm_device *dev, enum pipe pipe) |
@@ -49,6 +53,9 @@ static void i915_save_palette(struct drm_device *dev, enum pipe pipe) | |||
49 | if (!i915_pipe_enabled(dev, pipe)) | 53 | if (!i915_pipe_enabled(dev, pipe)) |
50 | return; | 54 | return; |
51 | 55 | ||
56 | if (IS_IGDNG(dev)) | ||
57 | reg = (pipe == PIPE_A) ? LGC_PALETTE_A : LGC_PALETTE_B; | ||
58 | |||
52 | if (pipe == PIPE_A) | 59 | if (pipe == PIPE_A) |
53 | array = dev_priv->save_palette_a; | 60 | array = dev_priv->save_palette_a; |
54 | else | 61 | else |
@@ -68,6 +75,9 @@ static void i915_restore_palette(struct drm_device *dev, enum pipe pipe) | |||
68 | if (!i915_pipe_enabled(dev, pipe)) | 75 | if (!i915_pipe_enabled(dev, pipe)) |
69 | return; | 76 | return; |
70 | 77 | ||
78 | if (IS_IGDNG(dev)) | ||
79 | reg = (pipe == PIPE_A) ? LGC_PALETTE_A : LGC_PALETTE_B; | ||
80 | |||
71 | if (pipe == PIPE_A) | 81 | if (pipe == PIPE_A) |
72 | array = dev_priv->save_palette_a; | 82 | array = dev_priv->save_palette_a; |
73 | else | 83 | else |
@@ -232,10 +242,16 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
232 | /* Pipe & plane A info */ | 242 | /* Pipe & plane A info */ |
233 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); | 243 | dev_priv->savePIPEACONF = I915_READ(PIPEACONF); |
234 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); | 244 | dev_priv->savePIPEASRC = I915_READ(PIPEASRC); |
235 | dev_priv->saveFPA0 = I915_READ(FPA0); | 245 | if (IS_IGDNG(dev)) { |
236 | dev_priv->saveFPA1 = I915_READ(FPA1); | 246 | dev_priv->saveFPA0 = I915_READ(PCH_FPA0); |
237 | dev_priv->saveDPLL_A = I915_READ(DPLL_A); | 247 | dev_priv->saveFPA1 = I915_READ(PCH_FPA1); |
238 | if (IS_I965G(dev)) | 248 | dev_priv->saveDPLL_A = I915_READ(PCH_DPLL_A); |
249 | } else { | ||
250 | dev_priv->saveFPA0 = I915_READ(FPA0); | ||
251 | dev_priv->saveFPA1 = I915_READ(FPA1); | ||
252 | dev_priv->saveDPLL_A = I915_READ(DPLL_A); | ||
253 | } | ||
254 | if (IS_I965G(dev) && !IS_IGDNG(dev)) | ||
239 | dev_priv->saveDPLL_A_MD = I915_READ(DPLL_A_MD); | 255 | dev_priv->saveDPLL_A_MD = I915_READ(DPLL_A_MD); |
240 | dev_priv->saveHTOTAL_A = I915_READ(HTOTAL_A); | 256 | dev_priv->saveHTOTAL_A = I915_READ(HTOTAL_A); |
241 | dev_priv->saveHBLANK_A = I915_READ(HBLANK_A); | 257 | dev_priv->saveHBLANK_A = I915_READ(HBLANK_A); |
@@ -243,7 +259,24 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
243 | dev_priv->saveVTOTAL_A = I915_READ(VTOTAL_A); | 259 | dev_priv->saveVTOTAL_A = I915_READ(VTOTAL_A); |
244 | dev_priv->saveVBLANK_A = I915_READ(VBLANK_A); | 260 | dev_priv->saveVBLANK_A = I915_READ(VBLANK_A); |
245 | dev_priv->saveVSYNC_A = I915_READ(VSYNC_A); | 261 | dev_priv->saveVSYNC_A = I915_READ(VSYNC_A); |
246 | dev_priv->saveBCLRPAT_A = I915_READ(BCLRPAT_A); | 262 | if (!IS_IGDNG(dev)) |
263 | dev_priv->saveBCLRPAT_A = I915_READ(BCLRPAT_A); | ||
264 | |||
265 | if (IS_IGDNG(dev)) { | ||
266 | dev_priv->saveFDI_TXA_CTL = I915_READ(FDI_TXA_CTL); | ||
267 | dev_priv->saveFDI_RXA_CTL = I915_READ(FDI_RXA_CTL); | ||
268 | |||
269 | dev_priv->savePFA_CTL_1 = I915_READ(PFA_CTL_1); | ||
270 | dev_priv->savePFA_WIN_SZ = I915_READ(PFA_WIN_SZ); | ||
271 | dev_priv->savePFA_WIN_POS = I915_READ(PFA_WIN_POS); | ||
272 | |||
273 | dev_priv->saveTRANS_HTOTAL_A = I915_READ(TRANS_HTOTAL_A); | ||
274 | dev_priv->saveTRANS_HBLANK_A = I915_READ(TRANS_HBLANK_A); | ||
275 | dev_priv->saveTRANS_HSYNC_A = I915_READ(TRANS_HSYNC_A); | ||
276 | dev_priv->saveTRANS_VTOTAL_A = I915_READ(TRANS_VTOTAL_A); | ||
277 | dev_priv->saveTRANS_VBLANK_A = I915_READ(TRANS_VBLANK_A); | ||
278 | dev_priv->saveTRANS_VSYNC_A = I915_READ(TRANS_VSYNC_A); | ||
279 | } | ||
247 | 280 | ||
248 | dev_priv->saveDSPACNTR = I915_READ(DSPACNTR); | 281 | dev_priv->saveDSPACNTR = I915_READ(DSPACNTR); |
249 | dev_priv->saveDSPASTRIDE = I915_READ(DSPASTRIDE); | 282 | dev_priv->saveDSPASTRIDE = I915_READ(DSPASTRIDE); |
@@ -260,10 +293,16 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
260 | /* Pipe & plane B info */ | 293 | /* Pipe & plane B info */ |
261 | dev_priv->savePIPEBCONF = I915_READ(PIPEBCONF); | 294 | dev_priv->savePIPEBCONF = I915_READ(PIPEBCONF); |
262 | dev_priv->savePIPEBSRC = I915_READ(PIPEBSRC); | 295 | dev_priv->savePIPEBSRC = I915_READ(PIPEBSRC); |
263 | dev_priv->saveFPB0 = I915_READ(FPB0); | 296 | if (IS_IGDNG(dev)) { |
264 | dev_priv->saveFPB1 = I915_READ(FPB1); | 297 | dev_priv->saveFPB0 = I915_READ(PCH_FPB0); |
265 | dev_priv->saveDPLL_B = I915_READ(DPLL_B); | 298 | dev_priv->saveFPB1 = I915_READ(PCH_FPB1); |
266 | if (IS_I965G(dev)) | 299 | dev_priv->saveDPLL_B = I915_READ(PCH_DPLL_B); |
300 | } else { | ||
301 | dev_priv->saveFPB0 = I915_READ(FPB0); | ||
302 | dev_priv->saveFPB1 = I915_READ(FPB1); | ||
303 | dev_priv->saveDPLL_B = I915_READ(DPLL_B); | ||
304 | } | ||
305 | if (IS_I965G(dev) && !IS_IGDNG(dev)) | ||
267 | dev_priv->saveDPLL_B_MD = I915_READ(DPLL_B_MD); | 306 | dev_priv->saveDPLL_B_MD = I915_READ(DPLL_B_MD); |
268 | dev_priv->saveHTOTAL_B = I915_READ(HTOTAL_B); | 307 | dev_priv->saveHTOTAL_B = I915_READ(HTOTAL_B); |
269 | dev_priv->saveHBLANK_B = I915_READ(HBLANK_B); | 308 | dev_priv->saveHBLANK_B = I915_READ(HBLANK_B); |
@@ -271,7 +310,24 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
271 | dev_priv->saveVTOTAL_B = I915_READ(VTOTAL_B); | 310 | dev_priv->saveVTOTAL_B = I915_READ(VTOTAL_B); |
272 | dev_priv->saveVBLANK_B = I915_READ(VBLANK_B); | 311 | dev_priv->saveVBLANK_B = I915_READ(VBLANK_B); |
273 | dev_priv->saveVSYNC_B = I915_READ(VSYNC_B); | 312 | dev_priv->saveVSYNC_B = I915_READ(VSYNC_B); |
274 | dev_priv->saveBCLRPAT_A = I915_READ(BCLRPAT_A); | 313 | if (!IS_IGDNG(dev)) |
314 | dev_priv->saveBCLRPAT_B = I915_READ(BCLRPAT_B); | ||
315 | |||
316 | if (IS_IGDNG(dev)) { | ||
317 | dev_priv->saveFDI_TXB_CTL = I915_READ(FDI_TXB_CTL); | ||
318 | dev_priv->saveFDI_RXB_CTL = I915_READ(FDI_RXB_CTL); | ||
319 | |||
320 | dev_priv->savePFB_CTL_1 = I915_READ(PFB_CTL_1); | ||
321 | dev_priv->savePFB_WIN_SZ = I915_READ(PFB_WIN_SZ); | ||
322 | dev_priv->savePFB_WIN_POS = I915_READ(PFB_WIN_POS); | ||
323 | |||
324 | dev_priv->saveTRANS_HTOTAL_B = I915_READ(TRANS_HTOTAL_B); | ||
325 | dev_priv->saveTRANS_HBLANK_B = I915_READ(TRANS_HBLANK_B); | ||
326 | dev_priv->saveTRANS_HSYNC_B = I915_READ(TRANS_HSYNC_B); | ||
327 | dev_priv->saveTRANS_VTOTAL_B = I915_READ(TRANS_VTOTAL_B); | ||
328 | dev_priv->saveTRANS_VBLANK_B = I915_READ(TRANS_VBLANK_B); | ||
329 | dev_priv->saveTRANS_VSYNC_B = I915_READ(TRANS_VSYNC_B); | ||
330 | } | ||
275 | 331 | ||
276 | dev_priv->saveDSPBCNTR = I915_READ(DSPBCNTR); | 332 | dev_priv->saveDSPBCNTR = I915_READ(DSPBCNTR); |
277 | dev_priv->saveDSPBSTRIDE = I915_READ(DSPBSTRIDE); | 333 | dev_priv->saveDSPBSTRIDE = I915_READ(DSPBSTRIDE); |
@@ -290,23 +346,41 @@ static void i915_save_modeset_reg(struct drm_device *dev) | |||
290 | static void i915_restore_modeset_reg(struct drm_device *dev) | 346 | static void i915_restore_modeset_reg(struct drm_device *dev) |
291 | { | 347 | { |
292 | struct drm_i915_private *dev_priv = dev->dev_private; | 348 | struct drm_i915_private *dev_priv = dev->dev_private; |
349 | int dpll_a_reg, fpa0_reg, fpa1_reg; | ||
350 | int dpll_b_reg, fpb0_reg, fpb1_reg; | ||
293 | 351 | ||
294 | if (drm_core_check_feature(dev, DRIVER_MODESET)) | 352 | if (drm_core_check_feature(dev, DRIVER_MODESET)) |
295 | return; | 353 | return; |
296 | 354 | ||
355 | if (IS_IGDNG(dev)) { | ||
356 | dpll_a_reg = PCH_DPLL_A; | ||
357 | dpll_b_reg = PCH_DPLL_B; | ||
358 | fpa0_reg = PCH_FPA0; | ||
359 | fpb0_reg = PCH_FPB0; | ||
360 | fpa1_reg = PCH_FPA1; | ||
361 | fpb1_reg = PCH_FPB1; | ||
362 | } else { | ||
363 | dpll_a_reg = DPLL_A; | ||
364 | dpll_b_reg = DPLL_B; | ||
365 | fpa0_reg = FPA0; | ||
366 | fpb0_reg = FPB0; | ||
367 | fpa1_reg = FPA1; | ||
368 | fpb1_reg = FPB1; | ||
369 | } | ||
370 | |||
297 | /* Pipe & plane A info */ | 371 | /* Pipe & plane A info */ |
298 | /* Prime the clock */ | 372 | /* Prime the clock */ |
299 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { | 373 | if (dev_priv->saveDPLL_A & DPLL_VCO_ENABLE) { |
300 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A & | 374 | I915_WRITE(dpll_a_reg, dev_priv->saveDPLL_A & |
301 | ~DPLL_VCO_ENABLE); | 375 | ~DPLL_VCO_ENABLE); |
302 | DRM_UDELAY(150); | 376 | DRM_UDELAY(150); |
303 | } | 377 | } |
304 | I915_WRITE(FPA0, dev_priv->saveFPA0); | 378 | I915_WRITE(fpa0_reg, dev_priv->saveFPA0); |
305 | I915_WRITE(FPA1, dev_priv->saveFPA1); | 379 | I915_WRITE(fpa1_reg, dev_priv->saveFPA1); |
306 | /* Actually enable it */ | 380 | /* Actually enable it */ |
307 | I915_WRITE(DPLL_A, dev_priv->saveDPLL_A); | 381 | I915_WRITE(dpll_a_reg, dev_priv->saveDPLL_A); |
308 | DRM_UDELAY(150); | 382 | DRM_UDELAY(150); |
309 | if (IS_I965G(dev)) | 383 | if (IS_I965G(dev) && !IS_IGDNG(dev)) |
310 | I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); | 384 | I915_WRITE(DPLL_A_MD, dev_priv->saveDPLL_A_MD); |
311 | DRM_UDELAY(150); | 385 | DRM_UDELAY(150); |
312 | 386 | ||
@@ -317,7 +391,24 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
317 | I915_WRITE(VTOTAL_A, dev_priv->saveVTOTAL_A); | 391 | I915_WRITE(VTOTAL_A, dev_priv->saveVTOTAL_A); |
318 | I915_WRITE(VBLANK_A, dev_priv->saveVBLANK_A); | 392 | I915_WRITE(VBLANK_A, dev_priv->saveVBLANK_A); |
319 | I915_WRITE(VSYNC_A, dev_priv->saveVSYNC_A); | 393 | I915_WRITE(VSYNC_A, dev_priv->saveVSYNC_A); |
320 | I915_WRITE(BCLRPAT_A, dev_priv->saveBCLRPAT_A); | 394 | if (!IS_IGDNG(dev)) |
395 | I915_WRITE(BCLRPAT_A, dev_priv->saveBCLRPAT_A); | ||
396 | |||
397 | if (IS_IGDNG(dev)) { | ||
398 | I915_WRITE(FDI_RXA_CTL, dev_priv->saveFDI_RXA_CTL); | ||
399 | I915_WRITE(FDI_TXA_CTL, dev_priv->saveFDI_TXA_CTL); | ||
400 | |||
401 | I915_WRITE(PFA_CTL_1, dev_priv->savePFA_CTL_1); | ||
402 | I915_WRITE(PFA_WIN_SZ, dev_priv->savePFA_WIN_SZ); | ||
403 | I915_WRITE(PFA_WIN_POS, dev_priv->savePFA_WIN_POS); | ||
404 | |||
405 | I915_WRITE(TRANS_HTOTAL_A, dev_priv->saveTRANS_HTOTAL_A); | ||
406 | I915_WRITE(TRANS_HBLANK_A, dev_priv->saveTRANS_HBLANK_A); | ||
407 | I915_WRITE(TRANS_HSYNC_A, dev_priv->saveTRANS_HSYNC_A); | ||
408 | I915_WRITE(TRANS_VTOTAL_A, dev_priv->saveTRANS_VTOTAL_A); | ||
409 | I915_WRITE(TRANS_VBLANK_A, dev_priv->saveTRANS_VBLANK_A); | ||
410 | I915_WRITE(TRANS_VSYNC_A, dev_priv->saveTRANS_VSYNC_A); | ||
411 | } | ||
321 | 412 | ||
322 | /* Restore plane info */ | 413 | /* Restore plane info */ |
323 | I915_WRITE(DSPASIZE, dev_priv->saveDSPASIZE); | 414 | I915_WRITE(DSPASIZE, dev_priv->saveDSPASIZE); |
@@ -339,14 +430,14 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
339 | 430 | ||
340 | /* Pipe & plane B info */ | 431 | /* Pipe & plane B info */ |
341 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { | 432 | if (dev_priv->saveDPLL_B & DPLL_VCO_ENABLE) { |
342 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B & | 433 | I915_WRITE(dpll_b_reg, dev_priv->saveDPLL_B & |
343 | ~DPLL_VCO_ENABLE); | 434 | ~DPLL_VCO_ENABLE); |
344 | DRM_UDELAY(150); | 435 | DRM_UDELAY(150); |
345 | } | 436 | } |
346 | I915_WRITE(FPB0, dev_priv->saveFPB0); | 437 | I915_WRITE(fpb0_reg, dev_priv->saveFPB0); |
347 | I915_WRITE(FPB1, dev_priv->saveFPB1); | 438 | I915_WRITE(fpb1_reg, dev_priv->saveFPB1); |
348 | /* Actually enable it */ | 439 | /* Actually enable it */ |
349 | I915_WRITE(DPLL_B, dev_priv->saveDPLL_B); | 440 | I915_WRITE(dpll_b_reg, dev_priv->saveDPLL_B); |
350 | DRM_UDELAY(150); | 441 | DRM_UDELAY(150); |
351 | if (IS_I965G(dev)) | 442 | if (IS_I965G(dev)) |
352 | I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); | 443 | I915_WRITE(DPLL_B_MD, dev_priv->saveDPLL_B_MD); |
@@ -359,7 +450,24 @@ static void i915_restore_modeset_reg(struct drm_device *dev) | |||
359 | I915_WRITE(VTOTAL_B, dev_priv->saveVTOTAL_B); | 450 | I915_WRITE(VTOTAL_B, dev_priv->saveVTOTAL_B); |
360 | I915_WRITE(VBLANK_B, dev_priv->saveVBLANK_B); | 451 | I915_WRITE(VBLANK_B, dev_priv->saveVBLANK_B); |
361 | I915_WRITE(VSYNC_B, dev_priv->saveVSYNC_B); | 452 | I915_WRITE(VSYNC_B, dev_priv->saveVSYNC_B); |
362 | I915_WRITE(BCLRPAT_B, dev_priv->saveBCLRPAT_B); | 453 | if (!IS_IGDNG(dev)) |
454 | I915_WRITE(BCLRPAT_B, dev_priv->saveBCLRPAT_B); | ||
455 | |||
456 | if (IS_IGDNG(dev)) { | ||
457 | I915_WRITE(FDI_RXB_CTL, dev_priv->saveFDI_RXB_CTL); | ||
458 | I915_WRITE(FDI_TXB_CTL, dev_priv->saveFDI_TXB_CTL); | ||
459 | |||
460 | I915_WRITE(PFB_CTL_1, dev_priv->savePFB_CTL_1); | ||
461 | I915_WRITE(PFB_WIN_SZ, dev_priv->savePFB_WIN_SZ); | ||
462 | I915_WRITE(PFB_WIN_POS, dev_priv->savePFB_WIN_POS); | ||
463 | |||
464 | I915_WRITE(TRANS_HTOTAL_B, dev_priv->saveTRANS_HTOTAL_B); | ||
465 | I915_WRITE(TRANS_HBLANK_B, dev_priv->saveTRANS_HBLANK_B); | ||
466 | I915_WRITE(TRANS_HSYNC_B, dev_priv->saveTRANS_HSYNC_B); | ||
467 | I915_WRITE(TRANS_VTOTAL_B, dev_priv->saveTRANS_VTOTAL_B); | ||
468 | I915_WRITE(TRANS_VBLANK_B, dev_priv->saveTRANS_VBLANK_B); | ||
469 | I915_WRITE(TRANS_VSYNC_B, dev_priv->saveTRANS_VSYNC_B); | ||
470 | } | ||
363 | 471 | ||
364 | /* Restore plane info */ | 472 | /* Restore plane info */ |
365 | I915_WRITE(DSPBSIZE, dev_priv->saveDSPBSIZE); | 473 | I915_WRITE(DSPBSIZE, dev_priv->saveDSPBSIZE); |
@@ -404,22 +512,43 @@ void i915_save_display(struct drm_device *dev) | |||
404 | dev_priv->saveCURSIZE = I915_READ(CURSIZE); | 512 | dev_priv->saveCURSIZE = I915_READ(CURSIZE); |
405 | 513 | ||
406 | /* CRT state */ | 514 | /* CRT state */ |
407 | dev_priv->saveADPA = I915_READ(ADPA); | 515 | if (IS_IGDNG(dev)) { |
516 | dev_priv->saveADPA = I915_READ(PCH_ADPA); | ||
517 | } else { | ||
518 | dev_priv->saveADPA = I915_READ(ADPA); | ||
519 | } | ||
408 | 520 | ||
409 | /* LVDS state */ | 521 | /* LVDS state */ |
410 | dev_priv->savePP_CONTROL = I915_READ(PP_CONTROL); | 522 | if (IS_IGDNG(dev)) { |
411 | dev_priv->savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS); | 523 | dev_priv->savePP_CONTROL = I915_READ(PCH_PP_CONTROL); |
412 | dev_priv->saveBLC_PWM_CTL = I915_READ(BLC_PWM_CTL); | 524 | dev_priv->saveBLC_PWM_CTL = I915_READ(BLC_PWM_PCH_CTL1); |
413 | dev_priv->saveBLC_HIST_CTL = I915_READ(BLC_HIST_CTL); | 525 | dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_PCH_CTL2); |
414 | if (IS_I965G(dev)) | 526 | dev_priv->saveBLC_CPU_PWM_CTL = I915_READ(BLC_PWM_CPU_CTL); |
415 | dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2); | 527 | dev_priv->saveBLC_CPU_PWM_CTL2 = I915_READ(BLC_PWM_CPU_CTL2); |
416 | if (IS_MOBILE(dev) && !IS_I830(dev)) | 528 | dev_priv->saveLVDS = I915_READ(PCH_LVDS); |
417 | dev_priv->saveLVDS = I915_READ(LVDS); | 529 | } else { |
418 | if (!IS_I830(dev) && !IS_845G(dev)) | 530 | dev_priv->savePP_CONTROL = I915_READ(PP_CONTROL); |
531 | dev_priv->savePFIT_PGM_RATIOS = I915_READ(PFIT_PGM_RATIOS); | ||
532 | dev_priv->saveBLC_PWM_CTL = I915_READ(BLC_PWM_CTL); | ||
533 | dev_priv->saveBLC_HIST_CTL = I915_READ(BLC_HIST_CTL); | ||
534 | if (IS_I965G(dev)) | ||
535 | dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2); | ||
536 | if (IS_MOBILE(dev) && !IS_I830(dev)) | ||
537 | dev_priv->saveLVDS = I915_READ(LVDS); | ||
538 | } | ||
539 | |||
540 | if (!IS_I830(dev) && !IS_845G(dev) && !IS_IGDNG(dev)) | ||
419 | dev_priv->savePFIT_CONTROL = I915_READ(PFIT_CONTROL); | 541 | dev_priv->savePFIT_CONTROL = I915_READ(PFIT_CONTROL); |
420 | dev_priv->savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS); | 542 | |
421 | dev_priv->savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS); | 543 | if (IS_IGDNG(dev)) { |
422 | dev_priv->savePP_DIVISOR = I915_READ(PP_DIVISOR); | 544 | dev_priv->savePP_ON_DELAYS = I915_READ(PCH_PP_ON_DELAYS); |
545 | dev_priv->savePP_OFF_DELAYS = I915_READ(PCH_PP_OFF_DELAYS); | ||
546 | dev_priv->savePP_DIVISOR = I915_READ(PCH_PP_DIVISOR); | ||
547 | } else { | ||
548 | dev_priv->savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS); | ||
549 | dev_priv->savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS); | ||
550 | dev_priv->savePP_DIVISOR = I915_READ(PP_DIVISOR); | ||
551 | } | ||
423 | 552 | ||
424 | /* Display Port state */ | 553 | /* Display Port state */ |
425 | if (SUPPORTS_INTEGRATED_DP(dev)) { | 554 | if (SUPPORTS_INTEGRATED_DP(dev)) { |
@@ -451,7 +580,10 @@ void i915_save_display(struct drm_device *dev) | |||
451 | dev_priv->saveVGA0 = I915_READ(VGA0); | 580 | dev_priv->saveVGA0 = I915_READ(VGA0); |
452 | dev_priv->saveVGA1 = I915_READ(VGA1); | 581 | dev_priv->saveVGA1 = I915_READ(VGA1); |
453 | dev_priv->saveVGA_PD = I915_READ(VGA_PD); | 582 | dev_priv->saveVGA_PD = I915_READ(VGA_PD); |
454 | dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); | 583 | if (IS_IGDNG(dev)) |
584 | dev_priv->saveVGACNTRL = I915_READ(CPU_VGACNTRL); | ||
585 | else | ||
586 | dev_priv->saveVGACNTRL = I915_READ(VGACNTRL); | ||
455 | 587 | ||
456 | i915_save_vga(dev); | 588 | i915_save_vga(dev); |
457 | } | 589 | } |
@@ -490,23 +622,41 @@ void i915_restore_display(struct drm_device *dev) | |||
490 | I915_WRITE(CURSIZE, dev_priv->saveCURSIZE); | 622 | I915_WRITE(CURSIZE, dev_priv->saveCURSIZE); |
491 | 623 | ||
492 | /* CRT state */ | 624 | /* CRT state */ |
493 | I915_WRITE(ADPA, dev_priv->saveADPA); | 625 | if (IS_IGDNG(dev)) |
626 | I915_WRITE(PCH_ADPA, dev_priv->saveADPA); | ||
627 | else | ||
628 | I915_WRITE(ADPA, dev_priv->saveADPA); | ||
494 | 629 | ||
495 | /* LVDS state */ | 630 | /* LVDS state */ |
496 | if (IS_I965G(dev)) | 631 | if (IS_I965G(dev) && !IS_IGDNG(dev)) |
497 | I915_WRITE(BLC_PWM_CTL2, dev_priv->saveBLC_PWM_CTL2); | 632 | I915_WRITE(BLC_PWM_CTL2, dev_priv->saveBLC_PWM_CTL2); |
498 | if (IS_MOBILE(dev) && !IS_I830(dev)) | 633 | |
634 | if (IS_IGDNG(dev)) { | ||
635 | I915_WRITE(PCH_LVDS, dev_priv->saveLVDS); | ||
636 | } else if (IS_MOBILE(dev) && !IS_I830(dev)) | ||
499 | I915_WRITE(LVDS, dev_priv->saveLVDS); | 637 | I915_WRITE(LVDS, dev_priv->saveLVDS); |
500 | if (!IS_I830(dev) && !IS_845G(dev)) | 638 | |
639 | if (!IS_I830(dev) && !IS_845G(dev) && !IS_IGDNG(dev)) | ||
501 | I915_WRITE(PFIT_CONTROL, dev_priv->savePFIT_CONTROL); | 640 | I915_WRITE(PFIT_CONTROL, dev_priv->savePFIT_CONTROL); |
502 | 641 | ||
503 | I915_WRITE(PFIT_PGM_RATIOS, dev_priv->savePFIT_PGM_RATIOS); | 642 | if (IS_IGDNG(dev)) { |
504 | I915_WRITE(BLC_PWM_CTL, dev_priv->saveBLC_PWM_CTL); | 643 | I915_WRITE(BLC_PWM_PCH_CTL1, dev_priv->saveBLC_PWM_CTL); |
505 | I915_WRITE(BLC_HIST_CTL, dev_priv->saveBLC_HIST_CTL); | 644 | I915_WRITE(BLC_PWM_PCH_CTL2, dev_priv->saveBLC_PWM_CTL2); |
506 | I915_WRITE(PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); | 645 | I915_WRITE(BLC_PWM_CPU_CTL, dev_priv->saveBLC_CPU_PWM_CTL); |
507 | I915_WRITE(PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); | 646 | I915_WRITE(BLC_PWM_CPU_CTL2, dev_priv->saveBLC_CPU_PWM_CTL2); |
508 | I915_WRITE(PP_DIVISOR, dev_priv->savePP_DIVISOR); | 647 | I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); |
509 | I915_WRITE(PP_CONTROL, dev_priv->savePP_CONTROL); | 648 | I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); |
649 | I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR); | ||
650 | I915_WRITE(PCH_PP_CONTROL, dev_priv->savePP_CONTROL); | ||
651 | } else { | ||
652 | I915_WRITE(PFIT_PGM_RATIOS, dev_priv->savePFIT_PGM_RATIOS); | ||
653 | I915_WRITE(BLC_PWM_CTL, dev_priv->saveBLC_PWM_CTL); | ||
654 | I915_WRITE(BLC_HIST_CTL, dev_priv->saveBLC_HIST_CTL); | ||
655 | I915_WRITE(PP_ON_DELAYS, dev_priv->savePP_ON_DELAYS); | ||
656 | I915_WRITE(PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); | ||
657 | I915_WRITE(PP_DIVISOR, dev_priv->savePP_DIVISOR); | ||
658 | I915_WRITE(PP_CONTROL, dev_priv->savePP_CONTROL); | ||
659 | } | ||
510 | 660 | ||
511 | /* Display Port state */ | 661 | /* Display Port state */ |
512 | if (SUPPORTS_INTEGRATED_DP(dev)) { | 662 | if (SUPPORTS_INTEGRATED_DP(dev)) { |
@@ -529,7 +679,10 @@ void i915_restore_display(struct drm_device *dev) | |||
529 | } | 679 | } |
530 | 680 | ||
531 | /* VGA state */ | 681 | /* VGA state */ |
532 | I915_WRITE(VGACNTRL, dev_priv->saveVGACNTRL); | 682 | if (IS_IGDNG(dev)) |
683 | I915_WRITE(CPU_VGACNTRL, dev_priv->saveVGACNTRL); | ||
684 | else | ||
685 | I915_WRITE(VGACNTRL, dev_priv->saveVGACNTRL); | ||
533 | I915_WRITE(VGA0, dev_priv->saveVGA0); | 686 | I915_WRITE(VGA0, dev_priv->saveVGA0); |
534 | I915_WRITE(VGA1, dev_priv->saveVGA1); | 687 | I915_WRITE(VGA1, dev_priv->saveVGA1); |
535 | I915_WRITE(VGA_PD, dev_priv->saveVGA_PD); | 688 | I915_WRITE(VGA_PD, dev_priv->saveVGA_PD); |
@@ -555,8 +708,17 @@ int i915_save_state(struct drm_device *dev) | |||
555 | i915_save_display(dev); | 708 | i915_save_display(dev); |
556 | 709 | ||
557 | /* Interrupt state */ | 710 | /* Interrupt state */ |
558 | dev_priv->saveIER = I915_READ(IER); | 711 | if (IS_IGDNG(dev)) { |
559 | dev_priv->saveIMR = I915_READ(IMR); | 712 | dev_priv->saveDEIER = I915_READ(DEIER); |
713 | dev_priv->saveDEIMR = I915_READ(DEIMR); | ||
714 | dev_priv->saveGTIER = I915_READ(GTIER); | ||
715 | dev_priv->saveGTIMR = I915_READ(GTIMR); | ||
716 | dev_priv->saveFDI_RXA_IMR = I915_READ(FDI_RXA_IMR); | ||
717 | dev_priv->saveFDI_RXB_IMR = I915_READ(FDI_RXB_IMR); | ||
718 | } else { | ||
719 | dev_priv->saveIER = I915_READ(IER); | ||
720 | dev_priv->saveIMR = I915_READ(IMR); | ||
721 | } | ||
560 | 722 | ||
561 | /* Clock gating state */ | 723 | /* Clock gating state */ |
562 | dev_priv->saveD_STATE = I915_READ(D_STATE); | 724 | dev_priv->saveD_STATE = I915_READ(D_STATE); |
@@ -621,8 +783,17 @@ int i915_restore_state(struct drm_device *dev) | |||
621 | i915_restore_display(dev); | 783 | i915_restore_display(dev); |
622 | 784 | ||
623 | /* Interrupt state */ | 785 | /* Interrupt state */ |
624 | I915_WRITE (IER, dev_priv->saveIER); | 786 | if (IS_IGDNG(dev)) { |
625 | I915_WRITE (IMR, dev_priv->saveIMR); | 787 | I915_WRITE(DEIER, dev_priv->saveDEIER); |
788 | I915_WRITE(DEIMR, dev_priv->saveDEIMR); | ||
789 | I915_WRITE(GTIER, dev_priv->saveGTIER); | ||
790 | I915_WRITE(GTIMR, dev_priv->saveGTIMR); | ||
791 | I915_WRITE(FDI_RXA_IMR, dev_priv->saveFDI_RXA_IMR); | ||
792 | I915_WRITE(FDI_RXB_IMR, dev_priv->saveFDI_RXB_IMR); | ||
793 | } else { | ||
794 | I915_WRITE (IER, dev_priv->saveIER); | ||
795 | I915_WRITE (IMR, dev_priv->saveIMR); | ||
796 | } | ||
626 | 797 | ||
627 | /* Clock gating state */ | 798 | /* Clock gating state */ |
628 | I915_WRITE (D_STATE, dev_priv->saveD_STATE); | 799 | I915_WRITE (D_STATE, dev_priv->saveD_STATE); |