]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
staging: media: tegra-video: vi: add flip controls only if no source controls are...
authorSvyatoslav Ryhel <clamor95@gmail.com>
Tue, 3 Mar 2026 08:42:26 +0000 (10:42 +0200)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Thu, 19 Mar 2026 07:18:35 +0000 (08:18 +0100)
Because the current Tegra video driver is video-centric, it exposes all
controls via /dev/video. If both the camera sensor and the VI provide
hflip and vflip, the driver will fail because only one control is allowed.
To address this, hflip and vflip should be added from the SoC only if the
camera sensor doesn't provide those controls.

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>
drivers/staging/media/tegra-video/vi.c

index e0961bc0a0175887ce52fa4482e9c10e69b7b300..19eebfdae2216a4c6dfc9d3ea200925cc4eb8260 100644 (file)
@@ -962,6 +962,7 @@ static int tegra_channel_setup_ctrl_handler(struct tegra_vi_channel *chan)
        }
 #else
        struct v4l2_subdev *subdev;
+       struct v4l2_ctrl *hflip, *vflip;
 
        /* custom control */
        v4l2_ctrl_new_custom(&chan->ctrl_handler, &syncpt_timeout_ctrl, NULL);
@@ -987,11 +988,13 @@ static int tegra_channel_setup_ctrl_handler(struct tegra_vi_channel *chan)
                return ret;
        }
 
-       if (chan->vi->soc->has_h_v_flip) {
+       hflip = v4l2_ctrl_find(subdev->ctrl_handler, V4L2_CID_HFLIP);
+       if (chan->vi->soc->has_h_v_flip && !hflip)
                v4l2_ctrl_new_std(&chan->ctrl_handler, &vi_ctrl_ops, V4L2_CID_HFLIP, 0, 1, 1, 0);
-               v4l2_ctrl_new_std(&chan->ctrl_handler, &vi_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0);
-       }
 
+       vflip = v4l2_ctrl_find(subdev->ctrl_handler, V4L2_CID_VFLIP);
+       if (chan->vi->soc->has_h_v_flip && !vflip)
+               v4l2_ctrl_new_std(&chan->ctrl_handler, &vi_ctrl_ops, V4L2_CID_VFLIP, 0, 1, 1, 0);
 #endif
 
        /* setup the controls */