--- /dev/null
+From 6797b39e6f6f34c74177736e146406e894b9482b Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 26 Mar 2014 13:30:52 -0700
+Subject: Input: cypress_ps2 - don't report as a button pads
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit 6797b39e6f6f34c74177736e146406e894b9482b upstream.
+
+The cypress PS/2 trackpad models supported by the cypress_ps2 driver
+emulate BTN_RIGHT events in firmware based on the finger position, as part
+of this no motion events are sent when the finger is in the button area.
+
+The INPUT_PROP_BUTTONPAD property is there to indicate to userspace that
+BTN_RIGHT events should be emulated in userspace, which is not necessary
+in this case.
+
+When INPUT_PROP_BUTTONPAD is advertised userspace will wait for a motion
+event before propagating the button event higher up the stack, as it needs
+current abs x + y data for its BTN_RIGHT emulation. Since in the
+cypress_ps2 pads don't report motion events in the button area, this means
+that clicks in the button area end up being ignored, so
+INPUT_PROP_BUTTONPAD actually causes problems for these touchpads, and
+removing it fixes:
+
+https://bugs.freedesktop.org/show_bug.cgi?id=76341
+
+Reported-by: Adam Williamson <awilliam@redhat.com>
+Tested-by: Adam Williamson <awilliam@redhat.com>
+Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/mouse/cypress_ps2.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+--- a/drivers/input/mouse/cypress_ps2.c
++++ b/drivers/input/mouse/cypress_ps2.c
+@@ -410,7 +410,6 @@ static int cypress_set_input_params(stru
+ __clear_bit(REL_X, input->relbit);
+ __clear_bit(REL_Y, input->relbit);
+
+- __set_bit(INPUT_PROP_BUTTONPAD, input->propbit);
+ __set_bit(EV_KEY, input->evbit);
+ __set_bit(BTN_LEFT, input->keybit);
+ __set_bit(BTN_RIGHT, input->keybit);
--- /dev/null
+From e4dbedc7eac7da9db363a36f2bd4366962eeefcc Mon Sep 17 00:00:00 2001
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Date: Thu, 6 Mar 2014 12:57:24 -0800
+Subject: Input: mousedev - fix race when creating mixed device
+
+From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+
+commit e4dbedc7eac7da9db363a36f2bd4366962eeefcc upstream.
+
+We should not be using static variable mousedev_mix in methods that can be
+called before that singleton gets assigned. While at it let's add open and
+close methods to mousedev structure so that we do not need to test if we
+are dealing with multiplexor or normal device and simply call appropriate
+method directly.
+
+This fixes: https://bugzilla.kernel.org/show_bug.cgi?id=71551
+
+Reported-by: GiulioDP <depasquale.giulio@gmail.com>
+Tested-by: GiulioDP <depasquale.giulio@gmail.com>
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/mousedev.c | 73 +++++++++++++++++++++++++++--------------------
+ 1 file changed, 42 insertions(+), 31 deletions(-)
+
+--- a/drivers/input/mousedev.c
++++ b/drivers/input/mousedev.c
+@@ -67,7 +67,6 @@ struct mousedev {
+ struct device dev;
+ struct cdev cdev;
+ bool exist;
+- bool is_mixdev;
+
+ struct list_head mixdev_node;
+ bool opened_by_mixdev;
+@@ -77,6 +76,9 @@ struct mousedev {
+ int old_x[4], old_y[4];
+ int frac_dx, frac_dy;
+ unsigned long touch;
++
++ int (*open_device)(struct mousedev *mousedev);
++ void (*close_device)(struct mousedev *mousedev);
+ };
+
+ enum mousedev_emul {
+@@ -116,9 +118,6 @@ static unsigned char mousedev_imex_seq[]
+ static struct mousedev *mousedev_mix;
+ static LIST_HEAD(mousedev_mix_list);
+
+-static void mixdev_open_devices(void);
+-static void mixdev_close_devices(void);
+-
+ #define fx(i) (mousedev->old_x[(mousedev->pkt_count - (i)) & 03])
+ #define fy(i) (mousedev->old_y[(mousedev->pkt_count - (i)) & 03])
+
+@@ -428,9 +427,7 @@ static int mousedev_open_device(struct m
+ if (retval)
+ return retval;
+
+- if (mousedev->is_mixdev)
+- mixdev_open_devices();
+- else if (!mousedev->exist)
++ if (!mousedev->exist)
+ retval = -ENODEV;
+ else if (!mousedev->open++) {
+ retval = input_open_device(&mousedev->handle);
+@@ -446,9 +443,7 @@ static void mousedev_close_device(struct
+ {
+ mutex_lock(&mousedev->mutex);
+
+- if (mousedev->is_mixdev)
+- mixdev_close_devices();
+- else if (mousedev->exist && !--mousedev->open)
++ if (mousedev->exist && !--mousedev->open)
+ input_close_device(&mousedev->handle);
+
+ mutex_unlock(&mousedev->mutex);
+@@ -459,21 +454,29 @@ static void mousedev_close_device(struct
+ * stream. Note that this function is called with mousedev_mix->mutex
+ * held.
+ */
+-static void mixdev_open_devices(void)
++static int mixdev_open_devices(struct mousedev *mixdev)
+ {
+- struct mousedev *mousedev;
++ int error;
++
++ error = mutex_lock_interruptible(&mixdev->mutex);
++ if (error)
++ return error;
+
+- if (mousedev_mix->open++)
+- return;
++ if (!mixdev->open++) {
++ struct mousedev *mousedev;
+
+- list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) {
+- if (!mousedev->opened_by_mixdev) {
+- if (mousedev_open_device(mousedev))
+- continue;
++ list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) {
++ if (!mousedev->opened_by_mixdev) {
++ if (mousedev_open_device(mousedev))
++ continue;
+
+- mousedev->opened_by_mixdev = true;
++ mousedev->opened_by_mixdev = true;
++ }
+ }
+ }
++
++ mutex_unlock(&mixdev->mutex);
++ return 0;
+ }
+
+ /*
+@@ -481,19 +484,22 @@ static void mixdev_open_devices(void)
+ * device. Note that this function is called with mousedev_mix->mutex
+ * held.
+ */
+-static void mixdev_close_devices(void)
++static void mixdev_close_devices(struct mousedev *mixdev)
+ {
+- struct mousedev *mousedev;
++ mutex_lock(&mixdev->mutex);
+
+- if (--mousedev_mix->open)
+- return;
++ if (!--mixdev->open) {
++ struct mousedev *mousedev;
+
+- list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) {
+- if (mousedev->opened_by_mixdev) {
+- mousedev->opened_by_mixdev = false;
+- mousedev_close_device(mousedev);
++ list_for_each_entry(mousedev, &mousedev_mix_list, mixdev_node) {
++ if (mousedev->opened_by_mixdev) {
++ mousedev->opened_by_mixdev = false;
++ mousedev_close_device(mousedev);
++ }
+ }
+ }
++
++ mutex_unlock(&mixdev->mutex);
+ }
+
+
+@@ -522,7 +528,7 @@ static int mousedev_release(struct inode
+ mousedev_detach_client(mousedev, client);
+ kfree(client);
+
+- mousedev_close_device(mousedev);
++ mousedev->close_device(mousedev);
+
+ return 0;
+ }
+@@ -550,7 +556,7 @@ static int mousedev_open(struct inode *i
+ client->mousedev = mousedev;
+ mousedev_attach_client(mousedev, client);
+
+- error = mousedev_open_device(mousedev);
++ error = mousedev->open_device(mousedev);
+ if (error)
+ goto err_free_client;
+
+@@ -861,16 +867,21 @@ static struct mousedev *mousedev_create(
+
+ if (mixdev) {
+ dev_set_name(&mousedev->dev, "mice");
++
++ mousedev->open_device = mixdev_open_devices;
++ mousedev->close_device = mixdev_close_devices;
+ } else {
+ int dev_no = minor;
+ /* Normalize device number if it falls into legacy range */
+ if (dev_no < MOUSEDEV_MINOR_BASE + MOUSEDEV_MINORS)
+ dev_no -= MOUSEDEV_MINOR_BASE;
+ dev_set_name(&mousedev->dev, "mouse%d", dev_no);
++
++ mousedev->open_device = mousedev_open_device;
++ mousedev->close_device = mousedev_close_device;
+ }
+
+ mousedev->exist = true;
+- mousedev->is_mixdev = mixdev;
+ mousedev->handle.dev = input_get_device(dev);
+ mousedev->handle.name = dev_name(&mousedev->dev);
+ mousedev->handle.handler = handler;
+@@ -919,7 +930,7 @@ static void mousedev_destroy(struct mous
+ device_del(&mousedev->dev);
+ mousedev_cleanup(mousedev);
+ input_free_minor(MINOR(mousedev->dev.devt));
+- if (!mousedev->is_mixdev)
++ if (mousedev != mousedev_mix)
+ input_unregister_handle(&mousedev->handle);
+ put_device(&mousedev->dev);
+ }
--- /dev/null
+From 8a0435d958fb36d93b8df610124a0e91e5675c82 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Fri, 28 Mar 2014 01:01:38 -0700
+Subject: Input: synaptics - add manual min/max quirk for ThinkPad X240
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit 8a0435d958fb36d93b8df610124a0e91e5675c82 upstream.
+
+This extends Benjamin Tissoires manual min/max quirk table with support for
+the ThinkPad X240.
+
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/mouse/synaptics.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+--- a/drivers/input/mouse/synaptics.c
++++ b/drivers/input/mouse/synaptics.c
+@@ -1507,6 +1507,14 @@ static const struct dmi_system_id min_ma
+ .driver_data = (int []){1024, 5052, 2258, 4832},
+ },
+ {
++ /* Lenovo ThinkPad X240 */
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad X240"),
++ },
++ .driver_data = (int []){1232, 5710, 1156, 4696},
++ },
++ {
+ /* Lenovo ThinkPad T440s */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
--- /dev/null
+From 421e08c41fda1f0c2ff6af81a67b491389b653a5 Mon Sep 17 00:00:00 2001
+From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Date: Fri, 28 Mar 2014 00:43:00 -0700
+Subject: Input: synaptics - add manual min/max quirk
+
+From: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+
+commit 421e08c41fda1f0c2ff6af81a67b491389b653a5 upstream.
+
+The new Lenovo Haswell series (-40's) contains a new Synaptics touchpad.
+However, these new Synaptics devices report bad axis ranges.
+Under Windows, it is not a problem because the Windows driver uses RMI4
+over SMBus to talk to the device. Under Linux, we are using the PS/2
+fallback interface and it occurs the reported ranges are wrong.
+
+Of course, it would be too easy to have only one range for the whole
+series, each touchpad seems to be calibrated in a different way.
+
+We can not use SMBus to get the actual range because I suspect the firmware
+will switch into the SMBus mode and stop talking through PS/2 (this is the
+case for hybrid HID over I2C / PS/2 Synaptics touchpads).
+
+So as a temporary solution (until RMI4 land into upstream), start a new
+list of quirks with the min/max manually set.
+
+Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
+Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/input/mouse/synaptics.c | 47 ++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 47 insertions(+)
+
+--- a/drivers/input/mouse/synaptics.c
++++ b/drivers/input/mouse/synaptics.c
+@@ -265,11 +265,22 @@ static int synaptics_identify(struct psm
+ * Read touchpad resolution and maximum reported coordinates
+ * Resolution is left zero if touchpad does not support the query
+ */
++
++static const int *quirk_min_max;
++
+ static int synaptics_resolution(struct psmouse *psmouse)
+ {
+ struct synaptics_data *priv = psmouse->private;
+ unsigned char resp[3];
+
++ if (quirk_min_max) {
++ priv->x_min = quirk_min_max[0];
++ priv->x_max = quirk_min_max[1];
++ priv->y_min = quirk_min_max[2];
++ priv->y_max = quirk_min_max[3];
++ return 0;
++ }
++
+ if (SYN_ID_MAJOR(priv->identity) < 4)
+ return 0;
+
+@@ -1485,10 +1496,46 @@ static const struct dmi_system_id __init
+ { }
+ };
+
++static const struct dmi_system_id min_max_dmi_table[] __initconst = {
++#if defined(CONFIG_DMI)
++ {
++ /* Lenovo ThinkPad Helix */
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad Helix"),
++ },
++ .driver_data = (int []){1024, 5052, 2258, 4832},
++ },
++ {
++ /* Lenovo ThinkPad T440s */
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T440"),
++ },
++ .driver_data = (int []){1024, 5112, 2024, 4832},
++ },
++ {
++ /* Lenovo ThinkPad T540p */
++ .matches = {
++ DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
++ DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad T540"),
++ },
++ .driver_data = (int []){1024, 5056, 2058, 4832},
++ },
++#endif
++ { }
++};
++
+ void __init synaptics_module_init(void)
+ {
++ const struct dmi_system_id *min_max_dmi;
++
+ impaired_toshiba_kbc = dmi_check_system(toshiba_dmi_table);
+ broken_olpc_ec = dmi_check_system(olpc_dmi_table);
++
++ min_max_dmi = dmi_first_match(min_max_dmi_table);
++ if (min_max_dmi)
++ quirk_min_max = min_max_dmi->driver_data;
+ }
+
+ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
ext4-atomically-set-inode-i_flags-in-ext4_set_inode_flags.patch
+input-mousedev-fix-race-when-creating-mixed-device.patch
+input-synaptics-add-manual-min-max-quirk.patch
+input-synaptics-add-manual-min-max-quirk-for-thinkpad-x240.patch
+input-cypress_ps2-don-t-report-as-a-button-pads.patch
+x86-fix-boot-on-uniprocessor-systems.patch
--- /dev/null
+From 825600c0f20e595daaa7a6dd8970f84fa2a2ee57 Mon Sep 17 00:00:00 2001
+From: Artem Fetishev <artem_fetishev@epam.com>
+Date: Fri, 28 Mar 2014 13:33:39 -0700
+Subject: x86: fix boot on uniprocessor systems
+
+From: Artem Fetishev <artem_fetishev@epam.com>
+
+commit 825600c0f20e595daaa7a6dd8970f84fa2a2ee57 upstream.
+
+On x86 uniprocessor systems topology_physical_package_id() returns -1
+which causes rapl_cpu_prepare() to leave rapl_pmu variable uninitialized
+which leads to GPF in rapl_pmu_init().
+
+See arch/x86/kernel/cpu/perf_event_intel_rapl.c.
+
+It turns out that physical_package_id and core_id can actually be
+retreived for uniprocessor systems too. Enabling them also fixes
+rapl_pmu code.
+
+Signed-off-by: Artem Fetishev <artem_fetishev@epam.com>
+Cc: Stephane Eranian <eranian@google.com>
+Cc: Ingo Molnar <mingo@elte.hu>
+Cc: "H. Peter Anvin" <hpa@zytor.com>
+Cc: Thomas Gleixner <tglx@linutronix.de>
+Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
+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>
+
+---
+ arch/x86/include/asm/topology.h | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/arch/x86/include/asm/topology.h
++++ b/arch/x86/include/asm/topology.h
+@@ -119,9 +119,10 @@ static inline void setup_node_to_cpumask
+
+ extern const struct cpumask *cpu_coregroup_mask(int cpu);
+
+-#ifdef ENABLE_TOPO_DEFINES
+ #define topology_physical_package_id(cpu) (cpu_data(cpu).phys_proc_id)
+ #define topology_core_id(cpu) (cpu_data(cpu).cpu_core_id)
++
++#ifdef ENABLE_TOPO_DEFINES
+ #define topology_core_cpumask(cpu) (per_cpu(cpu_core_map, cpu))
+ #define topology_thread_cpumask(cpu) (per_cpu(cpu_sibling_map, cpu))
+