From nobody Thu Apr 2 18:46:23 2026 Received: from mail-lj1-f171.google.com (mail-lj1-f171.google.com [209.85.208.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 14676388E53 for ; Tue, 3 Mar 2026 08:42:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772527376; cv=none; b=ONE0dcGGwV/R/WiIypCM7syU3FucCIv7UFdEgIkO0QsLJ6EvGkuMZ2A7Kf6ORV/VqiWBqzF1K0dNIhh0QS5zSx36NWdFacl12gQeyCGk3MHjdtCy+eeqxWz/QMX6QhbR2sMTfff+i4zF5St58V/Kq4xUl8fAmmxvardjcoJi+3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772527376; c=relaxed/simple; bh=IzB8EsMSPw3QzBXaG2KwfOAPPaeXySttkLghuqSdNAs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RH0QwKmMdQ8UeZfHL72MhX8AAgwpahuQQR61nv1fxgFWLYW6JZ5QbA8SCwW8x4iGOQdsBuVBrTcGW/aOYMIHSflTNlElZKZKU3XkF9m/8d6XmXTyBkx0c2F1SIG9FkZijTQkHKYn2HCvjglWkf8GKVwMGDZ2mX5jdtFwcAkMzm8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fc/g0y3x; arc=none smtp.client-ip=209.85.208.171 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.b="fc/g0y3x" Received: by mail-lj1-f171.google.com with SMTP id 38308e7fff4ca-389ebb0e885so102560311fa.1 for ; Tue, 03 Mar 2026 00:42:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772527373; x=1773132173; 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; bh=Pid8l3oxr/AZHZz4pdBIzX1rDMW/6jLdB7pjgw7arVo=; b=fc/g0y3xFpyycAlk+OdVU8lkyJNTqGYwYHpnSi6QusmaAarrZEcU/4Tzd7nEosXujm eJa1nP6Z2U6lj79dL0rZKSwIK4Sjc35/kRMAC6Cfz7KnZns72eaUYWaNiw6sKjs4vAO1 wTc0yFtrztfdp/6sjx8Yz4BrSLstmGjH2V1fe3G2W+Bq8V21TMNEIu+i/WuGzuFjmBlC b/aCWfS8nkZHDfZKC8naZBKJgQwqGkz+SbekRRUd3LZ8UJAsS8NPCpDt4uuQQKupqygJ RbRBYOYW2givMifxNR5cVgQeN5MFXIWJ3AXr2xBRtYnFTp8o73FnPwSPD+DMJ/BnvdJJ 5zGg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772527373; x=1773132173; 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; bh=Pid8l3oxr/AZHZz4pdBIzX1rDMW/6jLdB7pjgw7arVo=; b=m+37LIj2vtjJoAbNfL9TEx9b4gLmKRGRg2/WfqeslQSRaaxYCzUUY9usu1j6ssVpQO 7vyYGpyKYohu0x7uHf51YU61kHWGohGewHSjpO4/Voglo7C6LvCLe5X6GNeQE5W4x9qJ O9fmUaBWptU055zODU9Dn6pDUDTiABj7hkrTkX8M+KBMqFcXgEUDbr/Bld115lNtkfor yYPS7eexkNAs8Tx7w5xIlVEvSJYNi8ybb9Dqv6/EvCuQsboBxVOkpCVcOMkEWBikPp3d HUVEfhVOQeYA/YOekLTLMJPx71NxcwgNiJP21T7dtPsfAgyrrcQWOwx43wPIGDCfRVQf YGFg== X-Gm-Message-State: AOJu0Yz9FvzvBTnt1bAi7/zxnwUFpaTGzd3cyL0+s6CuMxiPmCEM9ds2 JfgX08uBcB0kf6mgWCKNjarpVROzDhy2QqkP33Hl5515lMmrp9Ewdto9 X-Gm-Gg: ATEYQzzJqr3rTd1jtJSefIZvKyOQ+Sql//c9/jTlddvJ9Rc5ifqzGh2mZrD2jbOn44j Lwb6rxdf25jH7xgu0dKG0UOnsNiB81nd5tX3alkJgrLY6ikx3WLv989WsDaArbyEkuDYaZFgETR uxyt1YBfGL9wLaMKJhw07Infih0MPrNnCg4Hx3eCdwu/w5CasV1k9NB9rrlmkjnXjl6B2f23QWv v/bazJSPxUC6sgvxnZOZoFDv/nRKMB46WnWEGj9NYo8gjTBU9u+IbF4grPoFAdPYefuW6EKJfJ6 HZ531KWXHQ06LBfBFrQ79p5XjQJmDI2pqtsCwqXobu3boxdWSlqSjPtqTrns0bKivo45n1jMZx+ 694TarrAbVp8XF7KaZVu/0HF8c/FXInp5nBZIngTRDjxW8SOdugLlLuhRV4NtrWFl7y7Q2+beEg 4yl99AwHvrFbGM X-Received: by 2002:a2e:bc1d:0:b0:38a:957:a125 with SMTP id 38308e7fff4ca-38a0957a856mr72649181fa.18.1772527373025; Tue, 03 Mar 2026 00:42:53 -0800 (PST) Received: from xeon ([188.163.112.72]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-389f30227a9sm32599471fa.42.2026.03.03.00.42.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Mar 2026 00:42:52 -0800 (PST) From: Svyatoslav Ryhel To: Thierry Reding , Thierry Reding , Mikko Perttunen , David Airlie , Simona Vetter , Jonathan Hunter , Sowjanya Komatineni , Luca Ceresoli , Mauro Carvalho Chehab , Greg Kroah-Hartman , Hans Verkuil , Svyatoslav Ryhel Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev Subject: [PATCH v7 02/15] staging: media: tegra-video: vi: adjust get_selection operation check Date: Tue, 3 Mar 2026 10:42:25 +0200 Message-ID: <20260303084239.15007-3-clamor95@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260303084239.15007-1-clamor95@gmail.com> References: <20260303084239.15007-1-clamor95@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable 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 =E2=80=94 treating it as if the operation was not implemented =E2=80=94 instead of returning a failure. Tested-by: Luca Ceresoli # tegra20, parallel ca= mera Signed-off-by: Svyatoslav Ryhel --- drivers/staging/media/tegra-video/vi.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media= /tegra-video/vi.c index a7892036f29e..e0961bc0a017 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -476,17 +476,11 @@ static int __tegra_channel_try_format(struct tegra_vi= _channel *chan, fse.code =3D fmtinfo->code; ret =3D v4l2_subdev_call(subdev, pad, enum_frame_size, sd_state, &fse); if (ret) { - if (!v4l2_subdev_has_op(subdev, pad, get_selection)) { + if (!v4l2_subdev_has_op(subdev, pad, get_selection) || + v4l2_subdev_call(subdev, pad, get_selection, NULL, &sdsel)) { try_crop->width =3D 0; try_crop->height =3D 0; } else { - ret =3D v4l2_subdev_call(subdev, pad, get_selection, - NULL, &sdsel); - if (ret) { - ret =3D -EINVAL; - goto out_free; - } - try_crop->width =3D sdsel.r.width; try_crop->height =3D sdsel.r.height; } --=20 2.51.0