media:i2c: fix imx477 partial frame output

Fix imx477 partial frame issue and wrong frame-length
/exposure time calculations.
Uses hardcoded sensor internal clock frequency
instead of clock values from sensor device tree.

Adding clock frequency to device tree also require
deskew_initial_enable = "true". Setting deskew in
device tree is causing kernel panic in function
nvcsi_deskew_setup(). For unblocking the IMX477
use case, set hardcoded clock in driver for now.

Bug 4384649

Change-Id: Iedb02673c6f4da140aee22adc991805b6aa1eb7e
Signed-off-by: Ankur Pawar <ankurp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3086503
Reviewed-by: Praveen AC <pac@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Ankur Pawar
2024-02-29 04:50:04 -08:00
committed by mobile promotions
parent 396db89160
commit 4d4e685699

View File

@@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0-only // SPDX-License-Identifier: GPL-2.0-only
// SPDX-FileCopyrightText: Copyright (c) 2021-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
/* /*
* Copyright (c) 2020, RidgeRun. All rights reserved. * Copyright (c) 2020, RidgeRun. All rights reserved.
* Copyright (c) 2021-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
* *
* Contact us: support@ridgerun.com * Contact us: support@ridgerun.com
* *
@@ -26,6 +26,8 @@
#include "../platform/tegra/camera/camera_gpio.h" #include "../platform/tegra/camera/camera_gpio.h"
#include "imx477_mode_tbls.h" #include "imx477_mode_tbls.h"
#define IMX477_SENSOR_INTERNAL_CLK_FREQ 840000000
static const struct of_device_id imx477_of_match[] = { static const struct of_device_id imx477_of_match[] = {
{.compatible = "ridgerun,imx477",}, {.compatible = "ridgerun,imx477",},
{}, {},
@@ -228,7 +230,7 @@ static int imx477_set_frame_rate(struct tegracam_device *tc_dev, s64 val)
if (val == 0 || mode->image_properties.line_length == 0) if (val == 0 || mode->image_properties.line_length == 0)
return -EINVAL; return -EINVAL;
frame_length = (u32) (mode->signal_properties.pixel_clock.val * frame_length = (u32) (IMX477_SENSOR_INTERNAL_CLK_FREQ *
(u64) mode->control_properties.framerate_factor / (u64) mode->control_properties.framerate_factor /
mode->image_properties.line_length / val); mode->image_properties.line_length / val);
@@ -279,12 +281,12 @@ static int imx477_set_exposure(struct tegracam_device *tc_dev, s64 val)
fine_integ_time_factor = priv->fine_integ_time * fine_integ_time_factor = priv->fine_integ_time *
mode->control_properties.exposure_factor / mode->control_properties.exposure_factor /
mode->signal_properties.pixel_clock.val; IMX477_SENSOR_INTERNAL_CLK_FREQ;
dev_dbg(dev, "%s: Setting exposure control to: %lld\n", __func__, val); dev_dbg(dev, "%s: Setting exposure control to: %lld\n", __func__, val);
coarse_time = (val - fine_integ_time_factor) coarse_time = (val - fine_integ_time_factor)
* mode->signal_properties.pixel_clock.val * IMX477_SENSOR_INTERNAL_CLK_FREQ
/ mode->control_properties.exposure_factor / mode->control_properties.exposure_factor
/ mode->image_properties.line_length; / mode->image_properties.line_length;