--- /dev/null
+From d4f1e48bd11e3df6a26811f7a1f06c4225d92f7d Mon Sep 17 00:00:00 2001
+From: Omair Mohammed Abdullah <omair.m.abdullah@linux.intel.com>
+Date: Sat, 29 Sep 2012 12:24:05 +0530
+Subject: ALSA: aloop - add locking to timer access
+
+From: Omair Mohammed Abdullah <omair.m.abdullah@linux.intel.com>
+
+commit d4f1e48bd11e3df6a26811f7a1f06c4225d92f7d upstream.
+
+When the loopback timer handler is running, calling del_timer() (for STOP
+trigger) will not wait for the handler to complete before deactivating the
+timer. The timer gets rescheduled in the handler as usual. Then a subsequent
+START trigger will try to start the timer using add_timer() with a timer pending
+leading to a kernel panic.
+
+Serialize the calls to add_timer() and del_timer() using a spin lock to avoid
+this.
+
+Signed-off-by: Omair Mohammed Abdullah <omair.m.abdullah@linux.intel.com>
+Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/drivers/aloop.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/sound/drivers/aloop.c
++++ b/sound/drivers/aloop.c
+@@ -120,6 +120,7 @@ struct loopback_pcm {
+ unsigned int last_drift;
+ unsigned long last_jiffies;
+ struct timer_list timer;
++ spinlock_t timer_lock;
+ };
+
+ static struct platform_device *devices[SNDRV_CARDS];
+@@ -170,6 +171,7 @@ static void loopback_timer_start(struct
+ unsigned long tick;
+ unsigned int rate_shift = get_rate_shift(dpcm);
+
++ spin_lock(&dpcm->timer_lock);
+ if (rate_shift != dpcm->pcm_rate_shift) {
+ dpcm->pcm_rate_shift = rate_shift;
+ dpcm->period_size_frac = frac_pos(dpcm, dpcm->pcm_period_size);
+@@ -182,12 +184,15 @@ static void loopback_timer_start(struct
+ tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps;
+ dpcm->timer.expires = jiffies + tick;
+ add_timer(&dpcm->timer);
++ spin_unlock(&dpcm->timer_lock);
+ }
+
+ static inline void loopback_timer_stop(struct loopback_pcm *dpcm)
+ {
++ spin_lock(&dpcm->timer_lock);
+ del_timer(&dpcm->timer);
+ dpcm->timer.expires = 0;
++ spin_unlock(&dpcm->timer_lock);
+ }
+
+ #define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK)
+@@ -667,6 +672,7 @@ static int loopback_open(struct snd_pcm_
+ dpcm->substream = substream;
+ setup_timer(&dpcm->timer, loopback_timer_function,
+ (unsigned long)dpcm);
++ spin_lock_init(&dpcm->timer_lock);
+
+ cable = loopback->cables[substream->number][dev];
+ if (!cable) {
--- /dev/null
+From d279fae8a41690ec1b20c07be8c6f42f8af27a17 Mon Sep 17 00:00:00 2001
+From: Wang Xingchao <xingchao.wang@intel.com>
+Date: Mon, 17 Sep 2012 13:10:23 +0800
+Subject: ALSA: hda - Add another pci id for Haswell board
+
+From: Wang Xingchao <xingchao.wang@intel.com>
+
+commit d279fae8a41690ec1b20c07be8c6f42f8af27a17 upstream.
+
+A new PCI id 0x0d0c for Haswell HDA Controller.
+
+[root@SKBM04SDP ~]# lspci |grep Audio
+00:03.0 Audio device: Intel Corporation Device 0d0c (rev 02)
+00:1b.0 Audio device: Intel Corporation Lynx Point HD Audio Controller
+
+Signed-off-by: Wang Xingchao <xingchao.wang@intel.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/hda_intel.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -3285,6 +3285,9 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids)
+ { PCI_DEVICE(0x8086, 0x0c0c),
+ .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
+ AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
++ { PCI_DEVICE(0x8086, 0x0d0c),
++ .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
++ AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
+ /* SCH */
+ { PCI_DEVICE(0x8086, 0x811b),
+ .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
--- /dev/null
+From e4db0952e542090c605fd41d31d761f1b4624f4a Mon Sep 17 00:00:00 2001
+From: Felix Kaechele <felix@fetzig.org>
+Date: Wed, 26 Sep 2012 01:20:44 +0200
+Subject: ALSA: hda - Add inverted internal mic quirk for Lenovo IdeaPad U310
+
+From: Felix Kaechele <felix@fetzig.org>
+
+commit e4db0952e542090c605fd41d31d761f1b4624f4a upstream.
+
+The Lenovo IdeaPad U310 has an internal mic where the right channel
+is phase inverted.
+
+Signed-off-by: Felix Kaechele <felix@fetzig.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_conexant.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -4462,6 +4462,7 @@ static const struct snd_pci_quirk cxt506
+ SND_PCI_QUIRK(0x17aa, 0x21ce, "Lenovo T420", CXT_PINCFG_LENOVO_TP410),
+ SND_PCI_QUIRK(0x17aa, 0x21cf, "Lenovo T520", CXT_PINCFG_LENOVO_TP410),
+ SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
++ SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
+ SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
+ {}
+ };
--- /dev/null
+From 4b527b6516ab1f0af8aaedd02dbf71ee2c1180f4 Mon Sep 17 00:00:00 2001
+From: David Henningsson <david.henningsson@canonical.com>
+Date: Tue, 18 Sep 2012 14:26:59 +0200
+Subject: ALSA: hda - limit internal mic boost for Asus X202E
+
+From: David Henningsson <david.henningsson@canonical.com>
+
+commit 4b527b6516ab1f0af8aaedd02dbf71ee2c1180f4 upstream.
+
+When the input gain for the internal mic is set to its maximum level,
+the background noise becomes so high - and any relevant signal clipped -
+that the setting becomes unusable. It is better to limit the amplification.
+
+BugLink: https://bugs.launchpad.net/bugs/1052460
+Signed-off-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_via.c | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+--- a/sound/pci/hda/patch_via.c
++++ b/sound/pci/hda/patch_via.c
+@@ -3670,6 +3670,32 @@ static void set_widgets_power_state_vt20
+ update_power_state(codec, 0x21, AC_PWRST_D3);
+ }
+
++/*
++ * pin fix-up
++ */
++enum {
++ VIA_FIXUP_INTMIC_BOOST,
++};
++
++static void via_fixup_intmic_boost(struct hda_codec *codec,
++ const struct hda_fixup *fix, int action)
++{
++ if (action == HDA_FIXUP_ACT_PRE_PROBE)
++ override_mic_boost(codec, 0x30, 0, 2, 40);
++}
++
++static const struct hda_fixup via_fixups[] = {
++ [VIA_FIXUP_INTMIC_BOOST] = {
++ .type = HDA_FIXUP_FUNC,
++ .v.func = via_fixup_intmic_boost,
++ },
++};
++
++static const struct snd_pci_quirk vt2002p_fixups[] = {
++ SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST),
++ {}
++};
++
+ /* patch for vt2002P */
+ static int patch_vt2002P(struct hda_codec *codec)
+ {
+@@ -3686,6 +3712,9 @@ static int patch_vt2002P(struct hda_code
+ override_mic_boost(codec, 0x29, 0, 3, 40);
+ add_secret_dac_path(codec);
+
++ snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups);
++ snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
++
+ /* automatic parse from the BIOS config */
+ err = via_parse_auto_config(codec);
+ if (err < 0) {
--- /dev/null
+From 9f720bb9409ea5923361fbd3fdbc505ca36cf012 Mon Sep 17 00:00:00 2001
+From: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+Date: Thu, 27 Sep 2012 10:38:14 -0300
+Subject: ALSA: hda/realtek - Fix detection of ALC271X codec
+
+From: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+
+commit 9f720bb9409ea5923361fbd3fdbc505ca36cf012 upstream.
+
+In commit af741c1 ("ALSA: hda/realtek - Call alc_auto_parse_customize_define()
+always after fixup"), alc_auto_parse_customize_define was moved after
+detection of ALC271X.
+
+The problem is that detection of ALC271X relies on spec->cdefine.platform_type,
+and it's set on alc_auto_parse_customize_define.
+
+Move the alc_auto_parse_customize_define and its required fixup setup
+before the block doing the ALC271X and other codec setup.
+
+BugLink: https://bugs.launchpad.net/bugs/1006690
+Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+Reviewed-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_realtek.c | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+--- a/sound/pci/hda/patch_realtek.c
++++ b/sound/pci/hda/patch_realtek.c
+@@ -6334,6 +6334,12 @@ static int patch_alc269(struct hda_codec
+
+ spec = codec->spec;
+
++ alc_pick_fixup(codec, alc269_fixup_models,
++ alc269_fixup_tbl, alc269_fixups);
++ alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
++
++ alc_auto_parse_customize_define(codec);
++
+ if (codec->vendor_id == 0x10ec0269) {
+ spec->codec_variant = ALC269_TYPE_ALC269VA;
+ switch (alc_get_coef0(codec) & 0x00f0) {
+@@ -6361,12 +6367,6 @@ static int patch_alc269(struct hda_codec
+ alc269_fill_coef(codec);
+ }
+
+- alc_pick_fixup(codec, alc269_fixup_models,
+- alc269_fixup_tbl, alc269_fixups);
+- alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
+-
+- alc_auto_parse_customize_define(codec);
+-
+ /* automatic parse from the BIOS config */
+ err = alc269_parse_auto_config(codec);
+ if (err < 0)
--- /dev/null
+From 90accc58a6946e7245993da6079f88d8c29cb731 Mon Sep 17 00:00:00 2001
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Date: Fri, 21 Sep 2012 18:39:06 -0500
+Subject: ALSA: hda - use LPIB for delay estimation
+
+From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+
+commit 90accc58a6946e7245993da6079f88d8c29cb731 upstream.
+
+DMA Position in Buffer (DPIB) should be used for
+ring buffer management, while LPIB register provides
+information on the number of samples transfered on
+the link. The difference between the two pieces of
+information corresponds to hardware/DMA buffering.
+
+This patch reports this difference in runtime->delay, and
+removes the use of the COMBO mode on recent Intel hardware.
+
+Credits to Takashi Iwai for an initial patch.
+
+[rebased to for-next branch and replaced snd_printk() with
+ snd_printdd() by tiwai]
+
+Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/hda_intel.c | 36 +++++++++++++++++++++++++++++-------
+ 1 file changed, 29 insertions(+), 7 deletions(-)
+
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -538,6 +538,7 @@ enum {
+ #define AZX_DCAPS_ALIGN_BUFSIZE (1 << 22) /* buffer size alignment */
+ #define AZX_DCAPS_4K_BDLE_BOUNDARY (1 << 23) /* BDLE in 4k boundary */
+ #define AZX_DCAPS_POSFIX_COMBO (1 << 24) /* Use COMBO as default */
++#define AZX_DCAPS_COUNT_LPIB_DELAY (1 << 25) /* Take LPIB as delay */
+
+ /* quirks for ATI SB / AMD Hudson */
+ #define AZX_DCAPS_PRESET_ATI_SB \
+@@ -2120,6 +2121,27 @@ static unsigned int azx_get_position(str
+
+ if (pos >= azx_dev->bufsize)
+ pos = 0;
++
++ /* calculate runtime delay from LPIB */
++ if (azx_dev->substream->runtime &&
++ chip->position_fix[stream] == POS_FIX_POSBUF &&
++ (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) {
++ unsigned int lpib_pos = azx_sd_readl(azx_dev, SD_LPIB);
++ int delay;
++ if (stream == SNDRV_PCM_STREAM_PLAYBACK)
++ delay = pos - lpib_pos;
++ else
++ delay = lpib_pos - pos;
++ if (delay < 0)
++ delay += azx_dev->bufsize;
++ if (delay >= azx_dev->period_bytes) {
++ snd_printdd("delay %d > period_bytes %d\n",
++ delay, azx_dev->period_bytes);
++ delay = 0; /* something is wrong */
++ }
++ azx_dev->substream->runtime->delay =
++ bytes_to_frames(azx_dev->substream->runtime, delay);
++ }
+ return pos;
+ }
+
+@@ -3260,7 +3282,7 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids)
+ /* CPT */
+ { PCI_DEVICE(0x8086, 0x1c20),
+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
+- AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
++ AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
+ /* PBG */
+ { PCI_DEVICE(0x8086, 0x1d20),
+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
+@@ -3268,26 +3290,26 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids)
+ /* Panther Point */
+ { PCI_DEVICE(0x8086, 0x1e20),
+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
+- AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
++ AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
+ /* Lynx Point */
+ { PCI_DEVICE(0x8086, 0x8c20),
+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
+- AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
++ AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
+ /* Lynx Point-LP */
+ { PCI_DEVICE(0x8086, 0x9c20),
+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
+- AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
++ AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
+ /* Lynx Point-LP */
+ { PCI_DEVICE(0x8086, 0x9c21),
+ .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_SCH_SNOOP |
+- AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
++ AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
+ /* Haswell */
+ { PCI_DEVICE(0x8086, 0x0c0c),
+ .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
+- AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
++ AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
+ { PCI_DEVICE(0x8086, 0x0d0c),
+ .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
+- AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_COMBO },
++ AZX_DCAPS_BUFSIZE | AZX_DCAPS_COUNT_LPIB_DELAY },
+ /* SCH */
+ { PCI_DEVICE(0x8086, 0x811b),
+ .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
--- /dev/null
+From cf55e904516947597d75fd3844acc24891a95772 Mon Sep 17 00:00:00 2001
+From: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+Date: Fri, 21 Sep 2012 20:45:19 -0300
+Subject: ALSA: hda/via - don't report presence on HPs with no presence support
+
+From: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+
+commit cf55e904516947597d75fd3844acc24891a95772 upstream.
+
+If headphone jack can't detect plug presence, and we have the jack in
+the jack table, snd_hda_jack_detect will return the plug as always
+present (as it'll be considered as a phantom jack). The problem is that
+when this happens, line out pins will always be disabled, resulting in
+no sound if there are no headphones connected.
+
+This was reported as a no sound problem after suspend on
+http://bugs.launchpad.net/bugs/1052499, since the bug doesn't manifests
+on first initialization before the phantom jack is added, but on resume
+we reexecute the initialization code, and via_hp_automute starts
+reporting HP always present with the jack now on the table.
+
+BugLink: https://bugs.launchpad.net/bugs/1052499
+Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_via.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/sound/pci/hda/patch_via.c
++++ b/sound/pci/hda/patch_via.c
+@@ -1672,7 +1672,8 @@ static void via_hp_automute(struct hda_c
+ struct via_spec *spec = codec->spec;
+
+ if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0] &&
+- (spec->codec_type != VT1708 || spec->vt1708_jack_detect))
++ (spec->codec_type != VT1708 || spec->vt1708_jack_detect) &&
++ is_jack_detectable(codec, spec->autocfg.hp_pins[0]))
+ present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
+
+ if (spec->smart51_enabled)
--- /dev/null
+From 2b58fd5b3193fd3af3d15114d95706087d25a7fe Mon Sep 17 00:00:00 2001
+From: Daniel Mack <zonque@gmail.com>
+Date: Tue, 4 Sep 2012 10:23:07 +0200
+Subject: ALSA: snd-usb: Add quirks for Playback Designs devices
+
+From: Daniel Mack <zonque@gmail.com>
+
+commit 2b58fd5b3193fd3af3d15114d95706087d25a7fe upstream.
+
+Playback Designs' USB devices have some hardware limitations on their
+USB interface. In particular:
+
+ - They need a 20ms delay after each class compliant request as the
+ hardware ACKs the USB packets before the device is actually ready
+ for the next command. Sending data immediately will result in buffer
+ overflows in the hardware.
+ - The devices send bogus feedback data at the start of each stream
+ which confuse the feedback format auto-detection.
+
+This patch introduces a new quirks hook that is called after each
+control packet and which adds a delay for all devices that match
+Playback Designs' USB VID for now.
+
+In addition, it adds a counter to snd_usb_endpoint to drop received
+packets on the floor. Another new quirks function that is called once
+an endpoint is started initializes that counter for these devices on
+their sync endpoint.
+
+Signed-off-by: Daniel Mack <zonque@gmail.com>
+Reported-and-tested-by: Andreas Koch <andreas@akdesigninc.com>
+Supported-by: Demian Martin <demianm_1@yahoo.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/card.h | 2 ++
+ sound/usb/endpoint.c | 8 ++++++++
+ sound/usb/helper.c | 5 +++++
+ sound/usb/quirks.c | 24 ++++++++++++++++++++++++
+ sound/usb/quirks.h | 10 ++++++++++
+ 5 files changed, 49 insertions(+)
+
+--- a/sound/usb/card.h
++++ b/sound/usb/card.h
+@@ -92,6 +92,8 @@ struct snd_usb_endpoint {
+ unsigned char silence_value;
+ unsigned int stride;
+ int iface, alt_idx;
++ int skip_packets; /* quirks for devices to ignore the first n packets
++ in a stream */
+
+ spinlock_t lock;
+ struct list_head list;
+--- a/sound/usb/endpoint.c
++++ b/sound/usb/endpoint.c
+@@ -31,6 +31,7 @@
+ #include "card.h"
+ #include "endpoint.h"
+ #include "pcm.h"
++#include "quirks.h"
+
+ #define EP_FLAG_ACTIVATED 0
+ #define EP_FLAG_RUNNING 1
+@@ -170,6 +171,11 @@ static void retire_inbound_urb(struct sn
+ {
+ struct urb *urb = urb_ctx->urb;
+
++ if (unlikely(ep->skip_packets > 0)) {
++ ep->skip_packets--;
++ return;
++ }
++
+ if (ep->sync_slave)
+ snd_usb_handle_sync_urb(ep->sync_slave, ep, urb);
+
+@@ -828,6 +834,8 @@ int snd_usb_endpoint_start(struct snd_us
+ ep->unlink_mask = 0;
+ ep->phase = 0;
+
++ snd_usb_endpoint_start_quirk(ep);
++
+ /*
+ * If this endpoint has a data endpoint as implicit feedback source,
+ * don't start the urbs here. Instead, mark them all as available,
+--- a/sound/usb/helper.c
++++ b/sound/usb/helper.c
+@@ -21,6 +21,7 @@
+
+ #include "usbaudio.h"
+ #include "helper.h"
++#include "quirks.h"
+
+ /*
+ * combine bytes and get an integer value
+@@ -97,6 +98,10 @@ int snd_usb_ctl_msg(struct usb_device *d
+ memcpy(data, buf, size);
+ kfree(buf);
+ }
++
++ snd_usb_ctl_msg_quirk(dev, pipe, request, requesttype,
++ value, index, data, size);
++
+ return err;
+ }
+
+--- a/sound/usb/quirks.c
++++ b/sound/usb/quirks.c
+@@ -761,3 +761,27 @@ void snd_usb_set_format_quirk(struct snd
+ }
+ }
+
++void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep)
++{
++ /*
++ * "Playback Design" products send bogus feedback data at the start
++ * of the stream. Ignore them.
++ */
++ if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) &&
++ ep->type == SND_USB_ENDPOINT_TYPE_SYNC)
++ ep->skip_packets = 4;
++}
++
++void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
++ __u8 request, __u8 requesttype, __u16 value,
++ __u16 index, void *data, __u16 size)
++{
++ /*
++ * "Playback Design" products need a 20ms delay after each
++ * class compliant request
++ */
++ if ((le16_to_cpu(dev->descriptor.idVendor) == 0x23ba) &&
++ (requesttype & USB_TYPE_MASK) == USB_TYPE_CLASS)
++ mdelay(20);
++}
++
+--- a/sound/usb/quirks.h
++++ b/sound/usb/quirks.h
+@@ -1,6 +1,10 @@
+ #ifndef __USBAUDIO_QUIRKS_H
+ #define __USBAUDIO_QUIRKS_H
+
++struct audioformat;
++struct snd_usb_endpoint;
++struct snd_usb_substream;
++
+ int snd_usb_create_quirk(struct snd_usb_audio *chip,
+ struct usb_interface *iface,
+ struct usb_driver *driver,
+@@ -20,4 +24,10 @@ void snd_usb_set_format_quirk(struct snd
+ int snd_usb_is_big_endian_format(struct snd_usb_audio *chip,
+ struct audioformat *fp);
+
++void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep);
++
++void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
++ __u8 request, __u8 requesttype, __u16 value,
++ __u16 index, void *data, __u16 size);
++
+ #endif /* __USBAUDIO_QUIRKS_H */
--- /dev/null
+From c10514394ef9e8de93a4ad8c8904d71dcd82c122 Mon Sep 17 00:00:00 2001
+From: David Henningsson <david.henningsson@canonical.com>
+Date: Thu, 20 Sep 2012 10:20:41 +0200
+Subject: ALSA: usb - disable broken hw volume for Tenx TP6911
+
+From: David Henningsson <david.henningsson@canonical.com>
+
+commit c10514394ef9e8de93a4ad8c8904d71dcd82c122 upstream.
+
+While going through Ubuntu bugs, I discovered this patch being
+posted and a confirmation that the patch works as expected.
+
+Finding out how the hw volume really works would be preferrable
+to just disabling the broken one, but this would be better than
+nothing.
+
+Credit: sndfnsdfin (qawsnews)
+BugLink: https://bugs.launchpad.net/bugs/559939
+Signed-off-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/mixer.c | 7 +++++++
+ 1 file changed, 7 insertions(+)
+
+--- a/sound/usb/mixer.c
++++ b/sound/usb/mixer.c
+@@ -1267,6 +1267,13 @@ static int parse_audio_feature_unit(stru
+ /* disable non-functional volume control */
+ master_bits &= ~UAC_CONTROL_BIT(UAC_FU_VOLUME);
+ break;
++ case USB_ID(0x1130, 0xf211):
++ snd_printk(KERN_INFO
++ "usbmixer: volume control quirk for Tenx TP6911 Audio Headset\n");
++ /* disable non-functional volume control */
++ channels = 0;
++ break;
++
+ }
+ if (channels > 0)
+ first_ch_bits = snd_usb_combine_bytes(bmaControls + csize, csize);
--- /dev/null
+From c05fce586d4da2dfe0309bef3795a8586e967bc3 Mon Sep 17 00:00:00 2001
+From: Marko Friedemann <mfr@bmx-chemnitz.de>
+Date: Mon, 3 Sep 2012 10:12:40 +0200
+Subject: ALSA: USB: Support for (original) Xbox Communicator
+
+From: Marko Friedemann <mfr@bmx-chemnitz.de>
+
+commit c05fce586d4da2dfe0309bef3795a8586e967bc3 upstream.
+
+Added support for Xbox Communicator to USB quirks.
+
+Signed-off-by: Marko Friedemann <mfr@bmx-chemnitz.de>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/quirks-table.h | 53 +++++++++++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 53 insertions(+)
+
+--- a/sound/usb/quirks-table.h
++++ b/sound/usb/quirks-table.h
+@@ -2781,6 +2781,59 @@ YAMAHA_DEVICE(0x7010, "UB99"),
+ }
+ },
+
++/* Microsoft XboxLive Headset/Xbox Communicator */
++{
++ USB_DEVICE(0x045e, 0x0283),
++ .bInterfaceClass = USB_CLASS_PER_INTERFACE,
++ .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
++ .vendor_name = "Microsoft",
++ .product_name = "XboxLive Headset/Xbox Communicator",
++ .ifnum = QUIRK_ANY_INTERFACE,
++ .type = QUIRK_COMPOSITE,
++ .data = &(const struct snd_usb_audio_quirk[]) {
++ {
++ /* playback */
++ .ifnum = 0,
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT,
++ .data = &(const struct audioformat) {
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ .channels = 1,
++ .iface = 0,
++ .altsetting = 0,
++ .altset_idx = 0,
++ .attributes = 0,
++ .endpoint = 0x04,
++ .ep_attr = 0x05,
++ .rates = SNDRV_PCM_RATE_CONTINUOUS,
++ .rate_min = 22050,
++ .rate_max = 22050
++ }
++ },
++ {
++ /* capture */
++ .ifnum = 1,
++ .type = QUIRK_AUDIO_FIXED_ENDPOINT,
++ .data = &(const struct audioformat) {
++ .formats = SNDRV_PCM_FMTBIT_S16_LE,
++ .channels = 1,
++ .iface = 1,
++ .altsetting = 0,
++ .altset_idx = 0,
++ .attributes = 0,
++ .endpoint = 0x85,
++ .ep_attr = 0x05,
++ .rates = SNDRV_PCM_RATE_CONTINUOUS,
++ .rate_min = 16000,
++ .rate_max = 16000
++ }
++ },
++ {
++ .ifnum = -1
++ }
++ }
++ }
++},
++
+ {
+ /*
+ * Some USB MIDI devices don't have an audio control interface,
--- /dev/null
+From ae60503741991a36ed6b2a8f53b249b2a72af52b Mon Sep 17 00:00:00 2001
+From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
+Date: Thu, 27 Sep 2012 13:21:48 +0100
+Subject: ASoC: wm5110: Adding missing volume update bits
+
+From: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
+
+commit ae60503741991a36ed6b2a8f53b249b2a72af52b upstream.
+
+The volume update bits were being set on all but one input and one output.
+
+Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/wm5110.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/sound/soc/codecs/wm5110.c
++++ b/sound/soc/codecs/wm5110.c
+@@ -869,6 +869,8 @@ static unsigned int wm5110_digital_vu[]
+ ARIZONA_ADC_DIGITAL_VOLUME_2R,
+ ARIZONA_ADC_DIGITAL_VOLUME_3L,
+ ARIZONA_ADC_DIGITAL_VOLUME_3R,
++ ARIZONA_ADC_DIGITAL_VOLUME_4L,
++ ARIZONA_ADC_DIGITAL_VOLUME_4R,
+
+ ARIZONA_DAC_DIGITAL_VOLUME_1L,
+ ARIZONA_DAC_DIGITAL_VOLUME_1R,
+@@ -880,6 +882,8 @@ static unsigned int wm5110_digital_vu[]
+ ARIZONA_DAC_DIGITAL_VOLUME_4R,
+ ARIZONA_DAC_DIGITAL_VOLUME_5L,
+ ARIZONA_DAC_DIGITAL_VOLUME_5R,
++ ARIZONA_DAC_DIGITAL_VOLUME_6L,
++ ARIZONA_DAC_DIGITAL_VOLUME_6R,
+ };
+
+ static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
--- /dev/null
+From 689185b78ba6fbe0042f662a468b5565909dff7a Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Date: Tue, 31 Jul 2012 18:37:29 +0100
+Subject: ASoC: wm9712: Fix name of Capture Switch
+
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+
+commit 689185b78ba6fbe0042f662a468b5565909dff7a upstream.
+
+Help UIs associate it with the matching gain control.
+
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/wm9712.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/sound/soc/codecs/wm9712.c
++++ b/sound/soc/codecs/wm9712.c
+@@ -146,7 +146,7 @@ SOC_SINGLE("Playback Attenuate (-6dB) Sw
+ SOC_SINGLE("Bass Volume", AC97_MASTER_TONE, 8, 15, 1),
+ SOC_SINGLE("Treble Volume", AC97_MASTER_TONE, 0, 15, 1),
+
+-SOC_SINGLE("Capture ADC Switch", AC97_REC_GAIN, 15, 1, 1),
++SOC_SINGLE("Capture Switch", AC97_REC_GAIN, 15, 1, 1),
+ SOC_ENUM("Capture Volume Steps", wm9712_enum[6]),
+ SOC_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 63, 0),
+ SOC_SINGLE("Capture ZC Switch", AC97_REC_GAIN, 7, 1, 0),
--- /dev/null
+From eb4d5fc1f0ce89e3d5b072c594a1e213a0e05881 Mon Sep 17 00:00:00 2001
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Date: Thu, 27 Sep 2012 18:35:24 +0100
+Subject: ASoC: wm_hubs: Ensure volume updates are handled during class W startup
+
+From: Mark Brown <broonie@opensource.wolfsonmicro.com>
+
+commit eb4d5fc1f0ce89e3d5b072c594a1e213a0e05881 upstream.
+
+In some circumstances we may need to flush volume updates to the device
+after switching to class W mode. Do this unconditionally to ensure that
+these situations are handled.
+
+Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/soc/codecs/wm_hubs.c | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- a/sound/soc/codecs/wm_hubs.c
++++ b/sound/soc/codecs/wm_hubs.c
+@@ -634,6 +634,11 @@ void wm_hubs_update_class_w(struct snd_s
+
+ snd_soc_update_bits(codec, WM8993_CLASS_W_0,
+ WM8993_CP_DYN_V | WM8993_CP_DYN_FREQ, enable);
++
++ snd_soc_write(codec, WM8993_LEFT_OUTPUT_VOLUME,
++ snd_soc_read(codec, WM8993_LEFT_OUTPUT_VOLUME));
++ snd_soc_write(codec, WM8993_RIGHT_OUTPUT_VOLUME,
++ snd_soc_read(codec, WM8993_RIGHT_OUTPUT_VOLUME));
+ }
+ EXPORT_SYMBOL_GPL(wm_hubs_update_class_w);
+
--- /dev/null
+From adf00b26d18e1b3570451296e03bcb20e4798cdd Mon Sep 17 00:00:00 2001
+From: Paulo Zanoni <paulo.r.zanoni@intel.com>
+Date: Tue, 25 Sep 2012 13:23:34 -0300
+Subject: drm/i915: make sure we write all the DIP data bytes
+
+From: Paulo Zanoni <paulo.r.zanoni@intel.com>
+
+commit adf00b26d18e1b3570451296e03bcb20e4798cdd upstream.
+
+... even if the actual infoframe is smaller than the maximum possible
+size.
+
+If we don't write all the 32 DIP data bytes the InfoFrame ECC may not
+be correctly calculated in some cases (e.g., when changing the port),
+and this will lead to black screens on HDMI monitors. The ECC value is
+generated by the hardware.
+
+I don't see how this should break anything since we're writing 0 and
+that should be the correct value, so this patch should be safe.
+
+Notice that on IVB and older we actually have 64 bytes available for
+VIDEO_DIP_DATA, but only bytes 0-31 actually store infoframe data: the
+others are either read-only ECC values or marked as "reserved". On HSW
+we only have 32 bytes, and the ECC value is stored on its own separate
+read-only register. See BSpec.
+
+This patch fixes bug #46761, which is marked as a regression
+introduced by commit 4e89ee174bb2da341bf90a84321c7008a3c9210d:
+ drm/i915: set the DIP port on ibx_write_infoframe
+
+Before commit 4e89 we were just failing to send AVI infoframes when we
+needed to change the port, which can lead to black screens in some
+cases. After commit 4e89 we started sending infoframes, but with a
+possibly wrong ECC value. After this patch I hope we start sending
+correct infoframes.
+
+Version 2:
+ - Improve commit message
+ - Try to make the code more clear
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=46761
+Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
+Reviewed-by: Rodrigo Vivi <rodrigo.vivi@gmail.com>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/i915_reg.h | 4 ++++
+ drivers/gpu/drm/i915/intel_hdmi.c | 15 +++++++++++++++
+ 2 files changed, 19 insertions(+)
+
+--- a/drivers/gpu/drm/i915/i915_reg.h
++++ b/drivers/gpu/drm/i915/i915_reg.h
+@@ -1753,6 +1753,10 @@
+
+ /* Video Data Island Packet control */
+ #define VIDEO_DIP_DATA 0x61178
++/* Read the description of VIDEO_DIP_DATA (before Haswel) or VIDEO_DIP_ECC
++ * (Haswell and newer) to see which VIDEO_DIP_DATA byte corresponds to each byte
++ * of the infoframe structure specified by CEA-861. */
++#define VIDEO_DIP_DATA_SIZE 32
+ #define VIDEO_DIP_CTL 0x61170
+ /* Pre HSW: */
+ #define VIDEO_DIP_ENABLE (1 << 31)
+--- a/drivers/gpu/drm/i915/intel_hdmi.c
++++ b/drivers/gpu/drm/i915/intel_hdmi.c
+@@ -151,6 +151,9 @@ static void g4x_write_infoframe(struct d
+ I915_WRITE(VIDEO_DIP_DATA, *data);
+ data++;
+ }
++ /* Write every possible data byte to force correct ECC calculation. */
++ for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
++ I915_WRITE(VIDEO_DIP_DATA, 0);
+ mmiowb();
+
+ val |= g4x_infoframe_enable(frame);
+@@ -186,6 +189,9 @@ static void ibx_write_infoframe(struct d
+ I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
+ data++;
+ }
++ /* Write every possible data byte to force correct ECC calculation. */
++ for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
++ I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
+ mmiowb();
+
+ val |= g4x_infoframe_enable(frame);
+@@ -224,6 +230,9 @@ static void cpt_write_infoframe(struct d
+ I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
+ data++;
+ }
++ /* Write every possible data byte to force correct ECC calculation. */
++ for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
++ I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
+ mmiowb();
+
+ val |= g4x_infoframe_enable(frame);
+@@ -259,6 +268,9 @@ static void vlv_write_infoframe(struct d
+ I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
+ data++;
+ }
++ /* Write every possible data byte to force correct ECC calculation. */
++ for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
++ I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), 0);
+ mmiowb();
+
+ val |= g4x_infoframe_enable(frame);
+@@ -292,6 +304,9 @@ static void hsw_write_infoframe(struct d
+ I915_WRITE(data_reg + i, *data);
+ data++;
+ }
++ /* Write every possible data byte to force correct ECC calculation. */
++ for (; i < VIDEO_DIP_DATA_SIZE; i += 4)
++ I915_WRITE(data_reg + i, 0);
+ mmiowb();
+
+ val |= hsw_infoframe_enable(frame);
--- /dev/null
+From ab3951eb74e7c33a2f5b7b64d72e82f1eea61571 Mon Sep 17 00:00:00 2001
+From: Eugeni Dodonov <eugeni.dodonov@intel.com>
+Date: Mon, 18 Jun 2012 19:03:38 -0300
+Subject: drm/i915: prevent possible pin leak on error path
+
+From: Eugeni Dodonov <eugeni.dodonov@intel.com>
+
+commit ab3951eb74e7c33a2f5b7b64d72e82f1eea61571 upstream.
+
+We should not hit this under any sane conditions, but still, this does not
+looks right.
+
+Reported-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
+CC: Chris Wilson <chris@chris-wilson.co.uk>
+CC: Daniel Vetter <daniel.vetter@ffwll.ch>
+Reviewed-by: Chris Wlison <chris@chris-wilson.co.uk>
+Signed-off-by: Eugeni Dodonov <eugeni.dodonov@intel.com>
+Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/gpu/drm/i915/intel_display.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/gpu/drm/i915/intel_display.c
++++ b/drivers/gpu/drm/i915/intel_display.c
+@@ -6394,7 +6394,7 @@ static int intel_gen7_queue_flip(struct
+ default:
+ WARN_ONCE(1, "unknown plane in flip command\n");
+ ret = -ENODEV;
+- goto err;
++ goto err_unpin;
+ }
+
+ ret = intel_ring_begin(ring, 4);
--- /dev/null
+From 041bbb6d369811e948ae01f3d00414264076be35 Mon Sep 17 00:00:00 2001
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Sun, 30 Sep 2012 23:04:56 -0400
+Subject: ext4: fix mtime update in nodelalloc mode
+
+From: Theodore Ts'o <tytso@mit.edu>
+
+commit 041bbb6d369811e948ae01f3d00414264076be35 upstream.
+
+Commits 5e8830dc85d0 and 41c4d25f78c0 introduced a regression into
+v3.6-rc1 for ext4 in nodealloc mode, such that mtime updates would not
+take place for files modified via mmap if the page was already in the
+page cache. This would also affect ext3 file systems mounted using
+the ext4 file system driver.
+
+The problem was that ext4_page_mkwrite() had a shortcut which would
+avoid calling __block_page_mkwrite() under some circumstances, and the
+above two commit transferred the responsibility of calling
+file_update_time() to __block_page_mkwrite --- which woudln't get
+called in some circumstances.
+
+Since __block_page_mkwrite() only has three callers,
+block_page_mkwrite(), ext4_page_mkwrite, and nilfs_page_mkwrite(), the
+best way to solve this is to move the responsibility for calling
+file_update_time() to its caller.
+
+This problem was found via xfstests #215 with a file system mounted
+with -o nodelalloc.
+
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Reviewed-by: Jan Kara <jack@suse.cz>
+Cc: KONISHI Ryusuke <konishi.ryusuke@lab.ntt.co.jp>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/buffer.c | 13 +++++++------
+ fs/ext4/inode.c | 1 +
+ fs/nilfs2/file.c | 1 +
+ 3 files changed, 9 insertions(+), 6 deletions(-)
+
+--- a/fs/buffer.c
++++ b/fs/buffer.c
+@@ -2312,12 +2312,6 @@ int __block_page_mkwrite(struct vm_area_
+ loff_t size;
+ int ret;
+
+- /*
+- * Update file times before taking page lock. We may end up failing the
+- * fault so this update may be superfluous but who really cares...
+- */
+- file_update_time(vma->vm_file);
+-
+ lock_page(page);
+ size = i_size_read(inode);
+ if ((page->mapping != inode->i_mapping) ||
+@@ -2355,6 +2349,13 @@ int block_page_mkwrite(struct vm_area_st
+ struct super_block *sb = vma->vm_file->f_path.dentry->d_inode->i_sb;
+
+ sb_start_pagefault(sb);
++
++ /*
++ * Update file times before taking page lock. We may end up failing the
++ * fault so this update may be superfluous but who really cares...
++ */
++ file_update_time(vma->vm_file);
++
+ ret = __block_page_mkwrite(vma, vmf, get_block);
+ sb_end_pagefault(sb);
+ return block_page_mkwrite_return(ret);
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -4787,6 +4787,7 @@ int ext4_page_mkwrite(struct vm_area_str
+ int retries = 0;
+
+ sb_start_pagefault(inode->i_sb);
++ file_update_time(vma->vm_file);
+ /* Delalloc case is easy... */
+ if (test_opt(inode->i_sb, DELALLOC) &&
+ !ext4_should_journal_data(inode) &&
+--- a/fs/nilfs2/file.c
++++ b/fs/nilfs2/file.c
+@@ -116,6 +116,7 @@ static int nilfs_page_mkwrite(struct vm_
+ if (unlikely(ret))
+ goto out;
+
++ file_update_time(vma->vm_file);
+ ret = __block_page_mkwrite(vma, vmf, nilfs_get_block);
+ if (ret) {
+ nilfs_transaction_abort(inode->i_sb);
--- /dev/null
+From 36e4f20af833d1ce196e6a4ade05dc26c44652d1 Mon Sep 17 00:00:00 2001
+From: Michal Hocko <mhocko@suse.cz>
+Date: Mon, 8 Oct 2012 16:33:31 -0700
+Subject: hugetlb: do not use vma_hugecache_offset() for vma_prio_tree_foreach
+
+From: Michal Hocko <mhocko@suse.cz>
+
+commit 36e4f20af833d1ce196e6a4ade05dc26c44652d1 upstream.
+
+Commit 0c176d52b0b2 ("mm: hugetlb: fix pgoff computation when unmapping
+page from vma") fixed pgoff calculation but it has replaced it by
+vma_hugecache_offset() which is not approapriate for offsets used for
+vma_prio_tree_foreach() because that one expects index in page units
+rather than in huge_page_shift.
+
+Johannes said:
+
+: The resulting index may not be too big, but it can be too small: assume
+: hpage size of 2M and the address to unmap to be 0x200000. This is regular
+: page index 512 and hpage index 1. If you have a VMA that maps the file
+: only starting at the second huge page, that VMAs vm_pgoff will be 512 but
+: you ask for offset 1 and miss it even though it does map the page of
+: interest. hugetlb_cow() will try to unmap, miss the vma, and retry the
+: cow until the allocation succeeds or the skipped vma(s) go away.
+
+Signed-off-by: Michal Hocko <mhocko@suse.cz>
+Acked-by: Hillf Danton <dhillf@gmail.com>
+Cc: Mel Gorman <mel@csn.ul.ie>
+Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
+Cc: Andrea Arcangeli <aarcange@redhat.com>
+Cc: David Rientjes <rientjes@google.com>
+Acked-by: Johannes Weiner <hannes@cmpxchg.org>
+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>
+
+---
+ mm/hugetlb.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/mm/hugetlb.c
++++ b/mm/hugetlb.c
+@@ -2481,7 +2481,8 @@ static int unmap_ref_private(struct mm_s
+ * from page cache lookup which is in HPAGE_SIZE units.
+ */
+ address = address & huge_page_mask(h);
+- pgoff = vma_hugecache_offset(h, vma, address);
++ pgoff = ((address - vma->vm_start) >> PAGE_SHIFT) +
++ vma->vm_pgoff;
+ mapping = vma->vm_file->f_dentry->d_inode->i_mapping;
+
+ /*
--- /dev/null
+From 7a71932d5676b7410ab64d149bad8bde6b0d8632 Mon Sep 17 00:00:00 2001
+From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Date: Mon, 8 Oct 2012 16:33:47 -0700
+Subject: kpageflags: fix wrong KPF_THP on non-huge compound pages
+
+From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+
+commit 7a71932d5676b7410ab64d149bad8bde6b0d8632 upstream.
+
+KPF_THP can be set on non-huge compound pages (like slab pages or pages
+allocated by drivers with __GFP_COMP) because PageTransCompound only
+checks PG_head and PG_tail. Obviously this is a bug and breaks user space
+applications which look for thp via /proc/kpageflags.
+
+This patch rules out setting KPF_THP wrongly by additionally checking
+PageLRU on the head pages.
+
+Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
+Acked-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
+Acked-by: David Rientjes <rientjes@google.com>
+Reviewed-by: Fengguang Wu <fengguang.wu@intel.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>
+
+---
+ fs/proc/page.c | 8 +++++++-
+ 1 file changed, 7 insertions(+), 1 deletion(-)
+
+--- a/fs/proc/page.c
++++ b/fs/proc/page.c
+@@ -115,7 +115,13 @@ u64 stable_page_flags(struct page *page)
+ u |= 1 << KPF_COMPOUND_TAIL;
+ if (PageHuge(page))
+ u |= 1 << KPF_HUGE;
+- else if (PageTransCompound(page))
++ /*
++ * PageTransCompound can be true for non-huge compound pages (slab
++ * pages or pages allocated by drivers with __GFP_COMP) because it
++ * just checks PG_head/PG_tail, so we need to check PageLRU to make
++ * sure a given page is a thp, not a non-huge compound page.
++ */
++ else if (PageTransCompound(page) && PageLRU(compound_trans_head(page)))
+ u |= 1 << KPF_THP;
+
+ /*
--- /dev/null
+From 65fc7f9957c52ad4fdf4ee5dfe3a75aa0a633d39 Mon Sep 17 00:00:00 2001
+From: Gabor Juhos <juhosg@openwrt.org>
+Date: Sat, 1 Sep 2012 18:46:00 +0200
+Subject: MIPS: ath79: use correct fractional dividers for {CPU,DDR}_PLL on AR934x
+
+From: Gabor Juhos <juhosg@openwrt.org>
+
+commit 65fc7f9957c52ad4fdf4ee5dfe3a75aa0a633d39 upstream.
+
+The current dividers in the code are wrong and this
+leads to broken CPU frequency calculation on boards
+where the fractional part is used.
+
+For example, if the SoC is running from a 40MHz
+reference clock, refdiv=1, nint=14, outdiv=0 and
+nfrac=31 the real frequency is 579.375MHz but the
+current code calculates 569.687MHz instead.
+
+Because the system time is indirectly related to
+the CPU frequency the broken computation causes
+drift in the system time.
+
+The correct divider is 2^6 for the CPU PLL and 2^10
+for the DDR PLL. Use the correct values to fix the
+issue.
+
+Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
+Cc: linux-mips@linux-mips.org
+Patchwork: https://patchwork.linux-mips.org/patch/4305/
+Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/mips/ath79/clock.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/arch/mips/ath79/clock.c
++++ b/arch/mips/ath79/clock.c
+@@ -189,7 +189,7 @@ static void __init ar934x_clocks_init(vo
+ AR934X_PLL_CPU_CONFIG_NFRAC_MASK;
+
+ cpu_pll = nint * ath79_ref_clk.rate / ref_div;
+- cpu_pll += frac * ath79_ref_clk.rate / (ref_div * (2 << 6));
++ cpu_pll += frac * ath79_ref_clk.rate / (ref_div * (1 << 6));
+ cpu_pll /= (1 << out_div);
+
+ pll = ath79_pll_rr(AR934X_PLL_DDR_CONFIG_REG);
+@@ -203,7 +203,7 @@ static void __init ar934x_clocks_init(vo
+ AR934X_PLL_DDR_CONFIG_NFRAC_MASK;
+
+ ddr_pll = nint * ath79_ref_clk.rate / ref_div;
+- ddr_pll += frac * ath79_ref_clk.rate / (ref_div * (2 << 10));
++ ddr_pll += frac * ath79_ref_clk.rate / (ref_div * (1 << 10));
+ ddr_pll /= (1 << out_div);
+
+ clk_ctrl = ath79_pll_rr(AR934X_PLL_CPU_DDR_CLK_CTRL_REG);
--- /dev/null
+From ec4d9f626d5908b6052c2973f37992f1db52e967 Mon Sep 17 00:00:00 2001
+From: Hugh Dickins <hughd@google.com>
+Date: Mon, 8 Oct 2012 16:33:14 -0700
+Subject: mm: fix invalidate_complete_page2() lock ordering
+
+From: Hugh Dickins <hughd@google.com>
+
+commit ec4d9f626d5908b6052c2973f37992f1db52e967 upstream.
+
+In fuzzing with trinity, lockdep protested "possible irq lock inversion
+dependency detected" when isolate_lru_page() reenabled interrupts while
+still holding the supposedly irq-safe tree_lock:
+
+invalidate_inode_pages2
+ invalidate_complete_page2
+ spin_lock_irq(&mapping->tree_lock)
+ clear_page_mlock
+ isolate_lru_page
+ spin_unlock_irq(&zone->lru_lock)
+
+isolate_lru_page() is correct to enable interrupts unconditionally:
+invalidate_complete_page2() is incorrect to call clear_page_mlock() while
+holding tree_lock, which is supposed to nest inside lru_lock.
+
+Both truncate_complete_page() and invalidate_complete_page() call
+clear_page_mlock() before taking tree_lock to remove page from radix_tree.
+ I guess invalidate_complete_page2() preferred to test PageDirty (again)
+under tree_lock before committing to the munlock; but since the page has
+already been unmapped, its state is already somewhat inconsistent, and no
+worse if clear_page_mlock() moved up.
+
+Reported-by: Sasha Levin <levinsasha928@gmail.com>
+Deciphered-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Hugh Dickins <hughd@google.com>
+Acked-by: Mel Gorman <mel@csn.ul.ie>
+Cc: Rik van Riel <riel@redhat.com>
+Cc: Johannes Weiner <hannes@cmpxchg.org>
+Cc: Michel Lespinasse <walken@google.com>
+Cc: Ying Han <yinghan@google.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>
+
+---
+ mm/truncate.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/mm/truncate.c
++++ b/mm/truncate.c
+@@ -394,11 +394,12 @@ invalidate_complete_page2(struct address
+ if (page_has_private(page) && !try_to_release_page(page, GFP_KERNEL))
+ return 0;
+
++ clear_page_mlock(page);
++
+ spin_lock_irq(&mapping->tree_lock);
+ if (PageDirty(page))
+ goto failed;
+
+- clear_page_mlock(page);
+ BUG_ON(page_has_private(page));
+ __delete_from_page_cache(page);
+ spin_unlock_irq(&mapping->tree_lock);
--- /dev/null
+From 027ef6c87853b0a9df53175063028edb4950d476 Mon Sep 17 00:00:00 2001
+From: Andrea Arcangeli <aarcange@redhat.com>
+Date: Mon, 8 Oct 2012 16:33:27 -0700
+Subject: mm: thp: fix pmd_present for split_huge_page and PROT_NONE with THP
+
+From: Andrea Arcangeli <aarcange@redhat.com>
+
+commit 027ef6c87853b0a9df53175063028edb4950d476 upstream.
+
+In many places !pmd_present has been converted to pmd_none. For pmds
+that's equivalent and pmd_none is quicker so using pmd_none is better.
+
+However (unless we delete pmd_present) we should provide an accurate
+pmd_present too. This will avoid the risk of code thinking the pmd is non
+present because it's under __split_huge_page_map, see the pmd_mknotpresent
+there and the comment above it.
+
+If the page has been mprotected as PROT_NONE, it would also lead to a
+pmd_present false negative in the same way as the race with
+split_huge_page.
+
+Because the PSE bit stays on at all times (both during split_huge_page and
+when the _PAGE_PROTNONE bit get set), we could only check for the PSE bit,
+but checking the PROTNONE bit too is still good to remember pmd_present
+must always keep PROT_NONE into account.
+
+This explains a not reproducible BUG_ON that was seldom reported on the
+lists.
+
+The same issue is in pmd_large, it would go wrong with both PROT_NONE and
+if it races with split_huge_page.
+
+Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
+Acked-by: Rik van Riel <riel@redhat.com>
+Cc: Johannes Weiner <jweiner@redhat.com>
+Cc: Hugh Dickins <hughd@google.com>
+Cc: Mel Gorman <mgorman@suse.de>
+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/pgtable.h | 11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+--- a/arch/x86/include/asm/pgtable.h
++++ b/arch/x86/include/asm/pgtable.h
+@@ -146,8 +146,7 @@ static inline unsigned long pmd_pfn(pmd_
+
+ static inline int pmd_large(pmd_t pte)
+ {
+- return (pmd_flags(pte) & (_PAGE_PSE | _PAGE_PRESENT)) ==
+- (_PAGE_PSE | _PAGE_PRESENT);
++ return pmd_flags(pte) & _PAGE_PSE;
+ }
+
+ #ifdef CONFIG_TRANSPARENT_HUGEPAGE
+@@ -415,7 +414,13 @@ static inline int pte_hidden(pte_t pte)
+
+ static inline int pmd_present(pmd_t pmd)
+ {
+- return pmd_flags(pmd) & _PAGE_PRESENT;
++ /*
++ * Checking for _PAGE_PSE is needed too because
++ * split_huge_page will temporarily clear the present bit (but
++ * the _PAGE_PSE flag will remain set at all times while the
++ * _PAGE_PRESENT bit is clear).
++ */
++ return pmd_flags(pmd) & (_PAGE_PRESENT | _PAGE_PROTNONE | _PAGE_PSE);
+ }
+
+ static inline int pmd_none(pmd_t pmd)
ext4-online-defrag-is-not-supported-for-journaled-files.patch
ext4-always-set-i_op-in-ext4_mknod.patch
ext4-fix-fdatasync-for-files-with-only-i_size-changes.patch
+ext4-fix-mtime-update-in-nodelalloc-mode.patch
+asoc-wm_hubs-ensure-volume-updates-are-handled-during-class-w-startup.patch
+asoc-wm5110-adding-missing-volume-update-bits.patch
+asoc-wm9712-fix-name-of-capture-switch.patch
+kpageflags-fix-wrong-kpf_thp-on-non-huge-compound-pages.patch
+hugetlb-do-not-use-vma_hugecache_offset-for-vma_prio_tree_foreach.patch
+mm-fix-invalidate_complete_page2-lock-ordering.patch
+mm-thp-fix-pmd_present-for-split_huge_page-and-prot_none-with-thp.patch
+mips-ath79-use-correct-fractional-dividers-for-cpu-ddr-_pll-on-ar934x.patch
+drm-i915-prevent-possible-pin-leak-on-error-path.patch
+drm-i915-make-sure-we-write-all-the-dip-data-bytes.patch
+alsa-hda-add-inverted-internal-mic-quirk-for-lenovo-ideapad-u310.patch
+alsa-aloop-add-locking-to-timer-access.patch
+alsa-hda-via-don-t-report-presence-on-hps-with-no-presence-support.patch
+alsa-hda-realtek-fix-detection-of-alc271x-codec.patch
+alsa-hda-limit-internal-mic-boost-for-asus-x202e.patch
+alsa-usb-disable-broken-hw-volume-for-tenx-tp6911.patch
+alsa-snd-usb-add-quirks-for-playback-designs-devices.patch
+alsa-usb-support-for-original-xbox-communicator.patch
+alsa-hda-add-another-pci-id-for-haswell-board.patch
+alsa-hda-use-lpib-for-delay-estimation.patch