• Qipan Li's avatar
    serial: sirf: use hrtimer for data rx · 0f17e3b4
    Qipan Li authored
    when the serial works as a bluetooth sink, due to audio realtime
    requirement, the driver should have something similar with ALSA:
    1. one big DMA buffer to easy the schedule jitter
    2. split this big DMA buffer to multiple small periods, for each
    period, we get a DMA interrupt, then push the data to userspace.
    the small periods will easy the audio latency.
    
    so ALSA generally uses a cyclic chained DMA.
    
    but for sirfsoc, the dma hardware has the limitation: we have
    only two loops in the cyclic mode, so we can only support two
    small periods to switch. if we make the DMA buffer too big, we
    get long latency, if we make the DMA buffer too little, we get
    miss in scheduling for audio realtime.
    
    so this patch moves to use a hrtimer to simulate the cyclic
    DMA, then we can have a big buffer, and also have a timely
    data push to users as the hrtimer can generate in small period
    then actual HW interrupts.
    
    with this patch, we also delete a lot of complex codes to handle
    loop buffers, and RX timeout interrupt since the RX work can be
    completely handled from hrtimer interrupt.
    
    tests show using this way will make our bad audio streaming be-
    come smooth.
    Signed-off-by: default avatarQipan Li <Qipan.Li@csr.com>
    Signed-off-by: default avatarBarry Song <Baohua.Song@csr.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    0f17e3b4
sirfsoc_uart.h 13 KB