summaryrefslogtreecommitdiff
path: root/drivers/media/platform/atmel/atmel-isc.h
diff options
context:
space:
mode:
authorEugen Hristev <eugen.hristev@microchip.com>2022-05-03 10:44:18 +0200
committerMauro Carvalho Chehab <mchehab@kernel.org>2022-05-13 11:02:21 +0200
commit314c96e5203de1bac744e8536ef20b195f460674 (patch)
tree02e74a153647616051b83e7e3e16de13988cf854 /drivers/media/platform/atmel/atmel-isc.h
parent91f49b80983f7bffdea9498209b2b896231ac776 (diff)
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>
Diffstat (limited to 'drivers/media/platform/atmel/atmel-isc.h')
-rw-r--r--drivers/media/platform/atmel/atmel-isc.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/media/platform/atmel/atmel-isc.h b/drivers/media/platform/atmel/atmel-isc.h
index f9ad7ec6bd13..ff60ba020cb9 100644
--- a/drivers/media/platform/atmel/atmel-isc.h
+++ b/drivers/media/platform/atmel/atmel-isc.h
@@ -218,6 +218,7 @@ struct isc_reg_offsets {
*
* @lock: lock for serializing userspace file operations
* with ISC operations
+ * @awb_mutex: serialize access to streaming status from awb work queue
* @awb_lock: lock for serializing awb work queue operations
* with DMA/buffer operations
*
@@ -290,6 +291,7 @@ struct isc_device {
struct work_struct awb_work;
struct mutex lock;
+ struct mutex awb_mutex;
spinlock_t awb_lock;
struct regmap_field *pipeline[ISC_PIPE_LINE_NODE_NUM];