You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just did a few tests with my Cirrus kernel build (based on top of rpi-4.0.y) with MMAP enabled and it worked fine, too. With MMAP aplay is able to play back 24bit WAVs which won't work without MMAP support.
I think we should do some more testing with the various cards (I only have Wolfson/Cirrus cards here), maybe MMAP works fine with the current kernel tree and it's just a matter of adding back the info flags.
I do not know how exactly MMAP is implemented, but it seems to rely on some kind of advanced memory management of the DMA engine or maybe there is still a bug in the driver itself or ALSA.
Anyway, under some constellations, playing back a file that require MMAP and afterwards recording in 24-bit sometimes result in having a loop of the previously played file in the record instead of the recorded audio signal or no signal at all.
Since I was not able to further debug this issue, I decided to disable MMAP, since don't having a feature is better than to have a feature that results in unreliable behavior.
If you decide to enable it per default, it would be very advisable to test it with a wide range of different files with different formats, recording formats and hardware that does support 24-bit and hardware that does not.
I've pushed a commit that makes the MMAP support conditional on a DT property. After rebuilding and copying the kernel, modules and overlays to your SD card, add:
@pelwell could you include the commit in the 4.0 tree as well?
I did several tests with my Cirrus card and the driver rebased
onto rpi-3.18.y and so far everything went well.
First I played a testfile, tried with different samplerates
and 16/24/32 bit. The (packed) 24bit wavs required MMAP support,
for the others I tried both without MMAP and with forced MMAP
(aplay -M).
Immediately afterwards I recorded an audio file. Tried with 44.1
and 48kHz, 16/24/32 bit and also without and with MMAP (arecord -M).
After recording I played back the recorded file, also sometimes
tried with aplay -M.
I did some 15 play-record-play runs and didn't see any of the
issues koalo wrote about.
The only issue I ran into was playback not starting together with a
bcm2708-dmaengine bcm2708-dmaengine: DMA transfer could not be terminated
entry in dmesg. But I think that's unrelated to MMAP support, I saw
this before without MMAP support too (not sure if it's a bug in
the Cirrus driver or somewhere else).
Sounds good. Do you have any idea where is this enabled now in the source?
sound/soc/soc-generic-dmaengine-pcm.c
All I2S devices using soc-generic-dmaengine implicitly have MMAP
capabilities.
see dmaengine_pcm_set_runtime_hwparams:
...
hw.info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
SNDRV_PCM_INFO_INTERLEAVED;
Activity
HiassofT commentedon Jun 4, 2015
MMAP support was present in the inital version of bcm2708-i2s but shortly afterwards removed in commit 62c05a0.
It's not quite clear to me what the strange issues actually were/are.
Ping @koalo, could you elaborate on this?
Ragnar Jensen provides a Wolfson/Cirrus card kernel build with MMAP support enabled and it seems to be working very well.
http://www.element14.com/community/message/149403/l/re-cirrus-logic-audio-card-working-on-the-raspberry-pi-2#149403
I just did a few tests with my Cirrus kernel build (based on top of rpi-4.0.y) with MMAP enabled and it worked fine, too. With MMAP aplay is able to play back 24bit WAVs which won't work without MMAP support.
This is the patch I used when testing:
I think we should do some more testing with the various cards (I only have Wolfson/Cirrus cards here), maybe MMAP works fine with the current kernel tree and it's just a matter of adding back the info flags.
pelwell commentedon Jun 4, 2015
If that's all it takes, I can add a custom DT property to enable MMAP support and expose it via a dtparam setting.
koalo commentedon Jun 4, 2015
I do not know how exactly MMAP is implemented, but it seems to rely on some kind of advanced memory management of the DMA engine or maybe there is still a bug in the driver itself or ALSA.
Anyway, under some constellations, playing back a file that require MMAP and afterwards recording in 24-bit sometimes result in having a loop of the previously played file in the record instead of the recorded audio signal or no signal at all.
Since I was not able to further debug this issue, I decided to disable MMAP, since don't having a feature is better than to have a feature that results in unreliable behavior.
If you decide to enable it per default, it would be very advisable to test it with a wide range of different files with different formats, recording formats and hardware that does support 24-bit and hardware that does not.
bcm2708-i2s: Enable MMAP support via a DT property and overlay
pelwell commentedon Jun 5, 2015
I've pushed a commit that makes the MMAP support conditional on a DT property. After rebuilding and copying the kernel, modules and overlays to your SD card, add:
to
config.txt.kernel: bcm2708-i2s: Enable MMAP support via a DT property and overlay
kernel: bcm2708-i2s: Enable MMAP support via a DT property and overlay
pelwell commentedon Jun 8, 2015
The latest firmware (Hexxeh/rpi-firmware@9ad0e75) contains the updated module and overlay. Please try it and comment on your findings.
HiassofT commentedon Jun 8, 2015
Thanks a lot for the explanation and the commit!
@pelwell could you include the commit in the 4.0 tree as well?
I did several tests with my Cirrus card and the driver rebased
onto rpi-3.18.y and so far everything went well.
First I played a testfile, tried with different samplerates
and 16/24/32 bit. The (packed) 24bit wavs required MMAP support,
for the others I tried both without MMAP and with forced MMAP
(aplay -M).
Immediately afterwards I recorded an audio file. Tried with 44.1
and 48kHz, 16/24/32 bit and also without and with MMAP (arecord -M).
After recording I played back the recorded file, also sometimes
tried with aplay -M.
I did some 15 play-record-play runs and didn't see any of the
issues koalo wrote about.
The only issue I ran into was playback not starting together with a
entry in dmesg. But I think that's unrelated to MMAP support, I saw
this before without MMAP support too (not sure if it's a bug in
the Cirrus driver or somewhere else).
bcm2708-i2s: Enable MMAP support via a DT property and overlay
pelwell commentedon Jun 8, 2015
Pushed.
BCM2708: Add I2S support to board file
BCM2708: Add I2S support to board file
BCM2708: Add I2S support to board file
BCM2708: Add I2S support to board file
133 remaining items
bcm2835-i2s: Enable MMAP support via a DT property
bcm2835-i2s: Enable MMAP support via a DT property
bcm2835-i2s: Enable MMAP support via a DT property
bcm2835-i2s: Enable MMAP support via a DT property
bcm2835-i2s: Enable MMAP support via a DT property
bcm2835-i2s: Enable MMAP support via a DT property
bcm2835-i2s: Enable MMAP support via a DT property
bcm2835-i2s: Enable MMAP support via a DT property
kernel: bcm2708-i2s: Enable MMAP support via a DT property and overlay
agherzan commentedon Apr 25, 2017
@popcornmix Any idea why this overlay (i2s-mmap) is not available anymore in 4.9?
HiassofT commentedon Apr 25, 2017
agherzan commentedon Apr 25, 2017
Sounds good. Do you have any idea where is this enabled now in the source?
HiassofT commentedon Apr 25, 2017
agherzan commentedon May 1, 2017
Thanks @HiassofT . That makes sense.