aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_suspend.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/i915_suspend.c')
-rw-r--r--drivers/gpu/drm/i915/i915_suspend.c104
1 files changed, 56 insertions, 48 deletions
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 42729d25da58..0521ecf26017 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -235,6 +235,7 @@ static void i915_restore_vga(struct drm_device *dev)
235static void i915_save_modeset_reg(struct drm_device *dev) 235static void i915_save_modeset_reg(struct drm_device *dev)
236{ 236{
237 struct drm_i915_private *dev_priv = dev->dev_private; 237 struct drm_i915_private *dev_priv = dev->dev_private;
238 int i;
238 239
239 if (drm_core_check_feature(dev, DRIVER_MODESET)) 240 if (drm_core_check_feature(dev, DRIVER_MODESET))
240 return; 241 return;
@@ -367,6 +368,28 @@ static void i915_save_modeset_reg(struct drm_device *dev)
367 } 368 }
368 i915_save_palette(dev, PIPE_B); 369 i915_save_palette(dev, PIPE_B);
369 dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT); 370 dev_priv->savePIPEBSTAT = I915_READ(PIPEBSTAT);
371
372 /* Fences */
373 switch (INTEL_INFO(dev)->gen) {
374 case 6:
375 for (i = 0; i < 16; i++)
376 dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8));
377 break;
378 case 5:
379 case 4:
380 for (i = 0; i < 16; i++)
381 dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_965_0 + (i * 8));
382 break;
383 case 3:
384 if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
385 for (i = 0; i < 8; i++)
386 dev_priv->saveFENCE[i+8] = I915_READ(FENCE_REG_945_8 + (i * 4));
387 case 2:
388 for (i = 0; i < 8; i++)
389 dev_priv->saveFENCE[i] = I915_READ(FENCE_REG_830_0 + (i * 4));
390 break;
391 }
392
370 return; 393 return;
371} 394}
372 395
@@ -375,10 +398,33 @@ static void i915_restore_modeset_reg(struct drm_device *dev)
375 struct drm_i915_private *dev_priv = dev->dev_private; 398 struct drm_i915_private *dev_priv = dev->dev_private;
376 int dpll_a_reg, fpa0_reg, fpa1_reg; 399 int dpll_a_reg, fpa0_reg, fpa1_reg;
377 int dpll_b_reg, fpb0_reg, fpb1_reg; 400 int dpll_b_reg, fpb0_reg, fpb1_reg;
401 int i;
378 402
379 if (drm_core_check_feature(dev, DRIVER_MODESET)) 403 if (drm_core_check_feature(dev, DRIVER_MODESET))
380 return; 404 return;
381 405
406 /* Fences */
407 switch (INTEL_INFO(dev)->gen) {
408 case 6:
409 for (i = 0; i < 16; i++)
410 I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + (i * 8), dev_priv->saveFENCE[i]);
411 break;
412 case 5:
413 case 4:
414 for (i = 0; i < 16; i++)
415 I915_WRITE64(FENCE_REG_965_0 + (i * 8), dev_priv->saveFENCE[i]);
416 break;
417 case 3:
418 case 2:
419 if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
420 for (i = 0; i < 8; i++)
421 I915_WRITE(FENCE_REG_945_8 + (i * 4), dev_priv->saveFENCE[i+8]);
422 for (i = 0; i < 8; i++)
423 I915_WRITE(FENCE_REG_830_0 + (i * 4), dev_priv->saveFENCE[i]);
424 break;
425 }
426
427
382 if (HAS_PCH_SPLIT(dev)) { 428 if (HAS_PCH_SPLIT(dev)) {
383 dpll_a_reg = PCH_DPLL_A; 429 dpll_a_reg = PCH_DPLL_A;
384 dpll_b_reg = PCH_DPLL_B; 430 dpll_b_reg = PCH_DPLL_B;
@@ -694,7 +740,7 @@ void i915_restore_display(struct drm_device *dev)
694 I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS); 740 I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->savePP_OFF_DELAYS);
695 I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR); 741 I915_WRITE(PCH_PP_DIVISOR, dev_priv->savePP_DIVISOR);
696 I915_WRITE(PCH_PP_CONTROL, dev_priv->savePP_CONTROL); 742 I915_WRITE(PCH_PP_CONTROL, dev_priv->savePP_CONTROL);
697 I915_WRITE(MCHBAR_RENDER_STANDBY, 743 I915_WRITE(RSTDBYCTL,
698 dev_priv->saveMCHBAR_RENDER_STANDBY); 744 dev_priv->saveMCHBAR_RENDER_STANDBY);
699 } else { 745 } else {
700 I915_WRITE(PFIT_PGM_RATIOS, dev_priv->savePFIT_PGM_RATIOS); 746 I915_WRITE(PFIT_PGM_RATIOS, dev_priv->savePFIT_PGM_RATIOS);
@@ -765,14 +811,16 @@ int i915_save_state(struct drm_device *dev)
765 dev_priv->saveFDI_RXA_IMR = I915_READ(FDI_RXA_IMR); 811 dev_priv->saveFDI_RXA_IMR = I915_READ(FDI_RXA_IMR);
766 dev_priv->saveFDI_RXB_IMR = I915_READ(FDI_RXB_IMR); 812 dev_priv->saveFDI_RXB_IMR = I915_READ(FDI_RXB_IMR);
767 dev_priv->saveMCHBAR_RENDER_STANDBY = 813 dev_priv->saveMCHBAR_RENDER_STANDBY =
768 I915_READ(MCHBAR_RENDER_STANDBY); 814 I915_READ(RSTDBYCTL);
769 } else { 815 } else {
770 dev_priv->saveIER = I915_READ(IER); 816 dev_priv->saveIER = I915_READ(IER);
771 dev_priv->saveIMR = I915_READ(IMR); 817 dev_priv->saveIMR = I915_READ(IMR);
772 } 818 }
773 819
774 if (HAS_PCH_SPLIT(dev)) 820 if (IS_IRONLAKE_M(dev))
775 ironlake_disable_drps(dev); 821 ironlake_disable_drps(dev);
822 if (IS_GEN6(dev))
823 gen6_disable_rps(dev);
776 824
777 /* Cache mode state */ 825 /* Cache mode state */
778 dev_priv->saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0); 826 dev_priv->saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
@@ -788,28 +836,6 @@ int i915_save_state(struct drm_device *dev)
788 for (i = 0; i < 3; i++) 836 for (i = 0; i < 3; i++)
789 dev_priv->saveSWF2[i] = I915_READ(SWF30 + (i << 2)); 837 dev_priv->saveSWF2[i] = I915_READ(SWF30 + (i << 2));
790 838
791 /* Fences */
792 switch (INTEL_INFO(dev)->gen) {
793 case 6:
794 for (i = 0; i < 16; i++)
795 dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_SANDYBRIDGE_0 + (i * 8));
796 break;
797 case 5:
798 case 4:
799 for (i = 0; i < 16; i++)
800 dev_priv->saveFENCE[i] = I915_READ64(FENCE_REG_965_0 + (i * 8));
801 break;
802 case 3:
803 if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
804 for (i = 0; i < 8; i++)
805 dev_priv->saveFENCE[i+8] = I915_READ(FENCE_REG_945_8 + (i * 4));
806 case 2:
807 for (i = 0; i < 8; i++)
808 dev_priv->saveFENCE[i] = I915_READ(FENCE_REG_830_0 + (i * 4));
809 break;
810
811 }
812
813 return 0; 839 return 0;
814} 840}
815 841
@@ -823,27 +849,6 @@ int i915_restore_state(struct drm_device *dev)
823 /* Hardware status page */ 849 /* Hardware status page */
824 I915_WRITE(HWS_PGA, dev_priv->saveHWS); 850 I915_WRITE(HWS_PGA, dev_priv->saveHWS);
825 851
826 /* Fences */
827 switch (INTEL_INFO(dev)->gen) {
828 case 6:
829 for (i = 0; i < 16; i++)
830 I915_WRITE64(FENCE_REG_SANDYBRIDGE_0 + (i * 8), dev_priv->saveFENCE[i]);
831 break;
832 case 5:
833 case 4:
834 for (i = 0; i < 16; i++)
835 I915_WRITE64(FENCE_REG_965_0 + (i * 8), dev_priv->saveFENCE[i]);
836 break;
837 case 3:
838 case 2:
839 if (IS_I945G(dev) || IS_I945GM(dev) || IS_G33(dev))
840 for (i = 0; i < 8; i++)
841 I915_WRITE(FENCE_REG_945_8 + (i * 4), dev_priv->saveFENCE[i+8]);
842 for (i = 0; i < 8; i++)
843 I915_WRITE(FENCE_REG_830_0 + (i * 4), dev_priv->saveFENCE[i]);
844 break;
845 }
846
847 i915_restore_display(dev); 852 i915_restore_display(dev);
848 853
849 /* Interrupt state */ 854 /* Interrupt state */
@@ -860,13 +865,16 @@ int i915_restore_state(struct drm_device *dev)
860 } 865 }
861 866
862 /* Clock gating state */ 867 /* Clock gating state */
863 intel_init_clock_gating(dev); 868 intel_enable_clock_gating(dev);
864 869
865 if (HAS_PCH_SPLIT(dev)) { 870 if (IS_IRONLAKE_M(dev)) {
866 ironlake_enable_drps(dev); 871 ironlake_enable_drps(dev);
867 intel_init_emon(dev); 872 intel_init_emon(dev);
868 } 873 }
869 874
875 if (IS_GEN6(dev))
876 gen6_enable_rps(dev_priv);
877
870 /* Cache mode state */ 878 /* Cache mode state */
871 I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000); 879 I915_WRITE (CACHE_MODE_0, dev_priv->saveCACHE_MODE_0 | 0xffff0000);
872 880