Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.50 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795975668; b=hJWLW2QucEBgqKdrz6374cUouHhoaL8JYUHU2Hk2L9+cpBp8uzM/4PnZx+HXRliRkxeF iiBByfwnIn+yFAkzjnpb69MvsRXOF2v3GxwaTDpg3Ja2uvxhLoRPDLTIZinBH7MHF/mIQ dALgGcfCpbCp6phw/YcM/ROpgjZ6FRd83Da5A0KZbEVGFUXkvt4Dc4CSur48067R5mcGa n8V3gL6QVlBL3Z87uW4eWiWHajWdoQvjU7f67zodKKIR5/VellZYJfjps/psSZ07ubJYS dT+KUxLEVvIBy86IIH73JAGerpBSl8sd+mULK+oToroHLumoRcJFoyuIiGfCCYr1hKQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795975668; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=EqQOrrgVosQ8VkU5mKjG5aVrBxR7aF/ftphDXWoNeUk=; b=TmO/lbUOGEeOfJhf4W5vBjsb14JDsogKvnbXP4EK+GliXmquogXHoPXVXzuwX3DsJ5O2 e93SWxbDM0oFYBtdPCH8lqeJ85nDmU1k9Kxi9tSrdHSNA3FbVW5Ju2QTmNtOyE6bNMHA6 lCZqd92C6ZaJhmq3pFHk7+wE7rCqDRclcb+0Sguy73Q76nVlj5YzkQotS+EJtBttybWgQ v2B3Km71vOeGr+hmVTWG1FSs+n6FTJzVaTbFl9kN9T56zawIjfsV7pSlSEyJb+Ta/xWsR mLc0EXpdhyRyRokGptZZ9bX0pcEeY3QqkGWFl1KfJieIuwNsB9gMMHShEkqb11oifVA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=JCoOUyn2; arc=none smtp.remote-ip=209.85.218.50 Received: from mail-ej1-f50.google.com (mail-ej1-f50.google.com [209.85.218.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B4D89606A6A1 for ; Sun, 29 Nov 2026 18:07:47 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B4D89606A6A1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=JCoOUyn2 Received: by mail-ej1-f50.google.com with SMTP id a640c23a62f3a-c513a854320so625422966b.0 for ; Sun, 29 Nov 2026 10:07:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795975666; x=1796580466; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=EqQOrrgVosQ8VkU5mKjG5aVrBxR7aF/ftphDXWoNeUk=; b=JCoOUyn2ABqrVzyuaB4F7Vw89N0Y6nuIqPr3S0hib0OH8IWX3lNVfzz+HyBpdqnKGI eWPnZabv5kkRM/a7kNjbTkWjOKUHrzxA8MkLViASaiDEhESWDhhvpkLhYWtdwt9baAb8 1AYpAJ8DfCu7dXkSZb5w0s5DFK/XTzmbZ7o7lAj//U/kZ3G0hHCeiIXClFfMGoQKiIX3 Kz5CtAHgI2PX4lPtCrRQHRc2uftUpTPKZRCmyS5yOTab5d8T/95qO+Y53pyagIfOiIR1 2iCdZ2p0nJBn3OIAbaHs+g67CLu1EtuLc6/TUMEwtY3gL8YQjn/VSbL+xJvNcga2DuKs ImBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795975666; x=1796580466; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=EqQOrrgVosQ8VkU5mKjG5aVrBxR7aF/ftphDXWoNeUk=; b=yppSp5AUc/W1AHgbLk63hLRrESZXA8HxYJWKux+CbjxVros4HW37uu3NccEGaEfqmU iWB80cqueZDXI9CDddHxORbRM+h/EBU0MpaGwx4rqOkcT8hPKqYTX1GHx1I60KLxs1mh Lxiw0keF7dHXsEUJ6F/ewmrWbYEh3hm9bi+nAiVJiHenuWQGh5XqiNUbZegokx2kozxX bJpRbixP0JIyBfkKC6gwDh7DsEtGVdSPt97QoiXNFjD48DeeG76tDR4u13AiVUZv28nw sUi+5704r0VIyy6lG1BVA9fwVx2ioCCrur9WvaC4B7+AargnFvG1/X1JkF//aQq9La1Z MBzg== X-Forwarded-Encrypted: i=1; AL+hErHTr4vh9w62dW+7arQyRF2CELbdFJvoS69Ti0HmJVL6Uw+1gjjdQQiIEt48UcnglGp8i5JVKFnWlJfKrA==@vger.kernel.org X-Gm-Message-State: APuU4Z99AHXBNewLzPJ+EJQm7d2zARtjUSJUTsf3bj2FgwpMn5bq4BX3 Z1X6WctBGvHP9v6El08ahWX5awgO55rFV5WV6G/minwjKRE1cv08k0XS X-Gm-Gg: AZFdTZeY8dwKIewVEQFrg10tv02Ob8Rptl4D7d9TU3DrlJhyQp6FXh4j7p9MYNO3X6U aKtOktdr/ky3JmZRdxoDKExRR9o+i9aRCzeCfA1OHh7oN094lGQ4uyb6bywyNbgSRyko4vB9EVV TG8ZKMzV6qpIBjjf5XWcQOh1XsDPxwzUQ3lvggf+2wokHapee04KqS5CYFPpXsN3xZKokgSeeHV uRJ/88p6OPFLIfpmy24p3jFJ8Mvty1Q1NpTjul3hk3nTvfOlrY9BCgySTmJiRPlKMrbAwOxecyD U+/piSEhnh2w4tiLIvbSo3UkeHMCqQeF+si0Q4a/MHUyR7u9RtLUUE61dpSbn8XKmj4CRC4kXy6 D50u4uB0J7/Y6RTxwex0Rh+8JtQJ5PSxBjGdGsNHIFMStAwcyNMUZdhOTEosGPXuiShHsipM9Ok RbljwHt+eDnJS9ebZs6WSLgt+vT8RuVMq5t+f6/iYA5ppQ4U5px8nSmVGk3sXF8D1rfEfXLT13d ttD4x0gNKjDF5GCERBQOfZIkjEb+yrBy6aeqSam5GcuPsx8dFu1GRTk4a4GpbpRanwrPVpyiS1C 0nrmogd07TVpJpkkD8vtw6vD5ViQIrEAkeMZItwtJgW6uKsH7lH/1jTUIND9bGeaLcCDP0Hyat/ 6OLqdInGDng== X-Received: by 2002:a17:907:a890:b0:c41:55b4:d88b with SMTP id a640c23a62f3a-c513ab14402mr2651068966b.43.1795975665938; Sun, 29 Nov 2026 10:07:45 -0800 (PST) Received: from xeon ([188.163.112.54]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae8ce16sm1061518266b.37.2026.11.29.10.07.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 10:07:45 -0800 (PST) From: Svyatoslav Ryhel To: Mauro Carvalho Chehab , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Greg Kroah-Hartman , Svyatoslav Ryhel , Hans Verkuil , Mikko Perttunen 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 Message-ID: <20261129180722.142186-5-clamor95@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20261129180722.142186-1-clamor95@gmail.com> References: <20261129180722.142186-1-clamor95@gmail.com> X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- .../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