Merge branch 'build' into release

* build:
  global makefile: handle include/uapi/sound redirection properly
  Refreshed pci/hda/hda_intel.patch and usb/caiaq/device.patch
  Buil snd-usb-usx2y on >= 2.6.24 only
  Avoid use of timecounter for old kernels in hda_intel.c
  Refresh usb/stream.patch
  Add missing wrappers of flush_delayed_work() and flush_work() for older kernels
  Refresh pcm_native.patch
  Add $KERNEL/include/uapi to include path
  Refresh include/sound/core.patch
  Refresh usb/endpoint.patch
  Update usb/card.patch
  Update emu10k1_main.patch
  Build snd-scs1x only on 2.6.39 and later kernels
  Add a build stub for snd-scs1x driver
  Refresh include/sound/pcm.patch
diff --git a/alsa/Makefile b/alsa/Makefile
index ce32384..84f5c11 100644
--- a/alsa/Makefile
+++ b/alsa/Makefile
@@ -123,6 +123,10 @@
 			done ; \
 			ln -sf $(ALSAKERNELDIR)/include/sound \
 						alsa-kernel/include ; \
+			if test -d $(ALSAKERNELDIR)/include/uapi/sound; then \
+				ln -sf $(ALSAKERNELDIR)/include/uapi/sound \
+							alsa-kernel/uapi ; \
+			fi ; \
 			ln -sf $(ALSAKERNELDIR)/include/trace/events \
 						alsa-kernel/trace_events ; \
 			ln -sf $(ALSAKERNELDIR)/Documentation/sound/alsa \
diff --git a/alsa/acore/pcm_native.patch b/alsa/acore/pcm_native.patch
index 9066472..9c08ea4 100644
--- a/alsa/acore/pcm_native.patch
+++ b/alsa/acore/pcm_native.patch
@@ -1,5 +1,5 @@
---- ../alsa-kernel/core/pcm_native.c	2012-10-30 11:00:52.000000000 +0100
-+++ pcm_native.c	2012-10-30 11:02:14.000000000 +0100
+--- ../alsa-kernel/core/pcm_native.c	2012-11-22 17:40:53.000000000 +0100
++++ pcm_native.c	2012-11-23 18:05:26.000000000 +0100
 @@ -1,3 +1,11 @@
 +#define __NO_VERSION__
 +#include "adriver.h"
@@ -130,7 +130,7 @@
  	if (substream->pcm_release) {
  		substream->pcm_release(substream);
  		substream->pcm_release = NULL;
-@@ -2854,23 +2919,42 @@
+@@ -2856,23 +2921,42 @@
  
  	pcm_file = file->private_data;
  	substream = pcm_file->substream;
@@ -180,7 +180,7 @@
  {
  	struct snd_pcm_file *pcm_file;
  	struct snd_pcm_substream *substream;
-@@ -2880,7 +2964,11 @@
+@@ -2882,7 +2966,11 @@
  	void __user **bufs;
  	snd_pcm_uframes_t frames;
  
@@ -192,7 +192,7 @@
  	substream = pcm_file->substream;
  	if (PCM_RUNTIME_CHECK(substream))
  		return -ENXIO;
-@@ -2904,8 +2992,13 @@
+@@ -2906,8 +2994,13 @@
  	return result;
  }
  
@@ -206,7 +206,7 @@
  {
  	struct snd_pcm_file *pcm_file;
  	struct snd_pcm_substream *substream;
-@@ -2915,7 +3008,11 @@
+@@ -2917,7 +3010,11 @@
  	void __user **bufs;
  	snd_pcm_uframes_t frames;
  
@@ -218,7 +218,7 @@
  	substream = pcm_file->substream;
  	if (PCM_RUNTIME_CHECK(substream))
  		return -ENXIO;
-@@ -2937,6 +3034,7 @@
+@@ -2939,6 +3036,7 @@
  	kfree(bufs);
  	return result;
  }
@@ -226,13 +226,14 @@
  
  static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait)
  {
-@@ -3024,6 +3122,18 @@
+@@ -3026,6 +3124,19 @@
   * mmap support
   */
  
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
 +#ifndef VM_RESERVED
 +#define USE_MMAP_SWAPOUT
-+#define VM_RESERVED	0	/* dummy */
++#endif
 +#endif
 +
 +#ifdef USE_MMAP_SWAPOUT
@@ -245,7 +246,7 @@
  /*
   * Only on coherent architectures, we can mmap the status and the control records
   * for effcient data transfer.  On others, we have to use HWSYNC ioctl...
-@@ -3032,6 +3142,7 @@
+@@ -3034,6 +3145,7 @@
  /*
   * mmap status record
   */
@@ -253,7 +254,7 @@
  static int snd_pcm_mmap_status_fault(struct vm_area_struct *area,
  						struct vm_fault *vmf)
  {
-@@ -3045,10 +3156,35 @@
+@@ -3047,10 +3159,35 @@
  	get_page(vmf->page);
  	return 0;
  }
@@ -289,7 +290,7 @@
  };
  
  static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file,
-@@ -3069,6 +3205,7 @@
+@@ -3071,6 +3208,7 @@
  /*
   * mmap control record
   */
@@ -297,7 +298,7 @@
  static int snd_pcm_mmap_control_fault(struct vm_area_struct *area,
  						struct vm_fault *vmf)
  {
-@@ -3082,10 +3219,36 @@
+@@ -3084,10 +3222,36 @@
  	get_page(vmf->page);
  	return 0;
  }
@@ -334,7 +335,7 @@
  };
  
  static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file,
-@@ -3139,9 +3302,12 @@
+@@ -3141,9 +3305,12 @@
  	return virt_to_page(vaddr);
  }
  
@@ -347,7 +348,7 @@
  static int snd_pcm_mmap_data_fault(struct vm_area_struct *area,
  						struct vm_fault *vmf)
  {
-@@ -3168,6 +3334,45 @@
+@@ -3170,6 +3337,45 @@
  	vmf->page = page;
  	return 0;
  }
@@ -393,7 +394,7 @@
  
  static const struct vm_operations_struct snd_pcm_vm_ops_data = {
  	.open =		snd_pcm_mmap_data_open,
-@@ -3177,7 +3382,14 @@
+@@ -3179,7 +3385,14 @@
  static const struct vm_operations_struct snd_pcm_vm_ops_data_fault = {
  	.open =		snd_pcm_mmap_data_open,
  	.close =	snd_pcm_mmap_data_close,
@@ -408,7 +409,7 @@
  };
  
  #ifndef ARCH_HAS_DMA_MMAP_COHERENT
-@@ -3226,11 +3438,23 @@
+@@ -3228,11 +3441,23 @@
  	area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
  	area->vm_flags |= VM_IO;
  	size = area->vm_end - area->vm_start;
@@ -433,7 +434,7 @@
  	return 0;
  }
  
-@@ -3265,7 +3489,7 @@
+@@ -3267,7 +3492,7 @@
  	    runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED)
  		return -EINVAL;
  	size = area->vm_end - area->vm_start;
@@ -442,7 +443,7 @@
  	dma_bytes = PAGE_ALIGN(runtime->dma_bytes);
  	if ((size_t)size > dma_bytes)
  		return -EINVAL;
-@@ -3296,7 +3520,7 @@
+@@ -3298,7 +3523,7 @@
  	if (PCM_RUNTIME_CHECK(substream))
  		return -ENXIO;
  
@@ -451,7 +452,7 @@
  	switch (offset) {
  	case SNDRV_PCM_MMAP_OFFSET_STATUS:
  		if (pcm_file->no_compat_mmap)
-@@ -3329,12 +3553,34 @@
+@@ -3331,12 +3556,34 @@
  /*
   * ioctl32 compat
   */
@@ -487,7 +488,7 @@
  /*
   *  To be removed helpers to keep binary compatibility
   */
-@@ -3475,29 +3721,49 @@
+@@ -3477,29 +3724,49 @@
  	{
  		.owner =		THIS_MODULE,
  		.write =		snd_pcm_write,
diff --git a/alsa/configure.in b/alsa/configure.in
index d383a2d..4fe3dc4 100644
--- a/alsa/configure.in
+++ b/alsa/configure.in
@@ -203,7 +203,7 @@
 
 dnl Check for kernel version...
 AC_MSG_CHECKING(for kernel version)
-KERNEL_INC="-I$CONFIG_SND_KERNELDIR/include"
+KERNEL_INC="-I$CONFIG_SND_KERNELDIR/include -I$CONFIG_SND_KERNELDIR/include/uapi"
 MAKE_ADDS=""
 if test -n "$kernelbuild"; then
   kpath=""
diff --git a/alsa/firewire/scs1x.c b/alsa/firewire/scs1x.c
new file mode 100644
index 0000000..45d674e
--- /dev/null
+++ b/alsa/firewire/scs1x.c
@@ -0,0 +1,2 @@
+#include "adriver.h"
+#include "../alsa-kernel/firewire/scs1x.c"
diff --git a/alsa/include/adriver.h b/alsa/include/adriver.h
index 131d72c..2ef8f41 100644
--- a/alsa/include/adriver.h
+++ b/alsa/include/adriver.h
@@ -1545,6 +1545,9 @@
 	return ret;
 }
 
+#define flush_work		flush_work_sync
+#define flush_delayed_work	flush_delayed_work_sync
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 23)
 /* XXX this is a workaround; these are really different, but almost same
  * as used in the usual free/error path
diff --git a/alsa/include/sound/core.patch b/alsa/include/sound/core.patch
index 33062e3..fb55d4a 100644
--- a/alsa/include/sound/core.patch
+++ b/alsa/include/sound/core.patch
@@ -1,6 +1,6 @@
---- ../../alsa-kernel/include/core.h	2012-02-01 09:58:47.000000000 +0100
-+++ core.h	2012-02-01 10:51:29.000000000 +0100
-@@ -105,8 +105,16 @@
+--- ../../alsa-kernel/include/core.h	2012-10-30 11:00:52.000000000 +0100
++++ core.h	2012-11-23 17:56:50.000000000 +0100
+@@ -104,8 +104,16 @@
  	char shortname[32];		/* short name of this soundcard */
  	char longname[80];		/* name of this soundcard */
  	char mixername[80];		/* mixer name */
@@ -17,7 +17,7 @@
  	struct module *module;		/* top-level module */
  
  	void *private_data;		/* private data for soundcard */
-@@ -126,7 +134,15 @@
+@@ -125,7 +133,15 @@
  	struct snd_info_entry *proc_id;	/* the card id */
  	struct proc_dir_entry *proc_root_link;	/* number link to real id */
  
@@ -34,8 +34,8 @@
  								state */
  	spinlock_t files_lock;		/* lock the files for this card */
 @@ -134,7 +150,9 @@
- 	int free_on_last_close;		/* free in context of file_release */
  	wait_queue_head_t shutdown_sleep;
+ 	atomic_t refcount;		/* refcount for disconnection */
  	struct device *dev;		/* device assigned to this card */
 +#ifndef CONFIG_SYSFS_DEPRECATED
  	struct device *card_dev;	/* cardX object for sysfs */
@@ -61,7 +61,7 @@
  };
  
  #ifdef CONFIG_PM
-@@ -195,7 +224,11 @@
+@@ -196,7 +225,11 @@
  /* return a device pointer linked to each sound device as a parent */
  static inline struct device *snd_card_get_device_link(struct snd_card *card)
  {
@@ -73,9 +73,9 @@
  }
  
  /* sound.c */
-@@ -297,7 +330,11 @@
- int snd_card_file_add(struct snd_card *card, struct file *file);
+@@ -299,7 +332,11 @@
  int snd_card_file_remove(struct snd_card *card, struct file *file);
+ void snd_card_unref(struct snd_card *card);
  
 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
 +#define snd_card_set_dev(card,dev) /* no struct device */
@@ -85,7 +85,7 @@
  
  /* device.c */
  
-@@ -412,13 +449,21 @@
+@@ -424,13 +461,21 @@
  
  /* for easier backward-porting */
  #if defined(CONFIG_GAMEPORT) || defined(CONFIG_GAMEPORT_MODULE)
diff --git a/alsa/include/sound/pcm.patch b/alsa/include/sound/pcm.patch
index 5c57f57..a4bed0e 100644
--- a/alsa/include/sound/pcm.patch
+++ b/alsa/include/sound/pcm.patch
@@ -1,6 +1,6 @@
---- ../../alsa-kernel/include/pcm.h	2011-11-08 07:59:19.946461474 +0100
-+++ pcm.h	2011-11-08 08:30:47.618696246 +0100
-@@ -278,10 +278,15 @@
+--- ../../alsa-kernel/include/pcm.h	2012-10-23 16:14:36.000000000 +0200
++++ pcm.h	2012-10-25 00:44:04.000000000 +0200
+@@ -280,10 +280,18 @@
  	snd_pcm_uframes_t avail_max;
  	snd_pcm_uframes_t hw_ptr_base;	/* Position at buffer restart */
  	snd_pcm_uframes_t hw_ptr_interrupt; /* Position at interrupt time */
@@ -12,12 +12,14 @@
 +#endif
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31)
  	snd_pcm_sframes_t delay;	/* extra delay; typically FIFO size */
--
 +#endif
++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 7, 0)
+ 	u64 hw_ptr_wrap;                /* offset for hw_ptr due to boundary wrap-around */
++#endif
+ 
  	/* -- HW params -- */
  	snd_pcm_access_t access;	/* access mode */
- 	snd_pcm_format_t format;	/* SNDRV_PCM_FORMAT_* */
-@@ -291,6 +296,9 @@
+@@ -294,6 +302,9 @@
  	snd_pcm_uframes_t period_size;	/* period size */
  	unsigned int periods;		/* periods */
  	snd_pcm_uframes_t buffer_size;	/* buffer size */
@@ -27,7 +29,7 @@
  	snd_pcm_uframes_t min_align;	/* Min alignment for the format */
  	size_t byte_align;
  	unsigned int frame_bits;
-@@ -298,11 +306,17 @@
+@@ -301,11 +312,17 @@
  	unsigned int info;
  	unsigned int rate_num;
  	unsigned int rate_den;
@@ -45,7 +47,7 @@
  	snd_pcm_uframes_t start_threshold;
  	snd_pcm_uframes_t stop_threshold;
  	snd_pcm_uframes_t silence_threshold; /* Silence filling happens when
-@@ -320,9 +334,22 @@
+@@ -323,9 +340,22 @@
  	struct snd_pcm_mmap_control *control;
  
  	/* -- locking / scheduling -- */
@@ -68,7 +70,7 @@
  	struct fasync_struct *fasync;
  
  	/* -- private section -- */
-@@ -339,8 +366,9 @@
+@@ -342,8 +372,9 @@
  
  	/* -- timer -- */
  	unsigned int timer_resolution;	/* timer resolution */
@@ -79,7 +81,7 @@
  	/* -- DMA -- */           
  	unsigned char *dma_area;	/* DMA area */
  	dma_addr_t dma_addr;		/* physical bus address (not accessible from main CPU) */
-@@ -353,9 +381,34 @@
+@@ -356,9 +387,37 @@
  	struct snd_pcm_oss_runtime oss;
  #endif
  
@@ -107,6 +109,9 @@
 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 37)
 +	unsigned long hw_ptr_buffer_jiffies; /* buffer time in jiffies */
 +#endif
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 7, 0)
++	u64 hw_ptr_wrap;                /* offset for hw_ptr due to boundary wrap-around */
++#endif
 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 38)
 +	unsigned int no_period_wakeup: 1;
 +#endif
@@ -114,7 +119,7 @@
  };
  
  struct snd_pcm_group {		/* keep linked substreams */
-@@ -373,7 +426,15 @@
+@@ -376,7 +435,15 @@
  	int number;
  	char name[32];			/* substream name */
  	int stream;			/* stream (direction) */
@@ -130,7 +135,7 @@
  	size_t buffer_bytes_max;	/* limit ring buffer size */
  	struct snd_dma_buffer dma_buffer;
  	unsigned int dma_buf_id;
-@@ -385,6 +446,9 @@
+@@ -388,6 +455,9 @@
          /* -- timer section -- */
  	struct snd_timer *timer;		/* timer */
  	unsigned timer_running: 1;	/* time is running */
@@ -140,7 +145,7 @@
  	/* -- next substream -- */
  	struct snd_pcm_substream *next;
  	/* -- linked substreams -- */
-@@ -397,7 +461,9 @@
+@@ -400,7 +470,9 @@
  	atomic_t mmap_count;
  	unsigned int f_flags;
  	void (*pcm_release)(struct snd_pcm_substream *);
@@ -150,7 +155,7 @@
  #if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
  	/* -- OSS things -- */
  	struct snd_pcm_oss_substream oss;
-@@ -413,6 +479,13 @@
+@@ -416,6 +488,13 @@
  #endif
  	/* misc flags */
  	unsigned int hw_opened: 1;
@@ -164,7 +169,7 @@
  };
  
  #define SUBSTREAM_BUSY(substream) ((substream)->ref_count > 0)
-@@ -491,7 +564,11 @@
+@@ -499,7 +578,11 @@
  int snd_pcm_status(struct snd_pcm_substream *substream,
  		   struct snd_pcm_status *status);
  int snd_pcm_start(struct snd_pcm_substream *substream);
diff --git a/alsa/kconfig-vers b/alsa/kconfig-vers
index 0c376b4..d075f26 100644
--- a/alsa/kconfig-vers
+++ b/alsa/kconfig-vers
@@ -19,4 +19,6 @@
 SND_USB_6FIRE	2.6.28
 SND_FIREWIRE_SPEAKERS	2.6.39
 SND_ISIGHT	2.6.39
+SND_SCS1X	2.6.39
 SND_COMPRESS_OFFLOAD	3.0
+SND_USB_USX2Y	2.6.24
diff --git a/alsa/pci/emu10k1/emu10k1_main.patch b/alsa/pci/emu10k1/emu10k1_main.patch
index 61c574c..5a3ab96 100644
--- a/alsa/pci/emu10k1/emu10k1_main.patch
+++ b/alsa/pci/emu10k1/emu10k1_main.patch
@@ -1,52 +1,12 @@
---- ../../alsa-kernel/pci/emu10k1/emu10k1_main.c	2008-10-23 19:44:35.000000000 +0200
-+++ emu10k1_main.c	2008-10-23 19:46:15.000000000 +0200
+--- ../../alsa-kernel/pci/emu10k1/emu10k1_main.c	2012-11-22 21:23:16.000000000 +0100
++++ emu10k1_main.c	2012-11-23 17:49:52.000000000 +0100
 @@ -1,3 +1,5 @@
 +#define __NO_VERSION__
 +#include "adriver.h"
  /*
   *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
   *                   Creative Labs, Inc.
-@@ -65,6 +67,11 @@
- MODULE_FIRMWARE(EMU1010_NOTEBOOK_FILENAME);
- 
- 
-+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 0)
-+#define wake_up_process(kt) /* */
-+#endif
-+
-+
- /*************************************************************************
-  * EMU10K1 init / done
-  *************************************************************************/
-@@ -666,7 +673,11 @@
- 	unsigned long flags;
- 	const struct firmware *fw_entry;
- 
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 5, 0)
- 	err = request_firmware(&fw_entry, filename, &emu->pci->dev);
-+#else
-+	err = request_firmware(&fw_entry, filename, pci_name(emu->pci));
-+#endif
- 	if (err != 0) {
- 		snd_printk(KERN_ERR "firmware: %s not found. Err = %d\n", filename, err);
- 		return err;
-@@ -1399,6 +1410,7 @@
- 	 .i2c_adc = 1,
- 	 .spk71 = 1} ,
- 	/* Tested by James@superbug.co.uk 4th Nov 2007. */
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
- 	{.vendor = 0x1102, .device = 0x0008, .subsystem = 0x42011102,
- 	 .driver = "Audigy2", .name = "E-mu 1010 Notebook [MAEM8950]",
- 	 .id = "EMU1010",
-@@ -1441,6 +1453,7 @@
-	 .ca0108_chip = 1,
-	 .spk71 = 1,
-	 .emu_model = EMU_MODEL_EMU0404}, /* EMU 0404 PCIe ver_03 */
-+#endif
- 	/* Note that all E-mu cards require kernel 2.6 or newer. */
- 	{.vendor = 0x1102, .device = 0x0008,
- 	 .driver = "Audigy2", .name = "SB Audigy 2 Value [Unknown]",
-@@ -1751,7 +1764,7 @@
+@@ -1772,7 +1774,7 @@
  	emu->synth = NULL;
  	emu->get_synth_voice = NULL;
  	/* read revision & serial */
diff --git a/alsa/pci/hda/hda_intel.patch b/alsa/pci/hda/hda_intel.patch
index bc7c6ea..e974de6 100644
--- a/alsa/pci/hda/hda_intel.patch
+++ b/alsa/pci/hda/hda_intel.patch
@@ -1,11 +1,32 @@
---- ../../alsa-kernel/pci/hda/hda_intel.c	2012-07-19 08:17:20.000000000 +0200
-+++ hda_intel.c	2012-07-19 08:40:39.000000000 +0200
+--- ../../alsa-kernel/pci/hda/hda_intel.c	2012-12-07 07:55:19.000000000 +0100
++++ hda_intel.c	2012-12-07 08:50:44.000000000 +0100
 @@ -1,3 +1,4 @@
 +#include "hda_intel_hack.c"
  /*
   *
   *  hda_intel.c - Implementation of primary alsa driver code base
-@@ -624,10 +625,21 @@
+@@ -47,7 +48,9 @@
+ #include <linux/reboot.h>
+ #include <linux/io.h>
+ #include <linux/pm_runtime.h>
++#ifdef HAVE_TIMECOUNTER
+ #include <linux/clocksource.h>
++#endif
+ #include <linux/time.h>
+ #include <linux/completion.h>
+ 
+@@ -424,8 +427,10 @@
+ 	unsigned int wc_marked:1;
+ 	unsigned int no_period_wakeup:1;
+ 
++#ifdef HAVE_TIMECOUNTER
+ 	struct timecounter  azx_tc;
+ 	struct cyclecounter azx_cc;
++#endif
+ };
+ 
+ /* CORB/RIRB */
+@@ -659,10 +664,21 @@
  		return;
  	if (addr && size) {
  		int pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT;
@@ -27,7 +48,41 @@
  	}
  }
  
-@@ -2225,7 +2237,11 @@
+@@ -1759,6 +1775,7 @@
+ 	azx_dev->opened = 0;
+ }
+ 
++#ifdef HAVE_TIMECOUNTER
+ static cycle_t azx_cc_read(const struct cyclecounter *cc)
+ {
+ 	struct azx_dev *azx_dev = container_of(cc, struct azx_dev, azx_cc);
+@@ -1816,6 +1833,9 @@
+ 
+ 	return 0;
+ }
++#else
++#define azx_get_wallclock_tstamp NULL
++#endif
+ 
+ static struct snd_pcm_hardware azx_pcm_hw = {
+ 	.info =			(SNDRV_PCM_INFO_MMAP |
+@@ -2156,6 +2176,7 @@
+ 			azx_readl(chip, OLD_SSYNC) & ~sbits);
+ 	else
+ 		azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits);
++#ifdef HAVE_TIMECOUNTER
+ 	if (start) {
+ 		azx_timecounter_init(substream, 0, 0);
+ 		if (nsync > 1) {
+@@ -2172,6 +2193,7 @@
+ 			}
+ 		}
+ 	}
++#endif
+ 	spin_unlock(&chip->reg_lock);
+ 	return 0;
+ }
+@@ -2394,7 +2416,11 @@
  	struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
  	struct azx *chip = apcm->chip;
  	if (!azx_snoop(chip))
@@ -39,15 +94,15 @@
  	return snd_pcm_lib_default_mmap(substream, area);
  }
  #else
-@@ -2679,6 +2695,7 @@
- static bool __devinit check_hdmi_disabled(struct pci_dev *pci)
+@@ -2935,6 +2961,7 @@
+ static bool check_hdmi_disabled(struct pci_dev *pci)
  {
  	bool vga_inactive = false;
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 5, 0)
  	struct pci_dev *p = get_bound_vga(pci);
  
  	if (p) {
-@@ -2686,6 +2703,7 @@
+@@ -2942,6 +2969,7 @@
  			vga_inactive = true;
  		pci_dev_put(p);
  	}
@@ -55,7 +110,7 @@
  	return vga_inactive;
  }
  #endif /* SUPPORT_VGA_SWITCHEROO */
-@@ -2797,6 +2815,10 @@
+@@ -3050,6 +3078,10 @@
  	}
  }
  
@@ -66,7 +121,7 @@
  /*
   * white/black-list for enable_msi
   */
-@@ -2809,6 +2831,14 @@
+@@ -3062,6 +3094,14 @@
  	{}
  };
  
@@ -78,10 +133,10 @@
 +};
 +#endif
 +
- static void __devinit check_msi(struct azx *chip)
+ static void check_msi(struct azx *chip)
  {
  	const struct snd_pci_quirk *q;
-@@ -2817,7 +2847,11 @@
+@@ -3070,7 +3110,11 @@
  		chip->msi = !!enable_msi;
  		return;
  	}
@@ -93,7 +148,7 @@
  	q = snd_pci_quirk_lookup(chip->pci, msi_black_list);
  	if (q) {
  		printk(KERN_INFO
-@@ -2826,6 +2860,16 @@
+@@ -3079,6 +3123,16 @@
  		chip->msi = q->value;
  		return;
  	}
@@ -110,7 +165,7 @@
  
  	/* NVidia chipsets seem to cause troubles with MSI */
  	if (chip->driver_caps & AZX_DCAPS_NO_MSI) {
-@@ -2847,7 +2891,7 @@
+@@ -3100,7 +3154,7 @@
  		if (snoop) {
  			u8 val;
  			pci_read_config_byte(chip->pci, 0x42, &val);
@@ -119,7 +174,7 @@
  				snoop = false;
  		}
  		break;
-@@ -3018,7 +3062,7 @@
+@@ -3246,7 +3300,7 @@
  					 PCI_DEVICE_ID_ATI_SBX00_SMBUS,
  					 NULL);
  		if (p_smbus) {
diff --git a/alsa/pci/hda/hda_intel_hack.c b/alsa/pci/hda/hda_intel_hack.c
index 76903d3..e8ec214 100644
--- a/alsa/pci/hda/hda_intel_hack.c
+++ b/alsa/pci/hda/hda_intel_hack.c
@@ -19,3 +19,6 @@
 #endif
 #endif
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30)
+#define HAVE_TIMECOUNTER
+#endif
diff --git a/alsa/usb/caiaq/device.patch b/alsa/usb/caiaq/device.patch
index 2a5cae7..fcfd255 100644
--- a/alsa/usb/caiaq/device.patch
+++ b/alsa/usb/caiaq/device.patch
@@ -1,5 +1,5 @@
---- ../../alsa-kernel/usb/caiaq/device.c	2011-10-19 17:32:45.314228109 +0200
-+++ device.c	2011-11-08 08:38:43.436915004 +0100
+--- ../../alsa-kernel/usb/caiaq/device.c	2012-12-07 07:55:19.000000000 +0100
++++ device.c	2012-12-07 08:52:39.000000000 +0100
 @@ -1,3 +1,5 @@
 +#include "adriver.h"
 +#include "../usbcompat.h"
@@ -32,6 +32,6 @@
 +#define snd_usb_caiaq_midi_output_done snd_usb_caiaq_midi_output_done_wrapper
 +#endif
 +
- static int __devinit init_card(struct snd_usb_caiaqdev *dev)
+ static int init_card(struct snd_usb_caiaqdev *dev)
  {
  	char *c, usbpath[32];
diff --git a/alsa/usb/card.patch b/alsa/usb/card.patch
index 91f3217..465b22e 100644
--- a/alsa/usb/card.patch
+++ b/alsa/usb/card.patch
@@ -1,25 +1,11 @@
---- ../alsa-kernel/usb/card.c	2012-04-13 10:26:19.000000000 +0200
-+++ card.c	2012-04-13 10:34:43.000000000 +0200
+--- ../alsa-kernel/usb/card.c	2012-11-22 17:40:53.000000000 +0100
++++ card.c	2012-11-23 17:53:19.000000000 +0100
 @@ -1,3 +1,4 @@
 +#include "card.inc"
  /*
   *   (Tentative) USB Audio Driver for ALSA
   *
-@@ -83,7 +84,12 @@
- static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
- static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
- static int nrpacks = 8;		/* max. number of packets per urb */
--static bool async_unlink = 1;
-+static bool async_unlink =
-+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
-+true;
-+#else
-+false; /* disabled as default for buggy async-unlink handling */
-+#endif
- static int device_setup[SNDRV_CARDS]; /* device parameter for this card */
- static bool ignore_ctl_error;
- 
-@@ -247,19 +253,25 @@
+@@ -241,19 +242,25 @@
  
  	case UAC_VERSION_2: {
  		struct usb_interface_assoc_descriptor *assoc =
@@ -45,8 +31,8 @@
  
  		break;
  	}
-@@ -348,8 +360,13 @@
- 	chip->async_unlink = async_unlink;
+@@ -341,8 +348,13 @@
+ 	chip->nrpacks = nrpacks;
  	chip->probing = 1;
  
 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
@@ -59,7 +45,7 @@
  	INIT_LIST_HEAD(&chip->pcm_list);
  	INIT_LIST_HEAD(&chip->ep_list);
  	INIT_LIST_HEAD(&chip->midi_list);
-@@ -452,8 +469,12 @@
+@@ -445,8 +457,12 @@
  
  	alts = &intf->altsetting[0];
  	ifnum = get_iface_desc(alts)->bInterfaceNumber;
@@ -72,7 +58,7 @@
  	if (quirk && quirk->ifnum >= 0 && ifnum != quirk->ifnum)
  		goto __err_val;
  
-@@ -591,6 +612,7 @@
+@@ -584,6 +600,7 @@
  	}
  }
  
@@ -80,7 +66,7 @@
  /*
   * new 2.5 USB kernel API
   */
-@@ -694,6 +716,7 @@
+@@ -693,6 +710,7 @@
  #define usb_audio_suspend	NULL
  #define usb_audio_resume	NULL
  #endif		/* CONFIG_PM */
@@ -88,7 +74,7 @@
  
  static struct usb_device_id usb_audio_ids [] = {
  #include "quirks-table.h"
-@@ -710,13 +733,23 @@
+@@ -709,13 +727,23 @@
   */
  
  static struct usb_driver usb_audio_driver = {
@@ -112,7 +98,7 @@
  };
  
  static int __init snd_usb_audio_init(void)
-@@ -735,3 +768,5 @@
+@@ -734,3 +762,5 @@
  
  module_init(snd_usb_audio_init);
  module_exit(snd_usb_audio_cleanup);
diff --git a/alsa/usb/endpoint.patch b/alsa/usb/endpoint.patch
index 3ffc405..3c02313 100644
--- a/alsa/usb/endpoint.patch
+++ b/alsa/usb/endpoint.patch
@@ -1,12 +1,12 @@
---- ../alsa-kernel/usb/endpoint.c	2012-04-13 10:28:20.000000000 +0200
-+++ endpoint.c	2012-04-13 10:34:23.000000000 +0200
+--- ../alsa-kernel/usb/endpoint.c	2012-11-22 17:40:53.000000000 +0100
++++ endpoint.c	2012-11-23 17:56:12.000000000 +0100
 @@ -1,3 +1,5 @@
 +#define __NO_VERSION__
 +#include "usbaudio.inc"
  /*
   *   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
-@@ -338,7 +340,11 @@
+@@ -344,7 +346,11 @@
  /*
   * complete callback for urbs
   */
@@ -18,16 +18,13 @@
  {
  	struct snd_urb_ctx *ctx = urb->context;
  	struct snd_usb_endpoint *ep = ctx->ep;
-@@ -539,7 +545,12 @@
+@@ -532,6 +538,9 @@
+ 		if (test_bit(i, &ep->active_mask)) {
  			if (!test_and_set_bit(i, &ep->unlink_mask)) {
  				struct urb *u = ep->urb[i].urb;
- 				if (async)
-+				{
 +#ifdef URB_ASYNC_UNLINK
-+					u->transfer_flags |= URB_ASYNC_UNLINK;
++				u->transfer_flags |= URB_ASYNC_UNLINK;
 +#endif
- 					usb_unlink_urb(u);
-+				}
- 				else
- 					usb_kill_urb(u);
+ 				usb_unlink_urb(u);
  			}
+ 		}
diff --git a/alsa/usb/stream.patch b/alsa/usb/stream.patch
index 3482adb..d2566d8 100644
--- a/alsa/usb/stream.patch
+++ b/alsa/usb/stream.patch
@@ -1,12 +1,12 @@
---- ../alsa-kernel/usb/stream.c	2011-09-14 13:42:49.765017473 +0200
-+++ stream.c	2011-09-14 13:57:20.282765713 +0200
+--- ../alsa-kernel/usb/stream.c	2012-11-26 18:36:55.000000000 +0100
++++ stream.c	2012-11-26 18:38:12.000000000 +0100
 @@ -1,3 +1,5 @@
 +#define __NO_VERSION__
 +#include "usbaudio.inc"
  /*
   *   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
-@@ -261,7 +263,11 @@
+@@ -493,7 +495,11 @@
  		    (altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING &&
  		     altsd->bInterfaceSubClass != USB_SUBCLASS_VENDOR_SPEC) ||
  		    altsd->bNumEndpoints < 1 ||
@@ -18,7 +18,7 @@
  			continue;
  		/* must be isochronous */
  		if ((get_endpoint(alts, 0)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) !=
-@@ -371,7 +377,11 @@
+@@ -614,7 +620,11 @@
  		    fp && fp->altsetting == 1 && fp->channels == 1 &&
  		    fp->formats == SNDRV_PCM_FMTBIT_S16_LE &&
  		    protocol == UAC_VERSION_1 &&
@@ -30,7 +30,7 @@
  							fp->maxpacksize * 2)
  			continue;
  
-@@ -387,7 +397,11 @@
+@@ -630,7 +640,11 @@
  		fp->endpoint = get_endpoint(alts, 0)->bEndpointAddress;
  		fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
  		fp->datainterval = snd_usb_parse_datainterval(chip, alts);
@@ -39,6 +39,6 @@
 +#else
 +		fp->maxpacksize = get_endpoint(alts, 0)->wMaxPacketSize;
 +#endif
- 		/* num_channels is only set for v2 interfaces */
  		fp->channels = num_channels;
  		if (snd_usb_get_speed(dev) == USB_SPEED_HIGH)
+ 			fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1)