diff options
author | Takashi Iwai <tiwai@suse.de> | 2010-05-21 17:05:56 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2010-05-21 17:15:10 +0200 |
commit | 9192773a097bf90759bfbf030d4d036ae4b06f62 (patch) | |
tree | dc93f98569b44d68048bf67db2cb4406fc450fe2 | |
parent | 672e44aaa2ce308a4a9240c39029900d31d0b0ea (diff) | |
download | alsa-driver-build-unstable-9192773a097bf90759bfbf030d4d036ae4b06f62.tar.gz |
Add check of new usb_alloc_coherent() and pm_qos_request()
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | acore/pcm_native.patch | 88 | ||||
-rw-r--r-- | configure.in | 62 | ||||
-rw-r--r-- | include/adriver.h | 5 | ||||
-rw-r--r-- | include/config.h.in | 2 | ||||
-rw-r--r-- | include/sound/pcm.patch | 30 |
5 files changed, 152 insertions, 35 deletions
diff --git a/acore/pcm_native.patch b/acore/pcm_native.patch index 939daea9b..02f4946b1 100644 --- a/acore/pcm_native.patch +++ b/acore/pcm_native.patch @@ -1,5 +1,5 @@ ---- ../alsa-kernel/core/pcm_native.c 2010-04-13 12:01:49.316965755 +0200 -+++ pcm_native.c 2010-04-13 13:02:27.280928480 +0200 +--- ../alsa-kernel/core/pcm_native.c 2010-05-21 16:36:59.457637275 +0200 ++++ pcm_native.c 2010-05-21 17:01:24.502137046 +0200 @@ -1,3 +1,5 @@ +#define __NO_VERSION__ +#include "adriver.h" @@ -17,8 +17,8 @@ #include <linux/time.h> #include <linux/pm_qos_params.h> #include <linux/uio.h> -@@ -399,7 +401,10 @@ - return 0; +@@ -369,7 +371,10 @@ + return usecs; } -static int snd_pcm_hw_params(struct snd_pcm_substream *substream, @@ -29,7 +29,43 @@ struct snd_pcm_hw_params *params) { struct snd_pcm_runtime *runtime; -@@ -1577,7 +1582,11 @@ +@@ -451,6 +456,7 @@ + snd_pcm_timer_resolution_change(substream); + runtime->status->state = SNDRV_PCM_STATE_SETUP; + ++#ifdef CONFIG_SND_HAVE_PM_QOS_REQUEST + if (substream->latency_pm_qos_req) { + pm_qos_remove_request(substream->latency_pm_qos_req); + substream->latency_pm_qos_req = NULL; +@@ -458,6 +464,13 @@ + if ((usecs = period_to_usecs(runtime)) >= 0) + substream->latency_pm_qos_req = pm_qos_add_request( + PM_QOS_CPU_DMA_LATENCY, usecs); ++#else ++ pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, ++ substream->latency_id); ++ if ((usecs = period_to_usecs(runtime)) >= 0) ++ pm_qos_add_requirement(PM_QOS_CPU_DMA_LATENCY, ++ substream->latency_id, usecs); ++#endif + return 0; + _error: + /* hardware might be unuseable from this time, +@@ -512,8 +525,13 @@ + if (substream->ops->hw_free) + result = substream->ops->hw_free(substream); + runtime->status->state = SNDRV_PCM_STATE_OPEN; ++#ifdef CONFIG_SND_HAVE_PM_QOS_REQUEST + pm_qos_remove_request(substream->latency_pm_qos_req); + substream->latency_pm_qos_req = NULL; ++#else ++ pm_qos_remove_requirement(PM_QOS_CPU_DMA_LATENCY, ++ substream->latency_id); ++#endif + return result; + } + +@@ -1549,7 +1567,11 @@ file = fget(fd); if (!file) return NULL; @@ -41,7 +77,7 @@ if (!S_ISCHR(inode->i_mode) || imajor(inode) != snd_major) { fput(file); -@@ -2834,25 +2843,50 @@ +@@ -2806,25 +2828,50 @@ struct snd_pcm_runtime *runtime; snd_pcm_sframes_t result; @@ -99,7 +135,7 @@ { struct snd_pcm_file *pcm_file; struct snd_pcm_substream *substream; -@@ -2862,7 +2896,11 @@ +@@ -2834,7 +2881,11 @@ void __user **bufs; snd_pcm_uframes_t frames; @@ -111,7 +147,7 @@ substream = pcm_file->substream; if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; -@@ -2886,8 +2924,13 @@ +@@ -2858,8 +2909,13 @@ return result; } @@ -125,7 +161,7 @@ { struct snd_pcm_file *pcm_file; struct snd_pcm_substream *substream; -@@ -2897,7 +2940,11 @@ +@@ -2869,7 +2925,11 @@ void __user **bufs; snd_pcm_uframes_t frames; @@ -137,7 +173,7 @@ substream = pcm_file->substream; if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; -@@ -2919,6 +2966,7 @@ +@@ -2891,6 +2951,7 @@ kfree(bufs); return result; } @@ -145,7 +181,7 @@ static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait) { -@@ -3006,6 +3054,22 @@ +@@ -2978,6 +3039,22 @@ * mmap support */ @@ -168,7 +204,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... -@@ -3014,6 +3078,7 @@ +@@ -2986,6 +3063,7 @@ /* * mmap status record */ @@ -176,7 +212,7 @@ static int snd_pcm_mmap_status_fault(struct vm_area_struct *area, struct vm_fault *vmf) { -@@ -3027,10 +3092,49 @@ +@@ -2999,10 +3077,49 @@ get_page(vmf->page); return 0; } @@ -226,7 +262,7 @@ }; static int snd_pcm_mmap_status(struct snd_pcm_substream *substream, struct file *file, -@@ -3045,7 +3149,11 @@ +@@ -3017,7 +3134,11 @@ if (size != PAGE_ALIGN(sizeof(struct snd_pcm_mmap_status))) return -EINVAL; area->vm_ops = &snd_pcm_vm_ops_status; @@ -238,7 +274,7 @@ area->vm_flags |= VM_RESERVED; return 0; } -@@ -3053,6 +3161,7 @@ +@@ -3025,6 +3146,7 @@ /* * mmap control record */ @@ -246,7 +282,7 @@ static int snd_pcm_mmap_control_fault(struct vm_area_struct *area, struct vm_fault *vmf) { -@@ -3066,10 +3175,50 @@ +@@ -3038,10 +3160,50 @@ get_page(vmf->page); return 0; } @@ -297,7 +333,7 @@ }; static int snd_pcm_mmap_control(struct snd_pcm_substream *substream, struct file *file, -@@ -3084,7 +3233,11 @@ +@@ -3056,7 +3218,11 @@ if (size != PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control))) return -EINVAL; area->vm_ops = &snd_pcm_vm_ops_control; @@ -309,7 +345,7 @@ area->vm_flags |= VM_RESERVED; return 0; } -@@ -3125,9 +3278,16 @@ +@@ -3097,9 +3263,16 @@ return virt_to_page(vaddr); } @@ -326,7 +362,7 @@ static int snd_pcm_mmap_data_fault(struct vm_area_struct *area, struct vm_fault *vmf) { -@@ -3154,6 +3314,59 @@ +@@ -3126,6 +3299,59 @@ vmf->page = page; return 0; } @@ -386,7 +422,7 @@ static const struct vm_operations_struct snd_pcm_vm_ops_data = { .open = snd_pcm_mmap_data_open, -@@ -3163,7 +3376,14 @@ +@@ -3135,7 +3361,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, @@ -401,7 +437,7 @@ }; #ifndef ARCH_HAS_DMA_MMAP_COHERENT -@@ -3207,11 +3427,26 @@ +@@ -3183,11 +3416,26 @@ area->vm_page_prot = pgprot_noncached(area->vm_page_prot); area->vm_flags |= VM_IO; size = area->vm_end - area->vm_start; @@ -429,7 +465,7 @@ return 0; } -@@ -3255,7 +3490,7 @@ +@@ -3231,7 +3479,7 @@ runtime->access == SNDRV_PCM_ACCESS_RW_NONINTERLEAVED) return -EINVAL; size = area->vm_end - area->vm_start; @@ -438,7 +474,7 @@ dma_bytes = PAGE_ALIGN(runtime->dma_bytes); if ((size_t)size > dma_bytes) return -EINVAL; -@@ -3263,7 +3498,11 @@ +@@ -3239,7 +3487,11 @@ return -EINVAL; area->vm_ops = &snd_pcm_vm_ops_data; @@ -450,7 +486,7 @@ if (substream->ops->mmap) err = substream->ops->mmap(substream, area); else -@@ -3286,7 +3525,7 @@ +@@ -3262,7 +3514,7 @@ if (PCM_RUNTIME_CHECK(substream)) return -ENXIO; @@ -459,7 +495,7 @@ switch (offset) { case SNDRV_PCM_MMAP_OFFSET_STATUS: if (pcm_file->no_compat_mmap) -@@ -3319,12 +3558,34 @@ +@@ -3295,12 +3547,34 @@ /* * ioctl32 compat */ @@ -495,7 +531,7 @@ /* * To be removed helpers to keep binary compatibility */ -@@ -3463,31 +3724,55 @@ +@@ -3439,31 +3713,55 @@ const struct file_operations snd_pcm_f_ops[2] = { { diff --git a/configure.in b/configure.in index fb1215c90..752dc8e2b 100644 --- a/configure.in +++ b/configure.in @@ -2889,6 +2889,38 @@ if test -n "$CONFIG_USB"; then fi CHECK_KERNEL_HEADER(linux/usb/ch9.h) + + dnl check for new usb_alloc_coherent() + AC_MSG_CHECKING(usb_alloc_coherent) + usb_alloc_coherent="0" + ac_save_CFLAGS="$CFLAGS" + ac_save_CC="$CC" + CFLAGS="$KERNEL_CHECK_CFLAGS" + CC=$KCC + AC_TRY_COMPILE([ +#define __KERNEL__ +#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H +#include <$INCLUDE_AUTOCONF_H> +#else +#include <linux/config.h> +#endif +#include <linux/usb.h> +],[ + void *(*foo)(struct usb_device *dev, size_t size, + gfp_t mem_flags, dma_addr_t *dma) = usb_alloc_coherent; + foo(NULL, 0, 0, NULL); +], + AC_MSG_RESULT(yes);usb_alloc_coherent="1", + AC_MSG_RESULT(no);usb_alloc_coherent="0", + AC_MSG_RESULT(unknown);usb_alloc_coherent="0" +) + CFLAGS=$ac_save_CFLAGS + CC=$ac_save_CC + CONFIG_SND_HAVE_USB_ALLOC_COHERENT=$usb_alloc_coherent + if test "$CONFIG_SND_HAVE_USB_ALLOC_COHERENT" = "1"; then + AC_DEFINE(CONFIG_SND_HAVE_USB_ALLOC_COHERENT) + fi + fi dnl class_simple for old 2.6 kernels @@ -3322,6 +3354,36 @@ if test "$kversion.$kpatchlevel" = "2.6"; then fi fi +dnl Check for new pm_qos_request() +if test "$kversion.$kpatchlevel" = "2.6"; then + AC_MSG_CHECKING(for new pm_qos_request) + pm_qos_request="0" + ac_save_CFLAGS="$CFLAGS" + ac_save_CC="$CC" + CFLAGS="$KERNEL_CHECK_CFLAGS" + CC=$KCC + AC_TRY_COMPILE([ +#define __KERNEL__ +#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H +#include <$INCLUDE_AUTOCONF_H> +#else +#include <linux/config.h> +#endif +#include <linux/pm_qos_params.h> +],[ + int (*foo)(int)) = pm_qos_request; +], + AC_MSG_RESULT(yes);pm_qos_request="1", + AC_MSG_RESULT(no);pm_qos_request="0", + AC_MSG_RESULT(unknown);pm_qos_request="0" +) + CFLAGS=$ac_save_CFLAGS + CC=$ac_save_CC + CONFIG_SND_HAVE_PM_QOS_REQUEST=$pm_qos_request + if test "$CONFIG_SND_HAVE_PM_QOS_REQUEST" = "1"; then + AC_DEFINE(CONFIG_SND_HAVE_PM_QOS_REQUEST) + fi +fi dnl New unlocked/compat_ioctl if test "$kversion.$kpatchlevel" = "2.6"; then diff --git a/include/adriver.h b/include/adriver.h index 83fe7ee2a..2798408cd 100644 --- a/include/adriver.h +++ b/include/adriver.h @@ -629,6 +629,11 @@ enum { #define URB_NO_TRANSFER_DMA_MAP 0 #endif +#ifndef CONFIG_SND_HAVE_USB_ALLOC_COHERENT +#define usb_alloc_coherent usb_buffer_alloc +#define usb_free_coherent usb_buffer_free +#endif + #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 0) \ && LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 20) struct usb_ctrlrequest { diff --git a/include/config.h.in b/include/config.h.in index 49ce1883c..ae9ca3360 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -89,3 +89,5 @@ #undef CONFIG_HAVE_PAGE_TO_PFN #undef CONFIG_HAVE_VIDEO_DRVDATA #undef CONFIG_HAVE_GENERATED_AUTOCONF_H +#undef CONFIG_SND_HAVE_PM_QOS_REQUEST +#undef CONFIG_SND_HAVE_USB_ALLOC_COHERENT diff --git a/include/sound/pcm.patch b/include/sound/pcm.patch index 8b7622cc3..f35704911 100644 --- a/include/sound/pcm.patch +++ b/include/sound/pcm.patch @@ -1,6 +1,6 @@ ---- ../../alsa-kernel/include/pcm.h 2010-01-26 16:50:53.000000000 +0100 -+++ pcm.h 2010-01-26 17:01:40.000000000 +0100 -@@ -272,9 +272,12 @@ struct snd_pcm_runtime { +--- ../../alsa-kernel/include/pcm.h 2010-05-21 16:36:59.381638299 +0200 ++++ pcm.h 2010-05-21 16:59:33.937768437 +0200 +@@ -273,9 +273,12 @@ 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 */ @@ -14,7 +14,7 @@ /* -- HW params -- */ snd_pcm_access_t access; /* access mode */ snd_pcm_format_t format; /* SNDRV_PCM_FORMAT_* */ -@@ -284,6 +287,9 @@ struct snd_pcm_runtime { +@@ -285,6 +288,9 @@ snd_pcm_uframes_t period_size; /* period size */ unsigned int periods; /* periods */ snd_pcm_uframes_t buffer_size; /* buffer size */ @@ -24,7 +24,7 @@ snd_pcm_uframes_t min_align; /* Min alignment for the format */ size_t byte_align; unsigned int frame_bits; -@@ -295,6 +301,10 @@ struct snd_pcm_runtime { +@@ -296,6 +302,10 @@ /* -- SW params -- */ int tstamp_mode; /* mmap timestamp is updated */ unsigned int period_step; @@ -35,7 +35,7 @@ snd_pcm_uframes_t start_threshold; snd_pcm_uframes_t stop_threshold; snd_pcm_uframes_t silence_threshold; /* Silence filling happens when -@@ -312,11 +322,18 @@ struct snd_pcm_runtime { +@@ -313,11 +323,18 @@ struct snd_pcm_mmap_control *control; /* -- locking / scheduling -- */ @@ -57,7 +57,7 @@ /* -- private section -- */ void *private_data; void (*private_free)(struct snd_pcm_runtime *runtime); -@@ -331,8 +348,9 @@ struct snd_pcm_runtime { +@@ -332,8 +349,9 @@ /* -- timer -- */ unsigned int timer_resolution; /* timer resolution */ @@ -68,7 +68,7 @@ /* -- DMA -- */ unsigned char *dma_area; /* DMA area */ dma_addr_t dma_addr; /* physical bus address (not accessible from main CPU) */ -@@ -348,6 +366,21 @@ struct snd_pcm_runtime { +@@ -349,6 +367,21 @@ #ifdef CONFIG_SND_PCM_XRUN_DEBUG struct snd_pcm_hwptr_log *hwptr_log; #endif @@ -90,7 +90,19 @@ }; struct snd_pcm_group { /* keep linked substreams */ -@@ -377,6 +410,9 @@ struct snd_pcm_substream { +@@ -366,7 +399,11 @@ + int number; + char name[32]; /* substream name */ + int stream; /* stream (direction) */ ++#ifdef CONFIG_SND_HAVE_PM_QOS_REQUEST + struct pm_qos_request_list *latency_pm_qos_req; /* pm_qos request */ ++#else ++ char latency_id[20]; ++#endif + size_t buffer_bytes_max; /* limit ring buffer size */ + struct snd_dma_buffer dma_buffer; + unsigned int dma_buf_id; +@@ -378,6 +415,9 @@ /* -- timer section -- */ struct snd_timer *timer; /* timer */ unsigned timer_running: 1; /* time is running */ |