diff mbox

How to work around zero-initialized BLC_PWM_PCH_CTL2?

Message ID 87txi8d7z4.fsf@intel.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jani Nikula Aug. 29, 2013, 11:58 a.m. UTC
Hi Takashi -

On Thu, 29 Aug 2013, Takashi Iwai <tiwai@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:


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

Comments

Takashi Iwai Aug. 30, 2013, 10:05 a.m. UTC | #1
Hi Jani,

At Thu, 29 Aug 2013 14:58:23 +0300,
Jani Nikula wrote:
> 
> 
> Hi Takashi -
> 
> On Thu, 29 Aug 2013, Takashi Iwai <tiwai@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.

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.


> 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.

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

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

Yep, we can't take some value blindly.


thanks,

Takashi


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

---
diff mbox

Patch

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);
 	}
 }