--- /dev/null
+From f7ab9b407b3bc83161c2aa74c992ba4782e87c9c Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Thu, 20 Jan 2011 10:03:24 +0000
+Subject: drm/i915: Add dependency on CONFIG_TMPFS
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit f7ab9b407b3bc83161c2aa74c992ba4782e87c9c upstream.
+
+Without tmpfs, shmem_readpage() is not compiled in causing an OOPS as
+soon as we try to allocate some swappable pages for GEM.
+
+Jan 19 22:52:26 harlie kernel: Modules linked in: i915(+) drm_kms_helper cfbcopyarea video backlight cfbimgblt cfbfillrect
+Jan 19 22:52:26 harlie kernel:
+Jan 19 22:52:26 harlie kernel: Pid: 1125, comm: modprobe Not tainted 2.6.37Harlie #10 To be filled by O.E.M./To be filled by O.E.M.
+Jan 19 22:52:26 harlie kernel: EIP: 0060:[<00000000>] EFLAGS: 00010246 CPU: 3
+Jan 19 22:52:26 harlie kernel: EIP is at 0x0
+Jan 19 22:52:26 harlie kernel: EAX: 00000000 EBX: f7b7d000 ECX: f3383100 EDX: f7b7d000
+Jan 19 22:52:26 harlie kernel: ESI: f1456118 EDI: 00000000 EBP: f2303c98 ESP: f2303c7c
+Jan 19 22:52:26 harlie kernel: DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
+Jan 19 22:52:26 harlie kernel: Process modprobe (pid: 1125, ti=f2302000 task=f259cd80 task.ti=f2302000)
+Jan 19 22:52:26 harlie kernel: Stack:
+Jan 19 22:52:26 harlie udevd-work[1072]: '/sbin/modprobe -b pci:v00008086d00000046sv00000000sd00000000bc03sc00i00' unexpected exit with status 0x0009
+Jan 19 22:52:26 harlie kernel: c1074061 000000d0 f2f42b80 00000000 000a13d2 f2d5dcc0 00000001 f2303cac
+Jan 19 22:52:26 harlie kernel: c107416f 00000000 000a13d2 00000000 f2303cd4 f8d620ed f2cee620 00001000
+Jan 19 22:52:26 harlie kernel: 00000000 000a13d2 f1456118 f2d5dcc0 f1a40000 00001000 f2303d04 f8d637ab
+Jan 19 22:52:26 harlie kernel: Call Trace:
+Jan 19 22:52:26 harlie kernel: [<c1074061>] ? do_read_cache_page+0x71/0x160
+Jan 19 22:52:26 harlie kernel: [<c107416f>] ? read_cache_page_gfp+0x1f/0x30
+Jan 19 22:52:26 harlie kernel: [<f8d620ed>] ? i915_gem_object_get_pages+0xad/0x1d0 [i915]
+Jan 19 22:52:26 harlie kernel: [<f8d637ab>] ? i915_gem_object_bind_to_gtt+0xeb/0x2d0 [i915]
+Jan 19 22:52:26 harlie kernel: [<f8d65961>] ? i915_gem_object_pin+0x151/0x190 [i915]
+Jan 19 22:52:26 harlie kernel: [<c11e16ed>] ? drm_gem_object_init+0x3d/0x60
+Jan 19 22:52:26 harlie kernel: [<f8d65aa5>] ? i915_gem_init_ringbuffer+0x105/0x1e0 [i915]
+Jan 19 22:52:26 harlie kernel: [<f8d571b7>] ? i915_driver_load+0x667/0x1160 [i915]
+
+Reported-by: John J. Stimson-III <john@idsfa.net>
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/Kconfig | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/gpu/drm/Kconfig
++++ b/drivers/gpu/drm/Kconfig
+@@ -100,7 +100,10 @@ config DRM_I830
+ config DRM_I915
+ tristate "i915 driver"
+ depends on AGP_INTEL
++ # we need shmfs for the swappable backing store, and in particular
++ # the shmem_readpage() which depends upon tmpfs
+ select SHMEM
++ select TMPFS
+ select DRM_KMS_HELPER
+ select FB_CFB_FILLRECT
+ select FB_CFB_COPYAREA
--- /dev/null
+From 858bc21f0637c407601a05626854ae58b242f75d Mon Sep 17 00:00:00 2001
+From: Jesse Barnes <jbarnes@virtuousgeek.org>
+Date: Tue, 4 Jan 2011 10:46:49 -0800
+Subject: drm/i915: check eDP encoder correctly when setting modes
+
+From: Jesse Barnes <jbarnes@virtuousgeek.org>
+
+commit 858bc21f0637c407601a05626854ae58b242f75d upstream.
+
+We were using a stale pointer in the check which caused us to use CPU
+attached DP params when we should have been using PCH attached params.
+
+Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=31988
+Tested-by: Jan-Hendrik Zab <jan@jhz.name>
+Tested-by: Christoph Lukas <christoph.lukas@gmx.net>
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/i915/intel_display.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/i915/intel_display.c
++++ b/drivers/gpu/drm/i915/intel_display.c
+@@ -3714,7 +3714,7 @@ static int intel_crtc_mode_set(struct dr
+ int lane = 0, link_bw, bpp;
+ /* CPU eDP doesn't require FDI link, so just set DP M/N
+ according to current link config */
+- if (has_edp_encoder && !intel_encoder_is_pch_edp(&encoder->base)) {
++ if (has_edp_encoder && !intel_encoder_is_pch_edp(&has_edp_encoder->base)) {
+ target_clock = mode->clock;
+ intel_edp_link_config(has_edp_encoder,
+ &lane, &link_bw);
--- /dev/null
+From f5afcd3dd0dca7fe869311c51da54d5a889191ba Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?David=20M=C3=BCller?= <d.mueller@elsoft.ch>
+Date: Thu, 6 Jan 2011 12:29:32 +0000
+Subject: drm/i915/crt: Check for a analog monitor in case of DVI-I
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: =?UTF-8?q?David=20M=C3=BCller?= <d.mueller@elsoft.ch>
+
+commit f5afcd3dd0dca7fe869311c51da54d5a889191ba upstream.
+
+Since Linux 2.6.36 the digital output on my system (855GME + DVI-I) is
+not working any longer. The analog output is always activated
+regardless of the type of monitor attached.
+
+The culprit seems to be intel_crt_detect_ddc(), which returns true as
+soon as an ACK from the EDID device is received. Obviously this
+approach does not work with DVI-I where the analog and digital outputs
+share a common DDC bus.
+
+In a similar manner to the shared DDC wire, ala the "Mac Mini Hack", we
+need an additional check to make sure that there really is an analog
+device attached to the DDC.
+
+Signed-off-by: David Müller <d.mueller@elsoft.ch>
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/i915/intel_crt.c | 30 +++++++++++++++++++++++++-----
+ 1 file changed, 25 insertions(+), 5 deletions(-)
+
+--- a/drivers/gpu/drm/i915/intel_crt.c
++++ b/drivers/gpu/drm/i915/intel_crt.c
+@@ -30,6 +30,7 @@
+ #include "drm.h"
+ #include "drm_crtc.h"
+ #include "drm_crtc_helper.h"
++#include "drm_edid.h"
+ #include "intel_drv.h"
+ #include "i915_drm.h"
+ #include "i915_drv.h"
+@@ -287,8 +288,9 @@ static bool intel_crt_ddc_probe(struct d
+ return i2c_transfer(&dev_priv->gmbus[ddc_bus].adapter, msgs, 1) == 1;
+ }
+
+-static bool intel_crt_detect_ddc(struct intel_crt *crt)
++static bool intel_crt_detect_ddc(struct drm_connector *connector)
+ {
++ struct intel_crt *crt = intel_attached_crt(connector);
+ struct drm_i915_private *dev_priv = crt->base.base.dev->dev_private;
+
+ /* CRT should always be at 0, but check anyway */
+@@ -301,8 +303,26 @@ static bool intel_crt_detect_ddc(struct
+ }
+
+ if (intel_ddc_probe(&crt->base, dev_priv->crt_ddc_pin)) {
+- DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
+- return true;
++ struct edid *edid;
++ bool is_digital = false;
++
++ edid = drm_get_edid(connector,
++ &dev_priv->gmbus[dev_priv->crt_ddc_pin].adapter);
++ /*
++ * This may be a DVI-I connector with a shared DDC
++ * link between analog and digital outputs, so we
++ * have to check the EDID input spec of the attached device.
++ */
++ if (edid != NULL) {
++ is_digital = edid->input & DRM_EDID_INPUT_DIGITAL;
++ connector->display_info.raw_edid = NULL;
++ kfree(edid);
++ }
++
++ if (!is_digital) {
++ DRM_DEBUG_KMS("CRT detected via DDC:0x50 [EDID]\n");
++ return true;
++ }
+ }
+
+ return false;
+@@ -458,7 +478,7 @@ intel_crt_detect(struct drm_connector *c
+ }
+ }
+
+- if (intel_crt_detect_ddc(crt))
++ if (intel_crt_detect_ddc(connector))
+ return connector_status_connected;
+
+ if (!force)
+@@ -472,7 +492,7 @@ intel_crt_detect(struct drm_connector *c
+ crtc = intel_get_load_detect_pipe(&crt->base, connector,
+ NULL, &dpms_mode);
+ if (crtc) {
+- if (intel_crt_detect_ddc(crt))
++ if (intel_crt_detect_ddc(connector))
+ status = connector_status_connected;
+ else
+ status = intel_crt_load_detect(crtc, crt);
--- /dev/null
+From 3c5a62b5226ca5db993660281e9c2a7275d9fb02 Mon Sep 17 00:00:00 2001
+From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
+Date: Thu, 6 Jan 2011 18:26:08 +0800
+Subject: drm/i915: fix calculation of eDP signal levels on Sandybridge
+
+From: Yuanhan Liu <yuanhan.liu@linux.intel.com>
+
+commit 3c5a62b5226ca5db993660281e9c2a7275d9fb02 upstream.
+
+Some voltage swing/pre-emphasis level use the same value on eDP
+Sandybridge, like 400mv_0db and 600mv_0db are with the same value
+of (0x0 << 22). So, fix them, and point out the value if it isn't
+a supported voltage swing/pre-emphasis level.
+
+Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/i915/i915_reg.h | 9 +++++----
+ drivers/gpu/drm/i915/intel_dp.c | 23 ++++++++++++++++-------
+ 2 files changed, 21 insertions(+), 11 deletions(-)
+
+--- a/drivers/gpu/drm/i915/i915_reg.h
++++ b/drivers/gpu/drm/i915/i915_reg.h
+@@ -3057,10 +3057,11 @@
+ #define EDP_LINK_TRAIN_600MV_3_5DB_SNB_A (0x01<<22)
+ #define EDP_LINK_TRAIN_800MV_0DB_SNB_A (0x0<<22)
+ /* SNB B-stepping */
+-#define EDP_LINK_TRAIN_400MV_0DB_SNB_B (0x0<<22)
+-#define EDP_LINK_TRAIN_400MV_6DB_SNB_B (0x3a<<22)
+-#define EDP_LINK_TRAIN_600MV_3_5DB_SNB_B (0x39<<22)
+-#define EDP_LINK_TRAIN_800MV_0DB_SNB_B (0x38<<22)
++#define EDP_LINK_TRAIN_400_600MV_0DB_SNB_B (0x0<<22)
++#define EDP_LINK_TRAIN_400MV_3_5DB_SNB_B (0x1<<22)
++#define EDP_LINK_TRAIN_400_600MV_6DB_SNB_B (0x3a<<22)
++#define EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B (0x39<<22)
++#define EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B (0x38<<22)
+ #define EDP_LINK_TRAIN_VOL_EMP_MASK_SNB (0x3f<<22)
+
+ #endif /* _I915_REG_H_ */
+--- a/drivers/gpu/drm/i915/intel_dp.c
++++ b/drivers/gpu/drm/i915/intel_dp.c
+@@ -1153,18 +1153,27 @@ intel_dp_signal_levels(uint8_t train_set
+ static uint32_t
+ intel_gen6_edp_signal_levels(uint8_t train_set)
+ {
+- switch (train_set & (DP_TRAIN_VOLTAGE_SWING_MASK|DP_TRAIN_PRE_EMPHASIS_MASK)) {
++ int signal_levels = train_set & (DP_TRAIN_VOLTAGE_SWING_MASK |
++ DP_TRAIN_PRE_EMPHASIS_MASK);
++ switch (signal_levels) {
+ case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_0:
+- return EDP_LINK_TRAIN_400MV_0DB_SNB_B;
++ case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_0:
++ return EDP_LINK_TRAIN_400_600MV_0DB_SNB_B;
++ case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_3_5:
++ return EDP_LINK_TRAIN_400MV_3_5DB_SNB_B;
+ case DP_TRAIN_VOLTAGE_SWING_400 | DP_TRAIN_PRE_EMPHASIS_6:
+- return EDP_LINK_TRAIN_400MV_6DB_SNB_B;
++ case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_6:
++ return EDP_LINK_TRAIN_400_600MV_6DB_SNB_B;
+ case DP_TRAIN_VOLTAGE_SWING_600 | DP_TRAIN_PRE_EMPHASIS_3_5:
+- return EDP_LINK_TRAIN_600MV_3_5DB_SNB_B;
++ case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_3_5:
++ return EDP_LINK_TRAIN_600_800MV_3_5DB_SNB_B;
+ case DP_TRAIN_VOLTAGE_SWING_800 | DP_TRAIN_PRE_EMPHASIS_0:
+- return EDP_LINK_TRAIN_800MV_0DB_SNB_B;
++ case DP_TRAIN_VOLTAGE_SWING_1200 | DP_TRAIN_PRE_EMPHASIS_0:
++ return EDP_LINK_TRAIN_800_1200MV_0DB_SNB_B;
+ default:
+- DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level\n");
+- return EDP_LINK_TRAIN_400MV_0DB_SNB_B;
++ DRM_DEBUG_KMS("Unsupported voltage swing/pre-emphasis level:"
++ "0x%x\n", signal_levels);
++ return EDP_LINK_TRAIN_400_600MV_0DB_SNB_B;
+ }
+ }
+
--- /dev/null
+From 22ab70d3262ddb6e69b3c246a34e2967ba5eb1e8 Mon Sep 17 00:00:00 2001
+From: Knut Petersen <knut_petersen@t-online.de>
+Date: Fri, 14 Jan 2011 15:38:10 +0000
+Subject: drm/i915/lvds: Add AOpen i915GMm-HFS to the list of false-positive LVDS
+
+From: Knut Petersen <knut_petersen@t-online.de>
+
+commit 22ab70d3262ddb6e69b3c246a34e2967ba5eb1e8 upstream.
+
+Signed-off-by: Knut Petersen <knut_petersen@t-online.de>
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/i915/intel_lvds.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/gpu/drm/i915/intel_lvds.c
++++ b/drivers/gpu/drm/i915/intel_lvds.c
+@@ -697,6 +697,14 @@ static const struct dmi_system_id intel_
+ },
+ {
+ .callback = intel_no_lvds_dmi_callback,
++ .ident = "AOpen i915GMm-HFS",
++ .matches = {
++ DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
++ DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
++ },
++ },
++ {
++ .callback = intel_no_lvds_dmi_callback,
+ .ident = "Aopen i945GTt-VFA",
+ .matches = {
+ DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"),
--- /dev/null
+From 47356eb67285014527a5ab87543ba1fae3d1e10a Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Tue, 11 Jan 2011 17:06:04 +0000
+Subject: drm/i915/panel: Only record the backlight level when it is enabled
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 47356eb67285014527a5ab87543ba1fae3d1e10a upstream.
+
+By tracking the current status of the backlight we can prevent recording
+the value of the current backlight when we have disabled it. And so
+prevent restoring it to 'off' after an unbalanced sequence of
+intel_lvds_disable/enable.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=22672
+Tested-by: Alex Riesen <raa.lkml@gmail.com>
+Tested-by: Larry Finger <Larry.Finger@lwfinger.net>
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/i915/i915_drv.h | 1 +
+ drivers/gpu/drm/i915/intel_display.c | 2 ++
+ drivers/gpu/drm/i915/intel_drv.h | 3 +++
+ drivers/gpu/drm/i915/intel_lvds.c | 10 ++--------
+ drivers/gpu/drm/i915/intel_panel.c | 31 +++++++++++++++++++++++++++++++
+ 5 files changed, 39 insertions(+), 8 deletions(-)
+
+--- a/drivers/gpu/drm/i915/i915_drv.h
++++ b/drivers/gpu/drm/i915/i915_drv.h
+@@ -329,6 +329,7 @@ typedef struct drm_i915_private {
+
+ /* LVDS info */
+ int backlight_level; /* restore backlight to this value */
++ bool backlight_enabled;
+ struct drm_display_mode *panel_fixed_mode;
+ struct drm_display_mode *lfp_lvds_vbt_mode; /* if any */
+ struct drm_display_mode *sdvo_lvds_vbt_mode; /* if any */
+--- a/drivers/gpu/drm/i915/intel_display.c
++++ b/drivers/gpu/drm/i915/intel_display.c
+@@ -5498,6 +5498,8 @@ static void intel_setup_outputs(struct d
+ encoder->base.possible_clones =
+ intel_encoder_clones(dev, encoder->clone_mask);
+ }
++
++ intel_panel_setup_backlight(dev);
+ }
+
+ static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
+--- a/drivers/gpu/drm/i915/intel_drv.h
++++ b/drivers/gpu/drm/i915/intel_drv.h
+@@ -256,6 +256,9 @@ extern void intel_pch_panel_fitting(stru
+ extern u32 intel_panel_get_max_backlight(struct drm_device *dev);
+ extern u32 intel_panel_get_backlight(struct drm_device *dev);
+ extern void intel_panel_set_backlight(struct drm_device *dev, u32 level);
++extern void intel_panel_setup_backlight(struct drm_device *dev);
++extern void intel_panel_enable_backlight(struct drm_device *dev);
++extern void intel_panel_disable_backlight(struct drm_device *dev);
+
+ extern void intel_crtc_load_lut(struct drm_crtc *crtc);
+ extern void intel_encoder_prepare (struct drm_encoder *encoder);
+--- a/drivers/gpu/drm/i915/intel_lvds.c
++++ b/drivers/gpu/drm/i915/intel_lvds.c
+@@ -106,7 +106,7 @@ static void intel_lvds_enable(struct int
+ I915_WRITE(ctl_reg, I915_READ(ctl_reg) | POWER_TARGET_ON);
+ POSTING_READ(lvds_reg);
+
+- intel_panel_set_backlight(dev, dev_priv->backlight_level);
++ intel_panel_enable_backlight(dev);
+ }
+
+ static void intel_lvds_disable(struct intel_lvds *intel_lvds)
+@@ -123,8 +123,7 @@ static void intel_lvds_disable(struct in
+ lvds_reg = LVDS;
+ }
+
+- dev_priv->backlight_level = intel_panel_get_backlight(dev);
+- intel_panel_set_backlight(dev, 0);
++ intel_panel_disable_backlight(dev);
+
+ I915_WRITE(ctl_reg, I915_READ(ctl_reg) & ~POWER_TARGET_ON);
+
+@@ -395,8 +394,6 @@ static void intel_lvds_prepare(struct dr
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct intel_lvds *intel_lvds = to_intel_lvds(encoder);
+
+- dev_priv->backlight_level = intel_panel_get_backlight(dev);
+-
+ /* We try to do the minimum that is necessary in order to unlock
+ * the registers for mode setting.
+ *
+@@ -427,9 +424,6 @@ static void intel_lvds_commit(struct drm
+ struct drm_i915_private *dev_priv = dev->dev_private;
+ struct intel_lvds *intel_lvds = to_intel_lvds(encoder);
+
+- if (dev_priv->backlight_level == 0)
+- dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
+-
+ /* Undo any unlocking done in prepare to prevent accidental
+ * adjustment of the registers.
+ */
+--- a/drivers/gpu/drm/i915/intel_panel.c
++++ b/drivers/gpu/drm/i915/intel_panel.c
+@@ -218,3 +218,34 @@ void intel_panel_set_backlight(struct dr
+ tmp &= ~BACKLIGHT_DUTY_CYCLE_MASK;
+ I915_WRITE(BLC_PWM_CTL, tmp | level);
+ }
++
++void intel_panel_disable_backlight(struct drm_device *dev)
++{
++ struct drm_i915_private *dev_priv = dev->dev_private;
++
++ if (dev_priv->backlight_enabled) {
++ dev_priv->backlight_level = intel_panel_get_backlight(dev);
++ dev_priv->backlight_enabled = false;
++ }
++
++ intel_panel_set_backlight(dev, 0);
++}
++
++void intel_panel_enable_backlight(struct drm_device *dev)
++{
++ struct drm_i915_private *dev_priv = dev->dev_private;
++
++ if (dev_priv->backlight_level == 0)
++ dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
++
++ intel_panel_set_backlight(dev, dev_priv->backlight_level);
++ dev_priv->backlight_enabled = true;
++}
++
++void intel_panel_setup_backlight(struct drm_device *dev)
++{
++ struct drm_i915_private *dev_priv = dev->dev_private;
++
++ dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
++ dev_priv->backlight_enabled = dev_priv->backlight_level != 0;
++}
--- /dev/null
+From c8303e7f3f3093c16ef0fa5f73280637c89d4368 Mon Sep 17 00:00:00 2001
+From: Indan Zupancic <indan@nul.nu>
+Date: Wed, 12 Jan 2011 11:59:19 +0000
+Subject: drm/i915/panel: The backlight is enabled if the current value is non-zero
+
+From: Indan Zupancic <indan@nul.nu>
+
+commit c8303e7f3f3093c16ef0fa5f73280637c89d4368 upstream.
+
+... and not if the maximum is non-zero. This fixes the typo introduced
+in 47356eb6728501452 and preserves the backlight value from boot.
+
+[ickle: My thanks also to Indan Zupancic for diagnosing the original
+ regression and suggesting the appropriate fix.]
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/i915/intel_panel.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/i915/intel_panel.c
++++ b/drivers/gpu/drm/i915/intel_panel.c
+@@ -246,6 +246,6 @@ void intel_panel_setup_backlight(struct
+ {
+ struct drm_i915_private *dev_priv = dev->dev_private;
+
+- dev_priv->backlight_level = intel_panel_get_max_backlight(dev);
++ dev_priv->backlight_level = intel_panel_get_backlight(dev);
+ dev_priv->backlight_enabled = dev_priv->backlight_level != 0;
+ }
--- /dev/null
+From 934f992c763ae1e5eefcce8af769c16444085df7 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Thu, 20 Jan 2011 13:09:12 +0000
+Subject: drm/i915: Recognise non-VGA display devices
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 934f992c763ae1e5eefcce8af769c16444085df7 upstream.
+
+Starting with SandyBridge (though possible with earlier hacked BIOSes),
+the BIOS may initialise the IGFX as secondary to a discrete GPU. Prior,
+it would simply disable the integrated GPU. So we adjust our PCI class
+mask to match any DISPLAY_CLASS device.
+
+In such a configuration, the IGFX is not a primary VGA controller and
+so should not take part in VGA arbitration, and the error return from
+vga_client_register() is expected.
+
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/i915/i915_dma.c | 10 ++++++++--
+ drivers/gpu/drm/i915/i915_drv.c | 2 +-
+ drivers/gpu/vga/vgaarb.c | 2 +-
+ 3 files changed, 10 insertions(+), 4 deletions(-)
+
+--- a/drivers/gpu/drm/i915/i915_dma.c
++++ b/drivers/gpu/drm/i915/i915_dma.c
+@@ -1243,9 +1243,15 @@ static int i915_load_modeset_init(struct
+ if (ret)
+ DRM_INFO("failed to find VBIOS tables\n");
+
+- /* if we have > 1 VGA cards, then disable the radeon VGA resources */
++ /* If we have > 1 VGA cards, then we need to arbitrate access
++ * to the common VGA resources.
++ *
++ * If we are a secondary display controller (!PCI_DISPLAY_CLASS_VGA),
++ * then we do not take part in VGA arbitration and the
++ * vga_client_register() fails with -ENODEV.
++ */
+ ret = vga_client_register(dev->pdev, dev, NULL, i915_vga_set_decode);
+- if (ret)
++ if (ret && ret != -ENODEV)
+ goto cleanup_ringbuffer;
+
+ intel_register_dsm_handler();
+--- a/drivers/gpu/drm/i915/i915_drv.c
++++ b/drivers/gpu/drm/i915/i915_drv.c
+@@ -54,7 +54,7 @@ extern int intel_agp_enabled;
+
+ #define INTEL_VGA_DEVICE(id, info) { \
+ .class = PCI_CLASS_DISPLAY_VGA << 8, \
+- .class_mask = 0xffff00, \
++ .class_mask = 0xff0000, \
+ .vendor = 0x8086, \
+ .device = id, \
+ .subvendor = PCI_ANY_ID, \
+--- a/drivers/gpu/vga/vgaarb.c
++++ b/drivers/gpu/vga/vgaarb.c
+@@ -636,7 +636,7 @@ int vga_client_register(struct pci_dev *
+ void (*irq_set_state)(void *cookie, bool state),
+ unsigned int (*set_vga_decode)(void *cookie, bool decode))
+ {
+- int ret = -1;
++ int ret = -ENODEV;
+ struct vga_device *vgadev;
+ unsigned long flags;
+
--- /dev/null
+From 97aaf910731b03b27b1c4c8a58006a1dc99dcd9a Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Tue, 4 Jan 2011 20:10:52 +0000
+Subject: drm/i915/sdvo: Defer detection of output capabilities until probing
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 97aaf910731b03b27b1c4c8a58006a1dc99dcd9a upstream.
+
+Alex Fiestas reported an issue with his HDMI connector being misdetected
+as DVI unless he had something connected upon boot. By moving the
+decision as to whether to use HDMI or DVI encoding for the HDMI capable
+output until we probe the monitor means that we should avoid sending a
+HDMI signal to a DVI monitor and also correctly detect hardware like
+Alex's.
+
+However, to really determine what connector is soldered onto the wire we
+need to inspect the VBT sdvo child devices - but can we trust it?
+
+Reported-by: Alex Fiestas <alex@eyeos.org>
+Tested-by: Alex Fiestas <alex@eyeos.org>
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=32828
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/i915/intel_sdvo.c | 33 +++++++++++----------------------
+ 1 file changed, 11 insertions(+), 22 deletions(-)
+
+--- a/drivers/gpu/drm/i915/intel_sdvo.c
++++ b/drivers/gpu/drm/i915/intel_sdvo.c
+@@ -1024,9 +1024,13 @@ static void intel_sdvo_mode_set(struct d
+ if (!intel_sdvo_set_target_input(intel_sdvo))
+ return;
+
+- if (intel_sdvo->has_hdmi_monitor &&
+- !intel_sdvo_set_avi_infoframe(intel_sdvo))
+- return;
++ if (intel_sdvo->has_hdmi_monitor) {
++ intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI);
++ intel_sdvo_set_colorimetry(intel_sdvo,
++ SDVO_COLORIMETRY_RGB256);
++ intel_sdvo_set_avi_infoframe(intel_sdvo);
++ } else
++ intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_DVI);
+
+ if (intel_sdvo->is_tv &&
+ !intel_sdvo_set_tv_format(intel_sdvo))
+@@ -1395,6 +1399,9 @@ intel_sdvo_detect(struct drm_connector *
+
+ intel_sdvo->attached_output = response;
+
++ intel_sdvo->has_hdmi_monitor = false;
++ intel_sdvo->has_hdmi_audio = false;
++
+ if ((intel_sdvo_connector->output_flag & response) == 0)
+ ret = connector_status_disconnected;
+ else if (response & SDVO_TMDS_MASK)
+@@ -1919,20 +1926,7 @@ intel_sdvo_select_i2c_bus(struct drm_i91
+ static bool
+ intel_sdvo_is_hdmi_connector(struct intel_sdvo *intel_sdvo, int device)
+ {
+- int is_hdmi;
+-
+- if (!intel_sdvo_check_supp_encode(intel_sdvo))
+- return false;
+-
+- if (!intel_sdvo_set_target_output(intel_sdvo,
+- device == 0 ? SDVO_OUTPUT_TMDS0 : SDVO_OUTPUT_TMDS1))
+- return false;
+-
+- is_hdmi = 0;
+- if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ENCODE, &is_hdmi, 1))
+- return false;
+-
+- return !!is_hdmi;
++ return intel_sdvo_check_supp_encode(intel_sdvo);
+ }
+
+ static u8
+@@ -2034,12 +2028,7 @@ intel_sdvo_dvi_init(struct intel_sdvo *i
+ connector->connector_type = DRM_MODE_CONNECTOR_DVID;
+
+ if (intel_sdvo_is_hdmi_connector(intel_sdvo, device)) {
+- /* enable hdmi encoding mode if supported */
+- intel_sdvo_set_encode(intel_sdvo, SDVO_ENCODE_HDMI);
+- intel_sdvo_set_colorimetry(intel_sdvo,
+- SDVO_COLORIMETRY_RGB256);
+ connector->connector_type = DRM_MODE_CONNECTOR_HDMIA;
+-
+ intel_sdvo->is_hdmi = true;
+ }
+ intel_sdvo->base.clone_mask = ((1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
--- /dev/null
+From 0ba41e449fd0f45f5b29c1009020ab1b298bedda Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Sat, 8 Jan 2011 15:10:41 +0000
+Subject: drm: Restore the old_fb upon modeset failure
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 0ba41e449fd0f45f5b29c1009020ab1b298bedda upstream.
+
+... or else we may end up disabling the wrong framebuffer, leading to an
+OOPS, e.g:
+
+[ 6033.229012] kernel BUG at drivers/gpu/drm/i915/i915_gem.c:3271!
+[ 6033.229012] invalid opcode: 0000 [#1] SMP
+[ 6033.229012] last sysfs file:
+/sys/devices/virtual/backlight/acpi_video0/uevent
+[ 6033.229012] Modules linked in: sunrpc cpufreq_ondemand acpi_cpufreq
+mperf snd_hda_codec_analog snd_hda_intel snd_hda_codec snd_hwdep snd_seq
+snd_seq_device snd_pcm snd_timer thinkpad_acpi ppdev snd r852 sm_common
+iTCO_wdt uvcvideo i2c_i801 iTCO_vendor_support microcode wmi nand
+videodev nand_ids nand_ecc snd_page_alloc parport_pc parport mtd
+soundcore joydev v4l1_compat pcspkr uinput ipv6 sdhci_pci sdhci mmc_core
+yenta_socket i915 drm_kms_helper drm i2c_algo_bit i2c_core video output
+[last unloaded: scsi_wait_scan]
+[ 6033.229012]
+[ 6033.229012] Pid: 4834, comm: Xorg Not tainted 2.6.37-rc8+ #25 7661BL5/7661BL5
+[ 6033.229012] EIP: 0060:[<f86fda5e>] EFLAGS: 00013246 CPU: 0
+[ 6033.229012] EIP is at i915_gem_object_unpin+0x23/0x76 [i915]
+[ 6033.229012] EAX: f68a4000 EBX: f6831f00 ECX: 000600fa EDX: f68a8000
+[ 6033.229012] ESI: f68a4014 EDI: f68a42b8 EBP: f2169c44 ESP: f2169c3c
+[ 6033.229012] DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
+[ 6033.229012] Process Xorg (pid: 4834, ti=f2168000 task=f21c8000 task.ti=f2168000)
+[ 6033.229012] Stack:
+[ 6033.229012] f3a84800 f68a4014 f2169c54 f87045d8 f3a84800 f872d9a8 f2169c68 f7fd8091
+[ 6033.229012] f3b952a4 00000000 f68a414c f2169cf0 f7fd9377 00000000 00000000 f7fd98b0
+[ 6033.229012] f7fd9f4e 0000000f f7f328a0 00000000 00000000 00000000 f2169ca4 f68a414c
+[ 6033.229012] Call Trace:
+[ 6033.229012] [<f87045d8>] ? intel_crtc_disable+0x36/0x41 [i915]
+[ 6033.229012] [<f7fd8091>] ? drm_helper_disable_unused_functions+0xcd/0xf9 [drm_kms_helper]
+[ 6033.229012] [<f7fd9377>] ? drm_crtc_helper_set_config+0x62a/0x7f7 [drm_kms_helper]
+[ 6033.229012] [<c04daa10>] ? __slab_free+0x1b/0xa4
+[ 6033.229012] [<f7fd7e62>] ? drm_fb_helper_initial_config+0x466/0x497 [drm_kms_helper]
+[ 6033.229012] [<f7fd7ea3>] ? drm_fb_helper_restore+0x10/0x2a [drm_kms_helper]
+[ 6033.229012] [<f86f2577>] ? i915_driver_lastclose+0x2a/0x57 [i915]
+[ 6033.229012] [<f7f1989f>] ? drm_lastclose+0x45/0x23e [drm]
+[ 6033.229012] [<f7f1a0b4>] ? drm_release+0x462/0x4d7 [drm]
+
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/drm_crtc_helper.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/drm_crtc_helper.c
++++ b/drivers/gpu/drm/drm_crtc_helper.c
+@@ -650,6 +650,7 @@ int drm_crtc_helper_set_config(struct dr
+ old_fb)) {
+ DRM_ERROR("failed to set mode on [CRTC:%d]\n",
+ set->crtc->base.id);
++ set->crtc->fb = old_fb;
+ ret = -EINVAL;
+ goto fail;
+ }
+@@ -664,8 +665,10 @@ int drm_crtc_helper_set_config(struct dr
+ set->crtc->fb = set->fb;
+ ret = crtc_funcs->mode_set_base(set->crtc,
+ set->x, set->y, old_fb);
+- if (ret != 0)
++ if (ret != 0) {
++ set->crtc->fb = old_fb;
+ goto fail;
++ }
+ }
+ DRM_DEBUG_KMS("Setting connector DPMS state to on\n");
+ for (i = 0; i < set->num_connectors; i++) {
drm-radeon-remove-0x4243-pci-id.patch
drm-radeon-kms-evergreen-always-set-certain-vgt-regs-at-cp-init.patch
drm-radeon-kms-fix-s-r-issues-with-bios-scratch-regs.patch
+drm-restore-the-old_fb-upon-modeset-failure.patch
+drm-i915-check-edp-encoder-correctly-when-setting-modes.patch
+drm-i915-sdvo-defer-detection-of-output-capabilities-until-probing.patch
+drm-i915-crt-check-for-a-analog-monitor-in-case-of-dvi-i.patch
+drm-i915-fix-calculation-of-edp-signal-levels-on-sandybridge.patch
+drm-i915-panel-only-record-the-backlight-level-when-it-is-enabled.patch
+drm-i915-panel-the-backlight-is-enabled-if-the-current-value-is-non-zero.patch
+drm-i915-lvds-add-aopen-i915gmm-hfs-to-the-list-of-false-positive-lvds.patch
+drm-i915-add-dependency-on-config_tmpfs.patch
+drm-i915-recognise-non-vga-display-devices.patch
+x86-mm-avoid-possible-bogus-tlb-entries-by-clearing-prev-mm_cpumask-after-switching-mm.patch
--- /dev/null
+From 831d52bc153971b70e64eccfbed2b232394f22f8 Mon Sep 17 00:00:00 2001
+From: Suresh Siddha <suresh.b.siddha@intel.com>
+Date: Thu, 3 Feb 2011 12:20:04 -0800
+Subject: x86, mm: avoid possible bogus tlb entries by clearing prev mm_cpumask after switching mm
+
+From: Suresh Siddha <suresh.b.siddha@intel.com>
+
+commit 831d52bc153971b70e64eccfbed2b232394f22f8 upstream.
+
+Clearing the cpu in prev's mm_cpumask early will avoid the flush tlb
+IPI's while the cr3 is still pointing to the prev mm. And this window
+can lead to the possibility of bogus TLB fills resulting in strange
+failures. One such problematic scenario is mentioned below.
+
+ T1. CPU-1 is context switching from mm1 to mm2 context and got a NMI
+ etc between the point of clearing the cpu from the mm_cpumask(mm1)
+ and before reloading the cr3 with the new mm2.
+
+ T2. CPU-2 is tearing down a specific vma for mm1 and will proceed with
+ flushing the TLB for mm1. It doesn't send the flush TLB to CPU-1
+ as it doesn't see that cpu listed in the mm_cpumask(mm1).
+
+ T3. After the TLB flush is complete, CPU-2 goes ahead and frees the
+ page-table pages associated with the removed vma mapping.
+
+ T4. CPU-2 now allocates those freed page-table pages for something
+ else.
+
+ T5. As the CR3 and TLB caches for mm1 is still active on CPU-1, CPU-1
+ can potentially speculate and walk through the page-table caches
+ and can insert new TLB entries. As the page-table pages are
+ already freed and being used on CPU-2, this page walk can
+ potentially insert a bogus global TLB entry depending on the
+ (random) contents of the page that is being used on CPU-2.
+
+ T6. This bogus TLB entry being global will be active across future CR3
+ changes and can result in weird memory corruption etc.
+
+To avoid this issue, for the prev mm that is handing over the cpu to
+another mm, clear the cpu from the mm_cpumask(prev) after the cr3 is
+changed.
+
+Marking it for -stable, though we haven't seen any reported failure that
+can be attributed to this.
+
+Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
+Acked-by: Ingo Molnar <mingo@elte.hu>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/x86/include/asm/mmu_context.h | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+--- a/arch/x86/include/asm/mmu_context.h
++++ b/arch/x86/include/asm/mmu_context.h
+@@ -36,8 +36,6 @@ static inline void switch_mm(struct mm_s
+ unsigned cpu = smp_processor_id();
+
+ if (likely(prev != next)) {
+- /* stop flush ipis for the previous mm */
+- cpumask_clear_cpu(cpu, mm_cpumask(prev));
+ #ifdef CONFIG_SMP
+ percpu_write(cpu_tlbstate.state, TLBSTATE_OK);
+ percpu_write(cpu_tlbstate.active_mm, next);
+@@ -47,6 +45,9 @@ static inline void switch_mm(struct mm_s
+ /* Re-load page tables */
+ load_cr3(next->pgd);
+
++ /* stop flush ipis for the previous mm */
++ cpumask_clear_cpu(cpu, mm_cpumask(prev));
++
+ /*
+ * load the LDT, if the LDT is different:
+ */