Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915: write backlight harder

770c12312ad617172b1a65b911d3e6564fc5aca8 is the first bad commit
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

changed the register write sequence for restoring the backlight, which
helped prevent non-working backlights on some machines. Turns out that
the original sequence was the right thing to do for a different set of
machines. Worse, setting the backlight level _after_ enabling it seems
to reset it somehow. So we need to make that one conditional upon the
backlight having been reset to zero, and add the old one back.

Cargo-culting at it's best, but it seems to work.

Cc: stable@vger.kernel.org
Cc: Takashi Iwai <tiwai@suse.de>
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=47941
Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

+8 -5
+8 -5
drivers/gpu/drm/i915/intel_panel.c
··· 321 321 if (dev_priv->backlight_level == 0) 322 322 dev_priv->backlight_level = intel_panel_get_max_backlight(dev); 323 323 324 + dev_priv->backlight_enabled = true; 325 + intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); 326 + 324 327 if (INTEL_INFO(dev)->gen >= 4) { 325 328 uint32_t reg, tmp; 326 329 ··· 359 356 } 360 357 361 358 set_level: 362 - /* Call below after setting BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1. 363 - * BLC_PWM_CPU_CTL may be cleared to zero automatically when these 364 - * registers are set. 359 + /* Check the current backlight level and try to set again if it's zero. 360 + * On some machines, BLC_PWM_CPU_CTL is cleared to zero automatically 361 + * when BLC_PWM_CPU_CTL2 and BLC_PWM_PCH_CTL1 are written. 365 362 */ 366 - dev_priv->backlight_enabled = true; 367 - intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); 363 + if (!intel_panel_get_backlight(dev)) 364 + intel_panel_actually_set_backlight(dev, dev_priv->backlight_level); 368 365 } 369 366 370 367 static void intel_panel_init_backlight(struct drm_device *dev)