public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Hugh Dickins <hughd@google.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Chris Wilson <chris@chris-wilson.co.uk>,
	Giacomo Comes <comes@naic.edu>,
	Paulo Zanoni <paulo.r.zanoni@intel.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2] drm/i915: Fix blank panel at reopening lid
Date: Sat, 11 Aug 2012 08:56:42 +0200	[thread overview]
Message-ID: <s5hsjbt9as5.wl%tiwai@suse.de> (raw)
In-Reply-To: <s5hvcgq7wpp.wl%tiwai@suse.de>

When you reopen the lid on a laptop with PCH, the panel suddenly goes
blank sometimes.  It seems because BLC_PWM_CPU_CTL register is cleared
to zero when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 registers are
enabled.

This patch fixes the problem by moving the call of the function setting
BLC_PWM_CPU_CTL after enabling other two registers.

Reported-and-tested-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
v1->v2: add comments, fixed changelog

 drivers/gpu/drm/i915/intel_panel.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index 10c7d39..d564c05 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -311,9 +311,6 @@ void intel_panel_enable_backlight(struct drm_device *dev,
 	if (dev_priv->backlight_level == 0)
 		dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
 
-	dev_priv->backlight_enabled = true;
-	intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
-
 	if (INTEL_INFO(dev)->gen >= 4) {
 		uint32_t reg, tmp;
 
@@ -326,7 +323,7 @@ void intel_panel_enable_backlight(struct drm_device *dev,
 		 * we don't track the backlight dpms state, hence check whether
 		 * we have to do anything first. */
 		if (tmp & BLM_PWM_ENABLE)
-			return;
+			goto set_level;
 
 		if (dev_priv->num_pipe == 3)
 			tmp &= ~BLM_PIPE_SELECT_IVB;
@@ -347,6 +344,14 @@ void intel_panel_enable_backlight(struct drm_device *dev,
 			I915_WRITE(BLC_PWM_PCH_CTL1, tmp);
 		}
 	}
+
+set_level:
+	/* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1.
+	 * BLC_PWM_CPU_CTL may be cleared to zero automatically when these
+	 * registers are set.
+	 */
+	dev_priv->backlight_enabled = true;
+	intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
 }
 
 static void intel_panel_init_backlight(struct drm_device *dev)
-- 
1.7.11.4


  reply	other threads:[~2012-08-11  6:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-04 17:01 i915 regression on 3.6-rc1: lid blanks screen Hugh Dickins
2012-08-05  7:11 ` Takashi Iwai
2012-08-06  4:21   ` Hugh Dickins
2012-08-06  9:03     ` Daniel Vetter
2012-08-06 18:25       ` Hugh Dickins
2012-08-10 11:59         ` Takashi Iwai
2012-08-10 12:35           ` Daniel Vetter
2012-08-10 12:57             ` Takashi Iwai
2012-08-10 18:53               ` Hugh Dickins
2012-08-11  6:45                 ` Takashi Iwai
2012-08-11  6:56                   ` Takashi Iwai [this message]
2012-08-11 19:15                     ` [PATCH v2] drm/i915: Fix blank panel at reopening lid Daniel Vetter

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=s5hsjbt9as5.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=chris@chris-wilson.co.uk \
    --cc=comes@naic.edu \
    --cc=daniel.vetter@ffwll.ch \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulo.r.zanoni@intel.com \
    --cc=torvalds@linux-foundation.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