[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5hiptwavar.wl%tiwai@suse.de>
Date: Sat, 30 Apr 2011 12:27:24 +0200
From: Takashi Iwai <tiwai@...e.de>
To: Melchior FRANZ <melchior.franz@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
linux-kernel@...r.kernel.org,
Chris Wilson <chris@...is-wilson.co.uk>,
dri-devel@...ts.freedesktop.org
Subject: Re: i915/kms/backlight-combo mode problem (was: Re: Linux 2.6.39-rc5)
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)
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists