MLK-21459: mxc-jpeg: Jpeg encoder/decoder multi-instance crash
Reserve a slot for each context and allocate the slot data at open,
deallocate slot data at release and free that slot.
The device was already holding the array of slots.
The maximum number of slots allowed per device is currently limited to 1
for encoder and 1 for decoder, but the hardware supports 4+4.
Use GFP_ATOMIC for dma_zalloc_coherent, as we are holding a lock.
Also fix potential decoder bug when stm_ctrl is not properly cleared before
setting a new image format. This could be observed when decoding an
yuv420 image (img_fmt=0000b) after an yuv444 image (0011b), but only if
the descriptor is being reused.
Removed some debug logs and updated a comment.
Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Reviewed-by: Robert Chiras <robert.chiras@nxp.com>