2 * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <dt-bindings/media/camera.h>
19 #include <dt-bindings/platform/t210/t210.h>
24 /* generally used camera control gpio definitions and aliases*/
25 #define CAM_RST TEGRA_GPIO(S, 4)
26 #define CAM_AF_EN TEGRA_GPIO(S, 5)
27 #define CAM_FLASH_EN TEGRA_GPIO(S, 6)
28 #define CAM_PWDN_RQ TEGRA_GPIO(S, 7)
29 #define CAM_PWDN_FQ TEGRA_GPIO(T, 0)
30 #define CAM_STROBE_EN TEGRA_GPIO(T, 1)
32 #define CAM_PWDN_AF CAM_AF_EN
33 #define CAMFI_PWDN CAM_STROBE_EN
34 #define CAMRI_PWDN CAM_STROBE_EN
36 /* specifically used on camera board designs */
37 /* NxOV10823 general */
39 #define OV10823_SID_CAM1 CAMRI_PWDN /*PT1*/
40 #define OV10823_SID_CAM2 CAM_AF_EN /*PS5*/
41 #define OV10823_SID_CAM3 CAM_PWDN_FQ /*PT0*/
43 #define OV10823_DEFAULT_I2C_ADDR_SID_LOW (0x10)
44 #define OV10823_DEFAULT_I2C_ADDR_SID_HIGH (0x36)
45 #define OV10823_SENSOR_REG_RW_SID_LOW (0x300c)
46 #define OV10823_SENSOR_REG_RW_SID_HIGH (0x3661)
48 #define OV10823_I2C_ADDR_CAM1 (0x20)
49 #define OV10823_I2C_ADDR_CAM2 (0x22)
50 #define OV10823_I2C_ADDR_CAM3 (0x24)
52 /* ov10823 board specific */
53 #define OV10823_USE_OSC_FOR_MCLK (1)
54 #define OV10823_NEED_I2C_RECOVERY (0)
56 #define FIRST_CAM_POS (0)
57 #define SECOND_CAM_POS (1)
58 #define THIRD_CAM_POS (2)
70 remote-endpoint = <&ov5693_out0>;
76 remote-endpoint = <&ov5693_out1>;
87 compatible = "nvidia,ov5693";
88 /* I2C device address */
91 /* Physical dimensions of sensor */
96 sensor_model ="ov5693";
98 /* Define any required hw resources needed by driver */
99 /* ie. clocks, io pins, power sources */
103 /* Define any required hw resources needed by driver */
104 /* ie. clocks, io pins, power sources */
105 /* mclk-index indicates the index of the */
106 /* mclk-name with in the clock-names array */
108 clocks = <&tegra_car TEGRA210_CLK_ID_CLK_OUT_3>;
109 clock-names = "mclk";
110 clock-frequency = <24000000>;
113 pwdn-gpios = <&gpio CAM_PWDN_RQ GPIO_ACTIVE_HIGH>;
114 vana-supply = <&max77620_ldo3>;
115 vif-supply = <&en_vdd_cam>;
117 /* Defines number of frames to be dropped by driver internally after applying */
118 /* sensor crop settings. Some sensors send corrupt frames after applying */
119 /* crop co-ordinates */
120 post_crop_frame_drop = "0";
123 * A modeX node is required to support v4l2 driver
124 * implementation with NVIDIA camera software stack
127 * Standard MIPI driving clock, typically 24MHz
130 * Number of lane channels sensor is programmed to output
132 * tegra_sinterface = "";
133 * The base tegra serial interface lanes are connected to
135 * discontinuous_clk = "";
136 * The sensor is programmed to use a discontinuous clock on MIPI lanes
138 * dpcm_enable = "true";
139 * The sensor is programmed to use a DPCM modes
141 * cil_settletime = "";
142 * MIPI lane settle time value.
143 * A "0" value attempts to autocalibrate based on mclk_multiplier
149 * Pixel active region width
152 * Pixel active region height
155 * The sensor readout pixel pattern
156 * For eg - 10 bit bayer having 'bggr' pixel pattern has value "bayer_bggr"
157 * 12 bit bayer having 'bggr' pixel pattern has value "bayer_bggr12"
158 * 14 bit bayer having 'bggr' pixel pattern has value "bayer_bggr14"
160 * readout_orientation = "0";
161 * Based on camera module orientation.
162 * Only change readout_orientation if you specifically
163 * Program a different readout order for this mode
166 * Pixel line length (width) for sensor mode.
167 * This is used to calibrate features in our camera stack.
169 * mclk_multiplier = "";
170 * Multiplier to MCLK to help time hardware capture sequence
171 * TODO: Assign to PLL_Multiplier as well until fixed in core
174 * Sensor pixel clock used for calculations like exposure and framerate
179 * inherent_gain = "";
180 * Gain obtained inherently from mode (ie. pixel binning)
182 * min_gain_val = ""; (floor to 6 decimal places)
183 * max_gain_val = ""; (floor to 6 decimal places)
184 * Gain limits for mode
186 * min_exp_time = ""; (ceil to integer)
187 * max_exp_time = ""; (ceil to integer)
188 * Exposure Time limits for mode (us)
191 * min_hdr_ratio = "";
192 * max_hdr_ratio = "";
193 * HDR Ratio limits for mode
195 * min_framerate = "";
196 * max_framerate = "";
197 * Framerate limits for mode (fps)
199 * embedded_metadata_height = "";
200 * Sensor embedded metadata height in units of rows.
201 * If sensor does not support embedded metadata value should be 0.
203 mode0 { // OV5693_MODE_2592X1944
206 tegra_sinterface = "serial_a";
207 discontinuous_clk = "no";
208 dpcm_enable = "false";
209 cil_settletime = "0";
213 pixel_t = "bayer_bggr";
214 readout_orientation = "90";
215 line_length = "2688";
217 mclk_multiplier = "17.0";
218 pix_clk_hz = "160000000";
220 min_gain_val = "1.0";
223 max_hdr_ratio = "64";
224 min_framerate = "1.816577";
225 max_framerate = "30";
227 max_exp_time = "550385";
228 embedded_metadata_height = "0";
231 mode1 { //OV5693_MODE_2592X1458
234 tegra_sinterface = "serial_a";
235 discontinuous_clk = "no";
236 dpcm_enable = "false";
237 cil_settletime = "0";
241 pixel_t = "bayer_bggr";
242 readout_orientation = "90";
243 line_length = "2688";
245 mclk_multiplier = "17.0";
246 pix_clk_hz = "160000000";
248 min_gain_val = "1.0";
251 max_hdr_ratio = "64";
252 min_framerate = "1.816577";
253 max_framerate = "30";
255 max_exp_time = "550385";
256 embedded_metadata_height = "0";
259 mode2 { //OV5693_MODE_1280X720
262 tegra_sinterface = "serial_a";
263 discontinuous_clk = "no";
264 dpcm_enable = "false";
265 cil_settletime = "0";
269 pixel_t = "bayer_bggr";
270 readout_orientation = "90";
271 line_length = "1752";
273 mclk_multiplier = "17.0";
274 pix_clk_hz = "160000000";
276 min_gain_val = "1.0";
279 max_hdr_ratio = "64";
280 min_framerate = "2.787078";
281 max_framerate = "120";
283 max_exp_time = "358733";
284 embedded_metadata_height = "0";
288 mode3 { //OV5693_MODE_2592X1944_HDR
291 tegra_sinterface = "serial_a";
292 discontinuous_clk = "no";
293 dpcm_enable = "false";
294 cil_settletime = "0";
298 pixel_t = "hdr_bggr";
299 readout_orientation = "90";
300 line_length = "3696";
302 mclk_multiplier = "19.0";
303 pix_clk_hz = "176000000";
305 min_gain_val = "1.0";
308 max_hdr_ratio = "64";
309 min_framerate = "1.453262";
310 max_framerate = "24";
312 max_exp_time = "687981";
313 embedded_metadata_height = "0";
317 #address-cells = <1>;
322 ov5693_out0: endpoint {
325 remote-endpoint = <&vi_in0>;
332 compatible = "nvidia,ov5693";
333 /* I2C device address */
336 /* Physical dimensions of sensor */
337 physical_w = "3.674";
338 physical_h = "2.738";
341 sensor_model ="ov5693";
343 /* Define any required hw resources needed by driver */
344 /* ie. clocks, io pins, power sources */
349 /* Define any required hw resources needed by driver */
350 /* ie. clocks, io pins, power sources */
351 /* mclk-index indicates the index of the */
352 /* mclk-name with in the clock-names array */
354 clocks = <&tegra_car TEGRA210_CLK_ID_CLK_OUT_3>;
355 clock-names = "mclk";
356 clock-frequency = <24000000>;
359 pwdn-gpios = <&gpio CAM_PWDN_FQ GPIO_ACTIVE_HIGH>;
360 vana-supply = <&max77620_ldo3>;
361 vif-supply = <&en_vdd_cam>;
363 /* Defines number of frames to be dropped by driver internally after applying */
364 /* sensor crop settings. Some sensors send corrupt frames after applying */
365 /* crop co-ordinates */
366 post_crop_frame_drop = "0";
369 * A modeX node is required to support v4l2 driver
370 * implementation with NVIDIA camera software stack
373 * Standard MIPI driving clock, typically 24MHz
376 * Number of lane channels sensor is programmed to output
378 * tegra_sinterface = "";
379 * The base tegra serial interface lanes are connected to
381 * discontinuous_clk = "";
382 * The sensor is programmed to use a discontinuous clock on MIPI lanes
384 * dpcm_enable = "true";
385 * The sensor is programmed to use a DPCM modes
387 * cil_settletime = "";
388 * MIPI lane settle time value.
389 * A "0" value attempts to autocalibrate based on mclk_multiplier
395 * Pixel active region width
398 * Pixel active region height
401 * The sensor readout pixel pattern
402 * For eg - 10 bit bayer having 'bggr' pixel pattern has value "bayer_bggr"
403 * 12 bit bayer having 'bggr' pixel pattern has value "bayer_bggr12"
404 * 14 bit bayer having 'bggr' pixel pattern has value "bayer_bggr14"
406 * readout_orientation = "0";
407 * Based on camera module orientation.
408 * Only change readout_orientation if you specifically
409 * Program a different readout order for this mode
412 * Pixel line length (width) for sensor mode.
413 * This is used to calibrate features in our camera stack.
415 * mclk_multiplier = "";
416 * Multiplier to MCLK to help time hardware capture sequence
417 * TODO: Assign to PLL_Multiplier as well until fixed in core
420 * Sensor pixel clock used for calculations like exposure and framerate
425 * inherent_gain = "";
426 * Gain obtained inherently from mode (ie. pixel binning)
428 * min_gain_val = ""; (floor to 6 decimal places)
429 * max_gain_val = ""; (floor to 6 decimal places)
430 * Gain limits for mode
432 * min_exp_time = ""; (ceil to integer)
433 * max_exp_time = ""; (ceil to integer)
434 * Exposure Time limits for mode (us)
437 * min_hdr_ratio = "";
438 * max_hdr_ratio = "";
439 * HDR Ratio limits for mode
441 * min_framerate = "";
442 * max_framerate = "";
443 * Framerate limits for mode (fps)
445 * embedded_metadata_height = "";
446 * Sensor embedded metadata height in units of rows.
447 * If sensor does not support embedded metadata value should be 0.
449 mode0 { // OV5693_MODE_2592X1944
452 tegra_sinterface = "serial_c";
453 discontinuous_clk = "no";
454 dpcm_enable = "false";
455 cil_settletime = "0";
459 pixel_t = "bayer_bggr";
460 readout_orientation = "90";
461 line_length = "2688";
463 mclk_multiplier = "6.67";
464 pix_clk_hz = "160000000";
466 min_gain_val = "1.0";
469 max_hdr_ratio = "64";
470 min_framerate = "1.816577";
471 max_framerate = "30";
473 max_exp_time = "550385";
474 embedded_metadata_height = "0";
477 mode1 { //OV5693_MODE_2592X1458
480 tegra_sinterface = "serial_c";
481 discontinuous_clk = "no";
482 dpcm_enable = "false";
483 cil_settletime = "0";
487 pixel_t = "bayer_bggr";
488 readout_orientation = "90";
489 line_length = "2688";
491 mclk_multiplier = "6.67";
492 pix_clk_hz = "160000000";
494 min_gain_val = "1.0";
497 max_hdr_ratio = "64";
498 min_framerate = "1.816577";
499 max_framerate = "30";
501 max_exp_time = "550385";
504 mode2 { //OV5693_MODE_1280X720
507 tegra_sinterface = "serial_c";
508 discontinuous_clk = "no";
509 dpcm_enable = "false";
510 cil_settletime = "0";
514 pixel_t = "bayer_bggr";
515 readout_orientation = "90";
516 line_length = "1752";
518 mclk_multiplier = "6.67";
519 pix_clk_hz = "160000000";
521 min_gain_val = "1.0";
524 max_hdr_ratio = "64";
525 min_framerate = "2.787078";
526 max_framerate = "120";
528 max_exp_time = "358733";
529 embedded_metadata_height = "0";
533 mode3 { //OV5693_MODE_2592X1944_HDR
536 tegra_sinterface = "serial_c";
537 discontinuous_clk = "no";
538 dpcm_enable = "false";
539 cil_settletime = "0";
543 pixel_t = "hdr_bggr";
544 readout_orientation = "90";
545 line_length = "3696";
547 mclk_multiplier = "7.33";
548 pix_clk_hz = "176000000";
550 min_gain_val = "1.0";
553 max_hdr_ratio = "64";
554 min_framerate = "1.453262";
555 max_framerate = "24";
557 max_exp_time = "687981";
558 embedded_metadata_height = "0";
562 #address-cells = <1>;
567 ov5693_out1: endpoint {
570 remote-endpoint = <&vi_in1>;
579 tegra-camera-platform {
580 compatible = "nvidia, tegra-camera-platform";
583 * The general guideline for naming badge_info contains 3 parts, and is as follows,
584 * The first part is the camera_board_id for the module; if the module is in a FFD
585 * platform, then use the platform name for this part.
586 * The second part contains the position of the module, ex. “rear” or “front”.
587 * The third part contains the last 6 characters of a part number which is found
588 * in the module's specsheet from the vender.
592 badge = "e2146_rear_BA519C";
596 /* Declare PCL support driver (classically known as guid) */
597 pcl_id = "v4l2_sensor";
598 /* Driver's v4l2 device name */
599 devname = "ov5693 6-0010";
600 /* Declare the device-tree hierarchy to driver instance */
601 proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/ov5693_a@10";
604 /* Declare PCL support driver (classically known as guid) */
605 pcl_id = "v4l2_focuser_stub";
608 /* Declare PCL support driver (classically known as guid) */
613 badge = "e2146_front_P5V27C";
617 /* Declare PCL support driver (classically known as guid) */
618 pcl_id = "v4l2_sensor";
619 /* Driver's v4l2 device name */
620 devname = "ov5693 6-0036";
621 /* Declare the device-tree hierarchy to driver instance */
622 proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/ov5693_c@36";
625 /* Declare PCL support driver (classically known as guid) */
626 pcl_id = "v4l2_focuser_stub";
633 compatible = "nvidia,tegra210-camera", "simple-bus";
634 configuration = <0xAA55AA55>;
637 module1: module1@modules {
638 compatible = "sensor,rear";
639 badge_info = "e2146_rear_BA519C";
641 profile = <&ad5823_1>;
642 platformdata = "t210ref_ov5693_pdata";
645 module2: module2@modules {
646 compatible = "sensor,front";
647 badge_info = "e2146_front_P5V27C";
650 module3: module3@modules {
651 compatible = "sensor,rear";
652 badge_info = "e2385_angle0_ov10823";
655 profile = <&ov10823_A>;
656 platformdata = "t210ref_ov10823A_pdata";
660 module4: module4@modules {
661 compatible = "sensor,rear";
662 badge_info = "e2385_angle120_ov10823";
665 profile = <&ov10823_B>;
666 platformdata = "t210ref_ov10823B_pdata";
670 module5: module5@modules {
671 compatible = "sensor,rear";
672 badge_info = "e2385_angle240_ov10823";
675 profile = <&ov10823_C>;
676 platformdata = "t210ref_ov10823C_pdata";
682 ov5693_1: ov5693@2_0010 {
684 chipname = "pcl_OV5693";
689 busnum = <VI_I2C_BUS>;
692 pinmuxgrp = <0xFFFF>;
694 regulators = "vana", "vif";
695 clocks = "cam_mclk1";
696 drivername = "ov5693";
697 detect = <0x0002 0x300A 0xFFFF 0x5690>;
700 CAMERA_IND_CLK_SET(10000)
701 CAMERA_GPIO_CLR(CAM_PWDN_RQ)
703 CAMERA_REGULATOR_ON(0)
704 CAMERA_REGULATOR_ON(1)
706 CAMERA_GPIO_SET(CAM_PWDN_RQ)
712 CAMERA_GPIO_CLR(CAM_PWDN_RQ)
714 CAMERA_REGULATOR_OFF(1)
715 CAMERA_REGULATOR_OFF(0)
718 /* sensor capabilities */
719 cap-version = <0x34340002>;
720 cap-identifier = "OV5693";
721 cap-sensor_nvc_interface = <3>;
722 cap-pixel_types = <0x2101>;
723 cap-orientation = <1>;
725 cap-initial_clock_rate_khz = <6000>;
726 cap-h_sync_edge = <0>;
727 cap-v_sync_edge = <0>;
728 cap-mclk_on_vgp0 = <0>;
730 cap-data_lanes = <2>;
731 cap-virtual_channel_id = <0>;
732 cap-discontinuous_clk_mode = <1>;
733 cap-cil_threshold_settle = <0>;
734 cap-min_blank_time_width = <16>;
735 cap-min_blank_time_height = <16>;
736 cap-preferred_mode_index = <0>;
737 cap-external_clock_khz_0 = <24000>;
738 cap-clock_multiplier_0 = <8000000>;
739 cap-external_clock_khz_1 = <0>;
740 cap-clock_multiplier_1 = <0>;
743 ad5823_1: ad5823@2_000c {
745 chipname = "pcl_AD5823";
750 busnum = <VI_I2C_BUS>;
753 pinmuxgrp = <0xFFFF>;
755 regulators = "vdd", "vif";
756 drivername = "ad5823";
757 detect = <0x0002 0x0006 0xFFFF 0x0010>;
760 CAMERA_REGULATOR_ON(1)
761 CAMERA_REGULATOR_ON(0)
763 CAMERA_GPIO_SET(CAM_PWDN_AF)
768 CAMERA_REGULATOR_OFF(0)
769 CAMERA_REGULATOR_OFF(1)
770 CAMERA_GPIO_CLR(CAM_PWDN_AF)
775 ov5693_2: ov5693@2_0036 {
777 chipname = "pcl_OV5693f";
782 busnum = <VI_I2C_BUS>;
785 pinmuxgrp = <0xFFFF>;
787 regulators = "vana", "vif";
788 clocks = "cam_mclk1";
789 drivername = "ov5693.1";
790 detect = <0x0002 0x300A 0xFFFF 0x5690>;
793 CAMERA_IND_CLK_SET(10000)
794 CAMERA_GPIO_CLR(CAM_PWDN_FQ)
796 CAMERA_REGULATOR_ON(0)
797 CAMERA_REGULATOR_ON(1)
799 CAMERA_GPIO_SET(CAM_PWDN_FQ)
805 CAMERA_GPIO_CLR(CAM_PWDN_FQ)
807 CAMERA_REGULATOR_OFF(1)
808 CAMERA_REGULATOR_OFF(0)
811 /* sensor capabilities */
812 cap-version = <0x34340002>;
813 cap-identifier = "OV5693.1";
814 cap-sensor_nvc_interface = <5>;
815 cap-pixel_types = <0x2101>;
816 cap-orientation = <3>;
818 cap-initial_clock_rate_khz = <6000>;
819 cap-h_sync_edge = <0>;
820 cap-v_sync_edge = <0>;
821 cap-mclk_on_vgp0 = <0>;
823 cap-data_lanes = <2>;
824 cap-virtual_channel_id = <0>;
825 cap-discontinuous_clk_mode = <1>;
826 cap-cil_threshold_settle = <0>;
827 cap-min_blank_time_width = <16>;
828 cap-min_blank_time_height = <16>;
829 cap-preferred_mode_index = <0>;
830 cap-external_clock_khz_0 = <24000>;
831 cap-clock_multiplier_0 = <8000000>;
832 cap-external_clock_khz_1 = <0>;
833 cap-clock_multiplier_1 = <0>;
837 ov10823_A: ov10823@6_0020 {
839 chipname = "pcl_OV10823_A";
842 position = <FIRST_CAM_POS>;
844 busnum = <VI_I2C_BUS>;
845 addr = <OV10823_I2C_ADDR_CAM1>;
847 pinmuxgrp = <0xFFFF>;
849 drivername = "ov10823";
850 detect = <0x0002 0x300A 0xFFFF 0xA820>;
853 CAMERA_GPIO_SET(OV10823_SID_CAM1)
854 CAMERA_GPIO_SET(OV10823_SID_CAM2)
855 CAMERA_GPIO_SET(OV10823_SID_CAM3)
857 CAMERA_GPIO_CLR(OV10823_SID_CAM1)
859 CAMERA_TABLE_RAW_WRITE(CAMERA_RAW_I2C_ADDRESS(\
860 OV10823_DEFAULT_I2C_ADDR_SID_LOW, \
861 OV10823_SENSOR_REG_RW_SID_LOW, \
862 (OV10823_I2C_ADDR_CAM1 << 1)))
870 ov10823_B: ov10823@6_0022 {
872 chipname = "pcl_OV10823_B";
875 position = <SECOND_CAM_POS>;
877 busnum = <VI_I2C_BUS>;
878 addr = <OV10823_I2C_ADDR_CAM2>;
880 pinmuxgrp = <0xFFFF>;
882 drivername = "ov10823";
883 detect = <0x0002 0x300A 0xFFFF 0xA820>;
886 CAMERA_GPIO_CLR(OV10823_SID_CAM2)
888 CAMERA_TABLE_RAW_WRITE(CAMERA_RAW_I2C_ADDRESS(\
889 OV10823_DEFAULT_I2C_ADDR_SID_LOW, \
890 OV10823_SENSOR_REG_RW_SID_LOW, \
891 (OV10823_I2C_ADDR_CAM2 << 1)))
899 ov10823_C: ov10823@6_0024 {
901 chipname = "pcl_OV10823_C";
904 position = <THIRD_CAM_POS>;
906 busnum = <VI_I2C_BUS>;
907 addr = <OV10823_I2C_ADDR_CAM3>;
909 pinmuxgrp = <0xFFFF>;
911 drivername = "ov10823";
912 detect = <0x0002 0x300A 0xFFFF 0xA820>;
915 CAMERA_GPIO_CLR(OV10823_SID_CAM3)
917 CAMERA_TABLE_RAW_WRITE(CAMERA_RAW_I2C_ADDRESS(\
918 OV10823_DEFAULT_I2C_ADDR_SID_LOW, \
919 OV10823_SENSOR_REG_RW_SID_LOW, \
920 (OV10823_I2C_ADDR_CAM3 << 1)))