All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Takashi Iwai <tiwai@suse.de>, intel-gfx@lists.freedesktop.org
Subject: Re: How to work around zero-initialized BLC_PWM_PCH_CTL2?
Date: Thu, 29 Aug 2013 14:58:23 +0300	[thread overview]
Message-ID: <87txi8d7z4.fsf@intel.com> (raw)
In-Reply-To: <s5h38pshpcu.wl%tiwai@suse.de>


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:

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

  reply	other threads:[~2013-08-29 12:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-29  8:29 How to work around zero-initialized BLC_PWM_PCH_CTL2? Takashi Iwai
2013-08-29 11:58 ` Jani Nikula [this message]
2013-08-30 10:05   ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87txi8d7z4.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.