From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Emde Subject: [PATCH 1/4] drm/i915: clear up backlight inversion confusion on gen4 Date: Thu, 26 Apr 2012 18:48:34 +0200 Message-ID: <20120426165033.143738779@osadl.org> References: <1335173535-14811-1-git-send-email-daniel.vetter@ffwll.ch> <20120426164833.823221567@osadl.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from toro.web-alm.net (toro.web-alm.net [62.245.132.31]) by gabe.freedesktop.org (Postfix) with ESMTP id 63FE79EB67 for ; Thu, 26 Apr 2012 10:00:11 -0700 (PDT) Content-Disposition: inline; filename=drivers-gpu-drm-i915-invert-brightness-if-required.patch List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Daniel Vetter Cc: Intel Graphics Development List-Id: intel-gfx@lists.freedesktop.org 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 Date: Thu Mar 15 15:56:27 2012 +0100 drm/i915: panel: invert brightness acer aspire 5734z 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 Signed-off-by: Carsten Emde --- 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(-) Index: linux-tip/drivers/gpu/drm/i915/i915_reg.h =================================================================== --- linux-tip.orig/drivers/gpu/drm/i915/i915_reg.h +++ linux-tip/drivers/gpu/drm/i915/i915_reg.h @@ -1683,16 +1683,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) /* Index: linux-tip/drivers/gpu/drm/i915/intel_display.c =================================================================== --- linux-tip.orig/drivers/gpu/drm/i915/intel_display.c +++ linux-tip/drivers/gpu/drm/i915/intel_display.c @@ -9143,9 +9143,6 @@ 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) Index: linux-tip/drivers/gpu/drm/i915/intel_panel.c =================================================================== --- linux-tip.orig/drivers/gpu/drm/i915/intel_panel.c +++ linux-tip/drivers/gpu/drm/i915/intel_panel.c @@ -208,6 +208,10 @@ static u32 intel_panel_compute_brightnes 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; }