Release 4.7 drivers/gpu/drm/i915/i915_suspend.c
/*
*
* Copyright 2008 (c) Intel Corporation
* Jesse Barnes <jbarnes@virtuousgeek.org>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sub license, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice (including the
* next paragraph) shall be included in all copies or substantial portions
* of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
* IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
* ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <drm/drmP.h>
#include <drm/i915_drm.h>
#include "intel_drv.h"
#include "i915_reg.h"
static void i915_save_display(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
/* Display arbitration control */
if (INTEL_INFO(dev)->gen <= 4)
dev_priv->regfile.saveDSPARB = I915_READ(DSPARB);
/* LVDS state */
if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
dev_priv->regfile.saveLVDS = I915_READ(PCH_LVDS);
else if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
dev_priv->regfile.saveLVDS = I915_READ(LVDS);
/* Panel power sequencer */
if (HAS_PCH_SPLIT(dev)) {
dev_priv->regfile.savePP_CONTROL = I915_READ(PCH_PP_CONTROL);
dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PCH_PP_ON_DELAYS);
dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PCH_PP_OFF_DELAYS);
dev_priv->regfile.savePP_DIVISOR = I915_READ(PCH_PP_DIVISOR);
} else if (INTEL_INFO(dev)->gen <= 4) {
dev_priv->regfile.savePP_CONTROL = I915_READ(PP_CONTROL);
dev_priv->regfile.savePP_ON_DELAYS = I915_READ(PP_ON_DELAYS);
dev_priv->regfile.savePP_OFF_DELAYS = I915_READ(PP_OFF_DELAYS);
dev_priv->regfile.savePP_DIVISOR = I915_READ(PP_DIVISOR);
}
/* save FBC interval */
if (HAS_FBC(dev) && INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev))
dev_priv->regfile.saveFBC_CONTROL = I915_READ(FBC_CONTROL);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
yakui zhao | yakui zhao | 46 | 18.62% | 3 | 13.64% |
zhenyu wang | zhenyu wang | 44 | 17.81% | 1 | 4.55% |
jani nikula | jani nikula | 32 | 12.96% | 2 | 9.09% |
jesse barnes | jesse barnes | 28 | 11.34% | 3 | 13.64% |
chris wilson | chris wilson | 26 | 10.53% | 2 | 9.09% |
daniel vetter | daniel vetter | 23 | 9.31% | 3 | 13.64% |
paulo zanoni | paulo zanoni | 21 | 8.50% | 2 | 9.09% |
ville syrjala | ville syrjala | 9 | 3.64% | 1 | 4.55% |
keith packard | keith packard | 8 | 3.24% | 2 | 9.09% |
matt roper | matt roper | 5 | 2.02% | 1 | 4.55% |
wayne boyer | wayne boyer | 3 | 1.21% | 1 | 4.55% |
ben gamari | ben gamari | 2 | 0.81% | 1 | 4.55% |
| Total | 247 | 100.00% | 22 | 100.00% |
static void i915_restore_display(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
u32 mask = 0xffffffff;
/* Display arbitration */
if (INTEL_INFO(dev)->gen <= 4)
I915_WRITE(DSPARB, dev_priv->regfile.saveDSPARB);
mask = ~LVDS_PORT_EN;
/* LVDS state */
if (HAS_PCH_IBX(dev) || HAS_PCH_CPT(dev))
I915_WRITE(PCH_LVDS, dev_priv->regfile.saveLVDS & mask);
else if (INTEL_INFO(dev)->gen <= 4 && IS_MOBILE(dev) && !IS_I830(dev))
I915_WRITE(LVDS, dev_priv->regfile.saveLVDS & mask);
/* Panel power sequencer */
if (HAS_PCH_SPLIT(dev)) {
I915_WRITE(PCH_PP_ON_DELAYS, dev_priv->regfile.savePP_ON_DELAYS);
I915_WRITE(PCH_PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS);
I915_WRITE(PCH_PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR);
I915_WRITE(PCH_PP_CONTROL, dev_priv->regfile.savePP_CONTROL);
} else if (INTEL_INFO(dev)->gen <= 4) {
I915_WRITE(PP_ON_DELAYS, dev_priv->regfile.savePP_ON_DELAYS);
I915_WRITE(PP_OFF_DELAYS, dev_priv->regfile.savePP_OFF_DELAYS);
I915_WRITE(PP_DIVISOR, dev_priv->regfile.savePP_DIVISOR);
I915_WRITE(PP_CONTROL, dev_priv->regfile.savePP_CONTROL);
}
/* only restore FBC info on the platform that supports FBC*/
intel_fbc_global_disable(dev_priv);
/* restore FBC interval */
if (HAS_FBC(dev) && INTEL_INFO(dev)->gen <= 4 && !IS_G4X(dev))
I915_WRITE(FBC_CONTROL, dev_priv->regfile.saveFBC_CONTROL);
i915_redisable_vga(dev);
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
ben gamari | ben gamari | 85 | 31.25% | 1 | 4.35% |
zhenyu wang | zhenyu wang | 59 | 21.69% | 1 | 4.35% |
jesse barnes | jesse barnes | 28 | 10.29% | 4 | 17.39% |
paulo zanoni | paulo zanoni | 28 | 10.29% | 4 | 17.39% |
daniel vetter | daniel vetter | 26 | 9.56% | 3 | 13.04% |
yakui zhao | yakui zhao | 22 | 8.09% | 3 | 13.04% |
ville syrjala | ville syrjala | 9 | 3.31% | 1 | 4.35% |
matt roper | matt roper | 5 | 1.84% | 1 | 4.35% |
chris wilson | chris wilson | 4 | 1.47% | 2 | 8.70% |
wayne boyer | wayne boyer | 3 | 1.10% | 1 | 4.35% |
jani nikula | jani nikula | 2 | 0.74% | 1 | 4.35% |
keith packard | keith packard | 1 | 0.37% | 1 | 4.35% |
| Total | 272 | 100.00% | 23 | 100.00% |
int i915_save_state(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
int i;
mutex_lock(&dev->struct_mutex);
i915_save_display(dev);
if (IS_GEN4(dev))
pci_read_config_word(dev->pdev, GCDGMBUS,
&dev_priv->regfile.saveGCDGMBUS);
/* Cache mode state */
if (INTEL_INFO(dev)->gen < 7)
dev_priv->regfile.saveCACHE_MODE_0 = I915_READ(CACHE_MODE_0);
/* Memory Arbitration state */
dev_priv->regfile.saveMI_ARB_STATE = I915_READ(MI_ARB_STATE);
/* Scratch space */
if (IS_GEN2(dev_priv) && IS_MOBILE(dev_priv)) {
for (i = 0; i < 7; i++) {
dev_priv->regfile.saveSWF0[i] = I915_READ(SWF0(i));
dev_priv->regfile.saveSWF1[i] = I915_READ(SWF1(i));
}
for (i = 0; i < 3; i++)
dev_priv->regfile.saveSWF3[i] = I915_READ(SWF3(i));
} else if (IS_GEN2(dev_priv)) {
for (i = 0; i < 7; i++)
dev_priv->regfile.saveSWF1[i] = I915_READ(SWF1(i));
} else if (HAS_GMCH_DISPLAY(dev_priv)) {
for (i = 0; i < 16; i++) {
dev_priv->regfile.saveSWF0[i] = I915_READ(SWF0(i));
dev_priv->regfile.saveSWF1[i] = I915_READ(SWF1(i));
}
for (i = 0; i < 3; i++)
dev_priv->regfile.saveSWF3[i] = I915_READ(SWF3(i));
}
mutex_unlock(&dev->struct_mutex);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
ville syrjala | ville syrjala | 153 | 46.79% | 1 | 11.11% |
ben gamari | ben gamari | 92 | 28.13% | 1 | 11.11% |
jesse barnes | jesse barnes | 35 | 10.70% | 3 | 33.33% |
yakui zhao | yakui zhao | 19 | 5.81% | 1 | 11.11% |
keith packard | keith packard | 16 | 4.89% | 1 | 11.11% |
daniel vetter | daniel vetter | 12 | 3.67% | 2 | 22.22% |
| Total | 327 | 100.00% | 9 | 100.00% |
int i915_restore_state(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
int i;
mutex_lock(&dev->struct_mutex);
i915_gem_restore_fences(dev);
if (IS_GEN4(dev))
pci_write_config_word(dev->pdev, GCDGMBUS,
dev_priv->regfile.saveGCDGMBUS);
i915_restore_display(dev);
/* Cache mode state */
if (INTEL_INFO(dev)->gen < 7)
I915_WRITE(CACHE_MODE_0, dev_priv->regfile.saveCACHE_MODE_0 |
0xffff0000);
/* Memory arbitration state */
I915_WRITE(MI_ARB_STATE, dev_priv->regfile.saveMI_ARB_STATE | 0xffff0000);
/* Scratch space */
if (IS_GEN2(dev_priv) && IS_MOBILE(dev_priv)) {
for (i = 0; i < 7; i++) {
I915_WRITE(SWF0(i), dev_priv->regfile.saveSWF0[i]);
I915_WRITE(SWF1(i), dev_priv->regfile.saveSWF1[i]);
}
for (i = 0; i < 3; i++)
I915_WRITE(SWF3(i), dev_priv->regfile.saveSWF3[i]);
} else if (IS_GEN2(dev_priv)) {
for (i = 0; i < 7; i++)
I915_WRITE(SWF1(i), dev_priv->regfile.saveSWF1[i]);
} else if (HAS_GMCH_DISPLAY(dev_priv)) {
for (i = 0; i < 16; i++) {
I915_WRITE(SWF0(i), dev_priv->regfile.saveSWF0[i]);
I915_WRITE(SWF1(i), dev_priv->regfile.saveSWF1[i]);
}
for (i = 0; i < 3; i++)
I915_WRITE(SWF3(i), dev_priv->regfile.saveSWF3[i]);
}
mutex_unlock(&dev->struct_mutex);
intel_i2c_reset(dev);
return 0;
}
Contributors
| Person | Tokens | Prop | Commits | CommitProp |
ville syrjala | ville syrjala | 154 | 45.29% | 1 | 10.00% |
jesse barnes | jesse barnes | 129 | 37.94% | 3 | 30.00% |
ben gamari | ben gamari | 21 | 6.18% | 1 | 10.00% |
keith packard | keith packard | 16 | 4.71% | 1 | 10.00% |
daniel vetter | daniel vetter | 10 | 2.94% | 1 | 10.00% |
chris wilson | chris wilson | 6 | 1.76% | 2 | 20.00% |
eric anholt | eric anholt | 4 | 1.18% | 1 | 10.00% |
| Total | 340 | 100.00% | 10 | 100.00% |
Overall Contributors
| Person | Tokens | Prop | Commits | CommitProp |
ville syrjala | ville syrjala | 325 | 27.11% | 2 | 5.56% |
jesse barnes | jesse barnes | 227 | 18.93% | 6 | 16.67% |
ben gamari | ben gamari | 200 | 16.68% | 1 | 2.78% |
zhenyu wang | zhenyu wang | 103 | 8.59% | 1 | 2.78% |
yakui zhao | yakui zhao | 87 | 7.26% | 3 | 8.33% |
daniel vetter | daniel vetter | 71 | 5.92% | 5 | 13.89% |
paulo zanoni | paulo zanoni | 49 | 4.09% | 4 | 11.11% |
keith packard | keith packard | 41 | 3.42% | 2 | 5.56% |
chris wilson | chris wilson | 36 | 3.00% | 5 | 13.89% |
jani nikula | jani nikula | 34 | 2.84% | 2 | 5.56% |
matt roper | matt roper | 10 | 0.83% | 1 | 2.78% |
wayne boyer | wayne boyer | 6 | 0.50% | 1 | 2.78% |
eric anholt | eric anholt | 5 | 0.42% | 1 | 2.78% |
eugeni dodonov | eugeni dodonov | 3 | 0.25% | 1 | 2.78% |
david howells | david howells | 2 | 0.17% | 1 | 2.78% |
| Total | 1199 | 100.00% | 36 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.