Skip to contentSkip to conversation

How to work around zero-initialized BLC_PWM_PCH_CTL2?

DISCUSSION Takashi Iwai 2 participants 3 messages Aug 29, 2013 – Aug 30, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

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?

thanks,

Takashi

maintainer
#1 lore raw

Hi Takashi -

Quoted 8 lines · Takashi Iwai

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.

Quoted 6 lines

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:

drivers/gpu/drm/i915/intel_opregion.c +3 -1
index 53a82ea..2b379ec 100644
@@ -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/[email protected]

#2 lore raw

Hi Jani,

At Thu, 29 Aug 2013 14:58:23 +0300,

Quoted 17 lines · Jani Nikula

Hi Takashi -

Quoted 12 lines · Takashi Iwai

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.

Quoted 8 lines
Quoted 2 lines

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.

Attached below. The tarball contains the boot cases where the lid is opened and closed. The output of intel_bios_dumper couldn't be read when the lid is closed, as it seems.

In anyway, I see no obvious value (the max brightness 0x3a9) in intel_bios_reader output.

Quoted 26 lines

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:

drivers/gpu/drm/i915/intel_opregion.c +3 -1
index 53a82ea..2b379ec 100644
@@ -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);
 	}
 }
Quoted 4 lines

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.

With the patch, no useful information showed up, unfortunately.

Quoted 1 line

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

Yep, we can't take some value blindly.

thanks,

Takashi

Quoted 8 lines

BR,
Jani.

[1] http://lkml.kernel.org/r/[email protected]

---

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx