mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Melchior FRANZ <melchior.franz@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	Chris Wilson <chris@chris-wilson.co.uk>,
	dri-devel@lists.freedesktop.org
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)
Date: Sat, 30 Apr 2011 12:27:24 +0200	[thread overview]
Message-ID: <s5hiptwavar.wl%tiwai@suse.de> (raw)
In-Reply-To: <201104301032.05271@rk-nord.at>

At Sat, 30 Apr 2011 10:32:04 +0200,
Melchior FRANZ wrote:
> 
> * Takashi Iwai -- Saturday 30 April 2011:
> > I remember vaguely that the value zero could be interpreted as the max.
> 
> > Also, with the patch, does the backlight level can be adjusted
> > correctly to different values?  I wonder whether LBPC adjustment
> > really works or not on your machine.
> 
> > +			if (!lbpc)
> > +				lbpc = 0xff; /* max value */
> 
> This change does *not* work on my machine. The screen stays black
> again.

Hrm, then it's really hard to say how exactly the system behaves when
lbpc=0...  I guess we should avoid controlling LBPC in such a case,
e.g. something like the patch below (totally untested).

But Intel guys must know of this better... I leave this to their
hands.

> 
> Yes, backlight adjustment generally works on this notebook, but only
> with "acpi_osi=Linux" on the command line.

acpi_osi quirk should be better added statically, then.


thanks,

Takashi

---
diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1c1b27c..c0ab771 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -328,6 +328,7 @@ typedef struct drm_i915_private {
 	struct intel_overlay *overlay;
 
 	/* LVDS info */
+	int backlight_combination_mode; /* 0=unknown, -1=no, 1=yes */
 	int backlight_level;  /* restore backlight to this value */
 	bool backlight_enabled;
 	struct drm_display_mode *panel_fixed_mode;
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c
index a06ff07..320dd5f 100644
--- a/drivers/gpu/drm/i915/intel_panel.c
+++ b/drivers/gpu/drm/i915/intel_panel.c
@@ -115,14 +115,24 @@ done:
 static int is_backlight_combination_mode(struct drm_device *dev)
 {
 	struct drm_i915_private *dev_priv = dev->dev_private;
-
-	if (INTEL_INFO(dev)->gen >= 4)
-		return I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
-
-	if (IS_GEN2(dev))
-		return I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
-
-	return 0;
+	int combo_mode;
+	u8 lbpc;
+
+	if (dev_priv->backlight_combination_mode)
+		return dev_priv->backlight_combination_mode > 0;
+
+	pci_read_config_byte(dev->pdev, PCI_LBPC, &lbpc);
+	if (!lbpc)
+		combo_mode = 0;
+	else if (INTEL_INFO(dev)->gen >= 4)
+		combo_mode = I915_READ(BLC_PWM_CTL2) & BLM_COMBINATION_MODE;
+	else if (IS_GEN2(dev))
+		combo_mode = I915_READ(BLC_PWM_CTL) & BLM_LEGACY_MODE;
+	else
+		combo_mode = 0;
+
+	dev_priv->backlight_combination_mode = combo_mode ? -1 : 1;
+	return combo_mode;
 }
 
 static u32 i915_read_blc_pwm_ctl(struct drm_i915_private *dev_priv)

  reply	other threads:[~2011-04-30 10:27 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-27  4:30 Linux 2.6.39-rc5 Linus Torvalds
2011-04-29 15:58 ` Melchior FRANZ
2011-04-29 17:09   ` Takashi Iwai
2011-04-29 17:41     ` i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5) Melchior FRANZ
2011-04-29 19:47       ` Takashi Iwai
2011-04-29 20:09         ` Melchior FRANZ
2011-04-30  8:11           ` Takashi Iwai
2011-04-30  8:32             ` Melchior FRANZ
2011-04-30 10:27               ` Takashi Iwai [this message]
2011-04-30 11:34                 ` Melchior FRANZ
2011-04-30 14:37                   ` Joey Lee
2011-05-02 12:08                   ` Takashi Iwai
2011-05-02 13:12                     ` Melchior FRANZ
2011-05-04  7:07                     ` Joey Lee
     [not found] ` <201105051745.27992@rk-nord.at>
     [not found]   ` <s5htyd9kumz.wl%tiwai@suse.de>
2011-05-05 20:42     ` Melchior FRANZ
2011-05-06  8:52       ` i915/kms/backlight-combo mode problem Melchior FRANZ
2011-05-06 12:41         ` Joey Lee
2011-05-06 16:23           ` Melchior FRANZ
2011-05-07 20:22             ` Melchior FRANZ
2011-05-08 13:41               ` Joey Lee
2011-05-08 14:05                 ` Melchior FRANZ
2011-05-09  8:50                   ` Joey Lee
2011-05-09  9:00                     ` Takashi Iwai
2011-05-09  9:35                       ` Joey Lee
2011-05-09 10:08                     ` Melchior FRANZ
     [not found]                       ` <BANLkTimtvAWeS-t3bWjJmdVtyaPDw2uWDA@mail.gmail.com>
2011-05-10  3:29                         ` Michael Chang
2011-05-10 11:08                           ` Melchior FRANZ
     [not found]                             ` <BANLkTimQJM3N1WdBhYVOH0UyyOTFcxOfUQ@mail.gmail.com>
2011-05-13 21:20                               ` Joey Lee
2011-05-15 12:50                                 ` Melchior FRANZ
2011-05-15 10:08                             ` Takashi Iwai
2011-05-16 12:21                               ` Melchior FRANZ
2011-05-17  7:56                                 ` Michael Chang
2011-05-17  8:58                                   ` Melchior FRANZ
2011-05-17 10:12                                     ` Michael Chang
2011-05-17 11:40                                       ` Melchior FRANZ
2011-05-09  8:58               ` Takashi Iwai
2012-01-21 17:09 i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5) Chris Diamand
2012-01-21 18:32 ` Keith Packard

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=s5hiptwavar.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=chris@chris-wilson.co.uk \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=melchior.franz@gmail.com \
    --cc=torvalds@linux-foundation.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®