summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2009-02-12 18:18:14 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2009-02-12 18:18:14 +0000
commita397fbca1b8c53c9762ffa49bdf5372d93c0d60a (patch)
tree3939e77719e27275b0271ad47ba79e5089b74b88
parentccfff6ce01b5935c08cb32867b99dc8103a7b18d (diff)
downloadopenembedded-core-a397fbca1b8c53c9762ffa49bdf5372d93c0d60a.tar.gz
openembedded-core-a397fbca1b8c53c9762ffa49bdf5372d93c0d60a.tar.bz2
openembedded-core-a397fbca1b8c53c9762ffa49bdf5372d93c0d60a.zip
linux-moblin: Update patches
-rw-r--r--meta-moblin/packages/linux/linux-moblin-2.6.28+2.6.29-rc2/psb-driver.patch2711
1 files changed, 714 insertions, 1997 deletions
diff --git a/meta-moblin/packages/linux/linux-moblin-2.6.28+2.6.29-rc2/psb-driver.patch b/meta-moblin/packages/linux/linux-moblin-2.6.28+2.6.29-rc2/psb-driver.patch
index c515bc60ce..ca449c6cf5 100644
--- a/meta-moblin/packages/linux/linux-moblin-2.6.28+2.6.29-rc2/psb-driver.patch
+++ b/meta-moblin/packages/linux/linux-moblin-2.6.28+2.6.29-rc2/psb-driver.patch
@@ -337,7 +337,7 @@ Index: linux-2.6.28/include/drm/drm.h
Index: linux-2.6.28/include/drm/drmP.h
===================================================================
--- linux-2.6.28.orig/include/drm/drmP.h 2009-02-12 09:14:40.000000000 +0000
-+++ linux-2.6.28/include/drm/drmP.h 2009-02-12 09:14:41.000000000 +0000
++++ linux-2.6.28/include/drm/drmP.h 2009-02-12 15:59:51.000000000 +0000
@@ -57,6 +57,7 @@
#include <linux/dma-mapping.h>
#include <linux/mm.h>
@@ -638,16 +638,6 @@ Index: linux-2.6.28/include/drm/drmP.h
/* AGP/GART support (drm_agpsupport.h) */
extern struct drm_agp_head *drm_agp_init(struct drm_device *dev);
-@@ -1303,9 +1340,6 @@
- extern int drm_sysfs_device_add(struct drm_minor *minor);
- extern void drm_sysfs_hotplug_event(struct drm_device *dev);
- extern void drm_sysfs_device_remove(struct drm_minor *minor);
--extern char *drm_get_connector_status_name(enum drm_connector_status status);
--extern int drm_sysfs_connector_add(struct drm_connector *connector);
--extern void drm_sysfs_connector_remove(struct drm_connector *connector);
-
- /*
- * Basic memory manager support (drm_mm.c)
Index: linux-2.6.28/include/drm/drm_pciids.h
===================================================================
--- linux-2.6.28.orig/include/drm/drm_pciids.h 2009-02-12 09:14:31.000000000 +0000
@@ -665,8 +655,8 @@ Index: linux-2.6.28/include/drm/drm_pciids.h
Index: linux-2.6.28/drivers/gpu/drm/Makefile
===================================================================
--- linux-2.6.28.orig/drivers/gpu/drm/Makefile 2009-02-12 09:14:37.000000000 +0000
-+++ linux-2.6.28/drivers/gpu/drm/Makefile 2009-02-12 09:14:41.000000000 +0000
-@@ -10,8 +10,11 @@
++++ linux-2.6.28/drivers/gpu/drm/Makefile 2009-02-12 16:00:51.000000000 +0000
+@@ -10,6 +10,8 @@
drm_lock.o drm_memory.o drm_proc.o drm_stub.o drm_vm.o \
drm_agpsupport.o drm_scatter.o ati_pcigart.o drm_pci.o \
drm_sysfs.o drm_hashtab.o drm_sman.o drm_mm.o \
@@ -674,11 +664,8 @@ Index: linux-2.6.28/drivers/gpu/drm/Makefile
+ drm_bo_lock.o drm_bo_move.o drm_regman.o \
drm_crtc.o drm_crtc_helper.o drm_modes.o drm_edid.o
-+
drm-$(CONFIG_COMPAT) += drm_ioc32.o
-
- obj-$(CONFIG_DRM) += drm.o
-@@ -22,6 +25,7 @@
+@@ -22,6 +24,7 @@
obj-$(CONFIG_DRM_I810) += i810/
obj-$(CONFIG_DRM_I830) += i830/
obj-$(CONFIG_DRM_I915) += i915/
@@ -7239,1908 +7226,6 @@ Index: linux-2.6.28/drivers/gpu/drm/psb/Makefile
+ psb_schedule.o psb_xhw.o
+
+obj-$(CONFIG_DRM_PSB) += psb.o
-Index: linux-2.6.28/drivers/gpu/drm/psb/i915_reg.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.28/drivers/gpu/drm/psb/i915_reg.h 2009-02-12 09:14:41.000000000 +0000
-@@ -0,0 +1,67 @@
-+#include "../i915/i915_reg.h"
-+
-+
-+/*#define IS_I830(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82830_CGC)
-+#define IS_845G(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82845G_IG)
-+#define IS_I85X(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82855GM_IG)
-+#define IS_I855(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82855GM_IG)
-+#define IS_I865G(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82865_IG)
-+
-+#define IS_I915G(dev) (dev->pci_device == PCI_DEVICE_ID_INTEL_82915G_IG)
-+#define IS_I915GM(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82915GM_IG)
-+#define IS_I945G(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82945G_IG)
-+#define IS_I945GM(dev) ((dev)->pci_device == PCI_DEVICE_ID_INTEL_82945GM_IG)
-+
-+#define IS_I965G(dev) ((dev)->pci_device == 0x2972 || \
-+ (dev)->pci_device == 0x2982 || \
-+ (dev)->pci_device == 0x2992 || \
-+ (dev)->pci_device == 0x29A2 || \
-+ (dev)->pci_device == 0x2A02 || \
-+ (dev)->pci_device == 0x2A12)
-+
-+#define IS_I965GM(dev) ((dev)->pci_device == 0x2A02)
-+
-+#define IS_G33(dev) ((dev)->pci_device == 0x29C2 || \
-+ (dev)->pci_device == 0x29B2 || \
-+ (dev)->pci_device == 0x29D2)
-+
-+#define IS_I9XX(dev) (IS_I915G(dev) || IS_I915GM(dev) || IS_I945G(dev) || \
-+ IS_I945GM(dev) || IS_I965G(dev) || IS_POULSBO(dev))
-+
-+#define IS_MOBILE(dev) (IS_I830(dev) || IS_I85X(dev) || IS_I915GM(dev) || \
-+ IS_I945GM(dev) || IS_I965GM(dev) || IS_POULSBO(dev))
-+
-+#define IS_POULSBO(dev) (((dev)->pci_device == 0x8108) || \
-+ ((dev)->pci_device == 0x8109))*/
-+
-+#define FPA0 0x06040
-+#define FPA1 0x06044
-+#define FPB0 0x06048
-+#define FPB1 0x0604c
-+#define FP_N_DIV_MASK 0x003f0000
-+#define FP_N_DIV_SHIFT 16
-+#define FP_M1_DIV_MASK 0x00003f00
-+#define FP_M1_DIV_SHIFT 8
-+#define FP_M2_DIV_MASK 0x0000003f
-+#define FP_M2_DIV_SHIFT 0
-+
-+#define DPLL_B_MD 0x06020
-+
-+#define ADPA 0x61100
-+#define ADPA_DAC_ENABLE (1<<31)
-+#define ADPA_DAC_DISABLE 0
-+#define ADPA_PIPE_SELECT_MASK (1<<30)
-+#define ADPA_PIPE_A_SELECT 0
-+#define ADPA_PIPE_B_SELECT (1<<30)
-+#define ADPA_USE_VGA_HVPOLARITY (1<<15)
-+#define ADPA_SETS_HVPOLARITY 0
-+#define ADPA_VSYNC_CNTL_DISABLE (1<<11)
-+#define ADPA_VSYNC_CNTL_ENABLE 0
-+#define ADPA_HSYNC_CNTL_DISABLE (1<<10)
-+#define ADPA_HSYNC_CNTL_ENABLE 0
-+#define ADPA_VSYNC_ACTIVE_HIGH (1<<4)
-+#define ADPA_VSYNC_ACTIVE_LOW 0
-+#define ADPA_HSYNC_ACTIVE_HIGH (1<<3)
-+#define ADPA_HSYNC_ACTIVE_LOW 0
-+
-+
-Index: linux-2.6.28/drivers/gpu/drm/psb/intel_display.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ linux-2.6.28/drivers/gpu/drm/psb/intel_display.c 2009-02-12 09:14:41.000000000 +0000
-@@ -0,0 +1,1813 @@
-+/*
-+ * Copyright © 2006-2007 Intel Corporation
-+ *
-+ * 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, sublicense,
-+ * 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 NONINFRINGEMENT. IN NO EVENT SHALL
-+ * THE AUTHORS OR COPYRIGHT HOLDERS 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.
-+ *
-+ * Authors:
-+ * Eric Anholt <eric@anholt.net>
-+ */
-+
-+#include <linux/i2c.h>
-+#include "drmP.h"
-+#include "../i915/intel_drv.h"
-+#include "i915_drm.h"
-+#include "../i915/i915_drv.h"
-+
-+#include "drm_crtc_helper.h"
-+
-+bool intel_pipe_has_type (struct drm_crtc *crtc, int type);
-+
-+typedef struct {
-+ /* given values */
-+ int n;
-+ int m1, m2;
-+ int p1, p2;
-+ /* derived values */
-+ int dot;
-+ int vco;
-+ int m;
-+ int p;
-+} intel_clock_t;
-+
-+typedef struct {
-+ int min, max;
-+} intel_range_t;
-+
-+typedef struct {
-+ int dot_limit;
-+ int p2_slow, p2_fast;
-+} intel_p2_t;
-+
-+#define INTEL_P2_NUM 2
-+
-+typedef struct {
-+ intel_range_t dot, vco, n, m, m1, m2, p, p1;
-+ intel_p2_t p2;
-+} intel_limit_t;
-+
-+#define I8XX_DOT_MIN 25000
-+#define I8XX_DOT_MAX 350000
-+#define I8XX_VCO_MIN 930000
-+#define I8XX_VCO_MAX 1400000
-+#define I8XX_N_MIN 3
-+#define I8XX_N_MAX 16
-+#define I8XX_M_MIN 96
-+#define I8XX_M_MAX 140
-+#define I8XX_M1_MIN 18
-+#define I8XX_M1_MAX 26
-+#define I8XX_M2_MIN 6
-+#define I8XX_M2_MAX 16
-+#define I8XX_P_MIN 4
-+#define I8XX_P_MAX 128
-+#define I8XX_P1_MIN 2
-+#define I8XX_P1_MAX 33
-+#define I8XX_P1_LVDS_MIN 1
-+#define I8XX_P1_LVDS_MAX 6
-+#define I8XX_P2_SLOW 4
-+#define I8XX_P2_FAST 2
-+#define I8XX_P2_LVDS_SLOW 14
-+#define I8XX_P2_LVDS_FAST 14 /* No fast option */
-+#define I8XX_P2_SLOW_LIMIT 165000
-+
-+#define I9XX_DOT_MIN 20000
-+#define I9XX_DOT_MAX 400000
-+#define I9XX_VCO_MIN 1400000
-+#define I9XX_VCO_MAX 2800000
-+#define I9XX_N_MIN 3
-+#define I9XX_N_MAX 8
-+#define I9XX_M_MIN 70
-+#define I9XX_M_MAX 120
-+#define I9XX_M1_MIN 10
-+#define I9XX_M1_MAX 20
-+#define I9XX_M2_MIN 5
-+#define I9XX_M2_MAX 9
-+#define I9XX_P_SDVO_DAC_MIN 5
-+#define I9XX_P_SDVO_DAC_MAX 80
-+#define I9XX_P_LVDS_MIN 7
-+#define I9XX_P_LVDS_MAX 98
-+#define I9XX_P1_MIN 1
-+#define I9XX_P1_MAX 8
-+#define I9XX_P2_SDVO_DAC_SLOW 10
-+#define I9XX_P2_SDVO_DAC_FAST 5
-+#define I9XX_P2_SDVO_DAC_SLOW_LIMIT 200000
-+#define I9XX_P2_LVDS_SLOW 14
-+#define I9XX_P2_LVDS_FAST 7
-+#define I9XX_P2_LVDS_SLOW_LIMIT 112000
-+
-+#define INTEL_LIMIT_I8XX_DVO_DAC 0
-+#define INTEL_LIMIT_I8XX_LVDS 1
-+#define INTEL_LIMIT_I9XX_SDVO_DAC 2
-+#define INTEL_LIMIT_I9XX_LVDS 3
-+
-+static const intel_limit_t intel_limits[] = {
-+ { /* INTEL_LIMIT_I8XX_DVO_DAC */
-+ .dot = { .min = I8XX_DOT_MIN, .max = I8XX_DOT_MAX },
-+ .vco = { .min = I8XX_VCO_MIN, .max = I8XX_VCO_MAX },
-+ .n = { .min = I8XX_N_MIN, .max = I8XX_N_MAX },
-+ .m = { .min = I8XX_M_MIN, .max = I8XX_M_MAX },
-+ .m1 = { .min = I8XX_M1_MIN, .max = I8XX_M1_MAX },
-+ .m2 = { .min = I8XX_M2_MIN, .max = I8XX_M2_MAX },
-+ .p = { .min = I8XX_P_MIN, .max = I8XX_P_MAX },
-+ .p1 = { .min = I8XX_P1_MIN, .max = I8XX_P1_MAX },
-+ .p2 = { .dot_limit = I8XX_P2_SLOW_LIMIT,
-+ .p2_slow = I8XX_P2_SLOW, .p2_fast = I8XX_P2_FAST },
-+ },
-+ { /* INTEL_LIMIT_I8XX_LVDS */
-+ .dot = { .min = I8XX_DOT_MIN, .max = I8XX_DOT_MAX },
-+ .vco = { .min = I8XX_VCO_MIN, .max = I8XX_VCO_MAX },
-+ .n = { .min = I8XX_N_MIN, .max = I8XX_N_MAX },
-+ .m = { .min = I8XX_M_MIN, .max = I8XX_M_MAX },
-+ .m1 = { .min = I8XX_M1_MIN, .max = I8XX_M1_MAX },
-+ .m2 = { .min = I8XX_M2_MIN, .max = I8XX_M2_MAX },
-+ .p = { .min = I8XX_P_MIN, .max = I8XX_P_MAX },
-+ .p1 = { .min = I8XX_P1_LVDS_MIN, .max = I8XX_P1_LVDS_MAX },
-+ .p2 = { .dot_limit = I8XX_P2_SLOW_LIMIT,
-+ .p2_slow = I8XX_P2_LVDS_SLOW, .p2_fast = I8XX_P2_LVDS_FAST },
-+ },
-+ { /* INTEL_LIMIT_I9XX_SDVO_DAC */
-+ .dot = { .min = I9XX_DOT_MIN, .max = I9XX_DOT_MAX },
-+ .vco = { .min = I9XX_VCO_MIN, .max = I9XX_VCO_MAX },
-+ .n = { .min = I9XX_N_MIN, .max = I9XX_N_MAX },
-+ .m = { .min = I9XX_M_MIN, .max = I9XX_M_MAX },
-+ .m1 = { .min = I9XX_M1_MIN, .max = I9XX_M1_MAX },
-+ .m2 = { .min = I9XX_M2_MIN, .max = I9XX_M2_MAX },
-+ .p = { .min = I9XX_P_SDVO_DAC_MIN, .max = I9XX_P_SDVO_DAC_MAX },
-+ .p1 = { .min = I9XX_P1_MIN, .max = I9XX_P1_MAX },
-+ .p2 = { .dot_limit = I9XX_P2_SDVO_DAC_SLOW_LIMIT,
-+ .p2_slow = I9XX_P2_SDVO_DAC_SLOW, .p2_fast = I9XX_P2_SDVO_DAC_FAST },
-+ },
-+ { /* INTEL_LIMIT_I9XX_LVDS */
-+ .dot = { .min = I9XX_DOT_MIN, .max = I9XX_DOT_MAX },
-+ .vco = { .min = I9XX_VCO_MIN, .max = I9XX_VCO_MAX },
-+ .n = { .min = I9XX_N_MIN, .max = I9XX_N_MAX },
-+ .m = { .min = I9XX_M_MIN, .max = I9XX_M_MAX },
-+ .m1 = { .min = I9XX_M1_MIN, .max = I9XX_M1_MAX },
-+ .m2 = { .min = I9XX_M2_MIN, .max = I9XX_M2_MAX },
-+ .p = { .min = I9XX_P_LVDS_MIN, .max = I9XX_P_LVDS_MAX },
-+ .p1 = { .min = I9XX_P1_MIN, .max = I9XX_P1_MAX },
-+ /* The single-channel range is 25-112Mhz, and dual-channel
-+ * is 80-224Mhz. Prefer single channel as much as possible.
-+ */
-+ .p2 = { .dot_limit = I9XX_P2_LVDS_SLOW_LIMIT,
-+ .p2_slow = I9XX_P2_LVDS_SLOW, .p2_fast = I9XX_P2_LVDS_FAST },
-+ },
-+};
-+
-+static const intel_limit_t *intel_limit(struct drm_crtc *crtc)
-+{
-+ struct drm_device *dev = crtc->dev;
-+ const intel_limit_t *limit;
-+
-+ if (IS_I9XX(dev)) {
-+ if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
-+ limit = &intel_limits[INTEL_LIMIT_I9XX_LVDS];
-+ else
-+ limit = &intel_limits[INTEL_LIMIT_I9XX_SDVO_DAC];
-+ } else {
-+ if (intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS))
-+ limit = &intel_limits[INTEL_LIMIT_I8XX_LVDS];
-+ else
-+ limit = &intel_limits[INTEL_LIMIT_I8XX_DVO_DAC];
-+ }
-+ return limit;
-+}
-+
-+/** Derive the pixel clock for the given refclk and divisors for 8xx chips. */
-+
-+static void i8xx_clock(int refclk, intel_clock_t *clock)
-+{
-+ clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2);
-+ clock->p = clock->p1 * clock->p2;
-+ clock->vco = refclk * clock->m / (clock->n + 2);
-+ clock->dot = clock->vco / clock->p;
-+}
-+
-+/** Derive the pixel clock for the given refclk and divisors for 9xx chips. */
-+
-+static void i9xx_clock(int refclk, intel_clock_t *clock)
-+{
-+ clock->m = 5 * (clock->m1 + 2) + (clock->m2 + 2);
-+ clock->p = clock->p1 * clock->p2;
-+ clock->vco = refclk * clock->m / (clock->n + 2);
-+ clock->dot = clock->vco / clock->p;
-+}
-+
-+static void intel_clock(struct drm_device *dev, int refclk,
-+ intel_clock_t *clock)
-+{
-+ if (IS_I9XX(dev))
-+ i9xx_clock (refclk, clock);
-+ else
-+ i8xx_clock (refclk, clock);
-+}
-+
-+/**
-+ * Returns whether any output on the specified pipe is of the specified type
-+ */
-+bool intel_pipe_has_type (struct drm_crtc *crtc, int type)
-+{
-+ struct drm_device *dev = crtc->dev;
-+ struct drm_mode_config *mode_config = &dev->mode_config;
-+ struct drm_connector *l_entry;
-+
-+ list_for_each_entry(l_entry, &mode_config->connector_list, head) {
-+ if (l_entry->encoder &&
-+ l_entry->encoder->crtc == crtc) {
-+ struct intel_output *intel_output = to_intel_output(l_entry);
-+ if (intel_output->type == type)
-+ return true;
-+ }
-+ }
-+ return false;
-+}
-+
-+#define INTELPllInvalid(s) { /* ErrorF (s) */; return false; }
-+/**
-+ * Returns whether the given set of divisors are valid for a given refclk with
-+ * the given connectors.
-+ */
-+
-+static bool intel_PLL_is_valid(struct drm_crtc *crtc, intel_clock_t *clock)
-+{
-+ const intel_limit_t *limit = intel_limit (crtc);
-+
-+ if (clock->p1 < limit->p1.min || limit->p1.max < clock->p1)
-+ INTELPllInvalid ("p1 out of range\n");
-+ if (clock->p < limit->p.min || limit->p.max < clock->p)
-+ INTELPllInvalid ("p out of range\n");
-+ if (clock->m2 < limit->m2.min || limit->m2.max < clock->m2)
-+ INTELPllInvalid ("m2 out of range\n");
-+ if (clock->m1 < limit->m1.min || limit->m1.max < clock->m1)
-+ INTELPllInvalid ("m1 out of range\n");
-+ if (clock->m1 <= clock->m2)
-+ INTELPllInvalid ("m1 <= m2\n");
-+ if (clock->m < limit->m.min || limit->m.max < clock->m)
-+ INTELPllInvalid ("m out of range\n");
-+ if (clock->n < limit->n.min || limit->n.max < clock->n)
-+ INTELPllInvalid ("n out of range\n");
-+ if (clock->vco < limit->vco.min || limit->vco.max < clock->vco)
-+ INTELPllInvalid ("vco out of range\n");
-+ /* XXX: We may need to be checking "Dot clock" depending on the multiplier,
-+ * connector, etc., rather than just a single range.
-+ */
-+ if (clock->dot < limit->dot.min || limit->dot.max < clock->dot)
-+ INTELPllInvalid ("dot out of range\n");
-+
-+ return true;
-+}
-+
-+/**
-+ * Returns a set of divisors for the desired target clock with the given
-+ * refclk, or FALSE. The returned values represent the clock equation:
-+ * reflck * (5 * (m1 + 2) + (m2 + 2)) / (n + 2) / p1 / p2.
-+ */
-+static bool intel_find_best_PLL(struct drm_crtc *crtc, int target,
-+ int refclk, intel_clock_t *best_clock)
-+{
-+ struct drm_device *dev = crtc->dev;
-+ DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
-+ intel_clock_t clock;
-+ const intel_limit_t *limit = intel_limit(crtc);
-+ int err = target;
-+
-+ if (IS_I9XX(dev) && intel_pipe_has_type(crtc, INTEL_OUTPUT_LVDS) &&
-+ (I915_READ(LVDS) & LVDS_PORT_EN) != 0) {
-+ /*
-+ * For LVDS, if the panel is on, just rely on its current
-+ * settings for dual-channel. We haven't figured out how to
-+ * reliably set up different single/dual channel state, if we
-+ * even can.
-+ */
-+ if ((I915_READ(LVDS) & LVDS_CLKB_POWER_MASK) ==
-+ LVDS_CLKB_POWER_UP)
-+ clock.p2 = limit->p2.p2_fast;
-+ else
-+ clock.p2 = limit->p2.p2_slow;
-+ } else {
-+ if (target < limit->p2.dot_limit)
-+ clock.p2 = limit->p2.p2_slow;
-+ else
-+ clock.p2 = limit->p2.p2_fast;
-+ }
-+
-+ memset (best_clock, 0, sizeof (*best_clock));
-+
-+ for (clock.m1 = limit->m1.min; clock.m1 <= limit->m1.max; clock.m1++) {
-+ for (clock.m2 = limit->m2.min; clock.m2 < clock.m1 &&
-+ clock.m2 <= limit->m2.max; clock.m2++) {
-+ for (clock.n = limit->n.min; clock.n <= limit->n.max;
-+ clock.n++) {
-+ for (clock.p1 = limit->p1.min;
-+ clock.p1 <= limit->p1.max; clock.p1++) {
-+ int this_err;
-+
-+ intel_clock(dev, refclk, &clock);
-+
-+ if (!intel_PLL_is_valid(crtc, &clock))
-+ continue;
-+
-+ this_err = abs(clock.dot - target);
-+ if (this_err < err) {
-+ *best_clock = clock;
-+ err = this_err;
-+ }
-+ }
-+ }
-+ }
-+ }
-+
-+ return (err != target);
-+}
-+
-+void
-+intel_wait_for_vblank(struct drm_device *dev)
-+{
-+ /* Wait for 20ms, i.e. one cycle at 50hz. */
-+ udelay(20000);
-+}
-+
-+static void
-+intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
-+ struct drm_framebuffer *old_fb)
-+{
-+ struct drm_device *dev = crtc->dev;
-+ DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
-+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-+ int pipe = intel_crtc->pipe;
-+ unsigned long Start, Offset;
-+ int dspbase = (pipe == 0 ? DSPAADDR : DSPBADDR);
-+ int dspsurf = (pipe == 0 ? DSPASURF : DSPBSURF);
-+ int dspstride = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE;
-+ int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR;
-+ u32 dspcntr, alignment;
-+
-+ Start = crtc->fb->offset;
-+ Offset = y * crtc->fb->pitch + x;
-+
-+ DRM_DEBUG("Writing base %08lX %08lX %d %d\n", Start, Offset, x, y);
-+ if (IS_I965G(dev)) {
-+ I915_WRITE(dspbase, Offset);
-+ I915_READ(dspbase);
-+ I915_WRITE(dspsurf, Start);
-+ I915_READ(dspsurf);
-+ } else {
-+ I915_WRITE(dspbase, Start + Offset);
-+ I915_READ(dspbase);
-+ }
-+
-+
-+ if (!dev_priv->sarea_priv)
-+ return;
-+
-+ switch (pipe) {
-+ case 0:
-+ dev_priv->sarea_priv->pipeA_x = x;
-+ dev_priv->sarea_priv->pipeA_y = y;
-+ break;
-+ case 1:
-+ dev_priv->sarea_priv->pipeB_x = x;
-+ dev_priv->sarea_priv->pipeB_y = y;
-+ break;
-+ default:
-+ DRM_ERROR("Can't update pipe %d in SAREA\n", pipe);
-+ break;
-+ }
-+}
-+
-+
-+
-+/**
-+ * Sets the power management mode of the pipe and plane.
-+ *
-+ * This code should probably grow support for turning the cursor off and back
-+ * on appropriately at the same time as we're turning the pipe off/on.
-+ */
-+static void intel_crtc_dpms(struct drm_crtc *crtc, int mode)
-+{
-+ struct drm_device *dev = crtc->dev;
-+ DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
-+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-+ int pipe = intel_crtc->pipe;
-+ int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
-+ int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR;
-+ int dspbase_reg = (pipe == 0) ? DSPAADDR : DSPBADDR;
-+ int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
-+ u32 temp;
-+ bool enabled;
-+
-+ /* XXX: When our outputs are all unaware of DPMS modes other than off
-+ * and on, we should map those modes to DRM_MODE_DPMS_OFF in the CRTC.
-+ */
-+ switch (mode) {
-+ case DRM_MODE_DPMS_ON:
-+ case DRM_MODE_DPMS_STANDBY:
-+ case DRM_MODE_DPMS_SUSPEND:
-+ /* Enable the DPLL */
-+ temp = I915_READ(dpll_reg);
-+ if ((temp & DPLL_VCO_ENABLE) == 0) {
-+ I915_WRITE(dpll_reg, temp);
-+ I915_READ(dpll_reg);
-+ /* Wait for the clocks to stabilize. */
-+ udelay(150);
-+ I915_WRITE(dpll_reg, temp | DPLL_VCO_ENABLE);
-+ I915_READ(dpll_reg);
-+ /* Wait for the clocks to stabilize. */
-+ udelay(150);
-+ I915_WRITE(dpll_reg, temp | DPLL_VCO_ENABLE);
-+ I915_READ(dpll_reg);
-+ /* Wait for the clocks to stabilize. */
-+ udelay(150);
-+ }
-+
-+ /* Enable the pipe */
-+ temp = I915_READ(pipeconf_reg);
-+ if ((temp & PIPEACONF_ENABLE) == 0)
-+ I915_WRITE(pipeconf_reg, temp | PIPEACONF_ENABLE);
-+
-+ /* Enable the plane */
-+ temp = I915_READ(dspcntr_reg);
-+ if ((temp & DISPLAY_PLANE_ENABLE) == 0) {
-+ I915_WRITE(dspcntr_reg, temp | DISPLAY_PLANE_ENABLE);
-+ /* Flush the plane changes */
-+ I915_WRITE(dspbase_reg, I915_READ(dspbase_reg));
-+ }
-+
-+ intel_crtc_load_lut(crtc);
-+
-+ /* Give the overlay scaler a chance to enable if it's on this pipe */
-+ //intel_crtc_dpms_video(crtc, true); TODO
-+ break;
-+ case DRM_MODE_DPMS_OFF:
-+ /* Give the overlay scaler a chance to disable if it's on this pipe */
-+ //intel_crtc_dpms_video(crtc, FALSE); TODO
-+
-+ /* Disable the VGA plane that we never use */
-+ I915_WRITE(VGACNTRL, VGA_DISP_DISABLE);
-+
-+ /* Disable display plane */
-+ temp = I915_READ(dspcntr_reg);
-+ if ((temp & DISPLAY_PLANE_ENABLE) != 0) {
-+ I915_WRITE(dspcntr_reg, temp & ~DISPLAY_PLANE_ENABLE);
-+ /* Flush the plane changes */
-+ I915_WRITE(dspbase_reg, I915_READ(dspbase_reg));
-+ I915_READ(dspbase_reg);
-+ }
-+
-+ if (!IS_I9XX(dev)) {
-+ /* Wait for vblank for the disable to take effect */
-+ intel_wait_for_vblank(dev);
-+ }
-+
-+ /* Next, disable display pipes */
-+ temp = I915_READ(pipeconf_reg);
-+ if ((temp & PIPEACONF_ENABLE) != 0) {
-+ I915_WRITE(pipeconf_reg, temp & ~PIPEACONF_ENABLE);
-+ I915_READ(pipeconf_reg);
-+ }
-+
-+ /* Wait for vblank for the disable to take effect. */
-+ intel_wait_for_vblank(dev);
-+
-+ temp = I915_READ(dpll_reg);
-+ if ((temp & DPLL_VCO_ENABLE) != 0) {
-+ I915_WRITE(dpll_reg, temp & ~DPLL_VCO_ENABLE);
-+ I915_READ(dpll_reg);
-+ }
-+
-+ /* Wait for the clocks to turn off. */
-+ udelay(150);
-+ break;
-+ }
-+
-+
-+ if (!dev_priv->sarea_priv)
-+ return;
-+
-+ enabled = crtc->enabled && mode != DRM_MODE_DPMS_OFF;
-+
-+ switch (pipe) {
-+ case 0:
-+ dev_priv->sarea_priv->pipeA_w = enabled ? crtc->mode.hdisplay : 0;
-+ dev_priv->sarea_priv->pipeA_h = enabled ? crtc->mode.vdisplay : 0;
-+ break;
-+ case 1:
-+ dev_priv->sarea_priv->pipeB_w = enabled ? crtc->mode.hdisplay : 0;
-+ dev_priv->sarea_priv->pipeB_h = enabled ? crtc->mode.vdisplay : 0;
-+ break;
-+ default:
-+ DRM_ERROR("Can't update pipe %d in SAREA\n", pipe);
-+ break;
-+ }
-+
-+ intel_crtc->dpms_mode = mode;
-+}
-+
-+static void intel_crtc_prepare (struct drm_crtc *crtc)
-+{
-+ struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
-+ crtc_funcs->dpms(crtc, DRM_MODE_DPMS_OFF);
-+}
-+
-+static void intel_crtc_commit (struct drm_crtc *crtc)
-+{
-+ struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
-+ crtc_funcs->dpms(crtc, DRM_MODE_DPMS_ON);
-+}
-+
-+void intel_encoder_prepare (struct drm_encoder *encoder)
-+{
-+ struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
-+ /* lvds has its own version of prepare see intel_lvds_prepare */
-+ encoder_funcs->dpms(encoder, DRM_MODE_DPMS_OFF);
-+}
-+
-+void intel_encoder_commit (struct drm_encoder *encoder)
-+{
-+ struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
-+ /* lvds has its own version of commit see intel_lvds_commit */
-+ encoder_funcs->dpms(encoder, DRM_MODE_DPMS_ON);
-+}
-+
-+static bool intel_crtc_mode_fixup(struct drm_crtc *crtc,
-+ struct drm_display_mode *mode,
-+ struct drm_display_mode *adjusted_mode)
-+{
-+ return true;
-+}
-+
-+
-+/** Returns the core display clock speed for i830 - i945 */
-+static int intel_get_core_clock_speed(struct drm_device *dev)
-+{
-+
-+ /* Core clock values taken from the published datasheets.
-+ * The 830 may go up to 166 Mhz, which we should check.
-+ */
-+ if (IS_I945G(dev))
-+ return 400000;
-+ else if (IS_I915G(dev))
-+ return 333000;
-+ else if (IS_I945GM(dev) || IS_POULSBO(dev) || IS_845G(dev))
-+ return 200000;
-+ else if (IS_I915GM(dev)) {
-+ u16 gcfgc = 0;
-+
-+ pci_read_config_word(dev->pdev, GCFGC, &gcfgc);
-+
-+ if (gcfgc & GC_LOW_FREQUENCY_ENABLE)
-+ return 133000;
-+ else {
-+ switch (gcfgc & GC_DISPLAY_CLOCK_MASK) {
-+ case GC_DISPLAY_CLOCK_333_MHZ:
-+ return 333000;
-+ default:
-+ case GC_DISPLAY_CLOCK_190_200_MHZ:
-+ return 190000;
-+ }
-+ }
-+ } else if (IS_I865G(dev))
-+ return 266000;
-+ else if (IS_I855(dev)) {
-+ u16 hpllcc = 0;
-+ /* Assume that the hardware is in the high speed state. This
-+ * should be the default.
-+ */
-+ switch (hpllcc & GC_CLOCK_CONTROL_MASK) {
-+ case GC_CLOCK_133_200:
-+ case GC_CLOCK_100_200:
-+ return 200000;
-+ case GC_CLOCK_166_250:
-+ return 250000;
-+ case GC_CLOCK_100_133:
-+ return 133000;
-+ }
-+ } else /* 852, 830 */
-+ return 133000;
-+
-+ return 0; /* Silence gcc warning */
-+}
-+
-+
-+/**
-+ * Return the pipe currently connected to the panel fitter,
-+ * or -1 if the panel fitter is not present or not in use
-+ */
-+static int intel_panel_fitter_pipe (struct drm_device *dev)
-+{
-+ DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
-+ u32 pfit_control;
-+
-+ /* i830 doesn't have a panel fitter */
-+ if (IS_I830(dev))
-+ return -1;
-+
-+ pfit_control = I915_READ(PFIT_CONTROL);
-+
-+ /* See if the panel fitter is in use */
-+ if ((pfit_control & PFIT_ENABLE) == 0)
-+ return -1;
-+
-+ /* 965 can place panel fitter on either pipe */
-+ if (IS_I965G(dev))
-+ return (pfit_control >> 29) & 0x3;
-+
-+ /* older chips can only use pipe 1 */
-+ return 1;
-+}
-+
-+#define WA_NO_FB_GARBAGE_DISPLAY
-+#ifdef WA_NO_FB_GARBAGE_DISPLAY
-+static u32 fp_reg_value[2];
-+static u32 dpll_reg_value[2];
-+static u32 dpll_md_reg_value[2];
-+static u32 dspcntr_reg_value[2];
-+static u32 pipeconf_reg_value[2];
-+static u32 htot_reg_value[2];
-+static u32 hblank_reg_value[2];
-+static u32 hsync_reg_value[2];
-+static u32 vtot_reg_value[2];
-+static u32 vblank_reg_value[2];
-+static u32 vsync_reg_value[2];
-+static u32 dspsize_reg_value[2];
-+static u32 dspstride_reg_value[2];
-+static u32 dsppos_reg_value[2];
-+static u32 pipesrc_reg_value[2];
-+
-+static u32 dspbase_value[2];
-+
-+static u32 lvds_reg_value[2];
-+static u32 vgacntrl_reg_value[2];
-+static u32 pfit_control_reg_value[2];
-+
-+#if 0
-+void intel_crtc_mode_restore(struct drm_crtc *crtc)
-+{
-+ struct drm_device *dev = crtc->dev;
-+ DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
-+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-+ int pipe = intel_crtc->pipe;
-+ int fp_reg = (pipe == 0) ? FPA0 : FPB0;
-+ int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
-+ int dpll_md_reg = (intel_crtc->pipe == 0) ? DPLL_A_MD : DPLL_B_MD;
-+ int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR;
-+ int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
-+ int htot_reg = (pipe == 0) ? HTOTAL_A : HTOTAL_B;
-+ int hblank_reg = (pipe == 0) ? HBLANK_A : HBLANK_B;
-+ int hsync_reg = (pipe == 0) ? HSYNC_A : HSYNC_B;
-+ int vtot_reg = (pipe == 0) ? VTOTAL_A : VTOTAL_B;
-+ int vblank_reg = (pipe == 0) ? VBLANK_A : VBLANK_B;
-+ int vsync_reg = (pipe == 0) ? VSYNC_A : VSYNC_B;
-+ int dspsize_reg = (pipe == 0) ? DSPASIZE : DSPBSIZE;
-+ int dspstride_reg = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE;
-+ int dsppos_reg = (pipe == 0) ? DSPAPOS : DSPBPOS;
-+ int pipesrc_reg = (pipe == 0) ? PIPEASRC : PIPEBSRC;
-+ int dspbase = (pipe == 0 ? DSPAADDR : DSPBADDR);
-+
-+ bool ok, is_sdvo = false, is_dvo = false;
-+ bool is_crt = false, is_lvds = false, is_tv = false;
-+ struct drm_mode_config *mode_config = &dev->mode_config;
-+ struct drm_connector *output;
-+
-+ list_for_each_entry(output, &mode_config->connector_list, head) {
-+ struct intel_output *intel_output = to_intel_output(crtc);
-+
-+ if (output->crtc != crtc)
-+ continue;
-+
-+ switch (intel_output->type) {
-+ case INTEL_OUTPUT_LVDS:
-+ is_lvds = TRUE;
-+ break;
-+ case INTEL_OUTPUT_SDVO:
-+ is_sdvo = TRUE;
-+ break;
-+ case INTEL_OUTPUT_DVO:
-+ is_dvo = TRUE;
-+ break;
-+ case INTEL_OUTPUT_TVOUT:
-+ is_tv = TRUE;
-+ break;
-+ case INTEL_OUTPUT_ANALOG:
-+ is_crt = TRUE;
-+ break;
-+ }
-+ if(is_lvds && ((lvds_reg_value[pipe] & LVDS_PORT_EN) == 0))
-+ {
-+ printk("%s: is_lvds but not the boot display, so return\n",
-+ __FUNCTION__);
-+ return;
-+ }
-+ output->funcs->prepare(output);
-+ }
-+
-+ intel_crtc_prepare(crtc);
-+ /* Disable the panel fitter if it was on our pipe */
-+ if (intel_panel_fitter_pipe(dev) == pipe)
-+ I915_WRITE(PFIT_CONTROL, 0);
-+
-+ if (dpll_reg_value[pipe] & DPLL_VCO_ENABLE) {
-+ I915_WRITE(fp_reg, fp_reg_value[pipe]);
-+ I915_WRITE(dpll_reg, dpll_reg_value[pipe]& ~DPLL_VCO_ENABLE);
-+ I915_READ(dpll_reg);
-+ udelay(150);
-+ }
-+
-+ /*
-+ if(is_lvds)
-+ I915_WRITE(LVDS, lvds_reg_value[pipe]);
-+ */
-+ if (is_lvds) {
-+ I915_WRITE(LVDS, lvds_reg_value[pipe]);
-+ I915_READ(LVDS);
-+ }
-+
-+ I915_WRITE(fp_reg, fp_reg_value[pipe]);
-+ I915_WRITE(dpll_reg, dpll_reg_value[pipe]);
-+ I915_READ(dpll_reg);
-+ udelay(150);
-+ //I915_WRITE(dpll_md_reg, dpll_md_reg_value[pipe]);
-+ I915_WRITE(dpll_reg, dpll_reg_value[pipe]);
-+ I915_READ(dpll_reg);
-+ udelay(150);
-+ I915_WRITE(htot_reg, htot_reg_value[pipe]);
-+ I915_WRITE(hblank_reg, hblank_reg_value[pipe]);
-+ I915_WRITE(hsync_reg, hsync_reg_value[pipe]);
-+ I915_WRITE(vtot_reg, vtot_reg_value[pipe]);
-+ I915_WRITE(vblank_reg, vblank_reg_value[pipe]);
-+ I915_WRITE(vsync_reg, vsync_reg_value[pipe]);
-+ I915_WRITE(dspstride_reg, dspstride_reg_value[pipe]);
-+ I915_WRITE(dspsize_reg, dspsize_reg_value[pipe]);
-+ I915_WRITE(dsppos_reg, dsppos_reg_value[pipe]);
-+ I915_WRITE(pipesrc_reg, pipesrc_reg_value[pipe]);
-+ I915_WRITE(pipeconf_reg, pipeconf_reg_value[pipe]);
-+ I915_READ(pipeconf_reg);
-+ intel_wait_for_vblank(dev);
-+ I915_WRITE(dspcntr_reg, dspcntr_reg_value[pipe]);
-+ I915_WRITE(dspbase, dspbase_value[pipe]);
-+ I915_READ(dspbase);
-+ I915_WRITE(VGACNTRL, vgacntrl_reg_value[pipe]);
-+ intel_wait_for_vblank(dev);
-+ I915_WRITE(PFIT_CONTROL, pfit_control_reg_value[pipe]);
-+
-+ intel_crtc_commit(crtc);
-+ list_for_each_entry(output, &mode_config->connector_list, head) {
-+ if (output->crtc != crtc)
-+ continue;
-+
-+ output->funcs->commit(output);
-+ //output->funcs->dpms(output, DRM_MODE_DPMS_OFF);
-+ //printk("turn off the display first\n");
-+ }
-+ return;
-+}
-+
-+void intel_crtc_mode_save(struct drm_crtc *crtc)
-+{
-+ struct drm_device *dev = crtc->dev;
-+ DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
-+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-+ int pipe = intel_crtc->pipe;
-+ int fp_reg = (pipe == 0) ? FPA0 : FPB0;
-+ int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
-+ int dpll_md_reg = (intel_crtc->pipe == 0) ? DPLL_A_MD : DPLL_B_MD;
-+ int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR;
-+ int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
-+ int htot_reg = (pipe == 0) ? HTOTAL_A : HTOTAL_B;
-+ int hblank_reg = (pipe == 0) ? HBLANK_A : HBLANK_B;
-+ int hsync_reg = (pipe == 0) ? HSYNC_A : HSYNC_B;
-+ int vtot_reg = (pipe == 0) ? VTOTAL_A : VTOTAL_B;
-+ int vblank_reg = (pipe == 0) ? VBLANK_A : VBLANK_B;
-+ int vsync_reg = (pipe == 0) ? VSYNC_A : VSYNC_B;
-+ int dspsize_reg = (pipe == 0) ? DSPASIZE : DSPBSIZE;
-+ int dspstride_reg = (pipe == 0) ? DSPASTRIDE : DSPBSTRIDE;
-+ int dsppos_reg = (pipe == 0) ? DSPAPOS : DSPBPOS;
-+ int pipesrc_reg = (pipe == 0) ? PIPEASRC : PIPEBSRC;
-+ int dspbase = (pipe == 0 ? DSPAADDR : DSPBADDR);
-+ bool ok, is_sdvo = false, is_dvo = false;
-+ bool is_crt = false, is_lvds = false, is_tv = false;
-+ struct drm_mode_config *mode_config = &dev->mode_config;
-+ struct drm_connector *output;
-+
-+ list_for_each_entry(output, &mode_config->connector_list, head) {
-+ struct intel_output *intel_output = to_intel_output(crtc);
-+
-+ if (output->crtc != crtc)
-+ continue;
-+
-+ switch (intel_output->type) {
-+ case INTEL_OUTPUT_LVDS:
-+ is_lvds = TRUE;
-+ break;
-+ case INTEL_OUTPUT_SDVO:
-+ is_sdvo = TRUE;
-+ break;
-+ case INTEL_OUTPUT_DVO:
-+ is_dvo = TRUE;
-+ break;
-+ case INTEL_OUTPUT_TVOUT:
-+ is_tv = TRUE;
-+ break;
-+ case INTEL_OUTPUT_ANALOG:
-+ is_crt = TRUE;
-+ break;
-+ }
-+ }
-+
-+ fp_reg_value[pipe] = I915_READ(fp_reg);
-+ dpll_reg_value[pipe] = I915_READ(dpll_reg);
-+ dpll_md_reg_value[pipe] = I915_READ(dpll_md_reg);
-+ dspcntr_reg_value[pipe] = I915_READ(dspcntr_reg);
-+ pipeconf_reg_value[pipe] = I915_READ(pipeconf_reg);
-+ htot_reg_value[pipe] = I915_READ(htot_reg);
-+ hblank_reg_value[pipe] = I915_READ(hblank_reg);
-+ hsync_reg_value[pipe] = I915_READ(hsync_reg);
-+ vtot_reg_value[pipe] = I915_READ(vtot_reg);
-+ vblank_reg_value[pipe] = I915_READ(vblank_reg);
-+ vsync_reg_value[pipe] = I915_READ(vsync_reg);
-+ dspsize_reg_value[pipe] = I915_READ(dspsize_reg);
-+ dspstride_reg_value[pipe] = I915_READ(dspstride_reg);
-+ dsppos_reg_value[pipe] = I915_READ(dsppos_reg);
-+ pipesrc_reg_value[pipe] = I915_READ(pipesrc_reg);
-+ dspbase_value[pipe] = I915_READ(dspbase);
-+ if(is_lvds)
-+ lvds_reg_value[pipe] = I915_READ(LVDS);
-+ vgacntrl_reg_value[pipe] = I915_READ(VGACNTRL);
-+ pfit_control_reg_value[pipe] = I915_READ(PFIT_CONTROL);
-+}
-+#endif
-+#endif
-+static void intel_crtc_mode_set(struct drm_crtc *crtc,
-+ struct drm_display_mode *mode,
-+ struct drm_display_mode *adjusted_mode,
-+ int x, int y,
-+ struct drm_framebuffer *old_fb)
-+{
-+ struct drm_device *dev = crtc->dev;
-+ DRM_DRIVER_PRIVATE_T *dev_priv = dev->dev_private;
-+ struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
-+ int pipe = intel_crtc->pipe;
-+ int fp_reg = (pipe == 0) ? FPA0 : FPB0;
-+ int dpll_reg = (pipe == 0) ? DPLL_A : DPLL_B;
-+ int dpll_md_reg = (intel_crtc->pipe == 0) ? DPLL_A_MD : DPLL_B_MD;
-+ int dspcntr_reg = (pipe == 0) ? DSPACNTR : DSPBCNTR;
-+ int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
-+ int htot_reg = (pipe == 0) ? HTOTAL_A : HTOTAL_B;
-+ int hblank_reg = (pipe == 0) ? HBLANK_A : HBLANK_B;
-+ int hsync_reg = (pipe == 0) ? HSYNC_A : HSYNC_B;
-+ int vtot_reg = (pipe == 0) ? VTOTAL_A : VTOTAL_B;
-+ int vblank_reg = (pipe == 0) ? VBLANK_A : VBLANK_B;
-+ int vsync_reg = (pipe == 0) ? VSYNC_A : VSYNC_B;
-+