Re: [PATCH 16/16] drm/i915: Preserve VGACNTR bits from the BIOS

Thomas Richter
2014-08-15T13:39:27Z

On 15.08.2014 00:22, ville.syrjala@linux.intel.com wrote:
> From: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
> My Fujistsu-Siemens Lifebook S6010 doesn't like to resume from
> S3 unless VGACNTR has been restore to the original value. The BIOS
> value in this case was 0x0124008E. Setting the "VGA disable" bit
> doesn't interfere with the S3 resume fortunately.
>
> Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

Works on the S6010 as advertized, though cannot test on the R31 since it
does not resume from S3 - it does not even reach the real-mode entry
hook of the kernel.

Tested-by: Thomas Richter <richter@rus.uni-stuttgart.de>

> ---
> drivers/gpu/drm/i915/i915_drv.h | 2 ++
> drivers/gpu/drm/i915/intel_display.c | 8 +++++++-
> 2 files changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
> index b1ed71e..e0f64e4 100644
> --- a/drivers/gpu/drm/i915/i915_drv.h
> +++ b/drivers/gpu/drm/i915/i915_drv.h
> @@ -1638,6 +1638,8 @@ struct drm_i915_private {
> */
> struct workqueue_struct *dp_wq;
>
> + uint32_t bios_vgacntr;
> +
> /* Old dri1 support infrastructure, beware the dragons ya fools entering
> * here! */
> struct i915_dri1_state dri1;
> diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
> index 92baf6f..f154993 100644
> --- a/drivers/gpu/drm/i915/intel_display.c
> +++ b/drivers/gpu/drm/i915/intel_display.c
> @@ -12591,7 +12591,11 @@ static void i915_disable_vga(struct drm_device *dev)
> vga_put(dev->pdev, VGA_RSRC_LEGACY_IO);
> udelay(300);
>
> - I915_WRITE(vga_reg, VGA_DISP_DISABLE);
> + /*
> + * Fujitsu-Siemens Lifebook S6010 (830) has problems resuming
> + * from S3 without preserving (some of?) the other bits.
> + */
> + I915_WRITE(vga_reg, dev_priv->bios_vgacntr | VGA_DISP_DISABLE);
> POSTING_READ(vga_reg);
> }
>
> @@ -12680,6 +12684,8 @@ void intel_modeset_init(struct drm_device *dev)
>
> intel_shared_dpll_init(dev);
>
> + /* save the BIOS value before clobbering it */
> + dev_priv->bios_vgacntr = I915_READ(i915_vgacntrl_reg(dev));
> /* Just disable it once at startup */
> i915_disable_vga(dev);
> intel_setup_outputs(dev);