28 #include <drm/i915_drm.h>
49 static void i915_save_palette(
struct drm_device *dev,
enum pipe pipe)
56 if (!i915_pipe_enabled(dev, pipe))
67 for (i = 0; i < 256; i++)
71 static void i915_restore_palette(
struct drm_device *dev,
enum pipe pipe)
78 if (!i915_pipe_enabled(dev, pipe))
89 for (i = 0; i < 256; i++)
127 static void i915_save_vga(
struct drm_device *dev)
131 u16 cr_index, cr_data, st01;
149 i915_write_indexed(dev, cr_index, cr_data, 0x11,
150 i915_read_indexed(dev, cr_index, cr_data, 0x11) &
152 for (i = 0; i <= 0x24; i++)
154 i915_read_indexed(dev, cr_index, cr_data, i);
156 dev_priv->
saveCR[0x11] &= ~0x80;
161 for (i = 0; i <= 0x14; i++)
162 dev_priv->
saveAR[i] = i915_read_ar(dev, st01, i, 0);
168 for (i = 0; i < 9; i++)
180 for (i = 0; i < 8; i++)
185 static void i915_restore_vga(
struct drm_device *dev)
189 u16 cr_index, cr_data, st01;
204 for (i = 0; i < 7; i++)
210 i915_write_indexed(dev, cr_index, cr_data, 0x11, dev_priv->
saveCR[0x11]);
211 for (i = 0; i <= 0x24; i++)
212 i915_write_indexed(dev, cr_index, cr_data, i, dev_priv->
saveCR[i]);
215 for (i = 0; i < 9; i++)
228 for (i = 0; i <= 0x14; i++)
229 i915_write_ar(dev, st01, i, dev_priv->
saveAR[i], 0);
238 static void i915_save_modeset_reg(
struct drm_device *dev)
243 if (drm_core_check_feature(dev, DRIVER_MODESET))
315 i915_save_palette(dev,
PIPE_A);
372 i915_save_palette(dev,
PIPE_B);
379 for (i = 0; i < 16; i++)
384 for (i = 0; i < 16; i++)
389 for (i = 0; i < 8; i++)
392 for (i = 0; i < 8; i++)
400 static void i915_restore_modeset_reg(
struct drm_device *dev)
403 int dpll_a_reg, fpa0_reg, fpa1_reg;
404 int dpll_b_reg, fpb0_reg, fpb1_reg;
407 if (drm_core_check_feature(dev, DRIVER_MODESET))
414 for (i = 0; i < 16; i++)
419 for (i = 0; i < 16; i++)
425 for (i = 0; i < 8; i++)
427 for (i = 0; i < 8; i++)
519 i915_restore_palette(dev,
PIPE_A);
588 i915_restore_palette(dev,
PIPE_B);
606 static void i915_save_display(
struct drm_device *dev)
615 i915_save_modeset_reg(dev);
698 static void i915_restore_display(
struct drm_device *dev)
719 i915_restore_modeset_reg(dev);
797 i915_restore_vga(dev);
805 pci_read_config_byte(dev->pdev,
LBB, &dev_priv->
saveLBB);
812 i915_save_display(dev);
839 for (i = 0; i < 16; i++) {
843 for (i = 0; i < 3; i++)
856 pci_write_config_byte(dev->pdev,
LBB, dev_priv->
saveLBB);
863 i915_restore_display(dev);
885 for (i = 0; i < 16; i++) {
889 for (i = 0; i < 3; i++)