2008-08-26 02:11:06 +04:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2020-11-30 14:15:57 +03:00
|
|
|
#include "display/intel_de.h"
|
2019-06-13 11:44:16 +03:00
|
|
|
#include "display/intel_fbc.h"
|
2019-06-13 11:44:15 +03:00
|
|
|
#include "display/intel_gmbus.h"
|
2019-10-01 18:25:06 +03:00
|
|
|
#include "display/intel_vga.h"
|
2019-06-13 11:44:15 +03:00
|
|
|
|
2019-08-06 13:07:30 +03:00
|
|
|
#include "i915_drv.h"
|
2012-01-08 05:40:34 +04:00
|
|
|
#include "i915_reg.h"
|
2019-08-08 16:42:46 +03:00
|
|
|
#include "i915_suspend.h"
|
2008-08-26 02:11:06 +04:00
|
|
|
|
2020-10-05 20:14:41 +03:00
|
|
|
static void intel_save_swf(struct drm_i915_private *dev_priv)
|
2009-09-15 01:48:42 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Scratch space */
|
2021-06-06 07:50:49 +03:00
|
|
|
if (GRAPHICS_VER(dev_priv) == 2 && IS_MOBILE(dev_priv)) {
|
2015-09-18 20:03:43 +03:00
|
|
|
for (i = 0; i < 7; i++) {
|
2020-11-30 14:15:57 +03:00
|
|
|
dev_priv->regfile.saveSWF0[i] = intel_de_read(dev_priv, SWF0(i));
|
|
|
|
dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv, SWF1(i));
|
2015-09-18 20:03:43 +03:00
|
|
|
}
|
|
|
|
for (i = 0; i < 3; i++)
|
2020-11-30 14:15:57 +03:00
|
|
|
dev_priv->regfile.saveSWF3[i] = intel_de_read(dev_priv, SWF3(i));
|
2021-06-06 07:50:49 +03:00
|
|
|
} else if (GRAPHICS_VER(dev_priv) == 2) {
|
2015-09-18 20:03:43 +03:00
|
|
|
for (i = 0; i < 7; i++)
|
2020-11-30 14:15:57 +03:00
|
|
|
dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv, SWF1(i));
|
2019-02-05 01:25:38 +03:00
|
|
|
} else if (HAS_GMCH(dev_priv)) {
|
2015-09-18 20:03:43 +03:00
|
|
|
for (i = 0; i < 16; i++) {
|
2020-11-30 14:15:57 +03:00
|
|
|
dev_priv->regfile.saveSWF0[i] = intel_de_read(dev_priv, SWF0(i));
|
|
|
|
dev_priv->regfile.saveSWF1[i] = intel_de_read(dev_priv, SWF1(i));
|
2015-09-18 20:03:43 +03:00
|
|
|
}
|
|
|
|
for (i = 0; i < 3; i++)
|
2020-11-30 14:15:57 +03:00
|
|
|
dev_priv->regfile.saveSWF3[i] = intel_de_read(dev_priv, SWF3(i));
|
2009-09-15 01:48:42 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-05 20:14:41 +03:00
|
|
|
static void intel_restore_swf(struct drm_i915_private *dev_priv)
|
2009-09-15 01:48:42 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2015-09-18 20:03:43 +03:00
|
|
|
/* Scratch space */
|
2021-06-06 07:50:49 +03:00
|
|
|
if (GRAPHICS_VER(dev_priv) == 2 && IS_MOBILE(dev_priv)) {
|
2015-09-18 20:03:43 +03:00
|
|
|
for (i = 0; i < 7; i++) {
|
2020-11-30 14:15:57 +03:00
|
|
|
intel_de_write(dev_priv, SWF0(i), dev_priv->regfile.saveSWF0[i]);
|
|
|
|
intel_de_write(dev_priv, SWF1(i), dev_priv->regfile.saveSWF1[i]);
|
2015-09-18 20:03:43 +03:00
|
|
|
}
|
|
|
|
for (i = 0; i < 3; i++)
|
2020-11-30 14:15:57 +03:00
|
|
|
intel_de_write(dev_priv, SWF3(i), dev_priv->regfile.saveSWF3[i]);
|
2021-06-06 07:50:49 +03:00
|
|
|
} else if (GRAPHICS_VER(dev_priv) == 2) {
|
2015-09-18 20:03:43 +03:00
|
|
|
for (i = 0; i < 7; i++)
|
2020-11-30 14:15:57 +03:00
|
|
|
intel_de_write(dev_priv, SWF1(i), dev_priv->regfile.saveSWF1[i]);
|
2019-02-05 01:25:38 +03:00
|
|
|
} else if (HAS_GMCH(dev_priv)) {
|
2015-09-18 20:03:43 +03:00
|
|
|
for (i = 0; i < 16; i++) {
|
2020-11-30 14:15:57 +03:00
|
|
|
intel_de_write(dev_priv, SWF0(i), dev_priv->regfile.saveSWF0[i]);
|
|
|
|
intel_de_write(dev_priv, SWF1(i), dev_priv->regfile.saveSWF1[i]);
|
2015-09-18 20:03:43 +03:00
|
|
|
}
|
|
|
|
for (i = 0; i < 3; i++)
|
2020-11-30 14:15:57 +03:00
|
|
|
intel_de_write(dev_priv, SWF3(i), dev_priv->regfile.saveSWF3[i]);
|
2008-08-26 02:11:06 +04:00
|
|
|
}
|
2020-10-05 20:14:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void i915_save_display(struct drm_i915_private *dev_priv)
|
|
|
|
{
|
2021-01-28 16:31:23 +03:00
|
|
|
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
|
2020-10-05 20:14:41 +03:00
|
|
|
|
drm/i915: skip display initialization when there is no display
Display features should not be initialized or de-initialized when there
is no display. Skip modeset initialization, output setup, plane, crtc,
encoder, connector registration, display cdclk and rawclk
initialization, display core initialization, etc.
Skip the functionality at as high level as possible, and remove any
redundant checks. If the functionality is conditional to *other* display
checks, do not add more. If the un-initialization has checks for
initialization, do not add more.
We explicitly do not care about any GMCH/VLV/CHV code paths, as they've
always had and will have display.
Reviewed-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210408203150.237947-3-jose.souza@intel.com
2021-04-08 23:31:50 +03:00
|
|
|
if (!HAS_DISPLAY(dev_priv))
|
|
|
|
return;
|
|
|
|
|
2020-10-05 20:14:41 +03:00
|
|
|
/* Display arbitration control */
|
2021-06-06 07:50:49 +03:00
|
|
|
if (GRAPHICS_VER(dev_priv) <= 4)
|
2020-11-30 14:15:57 +03:00
|
|
|
dev_priv->regfile.saveDSPARB = intel_de_read(dev_priv, DSPARB);
|
2008-08-26 02:11:06 +04:00
|
|
|
|
2021-06-06 07:50:49 +03:00
|
|
|
if (GRAPHICS_VER(dev_priv) == 4)
|
2020-10-05 20:14:41 +03:00
|
|
|
pci_read_config_word(pdev, GCDGMBUS,
|
|
|
|
&dev_priv->regfile.saveGCDGMBUS);
|
|
|
|
|
|
|
|
intel_save_swf(dev_priv);
|
|
|
|
}
|
|
|
|
|
|
|
|
void i915_restore_display(struct drm_i915_private *dev_priv)
|
|
|
|
{
|
2021-01-28 16:31:23 +03:00
|
|
|
struct pci_dev *pdev = to_pci_dev(dev_priv->drm.dev);
|
2020-10-05 20:14:41 +03:00
|
|
|
|
drm/i915: skip display initialization when there is no display
Display features should not be initialized or de-initialized when there
is no display. Skip modeset initialization, output setup, plane, crtc,
encoder, connector registration, display cdclk and rawclk
initialization, display core initialization, etc.
Skip the functionality at as high level as possible, and remove any
redundant checks. If the functionality is conditional to *other* display
checks, do not add more. If the un-initialization has checks for
initialization, do not add more.
We explicitly do not care about any GMCH/VLV/CHV code paths, as they've
always had and will have display.
Reviewed-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210408203150.237947-3-jose.souza@intel.com
2021-04-08 23:31:50 +03:00
|
|
|
if (!HAS_DISPLAY(dev_priv))
|
|
|
|
return;
|
|
|
|
|
2020-10-05 20:14:41 +03:00
|
|
|
intel_restore_swf(dev_priv);
|
|
|
|
|
2021-06-06 07:50:49 +03:00
|
|
|
if (GRAPHICS_VER(dev_priv) == 4)
|
2020-10-05 20:14:41 +03:00
|
|
|
pci_write_config_word(pdev, GCDGMBUS,
|
|
|
|
dev_priv->regfile.saveGCDGMBUS);
|
|
|
|
|
|
|
|
/* Display arbitration */
|
2021-06-06 07:50:49 +03:00
|
|
|
if (GRAPHICS_VER(dev_priv) <= 4)
|
2020-11-30 14:15:57 +03:00
|
|
|
intel_de_write(dev_priv, DSPARB, dev_priv->regfile.saveDSPARB);
|
2020-10-05 20:14:41 +03:00
|
|
|
|
|
|
|
/* only restore FBC info on the platform that supports FBC*/
|
|
|
|
intel_fbc_global_disable(dev_priv);
|
|
|
|
|
|
|
|
intel_vga_redisable(dev_priv);
|
|
|
|
|
|
|
|
intel_gmbus_reset(dev_priv);
|
2008-08-26 02:11:06 +04:00
|
|
|
}
|