--- /dev/null
+From 4f444e2b59dd4255d121b57ec41a4a8c5d6bce46 Mon Sep 17 00:00:00 2001
+From: Jochen Friedrich <jochen@scram.de>
+Date: Mon, 3 Jan 2011 12:09:05 +0100
+Subject: ARM: 6606/1: sa1100: Fix platform device registration
+
+From: Jochen Friedrich <jochen@scram.de>
+
+commit 4f444e2b59dd4255d121b57ec41a4a8c5d6bce46 upstream.
+
+Since commit 7a5b4e16c880f8350d255dc188f81622905618c1, simpad devices don't
+boot anymore, since platform devices are registered too early. Fix by moving
+the registration from map_io to arch_initcall as done on other sa1100 boards.
+
+Signed-off-by: Jochen Friedrich <jochen@scram.de>
+Acked-by: Kristoffer Ericson <kristoffer.ericson@gmail.com>
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ arch/arm/mach-sa1100/simpad.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/arch/arm/mach-sa1100/simpad.c
++++ b/arch/arm/mach-sa1100/simpad.c
+@@ -166,9 +166,6 @@ static void __init simpad_map_io(void)
+ PCFR = 0;
+ PSDR = 0;
+
+- sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
+- ARRAY_SIZE(simpad_flash_resources));
+- sa11x0_register_mcp(&simpad_mcp_data);
+ }
+
+ static void simpad_power_off(void)
+@@ -216,6 +213,10 @@ static int __init simpad_init(void)
+
+ pm_power_off = simpad_power_off;
+
++ sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
++ ARRAY_SIZE(simpad_flash_resources));
++ sa11x0_register_mcp(&simpad_mcp_data);
++
+ ret = platform_add_devices(devices, ARRAY_SIZE(devices));
+ if(ret)
+ printk(KERN_WARNING "simpad: Unable to register mq200 framebuffer device");
--- /dev/null
+From 139467433e50926d22338e9dc754feaaf94b9db0 Mon Sep 17 00:00:00 2001
+From: Chris Wilson <chris@chris-wilson.co.uk>
+Date: Wed, 9 Feb 2011 20:01:16 +0000
+Subject: drm/i915/sdvo: If we have an EDID confirm it matches the mode of the connection
+
+From: Chris Wilson <chris@chris-wilson.co.uk>
+
+commit 139467433e50926d22338e9dc754feaaf94b9db0 upstream.
+
+If we have an EDID for a digital panel, but we are probing a non-TMDS
+connector then we know that this is a false detection, and vice versa.
+This should reduce the number of bogus outputs on multi-function
+adapters that report the same output on multiple connectors.
+
+Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=34101
+Reported-by: Sebastien Caty <sebastien.caty@mrnf.gouv.qc.ca>
+Tested-by: Sebastien Caty <sebastien.caty@mrnf.gouv.qc.ca>
+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 | 32 +++++++++++++++++++++++++++-----
+ 1 file changed, 27 insertions(+), 5 deletions(-)
+
+--- a/drivers/gpu/drm/i915/intel_sdvo.c
++++ b/drivers/gpu/drm/i915/intel_sdvo.c
+@@ -46,6 +46,7 @@
+ SDVO_TV_MASK)
+
+ #define IS_TV(c) (c->output_flag & SDVO_TV_MASK)
++#define IS_TMDS(c) (c->output_flag & SDVO_TMDS_MASK)
+ #define IS_LVDS(c) (c->output_flag & SDVO_LVDS_MASK)
+ #define IS_TV_OR_LVDS(c) (c->output_flag & (SDVO_TV_MASK | SDVO_LVDS_MASK))
+
+@@ -1356,7 +1357,8 @@ intel_sdvo_hdmi_sink_detect(struct drm_c
+ intel_sdvo->has_hdmi_monitor = drm_detect_hdmi_monitor(edid);
+ intel_sdvo->has_hdmi_audio = drm_detect_monitor_audio(edid);
+ }
+- }
++ } else
++ status = connector_status_disconnected;
+ connector->display_info.raw_edid = NULL;
+ kfree(edid);
+ }
+@@ -1404,10 +1406,25 @@ intel_sdvo_detect(struct drm_connector *
+
+ if ((intel_sdvo_connector->output_flag & response) == 0)
+ ret = connector_status_disconnected;
+- else if (response & SDVO_TMDS_MASK)
++ else if (IS_TMDS(intel_sdvo_connector))
+ ret = intel_sdvo_hdmi_sink_detect(connector);
+- else
+- ret = connector_status_connected;
++ else {
++ struct edid *edid;
++
++ /* if we have an edid check it matches the connection */
++ edid = intel_sdvo_get_edid(connector);
++ if (edid == NULL)
++ edid = intel_sdvo_get_analog_edid(connector);
++ if (edid != NULL) {
++ if (edid->input & DRM_EDID_INPUT_DIGITAL)
++ ret = connector_status_disconnected;
++ else
++ ret = connector_status_connected;
++ connector->display_info.raw_edid = NULL;
++ kfree(edid);
++ } else
++ ret = connector_status_connected;
++ }
+
+ /* May update encoder flag for like clock for SDVO TV, etc.*/
+ if (ret == connector_status_connected) {
+@@ -1443,10 +1460,15 @@ static void intel_sdvo_get_ddc_modes(str
+ edid = intel_sdvo_get_analog_edid(connector);
+
+ if (edid != NULL) {
+- if (edid->input & DRM_EDID_INPUT_DIGITAL) {
++ struct intel_sdvo_connector *intel_sdvo_connector = to_intel_sdvo_connector(connector);
++ bool monitor_is_digital = !!(edid->input & DRM_EDID_INPUT_DIGITAL);
++ bool connector_is_digital = !!IS_TMDS(intel_sdvo_connector);
++
++ if (connector_is_digital == monitor_is_digital) {
+ drm_mode_connector_update_edid_property(connector, edid);
+ drm_add_edid_modes(connector, edid);
+ }
++
+ connector->display_info.raw_edid = NULL;
+ kfree(edid);
+ }
--- /dev/null
+From c42988012ad9c1807b7c7a5ff855cd630094989b Mon Sep 17 00:00:00 2001
+From: Ben Hutchings <ben@decadent.org.uk>
+Date: Sat, 25 Dec 2010 16:17:32 +0000
+Subject: drm/nouveau: Only select ACPI_VIDEO if its dependencies are met
+
+From: Ben Hutchings <ben@decadent.org.uk>
+
+commit c42988012ad9c1807b7c7a5ff855cd630094989b upstream.
+
+CONFIG_ACPI_VIDEO depends on more than just CONFIG_ACPI, so add those
+dependencies to the Kconfig select condition. The case where some
+dependencies fail to be satisfied should be handled correctly, because
+in that case the ACPI_VIDEO symbols we use are converted into
+static-inline stubs.
+
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Signed-off-by: Francisco Jerez <currojerez@riseup.net>
+Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
+Cc: Nick Bowler <nbowler@elliptictech.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/nouveau/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/nouveau/Kconfig
++++ b/drivers/gpu/drm/nouveau/Kconfig
+@@ -10,7 +10,7 @@ config DRM_NOUVEAU
+ select FB
+ select FRAMEBUFFER_CONSOLE if !EMBEDDED
+ select FB_BACKLIGHT if DRM_NOUVEAU_BACKLIGHT
+- select ACPI_VIDEO if ACPI
++ select ACPI_VIDEO if ACPI && X86 && BACKLIGHT_CLASS_DEVICE && VIDEO_OUTPUT_CONTROL && INPUT
+ help
+ Choose this option for open-source nVidia support.
+
--- /dev/null
+From 16f9fdcbcce74102bed9a4b7ccc1fb05b5dd6ca3 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Mon, 7 Feb 2011 12:00:51 +1000
+Subject: drm/radeon: fix memory debugging since d961db75ce86a84f1f04e91ad1014653ed7d9f46
+
+From: Dave Airlie <airlied@redhat.com>
+
+commit 16f9fdcbcce74102bed9a4b7ccc1fb05b5dd6ca3 upstream.
+
+The old code dereferenced a value, the new code just needs to pass
+the ptr.
+
+fixes an oops looking at files in debugfs.
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/radeon/radeon_ttm.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/radeon_ttm.c
++++ b/drivers/gpu/drm/radeon/radeon_ttm.c
+@@ -787,9 +787,9 @@ static int radeon_ttm_debugfs_init(struc
+ radeon_mem_types_list[i].show = &radeon_mm_dump_table;
+ radeon_mem_types_list[i].driver_features = 0;
+ if (i == 0)
+- radeon_mem_types_list[i].data = &rdev->mman.bdev.man[TTM_PL_VRAM].priv;
++ radeon_mem_types_list[i].data = rdev->mman.bdev.man[TTM_PL_VRAM].priv;
+ else
+- radeon_mem_types_list[i].data = &rdev->mman.bdev.man[TTM_PL_TT].priv;
++ radeon_mem_types_list[i].data = rdev->mman.bdev.man[TTM_PL_TT].priv;
+
+ }
+ /* Add ttm page pool to debugfs */
--- /dev/null
+From a4b40d5d97f5c9ad0b7f4bf2818291ca184bb433 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexdeucher@gmail.com>
+Date: Mon, 14 Feb 2011 11:43:10 -0500
+Subject: drm/radeon/kms: add bounds checking to avivo pll algo
+
+From: Alex Deucher <alexdeucher@gmail.com>
+
+commit a4b40d5d97f5c9ad0b7f4bf2818291ca184bb433 upstream.
+
+Prevent divider overflow.
+Fixes:
+https://bugzilla.kernel.org/show_bug.cgi?id=28932
+
+Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/radeon/radeon_display.c | 10 ++++++++++
+ 1 file changed, 10 insertions(+)
+
+--- a/drivers/gpu/drm/radeon/radeon_display.c
++++ b/drivers/gpu/drm/radeon/radeon_display.c
+@@ -461,6 +461,11 @@ static void avivo_get_fb_div(struct rade
+ tmp *= target_clock;
+ *fb_div = tmp / pll->reference_freq;
+ *frac_fb_div = tmp % pll->reference_freq;
++
++ if (*fb_div > pll->max_feedback_div)
++ *fb_div = pll->max_feedback_div;
++ else if (*fb_div < pll->min_feedback_div)
++ *fb_div = pll->min_feedback_div;
+ }
+
+ static u32 avivo_get_post_div(struct radeon_pll *pll,
+@@ -494,6 +499,11 @@ static u32 avivo_get_post_div(struct rad
+ post_div--;
+ }
+
++ if (post_div > pll->max_post_div)
++ post_div = pll->max_post_div;
++ else if (post_div < pll->min_post_div)
++ post_div = pll->min_post_div;
++
+ return post_div;
+ }
+
--- /dev/null
+From 9fad321ac6bedd96f449754a1a25289ea1789a49 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexdeucher@gmail.com>
+Date: Mon, 7 Feb 2011 13:15:28 -0500
+Subject: drm/radeon/kms: add connector table for mac g5 9600
+
+From: Alex Deucher <alexdeucher@gmail.com>
+
+commit 9fad321ac6bedd96f449754a1a25289ea1789a49 upstream.
+
+PPC Mac cards do not provide connector tables in
+their vbios. Their connector/encoder configurations
+must be hardcoded in the driver.
+
+verified by nyef on #radeon
+
+Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/radeon/radeon_combios.c | 47 ++++++++++++++++++++++++++++++++
+ drivers/gpu/drm/radeon/radeon_mode.h | 1
+ 2 files changed, 48 insertions(+)
+
+--- a/drivers/gpu/drm/radeon/radeon_combios.c
++++ b/drivers/gpu/drm/radeon/radeon_combios.c
+@@ -1503,6 +1503,11 @@ bool radeon_get_legacy_connector_info_fr
+ (rdev->pdev->subsystem_device == 0x4a48)) {
+ /* Mac X800 */
+ rdev->mode_info.connector_table = CT_MAC_X800;
++ } else if ((rdev->pdev->device == 0x4150) &&
++ (rdev->pdev->subsystem_vendor == 0x1002) &&
++ (rdev->pdev->subsystem_device == 0x4150)) {
++ /* Mac G5 9600 */
++ rdev->mode_info.connector_table = CT_MAC_G5_9600;
+ } else
+ #endif /* CONFIG_PPC_PMAC */
+ #ifdef CONFIG_PPC64
+@@ -2021,6 +2026,48 @@ bool radeon_get_legacy_connector_info_fr
+ CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I,
+ &hpd);
+ break;
++ case CT_MAC_G5_9600:
++ DRM_INFO("Connector Table: %d (mac g5 9600)\n",
++ rdev->mode_info.connector_table);
++ /* DVI - tv dac, dvo */
++ ddc_i2c = combios_setup_i2c_bus(rdev, DDC_DVI, 0, 0);
++ hpd.hpd = RADEON_HPD_1; /* ??? */
++ radeon_add_legacy_encoder(dev,
++ radeon_get_encoder_enum(dev,
++ ATOM_DEVICE_DFP2_SUPPORT,
++ 0),
++ ATOM_DEVICE_DFP2_SUPPORT);
++ radeon_add_legacy_encoder(dev,
++ radeon_get_encoder_enum(dev,
++ ATOM_DEVICE_CRT2_SUPPORT,
++ 2),
++ ATOM_DEVICE_CRT2_SUPPORT);
++ radeon_add_legacy_connector(dev, 0,
++ ATOM_DEVICE_DFP2_SUPPORT |
++ ATOM_DEVICE_CRT2_SUPPORT,
++ DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
++ CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
++ &hpd);
++ /* ADC - primary dac, internal tmds */
++ ddc_i2c = combios_setup_i2c_bus(rdev, DDC_VGA, 0, 0);
++ hpd.hpd = RADEON_HPD_2; /* ??? */
++ radeon_add_legacy_encoder(dev,
++ radeon_get_encoder_enum(dev,
++ ATOM_DEVICE_DFP1_SUPPORT,
++ 0),
++ ATOM_DEVICE_DFP1_SUPPORT);
++ radeon_add_legacy_encoder(dev,
++ radeon_get_encoder_enum(dev,
++ ATOM_DEVICE_CRT1_SUPPORT,
++ 1),
++ ATOM_DEVICE_CRT1_SUPPORT);
++ radeon_add_legacy_connector(dev, 1,
++ ATOM_DEVICE_DFP1_SUPPORT |
++ ATOM_DEVICE_CRT1_SUPPORT,
++ DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
++ CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
++ &hpd);
++ break;
+ default:
+ DRM_INFO("Connector table: %d (invalid)\n",
+ rdev->mode_info.connector_table);
+--- a/drivers/gpu/drm/radeon/radeon_mode.h
++++ b/drivers/gpu/drm/radeon/radeon_mode.h
+@@ -209,6 +209,7 @@ enum radeon_connector_table {
+ CT_EMAC,
+ CT_RN50_POWER,
+ CT_MAC_X800,
++ CT_MAC_G5_9600,
+ };
+
+ enum radeon_dvo_chip {
--- /dev/null
+From c9417bdd4c6b1b92a21608c07e83afa419c7bb62 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexdeucher@gmail.com>
+Date: Sun, 6 Feb 2011 14:23:26 -0500
+Subject: drm/radeon/kms: fix interlaced modes on dce4+
+
+From: Alex Deucher <alexdeucher@gmail.com>
+
+commit c9417bdd4c6b1b92a21608c07e83afa419c7bb62 upstream.
+
+- set scaler table clears the interleave bit, need to
+reset it in encoder quirks, this was already done for
+pre-dce4.
+- remove the interleave settings from set_base() functions
+this is now handled in the encoder quirks functions, and
+isn't technically part of the display base setup.
+- rename evergreen_do_set_base() to dce4_do_set_base() since
+it's used on both evergreen and NI asics.
+
+Fixes:
+https://bugzilla.kernel.org/show_bug.cgi?id=28182
+
+Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/radeon/atombios_crtc.c | 22 +++++-----------------
+ drivers/gpu/drm/radeon/radeon_encoders.c | 20 +++++++++++++++-----
+ 2 files changed, 20 insertions(+), 22 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/atombios_crtc.c
++++ b/drivers/gpu/drm/radeon/atombios_crtc.c
+@@ -959,9 +959,9 @@ static void atombios_crtc_set_pll(struct
+ }
+ }
+
+-static int evergreen_crtc_do_set_base(struct drm_crtc *crtc,
+- struct drm_framebuffer *fb,
+- int x, int y, int atomic)
++static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
++ struct drm_framebuffer *fb,
++ int x, int y, int atomic)
+ {
+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
+ struct drm_device *dev = crtc->dev;
+@@ -1093,12 +1093,6 @@ static int evergreen_crtc_do_set_base(st
+ WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
+ (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay);
+
+- if (crtc->mode.flags & DRM_MODE_FLAG_INTERLACE)
+- WREG32(EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset,
+- EVERGREEN_INTERLEAVE_EN);
+- else
+- WREG32(EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset, 0);
+-
+ if (!atomic && fb && fb != crtc->fb) {
+ radeon_fb = to_radeon_framebuffer(fb);
+ rbo = radeon_fb->obj->driver_private;
+@@ -1247,12 +1241,6 @@ static int avivo_crtc_do_set_base(struct
+ WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
+ (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay);
+
+- if (crtc->mode.flags & DRM_MODE_FLAG_INTERLACE)
+- WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset,
+- AVIVO_D1MODE_INTERLEAVE_EN);
+- else
+- WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, 0);
+-
+ if (!atomic && fb && fb != crtc->fb) {
+ radeon_fb = to_radeon_framebuffer(fb);
+ rbo = radeon_fb->obj->driver_private;
+@@ -1276,7 +1264,7 @@ int atombios_crtc_set_base(struct drm_cr
+ struct radeon_device *rdev = dev->dev_private;
+
+ if (ASIC_IS_DCE4(rdev))
+- return evergreen_crtc_do_set_base(crtc, old_fb, x, y, 0);
++ return dce4_crtc_do_set_base(crtc, old_fb, x, y, 0);
+ else if (ASIC_IS_AVIVO(rdev))
+ return avivo_crtc_do_set_base(crtc, old_fb, x, y, 0);
+ else
+@@ -1291,7 +1279,7 @@ int atombios_crtc_set_base_atomic(struct
+ struct radeon_device *rdev = dev->dev_private;
+
+ if (ASIC_IS_DCE4(rdev))
+- return evergreen_crtc_do_set_base(crtc, fb, x, y, 1);
++ return dce4_crtc_do_set_base(crtc, fb, x, y, 1);
+ else if (ASIC_IS_AVIVO(rdev))
+ return avivo_crtc_do_set_base(crtc, fb, x, y, 1);
+ else
+--- a/drivers/gpu/drm/radeon/radeon_encoders.c
++++ b/drivers/gpu/drm/radeon/radeon_encoders.c
+@@ -1465,11 +1465,21 @@ atombios_apply_encoder_quirks(struct drm
+ }
+
+ /* set scaler clears this on some chips */
+- /* XXX check DCE4 */
+- if (!(radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))) {
+- if (ASIC_IS_AVIVO(rdev) && (mode->flags & DRM_MODE_FLAG_INTERLACE))
+- WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset,
+- AVIVO_D1MODE_INTERLEAVE_EN);
++ if (ASIC_IS_AVIVO(rdev) &&
++ (!(radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)))) {
++ if (ASIC_IS_DCE4(rdev)) {
++ if (mode->flags & DRM_MODE_FLAG_INTERLACE)
++ WREG32(EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset,
++ EVERGREEN_INTERLEAVE_EN);
++ else
++ WREG32(EVERGREEN_DATA_FORMAT + radeon_crtc->crtc_offset, 0);
++ } else {
++ if (mode->flags & DRM_MODE_FLAG_INTERLACE)
++ WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset,
++ AVIVO_D1MODE_INTERLEAVE_EN);
++ else
++ WREG32(AVIVO_D1MODE_DATA_FORMAT + radeon_crtc->crtc_offset, 0);
++ }
+ }
+ }
+
--- /dev/null
+From 5b40ddf888398ce4cccbf3b9d0a18d90149ed7ff Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexdeucher@gmail.com>
+Date: Mon, 14 Feb 2011 11:43:11 -0500
+Subject: drm/radeon/kms: hopefully fix pll issues for real (v3)
+
+From: Alex Deucher <alexdeucher@gmail.com>
+
+commit 5b40ddf888398ce4cccbf3b9d0a18d90149ed7ff upstream.
+
+The problematic boards have a recommended reference divider
+to be used when spread spectrum is enabled on the laptop panel.
+Enable the use of the recommended reference divider along with
+the new pll algo.
+
+v2: testing options
+
+v3: When using the fixed reference divider with LVDS, prefer
+min m to max p and use fractional feedback dividers.
+
+Fixes:
+https://bugzilla.kernel.org/show_bug.cgi?id=28852
+https://bugzilla.kernel.org/show_bug.cgi?id=24462
+https://bugzilla.kernel.org/show_bug.cgi?id=26552
+MacbookPro issues reported by Justin Mattock <justinmattock@gmail.com>
+
+Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/radeon/atombios_crtc.c | 22 ++++++++--------------
+ 1 file changed, 8 insertions(+), 14 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/atombios_crtc.c
++++ b/drivers/gpu/drm/radeon/atombios_crtc.c
+@@ -514,7 +514,6 @@ static u32 atombios_adjust_pll(struct dr
+ pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;
+ else
+ pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
+-
+ }
+
+ list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
+@@ -531,29 +530,28 @@ static u32 atombios_adjust_pll(struct dr
+ dp_clock = dig_connector->dp_clock;
+ }
+ }
+-/* this might work properly with the new pll algo */
+-#if 0 /* doesn't work properly on some laptops */
++
+ /* use recommended ref_div for ss */
+ if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
++ pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;
+ if (ss_enabled) {
+ if (ss->refdiv) {
+ pll->flags |= RADEON_PLL_USE_REF_DIV;
+ pll->reference_div = ss->refdiv;
++ if (ASIC_IS_AVIVO(rdev))
++ pll->flags |= RADEON_PLL_USE_FRAC_FB_DIV;
+ }
+ }
+ }
+-#endif
++
+ if (ASIC_IS_AVIVO(rdev)) {
+ /* DVO wants 2x pixel clock if the DVO chip is in 12 bit mode */
+ if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)
+ adjusted_clock = mode->clock * 2;
+ if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
+ pll->flags |= RADEON_PLL_PREFER_CLOSEST_LOWER;
+- /* rv515 needs more testing with this option */
+- if (rdev->family != CHIP_RV515) {
+- if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
+- pll->flags |= RADEON_PLL_IS_LCD;
+- }
++ if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
++ pll->flags |= RADEON_PLL_IS_LCD;
+ } else {
+ if (encoder->encoder_type != DRM_MODE_ENCODER_DAC)
+ pll->flags |= RADEON_PLL_NO_ODD_POST_DIV;
+@@ -921,11 +919,7 @@ static void atombios_crtc_set_pll(struct
+ /* adjust pixel clock as needed */
+ adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss);
+
+- /* rv515 seems happier with the old algo */
+- if (rdev->family == CHIP_RV515)
+- radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
+- &ref_div, &post_div);
+- else if (ASIC_IS_AVIVO(rdev))
++ if (ASIC_IS_AVIVO(rdev))
+ radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
+ &ref_div, &post_div);
+ else
--- /dev/null
+From c2049b3d29f47ed3750226dc51251a3404c85876 Mon Sep 17 00:00:00 2001
+From: Alex Deucher <alexdeucher@gmail.com>
+Date: Sun, 13 Feb 2011 18:42:41 -0500
+Subject: drm/radeon/kms: improve 6xx/7xx CS error output
+
+From: Alex Deucher <alexdeucher@gmail.com>
+
+commit c2049b3d29f47ed3750226dc51251a3404c85876 upstream.
+
+Makes debugging CS rejections much easier.
+
+Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/gpu/drm/radeon/r600_cs.c | 46 ++++++++++++++++++++++-----------------
+ 1 file changed, 26 insertions(+), 20 deletions(-)
+
+--- a/drivers/gpu/drm/radeon/r600_cs.c
++++ b/drivers/gpu/drm/radeon/r600_cs.c
+@@ -295,17 +295,18 @@ static inline int r600_cs_track_validate
+ }
+
+ if (!IS_ALIGNED(pitch, pitch_align)) {
+- dev_warn(p->dev, "%s:%d cb pitch (%d) invalid\n",
+- __func__, __LINE__, pitch);
++ dev_warn(p->dev, "%s:%d cb pitch (%d, 0x%x, %d) invalid\n",
++ __func__, __LINE__, pitch, pitch_align, array_mode);
+ return -EINVAL;
+ }
+ if (!IS_ALIGNED(height, height_align)) {
+- dev_warn(p->dev, "%s:%d cb height (%d) invalid\n",
+- __func__, __LINE__, height);
++ dev_warn(p->dev, "%s:%d cb height (%d, 0x%x, %d) invalid\n",
++ __func__, __LINE__, height, height_align, array_mode);
+ return -EINVAL;
+ }
+ if (!IS_ALIGNED(base_offset, base_align)) {
+- dev_warn(p->dev, "%s offset[%d] 0x%llx not aligned\n", __func__, i, base_offset);
++ dev_warn(p->dev, "%s offset[%d] 0x%llx 0x%llx, %d not aligned\n", __func__, i,
++ base_offset, base_align, array_mode);
+ return -EINVAL;
+ }
+
+@@ -320,7 +321,10 @@ static inline int r600_cs_track_validate
+ * broken userspace.
+ */
+ } else {
+- dev_warn(p->dev, "%s offset[%d] %d %d %lu too big\n", __func__, i, track->cb_color_bo_offset[i], tmp, radeon_bo_size(track->cb_color_bo[i]));
++ dev_warn(p->dev, "%s offset[%d] %d %d %d %lu too big\n", __func__, i,
++ array_mode,
++ track->cb_color_bo_offset[i], tmp,
++ radeon_bo_size(track->cb_color_bo[i]));
+ return -EINVAL;
+ }
+ }
+@@ -455,17 +459,18 @@ static int r600_cs_track_check(struct ra
+ }
+
+ if (!IS_ALIGNED(pitch, pitch_align)) {
+- dev_warn(p->dev, "%s:%d db pitch (%d) invalid\n",
+- __func__, __LINE__, pitch);
++ dev_warn(p->dev, "%s:%d db pitch (%d, 0x%x, %d) invalid\n",
++ __func__, __LINE__, pitch, pitch_align, array_mode);
+ return -EINVAL;
+ }
+ if (!IS_ALIGNED(height, height_align)) {
+- dev_warn(p->dev, "%s:%d db height (%d) invalid\n",
+- __func__, __LINE__, height);
++ dev_warn(p->dev, "%s:%d db height (%d, 0x%x, %d) invalid\n",
++ __func__, __LINE__, height, height_align, array_mode);
+ return -EINVAL;
+ }
+ if (!IS_ALIGNED(base_offset, base_align)) {
+- dev_warn(p->dev, "%s offset[%d] 0x%llx not aligned\n", __func__, i, base_offset);
++ dev_warn(p->dev, "%s offset[%d] 0x%llx, 0x%llx, %d not aligned\n", __func__, i,
++ base_offset, base_align, array_mode);
+ return -EINVAL;
+ }
+
+@@ -473,9 +478,10 @@ static int r600_cs_track_check(struct ra
+ nviews = G_028004_SLICE_MAX(track->db_depth_view) + 1;
+ tmp = ntiles * bpe * 64 * nviews;
+ if ((tmp + track->db_offset) > radeon_bo_size(track->db_bo)) {
+- dev_warn(p->dev, "z/stencil buffer too small (0x%08X %d %d %d -> %u have %lu)\n",
+- track->db_depth_size, ntiles, nviews, bpe, tmp + track->db_offset,
+- radeon_bo_size(track->db_bo));
++ dev_warn(p->dev, "z/stencil buffer (%d) too small (0x%08X %d %d %d -> %u have %lu)\n",
++ array_mode,
++ track->db_depth_size, ntiles, nviews, bpe, tmp + track->db_offset,
++ radeon_bo_size(track->db_bo));
+ return -EINVAL;
+ }
+ }
+@@ -1227,18 +1233,18 @@ static inline int r600_check_texture_res
+ /* XXX check height as well... */
+
+ if (!IS_ALIGNED(pitch, pitch_align)) {
+- dev_warn(p->dev, "%s:%d tex pitch (%d) invalid\n",
+- __func__, __LINE__, pitch);
++ dev_warn(p->dev, "%s:%d tex pitch (%d, 0x%x, %d) invalid\n",
++ __func__, __LINE__, pitch, pitch_align, G_038000_TILE_MODE(word0));
+ return -EINVAL;
+ }
+ if (!IS_ALIGNED(base_offset, base_align)) {
+- dev_warn(p->dev, "%s:%d tex base offset (0x%llx) invalid\n",
+- __func__, __LINE__, base_offset);
++ dev_warn(p->dev, "%s:%d tex base offset (0x%llx, 0x%llx, %d) invalid\n",
++ __func__, __LINE__, base_offset, base_align, G_038000_TILE_MODE(word0));
+ return -EINVAL;
+ }
+ if (!IS_ALIGNED(mip_offset, base_align)) {
+- dev_warn(p->dev, "%s:%d tex mip offset (0x%llx) invalid\n",
+- __func__, __LINE__, mip_offset);
++ dev_warn(p->dev, "%s:%d tex mip offset (0x%llx, 0x%llx, %d) invalid\n",
++ __func__, __LINE__, mip_offset, base_align, G_038000_TILE_MODE(word0));
+ return -EINVAL;
+ }
+
--- /dev/null
+From bcfe42e98047f1935c5571c8ea77beb2d43ec19d Mon Sep 17 00:00:00 2001
+From: Kashyap, Desai <kashyap.desai@lsi.com>
+Date: Thu, 10 Feb 2011 11:53:44 +0530
+Subject: [SCSI] mptfusion: Fix Incorrect return value in mptscsih_dev_reset
+
+From: Kashyap, Desai <kashyap.desai@lsi.com>
+
+commit bcfe42e98047f1935c5571c8ea77beb2d43ec19d upstream.
+
+There's a branch at the end of this function that
+is supposed to normalize the return value with what
+the mid-layer expects. In this one case, we get it wrong.
+
+Also increase the verbosity of the INFO level printk
+at the end of mptscsih_abort to include the actual return value
+and the scmd->serial_number. The reason being success
+or failure is actually determined by the state of
+the internal tag list when a TMF is issued, and not the
+return value of the TMF cmd. The serial_number is also
+used in this decision, thus it's useful to know for debugging
+purposes.
+
+Reported-by: Peter M. Petrakis <peter.petrakis@canonical.com>
+Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
+Signed-off-by: James Bottomley <James.Bottomley@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/message/fusion/mptscsih.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+--- a/drivers/message/fusion/mptscsih.c
++++ b/drivers/message/fusion/mptscsih.c
+@@ -1873,8 +1873,9 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
+ }
+
+ out:
+- printk(MYIOC_s_INFO_FMT "task abort: %s (sc=%p)\n",
+- ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), SCpnt);
++ printk(MYIOC_s_INFO_FMT "task abort: %s (rv=%04x) (sc=%p) (sn=%ld)\n",
++ ioc->name, ((retval == SUCCESS) ? "SUCCESS" : "FAILED"), retval,
++ SCpnt, SCpnt->serial_number);
+
+ return retval;
+ }
+@@ -1911,7 +1912,7 @@ mptscsih_dev_reset(struct scsi_cmnd * SC
+
+ vdevice = SCpnt->device->hostdata;
+ if (!vdevice || !vdevice->vtarget) {
+- retval = SUCCESS;
++ retval = 0;
+ goto out;
+ }
+
--- /dev/null
+From 84857c8bf83e8aa87afc57d2956ba01f11d82386 Mon Sep 17 00:00:00 2001
+From: Kashyap, Desai <kashyap.desai@lsi.com>
+Date: Thu, 10 Feb 2011 11:52:21 +0530
+Subject: [SCSI] mptfusion: mptctl_release is required in mptctl.c
+
+From: Kashyap, Desai <kashyap.desai@lsi.com>
+
+commit 84857c8bf83e8aa87afc57d2956ba01f11d82386 upstream.
+
+Added missing release callback for file_operations mptctl_fops.
+Without release callback there will be never freed. It remains on
+mptctl's eent list even after the file is closed and released.
+
+Relavent RHEL bugzilla is 660871
+
+Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
+Signed-off-by: James Bottomley <James.Bottomley@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/message/fusion/mptctl.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/message/fusion/mptctl.c
++++ b/drivers/message/fusion/mptctl.c
+@@ -597,6 +597,13 @@ mptctl_event_process(MPT_ADAPTER *ioc, E
+ }
+
+ static int
++mptctl_release(struct inode *inode, struct file *filep)
++{
++ fasync_helper(-1, filep, 0, &async_queue);
++ return 0;
++}
++
++static int
+ mptctl_fasync(int fd, struct file *filep, int mode)
+ {
+ MPT_ADAPTER *ioc;
+@@ -2815,6 +2822,7 @@ static const struct file_operations mptc
+ .llseek = no_llseek,
+ .fasync = mptctl_fasync,
+ .unlocked_ioctl = mptctl_ioctl,
++ .release = mptctl_release,
+ #ifdef CONFIG_COMPAT
+ .compat_ioctl = compat_mpctl_ioctl,
+ #endif
--- /dev/null
+From 3aa6e0aa8ab3e64bbfba092c64d42fd1d006b124 Mon Sep 17 00:00:00 2001
+From: Konstantin Khorenko <khorenko@parallels.com>
+Date: Tue, 1 Feb 2011 17:16:29 +0300
+Subject: NFSD: memory corruption due to writing beyond the stat array
+
+From: Konstantin Khorenko <khorenko@parallels.com>
+
+commit 3aa6e0aa8ab3e64bbfba092c64d42fd1d006b124 upstream.
+
+If nfsd fails to find an exported via NFS file in the readahead cache, it
+should increment corresponding nfsdstats counter (ra_depth[10]), but due to a
+bug it may instead write to ra_depth[11], corrupting the following field.
+
+In a kernel with NFSDv4 compiled in the corruption takes the form of an
+increment of a counter of the number of NFSv4 operation 0's received; since
+there is no operation 0, this is harmless.
+
+In a kernel with NFSDv4 disabled it corrupts whatever happens to be in the
+memory beyond nfsdstats.
+
+Signed-off-by: Konstantin Khorenko <khorenko@openvz.org>
+Signed-off-by: J. Bruce Fields <bfields@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ fs/nfsd/vfs.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/nfsd/vfs.c
++++ b/fs/nfsd/vfs.c
+@@ -809,7 +809,7 @@ nfsd_get_raparms(dev_t dev, ino_t ino)
+ if (ra->p_count == 0)
+ frap = rap;
+ }
+- depth = nfsdstats.ra_size*11/10;
++ depth = nfsdstats.ra_size;
+ if (!frap) {
+ spin_unlock(&rab->pb_lock);
+ return NULL;
--- /dev/null
+From c55c63c6539499379ab4a7e8a5c0f857351fb946 Mon Sep 17 00:00:00 2001
+From: Dave Airlie <airlied@redhat.com>
+Date: Fri, 7 Jan 2011 09:57:41 +1000
+Subject: vt: fix issue when fbcon wants to takeover a second time.
+
+From: Dave Airlie <airlied@redhat.com>
+
+commit c55c63c6539499379ab4a7e8a5c0f857351fb946 upstream.
+
+With framebuffer handover and multiple GPUs, we get into a
+position where the fbcon unbinds the vesafb framebuffer for GPU 1,
+but we still have a radeon framebuffer bound from GPU 0, so
+we don't unregister the console driver. Then when we tried to bind
+the new radeon framebuffer for GPU1 we never get to the bind
+call as we fail due to the console being registered already.
+
+This changes the return value to -EBUSY when the driver is
+already registered and continues to bind for -EBUSY.
+
+Signed-off-by: Dave Airlie <airlied@redhat.com>
+Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/tty/vt/vt.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+--- a/drivers/tty/vt/vt.c
++++ b/drivers/tty/vt/vt.c
+@@ -3524,7 +3524,7 @@ int register_con_driver(const struct con
+
+ /* already registered */
+ if (con_driver->con == csw)
+- retval = -EINVAL;
++ retval = -EBUSY;
+ }
+
+ if (retval)
+@@ -3635,7 +3635,12 @@ int take_over_console(const struct consw
+ int err;
+
+ err = register_con_driver(csw, first, last);
+-
++ /* if we get an busy error we still want to bind the console driver
++ * and return success, as we may have unbound the console driver
++ * but not unregistered it.
++ */
++ if (err == -EBUSY)
++ err = 0;
+ if (!err)
+ bind_con_driver(csw, first, last, deflt);
+