From: Svyatoslav Ryhel <clamor95@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>,
Thierry Reding <thierry.reding@kernel.org>,
Jonathan Hunter <jonathanh@nvidia.com>,
Sowjanya Komatineni <skomatineni@nvidia.com>,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Svyatoslav Ryhel <clamor95@gmail.com>,
Hans Verkuil <hverkuil+cisco@kernel.org>,
Mikko Perttunen <mperttunen@nvidia.com>
Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-staging@lists.linux.dev
Subject: [PATCH v2 04/15] media: tegra-video: vi: Drop subdevice passthrough and input ioctls
Date: Sun, 29 Nov 2026 20:07:11 +0200 [thread overview]
Message-ID: <20261129180722.142186-5-clamor95@gmail.com> (raw)
In-Reply-To: <20261129180722.142186-1-clamor95@gmail.com>
Drop V4L2 video device ioctl callbacks in tegra_channel_ioctl_ops that
simply proxy stream parameters, frame intervals, selection, EDID, or DV
timings to the remote source subdevice, as part of moving the driver to a
media-controller pipeline model.
Signed-off-by: Svyatoslav Ryhel <clamor95@gmail.com>
---
.../media/platform/nvidia/tegra-video/vi.c | 269 +-----------------
1 file changed, 1 insertion(+), 268 deletions(-)
diff --git a/drivers/media/platform/nvidia/tegra-video/vi.c b/drivers/media/platform/nvidia/tegra-video/vi.c
index 1df4700ab35d6..af66002541f0c 100644
--- a/drivers/media/platform/nvidia/tegra-video/vi.c
+++ b/drivers/media/platform/nvidia/tegra-video/vi.c
@@ -308,26 +308,6 @@ static int tegra_channel_querycap(struct file *file, void *fh,
return 0;
}
-static int tegra_channel_g_parm(struct file *file, void *fh,
- struct v4l2_streamparm *a)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- return v4l2_g_parm_cap(&chan->video, subdev, a);
-}
-
-static int tegra_channel_s_parm(struct file *file, void *fh,
- struct v4l2_streamparm *a)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- return v4l2_s_parm_cap(&chan->video, subdev, a);
-}
-
static int tegra_channel_enum_framesizes(struct file *file, void *fh,
struct v4l2_frmsizeenum *sizes)
{
@@ -358,38 +338,6 @@ static int tegra_channel_enum_framesizes(struct file *file, void *fh,
return 0;
}
-static int tegra_channel_enum_frameintervals(struct file *file, void *fh,
- struct v4l2_frmivalenum *ivals)
-{
- int ret;
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
- const struct tegra_video_format *fmtinfo;
- struct v4l2_subdev_frame_interval_enum fie = {
- .index = ivals->index,
- .width = ivals->width,
- .height = ivals->height,
- .which = V4L2_SUBDEV_FORMAT_ACTIVE,
- };
-
- fmtinfo = tegra_get_format_by_fourcc(chan->vi, ivals->pixel_format);
- if (!fmtinfo)
- return -EINVAL;
-
- fie.code = fmtinfo->code;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- ret = v4l2_subdev_call(subdev, pad, enum_frame_interval, NULL, &fie);
- if (ret)
- return ret;
-
- ivals->type = V4L2_FRMIVAL_TYPE_DISCRETE;
- ivals->discrete.numerator = fie.interval.numerator;
- ivals->discrete.denominator = fie.interval.denominator;
-
- return 0;
-}
-
static int tegra_channel_enum_format(struct file *file, void *fh,
struct v4l2_fmtdesc *f)
{
@@ -601,203 +549,6 @@ tegra_channel_subscribe_event(struct v4l2_fh *fh,
return v4l2_ctrl_subscribe_event(fh, sub);
}
-static int tegra_channel_g_selection(struct file *file, void *priv,
- struct v4l2_selection *sel)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
- struct v4l2_subdev_format fmt = {
- .which = V4L2_SUBDEV_FORMAT_ACTIVE,
- };
- struct v4l2_subdev_selection sdsel = {
- .which = V4L2_SUBDEV_FORMAT_ACTIVE,
- .target = sel->target,
- };
- int ret;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- if (!v4l2_subdev_has_op(subdev, pad, get_selection))
- return -ENOTTY;
-
- if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
- return -EINVAL;
- /*
- * Try the get selection operation and fallback to get format if not
- * implemented.
- */
- ret = v4l2_subdev_call(subdev, pad, get_selection, NULL, NULL, &sdsel);
- if (!ret)
- sel->r = sdsel.r;
- if (ret != -ENOIOCTLCMD)
- return ret;
-
- ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
- if (ret < 0)
- return ret;
-
- sel->r.left = 0;
- sel->r.top = 0;
- sel->r.width = fmt.format.width;
- sel->r.height = fmt.format.height;
-
- return 0;
-}
-
-static int tegra_channel_s_selection(struct file *file, void *fh,
- struct v4l2_selection *sel)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
- int ret;
- struct v4l2_subdev_selection sdsel = {
- .which = V4L2_SUBDEV_FORMAT_ACTIVE,
- .target = sel->target,
- .flags = sel->flags,
- .r = sel->r,
- };
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- if (!v4l2_subdev_has_op(subdev, pad, set_selection))
- return -ENOTTY;
-
- if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
- return -EINVAL;
-
- if (vb2_is_busy(&chan->queue))
- return -EBUSY;
-
- ret = v4l2_subdev_call(subdev, pad, set_selection, NULL, NULL, &sdsel);
- if (!ret) {
- sel->r = sdsel.r;
- /*
- * Subdev active format resolution may have changed during
- * set selection operation. So, update channel format to
- * the sub-device active format.
- */
- return tegra_channel_set_subdev_active_fmt(chan);
- }
-
- return ret;
-}
-
-static int tegra_channel_g_edid(struct file *file, void *fh,
- struct v4l2_edid *edid)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- if (!v4l2_subdev_has_op(subdev, pad, get_edid))
- return -ENOTTY;
-
- return v4l2_subdev_call(subdev, pad, get_edid, edid);
-}
-
-static int tegra_channel_s_edid(struct file *file, void *fh,
- struct v4l2_edid *edid)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- if (!v4l2_subdev_has_op(subdev, pad, set_edid))
- return -ENOTTY;
-
- return v4l2_subdev_call(subdev, pad, set_edid, edid);
-}
-
-static int tegra_channel_g_dv_timings(struct file *file, void *fh,
- struct v4l2_dv_timings *timings)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- if (!v4l2_subdev_has_op(subdev, pad, g_dv_timings))
- return -ENOTTY;
-
- return v4l2_device_call_until_err(chan->video.v4l2_dev, 0,
- pad, g_dv_timings, 0, timings);
-}
-
-static int tegra_channel_s_dv_timings(struct file *file, void *fh,
- struct v4l2_dv_timings *timings)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
- struct v4l2_bt_timings *bt = &timings->bt;
- struct v4l2_dv_timings curr_timings;
- int ret;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- if (!v4l2_subdev_has_op(subdev, pad, s_dv_timings))
- return -ENOTTY;
-
- ret = tegra_channel_g_dv_timings(file, fh, &curr_timings);
- if (ret)
- return ret;
-
- if (v4l2_match_dv_timings(timings, &curr_timings, 0, false))
- return 0;
-
- if (vb2_is_busy(&chan->queue))
- return -EBUSY;
-
- ret = v4l2_device_call_until_err(chan->video.v4l2_dev, 0,
- pad, s_dv_timings, 0, timings);
- if (ret)
- return ret;
-
- chan->format.width = bt->width;
- chan->format.height = bt->height;
- chan->format.bytesperline = bt->width * chan->fmtinfo->bpp;
- chan->format.sizeimage = chan->format.bytesperline * bt->height;
- chan->vi->ops->vi_fmt_align(&chan->format, chan->fmtinfo->bpp);
- tegra_channel_update_gangports(chan);
-
- return 0;
-}
-
-static int tegra_channel_query_dv_timings(struct file *file, void *fh,
- struct v4l2_dv_timings *timings)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- if (!v4l2_subdev_has_op(subdev, pad, query_dv_timings))
- return -ENOTTY;
-
- return v4l2_device_call_until_err(chan->video.v4l2_dev, 0,
- pad, query_dv_timings, 0, timings);
-}
-
-static int tegra_channel_enum_dv_timings(struct file *file, void *fh,
- struct v4l2_enum_dv_timings *timings)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- if (!v4l2_subdev_has_op(subdev, pad, enum_dv_timings))
- return -ENOTTY;
-
- return v4l2_subdev_call(subdev, pad, enum_dv_timings, timings);
-}
-
-static int tegra_channel_dv_timings_cap(struct file *file, void *fh,
- struct v4l2_dv_timings_cap *cap)
-{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
-
- subdev = tegra_channel_get_remote_source_subdev(chan);
- if (!v4l2_subdev_has_op(subdev, pad, dv_timings_cap))
- return -ENOTTY;
-
- return v4l2_subdev_call(subdev, pad, dv_timings_cap, cap);
-}
-
static int tegra_channel_log_status(struct file *file, void *fh)
{
struct tegra_vi_channel *chan = video_drvdata(file);
@@ -810,17 +561,11 @@ static int tegra_channel_log_status(struct file *file, void *fh)
static int tegra_channel_enum_input(struct file *file, void *fh,
struct v4l2_input *inp)
{
- struct tegra_vi_channel *chan = video_drvdata(file);
- struct v4l2_subdev *subdev;
-
if (inp->index)
return -EINVAL;
inp->type = V4L2_INPUT_TYPE_CAMERA;
- subdev = tegra_channel_get_remote_source_subdev(chan);
- strscpy(inp->name, subdev->name, sizeof(inp->name));
- if (v4l2_subdev_has_op(subdev, pad, dv_timings_cap))
- inp->capabilities = V4L2_IN_CAP_DV_TIMINGS;
+ strscpy(inp->name, "Camera", sizeof(inp->name));
return 0;
}
@@ -844,10 +589,7 @@ static int tegra_channel_s_input(struct file *file, void *priv,
static const struct v4l2_ioctl_ops tegra_channel_ioctl_ops = {
.vidioc_querycap = tegra_channel_querycap,
- .vidioc_g_parm = tegra_channel_g_parm,
- .vidioc_s_parm = tegra_channel_s_parm,
.vidioc_enum_framesizes = tegra_channel_enum_framesizes,
- .vidioc_enum_frameintervals = tegra_channel_enum_frameintervals,
.vidioc_enum_fmt_vid_cap = tegra_channel_enum_format,
.vidioc_g_fmt_vid_cap = tegra_channel_get_format,
.vidioc_s_fmt_vid_cap = tegra_channel_set_format,
@@ -866,15 +608,6 @@ static const struct v4l2_ioctl_ops tegra_channel_ioctl_ops = {
.vidioc_streamoff = vb2_ioctl_streamoff,
.vidioc_subscribe_event = tegra_channel_subscribe_event,
.vidioc_unsubscribe_event = v4l2_event_unsubscribe,
- .vidioc_g_selection = tegra_channel_g_selection,
- .vidioc_s_selection = tegra_channel_s_selection,
- .vidioc_g_edid = tegra_channel_g_edid,
- .vidioc_s_edid = tegra_channel_s_edid,
- .vidioc_g_dv_timings = tegra_channel_g_dv_timings,
- .vidioc_s_dv_timings = tegra_channel_s_dv_timings,
- .vidioc_query_dv_timings = tegra_channel_query_dv_timings,
- .vidioc_enum_dv_timings = tegra_channel_enum_dv_timings,
- .vidioc_dv_timings_cap = tegra_channel_dv_timings_cap,
.vidioc_log_status = tegra_channel_log_status,
};
--
2.53.0
next prev parent reply other threads:[~2026-11-29 18:07 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-29 18:07 [PATCH v2 00/15] tegra-video: Convert to media-centric pipe Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 01/15] staging: media: tegra-video: Move driver to media/platform/nvidia Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 02/15] media: tegra-video: vi: Drop controls consolidation into VI device Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 03/15] media: tegra-video: vi: Expose all sub-devices in the pipeline Svyatoslav Ryhel
2026-11-29 18:07 ` Svyatoslav Ryhel [this message]
2026-11-29 18:07 ` [PATCH v2 05/15] media: tegra-video: vi: Build bitmap of formats compatible with CSI/VIP instead of source Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 06/15] media: tegra-video: Expose SoC stepwise frame size limits Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 07/15] media: tegra-video: vi: Match fourcc against channel format bitmap Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 08/15] media: tegra-video: vi: Report stepwise frame sizes instead of querying subdev Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 09/15] media: tegra-video: vi: Configure capture format locally without subdev calls Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 10/15] media: tegra-video: vi: Implement link_validate for video entity Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 11/15] media: tegra-video: video: Resolve video device via media graph on notifications Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 12/15] media: tegra-video: Remove remote source subdev helper Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 13/15] media: tegra-video: csi: Scope pad and state ops to TPG mode Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 14/15] media: tegra-video: csi: Add pad and media operations for own CSI channels Svyatoslav Ryhel
2026-11-29 18:07 ` [PATCH v2 15/15] media: tegra-video: vip: Add pad and media operations for VIP Svyatoslav Ryhel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261129180722.142186-5-clamor95@gmail.com \
--to=clamor95@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=hverkuil+cisco@kernel.org \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=linux-tegra@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=mchehab@kernel.org \
--cc=mperttunen@nvidia.com \
--cc=skomatineni@nvidia.com \
--cc=thierry.reding@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®