• Takashi Iwai's avatar
    staging: bcm2835-audio: Operate non-atomic PCM ops · d7ca3a71
    Takashi Iwai authored
    This is the most significant part in the patch series.
    
    The bcm2835-audio driver used to queue the commands to vc04 core via
    workqueue, but basically the whole accesses to vc04 core are done in
    the sleepable context, including the callback calls.  In such a case,
    rewriting the code using non-atomic PCM ops will simplify the logic a
    lot.
    
    This patch does it: all workqueue are gone and each former-work
    implementation is now directly called from PCM ops like trigger and
    write transfer.
    
    Along with it, the DMA position updater, bcm2835_playback_fifo(), was
    also rewritten to use a simpler logic.  Now it handles the XRUN and
    draining properly by calling snd_pcm_stop() conditionally.
    
    The current position is kept in atomic_t value so that it can be read
    concurrently from the pointer callback.
    
    Also, the bcm2835_audio_instance object is allocated at the beginning
    of bcm2835_audio_open().  This makes the resource management clearer.
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    Tested-by: default avatarStefan Wahren <stefan.wahren@i2se.com>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    d7ca3a71
bcm2835-pcm.c 11 KB