From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.52 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795975678; b=cOGdGG9+FSRenbJhcF+vmUPLUhvqkkaQWWyWXmCIkI02OUuPiugKxRVaTMeFqaPsSsio wrPFi4wFIULGXYZtiPeWsUWlsPQ19q5Q5eb0TvBX9BemwVDgEF4YApZDW3WLVN9vtu8ed p/wrg+JlEI+3btBTZ/kr/HiaULO5F9NoOl/AOPLavafj5tkCEP+OUBncDeJpAV8FkCAfd 2qK52hx0zGV/i2wDk/y6CKlCmJRyJgqnrCUvYr/GbROL0LvTNP+vfGZ4ksc1s+aPvmgRR /A4vI8pF4yniNX2NuXyhWr7Zu9AV7bhC+7Eoz1qHiphh21LFV2gl5oGRuDRqksrWPVg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795975678; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: 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=VafIBdiECvt9TG+MZRw3cX9Z/eRezMFY64B5/+3v94k=; b=QRqsg5TBIETHYaqMnAgEnInIIXJaRWiZKVwuiA+fYHeNgBYS1RZMRxqW29Aa/h0XujUu ZEByUWKkfBtO5wIOIU04MyyWkdkLe+2vOHZbmpFfGwPGHtigitNEcdS2Rvdd2pbQDZFdn jNrPae+LUIxzFVLHCJLlY2DZDU7H1ZkB7FyfNDsaY+mXlJH2yP/UdEtpehxAbNhCajCCn y9Ln8LP/tnrBi1Z7hc9vcsshwYWjWJNSwYRMXSUtLgmCnY0ig32kz3uG5Sj+I48bchC+E epkbbbQpzY0hZbfKHBsOLcg0CBwhj1R9SkBdZ/HtGIDUeopPuqgKD/6T9DplHAcvxUw== 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=GajSbS2p; arc=none smtp.remote-ip=209.85.218.52 Received: from mail-ej1-f52.google.com (mail-ej1-f52.google.com [209.85.218.52]) (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 D8B6D606A6A6 for ; Sun, 29 Nov 2026 18:07:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D8B6D606A6A6 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=GajSbS2p Received: by mail-ej1-f52.google.com with SMTP id a640c23a62f3a-c4cac7a7d3cso1427036366b.3 for ; Sun, 29 Nov 2026 10:07:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1795975676; x=1796580476; 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=VafIBdiECvt9TG+MZRw3cX9Z/eRezMFY64B5/+3v94k=; b=GajSbS2p87GrsS7hKzMH3IXlKyHKPuzPb6tNBQX7eHwjk0mtbXEHYvi4gWuipdK93b aK8k6JjHX//PS99Wk2Sa49VWiP7mfAMnfdCi8HZA8EFW3MNOQiYmkC9nl6T78YURcM5Q OmATUQGp3s6zVb+REUjALvf084Sx80FUJOhmGtrWC8xTPpi04K5yGEB+x6d5okiZ3Wof zupSYbGJ4etynbz5ZWuovdJ4sM0pdjio9l0nzy3euD8xWLTG1SZkcP5yE+ex9/2ygONc x88jdEuw74AdANW9IZYp3oP8AcjcvzCl+TpsCAaQuwSK3WdgV68WkIdaIbfuTO5LaXqw hOug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795975676; x=1796580476; 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=VafIBdiECvt9TG+MZRw3cX9Z/eRezMFY64B5/+3v94k=; b=VhK7T5BS4o1PzgD8PUzppfxOeKA1Vc9Sxy7z6LAMT4+PQCC2Qadrzp9o8X2n3hUJLG bf3TM5QWdLIpN+phFQdG+I0mUWCpvGrkQWYV4e58HphGwZpVNuuNdat1excT/5qabvW1 w02rsBV9oUxaFjyZMRWU48nuVHmqnk+ab07LH0QmuEfz9xx6gWjs3YCTRXfOoKj5/XhF pWWNK1MtmaQb/xHkfXQ5nBsvOCxPB0vbrLNNS/OM+uobWPB40a0YfzSSTH4tWgbH5Y9r mkjemNZUZSeDpb7Zs/PplOVvC8xOxuyu9nAg08U+1s0kZn8Y6vv/ICpN/Xg47OObq+Gs IGsw== X-Gm-Message-State: APuU4Z8YopN6gTn0dnprDX12dLnZf/+AuO94kNpTMu5EfXi/DeJFwtBI GhYLDG2rNtfqyB5VwqpyGCKapBMDf77qwPrgBvWwece12SZhglj2CghH X-Gm-Gg: AZFdTZc//oGj0nE8R7BbzZj9n3IstRT2OUe61cFPWJX7OBK9VMSnuMoRQZqV56T++2j 7G4TVhiE5CvM1uC//UH86O7ugp7GKBQxf1L7tanC688e5lckl6ZWnqHNzrP4J/uwy0sgsfzMbC4 jN6P6hbEoAQzPyZNvQ+ty2r0G+NTPYO3+kOQr5g9x6Dau6jNIyqQLd3YWLOU+m5Bp7rweoBKxYh 8WdNtjmD7EZqOInYadO9WxCU8EpqK7tKRM/kKEqJ2OeHx2FPJLLTDwqfl+4jq6nabzF8T8Gcrcp Z5hzjy+4TvKQGX2b+GTMekSqWEPWT4xYV/QnlodIxEO7z5Ug0wsXiail07i32wXLZb3p8JbgXl8 9dqxpopFyH0o4tcjw7NhY8Kde5GF9WWx8Y0aBtZ/GqeKpJhl25lQzIuVYIH1QtarQEhN27NR62S XnqCBw5vvfUgV9exixdhKydyN+R/K84xjFfLoYjQFbx7xsni7sBk43qgxq1BxY6NDP7u/8GndD+ ccHuM6CW6nRO+c8KvP+TBapqoMM/h5RS6FxXmI4zUBc0yKm5XrKIzNkLlCKzrdmaHnj4uXHAP/J UASmeNpuT1TeRWtQzC2ZcuOesfU7imXm2EsToiggP1bxsCkuraapR6k+MKuFX2FLLBy2VhDhszu XftSfGOrvuw== X-Received: by 2002:a17:907:c07:b0:c50:c04d:cbb3 with SMTP id a640c23a62f3a-c516adc890cmr1889930466b.0.1795975676308; Sun, 29 Nov 2026 10:07:56 -0800 (PST) Received: from xeon ([188.163.112.54]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513ae8ce16sm1061518266b.37.2026.11.29.10.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2026 10:07:55 -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 10/15] media: tegra-video: vi: Implement link_validate for video entity Date: Sun, 29 Nov 2026 20:07:17 +0200 Message-ID: <20261129180722.142186-11-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-kernel@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 Add tegra_channel_link_validate() and attach it via tegra_channel_media_ops to chan->video.entity.ops to verify that the remote subdevice pad's active format (dimensions and media bus code) matches the channel's configured format during media pipeline validation. Signed-off-by: Svyatoslav Ryhel --- .../media/platform/nvidia/tegra-video/vi.c | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/drivers/media/platform/nvidia/tegra-video/vi.c b/drivers/media/platform/nvidia/tegra-video/vi.c index c292443783b14..f9d50d7571e10 100644 --- a/drivers/media/platform/nvidia/tegra-video/vi.c +++ b/drivers/media/platform/nvidia/tegra-video/vi.c @@ -485,6 +485,46 @@ static int tegra_channel_s_input(struct file *file, void *priv, return 0; } +static int tegra_channel_link_validate(struct media_link *link) +{ + struct video_device *video = + media_entity_to_video_device(link->sink->entity); + struct v4l2_subdev *subdev = + media_entity_to_v4l2_subdev(link->source->entity); + struct tegra_vi_channel *chan = video_get_drvdata(video); + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + .pad = link->source->index, + }; + int ret; + + if (!chan->fmtinfo) + return -EPIPE; + + ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt); + if (ret) + return ret; + + if (fmt.format.height != chan->format.height || + fmt.format.width != chan->format.width || + fmt.format.code != chan->fmtinfo->code) { + dev_dbg(chan->vi->dev, + "link '%s':%u -> '%s':%u not valid: 0x%04x/%ux%u != 0x%04x/%ux%u\n", + link->source->entity->name, link->source->index, + link->sink->entity->name, link->sink->index, + fmt.format.code, fmt.format.width, fmt.format.height, + chan->fmtinfo->code, chan->format.width, + chan->format.height); + return -EPIPE; + } + + return 0; +} + +static const struct media_entity_operations tegra_channel_media_ops = { + .link_validate = tegra_channel_link_validate, +}; + static const struct v4l2_ioctl_ops tegra_channel_ioctl_ops = { .vidioc_querycap = tegra_channel_querycap, .vidioc_enum_framesizes = tegra_channel_enum_framesizes, @@ -764,6 +804,7 @@ static int tegra_channel_init(struct tegra_vi_channel *chan) dev_name(vi->dev), "output", chan->portnos[0]); chan->video.vfl_type = VFL_TYPE_VIDEO; chan->video.vfl_dir = VFL_DIR_RX; + chan->video.entity.ops = &tegra_channel_media_ops; chan->video.ioctl_ops = &tegra_channel_ioctl_ops; chan->video.ctrl_handler = &chan->ctrl_handler; chan->video.lock = &chan->video_lock; -- 2.53.0