[PATCH 1/2] drm/i915: clear up backlight inversion confusion on gen4

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

 



There's a bit in the docs for gen4 only that says whether the
backlight control is inverted. And both the quirk we have and
all bugs only concern i965gm and gm45 (and mostly Acer) afaics.

So lets drop the quirk and use the bit instead.

Also clean up the BLC register definitions a bit by correctly
grouping the CTL and CTL2 definitions together.

This quirk was originally added in

commit 5a15ab5b93e4a3ebcd4fa6c76cf646a45e9cf806
Author: Carsten Emde <C.Emde at osadl.org>
Date:   Thu Mar 15 15:56:27 2012 +0100

    drm/i915: panel: invert brightness acer aspire 5734z

Cc: Carsten Emde <C.Emde at osadl.org>
References: https://bugzilla.kernel.org/show_bug.cgi?id=31522
References: https://bugs.freedesktop.org/show_bug.cgi?id=37986
References: https://bugs.freedesktop.org/show_bug.cgi?id=40455
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
 drivers/gpu/drm/i915/i915_reg.h      |    7 ++++---
 drivers/gpu/drm/i915/intel_display.c |    3 ---
 drivers/gpu/drm/i915/intel_panel.c   |    4 ++++
 3 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 5ac9837..67c4ca0 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -1783,16 +1783,17 @@
 #define PFIT_AUTO_RATIOS 0x61238
 
 /* Backlight control */
-#define BLC_PWM_CTL		0x61254
-#define   BACKLIGHT_MODULATION_FREQ_SHIFT		(17)
 #define BLC_PWM_CTL2		0x61250 /* 965+ only */
-#define   BLM_COMBINATION_MODE (1 << 30)
+#define   BLM_COMBINATION_MODE	(1 << 30)
+#define   BLM_POLARITY_I965	(1 << 28) /* gen4 only */
+#define BLC_PWM_CTL		0x61254
 /*
  * This is the most significant 15 bits of the number of backlight cycles in a
  * complete cycle of the modulated backlight control.
  *
  * The actual value is this field multiplied by two.
  */
+#define   BACKLIGHT_MODULATION_FREQ_SHIFT		(17)
 #define   BACKLIGHT_MODULATION_FREQ_MASK		(0x7fff << 17)
 #define   BLM_LEGACY_MODE				(1 << 16)
 /*
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 4c844c6..5d215f0 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6482,9 +6482,6 @@ static struct intel_quirk intel_quirks[] = {
 
 	/* Sony Vaio Y cannot use SSC on LVDS */
 	{ 0x0046, 0x104d, 0x9076, quirk_ssc_force_disable },
-
-	/* Acer Aspire 5734Z must invert backlight brightness */
-	{ 0x2a42, 0x1025, 0x0459, quirk_invert_brightness },
 };
 
 static void intel_init_quirks(struct drm_device *dev)
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index cad45ff..1874517 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -212,6 +212,10 @@ static u32 intel_panel_compute_brightness(struct drm_device *dev, u32 val)
 	    dev_priv->quirks & QUIRK_INVERT_BRIGHTNESS)
 		return intel_panel_get_max_backlight(dev) - val;
 
+	/* gen4 has a polarity bit */
+	if (IS_GEN4(dev) && (I915_READ(BLC_PWM_CTL2) & BLM_POLARITY_I965))
+			return intel_panel_get_max_backlight(dev) - val;
+
 	return val;
 }
 
-- 
1.7.10



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