From 6de4acf3fd66ec9c0e3967aa76d3a07c7fa251f8 Mon Sep 17 00:00:00 2001 From: Shubham Chandra Date: Tue, 5 Mar 2024 05:04:15 +0000 Subject: [PATCH] nvidia-oot: imx318: fix probe failure V4l2 ctrl values are 0 during init time s_ctrl call from v4l2. Since framerate val parameter is 0, when set_framerate_ex is called from set_ctrl_ex during initialization for probing of imx318 sensor, this results in invalid error and probe failure for imx318. Assign framerate 'val' to a value from imx318 sensor device-tree properties within the given range to avoid probe failure due to this. Bug 3692128 Change-Id: Ib5f50e64f99c8443bf604066eda315dc96fbde03 Signed-off-by: Shubham Chandra Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3089350 (cherry picked from commit 17e0946ce04b207adb0be84f7c409ce4ca304c1b) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3096300 Reviewed-by: svcacv Reviewed-by: Ankur Pawar Reviewed-by: Bitan Biswas GVS: buildbot_gerritrpt --- drivers/media/i2c/nv_imx318.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/media/i2c/nv_imx318.c b/drivers/media/i2c/nv_imx318.c index 2a8276f0..85ed0129 100644 --- a/drivers/media/i2c/nv_imx318.c +++ b/drivers/media/i2c/nv_imx318.c @@ -1,5 +1,9 @@ // SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2017-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2017-2024 NVIDIA CORPORATION & AFFILIATES. +// All rights reserved. +// +// nv_imx318.c - imx318 sensor driver +// #include @@ -131,6 +135,11 @@ static int imx318_set_frame_rate_ex(struct tegracam_device *tc_dev, u8 fl_arr[2]; int err = 0; + if (val < mode->control_properties.min_framerate) + val = mode->control_properties.min_framerate; + else if (val > mode->control_properties.max_framerate) + val = mode->control_properties.max_framerate; + if (mode->image_properties.line_length == 0 || val == 0) { return -EINVAL;