From 5cede1ef85a4aaa147b31e81e4f79ed54cc0bd13 Mon Sep 17 00:00:00 2001 From: dchvs Date: Mon, 8 Mar 2021 16:28:55 -0600 Subject: [PATCH] Fix dotted image --- .../tegra186-tx2-spiri-camera.dtsi | 44 +++++++++---------- .../nvidia-spiri/drivers/media/i2c/mt9m021.c | 20 ++++----- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/hardware/nvidia-spiri/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-tx2-spiri-camera.dtsi b/hardware/nvidia-spiri/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-tx2-spiri-camera.dtsi index 6928c01..85a4543 100644 --- a/hardware/nvidia-spiri/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-tx2-spiri-camera.dtsi +++ b/hardware/nvidia-spiri/platform/t18x/common/kernel-dts/t18x-common-platforms/tegra186-tx2-spiri-camera.dtsi @@ -98,25 +98,25 @@ i2c8 = "/i2c@31e0000"; inherent_gain = "1"; pix_clk_hz = "74250000"; - gain_factor = "3125"; - framerate_factor = "1000000"; - exposure_factor = "1000000"; - min_gain_val = "100000"; - max_gain_val = "796000"; - step_gain_val = "1"; - default_gain = "100000"; + gain_factor = "3"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; //"1000000"; + min_gain_val = "100"; + max_gain_val = "762"; + step_gain_val = "1"; + default_gain = "100"; min_hdr_ratio = "1"; max_hdr_ratio = "1"; min_framerate = "2000000"; max_framerate = "60000000"; step_framerate = "1"; - default_framerate = "60000000"; // 60.0 fps + default_framerate = "60000000"; // 60.0 fps - min_exp_time = "500"; // us - max_exp_time = "16000"; // us + min_exp_time = "23000"; // us + max_exp_time = "1000000"; // us step_exp_time = "1"; - default_exp_time = "12000"; // us + default_exp_time = "40000"; // us }; ports { #address-cells = <0x1>; @@ -185,25 +185,25 @@ i2c8 = "/i2c@31e0000"; inherent_gain = "1"; pix_clk_hz = "74250000"; - gain_factor = "3125"; - framerate_factor = "1000000"; - exposure_factor = "1000000"; - min_gain_val = "100000"; - max_gain_val = "796000"; - step_gain_val = "1"; - default_gain = "100000"; + gain_factor = "3"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "100"; + max_gain_val = "762"; + step_gain_val = "1"; + default_gain = "100"; min_hdr_ratio = "1"; max_hdr_ratio = "1"; min_framerate = "2000000"; max_framerate = "60000000"; step_framerate = "1"; - default_framerate = "60000000"; // 60.0 fps + default_framerate = "60000000"; // 60.0 fps - min_exp_time = "500"; // us - max_exp_time = "16000"; // us + min_exp_time = "23000"; // us + max_exp_time = "1000000"; // us step_exp_time = "1"; - default_exp_time = "12000"; // us + default_exp_time = "40000"; // us }; ports { #address-cells = <0x1>; diff --git a/kernel/nvidia-spiri/drivers/media/i2c/mt9m021.c b/kernel/nvidia-spiri/drivers/media/i2c/mt9m021.c index 7af9435..67ec898 100644 --- a/kernel/nvidia-spiri/drivers/media/i2c/mt9m021.c +++ b/kernel/nvidia-spiri/drivers/media/i2c/mt9m021.c @@ -135,8 +135,8 @@ #define MT9M021_ANALOG_GAIN_SHIFT 4 #define MT9M021_ANALOG_GAIN_MASK 0x0030 -#define MT9M021_GLOBAL_GAIN_MIN 100000 -#define MT9M021_GLOBAL_GAIN_MAX 796000 +#define MT9M021_GLOBAL_GAIN_MIN 100 +#define MT9M021_GLOBAL_GAIN_MAX 762 #define MT9M021_GLOBAL_GAIN_DEF 100 #define MT9M021_COARSE_INT_TIME_MIN 0x0001 @@ -420,15 +420,15 @@ static int mt9m021_set_gain(struct tegracam_device *tc_dev, s64 val) * GAIN: VAL / STEPS; * STEPS: 1/32 * - * SCALE FACTOR = 100.000 + * SCALE FACTOR = 32 * - * min_gain_val = 100.000 - * max_gain_val = 797.000 - * gain_factor = 3125 + * min_gain_val = 100 + * max_gain_val = 762 + * gain_factor = 3 * * gain maps to range 32 - 255 */ - gain = val / 3125; + gain = val / 3; /* Update analog gain multiplier */ err = mt9m021_read_reg16(s_data, MT9M021_DIGITAL_TEST, ®16); @@ -527,12 +527,12 @@ static int mt9m021_set_coarse_time(struct mt9m021 *priv, s64 val) static int mt9m021_set_exposure(struct tegracam_device *tc_dev, s64 val) { - struct camera_common_data *s_data = tc_dev->s_data; + struct camera_common_data *s_data = tc_dev->s_data; struct mt9m021 *priv = (struct mt9m021 *)tc_dev->priv; struct device *dev = tc_dev->dev; - const struct sensor_mode_properties *mode = + const struct sensor_mode_properties *mode = &s_data->sensor_props.sensor_modes[s_data->mode]; - u64 coarse_time; + u64 coarse_time; int err = 0; dev_dbg(dev, "Setting Exposure Time to : %lld", val);