--- /dev/null
+From e16b31bf47738f4498d7ce632e12d7d2a6a2492a Mon Sep 17 00:00:00 2001
+From: Marc Zyngier <Marc.Zyngier@arm.com>
+Date: Mon, 4 Nov 2013 11:42:29 +0100
+Subject: ARM: 7876/1: clear Thumb-2 IT state on exception handling
+
+From: Marc Zyngier <Marc.Zyngier@arm.com>
+
+commit e16b31bf47738f4498d7ce632e12d7d2a6a2492a upstream.
+
+The exception handling code fails to clear the IT state, potentially
+leading to incorrect execution of the fixup if the size of the IT
+block is more than one.
+
+Let fixup_exception do the IT sanitizing if a fixup has been found,
+and restore CPSR from the stack when returning from a data abort.
+
+Cc: Will Deacon <will.deacon@arm.com>
+Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
+Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/kernel/entry-armv.S | 1 +
+ arch/arm/mm/extable.c | 7 ++++++-
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+--- a/arch/arm/kernel/entry-armv.S
++++ b/arch/arm/kernel/entry-armv.S
+@@ -192,6 +192,7 @@ __dabt_svc:
+ svc_entry
+ mov r2, sp
+ dabt_helper
++ THUMB( ldr r5, [sp, #S_PSR] ) @ potentially updated CPSR
+ svc_exit r5 @ return from exception
+ UNWIND(.fnend )
+ ENDPROC(__dabt_svc)
+--- a/arch/arm/mm/extable.c
++++ b/arch/arm/mm/extable.c
+@@ -9,8 +9,13 @@ int fixup_exception(struct pt_regs *regs
+ const struct exception_table_entry *fixup;
+
+ fixup = search_exception_tables(instruction_pointer(regs));
+- if (fixup)
++ if (fixup) {
+ regs->ARM_pc = fixup->fixup;
++#ifdef CONFIG_THUMB2_KERNEL
++ /* Clear the IT state to avoid nasty surprises in the fixup */
++ regs->ARM_cpsr &= ~PSR_IT_MASK;
++#endif
++ }
+
+ return fixup != NULL;
+ }
--- /dev/null
+From 6de714c21a8ea315fffba6a93bbe537f4c1bf4f0 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Wed, 16 Oct 2013 11:56:14 +0200
+Subject: ARM: at91: fix hanged boot due to early rtc-interrupt
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit 6de714c21a8ea315fffba6a93bbe537f4c1bf4f0 upstream.
+
+Make sure the RTC-interrupts are masked at boot by adding a new helper
+function to be used at SOC-init.
+
+This fixes hanged boot on all AT91 SOCs with an RTC (but RM9200), for
+example, after a reset during an RTC-update or if an RTC-alarm goes off
+after shutdown (e.g. when using RTC wakeup).
+
+The RTC and RTT-peripherals are powered by backup power (VDDBU) (on all
+AT91 SOCs but RM9200) and are not reset on wake-up, user, watchdog or
+software reset. This means that their interrupts may be enabled during
+early boot if, for example, they where not disabled during a previous
+shutdown (e.g. due to a buggy driver or a non-clean shutdown such as a
+user reset). Furthermore, an RTC or RTT-alarm may also be active.
+
+The RTC and RTT-interrupts use the shared system-interrupt line, which
+is also used by the PIT, and if an interrupt occurs before a handler
+(e.g. RTC-driver) has been installed this leads to the system interrupt
+being disabled and prevents the system from booting.
+
+Note that when boot hangs due to an early RTC or RTT-interrupt, the only
+way to get the system to start again is to remove the backup power (e.g.
+battery) or to disable the interrupt manually from the bootloader. In
+particular, a user reset is not sufficient.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-at91/Makefile | 2 -
+ arch/arm/mach-at91/at91sam9g45.c | 2 +
+ arch/arm/mach-at91/at91sam9n12.c | 6 +++
+ arch/arm/mach-at91/at91sam9rl.c | 2 +
+ arch/arm/mach-at91/at91sam9x5.c | 6 +++
+ arch/arm/mach-at91/generic.h | 1
+ arch/arm/mach-at91/include/mach/at91sam9n12.h | 5 ++
+ arch/arm/mach-at91/include/mach/at91sam9x5.h | 5 ++
+ arch/arm/mach-at91/include/mach/sama5d3.h | 5 ++
+ arch/arm/mach-at91/sama5d3.c | 6 +++
+ arch/arm/mach-at91/sysirq_mask.c | 47 ++++++++++++++++++++++++++
+ 11 files changed, 86 insertions(+), 1 deletion(-)
+
+--- a/arch/arm/mach-at91/Makefile
++++ b/arch/arm/mach-at91/Makefile
+@@ -2,7 +2,7 @@
+ # Makefile for the linux kernel.
+ #
+
+-obj-y := irq.o gpio.o setup.o
++obj-y := irq.o gpio.o setup.o sysirq_mask.o
+ obj-m :=
+ obj-n :=
+ obj- :=
+--- a/arch/arm/mach-at91/at91sam9g45.c
++++ b/arch/arm/mach-at91/at91sam9g45.c
+@@ -377,6 +377,8 @@ static void __init at91sam9g45_initializ
+ arm_pm_idle = at91sam9_idle;
+ arm_pm_restart = at91sam9g45_restart;
+
++ at91_sysirq_mask_rtc(AT91SAM9G45_BASE_RTC);
++
+ /* Register GPIO subsystem */
+ at91_gpio_init(at91sam9g45_gpio, 5);
+ }
+--- a/arch/arm/mach-at91/at91sam9n12.c
++++ b/arch/arm/mach-at91/at91sam9n12.c
+@@ -223,7 +223,13 @@ static void __init at91sam9n12_map_io(vo
+ at91_init_sram(0, AT91SAM9N12_SRAM_BASE, AT91SAM9N12_SRAM_SIZE);
+ }
+
++static void __init at91sam9n12_initialize(void)
++{
++ at91_sysirq_mask_rtc(AT91SAM9N12_BASE_RTC);
++}
++
+ AT91_SOC_START(at91sam9n12)
+ .map_io = at91sam9n12_map_io,
+ .register_clocks = at91sam9n12_register_clocks,
++ .init = at91sam9n12_initialize,
+ AT91_SOC_END
+--- a/arch/arm/mach-at91/at91sam9rl.c
++++ b/arch/arm/mach-at91/at91sam9rl.c
+@@ -294,6 +294,8 @@ static void __init at91sam9rl_initialize
+ arm_pm_idle = at91sam9_idle;
+ arm_pm_restart = at91sam9_alt_restart;
+
++ at91_sysirq_mask_rtc(AT91SAM9RL_BASE_RTC);
++
+ /* Register GPIO subsystem */
+ at91_gpio_init(at91sam9rl_gpio, 4);
+ }
+--- a/arch/arm/mach-at91/at91sam9x5.c
++++ b/arch/arm/mach-at91/at91sam9x5.c
+@@ -322,6 +322,11 @@ static void __init at91sam9x5_map_io(voi
+ at91_init_sram(0, AT91SAM9X5_SRAM_BASE, AT91SAM9X5_SRAM_SIZE);
+ }
+
++static void __init at91sam9x5_initialize(void)
++{
++ at91_sysirq_mask_rtc(AT91SAM9X5_BASE_RTC);
++}
++
+ /* --------------------------------------------------------------------
+ * Interrupt initialization
+ * -------------------------------------------------------------------- */
+@@ -329,4 +334,5 @@ static void __init at91sam9x5_map_io(voi
+ AT91_SOC_START(at91sam9x5)
+ .map_io = at91sam9x5_map_io,
+ .register_clocks = at91sam9x5_register_clocks,
++ .init = at91sam9x5_initialize,
+ AT91_SOC_END
+--- a/arch/arm/mach-at91/generic.h
++++ b/arch/arm/mach-at91/generic.h
+@@ -34,6 +34,7 @@ extern int __init at91_aic_of_init(stru
+ struct device_node *parent);
+ extern int __init at91_aic5_of_init(struct device_node *node,
+ struct device_node *parent);
++extern void __init at91_sysirq_mask_rtc(u32 rtc_base);
+
+
+ /* Timer */
+--- a/arch/arm/mach-at91/include/mach/at91sam9n12.h
++++ b/arch/arm/mach-at91/include/mach/at91sam9n12.h
+@@ -49,6 +49,11 @@
+ #define AT91SAM9N12_BASE_USART3 0xf8028000
+
+ /*
++ * System Peripherals
++ */
++#define AT91SAM9N12_BASE_RTC 0xfffffeb0
++
++/*
+ * Internal Memory.
+ */
+ #define AT91SAM9N12_SRAM_BASE 0x00300000 /* Internal SRAM base address */
+--- a/arch/arm/mach-at91/include/mach/at91sam9x5.h
++++ b/arch/arm/mach-at91/include/mach/at91sam9x5.h
+@@ -55,6 +55,11 @@
+ #define AT91SAM9X5_BASE_USART2 0xf8024000
+
+ /*
++ * System Peripherals
++ */
++#define AT91SAM9X5_BASE_RTC 0xfffffeb0
++
++/*
+ * Internal Memory.
+ */
+ #define AT91SAM9X5_SRAM_BASE 0x00300000 /* Internal SRAM base address */
+--- a/arch/arm/mach-at91/include/mach/sama5d3.h
++++ b/arch/arm/mach-at91/include/mach/sama5d3.h
+@@ -73,6 +73,11 @@
+ #define SAMA5D3_BASE_USART3 0xf8024000
+
+ /*
++ * System Peripherals
++ */
++#define SAMA5D3_BASE_RTC 0xfffffeb0
++
++/*
+ * Internal Memory
+ */
+ #define SAMA5D3_SRAM_BASE 0x00300000 /* Internal SRAM base address */
+--- a/arch/arm/mach-at91/sama5d3.c
++++ b/arch/arm/mach-at91/sama5d3.c
+@@ -371,7 +371,13 @@ static void __init sama5d3_map_io(void)
+ at91_init_sram(0, SAMA5D3_SRAM_BASE, SAMA5D3_SRAM_SIZE);
+ }
+
++static void __init sama5d3_initialize(void)
++{
++ at91_sysirq_mask_rtc(SAMA5D3_BASE_RTC);
++}
++
+ AT91_SOC_START(sama5d3)
+ .map_io = sama5d3_map_io,
+ .register_clocks = sama5d3_register_clocks,
++ .init = sama5d3_initialize,
+ AT91_SOC_END
+--- /dev/null
++++ b/arch/arm/mach-at91/sysirq_mask.c
+@@ -0,0 +1,47 @@
++/*
++ * sysirq_mask.c - System-interrupt masking
++ *
++ * Copyright (C) 2013 Johan Hovold <jhovold@gmail.com>
++ *
++ * Functions to disable system interrupts from backup-powered peripherals.
++ *
++ * The RTC and RTT-peripherals are generally powered by backup power (VDDBU)
++ * and are not reset on wake-up, user, watchdog or software reset. This means
++ * that their interrupts may be enabled during early boot (e.g. after a user
++ * reset).
++ *
++ * As the RTC and RTT share the system-interrupt line with the PIT, an
++ * interrupt occurring before a handler has been installed would lead to the
++ * system interrupt being disabled and prevent the system from booting.
++ *
++ * This program is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU General Public License as published by
++ * the Free Software Foundation; either version 2 of the License, or
++ * (at your option) any later version.
++ */
++
++#include <linux/io.h>
++
++#include "generic.h"
++
++#define AT91_RTC_IDR 0x24 /* Interrupt Disable Register */
++#define AT91_RTC_IMR 0x28 /* Interrupt Mask Register */
++
++void __init at91_sysirq_mask_rtc(u32 rtc_base)
++{
++ void __iomem *base;
++ u32 mask;
++
++ base = ioremap(rtc_base, 64);
++ if (!base)
++ return;
++
++ mask = readl_relaxed(base + AT91_RTC_IMR);
++ if (mask) {
++ pr_info("AT91: Disabling rtc irq\n");
++ writel_relaxed(mask, base + AT91_RTC_IDR);
++ (void)readl_relaxed(base + AT91_RTC_IMR); /* flush */
++ }
++
++ iounmap(base);
++}
--- /dev/null
+From 94c4c79f2f1acca6e69a50bff5a7d9027509c16b Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Wed, 16 Oct 2013 11:56:15 +0200
+Subject: ARM: at91: fix hanged boot due to early rtt-interrupt
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit 94c4c79f2f1acca6e69a50bff5a7d9027509c16b upstream.
+
+Make sure the RTT-interrupts are masked at boot by adding a new helper
+function to be used at SOC-init.
+
+This fixes hanged boot on all AT91 SOCs with an RTT, for example, if an
+RTT-alarm goes off after a non-clean shutdown (e.g. when using RTC
+wakeup).
+
+The RTC and RTT-peripherals are powered by backup power (VDDBU) (on all
+AT91 SOCs but RM9200) and are not reset on wake-up, user, watchdog or
+software reset. This means that their interrupts may be enabled during
+early boot if, for example, they where not disabled during a previous
+shutdown (e.g. due to a buggy driver or a non-clean shutdown such as a
+user reset). Furthermore, an RTC or RTT-alarm may also be active.
+
+The RTC and RTT-interrupts use the shared system-interrupt line, which
+is also used by the PIT, and if an interrupt occurs before a handler
+(e.g. RTC-driver) has been installed this leads to the system interrupt
+being disabled and prevents the system from booting.
+
+Note that when boot hangs due to an early RTC or RTT-interrupt, the only
+way to get the system to start again is to remove the backup power (e.g.
+battery) or to disable the interrupt manually from the bootloader. In
+particular, a user reset is not sufficient.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-at91/at91sam9260.c | 2 ++
+ arch/arm/mach-at91/at91sam9261.c | 2 ++
+ arch/arm/mach-at91/at91sam9263.c | 3 +++
+ arch/arm/mach-at91/at91sam9g45.c | 1 +
+ arch/arm/mach-at91/at91sam9rl.c | 1 +
+ arch/arm/mach-at91/generic.h | 1 +
+ arch/arm/mach-at91/sysirq_mask.c | 24 ++++++++++++++++++++++++
+ 7 files changed, 34 insertions(+)
+
+--- a/arch/arm/mach-at91/at91sam9260.c
++++ b/arch/arm/mach-at91/at91sam9260.c
+@@ -349,6 +349,8 @@ static void __init at91sam9260_initializ
+ arm_pm_idle = at91sam9_idle;
+ arm_pm_restart = at91sam9_alt_restart;
+
++ at91_sysirq_mask_rtt(AT91SAM9260_BASE_RTT);
++
+ /* Register GPIO subsystem */
+ at91_gpio_init(at91sam9260_gpio, 3);
+ }
+--- a/arch/arm/mach-at91/at91sam9261.c
++++ b/arch/arm/mach-at91/at91sam9261.c
+@@ -291,6 +291,8 @@ static void __init at91sam9261_initializ
+ arm_pm_idle = at91sam9_idle;
+ arm_pm_restart = at91sam9_alt_restart;
+
++ at91_sysirq_mask_rtt(AT91SAM9261_BASE_RTT);
++
+ /* Register GPIO subsystem */
+ at91_gpio_init(at91sam9261_gpio, 3);
+ }
+--- a/arch/arm/mach-at91/at91sam9263.c
++++ b/arch/arm/mach-at91/at91sam9263.c
+@@ -328,6 +328,9 @@ static void __init at91sam9263_initializ
+ arm_pm_idle = at91sam9_idle;
+ arm_pm_restart = at91sam9_alt_restart;
+
++ at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT0);
++ at91_sysirq_mask_rtt(AT91SAM9263_BASE_RTT1);
++
+ /* Register GPIO subsystem */
+ at91_gpio_init(at91sam9263_gpio, 5);
+ }
+--- a/arch/arm/mach-at91/at91sam9g45.c
++++ b/arch/arm/mach-at91/at91sam9g45.c
+@@ -378,6 +378,7 @@ static void __init at91sam9g45_initializ
+ arm_pm_restart = at91sam9g45_restart;
+
+ at91_sysirq_mask_rtc(AT91SAM9G45_BASE_RTC);
++ at91_sysirq_mask_rtt(AT91SAM9G45_BASE_RTT);
+
+ /* Register GPIO subsystem */
+ at91_gpio_init(at91sam9g45_gpio, 5);
+--- a/arch/arm/mach-at91/at91sam9rl.c
++++ b/arch/arm/mach-at91/at91sam9rl.c
+@@ -295,6 +295,7 @@ static void __init at91sam9rl_initialize
+ arm_pm_restart = at91sam9_alt_restart;
+
+ at91_sysirq_mask_rtc(AT91SAM9RL_BASE_RTC);
++ at91_sysirq_mask_rtt(AT91SAM9RL_BASE_RTT);
+
+ /* Register GPIO subsystem */
+ at91_gpio_init(at91sam9rl_gpio, 4);
+--- a/arch/arm/mach-at91/generic.h
++++ b/arch/arm/mach-at91/generic.h
+@@ -35,6 +35,7 @@ extern int __init at91_aic_of_init(stru
+ extern int __init at91_aic5_of_init(struct device_node *node,
+ struct device_node *parent);
+ extern void __init at91_sysirq_mask_rtc(u32 rtc_base);
++extern void __init at91_sysirq_mask_rtt(u32 rtt_base);
+
+
+ /* Timer */
+--- a/arch/arm/mach-at91/sysirq_mask.c
++++ b/arch/arm/mach-at91/sysirq_mask.c
+@@ -21,6 +21,7 @@
+ */
+
+ #include <linux/io.h>
++#include <mach/at91_rtt.h>
+
+ #include "generic.h"
+
+@@ -44,4 +45,27 @@ void __init at91_sysirq_mask_rtc(u32 rtc
+ }
+
+ iounmap(base);
++}
++
++void __init at91_sysirq_mask_rtt(u32 rtt_base)
++{
++ void __iomem *base;
++ void __iomem *reg;
++ u32 mode;
++
++ base = ioremap(rtt_base, 16);
++ if (!base)
++ return;
++
++ reg = base + AT91_RTT_MR;
++
++ mode = readl_relaxed(reg);
++ if (mode & (AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN)) {
++ pr_info("AT91: Disabling rtt irq\n");
++ mode &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
++ writel_relaxed(mode, reg);
++ (void)readl_relaxed(reg); /* flush */
++ }
++
++ iounmap(base);
+ }
--- /dev/null
+From 9b3d423707c3b1f6633be1be7e959623e10c596b Mon Sep 17 00:00:00 2001
+From: Jiada Wang <jiada_wang@mentor.com>
+Date: Wed, 30 Oct 2013 04:25:51 -0700
+Subject: ARM: i.MX6q: fix the wrong parent of can_root clock
+
+From: Jiada Wang <jiada_wang@mentor.com>
+
+commit 9b3d423707c3b1f6633be1be7e959623e10c596b upstream.
+
+instead of pll3_usb_otg the parent of can_root clock
+should be pll3_60m.
+
+Signed-off-by: Jiada Wang <jiada_wang@mentor.com>
+Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
+Cc: Marc Kleine-Budde <mkl@pengutronix.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-imx/clk-imx6q.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm/mach-imx/clk-imx6q.c
++++ b/arch/arm/mach-imx/clk-imx6q.c
+@@ -428,7 +428,7 @@ static void __init imx6q_clocks_init(str
+ clk[asrc_podf] = imx_clk_divider("asrc_podf", "asrc_pred", base + 0x30, 9, 3);
+ clk[spdif_pred] = imx_clk_divider("spdif_pred", "spdif_sel", base + 0x30, 25, 3);
+ clk[spdif_podf] = imx_clk_divider("spdif_podf", "spdif_pred", base + 0x30, 22, 3);
+- clk[can_root] = imx_clk_divider("can_root", "pll3_usb_otg", base + 0x20, 2, 6);
++ clk[can_root] = imx_clk_divider("can_root", "pll3_60m", base + 0x20, 2, 6);
+ clk[ecspi_root] = imx_clk_divider("ecspi_root", "pll3_60m", base + 0x38, 19, 6);
+ clk[gpu2d_core_podf] = imx_clk_divider("gpu2d_core_podf", "gpu2d_core_sel", base + 0x18, 23, 3);
+ clk[gpu3d_core_podf] = imx_clk_divider("gpu3d_core_podf", "gpu3d_core_sel", base + 0x18, 26, 3);
--- /dev/null
+From 30aeadd44deea3f3b0df45b9a70ee0fd5f8d6dc2 Mon Sep 17 00:00:00 2001
+From: Jonathan Austin <jonathan.austin@arm.com>
+Date: Thu, 29 Aug 2013 18:41:11 +0100
+Subject: ARM: integrator_cp: Set LCD{0,1} enable lines when turning on CLCD
+
+From: Jonathan Austin <jonathan.austin@arm.com>
+
+commit 30aeadd44deea3f3b0df45b9a70ee0fd5f8d6dc2 upstream.
+
+This turns on the internal integrator LCD display(s). It seems that the code
+to do this got lost in refactoring of the CLCD driver.
+
+Signed-off-by: Jonathan Austin <jonathan.austin@arm.com>
+Acked-by: Linus Walleij <linus.walleij@linaro.org>
+Signed-off-by: Olof Johansson <olof@lixom.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-integrator/integrator_cp.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/arch/arm/mach-integrator/integrator_cp.c
++++ b/arch/arm/mach-integrator/integrator_cp.c
+@@ -199,7 +199,8 @@ static struct mmci_platform_data mmc_dat
+ static void cp_clcd_enable(struct clcd_fb *fb)
+ {
+ struct fb_var_screeninfo *var = &fb->fb.var;
+- u32 val = CM_CTRL_STATIC1 | CM_CTRL_STATIC2;
++ u32 val = CM_CTRL_STATIC1 | CM_CTRL_STATIC2
++ | CM_CTRL_LCDEN0 | CM_CTRL_LCDEN1;
+
+ if (var->bits_per_pixel <= 8 ||
+ (var->bits_per_pixel == 16 && var->green.length == 5))
--- /dev/null
+From 0bebda684857f76548ea48c8886785198701d8d3 Mon Sep 17 00:00:00 2001
+From: Markus Pargmann <mpa@pengutronix.de>
+Date: Thu, 17 Oct 2013 09:18:38 +0200
+Subject: ARM: OMAP2+: irq, AM33XX add missing register check
+
+From: Markus Pargmann <mpa@pengutronix.de>
+
+commit 0bebda684857f76548ea48c8886785198701d8d3 upstream.
+
+am33xx has a INTC_PENDING_IRQ3 register that is not checked for pending
+interrupts. This patch adds AM33XX to the ifdef of SOCs that have to
+check this register.
+
+Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-omap2/irq.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm/mach-omap2/irq.c
++++ b/arch/arm/mach-omap2/irq.c
+@@ -233,7 +233,7 @@ static inline void omap_intc_handle_irq(
+ goto out;
+
+ irqnr = readl_relaxed(base_addr + 0xd8);
+-#ifdef CONFIG_SOC_TI81XX
++#if IS_ENABLED(CONFIG_SOC_TI81XX) || IS_ENABLED(CONFIG_SOC_AM33XX)
+ if (irqnr)
+ goto out;
+ irqnr = readl_relaxed(base_addr + 0xf8);
--- /dev/null
+From 3522bf7bfa248b99eafa2f4872190699a808c7d9 Mon Sep 17 00:00:00 2001
+From: Nishanth Menon <nm@ti.com>
+Date: Thu, 14 Nov 2013 11:05:16 -0600
+Subject: ARM: OMAP2+: omap_device: maintain sane runtime pm status around suspend/resume
+
+From: Nishanth Menon <nm@ti.com>
+
+commit 3522bf7bfa248b99eafa2f4872190699a808c7d9 upstream.
+
+OMAP device hooks around suspend|resume_noirq ensures that hwmod
+devices are forced to idle using omap_device_idle/enable as part of
+the last stage of suspend activity.
+
+For a device such as i2c who uses autosuspend, it is possible to enter
+the suspend path with dev->power.runtime_status = RPM_ACTIVE.
+
+As part of the suspend flow, the generic runtime logic would increment
+it's dev->power.disable_depth to 1. This should prevent further
+pm_runtime_get_sync from succeeding once the runtime_status has been
+set to RPM_SUSPENDED.
+
+Now, as part of the suspend_noirq handler in omap_device, we force the
+following: if the device status is !suspended, we force the device
+to idle using omap_device_idle (clocks are cut etc..). This ensures
+that from a hardware perspective, the device is "suspended". However,
+runtime_status is left to be active.
+
+*if* an operation is attempted after this point to
+pm_runtime_get_sync, runtime framework depends on runtime_status to
+indicate accurately the device status, and since it sees it to be
+ACTIVE, it assumes the module is functional and returns a non-error
+value. As a result the user will see pm_runtime_get succeed, however a
+register access will crash due to the lack of clocks.
+
+To prevent this from happening, we should ensure that runtime_status
+exactly indicates the device status. As a result of this change
+any further calls to pm_runtime_get* would return -EACCES (since
+disable_depth is 1). On resume, we restore the clocks and runtime
+status exactly as we suspended with. These operations are not expected
+to fail as we update the states after the core runtime framework has
+suspended itself and restore before the core runtime framework has
+resumed.
+
+Reported-by: J Keerthy <j-keerthy@ti.com>
+Signed-off-by: Nishanth Menon <nm@ti.com>
+Acked-by: Rajendra Nayak <rnayak@ti.com>
+Acked-by: Kevin Hilman <khilman@linaro.org>
+Reviewed-by: Felipe Balbi <balbi@ti.com>
+Signed-off-by: Tony Lindgren <tony@atomide.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-omap2/omap_device.c | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+--- a/arch/arm/mach-omap2/omap_device.c
++++ b/arch/arm/mach-omap2/omap_device.c
+@@ -621,6 +621,7 @@ static int _od_suspend_noirq(struct devi
+
+ if (!ret && !pm_runtime_status_suspended(dev)) {
+ if (pm_generic_runtime_suspend(dev) == 0) {
++ pm_runtime_set_suspended(dev);
+ omap_device_idle(pdev);
+ od->flags |= OMAP_DEVICE_SUSPENDED;
+ }
+@@ -634,10 +635,18 @@ static int _od_resume_noirq(struct devic
+ struct platform_device *pdev = to_platform_device(dev);
+ struct omap_device *od = to_omap_device(pdev);
+
+- if ((od->flags & OMAP_DEVICE_SUSPENDED) &&
+- !pm_runtime_status_suspended(dev)) {
++ if (od->flags & OMAP_DEVICE_SUSPENDED) {
+ od->flags &= ~OMAP_DEVICE_SUSPENDED;
+ omap_device_enable(pdev);
++ /*
++ * XXX: we run before core runtime pm has resumed itself. At
++ * this point in time, we just restore the runtime pm state and
++ * considering symmetric operations in resume, we donot expect
++ * to fail. If we failed, something changed in core runtime_pm
++ * framework OR some device driver messed things up, hence, WARN
++ */
++ WARN(pm_runtime_set_active(dev),
++ "Could not set %s runtime state active\n", dev_name(dev));
+ pm_generic_runtime_resume(dev);
+ }
+
--- /dev/null
+From f3964fe1c9d9a887d65faf594669852e4dec46e0 Mon Sep 17 00:00:00 2001
+From: Russell King <rmk+kernel@arm.linux.org.uk>
+Date: Wed, 16 Oct 2013 00:09:02 +0100
+Subject: ARM: sa11x0/assabet: ensure CS2 is configured appropriately
+
+From: Russell King <rmk+kernel@arm.linux.org.uk>
+
+commit f3964fe1c9d9a887d65faf594669852e4dec46e0 upstream.
+
+The CS2 region contains the Assabet board configuration and status
+registers, which are 32-bit. Unfortunately, some boot loaders do not
+configure this region correctly, leaving it setup as a 16-bit region.
+Fix this.
+
+Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/arm/mach-sa1100/assabet.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/arch/arm/mach-sa1100/assabet.c
++++ b/arch/arm/mach-sa1100/assabet.c
+@@ -512,6 +512,9 @@ static void __init assabet_map_io(void)
+ * Its called GPCLKR0 in my SA1110 manual.
+ */
+ Ser1SDCR0 |= SDCR0_SUS;
++ MSC1 = (MSC1 & ~0xffff) |
++ MSC_NonBrst | MSC_32BitStMem |
++ MSC_RdAcc(2) | MSC_WrAcc(2) | MSC_Rec(0);
+
+ if (!machine_has_neponset())
+ sa1100_register_uart_fns(&assabet_port_fns);
--- /dev/null
+From 7b5bfb82882b9b1c8423ce0ed6852ca3762d967a Mon Sep 17 00:00:00 2001
+From: Phil Edworthy <phil.edworthy@renesas.com>
+Date: Thu, 31 Oct 2013 23:06:17 -0700
+Subject: ASoC: ak4642: prevent un-necessary changes to SG_SL1
+
+From: Phil Edworthy <phil.edworthy@renesas.com>
+
+commit 7b5bfb82882b9b1c8423ce0ed6852ca3762d967a upstream.
+
+If you record the sound during playback,
+the playback sound becomes silent.
+Modify so that the codec driver does not clear
+SG_SL1::DACL bit which is controlled under widget
+
+Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com>
+Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/ak4642.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/soc/codecs/ak4642.c
++++ b/sound/soc/codecs/ak4642.c
+@@ -257,7 +257,7 @@ static int ak4642_dai_startup(struct snd
+ * This operation came from example code of
+ * "ASAHI KASEI AK4642" (japanese) manual p94.
+ */
+- snd_soc_write(codec, SG_SL1, PMMP | MGAIN0);
++ snd_soc_update_bits(codec, SG_SL1, PMMP | MGAIN0, PMMP | MGAIN0);
+ snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3));
+ snd_soc_write(codec, ALC_CTL1, ALC | LMTH0);
+ snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL);
--- /dev/null
+From 3e68ce1bc72e5d6615677ec5a8b0a9bcb6c7a490 Mon Sep 17 00:00:00 2001
+From: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
+Date: Wed, 20 Nov 2013 14:37:09 +0000
+Subject: ASoC: arizona: Set FLL to free-run before disabling
+
+From: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
+
+commit 3e68ce1bc72e5d6615677ec5a8b0a9bcb6c7a490 upstream.
+
+The FLL must be placed into free-run mode before disabling
+to allow it to entirely shut down.
+
+Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/arizona.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/sound/soc/codecs/arizona.c
++++ b/sound/soc/codecs/arizona.c
+@@ -1525,6 +1525,8 @@ static void arizona_enable_fll(struct ar
+ try_wait_for_completion(&fll->ok);
+
+ regmap_update_bits(arizona->regmap, fll->base + 1,
++ ARIZONA_FLL1_FREERUN, 0);
++ regmap_update_bits(arizona->regmap, fll->base + 1,
+ ARIZONA_FLL1_ENA, ARIZONA_FLL1_ENA);
+ if (fll->ref_src >= 0 && fll->sync_src >= 0 &&
+ fll->ref_src != fll->sync_src)
+@@ -1543,6 +1545,8 @@ static void arizona_disable_fll(struct a
+ struct arizona *arizona = fll->arizona;
+ bool change;
+
++ regmap_update_bits(arizona->regmap, fll->base + 1,
++ ARIZONA_FLL1_FREERUN, ARIZONA_FLL1_FREERUN);
+ regmap_update_bits_check(arizona->regmap, fll->base + 1,
+ ARIZONA_FLL1_ENA, 0, &change);
+ regmap_update_bits(arizona->regmap, fll->base + 0x11,
--- /dev/null
+From afed4dbe3a043dbd833a53b6b4951e155708afd2 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Wed, 13 Nov 2013 17:15:00 +0100
+Subject: ASoC: blackfin: Fix missing break
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit afed4dbe3a043dbd833a53b6b4951e155708afd2 upstream.
+
+Fixes: 4b2ffc205cb9 ('ASoC: Blackfin I2S: add 8-bit sample support')
+Reported-by: David Binderman
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/blackfin/bf5xx-i2s.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/soc/blackfin/bf5xx-i2s.c
++++ b/sound/soc/blackfin/bf5xx-i2s.c
+@@ -121,6 +121,7 @@ static int bf5xx_i2s_hw_params(struct sn
+ bf5xx_i2s->tcr2 |= 7;
+ bf5xx_i2s->rcr2 |= 7;
+ sport_handle->wdsize = 1;
++ break;
+ case SNDRV_PCM_FORMAT_S16_LE:
+ bf5xx_i2s->tcr2 |= 15;
+ bf5xx_i2s->rcr2 |= 15;
--- /dev/null
+From 3d800c6d75b8c92fa928a0bcaf95cd7ac5fd1ce5 Mon Sep 17 00:00:00 2001
+From: Brian Austin <brian.austin@cirrus.com>
+Date: Thu, 14 Nov 2013 11:46:12 -0600
+Subject: ASoC: cs42l52: Correct MIC CTL mask
+
+From: Brian Austin <brian.austin@cirrus.com>
+
+commit 3d800c6d75b8c92fa928a0bcaf95cd7ac5fd1ce5 upstream.
+
+The mask for CS42L52_MIC_CTL_TYPE_MASK was wrong keeping the mic config
+from being set correctly.
+
+Signed-off-by: Brian Austin <brian.austin@cirrus.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/cs42l52.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/soc/codecs/cs42l52.h
++++ b/sound/soc/codecs/cs42l52.h
+@@ -179,7 +179,7 @@
+ #define CS42L52_MICB_CTL 0x11
+ #define CS42L52_MIC_CTL_MIC_SEL_MASK 0xBF
+ #define CS42L52_MIC_CTL_MIC_SEL_SHIFT 6
+-#define CS42L52_MIC_CTL_TYPE_MASK 0xDF
++#define CS42L52_MIC_CTL_TYPE_MASK 0x20
+ #define CS42L52_MIC_CTL_TYPE_SHIFT 5
+
+
--- /dev/null
+From fc7dc61d9a87011aaf8a6eb3144ebf9552adf5d2 Mon Sep 17 00:00:00 2001
+From: Oskar Schirmer <oskar@scara.com>
+Date: Tue, 12 Nov 2013 15:46:38 +0000
+Subject: ASoC: fsl: imx-pcm-fiq: omit fiq counter to avoid harm in unbalanced situations
+
+From: Oskar Schirmer <oskar@scara.com>
+
+commit fc7dc61d9a87011aaf8a6eb3144ebf9552adf5d2 upstream.
+
+Unbalanced calls to snd_imx_pcm_trigger() may result in endless
+FIQ activity and thus provoke eternal sound. While on the first glance,
+the switch statement looks pretty symmetric, the SUSPEND/RESUME
+pair is not: the suspend case comes along snd_pcm_suspend_all(),
+which for fsl/imx-pcm-fiq is called only at snd_soc_suspend(),
+but the resume case originates straight from the SNDRV_PCM_IOCTL_RESUME.
+This way userland may provoke an unbalanced resume, which might cause
+the fiq_enable counter to increase and never return to zero again,
+so eventually imx_pcm_fiq is never disabled.
+
+Simply removing the fiq_enable will solve the problem, as long as
+one never goes play and capture game simultaneously, but beware
+trying both at once, the early TRIGGER_STOP will cut off the other
+activity prematurely. So now playing and capturing is scrutinized
+separately, instead of by counting.
+
+Signed-off-by: Oskar Schirmer <oskar@scara.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/fsl/imx-pcm-fiq.c | 29 +++++++++++++++++------------
+ 1 file changed, 17 insertions(+), 12 deletions(-)
+
+--- a/sound/soc/fsl/imx-pcm-fiq.c
++++ b/sound/soc/fsl/imx-pcm-fiq.c
+@@ -44,7 +44,8 @@ struct imx_pcm_runtime_data {
+ struct hrtimer hrt;
+ int poll_time_ns;
+ struct snd_pcm_substream *substream;
+- atomic_t running;
++ atomic_t playing;
++ atomic_t capturing;
+ };
+
+ static enum hrtimer_restart snd_hrtimer_callback(struct hrtimer *hrt)
+@@ -56,7 +57,7 @@ static enum hrtimer_restart snd_hrtimer_
+ struct pt_regs regs;
+ unsigned long delta;
+
+- if (!atomic_read(&iprtd->running))
++ if (!atomic_read(&iprtd->playing) && !atomic_read(&iprtd->capturing))
+ return HRTIMER_NORESTART;
+
+ get_fiq_regs(®s);
+@@ -124,7 +125,6 @@ static int snd_imx_pcm_prepare(struct sn
+ return 0;
+ }
+
+-static int fiq_enable;
+ static int imx_pcm_fiq;
+
+ static int snd_imx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
+@@ -136,23 +136,27 @@ static int snd_imx_pcm_trigger(struct sn
+ case SNDRV_PCM_TRIGGER_START:
+ case SNDRV_PCM_TRIGGER_RESUME:
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+- atomic_set(&iprtd->running, 1);
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
++ atomic_set(&iprtd->playing, 1);
++ else
++ atomic_set(&iprtd->capturing, 1);
+ hrtimer_start(&iprtd->hrt, ns_to_ktime(iprtd->poll_time_ns),
+ HRTIMER_MODE_REL);
+- if (++fiq_enable == 1)
+- enable_fiq(imx_pcm_fiq);
+-
++ enable_fiq(imx_pcm_fiq);
+ break;
+
+ case SNDRV_PCM_TRIGGER_STOP:
+ case SNDRV_PCM_TRIGGER_SUSPEND:
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+- atomic_set(&iprtd->running, 0);
+-
+- if (--fiq_enable == 0)
++ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
++ atomic_set(&iprtd->playing, 0);
++ else
++ atomic_set(&iprtd->capturing, 0);
++ if (!atomic_read(&iprtd->playing) &&
++ !atomic_read(&iprtd->capturing))
+ disable_fiq(imx_pcm_fiq);
+-
+ break;
++
+ default:
+ return -EINVAL;
+ }
+@@ -200,7 +204,8 @@ static int snd_imx_open(struct snd_pcm_s
+
+ iprtd->substream = substream;
+
+- atomic_set(&iprtd->running, 0);
++ atomic_set(&iprtd->playing, 0);
++ atomic_set(&iprtd->capturing, 0);
+ hrtimer_init(&iprtd->hrt, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
+ iprtd->hrt.function = snd_hrtimer_callback;
+
--- /dev/null
+From f69f86b1ba6493126a7f093a65a8952bcb183de2 Mon Sep 17 00:00:00 2001
+From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
+Date: Tue, 19 Nov 2013 10:51:29 +0000
+Subject: ASoC: wm5110: Add post SYSCLK register patch for rev D chip
+
+From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
+
+commit f69f86b1ba6493126a7f093a65a8952bcb183de2 upstream.
+
+Certain registers require patching after the SYSCLK has been brought up
+add support for this into the CODEC driver.
+
+Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/wm5110.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 42 insertions(+), 1 deletion(-)
+
+--- a/sound/soc/codecs/wm5110.c
++++ b/sound/soc/codecs/wm5110.c
+@@ -37,6 +37,47 @@ struct wm5110_priv {
+ struct arizona_fll fll[2];
+ };
+
++static const struct reg_default wm5110_sysclk_revd_patch[] = {
++ { 0x3093, 0x1001 },
++ { 0x30E3, 0x1301 },
++ { 0x3133, 0x1201 },
++ { 0x3183, 0x1501 },
++ { 0x31D3, 0x1401 },
++};
++
++static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w,
++ struct snd_kcontrol *kcontrol, int event)
++{
++ struct snd_soc_codec *codec = w->codec;
++ struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
++ struct regmap *regmap = codec->control_data;
++ const struct reg_default *patch = NULL;
++ int i, patch_size;
++
++ switch (arizona->rev) {
++ case 3:
++ patch = wm5110_sysclk_revd_patch;
++ patch_size = ARRAY_SIZE(wm5110_sysclk_revd_patch);
++ break;
++ default:
++ return 0;
++ }
++
++ switch (event) {
++ case SND_SOC_DAPM_POST_PMU:
++ if (patch)
++ for (i = 0; i < patch_size; i++)
++ regmap_write(regmap, patch[i].reg,
++ patch[i].def);
++ break;
++
++ default:
++ break;
++ }
++
++ return 0;
++}
++
+ static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
+ static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
+ static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
+@@ -400,7 +441,7 @@ static const struct snd_kcontrol_new wm5
+
+ static const struct snd_soc_dapm_widget wm5110_dapm_widgets[] = {
+ SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
+- 0, NULL, 0),
++ 0, wm5110_sysclk_ev, SND_SOC_DAPM_POST_PMU),
+ SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
+ ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
+ SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
--- /dev/null
+From 50bfcf2df2fadf77e143d6099150e6fa7ef4d78c Mon Sep 17 00:00:00 2001
+From: Nicolin Chen <b42378@freescale.com>
+Date: Thu, 14 Nov 2013 11:59:21 +0800
+Subject: ASoC: wm8962: Turn on regcache_cache_only before disabling regulator
+
+From: Nicolin Chen <b42378@freescale.com>
+
+commit 50bfcf2df2fadf77e143d6099150e6fa7ef4d78c upstream.
+
+It's safer to turn on regcache_cache_only before disabling regulator since
+the driver will turn off the regcache_cache_only after enabling regulator.
+
+If we remain cache_only false, some command like 'amixer cset' would get
+failure if being run before wm8962_resume().
+
+Signed-off-by: Nicolin Chen <b42378@freescale.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/wm8962.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/sound/soc/codecs/wm8962.c
++++ b/sound/soc/codecs/wm8962.c
+@@ -3722,6 +3722,8 @@ static int wm8962_i2c_probe(struct i2c_c
+ if (ret < 0)
+ goto err_enable;
+
++ regcache_cache_only(wm8962->regmap, true);
++
+ /* The drivers should power up as needed */
+ regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
+
--- /dev/null
+From c01422a4a184a183b03fb3046af88d61828f6d56 Mon Sep 17 00:00:00 2001
+From: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
+Date: Mon, 4 Nov 2013 12:03:44 +0000
+Subject: ASoC: wm_adsp: Interpret ADSP memory region lengths as 32 bit words
+
+From: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
+
+commit c01422a4a184a183b03fb3046af88d61828f6d56 upstream.
+
+Pad the ADSP word (3 bytes) to 4 bytes in the kernel and calculate
+lengths based on padded ADSP words instead of treating them as bytes
+
+Signed-off-by: Nariman Poushin <nariman@opensource.wolfsonmicro.com>
+Signed-off-by: Dimitris Papastamos <dp@opensource.wolfsonmicro.com>
+Signed-off-by: Mark Brown <broonie@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/wm_adsp.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/sound/soc/codecs/wm_adsp.c
++++ b/sound/soc/codecs/wm_adsp.c
+@@ -1062,6 +1062,7 @@ static int wm_adsp_setup_algs(struct wm_
+ if (i + 1 < algs) {
+ region->len = be32_to_cpu(adsp1_alg[i + 1].dm);
+ region->len -= be32_to_cpu(adsp1_alg[i].dm);
++ region->len *= 4;
+ wm_adsp_create_control(dsp, region);
+ } else {
+ adsp_warn(dsp, "Missing length info for region DM with ID %x\n",
+@@ -1079,6 +1080,7 @@ static int wm_adsp_setup_algs(struct wm_
+ if (i + 1 < algs) {
+ region->len = be32_to_cpu(adsp1_alg[i + 1].zm);
+ region->len -= be32_to_cpu(adsp1_alg[i].zm);
++ region->len *= 4;
+ wm_adsp_create_control(dsp, region);
+ } else {
+ adsp_warn(dsp, "Missing length info for region ZM with ID %x\n",
+@@ -1108,6 +1110,7 @@ static int wm_adsp_setup_algs(struct wm_
+ if (i + 1 < algs) {
+ region->len = be32_to_cpu(adsp2_alg[i + 1].xm);
+ region->len -= be32_to_cpu(adsp2_alg[i].xm);
++ region->len *= 4;
+ wm_adsp_create_control(dsp, region);
+ } else {
+ adsp_warn(dsp, "Missing length info for region XM with ID %x\n",
+@@ -1125,6 +1128,7 @@ static int wm_adsp_setup_algs(struct wm_
+ if (i + 1 < algs) {
+ region->len = be32_to_cpu(adsp2_alg[i + 1].ym);
+ region->len -= be32_to_cpu(adsp2_alg[i].ym);
++ region->len *= 4;
+ wm_adsp_create_control(dsp, region);
+ } else {
+ adsp_warn(dsp, "Missing length info for region YM with ID %x\n",
+@@ -1142,6 +1146,7 @@ static int wm_adsp_setup_algs(struct wm_
+ if (i + 1 < algs) {
+ region->len = be32_to_cpu(adsp2_alg[i + 1].zm);
+ region->len -= be32_to_cpu(adsp2_alg[i].zm);
++ region->len *= 4;
+ wm_adsp_create_control(dsp, region);
+ } else {
+ adsp_warn(dsp, "Missing length info for region ZM with ID %x\n",
--- /dev/null
+From ad5066d4c2b1d696749f8d7816357c23b648c4d3 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Tue, 12 Nov 2013 15:09:39 -0800
+Subject: backlight: atmel-pwm-bl: fix gpio polarity in remove
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit ad5066d4c2b1d696749f8d7816357c23b648c4d3 upstream.
+
+Make sure to honour gpio polarity also at remove so that the backlight is
+actually disabled on boards with active-low enable pin.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Acked-by: Jingoo Han <jg1.han@samsung.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/backlight/atmel-pwm-bl.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/video/backlight/atmel-pwm-bl.c
++++ b/drivers/video/backlight/atmel-pwm-bl.c
+@@ -206,8 +206,10 @@ static int atmel_pwm_bl_remove(struct pl
+ {
+ struct atmel_pwm_bl *pwmbl = platform_get_drvdata(pdev);
+
+- if (pwmbl->gpio_on != -1)
+- gpio_set_value(pwmbl->gpio_on, 0);
++ if (pwmbl->gpio_on != -1) {
++ gpio_set_value(pwmbl->gpio_on,
++ 0 ^ pwmbl->pdata->on_active_low);
++ }
+ pwm_channel_disable(&pwmbl->pwmc);
+ pwm_channel_free(&pwmbl->pwmc);
+ backlight_device_unregister(pwmbl->bldev);
--- /dev/null
+From 185d91442550110db67a7dc794a32efcea455a36 Mon Sep 17 00:00:00 2001
+From: Johan Hovold <jhovold@gmail.com>
+Date: Tue, 12 Nov 2013 15:09:38 -0800
+Subject: backlight: atmel-pwm-bl: fix reported brightness
+
+From: Johan Hovold <jhovold@gmail.com>
+
+commit 185d91442550110db67a7dc794a32efcea455a36 upstream.
+
+The driver supports 16-bit brightness values, but the value returned
+from get_brightness was truncated to eight bits.
+
+Signed-off-by: Johan Hovold <jhovold@gmail.com>
+Cc: Jingoo Han <jg1.han@samsung.com>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/backlight/atmel-pwm-bl.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/video/backlight/atmel-pwm-bl.c
++++ b/drivers/video/backlight/atmel-pwm-bl.c
+@@ -70,7 +70,7 @@ static int atmel_pwm_bl_set_intensity(st
+ static int atmel_pwm_bl_get_intensity(struct backlight_device *bd)
+ {
+ struct atmel_pwm_bl *pwmbl = bl_get_data(bd);
+- u8 intensity;
++ u32 intensity;
+
+ if (pwmbl->pdata->pwm_active_low) {
+ intensity = pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY) -
+@@ -80,7 +80,7 @@ static int atmel_pwm_bl_get_intensity(st
+ pwm_channel_readl(&pwmbl->pwmc, PWM_CDTY);
+ }
+
+- return intensity;
++ return intensity & 0xffff;
+ }
+
+ static int atmel_pwm_bl_init_pwm(struct atmel_pwm_bl *pwmbl)
--- /dev/null
+From 0219132fe7c26574371232b50db085573f6fbd3f Mon Sep 17 00:00:00 2001
+From: Helge Deller <deller@gmx.de>
+Date: Wed, 6 Nov 2013 23:38:59 +0100
+Subject: parisc: sticon - unbreak on 64bit kernel
+
+From: Helge Deller <deller@gmx.de>
+
+commit 0219132fe7c26574371232b50db085573f6fbd3f upstream.
+
+STI text console (sticon) was broken on 64bit machines with more than
+4GB RAM and this lead in some cases to a kernel crash.
+
+Since sticon uses the 32bit STI API it needs to keep pointers to memory
+below 4GB. But on a 64bit kernel some memory regions (e.g. the kernel
+stack) might be above 4GB which then may crash the kernel in the STI
+functions.
+
+Additionally sticon didn't selected the built-in framebuffer fonts by
+default. This is now fixed.
+
+On a side-note: Theoretically we could enhance the sticon driver to
+use the 64bit STI API. But - beside the fact that some machines don't
+provide a 64bit STI ROM - this would just add complexity.
+
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/video/console/sticore.c | 168 ++++++++++++++++++++++++----------------
+ drivers/video/sticore.h | 62 +++++++++++---
+ drivers/video/stifb.c | 10 +-
+ 3 files changed, 159 insertions(+), 81 deletions(-)
+
+--- a/drivers/video/console/sticore.c
++++ b/drivers/video/console/sticore.c
+@@ -3,7 +3,7 @@
+ * core code for console driver using HP's STI firmware
+ *
+ * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
+- * Copyright (C) 2001-2003 Helge Deller <deller@gmx.de>
++ * Copyright (C) 2001-2013 Helge Deller <deller@gmx.de>
+ * Copyright (C) 2001-2002 Thomas Bogendoerfer <tsbogend@alpha.franken.de>
+ *
+ * TODO:
+@@ -30,7 +30,7 @@
+
+ #include "../sticore.h"
+
+-#define STI_DRIVERVERSION "Version 0.9a"
++#define STI_DRIVERVERSION "Version 0.9b"
+
+ static struct sti_struct *default_sti __read_mostly;
+
+@@ -73,28 +73,34 @@ static const struct sti_init_flags defau
+
+ static int sti_init_graph(struct sti_struct *sti)
+ {
+- struct sti_init_inptr_ext inptr_ext = { 0, };
+- struct sti_init_inptr inptr = {
+- .text_planes = 3, /* # of text planes (max 3 for STI) */
+- .ext_ptr = STI_PTR(&inptr_ext)
+- };
+- struct sti_init_outptr outptr = { 0, };
++ struct sti_init_inptr *inptr = &sti->sti_data->init_inptr;
++ struct sti_init_inptr_ext *inptr_ext = &sti->sti_data->init_inptr_ext;
++ struct sti_init_outptr *outptr = &sti->sti_data->init_outptr;
+ unsigned long flags;
+- int ret;
++ int ret, err;
+
+ spin_lock_irqsave(&sti->lock, flags);
+
+- ret = STI_CALL(sti->init_graph, &default_init_flags, &inptr,
+- &outptr, sti->glob_cfg);
++ memset(inptr, 0, sizeof(*inptr));
++ inptr->text_planes = 3; /* # of text planes (max 3 for STI) */
++ memset(inptr_ext, 0, sizeof(*inptr_ext));
++ inptr->ext_ptr = STI_PTR(inptr_ext);
++ outptr->errno = 0;
++
++ ret = sti_call(sti, sti->init_graph, &default_init_flags, inptr,
++ outptr, sti->glob_cfg);
++
++ if (ret >= 0)
++ sti->text_planes = outptr->text_planes;
++ err = outptr->errno;
+
+ spin_unlock_irqrestore(&sti->lock, flags);
+
+ if (ret < 0) {
+- printk(KERN_ERR "STI init_graph failed (ret %d, errno %d)\n",ret,outptr.errno);
++ pr_err("STI init_graph failed (ret %d, errno %d)\n", ret, err);
+ return -1;
+ }
+
+- sti->text_planes = outptr.text_planes;
+ return 0;
+ }
+
+@@ -104,16 +110,18 @@ static const struct sti_conf_flags defau
+
+ static void sti_inq_conf(struct sti_struct *sti)
+ {
+- struct sti_conf_inptr inptr = { 0, };
++ struct sti_conf_inptr *inptr = &sti->sti_data->inq_inptr;
++ struct sti_conf_outptr *outptr = &sti->sti_data->inq_outptr;
+ unsigned long flags;
+ s32 ret;
+
+- sti->outptr.ext_ptr = STI_PTR(&sti->outptr_ext);
++ outptr->ext_ptr = STI_PTR(&sti->sti_data->inq_outptr_ext);
+
+ do {
+ spin_lock_irqsave(&sti->lock, flags);
+- ret = STI_CALL(sti->inq_conf, &default_conf_flags,
+- &inptr, &sti->outptr, sti->glob_cfg);
++ memset(inptr, 0, sizeof(*inptr));
++ ret = sti_call(sti, sti->inq_conf, &default_conf_flags,
++ inptr, outptr, sti->glob_cfg);
+ spin_unlock_irqrestore(&sti->lock, flags);
+ } while (ret == 1);
+ }
+@@ -126,7 +134,8 @@ static const struct sti_font_flags defau
+ void
+ sti_putc(struct sti_struct *sti, int c, int y, int x)
+ {
+- struct sti_font_inptr inptr = {
++ struct sti_font_inptr *inptr = &sti->sti_data->font_inptr;
++ struct sti_font_inptr inptr_default = {
+ .font_start_addr= STI_PTR(sti->font->raw),
+ .index = c_index(sti, c),
+ .fg_color = c_fg(sti, c),
+@@ -134,14 +143,15 @@ sti_putc(struct sti_struct *sti, int c,
+ .dest_x = x * sti->font_width,
+ .dest_y = y * sti->font_height,
+ };
+- struct sti_font_outptr outptr = { 0, };
++ struct sti_font_outptr *outptr = &sti->sti_data->font_outptr;
+ s32 ret;
+ unsigned long flags;
+
+ do {
+ spin_lock_irqsave(&sti->lock, flags);
+- ret = STI_CALL(sti->font_unpmv, &default_font_flags,
+- &inptr, &outptr, sti->glob_cfg);
++ *inptr = inptr_default;
++ ret = sti_call(sti, sti->font_unpmv, &default_font_flags,
++ inptr, outptr, sti->glob_cfg);
+ spin_unlock_irqrestore(&sti->lock, flags);
+ } while (ret == 1);
+ }
+@@ -156,7 +166,8 @@ void
+ sti_set(struct sti_struct *sti, int src_y, int src_x,
+ int height, int width, u8 color)
+ {
+- struct sti_blkmv_inptr inptr = {
++ struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr;
++ struct sti_blkmv_inptr inptr_default = {
+ .fg_color = color,
+ .bg_color = color,
+ .src_x = src_x,
+@@ -166,14 +177,15 @@ sti_set(struct sti_struct *sti, int src_
+ .width = width,
+ .height = height,
+ };
+- struct sti_blkmv_outptr outptr = { 0, };
++ struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr;
+ s32 ret;
+ unsigned long flags;
+
+ do {
+ spin_lock_irqsave(&sti->lock, flags);
+- ret = STI_CALL(sti->block_move, &clear_blkmv_flags,
+- &inptr, &outptr, sti->glob_cfg);
++ *inptr = inptr_default;
++ ret = sti_call(sti, sti->block_move, &clear_blkmv_flags,
++ inptr, outptr, sti->glob_cfg);
+ spin_unlock_irqrestore(&sti->lock, flags);
+ } while (ret == 1);
+ }
+@@ -182,7 +194,8 @@ void
+ sti_clear(struct sti_struct *sti, int src_y, int src_x,
+ int height, int width, int c)
+ {
+- struct sti_blkmv_inptr inptr = {
++ struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr;
++ struct sti_blkmv_inptr inptr_default = {
+ .fg_color = c_fg(sti, c),
+ .bg_color = c_bg(sti, c),
+ .src_x = src_x * sti->font_width,
+@@ -192,14 +205,15 @@ sti_clear(struct sti_struct *sti, int sr
+ .width = width * sti->font_width,
+ .height = height* sti->font_height,
+ };
+- struct sti_blkmv_outptr outptr = { 0, };
++ struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr;
+ s32 ret;
+ unsigned long flags;
+
+ do {
+ spin_lock_irqsave(&sti->lock, flags);
+- ret = STI_CALL(sti->block_move, &clear_blkmv_flags,
+- &inptr, &outptr, sti->glob_cfg);
++ *inptr = inptr_default;
++ ret = sti_call(sti, sti->block_move, &clear_blkmv_flags,
++ inptr, outptr, sti->glob_cfg);
+ spin_unlock_irqrestore(&sti->lock, flags);
+ } while (ret == 1);
+ }
+@@ -212,7 +226,8 @@ void
+ sti_bmove(struct sti_struct *sti, int src_y, int src_x,
+ int dst_y, int dst_x, int height, int width)
+ {
+- struct sti_blkmv_inptr inptr = {
++ struct sti_blkmv_inptr *inptr = &sti->sti_data->blkmv_inptr;
++ struct sti_blkmv_inptr inptr_default = {
+ .src_x = src_x * sti->font_width,
+ .src_y = src_y * sti->font_height,
+ .dest_x = dst_x * sti->font_width,
+@@ -220,14 +235,15 @@ sti_bmove(struct sti_struct *sti, int sr
+ .width = width * sti->font_width,
+ .height = height* sti->font_height,
+ };
+- struct sti_blkmv_outptr outptr = { 0, };
++ struct sti_blkmv_outptr *outptr = &sti->sti_data->blkmv_outptr;
+ s32 ret;
+ unsigned long flags;
+
+ do {
+ spin_lock_irqsave(&sti->lock, flags);
+- ret = STI_CALL(sti->block_move, &default_blkmv_flags,
+- &inptr, &outptr, sti->glob_cfg);
++ *inptr = inptr_default;
++ ret = sti_call(sti, sti->block_move, &default_blkmv_flags,
++ inptr, outptr, sti->glob_cfg);
+ spin_unlock_irqrestore(&sti->lock, flags);
+ } while (ret == 1);
+ }
+@@ -284,7 +300,7 @@ __setup("sti=", sti_setup);
+
+
+
+-static char *font_name[MAX_STI_ROMS] = { "VGA8x16", };
++static char *font_name[MAX_STI_ROMS];
+ static int font_index[MAX_STI_ROMS],
+ font_height[MAX_STI_ROMS],
+ font_width[MAX_STI_ROMS];
+@@ -389,10 +405,10 @@ static void sti_dump_outptr(struct sti_s
+ "%d used bits\n"
+ "%d planes\n"
+ "attributes %08x\n",
+- sti->outptr.bits_per_pixel,
+- sti->outptr.bits_used,
+- sti->outptr.planes,
+- sti->outptr.attributes));
++ sti->sti_data->inq_outptr.bits_per_pixel,
++ sti->sti_data->inq_outptr.bits_used,
++ sti->sti_data->inq_outptr.planes,
++ sti->sti_data->inq_outptr.attributes));
+ }
+
+ static int sti_init_glob_cfg(struct sti_struct *sti, unsigned long rom_address,
+@@ -402,24 +418,21 @@ static int sti_init_glob_cfg(struct sti_
+ struct sti_glob_cfg_ext *glob_cfg_ext;
+ void *save_addr;
+ void *sti_mem_addr;
+- const int save_addr_size = 1024; /* XXX */
+- int i;
++ int i, size;
+
+- if (!sti->sti_mem_request)
++ if (sti->sti_mem_request < 256)
+ sti->sti_mem_request = 256; /* STI default */
+
+- glob_cfg = kzalloc(sizeof(*sti->glob_cfg), GFP_KERNEL);
+- glob_cfg_ext = kzalloc(sizeof(*glob_cfg_ext), GFP_KERNEL);
+- save_addr = kzalloc(save_addr_size, GFP_KERNEL);
+- sti_mem_addr = kzalloc(sti->sti_mem_request, GFP_KERNEL);
+-
+- if (!(glob_cfg && glob_cfg_ext && save_addr && sti_mem_addr)) {
+- kfree(glob_cfg);
+- kfree(glob_cfg_ext);
+- kfree(save_addr);
+- kfree(sti_mem_addr);
++ size = sizeof(struct sti_all_data) + sti->sti_mem_request - 256;
++
++ sti->sti_data = kzalloc(size, STI_LOWMEM);
++ if (!sti->sti_data)
+ return -ENOMEM;
+- }
++
++ glob_cfg = &sti->sti_data->glob_cfg;
++ glob_cfg_ext = &sti->sti_data->glob_cfg_ext;
++ save_addr = &sti->sti_data->save_addr;
++ sti_mem_addr = &sti->sti_data->sti_mem_addr;
+
+ glob_cfg->ext_ptr = STI_PTR(glob_cfg_ext);
+ glob_cfg->save_addr = STI_PTR(save_addr);
+@@ -475,32 +488,31 @@ static int sti_init_glob_cfg(struct sti_
+ return 0;
+ }
+
+-#ifdef CONFIG_FB
++#ifdef CONFIG_FONTS
+ static struct sti_cooked_font *
+ sti_select_fbfont(struct sti_cooked_rom *cooked_rom, const char *fbfont_name)
+ {
+- const struct font_desc *fbfont;
++ const struct font_desc *fbfont = NULL;
+ unsigned int size, bpc;
+ void *dest;
+ struct sti_rom_font *nf;
+ struct sti_cooked_font *cooked_font;
+
+- if (!fbfont_name || !strlen(fbfont_name))
+- return NULL;
+- fbfont = find_font(fbfont_name);
++ if (fbfont_name && strlen(fbfont_name))
++ fbfont = find_font(fbfont_name);
+ if (!fbfont)
+ fbfont = get_default_font(1024,768, ~(u32)0, ~(u32)0);
+ if (!fbfont)
+ return NULL;
+
+- DPRINTK((KERN_DEBUG "selected %dx%d fb-font %s\n",
+- fbfont->width, fbfont->height, fbfont->name));
++ pr_info("STI selected %dx%d framebuffer font %s for sticon\n",
++ fbfont->width, fbfont->height, fbfont->name);
+
+ bpc = ((fbfont->width+7)/8) * fbfont->height;
+ size = bpc * 256;
+ size += sizeof(struct sti_rom_font);
+
+- nf = kzalloc(size, GFP_KERNEL);
++ nf = kzalloc(size, STI_LOWMEM);
+ if (!nf)
+ return NULL;
+
+@@ -637,7 +649,7 @@ static void *sti_bmode_font_raw(struct s
+ unsigned char *n, *p, *q;
+ int size = f->raw->bytes_per_char*256+sizeof(struct sti_rom_font);
+
+- n = kzalloc (4*size, GFP_KERNEL);
++ n = kzalloc(4*size, STI_LOWMEM);
+ if (!n)
+ return NULL;
+ p = n + 3;
+@@ -673,7 +685,7 @@ static struct sti_rom *sti_get_bmode_rom
+ sti_bmode_rom_copy(address + BMODE_LAST_ADDR_OFFS, sizeof(size), &size);
+
+ size = (size+3) / 4;
+- raw = kmalloc(size, GFP_KERNEL);
++ raw = kmalloc(size, STI_LOWMEM);
+ if (raw) {
+ sti_bmode_rom_copy(address, size, raw);
+ memmove (&raw->res004, &raw->type[0], 0x3c);
+@@ -707,7 +719,7 @@ static struct sti_rom *sti_get_wmode_rom
+ /* read the ROM size directly from the struct in ROM */
+ size = gsc_readl(address + offsetof(struct sti_rom,last_addr));
+
+- raw = kmalloc(size, GFP_KERNEL);
++ raw = kmalloc(size, STI_LOWMEM);
+ if (raw)
+ sti_rom_copy(address, size, raw);
+
+@@ -743,6 +755,10 @@ static int sti_read_rom(int wordmode, st
+
+ address = (unsigned long) STI_PTR(raw);
+
++ pr_info("STI ROM supports 32 %sbit firmware functions.\n",
++ raw->alt_code_type == ALT_CODE_TYPE_PA_RISC_64
++ ? "and 64 " : "");
++
+ sti->font_unpmv = address + (raw->font_unpmv & 0x03ffffff);
+ sti->block_move = address + (raw->block_move & 0x03ffffff);
+ sti->init_graph = address + (raw->init_graph & 0x03ffffff);
+@@ -901,7 +917,8 @@ test_rom:
+ sti_dump_globcfg(sti->glob_cfg, sti->sti_mem_request);
+ sti_dump_outptr(sti);
+
+- printk(KERN_INFO " graphics card name: %s\n", sti->outptr.dev_name );
++ pr_info(" graphics card name: %s\n",
++ sti->sti_data->inq_outptr.dev_name);
+
+ sti_roms[num_sti_roms] = sti;
+ num_sti_roms++;
+@@ -1073,6 +1090,29 @@ struct sti_struct * sti_get_rom(unsigned
+ }
+ EXPORT_SYMBOL(sti_get_rom);
+
++
++int sti_call(const struct sti_struct *sti, unsigned long func,
++ const void *flags, void *inptr, void *outptr,
++ struct sti_glob_cfg *glob_cfg)
++{
++ unsigned long _flags = STI_PTR(flags);
++ unsigned long _inptr = STI_PTR(inptr);
++ unsigned long _outptr = STI_PTR(outptr);
++ unsigned long _glob_cfg = STI_PTR(glob_cfg);
++ int ret;
++
++#ifdef CONFIG_64BIT
++ /* Check for overflow when using 32bit STI on 64bit kernel. */
++ if (WARN_ONCE(_flags>>32 || _inptr>>32 || _outptr>>32 || _glob_cfg>>32,
++ "Out of 32bit-range pointers!"))
++ return -1;
++#endif
++
++ ret = pdc_sti_call(func, _flags, _inptr, _outptr, _glob_cfg);
++
++ return ret;
++}
++
+ MODULE_AUTHOR("Philipp Rumpf, Helge Deller, Thomas Bogendoerfer");
+ MODULE_DESCRIPTION("Core STI driver for HP's NGLE series graphics cards in HP PARISC machines");
+ MODULE_LICENSE("GPL v2");
+--- a/drivers/video/sticore.h
++++ b/drivers/video/sticore.h
+@@ -18,6 +18,9 @@
+ #define STI_FONT_HPROMAN8 1
+ #define STI_FONT_KANA8 2
+
++#define ALT_CODE_TYPE_UNKNOWN 0x00 /* alt code type values */
++#define ALT_CODE_TYPE_PA_RISC_64 0x01
++
+ /* The latency of the STI functions cannot really be reduced by setting
+ * this to 0; STI doesn't seem to be designed to allow calling a different
+ * function (or the same function with different arguments) after a
+@@ -40,14 +43,6 @@
+
+ #define STI_PTR(p) ( virt_to_phys(p) )
+ #define PTR_STI(p) ( phys_to_virt((unsigned long)p) )
+-#define STI_CALL(func, flags, inptr, outptr, glob_cfg) \
+- ({ \
+- pdc_sti_call( func, STI_PTR(flags), \
+- STI_PTR(inptr), \
+- STI_PTR(outptr), \
+- STI_PTR(glob_cfg)); \
+- })
+-
+
+ #define sti_onscreen_x(sti) (sti->glob_cfg->onscreen_x)
+ #define sti_onscreen_y(sti) (sti->glob_cfg->onscreen_y)
+@@ -56,6 +51,12 @@
+ #define sti_font_x(sti) (PTR_STI(sti->font)->width)
+ #define sti_font_y(sti) (PTR_STI(sti->font)->height)
+
++#ifdef CONFIG_64BIT
++#define STI_LOWMEM (GFP_KERNEL | GFP_DMA)
++#else
++#define STI_LOWMEM (GFP_KERNEL)
++#endif
++
+
+ /* STI function configuration structs */
+
+@@ -306,6 +307,34 @@ struct sti_blkmv_outptr {
+ };
+
+
++/* sti_all_data is an internal struct which needs to be allocated in
++ * low memory (< 4GB) if STI is used with 32bit STI on a 64bit kernel */
++
++struct sti_all_data {
++ struct sti_glob_cfg glob_cfg;
++ struct sti_glob_cfg_ext glob_cfg_ext;
++
++ struct sti_conf_inptr inq_inptr;
++ struct sti_conf_outptr inq_outptr; /* configuration */
++ struct sti_conf_outptr_ext inq_outptr_ext;
++
++ struct sti_init_inptr_ext init_inptr_ext;
++ struct sti_init_inptr init_inptr;
++ struct sti_init_outptr init_outptr;
++
++ struct sti_blkmv_inptr blkmv_inptr;
++ struct sti_blkmv_outptr blkmv_outptr;
++
++ struct sti_font_inptr font_inptr;
++ struct sti_font_outptr font_outptr;
++
++ /* leave as last entries */
++ unsigned long save_addr[1024 / sizeof(unsigned long)];
++ /* min 256 bytes which is STI default, max sti->sti_mem_request */
++ unsigned long sti_mem_addr[256 / sizeof(unsigned long)];
++ /* do not add something below here ! */
++};
++
+ /* internal generic STI struct */
+
+ struct sti_struct {
+@@ -330,11 +359,9 @@ struct sti_struct {
+ region_t regions[STI_REGION_MAX];
+ unsigned long regions_phys[STI_REGION_MAX];
+
+- struct sti_glob_cfg *glob_cfg;
+- struct sti_cooked_font *font; /* ptr to selected font (cooked) */
++ struct sti_glob_cfg *glob_cfg; /* points into sti_all_data */
+
+- struct sti_conf_outptr outptr; /* configuration */
+- struct sti_conf_outptr_ext outptr_ext;
++ struct sti_cooked_font *font; /* ptr to selected font (cooked) */
+
+ struct pci_dev *pd;
+
+@@ -343,6 +370,9 @@ struct sti_struct {
+
+ /* pointer to the fb_info where this STI device is used */
+ struct fb_info *info;
++
++ /* pointer to all internal data */
++ struct sti_all_data *sti_data;
+ };
+
+
+@@ -350,6 +380,14 @@ struct sti_struct {
+
+ struct sti_struct *sti_get_rom(unsigned int index); /* 0: default sti */
+
++
++/* sticore main function to call STI firmware */
++
++int sti_call(const struct sti_struct *sti, unsigned long func,
++ const void *flags, void *inptr, void *outptr,
++ struct sti_glob_cfg *glob_cfg);
++
++
+ /* functions to call the STI ROM directly */
+
+ void sti_putc(struct sti_struct *sti, int c, int y, int x);
+--- a/drivers/video/stifb.c
++++ b/drivers/video/stifb.c
+@@ -1101,6 +1101,7 @@ static int __init stifb_init_fb(struct s
+ var = &info->var;
+
+ fb->sti = sti;
++ dev_name = sti->sti_data->inq_outptr.dev_name;
+ /* store upper 32bits of the graphics id */
+ fb->id = fb->sti->graphics_id[0];
+
+@@ -1114,11 +1115,11 @@ static int __init stifb_init_fb(struct s
+ Since this driver only supports standard mode, we check
+ if the device name contains the string "DX" and tell the
+ user how to reconfigure the card. */
+- if (strstr(sti->outptr.dev_name, "DX")) {
++ if (strstr(dev_name, "DX")) {
+ printk(KERN_WARNING
+ "WARNING: stifb framebuffer driver does not support '%s' in double-buffer mode.\n"
+ "WARNING: Please disable the double-buffer mode in IPL menu (the PARISC-BIOS).\n",
+- sti->outptr.dev_name);
++ dev_name);
+ goto out_err0;
+ }
+ /* fall though */
+@@ -1130,7 +1131,7 @@ static int __init stifb_init_fb(struct s
+ break;
+ default:
+ printk(KERN_WARNING "stifb: '%s' (id: 0x%08x) not supported.\n",
+- sti->outptr.dev_name, fb->id);
++ dev_name, fb->id);
+ goto out_err0;
+ }
+
+@@ -1154,7 +1155,6 @@ static int __init stifb_init_fb(struct s
+ fb->id = S9000_ID_A1659A;
+ break;
+ case S9000_ID_TIMBER: /* HP9000/710 Any (may be a grayscale device) */
+- dev_name = fb->sti->outptr.dev_name;
+ if (strstr(dev_name, "GRAYSCALE") ||
+ strstr(dev_name, "Grayscale") ||
+ strstr(dev_name, "grayscale"))
+@@ -1290,7 +1290,7 @@ static int __init stifb_init_fb(struct s
+ var->xres,
+ var->yres,
+ var->bits_per_pixel,
+- sti->outptr.dev_name,
++ dev_name,
+ fb->id,
+ fix->mmio_start);
+
--- /dev/null
+parisc-sticon-unbreak-on-64bit-kernel.patch
+arm-omap2-irq-am33xx-add-missing-register-check.patch
+arm-sa11x0-assabet-ensure-cs2-is-configured-appropriately.patch
+arm-7876-1-clear-thumb-2-it-state-on-exception-handling.patch
+arm-integrator_cp-set-lcd-0-1-enable-lines-when-turning-on-clcd.patch
+arm-omap2-omap_device-maintain-sane-runtime-pm-status-around-suspend-resume.patch
+arm-at91-fix-hanged-boot-due-to-early-rtc-interrupt.patch
+arm-at91-fix-hanged-boot-due-to-early-rtt-interrupt.patch
+arm-i.mx6q-fix-the-wrong-parent-of-can_root-clock.patch
+staging-tidspbridge-disable-driver.patch
+staging-lustre-ptlrpc-fix-ptlrpc_stop_pinger-logic.patch
+staging-zsmalloc-ensure-handle-is-never-0-on-success.patch
+staging-zram-fix-memory-leak-by-refcount-mismatch.patch
+staging-vt6656-fix-for-tx-usb-resets-from-vendors-driver.patch
+staging-r8188eu-fix-ap-mode.patch
+backlight-atmel-pwm-bl-fix-gpio-polarity-in-remove.patch
+backlight-atmel-pwm-bl-fix-reported-brightness.patch
+asoc-wm_adsp-interpret-adsp-memory-region-lengths-as-32-bit-words.patch
+asoc-ak4642-prevent-un-necessary-changes-to-sg_sl1.patch
+asoc-cs42l52-correct-mic-ctl-mask.patch
+asoc-wm8962-turn-on-regcache_cache_only-before-disabling-regulator.patch
+asoc-blackfin-fix-missing-break.patch
+asoc-fsl-imx-pcm-fiq-omit-fiq-counter-to-avoid-harm-in-unbalanced-situations.patch
+asoc-arizona-set-fll-to-free-run-before-disabling.patch
+asoc-wm5110-add-post-sysclk-register-patch-for-rev-d-chip.patch
--- /dev/null
+From b39f15c972c462903208531b82f9b34ba8ef3ec0 Mon Sep 17 00:00:00 2001
+From: Peng Tao <bergwolf@gmail.com>
+Date: Thu, 21 Nov 2013 22:42:45 +0800
+Subject: staging/lustre/ptlrpc: fix ptlrpc_stop_pinger logic
+
+From: Peng Tao <bergwolf@gmail.com>
+
+commit b39f15c972c462903208531b82f9b34ba8ef3ec0 upstream.
+
+It was introduced due to a patch hunk when porting
+commit 20802057 (staging/lustre/ptlrpc: race in pinger).
+
+Cc: Andreas Dilger <andreas.dilger@intel.com>
+Signed-off-by: Peng Tao <bergwolf@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/lustre/lustre/ptlrpc/pinger.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/staging/lustre/lustre/ptlrpc/pinger.c
++++ b/drivers/staging/lustre/lustre/ptlrpc/pinger.c
+@@ -409,8 +409,8 @@ int ptlrpc_stop_pinger(void)
+ struct l_wait_info lwi = { 0 };
+ int rc = 0;
+
+- if (!thread_is_init(&pinger_thread) &&
+- !thread_is_stopped(&pinger_thread))
++ if (thread_is_init(&pinger_thread) ||
++ thread_is_stopped(&pinger_thread))
+ return -EALREADY;
+
+ ptlrpc_pinger_remove_timeouts();
--- /dev/null
+From 9ecfc0f45033584ec58617cf6ec37f75833d97e8 Mon Sep 17 00:00:00 2001
+From: Larry Finger <Larry.Finger@lwfinger.net>
+Date: Sun, 17 Nov 2013 13:32:15 -0600
+Subject: staging: r8188eu: Fix AP mode
+
+From: Larry Finger <Larry.Finger@lwfinger.net>
+
+commit 9ecfc0f45033584ec58617cf6ec37f75833d97e8 upstream.
+
+Two code lines were accidentally deleted. Restore them.
+
+Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/rtl8188eu/core/rtw_ap.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/staging/rtl8188eu/core/rtw_ap.c
++++ b/drivers/staging/rtl8188eu/core/rtw_ap.c
+@@ -1115,6 +1115,9 @@ int rtw_check_beacon_data(struct adapter
+ return _FAIL;
+ }
+
++ /* fix bug of flush_cam_entry at STOP AP mode */
++ psta->state |= WIFI_AP_STATE;
++ rtw_indicate_connect(padapter);
+ pmlmepriv->cur_network.join_res = true;/* for check if already set beacon */
+ return ret;
+ }
--- /dev/null
+From 930ba4a374b96560ef9fde2145cdc454a164ddcc Mon Sep 17 00:00:00 2001
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Date: Wed, 27 Nov 2013 09:32:49 -0800
+Subject: Staging: tidspbridge: disable driver
+
+From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+commit 930ba4a374b96560ef9fde2145cdc454a164ddcc upstream.
+
+There seems to be no active maintainer for the driver, and there is an
+unfixed security bug, so disable the driver for now.
+
+Hopefully someone steps up to be the maintainer, and works to get this
+out of staging, otherwise it will be deleted soon.
+
+Reported-by: Nico Golde <nico@ngolde.de>
+Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
+Cc: Omar Ramirez Luna <omar.ramirez@copitl.com>
+Cc: Omar Ramirez Luna <omar.ramirez@ti.com>
+Cc: Kanigeri, Hari <h-kanigeri2@ti.com>
+Cc: Ameya Palande <ameya.palande@nokia.com>
+Cc: Guzman Lugo, Fernando <fernando.lugo@ti.com>
+Cc: Hebbar, Shivananda <x0hebbar@ti.com>
+Cc: Ramos Falcon, Ernesto <ernesto@ti.com>
+Cc: Felipe Contreras <felipe.contreras@gmail.com>
+Cc: Anna, Suman <s-anna@ti.com>
+Cc: Gupta, Ramesh <grgupta@ti.com>
+Cc: Gomez Castellanos, Ivan <ivan.gomez@ti.com>
+Cc: Andy Shevchenko <ext-andriy.shevchenko@nokia.com>
+Cc: Armando Uribe De Leon <x0095078@ti.com>
+Cc: Deepak Chitriki <deepak.chitriki@ti.com>
+Cc: Menon, Nishanth <nm@ti.com>
+Cc: Phil Carmody <ext-phil.2.carmody@nokia.com>
+Cc: Ohad Ben-Cohen <ohad@wizery.com>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/tidspbridge/Kconfig | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/staging/tidspbridge/Kconfig
++++ b/drivers/staging/tidspbridge/Kconfig
+@@ -4,7 +4,7 @@
+
+ menuconfig TIDSPBRIDGE
+ tristate "DSP Bridge driver"
+- depends on ARCH_OMAP3 && !ARCH_MULTIPLATFORM
++ depends on ARCH_OMAP3 && !ARCH_MULTIPLATFORM && BROKEN
+ select MAILBOX
+ select OMAP2PLUS_MBOX
+ help
--- /dev/null
+From 9df682927c2e3a92f43803d6b52095992e3b2ab8 Mon Sep 17 00:00:00 2001
+From: Malcolm Priestley <tvboxspy@gmail.com>
+Date: Thu, 7 Nov 2013 21:49:04 +0000
+Subject: staging: vt6656: [BUG] Fix for TX USB resets from vendors driver.
+
+From: Malcolm Priestley <tvboxspy@gmail.com>
+
+commit 9df682927c2e3a92f43803d6b52095992e3b2ab8 upstream.
+
+This fixes resets on heavy TX data traffic.
+
+Vendor driver
+VT6656_Linux_src_v1.21.03_x86_11.04.zip
+http://www.viaembedded.com/servlet/downloadSvl?id=1890&download_file_id=14704
+This is GPL-licensed code.
+
+original code
+BBbVT3184Init
+...
+//2007-0725, RobertChang add, Enable Squelch detect reset option(SQ_RST_Opt), USB (register4, bit1)
+CONTROLnsRequestIn(pDevice,
+ MESSAGE_TYPE_READ,
+ (WORD)0x600+4, // USB's Reg4's bit1
+ MESSAGE_REQUEST_MEM,
+ 1,
+ (PBYTE) &byData);
+byData = byData|2 ;
+CONTROLnsRequestOut(pDevice,
+ MESSAGE_TYPE_WRITE,
+ (WORD)0x600+4, // USB's Reg4's bit1
+ MESSAGE_REQUEST_MEM,
+ 1,
+ (PBYTE) &byData);
+
+return TRUE;//ntStatus;
+....
+
+A back port patch is needed for kernels less than 3.10.
+
+Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/vt6656/baseband.c | 11 +++++++++++
+ drivers/staging/vt6656/rndis.h | 2 ++
+ 2 files changed, 13 insertions(+)
+
+--- a/drivers/staging/vt6656/baseband.c
++++ b/drivers/staging/vt6656/baseband.c
+@@ -939,6 +939,7 @@ int BBbVT3184Init(struct vnt_private *pD
+ u8 * pbyAgc;
+ u16 wLengthAgc;
+ u8 abyArray[256];
++ u8 data;
+
+ ntStatus = CONTROLnsRequestIn(pDevice,
+ MESSAGE_TYPE_READ,
+@@ -1104,6 +1105,16 @@ else {
+ ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01);
+
+ RFbRFTableDownload(pDevice);
++
++ /* Fix for TX USB resets from vendors driver */
++ CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, USB_REG4,
++ MESSAGE_REQUEST_MEM, sizeof(data), &data);
++
++ data |= 0x2;
++
++ CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE, USB_REG4,
++ MESSAGE_REQUEST_MEM, sizeof(data), &data);
++
+ return true;//ntStatus;
+ }
+
+--- a/drivers/staging/vt6656/rndis.h
++++ b/drivers/staging/vt6656/rndis.h
+@@ -66,6 +66,8 @@
+
+ #define VIAUSB20_PACKET_HEADER 0x04
+
++#define USB_REG4 0x604
++
+ typedef struct _CMD_MESSAGE
+ {
+ u8 byData[256];
--- /dev/null
+From 1b672224d128ec2570eb37572ff803cfe452b4f7 Mon Sep 17 00:00:00 2001
+From: Rashika Kheria <rashika.kheria@gmail.com>
+Date: Sun, 10 Nov 2013 22:13:53 +0530
+Subject: Staging: zram: Fix memory leak by refcount mismatch
+
+From: Rashika Kheria <rashika.kheria@gmail.com>
+
+commit 1b672224d128ec2570eb37572ff803cfe452b4f7 upstream.
+
+As suggested by Minchan Kim and Jerome Marchand "The code in reset_store
+get the block device (bdget_disk()) but it does not put it (bdput()) when
+it's done using it. The usage count is therefore incremented but never
+decremented."
+
+This patch also puts bdput() for all error cases.
+
+Acked-by: Minchan Kim <minchan@kernel.org>
+Acked-by: Jerome Marchand <jmarchan@redhat.com>
+Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/zram/zram_drv.c | 19 ++++++++++++++-----
+ 1 file changed, 14 insertions(+), 5 deletions(-)
+
+--- a/drivers/staging/zram/zram_drv.c
++++ b/drivers/staging/zram/zram_drv.c
+@@ -652,21 +652,30 @@ static ssize_t reset_store(struct device
+ return -ENOMEM;
+
+ /* Do not reset an active device! */
+- if (bdev->bd_holders)
+- return -EBUSY;
++ if (bdev->bd_holders) {
++ ret = -EBUSY;
++ goto out;
++ }
+
+ ret = kstrtou16(buf, 10, &do_reset);
+ if (ret)
+- return ret;
++ goto out;
+
+- if (!do_reset)
+- return -EINVAL;
++ if (!do_reset) {
++ ret = -EINVAL;
++ goto out;
++ }
+
+ /* Make sure all pending I/O is finished */
+ fsync_bdev(bdev);
++ bdput(bdev);
+
+ zram_reset_device(zram, true);
+ return len;
++
++out:
++ bdput(bdev);
++ return ret;
+ }
+
+ static void __zram_make_request(struct zram *zram, struct bio *bio, int rw)
--- /dev/null
+From 67296874eb1cc80317bf2a8fba22b494e21eb29b Mon Sep 17 00:00:00 2001
+From: Olav Haugan <ohaugan@codeaurora.org>
+Date: Fri, 22 Nov 2013 09:30:41 -0800
+Subject: staging: zsmalloc: Ensure handle is never 0 on success
+
+From: Olav Haugan <ohaugan@codeaurora.org>
+
+commit 67296874eb1cc80317bf2a8fba22b494e21eb29b upstream.
+
+zsmalloc encodes a handle using the pfn and an object
+index. On hardware platforms with physical memory starting
+at 0x0 the pfn can be 0. This causes the encoded handle to be
+0 and is incorrectly interpreted as an allocation failure.
+
+This issue affects all current and future SoCs with physical
+memory starting at 0x0. All MSM8974 SoCs which includes
+Google Nexus 5 devices are affected.
+
+To prevent this false error we ensure that the encoded handle
+will not be 0 when allocation succeeds.
+
+Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/staging/zsmalloc/zsmalloc-main.c | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+--- a/drivers/staging/zsmalloc/zsmalloc-main.c
++++ b/drivers/staging/zsmalloc/zsmalloc-main.c
+@@ -430,7 +430,12 @@ static struct page *get_next_page(struct
+ return next;
+ }
+
+-/* Encode <page, obj_idx> as a single handle value */
++/*
++ * Encode <page, obj_idx> as a single handle value.
++ * On hardware platforms with physical memory starting at 0x0 the pfn
++ * could be 0 so we ensure that the handle will never be 0 by adjusting the
++ * encoded obj_idx value before encoding.
++ */
+ static void *obj_location_to_handle(struct page *page, unsigned long obj_idx)
+ {
+ unsigned long handle;
+@@ -441,17 +446,21 @@ static void *obj_location_to_handle(stru
+ }
+
+ handle = page_to_pfn(page) << OBJ_INDEX_BITS;
+- handle |= (obj_idx & OBJ_INDEX_MASK);
++ handle |= ((obj_idx + 1) & OBJ_INDEX_MASK);
+
+ return (void *)handle;
+ }
+
+-/* Decode <page, obj_idx> pair from the given object handle */
++/*
++ * Decode <page, obj_idx> pair from the given object handle. We adjust the
++ * decoded obj_idx back to its original value since it was adjusted in
++ * obj_location_to_handle().
++ */
+ static void obj_handle_to_location(unsigned long handle, struct page **page,
+ unsigned long *obj_idx)
+ {
+ *page = pfn_to_page(handle >> OBJ_INDEX_BITS);
+- *obj_idx = handle & OBJ_INDEX_MASK;
++ *obj_idx = (handle & OBJ_INDEX_MASK) - 1;
+ }
+
+ static unsigned long obj_idx_to_offset(struct page *page,