~ubuntu-branches/ubuntu/maverick/linux-backports-modules-2.6.32/maverick

« back to all changes in this revision

Viewing changes to updates/alsa-driver/usb/usx2y/usx2yhwdeppcm.patch

  • Committer: Bazaar Package Importer
  • Author(s): Andy Whitcroft, Andy Whitcroft
  • Date: 2010-02-04 23:15:51 UTC
  • Revision ID: james.westby@ubuntu.com-20100204231551-vjz5pkvxclukjxm1
Tags: 2.6.32-12.1
[ Andy Whitcroft ]

* initial LBM for lucid
* drop generated files
* printchanges -- rebase tree does not have stable tags use changelog
* printenv -- add revisions to printenv output
* formally rename compat-wireless to linux-backports-modules-wireless
* Update to compat-wireless-2.6.33-rc5
* update nouveau to mainline 2.6.33-rc4
* add new LBM package for nouveau
* nouveau -- fix major numbers and proc entry names
* fix up firmware installs for -wireless
* clean up UPDATE-NOVEAU
* update Nouveau to v2.6.33-rc6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
--- ../../alsa-kernel/usb/usx2y/usx2yhwdeppcm.c 2009-09-28 12:02:26.000000000 +0200
 
2
+++ usx2yhwdeppcm.c     2009-09-28 14:51:08.000000000 +0200
 
3
@@ -1,3 +1,29 @@
 
4
+#include "config.h"
 
5
+#ifdef CONFIG_HAVE_DEPRECATED_CONFIG_H
 
6
+#include <linux/autoconf.h>
 
7
+#else
 
8
+#include <linux/config.h>
 
9
+#endif
 
10
+#include <linux/version.h>
 
11
+
 
12
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,5)
 
13
+#define SND_NEED_USB_SET_INTERFACE
 
14
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
 
15
+#define SND_NEED_USB_WRAPPER
 
16
+#endif
 
17
+#define __NO_VERSION__
 
18
+#endif
 
19
+
 
20
+#define USB_2_6_18 (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 18))
 
21
+#if USB_2_6_18
 
22
+#define USX2Y_URB_FRAME_MASK -1
 
23
+#else
 
24
+#define USX2Y_URB_FRAME_MASK 0xffff
 
25
+#endif
 
26
+
 
27
+#include "adriver.h"
 
28
+#include "../usbcompat.h"
 
29
+
 
30
 /*
 
31
  *   This program is free software; you can redistribute it and/or modify
 
32
  *   it under the terms of the GNU General Public License as published by
 
33
@@ -150,7 +176,11 @@
 
34
 {
 
35
        int pack;
 
36
        for (pack = 0; pack < nr_of_packs(); ++pack) {
 
37
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 20)
 
38
                struct usb_iso_packet_descriptor *desc = urb->iso_frame_desc + pack;
 
39
+#else
 
40
+               iso_packet_descriptor_t *desc = urb->iso_frame_desc + pack;
 
41
+#endif
 
42
                if (NULL != subs) {
 
43
                        struct snd_usX2Y_hwdep_pcm_shm *shm = subs->usX2Y->hwdep_pcm_shm;
 
44
                        int head = shm->captured_iso_head + 1;
 
45
@@ -226,7 +256,11 @@
 
46
 }
 
47
 
 
48
 
 
49
+#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER)
 
50
+static void i_usX2Y_usbpcm_urb_complete(struct urb *urb, struct pt_regs *regs)
 
51
+#else
 
52
 static void i_usX2Y_usbpcm_urb_complete(struct urb *urb)
 
53
+#endif
 
54
 {
 
55
        struct snd_usX2Y_substream *subs = urb->context;
 
56
        struct usX2Ydev *usX2Y = subs->usX2Y;
 
57
@@ -256,9 +290,15 @@
 
58
        if (capsubs->completed_urb && atomic_read(&capsubs->state) >= state_PREPARED &&
 
59
            (NULL == capsubs2 || capsubs2->completed_urb) &&
 
60
            (playbacksubs->completed_urb || atomic_read(&playbacksubs->state) < state_PREPARED)) {
 
61
-               if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame))
 
62
-                       usX2Y->wait_iso_frame += nr_of_packs();
 
63
-               else {
 
64
+               if (!usX2Y_usbpcm_usbframe_complete(capsubs, capsubs2, playbacksubs, urb->start_frame)) {
 
65
+#if !USB_2_6_18
 
66
+                       if (nr_of_packs() <= urb->start_frame &&
 
67
+                           urb->start_frame <= (2 * nr_of_packs() - 1))        // uhci and ohci
 
68
+                               usX2Y->wait_iso_frame = urb->start_frame - nr_of_packs();
 
69
+                       else
 
70
+#endif
 
71
+                               usX2Y->wait_iso_frame +=  nr_of_packs();
 
72
+               } else {
 
73
                        snd_printdd("\n");
 
74
                        usX2Y_clients_stop(usX2Y);
 
75
                }
 
76
@@ -290,7 +330,11 @@
 
77
        usX2Y->prepare_subs = NULL;
 
78
 }
 
79
 
 
80
+#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER)
 
81
+static void i_usX2Y_usbpcm_subs_startup(struct urb *urb, struct pt_regs *regs)
 
82
+#else
 
83
 static void i_usX2Y_usbpcm_subs_startup(struct urb *urb)
 
84
+#endif
 
85
 {
 
86
        struct snd_usX2Y_substream *subs = urb->context;
 
87
        struct usX2Ydev *usX2Y = subs->usX2Y;
 
88
@@ -307,7 +351,11 @@
 
89
                wake_up(&usX2Y->prepare_wait_queue);
 
90
        }
 
91
 
 
92
+#if !defined(OLD_USB) && !defined(CONFIG_SND_NEW_IRQ_HANDLER)
 
93
+       i_usX2Y_usbpcm_urb_complete(urb, regs);
 
94
+#else
 
95
        i_usX2Y_usbpcm_urb_complete(urb);
 
96
+#endif
 
97
 }
 
98
 
 
99
 /*
 
100
@@ -429,6 +477,9 @@
 
101
                if (subs != NULL && atomic_read(&subs->state) >= state_PREPARED)
 
102
                        goto start;
 
103
        }
 
104
+#if !USB_2_6_18
 
105
+       usX2Y->wait_iso_frame = -1;
 
106
+#endif
 
107
 
 
108
  start:
 
109
        usX2Y_usbpcm_subs_startup(subs);
 
110
@@ -454,7 +505,11 @@
 
111
                                                goto cleanup;
 
112
                                        }  else {
 
113
                                                snd_printdd("%i\n", urb->start_frame);
 
114
+#if USB_2_6_18
 
115
                                                if (u == 0)
 
116
+#else
 
117
+                                               if (0 > usX2Y->wait_iso_frame)
 
118
+#endif
 
119
                                                        usX2Y->wait_iso_frame = urb->start_frame;
 
120
                                        }
 
121
                                        urb->transfer_flags = 0;
 
122
@@ -683,6 +738,7 @@
 
123
 }
 
124
 
 
125
 
 
126
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
 
127
 static int snd_usX2Y_hwdep_pcm_vm_fault(struct vm_area_struct *area,
 
128
                                        struct vm_fault *vmf)
 
129
 {
 
130
@@ -695,12 +751,60 @@
 
131
        get_page(vmf->page);
 
132
        return 0;
 
133
 }
 
134
+#else /* 2.6.24 */
 
135
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 
136
+static struct page * snd_usX2Y_hwdep_pcm_vm_nopage(struct vm_area_struct *area,
 
137
+                                       unsigned long address, int *type)
 
138
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 0)
 
139
+static struct page * snd_usX2Y_hwdep_pcm_vm_nopage(struct vm_area_struct *area,
 
140
+                                       unsigned long address, int no_share)
 
141
+#else
 
142
+static unsigned long snd_usX2Y_hwdep_pcm_vm_nopage(struct vm_area_struct *area,
 
143
+                                       unsigned long address, int no_share)
 
144
+#endif
 
145
+{
 
146
+       unsigned long offset;
 
147
+       struct page *page;
 
148
+       void *vaddr;
 
149
 
 
150
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 3, 25)
 
151
+       offset = area->vm_pgoff << PAGE_SHIFT;
 
152
+#else
 
153
+       offset = area->vm_offset;
 
154
+#endif
 
155
+       offset += address - area->vm_start;
 
156
+       if (snd_BUG_ON(offset % PAGE_SIZE))
 
157
+               return NOPAGE_OOM;
 
158
+       vaddr = (char*)((struct usX2Ydev *)
 
159
+                       area->vm_private_data)->hwdep_pcm_shm + offset;
 
160
+       page = virt_to_page(vaddr);
 
161
+#ifndef CONFIG_SND_REMOVE_PAGE_RESERVE
 
162
+       if (!PageReserved(page))
 
163
+#endif
 
164
+       get_page(page);
 
165
+
 
166
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0)
 
167
+       if (type)
 
168
+               *type = VM_FAULT_MINOR;
 
169
+#endif
 
170
+
 
171
+#ifndef LINUX_2_2
 
172
+       return page;
 
173
+#else
 
174
+#undef page_address
 
175
+       return page_address(page);
 
176
+#endif
 
177
+}
 
178
+#endif /* >= 2.6.24 */
 
179
 
 
180
 static const struct vm_operations_struct snd_usX2Y_hwdep_pcm_vm_ops = {
 
181
        .open = snd_usX2Y_hwdep_pcm_vm_open,
 
182
        .close = snd_usX2Y_hwdep_pcm_vm_close,
 
183
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 24)
 
184
        .fault = snd_usX2Y_hwdep_pcm_vm_fault,
 
185
+#else
 
186
+       .nopage = snd_usX2Y_hwdep_pcm_vm_nopage,
 
187
+#endif
 
188
 };
 
189
 
 
190
 
 
191
@@ -722,8 +826,14 @@
 
192
                return -ENODEV;
 
193
        }
 
194
        area->vm_ops = &snd_usX2Y_hwdep_pcm_vm_ops;
 
195
+#ifdef VM_RESERVED
 
196
        area->vm_flags |= VM_RESERVED | VM_DONTEXPAND;
 
197
+#endif
 
198
+#ifndef LINUX_2_2
 
199
        area->vm_private_data = hw->private_data;
 
200
+#else
 
201
+       area->vm_private_data = (long)hw->private_data;
 
202
+#endif
 
203
        return 0;
 
204
 }
 
205