]> git.baikalelectronics.ru Git - kernel.git/commit
media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming
authorEugen Hristev <eugen.hristev@microchip.com>
Tue, 3 May 2022 08:44:18 +0000 (10:44 +0200)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Fri, 13 May 2022 09:02:21 +0000 (11:02 +0200)
commitc8caa61bbdb224f955bed8ccf5538060930934fd
tree02e74a153647616051b83e7e3e16de13988cf854
parenta98102efdae399bbf1dc36a475c702a1a8adbc21
media: atmel: atmel-isc-base: use mutex to lock awb workq from streaming

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: Eugen Hristev <eugen.hristev@microchip.com>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/platform/atmel/atmel-isc-base.c
drivers/media/platform/atmel/atmel-isc.h