• Pierre-Louis Bossart's avatar
    ASoC: soc-pcm: test refcount before triggering · 6479f758
    Pierre-Louis Bossart authored
    On start/pause_release/resume, when more than one FE is connected to
    the same BE, it's possible that the trigger is sent more than
    once. This is not desirable, we only want to trigger a BE once, which
    is straightforward to implement with a refcount.
    
    For stop/pause/suspend, the problem is more complicated: the check
    implemented in snd_soc_dpcm_can_be_free_stop() may fail due to a
    conceptual deadlock when we trigger the BE before the FE. In this
    case, the FE states have not yet changed, so there are corner cases
    where the TRIGGER_STOP is never sent - the dual case of start where
    multiple triggers might be sent.
    
    This patch suggests an unconditional trigger in all cases, without
    checking the FE states, using a refcount protected by a spinlock.
    Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
    Message-Id: <20210817164054.250028-3-pierre-louis.bossart@linux.intel.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    6479f758
soc-dpcm.h 5.24 KB