intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: Intel Graphics Development <intel-gfx@lists.freedesktop.org>,
	Carsten Emde <C.Emde@osadl.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: [PATCH] drm/i915 disable combination mode
Date: Thu, 26 Jul 2012 14:20:50 +0200	[thread overview]
Message-ID: <1343305250-1320-1-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <501074AA.1070905@osadl.org>

... 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

  parent reply	other threads:[~2012-07-26 12:20 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-23  9:32 [PATCH 1/2] drm/i915: clear up backlight inversion confusion on gen4 Daniel Vetter
2012-04-23  9:32 ` [PATCH 2/2] drm/i915: pnv has a backlight polarity control bit, too Daniel Vetter
2012-04-23 10:27   ` Chris Wilson
2012-04-23  9:53 ` [PATCH 1/2] drm/i915: clear up backlight inversion confusion on gen4 Chris Wilson
2012-04-23 12:21   ` Daniel Vetter
2012-04-23 12:32     ` Chris Wilson
2012-04-23 13:48       ` Daniel Vetter
     [not found] ` <4F9542EF.3010208@osadl.org>
2012-04-23 12:32   ` Daniel Vetter
2012-04-23 12:36     ` Daniel Vetter
2012-04-23 13:15       ` Carsten Emde
2012-04-23 13:39         ` Daniel Vetter
2012-04-23 14:00           ` Carsten Emde
2012-04-23 14:22             ` Daniel Vetter
2012-04-23 15:06               ` Carsten Emde
2012-04-23 15:22                 ` Daniel Vetter
2012-04-23 15:38                   ` Carsten Emde
2012-04-23 15:56                     ` Daniel Vetter
2012-04-23 16:55                       ` Carsten Emde
2012-04-26 16:48 ` [PATCH 0/4] drm/i915: " Carsten Emde
2012-04-26 16:48   ` [PATCH 1/4] drm/i915: " Carsten Emde
2012-04-26 16:48   ` [PATCH 2/4] drm/i915: completely revert the invert brightness quirk Carsten Emde
2012-04-26 16:48   ` [PATCH 3/4] drm/i915: add quirk to indicate that an alt bit is used for brightness inversion Carsten Emde
2012-04-26 17:08     ` Daniel Vetter
2012-04-26 17:25       ` [PATCH] properly enable the blc controller on the right pipe Daniel Vetter
2012-04-26 17:27         ` Daniel Vetter
2012-04-26 19:12         ` Carsten Emde
2012-04-26 19:30           ` Daniel Vetter
2012-04-27 20:18             ` Carsten Emde
2012-06-02 23:08               ` Daniel Vetter
2012-06-11  8:51                 ` Daniel Vetter
2012-07-19 14:00                   ` Carsten Emde
2012-07-19 14:40                     ` Daniel Vetter
2012-07-19 22:51                       ` Carsten Emde
2012-07-20  8:10                         ` Daniel Vetter
2012-07-24  7:30                           ` Carsten Emde
2012-07-25 22:35                             ` Carsten Emde
2012-07-26 11:55                               ` [PATCH] drm/i915 disable combination mode Daniel Vetter
2012-07-26 12:20                               ` Daniel Vetter [this message]
2012-07-26 12:36                               ` Daniel Vetter
2012-07-26 14:09                               ` Daniel Vetter
2012-04-26 16:48   ` [PATCH 4/4] drm/i915: assign the brightness inversion quirk to Acer Aspire 5734Z Carsten Emde
2012-04-27 16:17   ` [PATCH 0/4] drm/i915: Re: clear up backlight inversion confusion on gen4 Monark Gondaliya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1343305250-1320-1-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=C.Emde@osadl.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).