Subject: Patch DRM/I915: Sync the LVDS save/restore function with intel driver
From: Zhao Yakui <yakui.z...@intel.com>

    Sync the LVDS save/restore functin with intel driver. At the same time
the possible_crtcs/clones for LVDS is added explicitly.

Signed-off-by: Zhao Yakui <yakui.z...@intel.com>
---
 drivers/gpu/drm/i915/i915_reg.h   |    2 ++
 drivers/gpu/drm/i915/intel_lvds.c |   21 ++++++++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

Index: linux-2.6/drivers/gpu/drm/i915/intel_lvds.c
===================================================================
--- linux-2.6.orig/drivers/gpu/drm/i915/intel_lvds.c    2009-03-03 
17:58:26.000000000 +0800
+++ linux-2.6/drivers/gpu/drm/i915/intel_lvds.c 2009-03-03 18:01:19.000000000 
+0800
@@ -58,9 +58,17 @@
 static u32 intel_lvds_get_max_backlight(struct drm_device *dev)
 {
        struct drm_i915_private *dev_priv = dev->dev_private;
+       u32 value, pm_ctl;
 
-       return ((I915_READ(BLC_PWM_CTL) & BACKLIGHT_MODULATION_FREQ_MASK) >>
-               BACKLIGHT_MODULATION_FREQ_SHIFT) * 2;
+       pm_ctl = I915_READ(BLC_PWM_CTL);
+
+       if (IS_I965GM(dev) || IS_GM45(dev))
+               value = (pm_ctl & BACKLIGHT_MODULATION_FREQ_MASK2) >>
+                       BACKLIGHT_MODULATION_FREQ_SHIFT2;
+       else
+               value = ((pm_ctl & BACKLIGHT_MODULATION_FREQ_MASK) >>
+                       BACKLIGHT_MODULATION_FREQ_SHIFT) * 2;
+       return value;
 }
 
 /**
@@ -107,6 +115,9 @@
        struct drm_device *dev = connector->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
 
+       if (IS_I965GM(dev) || IS_GM45(dev))
+               dev_priv->saveBLC_PWM_CTL2 = I915_READ(BLC_PWM_CTL2);
+
        dev_priv->savePP_ON = I915_READ(PP_ON_DELAYS);
        dev_priv->savePP_OFF = I915_READ(PP_OFF_DELAYS);
        dev_priv->savePP_CONTROL = I915_READ(PP_CONTROL);
@@ -128,6 +139,9 @@
        struct drm_device *dev = connector->dev;
        struct drm_i915_private *dev_priv = dev->dev_private;
 
+       if (IS_I965GM(dev) || IS_GM45(dev))
+               I915_WRITE(BLC_PWM_CTL2, dev_priv->saveBLC_PWM_CTL2);
+
        I915_WRITE(BLC_PWM_CTL, dev_priv->saveBLC_PWM_CTL);
        I915_WRITE(PP_ON_DELAYS, dev_priv->savePP_ON);
        I915_WRITE(PP_OFF_DELAYS, dev_priv->savePP_OFF);
@@ -440,7 +454,8 @@
        connector->display_info.subpixel_order = SubPixelHorizontalRGB;
        connector->interlace_allowed = false;
        connector->doublescan_allowed = false;
-
+       encoder->possible_crtcs = (1 << 1);
+       encoder->possible_clones = (1 << INTEL_OUTPUT_LVDS);
 
        /*
         * LVDS discovery:
Index: linux-2.6/drivers/gpu/drm/i915/i915_reg.h
===================================================================
--- linux-2.6.orig/drivers/gpu/drm/i915/i915_reg.h      2009-03-03 
18:01:04.000000000 +0800
+++ linux-2.6/drivers/gpu/drm/i915/i915_reg.h   2009-03-03 18:01:19.000000000 
+0800
@@ -815,6 +815,7 @@
 /* Backlight control */
 #define BLC_PWM_CTL            0x61254
 #define   BACKLIGHT_MODULATION_FREQ_SHIFT              (17)
+#define   BACKLIGHT_MODULATION_FREQ_SHIFT2             (16)
 #define BLC_PWM_CTL2           0x61250 /* 965+ only */
 #define   BLM_COMBINATION_MODE (1 << 30)
 /*
@@ -824,6 +825,7 @@
  * The actual value is this field multiplied by two.
  */
 #define   BACKLIGHT_MODULATION_FREQ_MASK               (0x7fff << 17)
+#define   BACKLIGHT_MODULATION_FREQ_MASK2              (0xffff << 17)
 #define   BLM_LEGACY_MODE                              (1 << 16)
 /*
  * This is the number of cycles out of the backlight modulation cycle for which



------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to