• Eugen Hristev's avatar
    media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming · 314c96e5
    Eugen Hristev authored
    The AWB workqueue runs in a kernel thread and needs to be synchronized
    w.r.t. the streaming status.
    It is possible that streaming is stopped while the AWB workq is running.
    In this case it is likely that the check for vb2_start_streaming_called is
    done at one point in time, but the AWB computations are done later,
    including a call to isc_update_profile, which requires streaming to be
    started.
    Thus , isc_update_profile will fail if during this operation sequence the
    streaming was stopped.
    To solve this issue, a mutex is added, that will serialize the awb work and
    streaming stopping, with the mention that either streaming is stopped
    completely including termination of the last frame is done, and after that
    the AWB work can check stream status and stop; either first AWB work is
    completed and after that the streaming can stop correctly.
    The awb spin lock cannot be used since this spinlock is taken in the same
    context and using it in the stop streaming will result in a recursion BUG.
    Signed-off-by: default avatarEugen Hristev <eugen.hristev@microchip.com>
    Reviewed-by: default avatarJacopo Mondi <jacopo@jmondi.org>
    Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
    Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
    314c96e5
atmel-isc.h 9.79 KB