--- /dev/null
+From bd2f21ebab93af5cc4eb2aaff409aa938dcca11b Mon Sep 17 00:00:00 2001
+From: Egbert Eich <eich@suse.de>
+Date: Sun, 14 Oct 2012 15:46:38 +0200
+Subject: DRM/i915: Add QUIRK_INVERT_BRIGHTNESS for NCR machines.
+
+From: Egbert Eich <eich@suse.de>
+
+commit 5f85f176c2f1c9d2a23f60ca0b99e4d0aa5a26a7 upstream.
+
+NCR machines with LVDS panels using Intel chipsets need to have the
+QUIRK_INVERT_BRIGHTNESS bit set.
+Unfortunately NCR doesn't set a meaningful subvendor/subdevice ID,
+therefore we add a DMI dependent quirk list.
+
+Signed-off-by: Egbert Eich <eich@suse.de>
+[danvet: fixup whitespace fail.]
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Acked-by: Jani Nikula <jani.nikula@intel.com>
+[bwh: Backported to 3.2:
+ - Adjust context
+ - Add #include <linux/dmi.h>]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/intel_display.c | 33 +++++++++++++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+--- a/drivers/gpu/drm/i915/intel_display.c
++++ b/drivers/gpu/drm/i915/intel_display.c
+@@ -25,6 +25,7 @@
+ */
+
+ #include <linux/cpufreq.h>
++#include <linux/dmi.h>
+ #include <linux/module.h>
+ #include <linux/input.h>
+ #include <linux/i2c.h>
+@@ -9217,6 +9218,34 @@ struct intel_quirk {
+ void (*hook)(struct drm_device *dev);
+ };
+
++/* For systems that don't have a meaningful PCI subdevice/subvendor ID */
++struct intel_dmi_quirk {
++ void (*hook)(struct drm_device *dev);
++ const struct dmi_system_id (*dmi_id_list)[];
++};
++
++static int intel_dmi_reverse_brightness(const struct dmi_system_id *id)
++{
++ DRM_INFO("Backlight polarity reversed on %s\n", id->ident);
++ return 1;
++}
++
++static const struct intel_dmi_quirk intel_dmi_quirks[] = {
++ {
++ .dmi_id_list = &(const struct dmi_system_id[]) {
++ {
++ .callback = intel_dmi_reverse_brightness,
++ .ident = "NCR Corporation",
++ .matches = {DMI_MATCH(DMI_SYS_VENDOR, "NCR Corporation"),
++ DMI_MATCH(DMI_PRODUCT_NAME, ""),
++ },
++ },
++ { } /* terminating entry */
++ },
++ .hook = quirk_invert_brightness,
++ },
++};
++
+ struct intel_quirk intel_quirks[] = {
+ /* HP Mini needs pipe A force quirk (LP: #322104) */
+ { 0x27ae, 0x103c, 0x361a, quirk_pipea_force },
+@@ -9276,6 +9305,10 @@ static void intel_init_quirks(struct drm
+ q->subsystem_device == PCI_ANY_ID))
+ q->hook(dev);
+ }
++ for (i = 0; i < ARRAY_SIZE(intel_dmi_quirks); i++) {
++ if (dmi_check_system(*intel_dmi_quirks[i].dmi_id_list) != 0)
++ intel_dmi_quirks[i].hook(dev);
++ }
+ }
+
+ /* Disable the VGA plane that we never use */
--- /dev/null
+From 19c42ce9869ff30f43a08fb774d08f35b92b5ff6 Mon Sep 17 00:00:00 2001
+From: Jani Nikula <jani.nikula@intel.com>
+Date: Fri, 12 Apr 2013 15:18:38 +0300
+Subject: drm/i915: ensure single initialization and cleanup of backlight device
+
+From: Jani Nikula <jani.nikula@intel.com>
+
+commit dc652f90e088798bfa31f496ba994ddadd5d5680 upstream.
+
+Backlight cleanup in the eDP connector destroy callback caused the
+backlight device to be removed on some systems that first initialized LVDS
+and then attempted to initialize eDP. Prevent multiple backlight
+initializations, and ensure backlight cleanup is only done once by moving
+it to modeset cleanup.
+
+A small wrinkle is the introduced asymmetry in backlight
+setup/cleanup. This could be solved by adding refcounting, but it seems
+overkill considering that there should only ever be one backlight device.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=55701
+Signed-off-by: Jani Nikula <jani.nikula@intel.com>
+Tested-by: Peter Verthez <peter.verthez@skynet.be>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+[bwh: Backported to 3.2:
+ - Adjust context
+ - s/dev_priv->backlight\.device/dev_priv->backlight/]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/intel_display.c | 3 +++
+ drivers/gpu/drm/i915/intel_dp.c | 5 -----
+ drivers/gpu/drm/i915/intel_lvds.c | 2 --
+ drivers/gpu/drm/i915/intel_panel.c | 7 ++++++-
+ 4 files changed, 9 insertions(+), 8 deletions(-)
+
+--- a/drivers/gpu/drm/i915/intel_display.c
++++ b/drivers/gpu/drm/i915/intel_display.c
+@@ -9471,6 +9471,9 @@ void intel_modeset_cleanup(struct drm_de
+ del_timer_sync(&dev_priv->idle_timer);
+ cancel_work_sync(&dev_priv->idle_work);
+
++ /* destroy backlight, if any, before the connectors */
++ intel_panel_destroy_backlight(dev);
++
+ drm_mode_config_cleanup(dev);
+ }
+
+--- a/drivers/gpu/drm/i915/intel_dp.c
++++ b/drivers/gpu/drm/i915/intel_dp.c
+@@ -2289,11 +2289,6 @@ done:
+ static void
+ intel_dp_destroy(struct drm_connector *connector)
+ {
+- struct drm_device *dev = connector->dev;
+-
+- if (intel_dpd_is_edp(dev))
+- intel_panel_destroy_backlight(dev);
+-
+ drm_sysfs_connector_remove(connector);
+ drm_connector_cleanup(connector);
+ kfree(connector);
+--- a/drivers/gpu/drm/i915/intel_lvds.c
++++ b/drivers/gpu/drm/i915/intel_lvds.c
+@@ -553,8 +553,6 @@ static void intel_lvds_destroy(struct dr
+ struct drm_device *dev = connector->dev;
+ struct drm_i915_private *dev_priv = dev->dev_private;
+
+- intel_panel_destroy_backlight(dev);
+-
+ if (dev_priv->lid_notifier.notifier_call)
+ acpi_lid_notifier_unregister(&dev_priv->lid_notifier);
+ drm_sysfs_connector_remove(connector);
+--- a/drivers/gpu/drm/i915/intel_panel.c
++++ b/drivers/gpu/drm/i915/intel_panel.c
+@@ -359,6 +359,9 @@ int intel_panel_setup_backlight(struct d
+
+ intel_panel_init_backlight(dev);
+
++ if (WARN_ON(dev_priv->backlight))
++ return -ENODEV;
++
+ if (dev_priv->int_lvds_connector)
+ connector = dev_priv->int_lvds_connector;
+ else if (dev_priv->int_edp_connector)
+@@ -386,8 +389,10 @@ int intel_panel_setup_backlight(struct d
+ void intel_panel_destroy_backlight(struct drm_device *dev)
+ {
+ struct drm_i915_private *dev_priv = dev->dev_private;
+- if (dev_priv->backlight)
++ if (dev_priv->backlight) {
+ backlight_device_unregister(dev_priv->backlight);
++ dev_priv->backlight = NULL;
++ }
+ }
+ #else
+ int intel_panel_setup_backlight(struct drm_device *dev)
--- /dev/null
+From fbeecda256bab53034d5a7f0c79c2f99219ce7c3 Mon Sep 17 00:00:00 2001
+From: Jani Nikula <jani.nikula@intel.com>
+Date: Fri, 23 Aug 2013 10:50:39 +0300
+Subject: drm/i915: try not to lose backlight CBLV precision
+
+From: Jani Nikula <jani.nikula@intel.com>
+
+commit cac6a5ae0118832936eb162ec4cedb30f2422bcc upstream.
+
+ACPI has _BCM and _BQC methods to set and query the backlight
+brightness, respectively. The ACPI opregion has variables BCLP and CBLV
+to hold the requested and current backlight brightness, respectively.
+
+The BCLP variable has range 0..255 while the others have range
+0..100. This means the _BCM method has to scale the brightness for BCLP,
+and the gfx driver has to scale the requested value back for CBLV. If
+the _BQC method uses the CBLV variable (apparently some implementations
+do, some don't) for current backlight level reporting, there's room for
+rounding errors.
+
+Use DIV_ROUND_UP for scaling back to CBLV to get back to the same values
+that were passed to _BCM, presuming the _BCM simply uses bclp = (in *
+255) / 100 for scaling to BCLP.
+
+Reference: https://gist.github.com/aaronlu/6314920
+Reported-by: Aaron Lu <aaron.lu@intel.com>
+Signed-off-by: Jani Nikula <jani.nikula@intel.com>
+Reviewed-by: Aaron Lu <aaron.lu@intel.com>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+[bwh: Backported to 3.2:
+ - Adjust context
+ - ASLE region is treated as normal memory rather than __iomem]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/intel_opregion.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/i915/intel_opregion.c
++++ b/drivers/gpu/drm/i915/intel_opregion.c
+@@ -161,7 +161,7 @@ static u32 asle_set_backlight(struct drm
+
+ max = intel_panel_get_max_backlight(dev);
+ intel_panel_set_backlight(dev, bclp * max / 255);
+- asle->cblv = (bclp*0x64)/0xff | ASLE_CBLV_VALID;
++ asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID;
+
+ return 0;
+ }
--- /dev/null
+From 0bdb6ae5a6447214693e9de94df3611cea80357a Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Thu, 4 Apr 2013 21:31:03 +0100
+Subject: drm/i915: Workaround incoherence between fences and LLC across multiple CPUs
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 25ff1195f8a0b3724541ae7bbe331b4296de9c06 upstream.
+
+In order to fully serialize access to the fenced region and the update
+to the fence register we need to take extreme measures on SNB+, and
+manually flush writes to memory prior to writing the fence register in
+conjunction with the memory barriers placed around the register write.
+
+Fixes i-g-t/gem_fence_thrash
+
+v2: Bring a bigger gun
+v3: Switch the bigger gun for heavier bullets (Arjan van de Ven)
+v4: Remove changes for working generations.
+v5: Reduce to a per-cpu wbinvd() call prior to updating the fences.
+v6: Rewrite comments to ellide forgotten history.
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62191
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Jon Bloomfield <jon.bloomfield@intel.com>
+Tested-by: Jon Bloomfield <jon.bloomfield@intel.com> (v2)
+Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+[bwh: Backported to 3.2: insert the cache flush in i915_gem_object_get_fence()]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/i915_gem.c | 16 ++++++++++++++++
+ 1 file changed, 16 insertions(+)
+
+--- a/drivers/gpu/drm/i915/i915_gem.c
++++ b/drivers/gpu/drm/i915/i915_gem.c
+@@ -2468,6 +2468,11 @@ i915_find_fence_reg(struct drm_device *d
+ return avail;
+ }
+
++static void i915_gem_write_fence__ipi(void *data)
++{
++ wbinvd();
++}
++
+ /**
+ * i915_gem_object_get_fence - set up a fence reg for an object
+ * @obj: object to map through a fence reg
+@@ -2589,6 +2594,17 @@ update:
+ switch (INTEL_INFO(dev)->gen) {
+ case 7:
+ case 6:
++ /* In order to fully serialize access to the fenced region and
++ * the update to the fence register we need to take extreme
++ * measures on SNB+. In theory, the write to the fence register
++ * flushes all memory transactions before, and coupled with the
++ * mb() placed around the register write we serialise all memory
++ * operations with respect to the changes in the tiler. Yet, on
++ * SNB+ we need to take a step further and emit an explicit wbinvd()
++ * on each processor in order to manually flush all memory
++ * transactions before updating the fence register.
++ */
++ on_each_cpu(i915_gem_write_fence__ipi, NULL, 1);
+ ret = sandybridge_write_fence_reg(obj, pipelined);
+ break;
+ case 5:
--- /dev/null
+From 2afe1a102cd3962ed4ec683128765fd33a4ab666 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Wed, 16 Oct 2013 09:49:02 +0100
+Subject: drm: Pad drm_mode_get_connector to 64-bit boundary
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit bc5bd37ce48c66e9192ad2e7231e9678880f6f8e upstream.
+
+Pavel Roskin reported that DRM_IOCTL_MODE_GETCONNECTOR was overwritting
+the 4 bytes beyond the end of its structure with a 32-bit userspace
+running on a 64-bit kernel. This is due to the padding gcc inserts as
+the drm_mode_get_connector struct includes a u64 and its size is not a
+natural multiple of u64s.
+
+64-bit kernel:
+
+sizeof(drm_mode_get_connector)=80, alignof=8
+sizeof(drm_mode_get_encoder)=20, alignof=4
+sizeof(drm_mode_modeinfo)=68, alignof=4
+
+32-bit userspace:
+
+sizeof(drm_mode_get_connector)=76, alignof=4
+sizeof(drm_mode_get_encoder)=20, alignof=4
+sizeof(drm_mode_modeinfo)=68, alignof=4
+
+Fortuituously we can insert explicit padding to the tail of our
+structures without breaking ABI.
+
+Reported-by: Pavel Roskin <proski@gnu.org>
+Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
+Cc: Dave Airlie <airlied@redhat.com>
+Cc: dri-devel@lists.freedesktop.org
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+[bwh: Backported to 3.2: adjust filename]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/drm/drm_mode.h | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/include/drm/drm_mode.h
++++ b/include/drm/drm_mode.h
+@@ -223,6 +223,8 @@ struct drm_mode_get_connector {
+ __u32 connection;
+ __u32 mm_width, mm_height; /**< HxW in millimeters */
+ __u32 subpixel;
++
++ __u32 pad;
+ };
+
+ #define DRM_MODE_PROP_PENDING (1<<0)
--- /dev/null
+From b8aea41ad64a7f527702e0296594a52ab77dce7c Mon Sep 17 00:00:00 2001
+From: Ondrej Zary <linux@rainbow-software.org>
+Date: Fri, 19 Jul 2013 21:08:48 +0200
+Subject: drm/radeon: Another card with wrong primary dac adj
+
+From: Ondrej Zary <linux@rainbow-software.org>
+
+commit f7929f34fa0e0bb6736a2484fdc07d77a1653081 upstream.
+
+Hello,
+got another card with "too bright" problem:
+Sapphire Radeon VE 7000 DDR (VGA+S-Video)
+
+lspci -vnn:
+01:00.0 VGA compatible controller [0300]: Advanced Micro Devices [AMD] nee ATI RV100 QY [Radeon 7000/VE] [1002:5159] (prog-if 00 [VGA controller])
+ Subsystem: PC Partner Limited Sapphire Radeon VE 7000 DDR [174b:7c28]
+
+The patch below fixes the problem for this card.
+But I don't like the blacklist, couldn't some heuristic be used instead?
+The interesting thing is that the manufacturer is the same as the other card
+needing the same quirk. I wonder how many different types are broken this way.
+
+The "wrong" ps2_pdac_adj value that comes from BIOS on this card is 0x300.
+
+====================
+drm/radeon: Add primary dac adj quirk for Sapphire Radeon VE 7000 DDR
+
+Values from BIOS are wrong, causing too bright colors.
+Use default values instead.
+
+Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/radeon/radeon_combios.c | 8 ++++++--
+ 1 file changed, 6 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/radeon_combios.c
++++ b/drivers/gpu/drm/radeon/radeon_combios.c
+@@ -898,10 +898,14 @@ struct radeon_encoder_primary_dac *radeo
+ }
+
+ /* quirks */
++ /* Radeon 7000 (RV100) */
++ if (((dev->pdev->device == 0x5159) &&
++ (dev->pdev->subsystem_vendor == 0x174B) &&
++ (dev->pdev->subsystem_device == 0x7c28)) ||
+ /* Radeon 9100 (R200) */
+- if ((dev->pdev->device == 0x514D) &&
++ ((dev->pdev->device == 0x514D) &&
+ (dev->pdev->subsystem_vendor == 0x174B) &&
+- (dev->pdev->subsystem_device == 0x7149)) {
++ (dev->pdev->subsystem_device == 0x7149))) {
+ /* vbios value is bad, use the default */
+ found = 0;
+ }
--- /dev/null
+From 4b8fefaee7a9d4ae9583328d03fd796e1933569e Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Fri, 12 Apr 2013 19:15:52 -0400
+Subject: drm/radeon: cleanup properly if mmio mapping fails
+
+From: Alex Deucher <alexander.deucher@amd.com>
+
+commit 0cd9cb76ae26a19df21abc6f94f5fff141e689c7 upstream.
+
+If we fail to map the mmio BAR, skip driver tear down
+that requires mmio.
+
+Should fix:
+https://bugzilla.kernel.org/show_bug.cgi?id=56541
+
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/radeon/radeon_kms.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/drivers/gpu/drm/radeon/radeon_kms.c
++++ b/drivers/gpu/drm/radeon/radeon_kms.c
+@@ -39,8 +39,12 @@ int radeon_driver_unload_kms(struct drm_
+
+ if (rdev == NULL)
+ return 0;
++ if (rdev->rmmio == NULL)
++ goto done_free;
+ radeon_modeset_fini(rdev);
+ radeon_device_fini(rdev);
++
++done_free:
+ kfree(rdev);
+ dev->dev_private = NULL;
+ return 0;
--- /dev/null
+From b8f6513652249d566a4c7b6feaf13eee789ccd7a Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Fri, 13 Sep 2013 18:33:16 -0400
+Subject: drm/radeon: fix panel scaling with eDP and LVDS bridges
+
+From: Alex Deucher <alexander.deucher@amd.com>
+
+commit 855f5f1d882a34e4e9dd27b299737cd3508a5624 upstream.
+
+We were using the wrong set_properly callback so we always
+ended up with Full scaling even if something else (Center or
+Full aspect) was selected.
+
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/radeon/radeon_connectors.c | 34 ++++++++++++++++++++++++++---
+ 1 file changed, 31 insertions(+), 3 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/radeon_connectors.c
++++ b/drivers/gpu/drm/radeon/radeon_connectors.c
+@@ -1423,6 +1423,24 @@ struct drm_connector_funcs radeon_dp_con
+ .force = radeon_dvi_force,
+ };
+
++static const struct drm_connector_funcs radeon_edp_connector_funcs = {
++ .dpms = drm_helper_connector_dpms,
++ .detect = radeon_dp_detect,
++ .fill_modes = drm_helper_probe_single_connector_modes,
++ .set_property = radeon_lvds_set_property,
++ .destroy = radeon_dp_connector_destroy,
++ .force = radeon_dvi_force,
++};
++
++static const struct drm_connector_funcs radeon_lvds_bridge_connector_funcs = {
++ .dpms = drm_helper_connector_dpms,
++ .detect = radeon_dp_detect,
++ .fill_modes = drm_helper_probe_single_connector_modes,
++ .set_property = radeon_lvds_set_property,
++ .destroy = radeon_dp_connector_destroy,
++ .force = radeon_dvi_force,
++};
++
+ void
+ radeon_add_atom_connector(struct drm_device *dev,
+ uint32_t connector_id,
+@@ -1514,8 +1532,6 @@ radeon_add_atom_connector(struct drm_dev
+ goto failed;
+ radeon_dig_connector->igp_lane_info = igp_lane_info;
+ radeon_connector->con_priv = radeon_dig_connector;
+- drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type);
+- drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs);
+ if (i2c_bus->valid) {
+ /* add DP i2c bus */
+ if (connector_type == DRM_MODE_CONNECTOR_eDP)
+@@ -1532,6 +1548,10 @@ radeon_add_atom_connector(struct drm_dev
+ case DRM_MODE_CONNECTOR_VGA:
+ case DRM_MODE_CONNECTOR_DVIA:
+ default:
++ drm_connector_init(dev, &radeon_connector->base,
++ &radeon_dp_connector_funcs, connector_type);
++ drm_connector_helper_add(&radeon_connector->base,
++ &radeon_dp_connector_helper_funcs);
+ connector->interlace_allowed = true;
+ connector->doublescan_allowed = true;
+ radeon_connector->dac_load_detect = true;
+@@ -1544,6 +1564,10 @@ radeon_add_atom_connector(struct drm_dev
+ case DRM_MODE_CONNECTOR_HDMIA:
+ case DRM_MODE_CONNECTOR_HDMIB:
+ case DRM_MODE_CONNECTOR_DisplayPort:
++ drm_connector_init(dev, &radeon_connector->base,
++ &radeon_dp_connector_funcs, connector_type);
++ drm_connector_helper_add(&radeon_connector->base,
++ &radeon_dp_connector_helper_funcs);
+ drm_connector_attach_property(&radeon_connector->base,
+ rdev->mode_info.underscan_property,
+ UNDERSCAN_OFF);
+@@ -1568,6 +1592,10 @@ radeon_add_atom_connector(struct drm_dev
+ break;
+ case DRM_MODE_CONNECTOR_LVDS:
+ case DRM_MODE_CONNECTOR_eDP:
++ drm_connector_init(dev, &radeon_connector->base,
++ &radeon_lvds_bridge_connector_funcs, connector_type);
++ drm_connector_helper_add(&radeon_connector->base,
++ &radeon_dp_connector_helper_funcs);
+ drm_connector_attach_property(&radeon_connector->base,
+ dev->mode_config.scaling_mode_property,
+ DRM_MODE_SCALE_FULLSCREEN);
+@@ -1731,7 +1759,7 @@ radeon_add_atom_connector(struct drm_dev
+ goto failed;
+ radeon_dig_connector->igp_lane_info = igp_lane_info;
+ radeon_connector->con_priv = radeon_dig_connector;
+- drm_connector_init(dev, &radeon_connector->base, &radeon_dp_connector_funcs, connector_type);
++ drm_connector_init(dev, &radeon_connector->base, &radeon_edp_connector_funcs, connector_type);
+ drm_connector_helper_add(&radeon_connector->base, &radeon_dp_connector_helper_funcs);
+ if (i2c_bus->valid) {
+ /* add DP i2c bus */
--- /dev/null
+From 9ba240246fdb384fa1bd80a5b7528101e47d9bb8 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexander.deucher@amd.com>
+Date: Mon, 1 Apr 2013 16:06:25 -0400
+Subject: drm/radeon: use frac fb div on RS780/RS880
+
+From: Alex Deucher <alexander.deucher@amd.com>
+
+commit 411678288d61ba17afe1f8afed92200be6bbc65d upstream.
+
+Monitors seem to prefer it. Fixes:
+https://bugs.freedesktop.org/show_bug.cgi?id=37696
+
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+[bwh: Backported to 3.2:
+ - Adjust context
+ - Add to pll->flags, not radeon_crtc->pll_flags]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/radeon/atombios_crtc.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/gpu/drm/radeon/atombios_crtc.c
++++ b/drivers/gpu/drm/radeon/atombios_crtc.c
+@@ -573,6 +573,9 @@ static u32 atombios_adjust_pll(struct dr
+ /* use frac fb div on APUs */
+ if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE61(rdev))
+ pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV;
++ /* use frac fb div on RS780/RS880 */
++ if ((rdev->family == CHIP_RS780) || (rdev->family == CHIP_RS880))
++ pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV;
+ if (ASIC_IS_DCE32(rdev) && mode->clock > 165000)
+ pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV;
+ } else {
--- /dev/null
+From d81980f44bbc6e82d978e03258ab487a2d4e8057 Mon Sep 17 00:00:00 2001
+From: Thomas Hellstrom <thellstrom@vmware.com>
+Date: Mon, 28 Oct 2013 02:02:19 -0700
+Subject: drm/ttm: Fix memory type compatibility check
+
+From: Thomas Hellstrom <thellstrom@vmware.com>
+
+commit 59c8e66378fb78adbcd05f0d09783dde6fef282b upstream.
+
+Also check the busy placements before deciding to move a buffer object.
+Failing to do this may result in a completely unneccessary move within a
+single memory type.
+
+Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com>
+Reviewed-by: Jakob Bornecrantz <jakob@vmware.com>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/ttm/ttm_bo.c | 32 ++++++++++++++++++++------------
+ 1 file changed, 20 insertions(+), 12 deletions(-)
+
+--- a/drivers/gpu/drm/ttm/ttm_bo.c
++++ b/drivers/gpu/drm/ttm/ttm_bo.c
+@@ -1091,24 +1091,32 @@ out_unlock:
+ return ret;
+ }
+
+-static int ttm_bo_mem_compat(struct ttm_placement *placement,
+- struct ttm_mem_reg *mem)
++static bool ttm_bo_mem_compat(struct ttm_placement *placement,
++ struct ttm_mem_reg *mem,
++ uint32_t *new_flags)
+ {
+ int i;
+
+ if (mem->mm_node && placement->lpfn != 0 &&
+ (mem->start < placement->fpfn ||
+ mem->start + mem->num_pages > placement->lpfn))
+- return -1;
++ return false;
+
+ for (i = 0; i < placement->num_placement; i++) {
+- if ((placement->placement[i] & mem->placement &
+- TTM_PL_MASK_CACHING) &&
+- (placement->placement[i] & mem->placement &
+- TTM_PL_MASK_MEM))
+- return i;
++ *new_flags = placement->placement[i];
++ if ((*new_flags & mem->placement & TTM_PL_MASK_CACHING) &&
++ (*new_flags & mem->placement & TTM_PL_MASK_MEM))
++ return true;
+ }
+- return -1;
++
++ for (i = 0; i < placement->num_busy_placement; i++) {
++ *new_flags = placement->busy_placement[i];
++ if ((*new_flags & mem->placement & TTM_PL_MASK_CACHING) &&
++ (*new_flags & mem->placement & TTM_PL_MASK_MEM))
++ return true;
++ }
++
++ return false;
+ }
+
+ int ttm_bo_validate(struct ttm_buffer_object *bo,
+@@ -1117,6 +1125,7 @@ int ttm_bo_validate(struct ttm_buffer_ob
+ bool no_wait_gpu)
+ {
+ int ret;
++ uint32_t new_flags;
+
+ BUG_ON(!atomic_read(&bo->reserved));
+ /* Check that range is valid */
+@@ -1127,8 +1136,7 @@ int ttm_bo_validate(struct ttm_buffer_ob
+ /*
+ * Check whether we need to move buffer.
+ */
+- ret = ttm_bo_mem_compat(placement, &bo->mem);
+- if (ret < 0) {
++ if (!ttm_bo_mem_compat(placement, &bo->mem, &new_flags)) {
+ ret = ttm_bo_move_buffer(bo, placement, interruptible, no_wait_reserve, no_wait_gpu);
+ if (ret)
+ return ret;
+@@ -1137,7 +1145,7 @@ int ttm_bo_validate(struct ttm_buffer_ob
+ * Use the access and other non-mapping-related flag bits from
+ * the compatible memory placement flags to the active flags
+ */
+- ttm_flag_masked(&bo->mem.placement, placement->placement[ret],
++ ttm_flag_masked(&bo->mem.placement, new_flags,
+ ~TTM_PL_MASK_MEMTYPE);
+ }
+ /*
drm-i915-add-quirk-to-invert-brightness-on-emachines-g725.patch
drm-i915-add-quirk-to-invert-brightness-on-emachines-e725.patch
drm-i915-add-quirk-to-invert-brightness-on-packard-bell-ncl20.patch
+drm-i915-add-quirk_invert_brightness-for-ncr-machines.patch
+drm-radeon-use-frac-fb-div-on-rs780-rs880.patch
+drm-radeon-cleanup-properly-if-mmio-mapping-fails.patch
+drm-i915-workaround-incoherence-between-fences-and-llc-across-multiple-cpus.patch
+drm-i915-ensure-single-initialization-and-cleanup-of-backlight-device.patch
+drm-radeon-another-card-with-wrong-primary-dac-adj.patch
+drm-i915-try-not-to-lose-backlight-cblv-precision.patch
+drm-radeon-fix-panel-scaling-with-edp-and-lvds-bridges.patch
+drm-pad-drm_mode_get_connector-to-64-bit-boundary.patch
+drm-ttm-fix-memory-type-compatibility-check.patch