[Intel-gfx] How to work around zero-initialized BLC_PWM_PCH_CTL2?

Jani Nikula jani.nikula at linux.intel.com
Thu Aug 29 13:58:23 CEST 2013


Hi Takashi -

On Thu, 29 Aug 2013, Takashi Iwai <tiwai at suse.de> wrote:
> a new laptop model we've been struggling has some strange hardware
> configuration.  BIOS turns off backlight and skips its initialization
> when the machine is booted with the lid closed.  This leaves
> BLC_PWM_PCH_CTL2 and other registers uninitialized.  Because a proper
> max brightness value can't be obtained from this register, i915 driver
> doesn't create the own backlight control any more.  It results in the
> permanent blank screen even after the lid is opened.
>
> Actually, the only missing piece is the initial BLC_PWM_PCH_CTL2
> value.  If I overwrite it via intel_reg_write before loading i915
> module, everything works fine.
>
> Now I wonder whether we can get this max brightness value from
> somewhere else.  Is it defined in VBT or anywhere else persistent?

Please run tools/intel_bios_reader from intel-gpu-tools, and post the
results. If that fails, please attach hexdump of
/sys/kernel/debug/dri/0/i915_opregion. The PWM value should be in the
VBT, and we could use that as a fallback. If the value makes sense, that
is.

Additionally we could enable the PWM request from ASLE. It would be
interesting to see if there are PWM requests, and with what values, if
you enable drm.debug=0xe and do:

diff --git a/drivers/gpu/drm/i915/intel_opregion.c b/drivers/gpu/drm/i915/intel_opregion.c
index 53a82ea..2b379ec 100644
--- a/drivers/gpu/drm/i915/intel_opregion.c
+++ b/drivers/gpu/drm/i915/intel_opregion.c
@@ -390,6 +390,7 @@ static u32 asle_set_als_illum(struct drm_device *dev, u32 alsi)
 
 static u32 asle_set_pwm_freq(struct drm_device *dev, u32 pfmb)
 {
+	DRM_DEBUG_DRIVER("pfmb = 0x%08x\n", pfmb);
 	DRM_DEBUG_DRIVER("PWM freq is not supported\n");
 	return ASLE_PWM_FREQ_FAILED;
 }
@@ -618,7 +619,8 @@ void intel_opregion_init(struct drm_device *dev)
 	}
 
 	if (opregion->asle) {
-		iowrite32(ASLE_TCHE_BLC_EN, &opregion->asle->tche);
+		iowrite32(ASLE_TCHE_BLC_EN | ASLE_TCHE_PFMB_EN,
+			  &opregion->asle->tche);
 		iowrite32(ASLE_ARDY_READY, &opregion->asle->ardy);
 	}
 }

Adding support for this is a bit tedious, though, as the PWM value has
been set as the max for the backlight device. It's probably not a good
idea to change the max on the fly in the user space facing interface, so
scaling would be required.

Note to self, we need to take machines like [1] into account too.


BR,
Jani.


[1] http://lkml.kernel.org/r/1347627426-3813-1-git-send-email-grant.likely@secretlab.ca



More information about the Intel-gfx mailing list