Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

staging: media: tegra-video: vi: adjust get_selection operation check

During __tegra_channel_try_format, the VI (Video Input) checks if the
camera sensor driver provides a get_selection operation. If this operation
is unavailable, the crop is set to 0. However, if the operation is
available but returns an error, the VI currently fails.

While this works for simple cameras with a single pad, it creates a corner
case for sensors like the mt9m114. This sensor provides the same operation
set for both IFP pads, but returns an error when get_selection is called
on an unsupported pad (such as the source pad), causing the aforementioned
behavior.

To resolve this, if get_selection is implemented but returns an error,
try_crop is now set to 0 — treating it as if the operation was not
implemented — instead of returning a failure.

Tested-by: Luca Ceresoli <luca.ceresoli@bootlin.com> # tegra20, parallel camera
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Svyatoslav Ryhel and committed by
Hans Verkuil
8a501119 410ff945

+2 -8
+2 -8
drivers/staging/media/tegra-video/vi.c
··· 476 476 fse.code = fmtinfo->code; 477 477 ret = v4l2_subdev_call(subdev, pad, enum_frame_size, sd_state, &fse); 478 478 if (ret) { 479 - if (!v4l2_subdev_has_op(subdev, pad, get_selection)) { 479 + if (!v4l2_subdev_has_op(subdev, pad, get_selection) || 480 + v4l2_subdev_call(subdev, pad, get_selection, NULL, &sdsel)) { 480 481 try_crop->width = 0; 481 482 try_crop->height = 0; 482 483 } else { 483 - ret = v4l2_subdev_call(subdev, pad, get_selection, 484 - NULL, &sdsel); 485 - if (ret) { 486 - ret = -EINVAL; 487 - goto out_free; 488 - } 489 - 490 484 try_crop->width = sdsel.r.width; 491 485 try_crop->height = sdsel.r.height; 492 486 }