drm/i915: Initialize panel timing registers if VBIOS did not

The time between start of the pixel clock and backlight enable is a basic
panel timing constraint.  If the Panel Power On/Off registers are found
to be 0, assume we are booting without VBIOS initialization and set these
registers to something reasonable.

Change-Id: Ibed6cc10d46bf52fd92e0beb25ae3525b5eef99d
Signed-off-by: Bryan Freed <bfreed@chromium.org>
[ickle: rearranged into a separate function to distinguish its role from
simply parsing the VBIOS tables.]
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Bryan Freed 2010-10-14 09:14:51 +01:00 committed by Chris Wilson
parent e60a0b107b
commit 6d139a87b7
3 changed files with 25 additions and 4 deletions

View File

@ -1235,7 +1235,7 @@ static int i915_load_modeset_init(struct drm_device *dev,
*/ */
dev_priv->allow_batchbuffer = 1; dev_priv->allow_batchbuffer = 1;
ret = intel_init_bios(dev); ret = intel_parse_bios(dev);
if (ret) if (ret)
DRM_INFO("failed to find VBIOS tables\n"); DRM_INFO("failed to find VBIOS tables\n");
@ -2001,6 +2001,9 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags)
intel_setup_gmbus(dev); intel_setup_gmbus(dev);
intel_opregion_setup(dev); intel_opregion_setup(dev);
/* Make sure the bios did its job and set up vital registers */
intel_setup_bios(dev);
i915_gem_load(dev); i915_gem_load(dev);
/* Init HWS */ /* Init HWS */

View File

@ -577,7 +577,7 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
} }
/** /**
* intel_init_bios - initialize VBIOS settings & find VBT * intel_parse_bios - find VBT and initialize settings from the BIOS
* @dev: DRM device * @dev: DRM device
* *
* Loads the Video BIOS and checks that the VBT exists. Sets scratch registers * Loads the Video BIOS and checks that the VBT exists. Sets scratch registers
@ -586,7 +586,7 @@ init_vbt_defaults(struct drm_i915_private *dev_priv)
* Returns 0 on success, nonzero on failure. * Returns 0 on success, nonzero on failure.
*/ */
bool bool
intel_init_bios(struct drm_device *dev) intel_parse_bios(struct drm_device *dev)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
struct pci_dev *pdev = dev->pdev; struct pci_dev *pdev = dev->pdev;
@ -647,3 +647,20 @@ intel_init_bios(struct drm_device *dev)
return 0; return 0;
} }
/* Ensure that vital registers have been initialised, even if the BIOS
* is absent or just failing to do its job.
*/
void intel_setup_bios(struct drm_device *dev)
{
struct drm_i915_private *dev_priv = dev->dev_private;
/* Set the Panel Power On/Off timings if uninitialized. */
if ((I915_READ(PP_ON_DELAYS) == 0) && (I915_READ(PP_OFF_DELAYS) == 0)) {
/* Set T2 to 40ms and T5 to 200ms */
I915_WRITE(PP_ON_DELAYS, 0x019007d0);
/* Set T3 to 35ms and Tx to 200ms */
I915_WRITE(PP_OFF_DELAYS, 0x015e07d0);
}
}

View File

@ -467,7 +467,8 @@ struct bdb_edp {
struct edp_link_params link_params[16]; struct edp_link_params link_params[16];
} __attribute__ ((packed)); } __attribute__ ((packed));
bool intel_init_bios(struct drm_device *dev); void intel_setup_bios(struct drm_device *dev);
bool intel_parse_bios(struct drm_device *dev);
/* /*
* Driver<->VBIOS interaction occurs through scratch bits in * Driver<->VBIOS interaction occurs through scratch bits in