From 8cc72361481f00253f1e468ade5795427386d593 Mon Sep 17 00:00:00 2001 From: Wai Yew CHAY Date: Thu, 14 May 2009 08:05:58 +0200 Subject: ALSA: SB X-Fi driver merge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Sound Blaster X-Fi driver supports Creative solutions based on 20K1 and 20K2 chipsets. Supported hardware : Creative Sound Blaster X-Fi Titanium Fatal1ty® Champion Series Creative Sound Blaster X-Fi Titanium Fatal1ty Professional Series Creative Sound Blaster X-Fi Titanium Professional Audio Creative Sound Blaster X-Fi Titanium Creative Sound Blaster X-Fi Elite Pro Creative Sound Blaster X-Fi Platinum Creative Sound Blaster X-Fi Fatal1ty Creative Sound Blaster X-Fi XtremeGamer Creative Sound Blaster X-Fi XtremeMusic Current release features: * ALSA PCM Playback * ALSA Record * ALSA Mixer Note: * External I/O modules detection not included. Signed-off-by: Wai Yew CHAY Singed-off-by: Ryan RICHARDS Signed-off-by: Takashi Iwai --- sound/pci/Kconfig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sound/pci/Kconfig') diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 93422e3a3f0c..3a7640feaf92 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -275,6 +275,16 @@ config SND_CS5535AUDIO To compile this driver as a module, choose M here: the module will be called snd-cs5535audio. +config SND_CTXFI + tristate "Creative Sound Blaster X-Fi" + select SND_PCM + help + If you want to use soundcards based on Creative Sound Blastr X-Fi + boards with 20k1 or 20k2 chips, say Y here. + + To compile this driver as a module, choose M here: the module + will be called snd-ctxfi. + config SND_DARLA20 tristate "(Echoaudio) Darla20" select FW_LOADER -- cgit v1.2.3 From 3e3ee6dc949d25423f72bb5ee5f58dfa79ac85c7 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 20 May 2009 16:47:59 +0200 Subject: ALSA: ctxfi - Add depends on X86 The ctxfi driver requires explicitly the 4k page size, and gives a build error on architectures with non-4k pages. As a workaround, just add the kconfig dependency on X86, which is the only architecture ever tested. Signed-off-by: Takashi Iwai --- sound/pci/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'sound/pci/Kconfig') diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 3a7640feaf92..2d7fef5df017 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -277,6 +277,7 @@ config SND_CS5535AUDIO config SND_CTXFI tristate "Creative Sound Blaster X-Fi" + depends on X86 select SND_PCM help If you want to use soundcards based on Creative Sound Blastr X-Fi -- cgit v1.2.3 From cd391e206f486955e216a61bd9ebcb0e142122e9 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 2 Jun 2009 15:04:29 +0200 Subject: ALSA: ctxfi - Remove PAGE_SIZE limitation Remove the limitation of PAGE_SIZE to be 4k by defining the own page size and macros for 4k. 8kb page size could be natively supported, but it's disabled right now for simplicity. Also, clean up using upper_32_bits() macro. Signed-off-by: Takashi Iwai --- sound/pci/Kconfig | 1 - sound/pci/ctxfi/cthw20k1.c | 16 ++++++---------- sound/pci/ctxfi/cthw20k2.c | 17 ++++------------- sound/pci/ctxfi/ctvmem.c | 25 ++++++++++++------------- sound/pci/ctxfi/ctvmem.h | 8 ++++++++ 5 files changed, 30 insertions(+), 37 deletions(-) (limited to 'sound/pci/Kconfig') diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig index 2d7fef5df017..3a7640feaf92 100644 --- a/sound/pci/Kconfig +++ b/sound/pci/Kconfig @@ -277,7 +277,6 @@ config SND_CS5535AUDIO config SND_CTXFI tristate "Creative Sound Blaster X-Fi" - depends on X86 select SND_PCM help If you want to use soundcards based on Creative Sound Blastr X-Fi diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c index 44283bd7b2df..b7b8e6f41d0d 100644 --- a/sound/pci/ctxfi/cthw20k1.c +++ b/sound/pci/ctxfi/cthw20k1.c @@ -1249,18 +1249,14 @@ static int hw_trn_init(struct hw *hw, const struct trn_conf *info) } trnctl = 0x13; /* 32-bit, 4k-size page */ -#if BITS_PER_LONG == 64 - ptp_phys_low = info->vm_pgt_phys & ((1UL<<32)-1); - ptp_phys_high = (info->vm_pgt_phys>>32) & ((1UL<<32)-1); - trnctl |= (1<<2); -#elif BITS_PER_LONG == 32 - ptp_phys_low = info->vm_pgt_phys & (~0UL); - ptp_phys_high = 0; -#else -# error "Unknown BITS_PER_LONG!" -#endif + ptp_phys_low = (u32)info->vm_pgt_phys; + ptp_phys_high = upper_32_bits(info->vm_pgt_phys); + if (sizeof(void *) == 8) /* 64bit address */ + trnctl |= (1 << 2); +#if 0 /* Only 4k h/w pages for simplicitiy */ #if PAGE_SIZE == 8192 trnctl |= (1<<5); +#endif #endif hw_write_20kx(hw, PTPALX, ptp_phys_low); hw_write_20kx(hw, PTPAHX, ptp_phys_high); diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c index 7c24c2ca96bd..349728765f2c 100644 --- a/sound/pci/ctxfi/cthw20k2.c +++ b/sound/pci/ctxfi/cthw20k2.c @@ -1203,19 +1203,10 @@ static int hw_trn_init(struct hw *hw, const struct trn_conf *info) } vmctl = 0x80000C0F; /* 32-bit, 4k-size page */ -#if BITS_PER_LONG == 64 - ptp_phys_low = info->vm_pgt_phys & ((1UL<<32)-1); - ptp_phys_high = (info->vm_pgt_phys>>32) & ((1UL<<32)-1); - vmctl |= (3<<8); -#elif BITS_PER_LONG == 32 - ptp_phys_low = info->vm_pgt_phys & (~0UL); - ptp_phys_high = 0; -#else -# error "Unknown BITS_PER_LONG!" -#endif -#if PAGE_SIZE == 8192 -# error "Don't support 8k-page!" -#endif + ptp_phys_low = (u32)info->vm_pgt_phys; + ptp_phys_high = upper_32_bits(info->vm_pgt_phys); + if (sizeof(void *) == 8) /* 64bit address */ + vmctl |= (3 << 8); /* Write page table physical address to all PTPAL registers */ for (i = 0; i < 64; i++) { hw_write_20kx(hw, VMEM_PTPAL+(16*i), ptp_phys_low); diff --git a/sound/pci/ctxfi/ctvmem.c b/sound/pci/ctxfi/ctvmem.c index 363b67e3a9e7..74a03623d047 100644 --- a/sound/pci/ctxfi/ctvmem.c +++ b/sound/pci/ctxfi/ctvmem.c @@ -18,12 +18,11 @@ #include "ctvmem.h" #include #include -#include /* for PAGE_SIZE macro definition */ #include #include -#define CT_PTES_PER_PAGE (PAGE_SIZE / sizeof(void *)) -#define CT_ADDRS_PER_PAGE (CT_PTES_PER_PAGE * PAGE_SIZE) +#define CT_PTES_PER_PAGE (CT_PAGE_SIZE / sizeof(void *)) +#define CT_ADDRS_PER_PAGE (CT_PTES_PER_PAGE * CT_PAGE_SIZE) /* * * Find or create vm block based on requested @size. @@ -138,24 +137,24 @@ ct_vm_map(struct ct_vm *vm, void *host_addr, int size) return NULL; } - start_phys = (virt_to_phys(host_addr) & PAGE_MASK); - pages = (PAGE_ALIGN(virt_to_phys(host_addr) + size) - - start_phys) >> PAGE_SHIFT; + start_phys = (virt_to_phys(host_addr) & CT_PAGE_MASK); + pages = (CT_PAGE_ALIGN(virt_to_phys(host_addr) + size) + - start_phys) >> CT_PAGE_SHIFT; ptp = vm->ptp[0]; - block = get_vm_block(vm, (pages << PAGE_SHIFT)); + block = get_vm_block(vm, (pages << CT_PAGE_SHIFT)); if (block == NULL) { printk(KERN_ERR "ctxfi: No virtual memory block that is big " "enough to allocate!\n"); return NULL; } - pte_start = (block->addr >> PAGE_SHIFT); + pte_start = (block->addr >> CT_PAGE_SHIFT); for (i = 0; i < pages; i++) - ptp[pte_start+i] = start_phys + (i << PAGE_SHIFT); + ptp[pte_start+i] = start_phys + (i << CT_PAGE_SHIFT); - block->addr += (virt_to_phys(host_addr) & (~PAGE_MASK)); + block->addr += (virt_to_phys(host_addr) & (~CT_PAGE_MASK)); block->size = size; return block; @@ -164,9 +163,9 @@ ct_vm_map(struct ct_vm *vm, void *host_addr, int size) static void ct_vm_unmap(struct ct_vm *vm, struct ct_vm_block *block) { /* do unmapping */ - block->size = ((block->addr + block->size + PAGE_SIZE - 1) - & PAGE_MASK) - (block->addr & PAGE_MASK); - block->addr &= PAGE_MASK; + block->size = ((block->addr + block->size + CT_PAGE_SIZE - 1) + & CT_PAGE_MASK) - (block->addr & CT_PAGE_MASK); + block->addr &= CT_PAGE_MASK; put_vm_block(vm, block); } diff --git a/sound/pci/ctxfi/ctvmem.h b/sound/pci/ctxfi/ctvmem.h index 618952efa5b3..17d2d37a9ea7 100644 --- a/sound/pci/ctxfi/ctvmem.h +++ b/sound/pci/ctxfi/ctvmem.h @@ -23,6 +23,14 @@ #include #include +/* 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 */ -- cgit v1.2.3