[PATCH] drm/i915 disable combination mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



... but this time around don't forget to save/restore the lbpc reg.

v2: Actually try to restroe LBPC on resume.
--

Hi Carsten,

Please test this quick hack, afaict that should be more towards the
ultimate truth of gen4 backlight heaven than adding random invert
brightness quirks.

Yours, Daniel
---
 drivers/gpu/drm/i915/i915_drv.h     |    1 +
 drivers/gpu/drm/i915/i915_reg.h     |    3 +++
 drivers/gpu/drm/i915/i915_suspend.c |   10 ++++++++++
 drivers/gpu/drm/i915/intel_panel.c  |    4 ++--
 4 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 0b2eb17..f483ef4 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -507,6 +507,7 @@ typedef struct drm_i915_private {
 	/* Register state */
 	bool modeset_on_lid;
 	u8 saveLBB;
+	u8 saveLBPC;
 	u32 saveDSPACNTR;
 	u32 saveDSPBCNTR;
 	u32 saveDSPARB;
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 1310caa..29ccd22 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1882,6 +1882,9 @@
 
 #define PFIT_AUTO_RATIOS 0x61238
 
+/* legacy/combination backlight modes in the pci config space */
+#define PCI_LBPC 0xf4
+
 /* Backlight control */
 #define BLC_PWM_CTL2		0x61250 /* 965+ only */
 #define   BLM_PWM_ENABLE		(1 << 31)
diff --git a/drivers/gpu/drm/i915/i915_suspend.c b/drivers/gpu/drm/i915/i915_suspend.c
index 740c076..63f9c09 100644
--- a/drivers/gpu/drm/i915/i915_suspend.c
+++ b/drivers/gpu/drm/i915/i915_suspend.c
@@ -641,6 +641,11 @@ static void i915_save_display(struct drm_device *dev)
 			dev_priv->saveLVDS = I915_READ(LVDS);
 	}
 
+	if (IS_GEN2(dev) || IS_GEN4(dev)) {
+		pci_read_config_byte(dev->pdev, PCI_LBPC,
+				     &dev_priv->saveLBPC);
+	}
+
 	if (!IS_I830(dev) && !IS_845G(dev) && !HAS_PCH_SPLIT(dev))
 		dev_priv->savePFIT_CONTROL = I915_READ(PFIT_CONTROL);
 
@@ -758,6 +763,11 @@ static void i915_restore_display(struct drm_device *dev)
 		I915_WRITE(PP_CONTROL, dev_priv->savePP_CONTROL);
 	}
 
+	if (IS_GEN2(dev) || IS_GEN4(dev)) {
+		pci_read_config_byte(dev->pdev, PCI_LBPC,
+				     &dev_priv->saveLBPC);
+	}
+
 	/* Display Port state */
 	if (SUPPORTS_INTEGRATED_DP(dev)) {
 		I915_WRITE(DP_B, dev_priv->saveDP_B);
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 10c7d39..c8b6bc5 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -33,8 +33,6 @@
 #include <linux/moduleparam.h>
 #include "intel_drv.h"
 
-#define PCI_LBPC 0xf4 /* legacy/combination backlight modes */
-
 void
 intel_fixed_panel_mode(struct drm_display_mode *fixed_mode,
 		       struct drm_display_mode *adjusted_mode)
@@ -121,11 +119,13 @@ static int is_backlight_combination_mode(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
 
+#if 0
 	if (INTEL_INFO(dev)->gen >= 4)
 		return I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
 
 	if (IS_GEN2(dev))
 		return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
+#endif
 
 	return 0;
 }
-- 
1.7.10.4



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]
  Powered by Linux