]> git.baikalelectronics.ru Git - kernel.git/commit
media: atmel: atmel-isc: limit incoming pixels per frame
authorEugen Hristev <eugen.hristev@microchip.com>
Fri, 12 Apr 2019 10:19:40 +0000 (06:19 -0400)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Wed, 8 May 2019 17:55:09 +0000 (13:55 -0400)
commitb503ae927286396f37972ba0377fd26240f3ec05
treed5b84546d942d31164109d9cfbb915b13faaa916
parentbf6606ef3f9a3d54175015a9a4c455e1fbb6c7d5
media: atmel: atmel-isc: limit incoming pixels per frame

This will limit the incoming pixels per frame from the sensor.
Currently, the ISC will stop sampling the frame only when the vsync/hsync
are detected.
If we misconfigure the resolution in the sensor w.r.t. resolution in the ISC,
the buffer used for DMA in the ISC will be smaller than the number of pixels
that the ISC DMA engine will copy.
In this case it happens that the DMA will overwrite parts of the memory which
should not be written, leading to memory corruption.
To avoid this situation, use the PFE CFG1 and PFE CFG2 registers, which crop
the incoming frame to the resolution that we configure.
This way the DMA engine will never write more data than we expect it to.

Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/atmel/atmel-isc-regs.h
drivers/media/platform/atmel/atmel-isc.c