Skip to content
Commit d212dcf6 authored by Matthias Reichl's avatar Matthias Reichl Committed by DigitalDreamtime
Browse files

dmaengine: bcm2835: Avoid splitting periods into very small chunks



The current cyclic DMA period splitting implementation can generate
very small chunks at the end of each period. For example a 65536 byte
period will be split into a 65532 byte chunk and a 4 byte chunk on
the "lite" DMA channels.

This increases pressure on the RAM controller as the DMA controller
needs to fetch two control blocks from RAM in quick succession and
could potentially cause latency issues if the RAM is tied up by other
devices.

We can easily avoid these situations by distributing the remaining
length evenly between the last-but-one and the last chunk, making
sure that split chunks will be at least half the maximum length the
DMA controller can handle.

This patch checks if the last chunk would be less than half of
the maximum DMA length and if yes distributes the max len+4...max_len*1.5
bytes evenly between the last 2 chunks. This results in chunk sizes
between max_len/2 and max_len*0.75 bytes.

Signed-off-by: default avatarMatthias Reichl <hias@horus.com>
Signed-off-by: default avatarMartin Sperl <kernel@martin.sperl.org>
Tested-by: default avatarClive Messer <clive.messer@digitaldreamtime.co.uk>
parent 51c0665b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment