/* * Copyright (c) 2015-2016, 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 #define GANG_MODE_L_R 1 #define GANG_MODE_T_B 2 #define GANG_MODE_R_L 3 #define GANG_MODE_B_T 4 #define CAM0_RST_L TEGRA_GPIO(S, 7) #define CAM1_RST_L TEGRA_GPIO(T, 0) #define CAM2_RST_L TEGRA_GPIO(S, 4) #define CAM_MUX0 TEGRA_GPIO(T, 1) #define CAM_MUX1 TEGRA_GPIO(S, 6) //GPIOs / { /* set camera gpio direction to output */ gpio: gpio@6000d000 { camera-control { gpio-output-low = < CAM0_RST_L CAM1_RST_L CAM2_RST_L CAM_MUX0 CAM_MUX1 >; }; }; }; / { host1x { vi_base: vi { num-channels = <3>; ports { #address-cells = <1>; #size-cells = <0>; vi_port0: port@0 { status = "okay"; reg = <0>; vi_in0: endpoint { status = "okay"; csi-port = <0>; bus-width = <2>; remote-endpoint = <&imx219_out0>; }; }; vi_port1: port@1 { status = "okay"; reg = <1>; vi_in1: endpoint { status = "okay"; csi-port = <2>; bus-width = <2>; remote-endpoint = <&imx219_out1>; }; }; vi_port2: port@2 { status = "okay"; reg = <2>; vi_in2: endpoint { status = "okay"; csi-port = <4>; bus-width = <2>; remote-endpoint = <&imx219_out2>; }; }; }; }; i2c-camera-mux { status = "okay"; compatible = "i2c-mux-gpio"; #address-cells = <1>; #size-cells = <0>; mux-gpios = < &gpio CAM_MUX0 GPIO_ACTIVE_HIGH &gpio CAM_MUX1 GPIO_ACTIVE_HIGH>; //i2c-parent = <&i2c@546c0000>; i2c-parent = <&i2c7>; i2c@0 { status = "okay"; reg = <0>; #address-cells = <1>; #size-cells = <0>; imx219_a@10 { compatible = "nvidia,imx219"; devnode="video0"; // I2C Device Address reg = <0x10>; reset-gpios = <&gpio CAM0_RST_L GPIO_ACTIVE_LOW>; //Physical Dimenstion of sensor physical_w = "5.095"; physical_h = "4.930"; //Sensor Model sensor_model ="imx219"; //XXX: Experiment dovdd-supply = <&en_vdd_cam>; avdd-reg = "vana"; dvdd-reg = "vdig"; //iovdd-reg = "dovdd"; iovdd-reg = "vif"; //XXX: Experiment //avdd-reg = "vana"; //iovdd-reg = "vif"; //dvdd-reg = "vdig"; clocks = <&tegra_car TEGRA210_CLK_ID_CLK_OUT_3>; clock-names = "mclk"; clock-frequency = <24000000>; mclk = "cam_mclk1"; post_crop_frame_drop = "0"; mode0 { // IMX219_MODE_1920X1080 mclk_khz = "24000"; //mclk_multiplier = "25"; mclk_multiplier = "17.0"; pix_clk_hz = "182400000"; //pix_clk_hz = "170000000"; num_lanes = "2"; tegra_sinterface = "serial_a"; discontinuous_clk = "yes"; cil_settletime = "0"; pixel_t = "bayer_rggb"; readout_orientation = "90"; inherent_gain = "1"; active_w = "1920"; active_h = "1080"; line_length = "3448"; dpcm_enable = "false"; min_gain_val = "1.0"; max_gain_val = "16"; min_hdr_ratio = "1"; max_hdr_ratio = "64"; min_framerate = "1"; max_framerate = "30"; min_exp_time = "33"; max_exp_time = "683709"; embedded_metadata_height = "2"; }; mode1 { // IMX219_MODE_1280X720 mclk_khz = "24000"; mclk_multiplier = "25"; pix_clk_hz = "182400000"; //pix_clk_hz = "170000000"; num_lanes = "2"; tegra_sinterface = "serial_a"; discontinuous_clk = "yes"; cil_settletime = "0"; pixel_t = "bayer_rggb"; readout_orientation = "90"; inherent_gain = "1"; active_w = "1280"; active_h = "720"; line_length = "3448"; dpcm_enable = "false"; //line_length = "1752"; min_gain_val = "1"; max_gain_val = "16"; min_hdr_ratio = "1"; max_hdr_ratio = "64"; min_framerate = "1"; max_framerate = "60"; //min_exp_time = "16"; min_exp_time = "13"; max_exp_time = "683709"; //embedded_metadata_height = "2"; }; mode2 { // IMX219_MODE_640X480 //mclk_khz = "47000"; mclk_khz = "24000"; mclk_multiplier = "17.0"; pix_clk_hz = "182400000"; //pix_clk_hz = "170000000"; num_lanes = "2"; tegra_sinterface = "serial_a"; discontinuous_clk = "yes"; cil_settletime = "0"; pixel_t = "bayer_rggb"; readout_orientation = "90"; inherent_gain = "0"; active_w = "640"; active_h = "480"; //line_length = "752"; //line_length = "1752"; line_length = "3448"; //line_length = "3559"; dpcm_enable = "false"; min_gain_val = "1"; max_gain_val = "16"; min_hdr_ratio = "1"; max_hdr_ratio = "64"; min_framerate = "1"; max_framerate = "90"; min_exp_time = "22"; max_exp_time = "358733"; //embedded_metadata_height = "2"; }; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; imx219_out0: endpoint { csi-port = <0>; bus-width = <2>; remote-endpoint = <&vi_in0>; }; }; }; }; }; i2c@1 { status = "okay"; reg = <1>; #address-cells = <1>; #size-cells = <0>; imx219_c@10 { compatible = "nvidia,imx219"; devnode="video1"; // I2C Device Address reg = <0x10>; reset-gpios = <&gpio CAM1_RST_L GPIO_ACTIVE_LOW>; //Physical Dimenstion of sensor physical_w = "5.095"; physical_h = "4.930"; //Sensor Model sensor_model ="imx219"; //avdd-reg = "vana"; //iovdd-reg = "vif"; //dvdd-reg = "vdig"; clocks = <&tegra_car TEGRA210_CLK_ID_CLK_OUT_3>; clock-names = "mclk"; clock-frequency = <24000000>; mclk = "cam_mclk1"; post_crop_frame_drop = "0"; mode0 { // IMX219_MODE_1920X1080 mclk_khz = "24000"; mclk_multiplier = "25"; pix_clk_hz = "182400000"; //pix_clk_hz = "170000000"; num_lanes = "2"; tegra_sinterface = "serial_c"; discontinuous_clk = "yes"; cil_settletime = "0"; pixel_t = "bayer_rggb"; readout_orientation = "270"; //readout_orientation = "90"; inherent_gain = "1"; active_w = "1920"; active_h = "1080"; line_length = "3448"; dpcm_enable = "false"; min_gain_val = "1"; max_gain_val = "16"; min_hdr_ratio = "1"; max_hdr_ratio = "64"; min_framerate = "1"; max_framerate = "30"; min_exp_time = "13"; max_exp_time = "683709"; //embedded_metadata_height = "2"; }; mode1 { // IMX219_MODE_1280X720 mclk_khz = "24000"; mclk_multiplier = "25"; pix_clk_hz = "182400000"; //pix_clk_hz = "170000000"; num_lanes = "2"; tegra_sinterface = "serial_c"; discontinuous_clk = "yes"; cil_settletime = "0"; pixel_t = "bayer_rggb"; readout_orientation = "270"; inherent_gain = "1"; active_w = "1280"; active_h = "720"; line_length = "3448"; dpcm_enable = "false"; //line_length = "1752"; min_gain_val = "1"; max_gain_val = "16"; min_hdr_ratio = "1"; max_hdr_ratio = "64"; min_framerate = "1"; max_framerate = "60"; //min_exp_time = "16"; min_exp_time = "13"; max_exp_time = "683709"; //embedded_metadata_height = "2"; }; mode2 { // IMX219_MODE_640X480 //mclk_khz = "47000"; mclk_khz = "24000"; mclk_multiplier = "17.0"; pix_clk_hz = "182400000"; //pix_clk_hz = "170000000"; num_lanes = "2"; tegra_sinterface = "serial_c"; discontinuous_clk = "yes"; cil_settletime = "0"; pixel_t = "bayer_rggb"; readout_orientation = "270"; inherent_gain = "0"; active_w = "640"; active_h = "480"; //line_length = "752"; //line_length = "1752"; line_length = "3448"; //line_length = "3559"; dpcm_enable = "false"; min_gain_val = "1"; max_gain_val = "16"; min_hdr_ratio = "1"; max_hdr_ratio = "64"; min_framerate = "1"; max_framerate = "90"; min_exp_time = "22"; max_exp_time = "358733"; //embedded_metadata_height = "2"; }; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; imx219_out1: endpoint { csi-port = <2>; bus-width = <2>; remote-endpoint = <&vi_in1>; }; }; }; }; }; i2c@2 { status = "okay"; reg = <2>; #address-cells = <1>; #size-cells = <0>; imx219_e@10 { compatible = "nvidia,imx219"; devnode="video2"; // I2C Device Address reg = <0x10>; reset-gpios = <&gpio CAM2_RST_L GPIO_ACTIVE_LOW>; //Physical Dimenstion of sensor physical_w = "5.095"; physical_h = "4.930"; //Sensor Model sensor_model ="imx219"; clocks = <&tegra_car TEGRA210_CLK_ID_CLK_OUT_3>; clock-names = "mclk"; clock-frequency = <24000000>; mclk = "cam_mclk1"; post_crop_frame_drop = "0"; mode0 { // IMX219_MODE_1920X1080 mclk_khz = "24000"; mclk_multiplier = "25"; pix_clk_hz = "182400000"; //pix_clk_hz = "170000000"; num_lanes = "2"; tegra_sinterface = "serial_e"; discontinuous_clk = "yes"; cil_settletime = "0"; pixel_t = "bayer_rggb"; readout_orientation = "270"; inherent_gain = "1"; active_w = "1920"; active_h = "1080"; line_length = "3448"; dpcm_enable = "false"; min_gain_val = "1"; max_gain_val = "16"; min_hdr_ratio = "1"; max_hdr_ratio = "64"; min_framerate = "1"; max_framerate = "30"; min_exp_time = "13"; max_exp_time = "683709"; //embedded_metadata_height = "2"; }; mode1 { // IMX219_MODE_1280X720 mclk_khz = "24000"; mclk_multiplier = "25"; pix_clk_hz = "182400000"; //pix_clk_hz = "170000000"; num_lanes = "2"; tegra_sinterface = "serial_e"; discontinuous_clk = "yes"; cil_settletime = "0"; pixel_t = "bayer_rggb"; readout_orientation = "270"; inherent_gain = "1"; active_w = "1280"; active_h = "720"; line_length = "3448"; dpcm_enable = "false"; //line_length = "1752"; min_gain_val = "1"; max_gain_val = "16"; min_hdr_ratio = "1"; max_hdr_ratio = "64"; min_framerate = "1"; max_framerate = "60"; //min_exp_time = "16"; min_exp_time = "13"; max_exp_time = "683709"; //embedded_metadata_height = "2"; }; mode2 { // IMX219_MODE_640X480 //mclk_khz = "47000"; mclk_khz = "24000"; mclk_multiplier = "17.0"; pix_clk_hz = "182400000"; //pix_clk_hz = "170000000"; num_lanes = "2"; tegra_sinterface = "serial_e"; discontinuous_clk = "yes"; cil_settletime = "0"; pixel_t = "bayer_rggb"; readout_orientation = "270"; inherent_gain = "0"; active_w = "640"; active_h = "480"; //line_length = "752"; //line_length = "1752"; line_length = "3448"; //line_length = "3559"; dpcm_enable = "false"; min_gain_val = "1"; max_gain_val = "16"; min_hdr_ratio = "1"; max_hdr_ratio = "64"; min_framerate = "1"; max_framerate = "90"; min_exp_time = "22"; max_exp_time = "358733"; //embedded_metadata_height = "2"; }; ports { #address-cells = <1>; #size-cells = <0>; port@0 { reg = <0>; imx219_out2: endpoint { csi-port = <4>; bus-width = <2>; remote-endpoint = <&vi_in2>; }; }; }; }; }; }; i2c7: i2c@546c0000 { status = "okay"; }; }; }; / { 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 * * isp_peak_byte_per_pixel = <>; * Max byte per pixel for the ISP ISO case * * isp_bw_margin_pct = <>; * Isp bandwidth margin in percentage */ compatible = "nvidia, tegra-camera-platform"; num_csi_lanes = <6>; max_lane_speed = <1500000>; min_bits_per_pixel = <10>; vi_peak_byte_per_pixel = <2>; vi_bw_margin_pct = <25>; max_pixel_rate = <182400>; isp_peak_byte_per_pixel = <2>; 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 vender. */ modules { cam_module0: module0 { status = "okay"; badge = "uav_back_imx219"; position = "rear"; orientation = "0"; cam_module0_drivernode0: drivernode0 { /* Declare PCL support driver (classically known as guid) */ pcl_id = "v4l2_sensor"; /* Driver's v4l2 device name */ devname = "imx219 7-0010"; /* Declare the device-tree hierarchy to driver instance */ proc-device-tree = "/proc/device-tree/host1x/i2c-camera-mux/i2c@0/imx219_a@10"; status = "okay"; }; }; cam_module1: module1 { status = "okay"; badge = "uav_frontright_imx219"; position = "topright"; orientation = "1"; cam_module1_drivernode0: drivernode0 { /* Declare PCL support driver (classically known as guid) */ pcl_id = "v4l2_sensor"; /* Driver's v4l2 device name */ devname = "imx219 8-0010"; /* Declare the device-tree hierarchy to driver instance */ proc-device-tree = "/proc/device-tree/host1x/i2c-camera-mux/i2c@1/imx219_c@10"; status = "okay"; }; }; cam_module2: module2 { status = "okay"; badge = "uav_frontleft_imx219"; position = "topleft"; orientation = "1"; cam_module2_drivernode0: drivernode0 { /* Declare PCL support driver (classically known as guid) */ pcl_id = "v4l2_sensor"; /* Driver's v4l2 device name */ devname = "imx219 9-0010"; /* Declare the device-tree hierarchy to driver instance */ proc-device-tree = "/proc/device-tree/host1x/i2c-camera-mux/i2c@2/imx219_e@10"; status = "okay"; }; }; }; }; };