media: stm32-dcmi: g_/s_selection crop support
authorHugues Fruchet <hugues.fruchet@st.com>
Tue, 22 Aug 2017 14:41:11 +0000 (10:41 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Sat, 26 Aug 2017 18:10:41 +0000 (14:10 -0400)
commitd533d5010ec373ea06ae4f253d7d69deb3fe0cfd
treea1cca0d98da33c391af75f0b64279e0cef1c982a
parent38e423ee00b6138f8fafba60f2b6f4f3ebfeb1fa
media: stm32-dcmi: g_/s_selection crop support

Implements g_/s_selection crop support by using DCMI crop
hardware feature.
User can first get the maximum supported resolution of the sensor
by calling g_selection(V4L2_SEL_TGT_CROP_BOUNDS).
Then user call to s_selection(V4L2_SEL_TGT_CROP) will reset sensor
to its maximum resolution and crop request is saved for later usage
in s_fmt().
Next call to s_fmt() will check if sensor can do frame size request
with crop request. If sensor supports only discrete frame sizes,
the frame size which is larger than user request is selected in
order to be able to match the crop request. Then s_fmt() resolution
user request is adjusted to match crop request resolution.

Signed-off-by: Hugues Fruchet <hugues.fruchet@st.com>
Signed-off-by: Hans Verkuil <hansverk@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/platform/stm32/stm32-dcmi.c