diff mbox

Revert "drm/i915: write backlight harder"

Message ID 1363963486-7891-1-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter March 22, 2013, 2:44 p.m. UTC
This reverts commit cf0a6584aa6d382f802f2c3cacac23ccbccde0cd.

Turns out that cargo-culting breaks systems. Note that we can't revert
further, since

commit 770c12312ad617172b1a65b911d3e6564fc5aca8
Author: Takashi Iwai <tiwai@suse.de>
Date:   Sat Aug 11 08:56:42 2012 +0200

    drm/i915: Fix blank panel at reopening lid

fixed a regression in 3.6-rc kernels for which we've never figured out
the exact root cause. But some further inspection of the backlight
code reveals that it's seriously lacking locking. And especially the
asle backlight update is know to get fired (through some smm magic)
when writing specific backlight control registers. So the possibility
of suffering from races is rather real.

Until those races are fixed I don't think it makes sense to try
further hacks. Which sucks a bit, but sometimes that's how it is :(

References: http://www.mail-archive.com/intel-gfx@lists.freedesktop.org/msg18788.html
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/i915/intel_panel.c |   13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

Comments

Takashi Iwai March 22, 2013, 3:06 p.m. UTC | #1
At Fri, 22 Mar 2013 15:44:46 +0100,
Daniel Vetter wrote:
> 
> This reverts commit cf0a6584aa6d382f802f2c3cacac23ccbccde0cd.
> 
> Turns out that cargo-culting breaks systems. Note that we can't revert
> further, since
> 
> commit 770c12312ad617172b1a65b911d3e6564fc5aca8
> Author: Takashi Iwai <tiwai@suse.de>
> Date:   Sat Aug 11 08:56:42 2012 +0200
> 
>     drm/i915: Fix blank panel at reopening lid
> 
> fixed a regression in 3.6-rc kernels for which we've never figured out
> the exact root cause. But some further inspection of the backlight
> code reveals that it's seriously lacking locking. And especially the
> asle backlight update is know to get fired (through some smm magic)
> when writing specific backlight control registers. So the possibility
> of suffering from races is rather real.
> 
> Until those races are fixed I don't think it makes sense to try
> further hacks. Which sucks a bit, but sometimes that's how it is :(
> 
> References: http://www.mail-archive.com/intel-gfx@lists.freedesktop.org/msg18788.html
> Cc: Jani Nikula <jani.nikula@intel.com>
> Cc: Takashi Iwai <tiwai@suse.de>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Feel free to add my tested-by tags to all three.

  Tested-by: Takashi Iwai <tiwai@suse.de>


thanks,

Takashi
Daniel Vetter March 23, 2013, 11:36 a.m. UTC | #2
On Fri, Mar 22, 2013 at 04:06:14PM +0100, Takashi Iwai wrote:
> At Fri, 22 Mar 2013 15:44:46 +0100,
> Daniel Vetter wrote:
> > 
> > This reverts commit cf0a6584aa6d382f802f2c3cacac23ccbccde0cd.
> > 
> > Turns out that cargo-culting breaks systems. Note that we can't revert
> > further, since
> > 
> > commit 770c12312ad617172b1a65b911d3e6564fc5aca8
> > Author: Takashi Iwai <tiwai@suse.de>
> > Date:   Sat Aug 11 08:56:42 2012 +0200
> > 
> >     drm/i915: Fix blank panel at reopening lid
> > 
> > fixed a regression in 3.6-rc kernels for which we've never figured out
> > the exact root cause. But some further inspection of the backlight
> > code reveals that it's seriously lacking locking. And especially the
> > asle backlight update is know to get fired (through some smm magic)
> > when writing specific backlight control registers. So the possibility
> > of suffering from races is rather real.
> > 
> > Until those races are fixed I don't think it makes sense to try
> > further hacks. Which sucks a bit, but sometimes that's how it is :(
> > 
> > References: http://www.mail-archive.com/intel-gfx@lists.freedesktop.org/msg18788.html
> > Cc: Jani Nikula <jani.nikula@intel.com>
> > Cc: Takashi Iwai <tiwai@suse.de>
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Feel free to add my tested-by tags to all three.
> 
>   Tested-by: Takashi Iwai <tiwai@suse.de>

Picked up for -fixes with the additional kernel bz link for #47941 added.
-Daniel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index a3730e0..bee8cb6 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -321,9 +321,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;
 
@@ -359,12 +356,12 @@  void intel_panel_enable_backlight(struct drm_device *dev,
 	}
 
 set_level:
-	/* Check the current backlight level and try to set again if it's zero.
-	 * On some machines, BLC_PWM_CPU_CTL is cleared to zero automatically
-	 * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written.
+	/* 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.
 	 */
-	if (!intel_panel_get_backlight(dev))
-		intel_panel_actually_set_backlight(dev, dev_priv->backlight_level);
+	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)