Thomas Gleixner | 1a59d1b8 | 2019-05-27 08:55:05 +0200 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
Jaroslav Kysela | c1017a4 | 2007-10-15 09:50:19 +0200 | [diff] [blame] | 3 | * Copyright (c) by Jaroslav Kysela <perex@perex.cz> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 4 | * Copyright (c) by Takashi Iwai <tiwai@suse.de> |
| 5 | * |
| 6 | * EMU10K1 memory page allocation (PTB area) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 7 | */ |
| 8 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 9 | #include <linux/pci.h> |
Tejun Heo | 5a0e3ad | 2010-03-24 17:04:11 +0900 | [diff] [blame] | 10 | #include <linux/gfp.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 11 | #include <linux/time.h> |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 12 | #include <linux/mutex.h> |
Paul Gortmaker | d81a6d7 | 2011-09-22 09:34:58 -0400 | [diff] [blame] | 13 | #include <linux/export.h> |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 14 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | #include <sound/core.h> |
| 16 | #include <sound/emu10k1.h> |
| 17 | |
| 18 | /* page arguments of these two macros are Emu page (4096 bytes), not like |
| 19 | * aligned pages in others |
| 20 | */ |
| 21 | #define __set_ptb_entry(emu,page,addr) \ |
Maciej S. Szmigiero | 541b9ba | 2018-02-14 00:06:18 +0100 | [diff] [blame] | 22 | (((__le32 *)(emu)->ptb_pages.area)[page] = \ |
| 23 | cpu_to_le32(((addr) << (emu->address_mode)) | (page))) |
| 24 | #define __get_ptb_entry(emu, page) \ |
| 25 | (le32_to_cpu(((__le32 *)(emu)->ptb_pages.area)[page])) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 26 | |
| 27 | #define UNIT_PAGES (PAGE_SIZE / EMUPAGESIZE) |
Peter Zubaj | 7241ea5 | 2015-04-28 21:57:29 +0200 | [diff] [blame] | 28 | #define MAX_ALIGN_PAGES0 (MAXPAGES0 / UNIT_PAGES) |
| 29 | #define MAX_ALIGN_PAGES1 (MAXPAGES1 / UNIT_PAGES) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 30 | /* get aligned page from offset address */ |
| 31 | #define get_aligned_page(offset) ((offset) >> PAGE_SHIFT) |
| 32 | /* get offset address from aligned page */ |
| 33 | #define aligned_page_offset(page) ((page) << PAGE_SHIFT) |
| 34 | |
Maciej S. Szmigiero | 541b9ba | 2018-02-14 00:06:18 +0100 | [diff] [blame] | 35 | #if PAGE_SIZE == EMUPAGESIZE && !IS_ENABLED(CONFIG_DYNAMIC_DEBUG) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | /* fill PTB entrie(s) corresponding to page with addr */ |
| 37 | #define set_ptb_entry(emu,page,addr) __set_ptb_entry(emu,page,addr) |
| 38 | /* fill PTB entrie(s) corresponding to page with silence pointer */ |
| 39 | #define set_silent_ptb(emu,page) __set_ptb_entry(emu,page,emu->silent_page.addr) |
| 40 | #else |
| 41 | /* fill PTB entries -- we need to fill UNIT_PAGES entries */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 42 | static inline void set_ptb_entry(struct snd_emu10k1 *emu, int page, dma_addr_t addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | { |
| 44 | int i; |
| 45 | page *= UNIT_PAGES; |
| 46 | for (i = 0; i < UNIT_PAGES; i++, page++) { |
| 47 | __set_ptb_entry(emu, page, addr); |
Maciej S. Szmigiero | 541b9ba | 2018-02-14 00:06:18 +0100 | [diff] [blame] | 48 | dev_dbg(emu->card->dev, "mapped page %d to entry %.8x\n", page, |
| 49 | (unsigned int)__get_ptb_entry(emu, page)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 50 | addr += EMUPAGESIZE; |
| 51 | } |
| 52 | } |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 53 | static inline void set_silent_ptb(struct snd_emu10k1 *emu, int page) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 54 | { |
| 55 | int i; |
| 56 | page *= UNIT_PAGES; |
Maciej S. Szmigiero | 541b9ba | 2018-02-14 00:06:18 +0100 | [diff] [blame] | 57 | for (i = 0; i < UNIT_PAGES; i++, page++) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 58 | /* do not increment ptr */ |
| 59 | __set_ptb_entry(emu, page, emu->silent_page.addr); |
Maciej S. Szmigiero | 541b9ba | 2018-02-14 00:06:18 +0100 | [diff] [blame] | 60 | dev_dbg(emu->card->dev, "mapped silent page %d to entry %.8x\n", |
| 61 | page, (unsigned int)__get_ptb_entry(emu, page)); |
| 62 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 63 | } |
| 64 | #endif /* PAGE_SIZE */ |
| 65 | |
| 66 | |
| 67 | /* |
| 68 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 69 | static int synth_alloc_pages(struct snd_emu10k1 *hw, struct snd_emu10k1_memblk *blk); |
| 70 | static int synth_free_pages(struct snd_emu10k1 *hw, struct snd_emu10k1_memblk *blk); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 71 | |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 72 | #define get_emu10k1_memblk(l,member) list_entry(l, struct snd_emu10k1_memblk, member) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | |
| 74 | |
| 75 | /* initialize emu10k1 part */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 76 | static void emu10k1_memblk_init(struct snd_emu10k1_memblk *blk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | { |
| 78 | blk->mapped_page = -1; |
| 79 | INIT_LIST_HEAD(&blk->mapped_link); |
| 80 | INIT_LIST_HEAD(&blk->mapped_order_link); |
| 81 | blk->map_locked = 0; |
| 82 | |
| 83 | blk->first_page = get_aligned_page(blk->mem.offset); |
| 84 | blk->last_page = get_aligned_page(blk->mem.offset + blk->mem.size - 1); |
| 85 | blk->pages = blk->last_page - blk->first_page + 1; |
| 86 | } |
| 87 | |
| 88 | /* |
| 89 | * search empty region on PTB with the given size |
| 90 | * |
| 91 | * if an empty region is found, return the page and store the next mapped block |
| 92 | * in nextp |
| 93 | * if not found, return a negative error code. |
| 94 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 95 | static int search_empty_map_area(struct snd_emu10k1 *emu, int npages, struct list_head **nextp) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 96 | { |
Maciej S. Szmigiero | a4463c9 | 2018-02-14 00:04:58 +0100 | [diff] [blame] | 97 | int page = 1, found_page = -ENOMEM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 98 | int max_size = npages; |
| 99 | int size; |
| 100 | struct list_head *candidate = &emu->mapped_link_head; |
| 101 | struct list_head *pos; |
| 102 | |
| 103 | list_for_each (pos, &emu->mapped_link_head) { |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 104 | struct snd_emu10k1_memblk *blk = get_emu10k1_memblk(pos, mapped_link); |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 105 | if (blk->mapped_page < 0) |
| 106 | continue; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 107 | size = blk->mapped_page - page; |
| 108 | if (size == npages) { |
| 109 | *nextp = pos; |
| 110 | return page; |
| 111 | } |
| 112 | else if (size > max_size) { |
| 113 | /* we look for the maximum empty hole */ |
| 114 | max_size = size; |
| 115 | candidate = pos; |
| 116 | found_page = page; |
| 117 | } |
| 118 | page = blk->mapped_page + blk->pages; |
| 119 | } |
Peter Zubaj | 7241ea5 | 2015-04-28 21:57:29 +0200 | [diff] [blame] | 120 | size = (emu->address_mode ? MAX_ALIGN_PAGES1 : MAX_ALIGN_PAGES0) - page; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | if (size >= max_size) { |
| 122 | *nextp = pos; |
| 123 | return page; |
| 124 | } |
| 125 | *nextp = candidate; |
| 126 | return found_page; |
| 127 | } |
| 128 | |
| 129 | /* |
| 130 | * map a memory block onto emu10k1's PTB |
| 131 | * |
| 132 | * call with memblk_lock held |
| 133 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 134 | static int map_memblk(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 135 | { |
| 136 | int page, pg; |
| 137 | struct list_head *next; |
| 138 | |
| 139 | page = search_empty_map_area(emu, blk->pages, &next); |
| 140 | if (page < 0) /* not found */ |
| 141 | return page; |
Maciej S. Szmigiero | a4463c9 | 2018-02-14 00:04:58 +0100 | [diff] [blame] | 142 | if (page == 0) { |
| 143 | dev_err(emu->card->dev, "trying to map zero (reserved) page\n"); |
| 144 | return -EINVAL; |
| 145 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | /* insert this block in the proper position of mapped list */ |
| 147 | list_add_tail(&blk->mapped_link, next); |
| 148 | /* append this as a newest block in order list */ |
| 149 | list_add_tail(&blk->mapped_order_link, &emu->mapped_order_link_head); |
| 150 | blk->mapped_page = page; |
| 151 | /* fill PTB */ |
| 152 | for (pg = blk->first_page; pg <= blk->last_page; pg++) { |
| 153 | set_ptb_entry(emu, page, emu->page_addr_table[pg]); |
| 154 | page++; |
| 155 | } |
| 156 | return 0; |
| 157 | } |
| 158 | |
| 159 | /* |
| 160 | * unmap the block |
| 161 | * return the size of resultant empty pages |
| 162 | * |
| 163 | * call with memblk_lock held |
| 164 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 165 | static int unmap_memblk(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 166 | { |
| 167 | int start_page, end_page, mpage, pg; |
| 168 | struct list_head *p; |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 169 | struct snd_emu10k1_memblk *q; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 170 | |
| 171 | /* calculate the expected size of empty region */ |
| 172 | if ((p = blk->mapped_link.prev) != &emu->mapped_link_head) { |
| 173 | q = get_emu10k1_memblk(p, mapped_link); |
| 174 | start_page = q->mapped_page + q->pages; |
| 175 | } else |
Maciej S. Szmigiero | a4463c9 | 2018-02-14 00:04:58 +0100 | [diff] [blame] | 176 | start_page = 1; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | if ((p = blk->mapped_link.next) != &emu->mapped_link_head) { |
| 178 | q = get_emu10k1_memblk(p, mapped_link); |
| 179 | end_page = q->mapped_page; |
| 180 | } else |
Peter Zubaj | 7241ea5 | 2015-04-28 21:57:29 +0200 | [diff] [blame] | 181 | end_page = (emu->address_mode ? MAX_ALIGN_PAGES1 : MAX_ALIGN_PAGES0); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 182 | |
| 183 | /* remove links */ |
| 184 | list_del(&blk->mapped_link); |
| 185 | list_del(&blk->mapped_order_link); |
| 186 | /* clear PTB */ |
| 187 | mpage = blk->mapped_page; |
| 188 | for (pg = blk->first_page; pg <= blk->last_page; pg++) { |
| 189 | set_silent_ptb(emu, mpage); |
| 190 | mpage++; |
| 191 | } |
| 192 | blk->mapped_page = -1; |
| 193 | return end_page - start_page; /* return the new empty size */ |
| 194 | } |
| 195 | |
| 196 | /* |
| 197 | * search empty pages with the given size, and create a memory block |
| 198 | * |
| 199 | * unlike synth_alloc the memory block is aligned to the page start |
| 200 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 201 | static struct snd_emu10k1_memblk * |
| 202 | search_empty(struct snd_emu10k1 *emu, int size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 203 | { |
| 204 | struct list_head *p; |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 205 | struct snd_emu10k1_memblk *blk; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 206 | int page, psize; |
| 207 | |
| 208 | psize = get_aligned_page(size + PAGE_SIZE -1); |
| 209 | page = 0; |
| 210 | list_for_each(p, &emu->memhdr->block) { |
| 211 | blk = get_emu10k1_memblk(p, mem.list); |
| 212 | if (page + psize <= blk->first_page) |
| 213 | goto __found_pages; |
| 214 | page = blk->last_page + 1; |
| 215 | } |
| 216 | if (page + psize > emu->max_cache_pages) |
| 217 | return NULL; |
| 218 | |
| 219 | __found_pages: |
| 220 | /* create a new memory block */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 221 | blk = (struct snd_emu10k1_memblk *)__snd_util_memblk_new(emu->memhdr, psize << PAGE_SHIFT, p->prev); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | if (blk == NULL) |
| 223 | return NULL; |
| 224 | blk->mem.offset = aligned_page_offset(page); /* set aligned offset */ |
| 225 | emu10k1_memblk_init(blk); |
| 226 | return blk; |
| 227 | } |
| 228 | |
| 229 | |
| 230 | /* |
| 231 | * check if the given pointer is valid for pages |
| 232 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 233 | static int is_valid_page(struct snd_emu10k1 *emu, dma_addr_t addr) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 234 | { |
| 235 | if (addr & ~emu->dma_mask) { |
Takashi Iwai | 11d42c8 | 2018-05-17 20:02:23 +0200 | [diff] [blame] | 236 | dev_err_ratelimited(emu->card->dev, |
Takashi Iwai | 6f002b0 | 2014-02-25 17:02:09 +0100 | [diff] [blame] | 237 | "max memory size is 0x%lx (addr = 0x%lx)!!\n", |
| 238 | emu->dma_mask, (unsigned long)addr); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 239 | return 0; |
| 240 | } |
| 241 | if (addr & (EMUPAGESIZE-1)) { |
Takashi Iwai | 11d42c8 | 2018-05-17 20:02:23 +0200 | [diff] [blame] | 242 | dev_err_ratelimited(emu->card->dev, "page is not aligned\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 243 | return 0; |
| 244 | } |
| 245 | return 1; |
| 246 | } |
| 247 | |
| 248 | /* |
| 249 | * map the given memory block on PTB. |
| 250 | * if the block is already mapped, update the link order. |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 251 | * if no empty pages are found, tries to release unused memory blocks |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 252 | * and retry the mapping. |
| 253 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 254 | int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 255 | { |
| 256 | int err; |
| 257 | int size; |
| 258 | struct list_head *p, *nextp; |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 259 | struct snd_emu10k1_memblk *deleted; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | unsigned long flags; |
| 261 | |
| 262 | spin_lock_irqsave(&emu->memblk_lock, flags); |
| 263 | if (blk->mapped_page >= 0) { |
| 264 | /* update order link */ |
Wei Yongjun | 292f2b6 | 2012-09-05 15:00:15 +0800 | [diff] [blame] | 265 | list_move_tail(&blk->mapped_order_link, |
| 266 | &emu->mapped_order_link_head); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 | spin_unlock_irqrestore(&emu->memblk_lock, flags); |
| 268 | return 0; |
| 269 | } |
| 270 | if ((err = map_memblk(emu, blk)) < 0) { |
| 271 | /* no enough page - try to unmap some blocks */ |
| 272 | /* starting from the oldest block */ |
| 273 | p = emu->mapped_order_link_head.next; |
| 274 | for (; p != &emu->mapped_order_link_head; p = nextp) { |
| 275 | nextp = p->next; |
| 276 | deleted = get_emu10k1_memblk(p, mapped_order_link); |
| 277 | if (deleted->map_locked) |
| 278 | continue; |
| 279 | size = unmap_memblk(emu, deleted); |
| 280 | if (size >= blk->pages) { |
| 281 | /* ok the empty region is enough large */ |
| 282 | err = map_memblk(emu, blk); |
| 283 | break; |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | spin_unlock_irqrestore(&emu->memblk_lock, flags); |
| 288 | return err; |
| 289 | } |
| 290 | |
Takashi Iwai | 2dd31de | 2006-04-28 15:13:39 +0200 | [diff] [blame] | 291 | EXPORT_SYMBOL(snd_emu10k1_memblk_map); |
| 292 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 293 | /* |
| 294 | * page allocation for DMA |
| 295 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 296 | struct snd_util_memblk * |
| 297 | snd_emu10k1_alloc_pages(struct snd_emu10k1 *emu, struct snd_pcm_substream *substream) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | { |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 299 | struct snd_pcm_runtime *runtime = substream->runtime; |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 300 | struct snd_util_memhdr *hdr; |
| 301 | struct snd_emu10k1_memblk *blk; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | int page, err, idx; |
| 303 | |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 304 | if (snd_BUG_ON(!emu)) |
| 305 | return NULL; |
| 306 | if (snd_BUG_ON(runtime->dma_bytes <= 0 || |
Peter Zubaj | 7241ea5 | 2015-04-28 21:57:29 +0200 | [diff] [blame] | 307 | runtime->dma_bytes >= (emu->address_mode ? MAXPAGES1 : MAXPAGES0) * EMUPAGESIZE)) |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 308 | return NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 309 | hdr = emu->memhdr; |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 310 | if (snd_BUG_ON(!hdr)) |
| 311 | return NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 312 | |
Jaroslav Kysela | 56385a1 | 2010-08-18 14:08:17 +0200 | [diff] [blame] | 313 | idx = runtime->period_size >= runtime->buffer_size ? |
| 314 | (emu->delay_pcm_irq * 2) : 0; |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 315 | mutex_lock(&hdr->block_mutex); |
Jaroslav Kysela | 56385a1 | 2010-08-18 14:08:17 +0200 | [diff] [blame] | 316 | blk = search_empty(emu, runtime->dma_bytes + idx); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 317 | if (blk == NULL) { |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 318 | mutex_unlock(&hdr->block_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 319 | return NULL; |
| 320 | } |
| 321 | /* fill buffer addresses but pointers are not stored so that |
| 322 | * snd_free_pci_page() is not called in in synth_free() |
| 323 | */ |
| 324 | idx = 0; |
| 325 | for (page = blk->first_page; page <= blk->last_page; page++, idx++) { |
Takashi Iwai | 77a23f2 | 2008-08-21 13:00:13 +0200 | [diff] [blame] | 326 | unsigned long ofs = idx << PAGE_SHIFT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 327 | dma_addr_t addr; |
Takashi Iwai | fcfb786 | 2012-08-03 12:51:21 +0200 | [diff] [blame] | 328 | if (ofs >= runtime->dma_bytes) |
| 329 | addr = emu->silent_page.addr; |
| 330 | else |
| 331 | addr = snd_pcm_sgbuf_get_addr(substream, ofs); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 332 | if (! is_valid_page(emu, addr)) { |
Takashi Iwai | 11d42c8 | 2018-05-17 20:02:23 +0200 | [diff] [blame] | 333 | dev_err_ratelimited(emu->card->dev, |
Takashi Iwai | 6f002b0 | 2014-02-25 17:02:09 +0100 | [diff] [blame] | 334 | "emu: failure page = %d\n", idx); |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 335 | mutex_unlock(&hdr->block_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | return NULL; |
| 337 | } |
| 338 | emu->page_addr_table[page] = addr; |
| 339 | emu->page_ptr_table[page] = NULL; |
| 340 | } |
| 341 | |
| 342 | /* set PTB entries */ |
| 343 | blk->map_locked = 1; /* do not unmap this block! */ |
| 344 | err = snd_emu10k1_memblk_map(emu, blk); |
| 345 | if (err < 0) { |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 346 | __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk); |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 347 | mutex_unlock(&hdr->block_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 348 | return NULL; |
| 349 | } |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 350 | mutex_unlock(&hdr->block_mutex); |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 351 | return (struct snd_util_memblk *)blk; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 352 | } |
| 353 | |
| 354 | |
| 355 | /* |
| 356 | * release DMA buffer from page table |
| 357 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 358 | int snd_emu10k1_free_pages(struct snd_emu10k1 *emu, struct snd_util_memblk *blk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 359 | { |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 360 | if (snd_BUG_ON(!emu || !blk)) |
| 361 | return -EINVAL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 362 | return snd_emu10k1_synth_free(emu, blk); |
| 363 | } |
| 364 | |
Maciej S. Szmigiero | 04f8773 | 2018-02-14 00:07:58 +0100 | [diff] [blame] | 365 | /* |
| 366 | * allocate DMA pages, widening the allocation if necessary |
| 367 | * |
| 368 | * See the comment above snd_emu10k1_detect_iommu() in emu10k1_main.c why |
| 369 | * this might be needed. |
| 370 | * |
| 371 | * If you modify this function check whether __synth_free_pages() also needs |
| 372 | * changes. |
| 373 | */ |
| 374 | int snd_emu10k1_alloc_pages_maybe_wider(struct snd_emu10k1 *emu, size_t size, |
| 375 | struct snd_dma_buffer *dmab) |
| 376 | { |
| 377 | if (emu->iommu_workaround) { |
| 378 | size_t npages = (size + PAGE_SIZE - 1) / PAGE_SIZE; |
| 379 | size_t size_real = npages * PAGE_SIZE; |
| 380 | |
| 381 | /* |
| 382 | * The device has been observed to accesses up to 256 extra |
| 383 | * bytes, but use 1k to be safe. |
| 384 | */ |
| 385 | if (size_real < size + 1024) |
| 386 | size += PAGE_SIZE; |
| 387 | } |
| 388 | |
| 389 | return snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
Takashi Iwai | 6974f8a | 2019-11-05 16:18:55 +0100 | [diff] [blame] | 390 | &emu->pci->dev, size, dmab); |
Maciej S. Szmigiero | 04f8773 | 2018-02-14 00:07:58 +0100 | [diff] [blame] | 391 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 392 | |
| 393 | /* |
| 394 | * memory allocation using multiple pages (for synth) |
| 395 | * Unlike the DMA allocation above, non-contiguous pages are assined. |
| 396 | */ |
| 397 | |
| 398 | /* |
| 399 | * allocate a synth sample area |
| 400 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 401 | struct snd_util_memblk * |
| 402 | snd_emu10k1_synth_alloc(struct snd_emu10k1 *hw, unsigned int size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 403 | { |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 404 | struct snd_emu10k1_memblk *blk; |
| 405 | struct snd_util_memhdr *hdr = hw->memhdr; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 406 | |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 407 | mutex_lock(&hdr->block_mutex); |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 408 | blk = (struct snd_emu10k1_memblk *)__snd_util_mem_alloc(hdr, size); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 409 | if (blk == NULL) { |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 410 | mutex_unlock(&hdr->block_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 411 | return NULL; |
| 412 | } |
| 413 | if (synth_alloc_pages(hw, blk)) { |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 414 | __snd_util_mem_free(hdr, (struct snd_util_memblk *)blk); |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 415 | mutex_unlock(&hdr->block_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 416 | return NULL; |
| 417 | } |
| 418 | snd_emu10k1_memblk_map(hw, blk); |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 419 | mutex_unlock(&hdr->block_mutex); |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 420 | return (struct snd_util_memblk *)blk; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 421 | } |
| 422 | |
Takashi Iwai | 2dd31de | 2006-04-28 15:13:39 +0200 | [diff] [blame] | 423 | EXPORT_SYMBOL(snd_emu10k1_synth_alloc); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 424 | |
| 425 | /* |
| 426 | * free a synth sample area |
| 427 | */ |
| 428 | int |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 429 | snd_emu10k1_synth_free(struct snd_emu10k1 *emu, struct snd_util_memblk *memblk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | { |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 431 | struct snd_util_memhdr *hdr = emu->memhdr; |
| 432 | struct snd_emu10k1_memblk *blk = (struct snd_emu10k1_memblk *)memblk; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 433 | unsigned long flags; |
| 434 | |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 435 | mutex_lock(&hdr->block_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 436 | spin_lock_irqsave(&emu->memblk_lock, flags); |
| 437 | if (blk->mapped_page >= 0) |
| 438 | unmap_memblk(emu, blk); |
| 439 | spin_unlock_irqrestore(&emu->memblk_lock, flags); |
| 440 | synth_free_pages(emu, blk); |
| 441 | __snd_util_mem_free(hdr, memblk); |
Ingo Molnar | 62932df | 2006-01-16 16:34:20 +0100 | [diff] [blame] | 442 | mutex_unlock(&hdr->block_mutex); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 443 | return 0; |
| 444 | } |
| 445 | |
Takashi Iwai | 2dd31de | 2006-04-28 15:13:39 +0200 | [diff] [blame] | 446 | EXPORT_SYMBOL(snd_emu10k1_synth_free); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 447 | |
| 448 | /* check new allocation range */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 449 | static void get_single_page_range(struct snd_util_memhdr *hdr, |
| 450 | struct snd_emu10k1_memblk *blk, |
| 451 | int *first_page_ret, int *last_page_ret) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 452 | { |
| 453 | struct list_head *p; |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 454 | struct snd_emu10k1_memblk *q; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 455 | int first_page, last_page; |
| 456 | first_page = blk->first_page; |
| 457 | if ((p = blk->mem.list.prev) != &hdr->block) { |
| 458 | q = get_emu10k1_memblk(p, mem.list); |
| 459 | if (q->last_page == first_page) |
| 460 | first_page++; /* first page was already allocated */ |
| 461 | } |
| 462 | last_page = blk->last_page; |
| 463 | if ((p = blk->mem.list.next) != &hdr->block) { |
| 464 | q = get_emu10k1_memblk(p, mem.list); |
| 465 | if (q->first_page == last_page) |
| 466 | last_page--; /* last page was already allocated */ |
| 467 | } |
| 468 | *first_page_ret = first_page; |
| 469 | *last_page_ret = last_page; |
| 470 | } |
| 471 | |
Takashi Iwai | a5003fc | 2008-05-30 09:49:41 +0200 | [diff] [blame] | 472 | /* release allocated pages */ |
| 473 | static void __synth_free_pages(struct snd_emu10k1 *emu, int first_page, |
| 474 | int last_page) |
| 475 | { |
Maciej S. Szmigiero | 055e0ae | 2018-02-14 00:06:34 +0100 | [diff] [blame] | 476 | struct snd_dma_buffer dmab; |
Takashi Iwai | a5003fc | 2008-05-30 09:49:41 +0200 | [diff] [blame] | 477 | int page; |
| 478 | |
Maciej S. Szmigiero | 055e0ae | 2018-02-14 00:06:34 +0100 | [diff] [blame] | 479 | dmab.dev.type = SNDRV_DMA_TYPE_DEV; |
Takashi Iwai | 6974f8a | 2019-11-05 16:18:55 +0100 | [diff] [blame] | 480 | dmab.dev.dev = &emu->pci->dev; |
Maciej S. Szmigiero | 055e0ae | 2018-02-14 00:06:34 +0100 | [diff] [blame] | 481 | |
Takashi Iwai | a5003fc | 2008-05-30 09:49:41 +0200 | [diff] [blame] | 482 | for (page = first_page; page <= last_page; page++) { |
Maciej S. Szmigiero | 055e0ae | 2018-02-14 00:06:34 +0100 | [diff] [blame] | 483 | if (emu->page_ptr_table[page] == NULL) |
| 484 | continue; |
| 485 | dmab.area = emu->page_ptr_table[page]; |
| 486 | dmab.addr = emu->page_addr_table[page]; |
Maciej S. Szmigiero | 04f8773 | 2018-02-14 00:07:58 +0100 | [diff] [blame] | 487 | |
| 488 | /* |
| 489 | * please keep me in sync with logic in |
| 490 | * snd_emu10k1_alloc_pages_maybe_wider() |
| 491 | */ |
Maciej S. Szmigiero | 055e0ae | 2018-02-14 00:06:34 +0100 | [diff] [blame] | 492 | dmab.bytes = PAGE_SIZE; |
Maciej S. Szmigiero | 04f8773 | 2018-02-14 00:07:58 +0100 | [diff] [blame] | 493 | if (emu->iommu_workaround) |
| 494 | dmab.bytes *= 2; |
| 495 | |
Maciej S. Szmigiero | 055e0ae | 2018-02-14 00:06:34 +0100 | [diff] [blame] | 496 | snd_dma_free_pages(&dmab); |
Takashi Iwai | a5003fc | 2008-05-30 09:49:41 +0200 | [diff] [blame] | 497 | emu->page_addr_table[page] = 0; |
| 498 | emu->page_ptr_table[page] = NULL; |
| 499 | } |
| 500 | } |
| 501 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 502 | /* |
| 503 | * allocate kernel pages |
| 504 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 505 | static int synth_alloc_pages(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 506 | { |
| 507 | int page, first_page, last_page; |
Maciej S. Szmigiero | 055e0ae | 2018-02-14 00:06:34 +0100 | [diff] [blame] | 508 | struct snd_dma_buffer dmab; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 509 | |
| 510 | emu10k1_memblk_init(blk); |
| 511 | get_single_page_range(emu->memhdr, blk, &first_page, &last_page); |
| 512 | /* allocate kernel pages */ |
| 513 | for (page = first_page; page <= last_page; page++) { |
Maciej S. Szmigiero | 04f8773 | 2018-02-14 00:07:58 +0100 | [diff] [blame] | 514 | if (snd_emu10k1_alloc_pages_maybe_wider(emu, PAGE_SIZE, |
| 515 | &dmab) < 0) |
Maciej S. Szmigiero | 055e0ae | 2018-02-14 00:06:34 +0100 | [diff] [blame] | 516 | goto __fail; |
| 517 | if (!is_valid_page(emu, dmab.addr)) { |
| 518 | snd_dma_free_pages(&dmab); |
| 519 | goto __fail; |
Jaroslav Kysela | 9f515b6 | 2008-06-17 16:20:13 +0200 | [diff] [blame] | 520 | } |
Maciej S. Szmigiero | 055e0ae | 2018-02-14 00:06:34 +0100 | [diff] [blame] | 521 | emu->page_addr_table[page] = dmab.addr; |
| 522 | emu->page_ptr_table[page] = dmab.area; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 523 | } |
| 524 | return 0; |
Maciej S. Szmigiero | 055e0ae | 2018-02-14 00:06:34 +0100 | [diff] [blame] | 525 | |
| 526 | __fail: |
| 527 | /* release allocated pages */ |
| 528 | last_page = page - 1; |
| 529 | __synth_free_pages(emu, first_page, last_page); |
| 530 | |
| 531 | return -ENOMEM; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 532 | } |
| 533 | |
| 534 | /* |
| 535 | * free pages |
| 536 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 537 | static int synth_free_pages(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | { |
Takashi Iwai | a5003fc | 2008-05-30 09:49:41 +0200 | [diff] [blame] | 539 | int first_page, last_page; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 540 | |
| 541 | get_single_page_range(emu->memhdr, blk, &first_page, &last_page); |
Takashi Iwai | a5003fc | 2008-05-30 09:49:41 +0200 | [diff] [blame] | 542 | __synth_free_pages(emu, first_page, last_page); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 543 | return 0; |
| 544 | } |
| 545 | |
| 546 | /* calculate buffer pointer from offset address */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 547 | static inline void *offset_ptr(struct snd_emu10k1 *emu, int page, int offset) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 548 | { |
| 549 | char *ptr; |
Takashi Iwai | da3cec3 | 2008-08-08 17:12:14 +0200 | [diff] [blame] | 550 | if (snd_BUG_ON(page < 0 || page >= emu->max_cache_pages)) |
| 551 | return NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 552 | ptr = emu->page_ptr_table[page]; |
| 553 | if (! ptr) { |
Takashi Iwai | 6f002b0 | 2014-02-25 17:02:09 +0100 | [diff] [blame] | 554 | dev_err(emu->card->dev, |
| 555 | "access to NULL ptr: page = %d\n", page); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 556 | return NULL; |
| 557 | } |
| 558 | ptr += offset & (PAGE_SIZE - 1); |
| 559 | return (void*)ptr; |
| 560 | } |
| 561 | |
| 562 | /* |
| 563 | * bzero(blk + offset, size) |
| 564 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 565 | int snd_emu10k1_synth_bzero(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, |
| 566 | int offset, int size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 567 | { |
| 568 | int page, nextofs, end_offset, temp, temp1; |
| 569 | void *ptr; |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 570 | struct snd_emu10k1_memblk *p = (struct snd_emu10k1_memblk *)blk; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 571 | |
| 572 | offset += blk->offset & (PAGE_SIZE - 1); |
| 573 | end_offset = offset + size; |
| 574 | page = get_aligned_page(offset); |
| 575 | do { |
| 576 | nextofs = aligned_page_offset(page + 1); |
| 577 | temp = nextofs - offset; |
| 578 | temp1 = end_offset - offset; |
| 579 | if (temp1 < temp) |
| 580 | temp = temp1; |
| 581 | ptr = offset_ptr(emu, page + p->first_page, offset); |
| 582 | if (ptr) |
| 583 | memset(ptr, 0, temp); |
| 584 | offset = nextofs; |
| 585 | page++; |
| 586 | } while (offset < end_offset); |
| 587 | return 0; |
| 588 | } |
| 589 | |
Takashi Iwai | 2dd31de | 2006-04-28 15:13:39 +0200 | [diff] [blame] | 590 | EXPORT_SYMBOL(snd_emu10k1_synth_bzero); |
| 591 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 592 | /* |
| 593 | * copy_from_user(blk + offset, data, size) |
| 594 | */ |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 595 | int snd_emu10k1_synth_copy_from_user(struct snd_emu10k1 *emu, struct snd_util_memblk *blk, |
| 596 | int offset, const char __user *data, int size) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 597 | { |
| 598 | int page, nextofs, end_offset, temp, temp1; |
| 599 | void *ptr; |
Takashi Iwai | eb4698f | 2005-11-17 14:50:13 +0100 | [diff] [blame] | 600 | struct snd_emu10k1_memblk *p = (struct snd_emu10k1_memblk *)blk; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 601 | |
| 602 | offset += blk->offset & (PAGE_SIZE - 1); |
| 603 | end_offset = offset + size; |
| 604 | page = get_aligned_page(offset); |
| 605 | do { |
| 606 | nextofs = aligned_page_offset(page + 1); |
| 607 | temp = nextofs - offset; |
| 608 | temp1 = end_offset - offset; |
| 609 | if (temp1 < temp) |
| 610 | temp = temp1; |
| 611 | ptr = offset_ptr(emu, page + p->first_page, offset); |
| 612 | if (ptr && copy_from_user(ptr, data, temp)) |
| 613 | return -EFAULT; |
| 614 | offset = nextofs; |
| 615 | data += temp; |
| 616 | page++; |
| 617 | } while (offset < end_offset); |
| 618 | return 0; |
| 619 | } |
Takashi Iwai | 2dd31de | 2006-04-28 15:13:39 +0200 | [diff] [blame] | 620 | |
| 621 | EXPORT_SYMBOL(snd_emu10k1_synth_copy_from_user); |