aboutsummaryrefslogtreecommitdiff
path: root/sound/pci/ctxfi/ctvmem.h
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ctxfi/ctvmem.h')
-rw-r--r--sound/pci/ctxfi/ctvmem.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/sound/pci/ctxfi/ctvmem.h b/sound/pci/ctxfi/ctvmem.h
index 4eb5bdd5cad..01e4fd0386a 100644
--- a/sound/pci/ctxfi/ctvmem.h
+++ b/sound/pci/ctxfi/ctvmem.h
@@ -20,24 +20,36 @@
#define CT_PTP_NUM 1 /* num of device page table pages */
-#include <linux/spinlock.h>
+#include <linux/mutex.h>
#include <linux/list.h>
+/* The chip can handle the page table of 4k pages
+ * (emu20k1 can handle even 8k pages, but we don't use it right now)
+ */
+#define CT_PAGE_SIZE 4096
+#define CT_PAGE_SHIFT 12
+#define CT_PAGE_MASK (~(PAGE_SIZE - 1))
+#define CT_PAGE_ALIGN(addr) ALIGN(addr, CT_PAGE_SIZE)
+
struct ct_vm_block {
unsigned int addr; /* starting logical addr of this block */
unsigned int size; /* size of this device virtual mem block */
struct list_head list;
};
+struct snd_pcm_substream;
+
/* Virtual memory management object for card device */
struct ct_vm {
void *ptp[CT_PTP_NUM]; /* Device page table pages */
unsigned int size; /* Available addr space in bytes */
struct list_head unused; /* List of unused blocks */
struct list_head used; /* List of used blocks */
+ struct mutex lock;
/* Map host addr (kmalloced/vmalloced) to device logical addr. */
- struct ct_vm_block *(*map)(struct ct_vm *, void *host_addr, int size);
+ struct ct_vm_block *(*map)(struct ct_vm *, struct snd_pcm_substream *,
+ int size);
/* Unmap device logical addr area. */
void (*unmap)(struct ct_vm *, struct ct_vm_block *block);
void *(*get_ptp_virt)(struct ct_vm *vm, int index);