From ace8c4eb8780a203eca33f189ee7947c6fb876a8 Mon Sep 17 00:00:00 2001 From: dchvs Date: Tue, 12 Jan 2021 16:45:16 -0600 Subject: [PATCH] Squashed commit of the following: commit 3ebe94f901eb91708ba986682790f09faa0a7468 Merge: 2d524ea9c 4d1b1ffa5 Author: Daniel Chaves <75323587+dchvs@users.noreply.github.com> Date: Tue Jan 12 12:43:07 2021 -0600 Merge pull request #16 from RidgeRun/4.4.1/evm/imx477-dev 4.4.1/evm/imx477 dev commit 4d1b1ffa56ad91ffeee143d5456a6731e70d78df Author: dchvs Date: Sun Jan 10 13:33:05 2021 -0600 Enable 2 cameras for Jetson Nano B01 revision commit a9c89fbb92b69b80aee5772d8a5baf6c90e648b1 Author: Carlos Rodriguez Date: Mon Jul 27 09:29:54 2020 -0600 Add IMX477 RBPV3 HQ camera support Resolutions: - 1920x1080 up to 60 fps - 4032x3040 up to 30 fps --- .../tegra194-camera-jakku-rbpcv3-imx477.dtsi | 59 ++ .../common/tegra194-camera-rbpcv3-imx477.dtsi | 369 ++++++++++++ .../tegra210-camera-rbpcv3-dual-imx477.dtsi | 559 ++++++++++++++++++ .../tegra210-camera-rbpcv3-imx477.dtsi | 324 ++++++++++ ...gra210-porg-camera-rbpcv3-dual-imx477.dtsi | 62 ++ .../tegra210-porg-camera-rbpcv3-imx477.dtsi | 40 ++ .../tegra210-porg-plugin-manager.dtsi | 120 ++-- .../tegra210-porg-p3448-common.dtsi | 4 +- nvidia/drivers/media/i2c/imx477.c | 24 +- 9 files changed, 1500 insertions(+), 61 deletions(-) create mode 100644 nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-camera-jakku-rbpcv3-imx477.dtsi create mode 100644 nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-camera-rbpcv3-imx477.dtsi create mode 100644 nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-camera-rbpcv3-dual-imx477.dtsi create mode 100644 nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-camera-rbpcv3-imx477.dtsi create mode 100644 nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-camera-rbpcv3-dual-imx477.dtsi create mode 100644 nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-camera-rbpcv3-imx477.dtsi diff --git a/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-camera-jakku-rbpcv3-imx477.dtsi b/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-camera-jakku-rbpcv3-imx477.dtsi new file mode 100644 index 000000000..9a034f5c9 --- /dev/null +++ b/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-camera-jakku-rbpcv3-imx477.dtsi @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020, RidgeRun. All rights reserved. + * + * Contact us: support@ridgerun.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "tegra194-camera-rbpcv3-imx477.dtsi" + +#define CAM0_PWDN TEGRA194_MAIN_GPIO(P, 4) +#define CAM1_PWDN TEGRA194_MAIN_GPIO(P, 5) +#define CAM_I2C_MUX TEGRA194_AON_GPIO(CC, 3) + +/ { + cam_i2cmux{ + compatible = "i2c-mux-gpio"; + #address-cells = <1>; + #size-cells = <0>; + i2c-parent = <&cam_i2c>; + mux-gpios = <&tegra_aon_gpio CAM_I2C_MUX GPIO_ACTIVE_HIGH>; + i2c@0 { + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + rbpcv3_imx477_a@1a { + reset-gpios = <&tegra_main_gpio CAM0_PWDN GPIO_ACTIVE_HIGH>; + }; + }; + i2c@1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + rbpcv3_imx477_c@1a { + reset-gpios = <&tegra_main_gpio CAM1_PWDN GPIO_ACTIVE_HIGH>; + }; + }; + }; + + gpio@2200000 { + camera-control-output-low { + gpio-hog; + output-low; + gpios = ; + label = "cam0-pwdn","cam1-pwdn"; + }; + }; +}; diff --git a/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-camera-rbpcv3-imx477.dtsi b/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-camera-rbpcv3-imx477.dtsi new file mode 100644 index 000000000..3b38727cd --- /dev/null +++ b/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-camera-rbpcv3-imx477.dtsi @@ -0,0 +1,369 @@ +/* + * Copyright (c) 2020, RidgeRun. All rights reserved. + * + * Contact us: support@ridgerun.com + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include + +/ { + host1x { + vi@15c10000 { + num-channels = <2>; + ports { + #address-cells = <1>; + #size-cells = <0>; + vi_port0: port@0 { + reg = <0>; + rbpcv3_imx477_vi_in0: endpoint { + status = "okay"; + port-index = <0>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_csi_out0>; + }; + }; + vi_port1: port@1 { + reg = <1>; + rbpcv3_imx477_vi_in1: endpoint { + status = "okay"; + port-index = <2>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_csi_out1>; + }; + }; + }; + }; + + nvcsi@15a00000 { + num-channels = <2>; + #address-cells = <1>; + #size-cells = <0>; + csi_chan0: channel@0 { + reg = <0>; + ports { + #address-cells = <1>; + #size-cells = <0>; + csi_chan0_port0: port@0 { + reg = <0>; + status = "okay"; + rbpcv3_imx477_csi_in0: endpoint@0 { + port-index = <0>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_out0>; + }; + }; + csi_chan0_port1: port@1 { + reg = <1>; + status = "okay"; + rbpcv3_imx477_csi_out0: endpoint@1 { + status = "okay"; + remote-endpoint = <&rbpcv3_imx477_vi_in0>; + }; + }; + }; + }; + csi_chan1: channel@1 { + reg = <1>; + ports { + #address-cells = <1>; + #size-cells = <0>; + csi_chan1_port0: port@0 { + reg = <0>; + rbpcv3_imx477_csi_in1: endpoint@2 { + port-index = <2>; + bus-width = <2>; + status = "okay"; + remote-endpoint = <&rbpcv3_imx477_out1>; + }; + }; + csi_chan1_port1: port@1 { + reg = <1>; + status = "okay"; + rbpcv3_imx477_csi_out1: endpoint@3 { + remote-endpoint = <&rbpcv3_imx477_vi_in1>; + }; + }; + }; + }; + }; + }; + + cam_i2cmux { + i2c_0:i2c@0 { + imx477_cam0: rbpcv3_imx477_a@1a { + compatible = "ridgerun,imx477"; + /* I2C device address */ + reg = <0x1a>; + + /* V4L2 device node location */ + devnode = "video0"; + + /* Physical dimensions of sensor */ + physical_w = "7.564"; + physical_h = "5.476"; + + sensor_model = "imx477"; + + use_sensor_mode_id = "true"; + + mode0 { /* IMX477_MODE_4032X3040 */ + mclk_khz = "24000"; + num_lanes = "2"; + tegra_sinterface = "serial_a"; + phy_mode = "DPHY"; + discontinuous_clk = "no"; + dpcm_enable = "false"; + cil_settletime = "0"; + + active_w = "4032"; + active_h = "3040"; + mode_type = "bayer"; + pixel_phase = "rggb"; + csi_pixel_bit_depth = "10"; + readout_orientation = "90"; + line_length = "9024"; + inherent_gain = "1"; + mclk_multiplier = "80"; + pix_clk_hz = "840000000"; + + gain_factor = "16"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "16"; /* 1.00x */ + max_gain_val = "356"; /* 22x */ + step_gain_val = "1"; + default_gain = "16"; /* 1.00x */ + min_hdr_ratio = "1"; + max_hdr_ratio = "1"; + min_framerate = "2000000"; /* 2.0 fps */ + max_framerate = "30000000"; /* 30.0 fps */ + step_framerate = "1"; + default_framerate = "30000000"; /* 30.0 fps */ + min_exp_time = "13"; /* us */ + max_exp_time = "683709"; /* us */ + step_exp_time = "1"; + default_exp_time = "2495"; /* us */ + + embedded_metadata_height = "2"; + }; + mode1 { /* IMX477_MODE_1920X1080 */ + mclk_khz = "24000"; + num_lanes = "2"; + tegra_sinterface = "serial_a"; + phy_mode = "DPHY"; + discontinuous_clk = "no"; + dpcm_enable = "false"; + cil_settletime = "0"; + + active_w = "1920"; + active_h = "1080"; + mode_type = "bayer"; + pixel_phase = "rggb"; + csi_pixel_bit_depth = "10"; + readout_orientation = "90"; + line_length = "9024"; + inherent_gain = "1"; + mclk_multiplier = "80"; + pix_clk_hz = "840000000"; + + gain_factor = "16"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "16"; /* 1.00x */ + max_gain_val = "356"; /* 22x */ + step_gain_val = "1"; + default_gain = "16"; /* 1.00x */ + min_hdr_ratio = "1"; + max_hdr_ratio = "1"; + min_framerate = "2000000"; /* 2.0 fps */ + max_framerate = "60000000"; /* 60.0 fps */ + step_framerate = "1"; + default_framerate = "60000000"; /* 60.0 fps */ + min_exp_time = "13"; /* us */ + max_exp_time = "683709"; /* us */ + step_exp_time = "1"; + default_exp_time = "2495"; /* us */ + + embedded_metadata_height = "2"; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + rbpcv3_imx477_out0: endpoint { + port-index = <0>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_csi_in0>; + }; + }; + }; + }; + }; + i2c_1: i2c@1 { + imx477_cam1: rbpcv3_imx477_c@1a { + compatible = "ridgerun,imx477"; + /* I2C device address */ + reg = <0x1a>; + + /* V4L2 device node location */ + devnode = "video1"; + + /* Physical dimensions of sensor */ + physical_w = "7.564"; + physical_h = "5.476"; + + sensor_model = "imx477"; + + use_sensor_mode_id = "true"; + + mode0 { /* IMX477_MODE_4032X3040 */ + mclk_khz = "24000"; + num_lanes = "2"; + tegra_sinterface = "serial_c"; + phy_mode = "DPHY"; + discontinuous_clk = "no"; + dpcm_enable = "false"; + cil_settletime = "0"; + + active_w = "4032"; + active_h = "3040"; + mode_type = "bayer"; + pixel_phase = "rggb"; + csi_pixel_bit_depth = "10"; + readout_orientation = "90"; + line_length = "9024"; + inherent_gain = "1"; + mclk_multiplier = "80"; + pix_clk_hz = "840000000"; + + gain_factor = "16"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "16"; /* 1.00x */ + max_gain_val = "356"; /* 22x */ + step_gain_val = "1"; + default_gain = "16"; /* 1.00x */ + min_hdr_ratio = "1"; + max_hdr_ratio = "1"; + min_framerate = "2000000"; /* 2.0 fps */ + max_framerate = "30000000"; /* 30.0 fps */ + step_framerate = "1"; + default_framerate = "30000000"; /* 30.0 fps */ + min_exp_time = "13"; /* us */ + max_exp_time = "683709"; /* us */ + step_exp_time = "1"; + default_exp_time = "2495"; /* us */ + + embedded_metadata_height = "2"; + }; + mode1 { /* IMX477_MODE_1920X1080 */ + mclk_khz = "24000"; + num_lanes = "2"; + tegra_sinterface = "serial_c"; + phy_mode = "DPHY"; + discontinuous_clk = "no"; + dpcm_enable = "false"; + cil_settletime = "0"; + + active_w = "1920"; + active_h = "1080"; + mode_type = "bayer"; + pixel_phase = "rggb"; + csi_pixel_bit_depth = "10"; + readout_orientation = "90"; + line_length = "9024"; + inherent_gain = "1"; + mclk_multiplier = "80"; + pix_clk_hz = "840000000"; + + gain_factor = "16"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "16"; /* 1.00x */ + max_gain_val = "356"; /* 22x */ + step_gain_val = "1"; + default_gain = "16"; /* 1.00x */ + min_hdr_ratio = "1"; + max_hdr_ratio = "1"; + min_framerate = "2000000"; /* 2.0 fps */ + max_framerate = "60000000"; /* 60.0 fps */ + step_framerate = "1"; + default_framerate = "60000000"; /* 60.0 fps */ + min_exp_time = "13"; /* us */ + max_exp_time = "683709"; /* us */ + step_exp_time = "1"; + default_exp_time = "2495"; /* us */ + + embedded_metadata_height = "2"; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + port@0 { + reg = <0>; + rbpcv3_imx477_out1: endpoint { + port-index = <2>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_csi_in1>; + }; + }; + }; + }; + }; + }; +}; +/ { + tcp: tegra-camera-platform { + compatible = "nvidia, tegra-camera-platform"; + num_csi_lanes = <4>; + max_lane_speed = <1500000>; + min_bits_per_pixel = <10>; + vi_peak_byte_per_pixel = <2>; + vi_bw_margin_pct = <25>; + max_pixel_rate = <7500000>; + isp_peak_byte_per_pixel = <5>; + isp_bw_margin_pct = <25>; + + modules { + cam_module0: module0 { + badge = "jakku_front_RBP194"; + position = "front"; + orientation = "1"; + status = "okay"; + cam_module0_drivernode0: drivernode0 { + status = "okay"; + pcl_id = "v4l2_sensor"; + devname = "imx477 9-001a"; + proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/rbpcv3_imx477_a@1a"; + }; + }; + cam_module1: module1 { + badge = "jakku_rear_RBP194"; + position = "rear"; + orientation = "1"; + status = "okay"; + cam_module1_drivernode0: drivernode0 { + status = "okay"; + pcl_id = "v4l2_sensor"; + devname = "imx477 10-001a"; + proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/rbpcv3_imx477_c@1a"; + }; + }; + }; + }; +}; diff --git a/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-camera-rbpcv3-dual-imx477.dtsi b/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-camera-rbpcv3-dual-imx477.dtsi new file mode 100644 index 000000000..5a9358f89 --- /dev/null +++ b/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-camera-rbpcv3-dual-imx477.dtsi @@ -0,0 +1,559 @@ +/* + * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include + +/ { + host1x { + vi_base: vi { + num-channels = <2>; + ports { + #address-cells = <1>; + #size-cells = <0>; + vi_port0: port@0 { + reg = <0>; + rbpcv3_imx477_vi_in0: endpoint { + port-index = <0>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_csi_out0>; + }; + }; + vi_port1: port@1 { + reg = <1>; + rbpcv3_imx477_vi_in1: endpoint { + port-index = <4>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_csi_out1>; + }; + }; + }; + }; + + csi_base: nvcsi { + num-channels = <2>; + #address-cells = <1>; + #size-cells = <0>; + csi_chan0: channel@0 { + reg = <0>; + ports { + #address-cells = <1>; + #size-cells = <0>; + csi_chan0_port0: port@0 { + reg = <0>; + rbpcv3_imx477_csi_in0: endpoint@0 { + port-index = <0>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_dual_out0>; + }; + }; + csi_chan0_port1: port@1 { + reg = <1>; + rbpcv3_imx477_csi_out0: endpoint@1 { + remote-endpoint = <&rbpcv3_imx477_vi_in0>; + }; + }; + }; + }; + csi_chan1: channel@1 { + reg = <1>; + ports { + #address-cells = <1>; + #size-cells = <0>; + csi_chan1_port0: port@2 { + reg = <0>; + rbpcv3_imx477_csi_in1: endpoint@2 { + port-index = <4>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_out1>; + }; + }; + csi_chan1_port1: port@3 { + reg = <1>; + rbpcv3_imx477_csi_out1: endpoint@3 { + remote-endpoint = <&rbpcv3_imx477_vi_in1>; + }; + }; + }; + }; + }; + }; + + cam_i2cmux { + i2c_0: i2c@0 { + imx477_cam0: rbpcv3_imx477_a@1a { + compatible = "ridgerun,imx477"; + /* I2C device address */ + reg = <0x1a>; + + /* V4L2 device node location */ + devnode = "video0"; + + /* Physical dimensions of sensor */ + physical_w = "3.680"; + physical_h = "2.760"; + + sensor_model = "imx477"; + + use_sensor_mode_id = "true"; + + /** + * ==== Modes ==== + * A modeX node is required to support v4l2 driver + * implementation with NVIDIA camera software stack + * + * == Signal properties == + * + * phy_mode = ""; + * PHY mode used by the MIPI lanes for this device + * + * tegra_sinterface = ""; + * CSI Serial interface connected to tegra + * Incase of virtual HW devices, use virtual + * For SW emulated devices, use host + * + * pix_clk_hz = ""; + * Sensor pixel clock used for calculations like exposure and framerate + * + * readout_orientation = "0"; + * Based on camera module orientation. + * Only change readout_orientation if you specifically + * Program a different readout order for this mode + * + * == Image format Properties == + * + * active_w = ""; + * Pixel active region width + * + * active_h = ""; + * Pixel active region height + * + * pixel_t = ""; + * The sensor readout pixel pattern + * + * line_length = ""; + * Pixel line length (width) for sensor mode. + * + * == Source Control Settings == + * + * Gain factor used to convert fixed point integer to float + * Gain range [min_gain/gain_factor, max_gain/gain_factor] + * Gain step [step_gain/gain_factor is the smallest step that can be configured] + * Default gain [Default gain to be initialized for the control. + * use min_gain_val as default for optimal results] + * Framerate factor used to convert fixed point integer to float + * Framerate range [min_framerate/framerate_factor, max_framerate/framerate_factor] + * Framerate step [step_framerate/framerate_factor is the smallest step that can be configured] + * Default Framerate [Default framerate to be initialized for the control. + * use max_framerate to get required performance] + * Exposure factor used to convert fixed point integer to float + * For convenience use 1 sec = 1000000us as conversion factor + * Exposure range [min_exp_time/exposure_factor, max_exp_time/exposure_factor] + * Exposure step [step_exp_time/exposure_factor is the smallest step that can be configured] + * Default Exposure Time [Default exposure to be initialized for the control. + * Set default exposure based on the default_framerate for optimal exposure settings] + * + * gain_factor = ""; (integer factor used for floating to fixed point conversion) + * min_gain_val = ""; (ceil to integer) + * max_gain_val = ""; (ceil to integer) + * step_gain_val = ""; (ceil to integer) + * default_gain = ""; (ceil to integer) + * Gain limits for mode + * + * exposure_factor = ""; (integer factor used for floating to fixed point conversion) + * min_exp_time = ""; (ceil to integer) + * max_exp_time = ""; (ceil to integer) + * step_exp_time = ""; (ceil to integer) + * default_exp_time = ""; (ceil to integer) + * Exposure Time limits for mode (sec) + * + * framerate_factor = ""; (integer factor used for floating to fixed point conversion) + * min_framerate = ""; (ceil to integer) + * max_framerate = ""; (ceil to integer) + * step_framerate = ""; (ceil to integer) + * default_framerate = ""; (ceil to integer) + * Framerate limits for mode (fps) + * + * embedded_metadata_height = ""; + * Sensor embedded metadata height in units of rows. + * If sensor does not support embedded metadata value should be 0. + */ + mode0 { /* IMX477_MODE_4032X3040 */ + mclk_khz = "24000"; + num_lanes = "2"; + tegra_sinterface = "serial_a"; + phy_mode = "DPHY"; + discontinuous_clk = "no"; + dpcm_enable = "false"; + cil_settletime = "0"; + + active_w = "4032"; + active_h = "3040"; + mode_type = "bayer"; + pixel_phase = "rggb"; + csi_pixel_bit_depth = "10"; + readout_orientation = "90"; + line_length = "9024"; + inherent_gain = "1"; + mclk_multiplier = "80"; + pix_clk_hz = "840000000"; + + gain_factor = "16"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "16"; /* 1.00x */ + max_gain_val = "356"; /* 22x */ + step_gain_val = "1"; + default_gain = "16"; /* 1.00x */ + min_hdr_ratio = "1"; + max_hdr_ratio = "1"; + min_framerate = "2000000"; /* 2.0 fps */ + max_framerate = "30000000"; /* 30.0 fps */ + step_framerate = "1"; + default_framerate = "30000000"; /* 30.0 fps */ + min_exp_time = "13"; /* us */ + max_exp_time = "683709"; /* us */ + step_exp_time = "1"; + default_exp_time = "2495"; /* us */ + + embedded_metadata_height = "2"; + }; + mode1 { /* IMX477_MODE_1920X1080 */ + mclk_khz = "24000"; + num_lanes = "2"; + tegra_sinterface = "serial_a"; + phy_mode = "DPHY"; + discontinuous_clk = "no"; + dpcm_enable = "false"; + cil_settletime = "0"; + + active_w = "1920"; + active_h = "1080"; + mode_type = "bayer"; + pixel_phase = "rggb"; + csi_pixel_bit_depth = "10"; + readout_orientation = "90"; + line_length = "9024"; + inherent_gain = "1"; + mclk_multiplier = "80"; + pix_clk_hz = "840000000"; + + gain_factor = "16"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "16"; /* 1.00x */ + max_gain_val = "356"; /* 22x */ + step_gain_val = "1"; + default_gain = "16"; /* 1.00x */ + min_hdr_ratio = "1"; + max_hdr_ratio = "1"; + min_framerate = "2000000"; /* 2.0 fps */ + max_framerate = "60000000"; /* 60.0 fps */ + step_framerate = "1"; + default_framerate = "60000000"; /* 60.0 fps */ + min_exp_time = "13"; /* us */ + max_exp_time = "683709"; /* us */ + step_exp_time = "1"; + default_exp_time = "2495"; /* us */ + + embedded_metadata_height = "2"; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + rbpcv3_imx477_dual_out0: endpoint { + port-index = <0>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_csi_in0>; + }; + }; + }; + }; + }; + i2c_1: i2c@1 { + imx477_cam1: rbpcv3_imx477_e@1a { + compatible = "nvidia,imx477"; + /* I2C device address */ + reg = <0x1a>; + + /* V4L2 device node location */ + devnode = "video1"; + + /* Physical dimensions of sensor */ + physical_w = "3.680"; + physical_h = "2.760"; + + sensor_model = "imx477"; + + use_sensor_mode_id = "true"; + + /** + * ==== Modes ==== + * A modeX node is required to support v4l2 driver + * implementation with NVIDIA camera software stack + * + * == Signal properties == + * + * phy_mode = ""; + * PHY mode used by the MIPI lanes for this device + * + * tegra_sinterface = ""; + * CSI Serial interface connected to tegra + * Incase of virtual HW devices, use virtual + * For SW emulated devices, use host + * + * pix_clk_hz = ""; + * Sensor pixel clock used for calculations like exposure and framerate + * + * readout_orientation = "0"; + * Based on camera module orientation. + * Only change readout_orientation if you specifically + * Program a different readout order for this mode + * + * == Image format Properties == + * + * active_w = ""; + * Pixel active region width + * + * active_h = ""; + * Pixel active region height + * + * pixel_t = ""; + * The sensor readout pixel pattern + * + * line_length = ""; + * Pixel line length (width) for sensor mode. + * + * == Source Control Settings == + * + * Gain factor used to convert fixed point integer to float + * Gain range [min_gain/gain_factor, max_gain/gain_factor] + * Gain step [step_gain/gain_factor is the smallest step that can be configured] + * Default gain [Default gain to be initialized for the control. + * use min_gain_val as default for optimal results] + * Framerate factor used to convert fixed point integer to float + * Framerate range [min_framerate/framerate_factor, max_framerate/framerate_factor] + * Framerate step [step_framerate/framerate_factor is the smallest step that can be configured] + * Default Framerate [Default framerate to be initialized for the control. + * use max_framerate to get required performance] + * Exposure factor used to convert fixed point integer to float + * For convenience use 1 sec = 1000000us as conversion factor + * Exposure range [min_exp_time/exposure_factor, max_exp_time/exposure_factor] + * Exposure step [step_exp_time/exposure_factor is the smallest step that can be configured] + * Default Exposure Time [Default exposure to be initialized for the control. + * Set default exposure based on the default_framerate for optimal exposure settings] + * + * gain_factor = ""; (integer factor used for floating to fixed point conversion) + * min_gain_val = ""; (ceil to integer) + * max_gain_val = ""; (ceil to integer) + * step_gain_val = ""; (ceil to integer) + * default_gain = ""; (ceil to integer) + * Gain limits for mode + * + * exposure_factor = ""; (integer factor used for floating to fixed point conversion) + * min_exp_time = ""; (ceil to integer) + * max_exp_time = ""; (ceil to integer) + * step_exp_time = ""; (ceil to integer) + * default_exp_time = ""; (ceil to integer) + * Exposure Time limits for mode (sec) + * + * framerate_factor = ""; (integer factor used for floating to fixed point conversion) + * min_framerate = ""; (ceil to integer) + * max_framerate = ""; (ceil to integer) + * step_framerate = ""; (ceil to integer) + * default_framerate = ""; (ceil to integer) + * Framerate limits for mode (fps) + * + * embedded_metadata_height = ""; + * Sensor embedded metadata height in units of rows. + * If sensor does not support embedded metadata value should be 0. + */ + mode0 { /* IMX477_MODE_4032X3040 */ + mclk_khz = "24000"; + num_lanes = "2"; + tegra_sinterface = "serial_e"; + phy_mode = "DPHY"; + discontinuous_clk = "no"; + dpcm_enable = "false"; + cil_settletime = "0"; + + active_w = "4032"; + active_h = "3040"; + mode_type = "bayer"; + pixel_phase = "rggb"; + csi_pixel_bit_depth = "10"; + readout_orientation = "90"; + line_length = "9024"; + inherent_gain = "1"; + mclk_multiplier = "80"; + pix_clk_hz = "840000000"; + + gain_factor = "16"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "16"; /* 1.00x */ + max_gain_val = "356"; /* 22x */ + step_gain_val = "1"; + default_gain = "16"; /* 1.00x */ + min_hdr_ratio = "1"; + max_hdr_ratio = "1"; + min_framerate = "2000000"; /* 2.0 fps */ + max_framerate = "30000000"; /* 30.0 fps */ + step_framerate = "1"; + default_framerate = "30000000"; /* 30.0 fps */ + min_exp_time = "13"; /* us */ + max_exp_time = "683709"; /* us */ + step_exp_time = "1"; + default_exp_time = "2495"; /* us */ + + embedded_metadata_height = "2"; + }; + mode1 { /* IMX477_MODE_1920X1080 */ + mclk_khz = "24000"; + num_lanes = "2"; + tegra_sinterface = "serial_e"; + phy_mode = "DPHY"; + discontinuous_clk = "no"; + dpcm_enable = "false"; + cil_settletime = "0"; + + active_w = "1920"; + active_h = "1080"; + mode_type = "bayer"; + pixel_phase = "rggb"; + csi_pixel_bit_depth = "10"; + readout_orientation = "90"; + line_length = "9024"; + inherent_gain = "1"; + mclk_multiplier = "80"; + pix_clk_hz = "840000000"; + + gain_factor = "16"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "16"; /* 1.00x */ + max_gain_val = "356"; /* 22x */ + step_gain_val = "1"; + default_gain = "16"; /* 1.00x */ + min_hdr_ratio = "1"; + max_hdr_ratio = "1"; + min_framerate = "2000000"; /* 2.0 fps */ + max_framerate = "60000000"; /* 60.0 fps */ + step_framerate = "1"; + default_framerate = "60000000"; /* 60.0 fps */ + min_exp_time = "13"; /* us */ + max_exp_time = "683709"; /* us */ + step_exp_time = "1"; + default_exp_time = "2495"; /* us */ + + embedded_metadata_height = "2"; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + rbpcv3_imx477_out1: endpoint { + port-index = <4>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_csi_in1>; + }; + }; + }; + }; + }; + }; +}; + +/ { + tcp: tegra-camera-platform { + compatible = "nvidia, tegra-camera-platform"; + + /** + * Physical settings to calculate max ISO BW + * + * num_csi_lanes = <>; + * Total number of CSI lanes when all cameras are active + * + * max_lane_speed = <>; + * Max lane speed in Kbit/s + * + * min_bits_per_pixel = <>; + * Min bits per pixel + * + * vi_peak_byte_per_pixel = <>; + * Max byte per pixel for the VI ISO case + * + * vi_bw_margin_pct = <>; + * Vi bandwidth margin in percentage + * + * max_pixel_rate = <>; + * Max pixel rate in Kpixel/s for the ISP ISO case + * + * isp_peak_byte_per_pixel = <>; + * Max byte per pixel for the ISP ISO case + * + * isp_bw_margin_pct = <>; + * Isp bandwidth margin in percentage + */ + num_csi_lanes = <4>; + max_lane_speed = <1500000>; + min_bits_per_pixel = <10>; + vi_peak_byte_per_pixel = <2>; + vi_bw_margin_pct = <25>; + max_pixel_rate = <7500000>; + isp_peak_byte_per_pixel = <5>; + isp_bw_margin_pct = <25>; + + /** + * The general guideline for naming badge_info contains 3 parts, and is as follows, + * The first part is the camera_board_id for the module; if the module is in a FFD + * platform, then use the platform name for this part. + * The second part contains the position of the module, ex. "rear" or "front". + * The third part contains the last 6 characters of a part number which is found + * in the module's specsheet from the vendor. + */ + modules { + cam_module0: module0 { + badge = "porg_front_RBPCV3"; + position = "front"; + orientation = "1"; + cam_module0_drivernode0: drivernode0 { + pcl_id = "v4l2_sensor"; + devname = "imx477 7-001a"; + proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/rbpcv3_imx477_a@1a"; + }; + }; + cam_module1: module1 { + badge = "porg_rear_RBPCV3"; + position = "rear"; + orientation = "1"; + cam_module1_drivernode0: drivernode0 { + pcl_id = "v4l2_sensor"; + devname = "imx477 8-001a"; + proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/rbpcv3_imx477_e@1a"; + }; + }; + }; + }; +}; diff --git a/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-camera-rbpcv3-imx477.dtsi b/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-camera-rbpcv3-imx477.dtsi new file mode 100644 index 000000000..c274178f8 --- /dev/null +++ b/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-camera-rbpcv3-imx477.dtsi @@ -0,0 +1,324 @@ +/* + * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include +#include + +/ { + host1x { + vi_base: vi { + num-channels = <1>; + ports { + #address-cells = <1>; + #size-cells = <0>; + vi_port0: port@0 { + reg = <0>; + rbpcv3_imx477_vi_in0: endpoint { + port-index = <0>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_csi_out0>; + }; + }; + }; + }; + + csi_base: nvcsi { + num-channels = <1>; + #address-cells = <1>; + #size-cells = <0>; + csi_chan0: channel@0 { + reg = <0>; + ports { + #address-cells = <1>; + #size-cells = <0>; + csi_chan0_port0: port@0 { + reg = <0>; + rbpcv3_imx477_csi_in0: endpoint@0 { + port-index = <0>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_out0>; + }; + }; + csi_chan0_port1: port@1 { + reg = <1>; + rbpcv3_imx477_csi_out0: endpoint@1 { + remote-endpoint = <&rbpcv3_imx477_vi_in0>; + }; + }; + }; + }; + }; + + i2c@546c0000 { + imx477_single_cam0: rbpcv3_imx477_a@1a { + compatible = "ridgerun,imx477"; + /* I2C device address */ + reg = <0x1a>; + + /* V4L2 device node location */ + devnode = "video0"; + + /* Physical dimensions of sensor */ + physical_w = "3.680"; + physical_h = "2.760"; + + sensor_model = "imx477"; + + use_sensor_mode_id = "true"; + + /** + * ==== Modes ==== + * A modeX node is required to support v4l2 driver + * implementation with NVIDIA camera software stack + * + * == Signal properties == + * + * phy_mode = ""; + * PHY mode used by the MIPI lanes for this device + * + * tegra_sinterface = ""; + * CSI Serial interface connected to tegra + * Incase of virtual HW devices, use virtual + * For SW emulated devices, use host + * + * pix_clk_hz = ""; + * Sensor pixel clock used for calculations like exposure and framerate + * + * readout_orientation = "0"; + * Based on camera module orientation. + * Only change readout_orientation if you specifically + * Program a different readout order for this mode + * + * == Image format Properties == + * + * active_w = ""; + * Pixel active region width + * + * active_h = ""; + * Pixel active region height + * + * pixel_t = ""; + * The sensor readout pixel pattern + * + * line_length = ""; + * Pixel line length (width) for sensor mode. + * + * == Source Control Settings == + * + * Gain factor used to convert fixed point integer to float + * Gain range [min_gain/gain_factor, max_gain/gain_factor] + * Gain step [step_gain/gain_factor is the smallest step that can be configured] + * Default gain [Default gain to be initialized for the control. + * use min_gain_val as default for optimal results] + * Framerate factor used to convert fixed point integer to float + * Framerate range [min_framerate/framerate_factor, max_framerate/framerate_factor] + * Framerate step [step_framerate/framerate_factor is the smallest step that can be configured] + * Default Framerate [Default framerate to be initialized for the control. + * use max_framerate to get required performance] + * Exposure factor used to convert fixed point integer to float + * For convenience use 1 sec = 1000000us as conversion factor + * Exposure range [min_exp_time/exposure_factor, max_exp_time/exposure_factor] + * Exposure step [step_exp_time/exposure_factor is the smallest step that can be configured] + * Default Exposure Time [Default exposure to be initialized for the control. + * Set default exposure based on the default_framerate for optimal exposure settings] + * + * gain_factor = ""; (integer factor used for floating to fixed point conversion) + * min_gain_val = ""; (ceil to integer) + * max_gain_val = ""; (ceil to integer) + * step_gain_val = ""; (ceil to integer) + * default_gain = ""; (ceil to integer) + * Gain limits for mode + * + * exposure_factor = ""; (integer factor used for floating to fixed point conversion) + * min_exp_time = ""; (ceil to integer) + * max_exp_time = ""; (ceil to integer) + * step_exp_time = ""; (ceil to integer) + * default_exp_time = ""; (ceil to integer) + * Exposure Time limits for mode (sec) + * + * framerate_factor = ""; (integer factor used for floating to fixed point conversion) + * min_framerate = ""; (ceil to integer) + * max_framerate = ""; (ceil to integer) + * step_framerate = ""; (ceil to integer) + * default_framerate = ""; (ceil to integer) + * Framerate limits for mode (fps) + * + * embedded_metadata_height = ""; + * Sensor embedded metadata height in units of rows. + * If sensor does not support embedded metadata value should be 0. + */ + mode0 { /* IMX477_MODE_4032X3040 */ + mclk_khz = "24000"; + num_lanes = "2"; + tegra_sinterface = "serial_a"; + phy_mode = "DPHY"; + discontinuous_clk = "no"; + dpcm_enable = "false"; + cil_settletime = "0"; + + active_w = "4032"; + active_h = "3040"; + mode_type = "bayer"; + pixel_phase = "rggb"; + csi_pixel_bit_depth = "10"; + readout_orientation = "90"; + line_length = "9024"; + inherent_gain = "1"; + mclk_multiplier = "80"; + pix_clk_hz = "840000000"; + + gain_factor = "16"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "16"; /* 1.00x */ + max_gain_val = "356"; /* 22x */ + step_gain_val = "1"; + default_gain = "16"; /* 1.00x */ + min_hdr_ratio = "1"; + max_hdr_ratio = "1"; + min_framerate = "2000000"; /* 2.0 fps */ + max_framerate = "30000000"; /* 30.0 fps */ + step_framerate = "1"; + default_framerate = "30000000"; /* 30.0 fps */ + min_exp_time = "13"; /* us */ + max_exp_time = "683709"; /* us */ + step_exp_time = "1"; + default_exp_time = "2495"; /* us */ + + embedded_metadata_height = "2"; + }; + mode1 { /* IMX477_MODE_1920X1080 */ + mclk_khz = "24000"; + num_lanes = "2"; + tegra_sinterface = "serial_a"; + phy_mode = "DPHY"; + discontinuous_clk = "no"; + dpcm_enable = "false"; + cil_settletime = "0"; + + active_w = "1920"; + active_h = "1080"; + mode_type = "bayer"; + pixel_phase = "rggb"; + csi_pixel_bit_depth = "10"; + readout_orientation = "90"; + line_length = "9024"; + inherent_gain = "1"; + mclk_multiplier = "80"; + pix_clk_hz = "840000000"; + + gain_factor = "16"; + framerate_factor = "1000000"; + exposure_factor = "1000000"; + min_gain_val = "16"; /* 1.00x */ + max_gain_val = "356"; /* 22x */ + step_gain_val = "1"; + default_gain = "16"; /* 1.00x */ + min_hdr_ratio = "1"; + max_hdr_ratio = "1"; + min_framerate = "2000000"; /* 2.0 fps */ + max_framerate = "60000000"; /* 60.0 fps */ + step_framerate = "1"; + default_framerate = "60000000"; /* 60.0 fps */ + min_exp_time = "13"; /* us */ + max_exp_time = "683709"; /* us */ + step_exp_time = "1"; + default_exp_time = "2495"; /* us */ + + embedded_metadata_height = "2"; + }; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + rbpcv3_imx477_out0: endpoint { + port-index = <0>; + bus-width = <2>; + remote-endpoint = <&rbpcv3_imx477_csi_in0>; + }; + }; + }; + }; + }; + }; +}; + +/ { + tcp: tegra-camera-platform { + compatible = "nvidia, tegra-camera-platform"; + + /** + * Physical settings to calculate max ISO BW + * + * num_csi_lanes = <>; + * Total number of CSI lanes when all cameras are active + * + * max_lane_speed = <>; + * Max lane speed in Kbit/s + * + * min_bits_per_pixel = <>; + * Min bits per pixel + * + * vi_peak_byte_per_pixel = <>; + * Max byte per pixel for the VI ISO case + * + * vi_bw_margin_pct = <>; + * Vi bandwidth margin in percentage + * + * max_pixel_rate = <>; + * Max pixel rate in Kpixel/s for the ISP ISO case + * + * isp_peak_byte_per_pixel = <>; + * Max byte per pixel for the ISP ISO case + * + * isp_bw_margin_pct = <>; + * Isp bandwidth margin in percentage + */ + num_csi_lanes = <2>; + max_lane_speed = <1500000>; + min_bits_per_pixel = <10>; + vi_peak_byte_per_pixel = <2>; + vi_bw_margin_pct = <25>; + max_pixel_rate = <7500000>; + isp_peak_byte_per_pixel = <5>; + isp_bw_margin_pct = <25>; + + /** + * The general guideline for naming badge_info contains 3 parts, and is as follows, + * The first part is the camera_board_id for the module; if the module is in a FFD + * platform, then use the platform name for this part. + * The second part contains the position of the module, ex. "rear" or "front". + * The third part contains the last 6 characters of a part number which is found + * in the module's specsheet from the vendor. + */ + modules { + cam_module0: module0 { + badge = "porg_front_RBPCV3"; + position = "front"; + orientation = "1"; + cam_module0_drivernode0: drivernode0 { + pcl_id = "v4l2_sensor"; + devname = "imx477 6-001a"; + proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/rbpcv3_imx477_a@1a"; + }; + }; + }; + }; +}; diff --git a/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-camera-rbpcv3-dual-imx477.dtsi b/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-camera-rbpcv3-dual-imx477.dtsi new file mode 100644 index 000000000..6fd9db28a --- /dev/null +++ b/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-camera-rbpcv3-dual-imx477.dtsi @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "tegra210-camera-rbpcv3-dual-imx477.dtsi" + +#define CAM1_PWDN TEGRA_GPIO(S, 7) +#define CAM2_PWDN TEGRA_GPIO(T, 0) +#define CAM_I2C_MUX TEGRA_GPIO(I, 0) // NFC_EN GPIO + +/ { + cam_i2cmux { + compatible = "i2c-mux-gpio"; + #address-cells = <1>; + #size-cells = <0>; + mux-gpios = <&gpio CAM_I2C_MUX GPIO_ACTIVE_HIGH>; + i2c-parent = <&i2c7>; + status = "disable"; + i2c@0 { + status = "disable"; + reg = <0>; + #address-cells = <1>; + #size-cells = <0>; + rbpcv3_imx477_a@1a { + status = "disable"; + reset-gpios = <&gpio CAM1_PWDN GPIO_ACTIVE_HIGH>; + }; + }; + i2c@1 { + status = "disable"; + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + rbpcv3_imx477_e@1a { + status = "disable"; + reset-gpios = <&gpio CAM2_PWDN GPIO_ACTIVE_HIGH>; + }; + }; + }; + + gpio@6000d000 { + camera-control-output-low { + gpio-hog; + output-low; + gpios = < CAM1_PWDN 0 CAM2_PWDN 0>; + label = "cam1-pwdn", "cam2-pwdn"; + }; + }; +}; diff --git a/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-camera-rbpcv3-imx477.dtsi b/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-camera-rbpcv3-imx477.dtsi new file mode 100644 index 000000000..aeb09d65a --- /dev/null +++ b/nvidia/platform/t210/porg/kernel-dts/porg-platforms/tegra210-porg-camera-rbpcv3-imx477.dtsi @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "tegra210-camera-rbpcv3-imx477.dtsi" + +#define CAM1_PWDN TEGRA_GPIO(S, 7) + +/ { + host1x { + i2c@546c0000 { + rbpcv3_imx477_a@1a { + status = "disable"; + reset-gpios = <&gpio CAM1_PWDN GPIO_ACTIVE_HIGH>; + }; + }; + }; + + gpio@6000d000 { + camera-control-output-low { + gpio-hog; + output-low; + gpios = < CAM1_PWDN 0 >; + label = "cam1-pwdn"; + }; + }; +}; diff --git a/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi b/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi index 93ec6e387..34a57a27f 100644 --- a/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi +++ b/nvidia/platform/t210/porg/kernel-dts/porg-plugin-manager/tegra210-porg-plugin-manager.dtsi @@ -185,9 +185,9 @@ non-removable; }; }; - /* IMX219 single sensor module */ + /* IMX477 single sensor module */ override@2 { - target = <&imx219_single_cam0>; + target = <&imx477_single_cam0>; _overlay_ { status = "okay"; }; @@ -196,7 +196,7 @@ target = <&cam_module0>; _overlay_ { status = "okay"; - badge = "porg_front_RBPCV2"; + badge = "porg_front_RBPCV3"; position = "front"; orientation = "1"; }; @@ -206,16 +206,8 @@ _overlay_ { status = "okay"; pcl_id = "v4l2_sensor"; - devname = "imx219 6-0010"; - proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/rbpcv2_imx219_a@10"; - }; - }; - override@5 { - target = <&cam_module0_drivernode1>; - _overlay_ { - status = "okay"; - pcl_id = "v4l2_lens"; - proc-device-tree = "/proc/device-tree/lens_imx219@RBPCV2/"; + devname = "imx477 6-001a"; + proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/rbpcv3_imx477_a@1a"; }; }; /* Enable VI ports */ @@ -232,12 +224,12 @@ }; }; override@8 { - target = <&rbpcv2_imx219_vi_in0>; + target = <&rbpcv3_imx477_vi_in0>; _overlay_ { status = "okay"; port-index = <0>; bus-width = <2>; - remote-endpoint = <&rbpcv2_imx219_csi_out0>; + remote-endpoint = <&rbpcv3_imx477_csi_out0>; }; }; /* Enable CSI ports */ @@ -260,12 +252,12 @@ }; }; override@12 { - target = <&rbpcv2_imx219_csi_in0>; + target = <&rbpcv3_imx477_csi_in0>; _overlay_ { status = "okay"; port-index = <0>; bus-width = <2>; - remote-endpoint = <&rbpcv2_imx219_out0>; + remote-endpoint = <&rbpcv3_imx477_out0>; }; }; override@13 { @@ -275,10 +267,10 @@ }; }; override@14 { - target = <&rbpcv2_imx219_csi_out0>; + target = <&rbpcv3_imx477_csi_out0>; _overlay_ { status = "okay"; - remote-endpoint = <&rbpcv2_imx219_vi_in0>; + remote-endpoint = <&rbpcv3_imx477_vi_in0>; }; }; /* tegra-camera-platform settings */ @@ -307,8 +299,46 @@ ids = ">=3448-0000-300", ">=3448-0002-300"; /* IMX219 dual sensor module */ + override@0 { + target = <&{/pcie@1003000/pci@2,0}>; + _overlay_ { + nvidia,plat-gpios = <&gpio TEGRA_GPIO(CC, 7) GPIO_ACTIVE_HIGH>; + }; + }; + override@1 { + target = <&sdhci2>; + _overlay_ { + vqmmc-supply = <&max77620_ldo6>; + no-sdio; + no-mmc; + sd-uhs-sdr104; + sd-uhs-sdr50; + sd-uhs-sdr25; + sd-uhs-sdr12; + }; + }; + override@2 { + target = <&throttle_oc1>; + _overlay_ { + nvidia,priority = <50>; + nvidia,polarity-active-low = <1>; + nvidia,count-threshold = <1>; + nvidia,alarm-filter = <5100000>; + nvidia,alarm-period = <0>; + nvidia,cpu-throt-percent = <75>; + nvidia,gpu-throt-level = + ; + }; + }; + override@3 { + target = <&{/leds}>; + _overlay_ { + status = "okay"; + }; + }; + /* IMX477 dual sensor module */ override@4 { - target = <&imx219_cam0>; + target = <&imx477_cam0>; _overlay_ { status = "okay"; }; @@ -317,7 +347,7 @@ target = <&cam_module0>; _overlay_ { status = "okay"; - badge = "porg_front_RBPCV2"; + badge = "porg_front_RBPCV3"; position = "front"; orientation = "1"; }; @@ -327,20 +357,12 @@ _overlay_ { status = "okay"; pcl_id = "v4l2_sensor"; - devname = "imx219 7-0010"; - proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/rbpcv2_imx219_a@10"; - }; - }; - override@7 { - target = <&cam_module0_drivernode1>; - _overlay_ { - status = "okay"; - pcl_id = "v4l2_lens"; - proc-device-tree = "/proc/device-tree/lens_imx219@RBPCV2/"; + devname = "imx477 7-001a"; + proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@0/rbpcv3_imx477_a@1a"; }; }; override@8 { - target = <&imx219_cam1>; + target = <&imx477_cam1>; _overlay_ { status = "okay"; }; @@ -349,7 +371,7 @@ target = <&cam_module1>; _overlay_ { status = "okay"; - badge = "porg_rear_RBPCV2"; + badge = "porg_rear_RBPCV3"; position = "rear"; orientation = "1"; }; @@ -359,16 +381,8 @@ _overlay_ { status = "okay"; pcl_id = "v4l2_sensor"; - devname = "imx219 8-0010"; - proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/rbpcv2_imx219_e@10"; - }; - }; - override@11 { - target = <&cam_module1_drivernode1>; - _overlay_ { - status = "okay"; - pcl_id = "v4l2_lens"; - proc-device-tree = "/proc/device-tree/lens_imx219@RBPCV2/"; + devname = "imx477 8-001a"; + proc-device-tree = "/proc/device-tree/cam_i2cmux/i2c@1/rbpcv3_imx477_e@1a"; }; }; /* Enable VI ports */ @@ -391,21 +405,21 @@ }; }; override@15 { - target = <&rbpcv2_imx219_vi_in0>; + target = <&rbpcv3_imx477_vi_in0>; _overlay_ { status = "okay"; port-index = <0>; bus-width = <2>; - remote-endpoint = <&rbpcv2_imx219_csi_out0>; + remote-endpoint = <&rbpcv3_imx477_csi_out0>; }; }; override@16 { - target = <&rbpcv2_imx219_vi_in1>; + target = <&rbpcv3_imx477_vi_in1>; _overlay_ { status = "okay"; port-index = <4>; bus-width = <2>; - remote-endpoint = <&rbpcv2_imx219_csi_out1>; + remote-endpoint = <&rbpcv3_imx477_csi_out1>; }; }; /* Enable CSI ports */ @@ -428,12 +442,12 @@ }; }; override@20 { - target = <&rbpcv2_imx219_csi_in0>; + target = <&rbpcv3_imx477_csi_in0>; _overlay_ { status = "okay"; port-index = <0>; bus-width = <2>; - remote-endpoint = <&rbpcv2_imx219_dual_out0>; + remote-endpoint = <&rbpcv3_imx477_dual_out0>; }; }; override@21 { @@ -443,7 +457,7 @@ }; }; override@22 { - target = <&rbpcv2_imx219_csi_out0>; + target = <&rbpcv3_imx477_csi_out0>; _overlay_ { status = "okay"; }; @@ -461,12 +475,12 @@ }; }; override@25 { - target = <&rbpcv2_imx219_csi_in1>; + target = <&rbpcv3_imx477_csi_in1>; _overlay_ { status = "okay"; port-index = <4>; bus-width = <2>; - remote-endpoint = <&rbpcv2_imx219_out1>; + remote-endpoint = <&rbpcv3_imx477_out1>; }; }; override@26 { @@ -476,7 +490,7 @@ }; }; override@27 { - target = <&rbpcv2_imx219_csi_out1>; + target = <&rbpcv3_imx477_csi_out1>; _overlay_ { status = "okay"; }; diff --git a/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi b/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi index 57cb90cb7..76e505b1c 100644 --- a/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi +++ b/nvidia/platform/t210/porg/kernel-dts/tegra210-porg-p3448-common.dtsi @@ -28,8 +28,8 @@ #include "porg-platforms/tegra210-pinmux-drive-sdmmc-common.dtsi" #include "porg-platforms/tegra210-porg-pwm-fan.dtsi" #include "porg-platforms/tegra210-porg-camera.dtsi" -#include "porg-platforms/tegra210-porg-camera-rbpcv2-imx219.dtsi" -#include "porg-platforms/tegra210-porg-camera-rbpcv2-dual-imx219.dtsi" +#include "porg-platforms/tegra210-porg-camera-rbpcv3-imx477.dtsi" +#include "porg-platforms/tegra210-porg-camera-rbpcv3-dual-imx477.dtsi" #include #include #include diff --git a/nvidia/drivers/media/i2c/imx477.c b/nvidia/drivers/media/i2c/imx477.c index 8f436bb1e..99ca7cee5 100644 --- a/nvidia/drivers/media/i2c/imx477.c +++ b/nvidia/drivers/media/i2c/imx477.c @@ -35,7 +35,8 @@ #include "imx477_mode_tbls.h" static const struct of_device_id imx477_of_match[] = { - {.compatible = "ridgerun,imx477",}, + {.compatible = "ridgerun,imx477"}, + {.compatible = "nvidia,imx477"}, {}, }; @@ -368,9 +369,9 @@ skip_power_seqn: gpio_set_value(pw->reset_gpio, 1); } - /* Need to wait for t4 + t5 + t9 + t10 time as per the data sheet */ - /* t4 - 200us, t5 - 21.2ms, t9 - 1.2ms t10 - 270 ms */ - usleep_range(300000, 300100); + /* Need to wait for t4 + t5 + t9 time as per the data sheet */ + /* t4 - 200us, t5 - 21.2ms, t9 - 1.2ms */ + usleep_range(23000, 23100); pw->state = SWITCH_ON; @@ -637,16 +638,23 @@ static struct camera_common_sensor_ops imx477_common_ops = { static int imx477_board_setup(struct imx477 *priv) { struct camera_common_data *s_data = priv->s_data; + struct camera_common_pdata *pdata = s_data->pdata; struct device *dev = s_data->dev; u8 reg_val[2]; int err = 0; - // Skip mclk enable as this camera has an internal oscillator + if (pdata->mclk_name) { + err = camera_common_mclk_enable(s_data); + if (err) { + dev_err(dev, "error turning on mclk (%d)\n", err); + goto done; + } + } err = imx477_power_on(s_data); if (err) { dev_err(dev, "error during power on sensor (%d)\n", err); - goto done; + goto err_power_on; } /* Probe sensor model id registers */ @@ -676,6 +684,10 @@ static int imx477_board_setup(struct imx477 *priv) err_reg_probe: imx477_power_off(s_data); +err_power_on: + if (pdata->mclk_name) + camera_common_mclk_disable(s_data); + done: return err; } -- 2.17.1