2009-06-24 08:55:22 alsa mmap doesn't work in 2008R1.5 on bf527
Stefan Wanja (GERMANY)
Message: 76239
Hello,
I am trying to use the ssm2602 codec on the bf527 ezKit with mmap. I have configured it in the kernel and it builds fine. After starting I try arecord --mmap which fails with this output:
root:/usr/share/alsa/cards> arecord --mmap
Recording WAVE 'stdin' : Unsigned 8 bit, Rate 8000 Hz, Mono
ALSA lib ../../../alsa-lib-1.0.12/src/pcm/pcm_mmap.c:370:(snd_pcm_mmap) mmap failed: No such device
arecord: set_params:965: Unable to install hw params:
ACCESS: MMAP_INTERLEAVED
FORMAT: U8
SUBFORMAT: STD
SAMPLE_BITS: 8
FRAME_BITS: 8
CHANNELS: 1
RATE: 8000
PERIOD_TIME: (85312 85313)
PERIOD_SIZE: (682 683)
PERIOD_BYTES: (682 683)
PERIODS: (3 5)
BUFFER_TIME: 341250
BUFFER_SIZE: 2730
BUFFER_BYTES: 2730
TICK_TIME: 4000
root:/usr/share/alsa/cards>
With strace I see the following:
open("/dev/aloadC30", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/snd/controlC31", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/aloadC31", O_RDONLY) = -1 ENOENT (No such file or directory)
open("/dev/snd/controlC0", O_RDONLY) = 3
close(3) = 0
stat("/usr/share/alsa/alsa.conf", {st_mode=S_IFREG|0644, st_size=7701, ...}) = 0
open("/dev/snd/controlC0", O_RDONLY) = 3
close(3) = 0
open("/dev/snd/controlC0", O_RDWR) = 3
ioctl(3, USBDEVFS_CONTROL, 0x65f4d4) = 0
ioctl(3, UI_DEV_CREATE, 0x65f49c) = 0
close(3) = 0
open("/dev/snd/controlC0", O_RDWR) = 3
ioctl(3, USBDEVFS_CONTROL, 0x65f7ec) = 0
ioctl(3, 0x40045532, 0x65f814) = 0
open("/dev/snd/pcmC0D0c", O_RDWR|O_NONBLOCK) = 4
close(3) = 0
ioctl(4, AGPIOC_ACQUIRE or APM_IOC_STANDBY, 0x65f640) = 0
fcntl(4, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
ioctl(4, AGPIOC_INFO, 0x65f7ec) = 0
ioctl(4, AGPIOC_RELEASE or APM_IOC_SUSPEND, 0x65f7e4) = 0
mmap2(NULL, 4096, PROT_READ, MAP_SHARED, 4, 0xfff80000) = -1 ENODEV (No such device)
ioctl(4, 0xc0844123, 0x65f760) = 0
fcntl(4, F_GETFL) = 0x802 (flags O_RDWR|O_NONBLOCK)
fcntl(4, F_SETFL, O_RDWR) = 0
ioctl(4, AGPIOC_ACQUIRE or APM_IOC_STANDBY, 0x65fc60) = 0
rt_sigaction(SIGINT, {0x3bfcc88, [INT], SA_RESTART}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGTERM, {0x3bfcc88, [TERM], SA_RESTART}, {SIG_DFL}, 8) = 0
rt_sigaction(SIGABRT, {0x3bfcc88, [ABRT], SA_RESTART}, {SIG_DFL}, 8) = 0
write(2, "Recording", 9Recording) = 9
write(2, " ", 1 ) = 1
write(2, "WAVE", 4WAVE) = 4
write(2, " \'", 2 ') = 2
write(2, "stdin", 5stdin) = 5
write(2, "\' : ", 4' : ) = 4
write(2, "Unsigned 8 bit", 14Unsigned 8 bit) = 14
write(2, ", ", 2, ) = 2
write(2, "Rate ", 5Rate ) = 5
write(2, "8000", 48000) = 4
write(2, " Hz, ", 5 Hz, ) = 5
write(2, "Mono", 4Mono) = 4
write(2, "\n", 1) = 1
ioctl(4, 0xc25c4110, 0x65d5a8) = 0
ioctl(4, 0xc25c4110, 0x65d5a8) = 0
ioctl(4, 0xc25c4110, 0x65d5a8) = 0
ioctl(4, 0xc25c4110, 0x65d2e4) = 0
ioctl(4, 0xc25c4110, 0x65d2e4) = 0
ioctl(4, 0xc25c4110, 0x65d2d4) = 0
ioctl(4, 0xc25c4110, 0x65d2d4) = 0
ioctl(4, 0xc25c4110, 0x65d2d4) = 0
ioctl(4, 0xc25c4110, 0x65d2d4) = 0
ioctl(4, 0xc25c4110, 0x65d2d4) = 0
ioctl(4, 0xc25c4110, 0x65d2d4) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65d028) = 0
ioctl(4, 0xc25c4110, 0x65d028) = 0
ioctl(4, 0xc25c4110, 0x65d028) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65d028) = 0
ioctl(4, 0xc25c4110, 0x65d028) = 0
ioctl(4, 0xc25c4110, 0x65d028) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65cdd4) = 0
ioctl(4, 0xc25c4110, 0x65d4cc) = 0
ioctl(4, 0xc25c4110, 0x65d4cc) = 0
ioctl(4, 0xc25c4110, 0x65d490) = 0
ioctl(4, 0xc25c4110, 0x65d490) = 0
ioctl(4, 0xc25c4110, 0x65d4bc) = 0
ioctl(4, 0xc25c4110, 0x65ceb8) = 0
ioctl(4, 0xc25c4110, 0x65ceb8) = 0
ioctl(4, 0xc25c4110, 0x65ce08) = 0
ioctl(4, 0xc25c4110, 0x65ce08) = 0
ioctl(4, 0xc25c4110, 0x65cdcc) = 0
ioctl(4, 0xc25c4110, 0x65cdf0) = 0
ioctl(4, 0xc25c4111, 0x65cdf0) = 0
ioctl(4, 0xc0844123, 0x67dc74) = 0
ioctl(4, 0xc0684113, 0x65cd60) = 0
ioctl(4, 0x80104132, 0x65ccb4) = 0
ioctl(4, 0x80104132, 0x65ccb4) = 0
write(2, "ALSA lib ", 9ALSA lib ) = 9
write(2, "../../../alsa-lib-1.0.12/src/pcm"..., 43../../../alsa-lib-1.0.12/src/pcm/pcm_mmap.c) = 43
write(2, ":", 1:) = 1
write(2, "370", 3370) = 3
write(2, ":(", 2:() = 2
write(2, "snd_pcm_mmap", 12snd_pcm_mmap) = 12
write(2, ") ", 2) ) = 2
write(2, "mmap failed", 11mmap failed) = 11
write(2, ": ", 2: ) = 2
write(2, "No such device", 14No such device) = 14
write(2, "\n", 1) = 1
...
_exit(1) = ?
Process 163 detached
root:/usr/share/alsa/cards> strace arecord --mmap
Mybootlog looks like that:
U-Boot 1.1.6 (ADI-2008R1.5) (Apr 14 2009 - 16:55:58)
CPU: ADSP bf527-0.0 (Detected Rev: 0.0)
Board: ADI BF527 EZ-Kit board
Support: blackfin.uclinux.org/
Clock: VCO: 525 MHz, Core: 525 MHz, System: 131 MHz
RAM: 64 MB
Flash: 4 MB
In: serial
Out: serial
Err: serial
Net: Blackfin EMAC
MAC: 00:E0:22:FE:BC:04
Hit any key to stop autoboot: 0
## Booting image at 01000000 ...
Image Name: Linux-2.6.22.19-ADI-2008R1.5-svn
Created: 2009-06-23 20:19:20 UTC
Image Type: Blackfin Linux Kernel Image (gzip compressed)
Data Size: 976569 Bytes = 953.7 kB
Load Address: 00001000
Entry Point: 0019a000
Verifying Checksum ... OK
Uncompressing Kernel Image ... OK
Starting Kernel at = 19a000
Linux version 2.6.22.19-ADI-2008R1.5-svn6845 (user@debby) (gcc version 4.1.2 (ADI svn)) #30 Tue Jun 23 22:19:04 CEST 2009
early printk enabled on early_BFuart0
Hardware Trace Active and Enabled
Blackfin support (C) 2004-2007 Analog Devices, Inc.
Compiled for ADSP-BF527 Rev 0.0
Warning: Unsupported Chip Revision ADSP-BF527 Rev 0.0 detected
Blackfin Linux support by blackfin.uclinux.org/
Processor Speed: 525 MHz core clock and 131 MHz System Clock
Board Memory: 64MB
Kernel Managed Memory: 64MB
Memory map:
text = 0x00001000-0x0012b8b0
rodata = 0x0012c000-0x00185328
data = 0x00186000-0x0019a000
stack = 0x00186000-0x00188000
init = 0x0019a000-0x001b4000
bss = 0x001b4000-0x001c3db0
available = 0x001c3db0-0x03eff000
DMA Zone = 0x03f00000-0x04000000
NOMPU: setting up cplb tables for global access
Instruction Cache Enabled
Data Cache Enabled (write-through)
Built 1 zonelists. Total pages: 16002
Kernel command line: root=/dev/mtdblock2 rw rootfstype=jffs2 earlyprintk=serial,uart1,57600 console=tty0 console=ttyBF0,57600
Configuring Blackfin Priority Driven Interrupts
PID hash table entries: 256 (order: 8, 1024 bytes)
console handover: boot [early_BFuart0] -> real [ttyBF0]
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory available: 62124k/65536k RAM, (104k init code, 1194k kernel code, 505k data, 1024k dma, 584k reserved)
Blackfin Scratchpad data SRAM: 4 KB
Blackfin Data A SRAM: 16 KB (15 KB free)
Blackfin Data B SRAM: 16 KB (16 KB free)
Blackfin Instruction SRAM: 48 KB (40 KB free)
Security Framework v1.0.0 initialized
Mount-cache hash table entries: 512
NET: Registered protocol family 16
Blackfin GPIO Controller
Blackfin DMA Controller
stamp_init(): registering device resources
Generic PHY: Registered new driver
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
JFFS2 version 2.2. (NAND) Â 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler anticipatory registered (default)
io scheduler cfq registered
bfin-otp: initialized
bfin-wdt: initialized: timeout=20 sec (nowayout=0)
Serial: Blackfin serial driver
bfin-uart.1: ttyBF0 at MMIO 0xffc02000 (irq = 31) is a BFIN-UART
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
bfin_mac_mdio: probed
bfin_mac: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=25)@sclk=131MHz)
bfin_mac: Version 1.1, Blackfin BF53[67] BF527 on-chip Ethernet MAC driver
physmap platform flash device: 00400000 at 20000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
Amd/Fujitsu Extended Query Table at 0x0040
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
Using physmap partition information
Creating 3 MTD partitions on "physmap-flash.0":
0x00000000-0x00030000 : "Bootloader"
0x00030000-0x00130000 : "Kernel"
0x00130000-0x00400000 : "RootFS"
bfin-spi bfin-spi.0: Blackfin BF5xx on-chip SPI Contoller Driver, Version 1.0, regs_base@ffc00500, dma channel@7
rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0
i2c /dev entries driver
i2c-bfin-twi i2c-bfin-twi.0: Blackfin BF5xx on-chip I2C TWI Contoller Driver, Version 1.8, regs_base@ffc01400
Advanced Linux Sound Architecture Driver Version 1.0.12rc1 (Thu Jun 22 13:55:50 2006 UTC).
ASoC version 0.13.1
dma rx:3 tx:4, err irq:15, regs:ffc00800
ssm2602 Audio Codec 0.1<6>dma_alloc_init: dma_page @ 0x03eb3000 - 256 pages at 0x03f00000
asoc: SSM2602 <-> bf5xx-i2s-0 mapping ok
ALSA device list:
#0: bf5xx_ssm2602 (SSM2602)
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
rtc-bfin rtc-bfin: setting the system clock to 1970-01-01 04:40:19 (16819)
VFS: Mounted root (jffs2 filesystem).
Freeing unused kernel memory: 104k freed
_____________________________________
a8888b. / Welcome to the uClinux distribution \
d888888b. / _ _ \
8P"YP"Y88 / | | |_| __ __ (TM) |
8|o||o|88 _____/ | | _ ____ _ _ \ \/ / |
8' .88 \ | | | | _ \| | | | \ / |
8`._.' Y8. \ | |__ | | | | | |_| | / \ |
d/ `8b. \ \____||_|_| |_|\____|/_/\_\ |
dP . Y8b. \ For embedded processors including |
d8:' " `::88b \ the Analog Devices Blackfin /
d8" 'Y88b \___________________________________/
:8P ' :888
8a. : _a88P For further information, check out:
._/"Yaa_: .| 88P| - blackfin.uclinux.org/
\ YP" `| 8P `. - docs.blackfin.uclinux.org/
/ \.___.d| .' - www.uclinux.org/
`--..__)8888P`._.' jgs/a:f - www.analog.com/blackfin
Have a lot of fun...
BusyBox v1.4.1 (2009-06-07 11:44:39 CEST) Built-in shell (msh)
Enter 'help' for a list of built-in commands.
My /dev looks like that:
root:/> ls -lisaR /dev
/dev:
38 0 drwxr-xr-x 4 root root 0 Jan 1 04:40 .
1 0 drwxr-xr-x 15 root root 0 Jan 1 00:00 ..
317 0 crw------- 1 root root 5, 1 Jan 1 04:40 console
348 0 crw-rw---- 1 root root 1, 7 Jan 1 02:22 full
343 0 crw-rw---- 1 root root 89, 0 Jan 1 02:22 i2c-0
349 0 crw-rw---- 1 root root 1, 2 Jan 1 02:22 kmem
345 0 crw-rw---- 1 root root 1, 11 Jan 1 02:22 kmsg
373 0 srw-rw-rw- 1 root root 0 Jan 1 04:40 log
350 0 crw-rw---- 1 root root 1, 1 Jan 1 02:22 mem
321 0 brw-rw---- 1 root root 31, 0 Jan 1 02:22 mtdblock0
320 0 brw-rw---- 1 root root 31, 1 Jan 1 02:22 mtdblock1
318 0 brw-rw---- 1 root root 31, 2 Jan 1 02:22 mtdblock2
315 0 crw-rw-rw- 1 root root 1, 3 Jun 7 2009 null
344 0 crw-rw---- 1 root root 253, 0 Jan 1 02:22 otp
354 0 crw-rw---- 1 root root 5, 2 Jan 1 02:22 ptmx
1 0 drwxr-xr-x 2 root root 0 Jan 1 2007 pts
337 0 brw-rw---- 1 root root 1, 0 Jan 1 02:22 ram0
336 0 brw-rw---- 1 root root 1, 1 Jan 1 02:22 ram1
327 0 brw-rw---- 1 root root 1, 10 Jan 1 02:22 ram10
326 0 brw-rw---- 1 root root 1, 11 Jan 1 02:22 ram11
325 0 brw-rw---- 1 root root 1, 12 Jan 1 02:22 ram12
324 0 brw-rw---- 1 root root 1, 13 Jan 1 02:22 ram13
323 0 brw-rw---- 1 root root 1, 14 Jan 1 02:22 ram14
322 0 brw-rw---- 1 root root 1, 15 Jan 1 02:22 ram15
335 0 brw-rw---- 1 root root 1, 2 Jan 1 02:22 ram2
334 0 brw-rw---- 1 root root 1, 3 Jan 1 02:22 ram3
333 0 brw-rw---- 1 root root 1, 4 Jan 1 02:22 ram4
332 0 brw-rw---- 1 root root 1, 5 Jan 1 02:22 ram5
331 0 brw-rw---- 1 root root 1, 6 Jan 1 02:22 ram6
330 0 brw-rw---- 1 root root 1, 7 Jan 1 02:22 ram7
329 0 brw-rw---- 1 root root 1, 8 Jan 1 02:22 ram8
328 0 brw-rw---- 1 root root 1, 9 Jan 1 02:22 ram9
347 0 crw-rw---- 1 root root 1, 8 Jan 1 02:22 random
319 0 lrwxrwxrwx 1 root root 9 Jan 1 02:22 root -> mtdblock2
351 0 crw-rw---- 1 root root 254, 0 Jan 1 02:22 rtc0
338 0 drw-r--r-- 2 root root 0 Jan 1 02:22 snd
355 0 crw-rw---- 1 root root 5, 0 Jan 1 02:22 tty
353 0 crw-rw---- 1 root root 204, 64 Jan 1 02:22 ttyBF0
346 0 crw-rw---- 1 root root 1, 9 Jan 1 02:22 urandom
352 0 crw-rw---- 1 root root 10, 130 Jan 1 02:22 watchdog
316 0 crw-rw-rw- 1 root root 1, 5 Jun 7 2009 zero
/dev/pts:
1 0 drwxr-xr-x 2 root root 0 Jan 1 2007 .
38 0 drwxr-xr-x 4 root root 0 Jan 1 04:40 ..
/dev/snd:
338 0 drw-r--r-- 2 root root 0 Jan 1 02:22 .
38 0 drwxr-xr-x 4 root root 0 Jan 1 04:40 ..
339 0 crwxrwxrwx 1 root root 116, 0 Jan 1 02:22 controlC0
340 0 crwxrwxrwx 1 root root 116, 24 Jan 1 02:22 pcmC0D0c
341 0 crwxrwxrwx 1 root root 116, 16 Jan 1 02:22 pcmC0D0p
342 0 crwxrwxrwx 1 root root 116, 33 Jan 1 02:22 timer
root:/>
My Kernel config relating Sound is as follows:
#
# Sound
#
CONFIG_SOUND=y
#
# Advanced Linux Sound Architecture
#
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
# CONFIG_SND_SEQUENCER is not set
# CONFIG_SND_MIXER_OSS is not set
# CONFIG_SND_PCM_OSS is not set
# CONFIG_SND_DYNAMIC_MINORS is not set
# CONFIG_SND_SUPPORT_OLD_API is not set
CONFIG_SND_VERBOSE_PROCFS=y
CONFIG_SND_VERBOSE_PRINTK=y
CONFIG_SND_DEBUG=y
CONFIG_SND_DEBUG_DETECT=y
CONFIG_SND_PCM_XRUN_DEBUG=y
#
# Generic devices
#
# CONFIG_SND_DUMMY is not set
# CONFIG_SND_MTPAV is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_MPU401 is not set
#
# ALSA Blackfin devices
#
# CONFIG_SND_BLACKFIN_AD1836 is not set
# CONFIG_SND_BFIN_AD73311 is not set
# CONFIG_SND_BFIN_AD73322 is not set
#
# System on Chip audio support
#
CONFIG_SND_SOC=y
CONFIG_SND_BF5XX_SOC=y
CONFIG_SND_MMAP_SUPPORT=y
CONFIG_SND_BF5XX_SOC_I2S=y
CONFIG_SND_BF5XX_SOC_SSM2602=y
CONFIG_SND_BF5XX_SOC_SSM2602_ADDR=0x1b
# CONFIG_SND_BF5XX_SOC_BF5xx is not set
CONFIG_SND_BF5XX_SPORT_NUM=0
# CONFIG_SND_BF5XX_HAVE_COLD_RESET is not set
CONFIG_SND_SOC_SSM2602=y
#
# Open Sound System
#
# CONFIG_SOUND_PRIME is not set
When I don't use mmap the sound is working. Does anyone have to hint for me how to solve this?
QuoteReplyEditDelete
2009-06-24 09:00:43 Re: alsa mmap doesn't work in 2008R1.5 on bf527
Mike Frysinger (UNITED STATES)
Message: 76240
the mmap() code was implemented for the AD1980 only. if you want to use it with other codecs, you'll probably have to write your own alsa card configuration file. look in lib/alsa-lib/Makefile and the referenced files.
QuoteReplyEditDelete
2009-06-24 09:18:31 Re: alsa mmap doesn't work in 2008R1.5 on bf527
Stefan Wanja (GERMANY)
Message: 76241
Do you mean by writing my own /usr/share/alsa/alsa.conf file I can get it working? Or do I have to edit some configuration in the source code and rebuild it to make it work?
The ssm2602 kernel module itself has support for mmap, is that right?
QuoteReplyEditDelete
2009-06-24 10:10:25 Re: alsa mmap doesn't work in 2008R1.5 on bf527
Stefan Wanja (GERMANY)
Message: 76251
I'm confused. As I have understood this so far, implementing mmap is not codec specific. It depends only the sport and dma implementation which is shared by some codecs? And the implementation in 2008R1.5 seems to include mmap. That is the kernel part of it. Does alsa-lib and it's config files have anything to do with mmap (codec specific)?
QuoteReplyEditDelete
2009-06-24 23:37:22 Re: alsa mmap doesn't work in 2008R1.5 on bf527
Cliff Cai (CHINA)
Message: 76286
Try 2009R1 ,it supports mmap for ssm2602.
Cliff
QuoteReplyEditDelete
2009-06-30 06:59:37 Re: alsa mmap doesn't work in 2008R1.5 on bf527
Stefan Wanja (GERMANY)
Message: 76518
Hey Cliff,
thanks for your response. I've been working with the trunk version recently and there it was working, right. What I am interested in is, what is the important change that happened from 2008 to 2009? When I look at the kernel sound driver files the changes seem to be not very complex. Was there an important change in alsa lib? I'm asking because we want to develop a new driver for the codecs we are using. Could you give me some advice or point me to some?
Kind regards,
Stefan