--- /dev/null
+From bc32ef0a6d6a6e1a4745101f2678a2ca1f3eb8fe Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Mon, 4 Feb 2013 10:28:15 +0100
+Subject: ALSA: aloop: Fix Oops while PM resume
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit edac894389f9c9de2a1368c78809c824b343f3a5 upstream.
+
+snd-aloop driver has no proper PM implementation, thus the PM resume
+may trigger Oops due to leftover timer instance. This patch adds the
+missing suspend/resume implementation.
+
+Reported-and-tested-by: El boulangero <elboulangero@gmail.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/drivers/aloop.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/sound/drivers/aloop.c
++++ b/sound/drivers/aloop.c
+@@ -287,12 +287,14 @@ static int loopback_trigger(struct snd_p
+ loopback_active_notify(dpcm);
+ break;
+ case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
++ case SNDRV_PCM_TRIGGER_SUSPEND:
+ spin_lock(&cable->lock);
+ cable->pause |= stream;
+ spin_unlock(&cable->lock);
+ loopback_timer_stop(dpcm);
+ break;
+ case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
++ case SNDRV_PCM_TRIGGER_RESUME:
+ spin_lock(&cable->lock);
+ dpcm->last_jiffies = jiffies;
+ cable->pause &= ~stream;
+@@ -552,7 +554,8 @@ static snd_pcm_uframes_t loopback_pointe
+ static struct snd_pcm_hardware loopback_pcm_hardware =
+ {
+ .info = (SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP |
+- SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE),
++ SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_PAUSE |
++ SNDRV_PCM_INFO_RESUME),
+ .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |
+ SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE |
+ SNDRV_PCM_FMTBIT_FLOAT_LE | SNDRV_PCM_FMTBIT_FLOAT_BE),
--- /dev/null
+From 91abcd9460c3ac7d538c1459768031745dd9537c Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Thu, 10 May 2012 08:54:23 +0200
+Subject: ALSA: hda - Add Conexant CX20751/2/3/4 codec support
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 61d648fb4726f8a89c07cd1904f9c2e11bf26df5 upstream.
+
+These are almost compatible with the older Conexant codecs.
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_conexant.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -4521,6 +4521,10 @@ static int patch_conexant_auto(struct hd
+ */
+
+ static const struct hda_codec_preset snd_hda_preset_conexant[] = {
++ { .id = 0x14f11510, .name = "CX20751/2",
++ .patch = patch_conexant_auto },
++ { .id = 0x14f11511, .name = "CX20753/4",
++ .patch = patch_conexant_auto },
+ { .id = 0x14f15045, .name = "CX20549 (Venice)",
+ .patch = patch_cxt5045 },
+ { .id = 0x14f15047, .name = "CX20551 (Waikiki)",
+@@ -4558,6 +4562,8 @@ static const struct hda_codec_preset snd
+ {} /* terminator */
+ };
+
++MODULE_ALIAS("snd-hda-codec-id:14f11510");
++MODULE_ALIAS("snd-hda-codec-id:14f11511");
+ MODULE_ALIAS("snd-hda-codec-id:14f15045");
+ MODULE_ALIAS("snd-hda-codec-id:14f15047");
+ MODULE_ALIAS("snd-hda-codec-id:14f15051");
--- /dev/null
+From 7f778c1b063b7fb67e6367e5e7eb903ce863052b Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Fri, 14 Dec 2012 10:22:35 +0100
+Subject: ALSA: hda - Always turn on pins for HDMI/DP
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 6169b673618bf0b2518ce413b54925782a603f06 upstream.
+
+We've seen the broken HDMI *video* output on some machines with GM965,
+and the debugging session pointed that the culprit is the disabled
+audio output pins. Toggling these pins dynamically on demand caused
+flickering of HDMI TV.
+
+This patch changes the behavior to keep the pin ON constantly.
+
+Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=51421
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_hdmi.c | 18 ++++--------------
+ 1 file changed, 4 insertions(+), 14 deletions(-)
+
+--- a/sound/pci/hda/patch_hdmi.c
++++ b/sound/pci/hda/patch_hdmi.c
+@@ -425,9 +425,11 @@ static void hdmi_init_pin(struct hda_cod
+ if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP)
+ snd_hda_codec_write(codec, pin_nid, 0,
+ AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
+- /* Disable pin out until stream is active*/
++ /* Enable pin out: some machines with GM965 gets broken output when
++ * the pin is disabled or changed while using with HDMI
++ */
+ snd_hda_codec_write(codec, pin_nid, 0,
+- AC_VERB_SET_PIN_WIDGET_CONTROL, 0);
++ AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
+ }
+
+ static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t cvt_nid)
+@@ -1152,17 +1154,11 @@ static int generic_hdmi_playback_pcm_pre
+ struct hdmi_spec *spec = codec->spec;
+ int pin_idx = hinfo_to_pin_index(spec, hinfo);
+ hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
+- int pinctl;
+
+ hdmi_set_channel_count(codec, cvt_nid, substream->runtime->channels);
+
+ hdmi_setup_audio_infoframe(codec, pin_idx, substream);
+
+- pinctl = snd_hda_codec_read(codec, pin_nid, 0,
+- AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+- snd_hda_codec_write(codec, pin_nid, 0,
+- AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl | PIN_OUT);
+-
+ return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
+ }
+
+@@ -1174,7 +1170,6 @@ static int generic_hdmi_playback_pcm_cle
+ int cvt_idx, pin_idx;
+ struct hdmi_spec_per_cvt *per_cvt;
+ struct hdmi_spec_per_pin *per_pin;
+- int pinctl;
+
+ snd_hda_codec_cleanup_stream(codec, hinfo->nid);
+
+@@ -1193,11 +1188,6 @@ static int generic_hdmi_playback_pcm_cle
+ return -EINVAL;
+ per_pin = &spec->pins[pin_idx];
+
+- pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
+- AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
+- snd_hda_codec_write(codec, per_pin->pin_nid, 0,
+- AC_VERB_SET_PIN_WIDGET_CONTROL,
+- pinctl & ~PIN_OUT);
+ snd_hda_spdif_ctls_unassign(codec, pin_idx);
+ }
+
--- /dev/null
+From d027778a1cf87dda708c66364d5bebd1e3be9ae9 Mon Sep 17 00:00:00 2001
+From: Takashi Iwai <tiwai@suse.de>
+Date: Tue, 29 Jan 2013 18:07:22 +0100
+Subject: ALSA: hda - Fix non-snoop page handling
+
+From: Takashi Iwai <tiwai@suse.de>
+
+commit 9ddf1aeb2134e72275c97a2c6ff2e3eb04f2f27a upstream.
+
+For non-snoop mode, we fiddle with the page attributes of CORB/RIRB
+and the position buffer, but also the ring buffers. The problem is
+that the current code blindly assumes that the buffer is contiguous.
+However, the ring buffers may be SG-buffers, thus a wrong vmapped
+address is passed there, leading to Oops.
+
+This patch fixes the handling for SG-buffers.
+
+Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=800701
+
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+[bwh: Backported to 3.2: open-code snd_pcm_get_dma_buf()]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/hda_intel.c | 40 ++++++++++++++++++++++++++--------------
+ 1 file changed, 26 insertions(+), 14 deletions(-)
+
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -582,29 +582,43 @@ static char *driver_short_names[] __devi
+ #define get_azx_dev(substream) (substream->runtime->private_data)
+
+ #ifdef CONFIG_X86
+-static void __mark_pages_wc(struct azx *chip, void *addr, size_t size, bool on)
++static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on)
+ {
++ int pages;
++
+ if (azx_snoop(chip))
+ return;
+- if (addr && size) {
+- int pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
++ if (!dmab || !dmab->area || !dmab->bytes)
++ return;
++
++#ifdef CONFIG_SND_DMA_SGBUF
++ if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) {
++ struct snd_sg_buf *sgbuf = dmab->private_data;
+ if (on)
+- set_memory_wc((unsigned long)addr, pages);
++ set_pages_array_wc(sgbuf->page_table, sgbuf->pages);
+ else
+- set_memory_wb((unsigned long)addr, pages);
++ set_pages_array_wb(sgbuf->page_table, sgbuf->pages);
++ return;
+ }
++#endif
++
++ pages = (dmab->bytes + PAGE_SIZE - 1) >> PAGE_SHIFT;
++ if (on)
++ set_memory_wc((unsigned long)dmab->area, pages);
++ else
++ set_memory_wb((unsigned long)dmab->area, pages);
+ }
+
+ static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf,
+ bool on)
+ {
+- __mark_pages_wc(chip, buf->area, buf->bytes, on);
++ __mark_pages_wc(chip, buf, on);
+ }
+ static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev,
+- struct snd_pcm_runtime *runtime, bool on)
++ struct snd_pcm_substream *substream, bool on)
+ {
+ if (azx_dev->wc_marked != on) {
+- __mark_pages_wc(chip, runtime->dma_area, runtime->dma_bytes, on);
++ __mark_pages_wc(chip, substream->runtime->dma_buffer_p, on);
+ azx_dev->wc_marked = on;
+ }
+ }
+@@ -615,7 +629,7 @@ static inline void mark_pages_wc(struct
+ {
+ }
+ static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev,
+- struct snd_pcm_runtime *runtime, bool on)
++ struct snd_pcm_substream *substream, bool on)
+ {
+ }
+ #endif
+@@ -1772,11 +1786,10 @@ static int azx_pcm_hw_params(struct snd_
+ {
+ struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
+ struct azx *chip = apcm->chip;
+- struct snd_pcm_runtime *runtime = substream->runtime;
+ struct azx_dev *azx_dev = get_azx_dev(substream);
+ int ret;
+
+- mark_runtime_wc(chip, azx_dev, runtime, false);
++ mark_runtime_wc(chip, azx_dev, substream, false);
+ azx_dev->bufsize = 0;
+ azx_dev->period_bytes = 0;
+ azx_dev->format_val = 0;
+@@ -1784,7 +1797,7 @@ static int azx_pcm_hw_params(struct snd_
+ params_buffer_bytes(hw_params));
+ if (ret < 0)
+ return ret;
+- mark_runtime_wc(chip, azx_dev, runtime, true);
++ mark_runtime_wc(chip, azx_dev, substream, true);
+ return ret;
+ }
+
+@@ -1793,7 +1806,6 @@ static int azx_pcm_hw_free(struct snd_pc
+ struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
+ struct azx_dev *azx_dev = get_azx_dev(substream);
+ struct azx *chip = apcm->chip;
+- struct snd_pcm_runtime *runtime = substream->runtime;
+ struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream];
+
+ /* reset BDL address */
+@@ -1806,7 +1818,7 @@ static int azx_pcm_hw_free(struct snd_pc
+
+ snd_hda_codec_cleanup(apcm->codec, hinfo, substream);
+
+- mark_runtime_wc(chip, azx_dev, runtime, false);
++ mark_runtime_wc(chip, azx_dev, substream, false);
+ return snd_pcm_lib_free_pages(substream);
+ }
+
--- /dev/null
+From 40de8047654debace75db0f04aebbbaace5bdd26 Mon Sep 17 00:00:00 2001
+From: Calvin Owens <jcalvinowens@gmail.com>
+Date: Fri, 12 Apr 2013 22:33:59 -0500
+Subject: ALSA: usb: Add quirk for 192KHz recording on E-Mu devices
+
+From: Calvin Owens <jcalvinowens@gmail.com>
+
+commit 1539d4f82ad534431cc67935e8e442ccf107d17d upstream.
+
+When recording at 176.2KHz or 192Khz, the device adds a 32-bit length
+header to the capture packets, which obviously needs to be ignored for
+recording to work properly.
+
+Userspace expected: L0 L1 L2 R0 R1 R2
+...but actually got: R2 L0 L1 L2 R0 R1
+
+Also, the last byte of the length header being interpreted as L0 of
+the first sample caused spikes every 0.5ms, resulting in a loud 16KHz
+tone (about the highest 'B' on a piano) being present throughout
+captures.
+
+Tested at all sample rates on an E-Mu 0404USB, and tested for
+regressions on a generic USB headset.
+
+Signed-off-by: Calvin Owens <jcalvinowens@gmail.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+[bwh: Backported to 3.2: adjust filenames, context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/usb/card.h | 1 +
+ sound/usb/endpoint.c | 3 ++-
+ sound/usb/quirks.c | 1 +
+ 3 files changed, 4 insertions(+), 1 deletion(-)
+
+--- a/sound/usb/card.h
++++ b/sound/usb/card.h
+@@ -74,6 +74,7 @@ struct snd_usb_substream {
+ unsigned int fill_max: 1; /* fill max packet size always */
+ unsigned int txfr_quirk:1; /* allow sub-frame alignment */
+ unsigned int fmt_type; /* USB audio format type (1-3) */
++ unsigned int pkt_offset_adj; /* Bytes to drop from beginning of packets (for non-compliant devices) */
+
+ unsigned int running: 1; /* running status */
+
+--- a/sound/usb/endpoint.c
++++ b/sound/usb/endpoint.c
+@@ -458,7 +458,7 @@ static int retire_capture_urb(struct snd
+ stride = runtime->frame_bits >> 3;
+
+ for (i = 0; i < urb->number_of_packets; i++) {
+- cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset;
++ cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset + subs->pkt_offset_adj;
+ if (urb->iso_frame_desc[i].status && printk_ratelimit()) {
+ snd_printdd("frame %d active: %d\n", i, urb->iso_frame_desc[i].status);
+ // continue;
+@@ -898,6 +898,7 @@ void snd_usb_init_substream(struct snd_u
+ subs->speed = snd_usb_get_speed(subs->dev);
+ if (subs->speed >= USB_SPEED_HIGH)
+ subs->ops.prepare_sync = prepare_capture_sync_urb_hs;
++ subs->pkt_offset_adj = 0;
+
+ snd_usb_set_pcm_ops(as->pcm, stream);
+
+--- a/sound/usb/quirks.c
++++ b/sound/usb/quirks.c
+@@ -748,6 +748,7 @@ static void set_format_emu_quirk(struct
+ break;
+ }
+ snd_emuusb_set_samplerate(subs->stream->chip, emu_samplerate_id);
++ subs->pkt_offset_adj = (emu_samplerate_id >= EMU_QUIRK_SR_176400HZ) ? 4 : 0;
+ }
+
+ void snd_usb_set_format_quirk(struct snd_usb_substream *subs,
--- /dev/null
+From 5b7d898a1904e32b640de3bed57d9646fe1f69ee Mon Sep 17 00:00:00 2001
+From: David Henningsson <david.henningsson@canonical.com>
+Date: Wed, 19 Dec 2012 09:44:47 +0100
+Subject: Revert "ALSA: hda - Shut up pins at power-saving mode with Conexnat codecs"
+
+From: David Henningsson <david.henningsson@canonical.com>
+
+commit 7ed4165e2d01bdbbb4c1086eb73eadf0f64cbbf0 upstream.
+
+This reverts commit 697c373e34613609cb5450f98b91fefb6e910588.
+
+The original patch was meant to remove clicking, but in fact caused even
+more clicking instead.
+
+Thanks to c4pp4 for doing most of the work with this bug.
+
+BugLink: https://bugs.launchpad.net/bugs/886975
+Signed-off-by: David Henningsson <david.henningsson@canonical.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+[bwh: Backported to 3.2: adjust context]
+Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
+Cc: Weng Meiling <wengmeiling.weng@huawei.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ sound/pci/hda/patch_conexant.c | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+--- a/sound/pci/hda/patch_conexant.c
++++ b/sound/pci/hda/patch_conexant.c
+@@ -548,24 +548,12 @@ static int conexant_build_controls(struc
+ return 0;
+ }
+
+-#ifdef CONFIG_SND_HDA_POWER_SAVE
+-static int conexant_suspend(struct hda_codec *codec, pm_message_t state)
+-{
+- snd_hda_shutup_pins(codec);
+- return 0;
+-}
+-#endif
+-
+ static const struct hda_codec_ops conexant_patch_ops = {
+ .build_controls = conexant_build_controls,
+ .build_pcms = conexant_build_pcms,
+ .init = conexant_init,
+ .free = conexant_free,
+ .set_power_state = conexant_set_power,
+-#ifdef CONFIG_SND_HDA_POWER_SAVE
+- .suspend = conexant_suspend,
+-#endif
+- .reboot_notify = snd_hda_shutup_pins,
+ };
+
+ #ifdef CONFIG_SND_HDA_INPUT_BEEP
+@@ -4360,10 +4348,6 @@ static const struct hda_codec_ops cx_aut
+ .init = cx_auto_init,
+ .free = conexant_free,
+ .unsol_event = cx_auto_unsol_event,
+-#ifdef CONFIG_SND_HDA_POWER_SAVE
+- .suspend = conexant_suspend,
+-#endif
+- .reboot_notify = snd_hda_shutup_pins,
+ };
+
+ /*
usb-add-device-quirk-for-microsoft-vx700-webcam.patch
usb-add-quirk-detection-based-on-interface-information.patch
usb-add-usb_quirk_reset_resume-for-all-logitech-uvc-webcams.patch
+alsa-usb-add-quirk-for-192khz-recording-on-e-mu-devices.patch
+alsa-aloop-fix-oops-while-pm-resume.patch
+alsa-hda-fix-non-snoop-page-handling.patch
+alsa-hda-add-conexant-cx20751-2-3-4-codec-support.patch
+revert-alsa-hda-shut-up-pins-at-power-saving-mode-with-conexnat-codecs.patch
+alsa-hda-always-turn-on-pins-for-hdmi-dp.patch