As Shane suggested, I spent some time on my dtsi files and now /dev/video0 and /dev/media0 are created for me.
However, I am getting all 0’s (black screen) during streaming using standard V4L2 application(using /dev/video0).
Below is the kernel log during streaming. All prints starting with “drivers/media/i2c/mysens.c” are from my driver.
mysens_v4l2 2-0010: camera_common_mclk_enable: enable MCLK with 27000000 Hz
drivers/media/i2c/mysens.c : mysens_power_on() ENTER
drivers/media/i2c/mysens.c : mysens_power_on() EXIT
drivers/media/i2c/mysens.c : mysens_set_fmt() ENTER
mysens_v4l2 2-0010: camera_common_try_fmt: size 1280 x 720
drivers/media/i2c/mysens.c : mysens_set_fmt() EXIT
drivers/media/i2c/mysens.c : mysens_set_fmt() ENTER
mysens_v4l2 2-0010: camera_common_s_fmt(12303) size 1280 x 720
mysens_v4l2 2-0010: camera_common_try_fmt: size 1280 x 720
drivers/media/i2c/mysens.c : mysens_set_fmt() EXIT
misc tegra_camera_ctrl: vi_v4l2_update_isobw:Set iso bw 55296 kbyteps at 3456 KHz
misc tegra_camera_ctrl: tegra_camera_isomgr_request++ bw=55296, lt=4
misc tegra_camera_ctrl: tegra_camera_isomgr_request: tegra_camera isomgr latency is 4 usec
drivers/media/i2c/mysens.c : mysens_s_stream() ENTER
drivers/media/i2c/mysens.c : mysens_s_stream() EXIT
<i>vi vi: Selected no CSI lane, cannot do calibration</i>
Will this log (especially, the one marked in italic) help you guys suggest what is missing in my setup?
I shall also attach my dtsi files and kernel log during boot as well
tegra210-jetson-cv-camera-mysens.dtsi
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <tegra210-platforms/tegra210-camera-mysens.dtsi>
#define CAM1_RST_L TEGRA_GPIO(S, 5)
/* camera control gpio definitions */
/ {
i2c@7000c500 {
mysens@10 {
clocks = <&tegra_car TEGRA210_CLK_ID_CLK_OUT_3>;
clock-names = "mclk";
clock-frequency = <24000000>;
mclk = "cam_mclk1";
reset-gpios = <&gpio CAM1_RST_L GPIO_ACTIVE_HIGH>;
};
};
gpio: gpio@6000d000 {
camera-control {
gpio-input = <
TEGRA_GPIO(X, 2)
>;
gpio-output-low = <
CAM1_RST_L
TEGRA_GPIO(S, 4)
>;
};
};
};
tegra210-camera-mysens.dtsi
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#include <dt-bindings/media/camera.h>
#include <dt-bindings/platform/t210/t210.h>
/ {
host1x {
vi {
num-channels = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
status = "okay";
mysens_vi_in0: endpoint {
status = "okay";
csi-port = <4>; // CSI EF
bus-width = <4>; // 4 lane
remote-endpoint = <&mysens_out0>;
};
};
};
};
};
i2c@7000c500 { // I2C_2
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
mysens@10 {
compatible = "nvidia,mysens_v4l2";
/* I2C device address */
reg = <0x10>;
/* Physical dimensions of sensor */
physical_w = "3.674";
physical_h = "2.738";
/* Sensor Model */
sensor_model ="mysens";
post_crop_frame_drop = "0";
mode0 { // MODE_3840X2160@30fps
mclk_khz = "24000";
num_lanes = "4";
tegra_sinterface = "serial_e";
discontinuous_clk = "yes";
cil_settletime = "0";
active_w = "3864";
active_h = "2160";
pixel_t = "bayer_rggb";
readout_orientation = "90";
line_length = "4200";
inherent_gain = "1";
mclk_multiplier = "25";
pix_clk_hz = "576000000";
min_gain_val = "1.0";
max_gain_val = "22.2";
min_hdr_ratio = "1";
max_hdr_ratio = "64";
min_framerate = "1.462526";
max_framerate = "30";
min_exp_time = "16.165";
max_exp_time = "33191";
embedded_metadata_height = "0";
};
mode1 { // MODE_3840X2160@60fps
mclk_khz = "24000";
num_lanes = "4";
tegra_sinterface = "serial_e";
discontinuous_clk = "yes";
cil_settletime = "0";
active_w = "3864";
active_h = "2160";
pixel_t = "bayer_rggb";
readout_orientation = "90";
line_length = "4200";
inherent_gain = "1";
mclk_multiplier = "25";
pix_clk_hz = "576000000";
min_gain_val = "1.0";
max_gain_val = "22.2";
min_hdr_ratio = "1";
max_hdr_ratio = "64";
min_framerate = "1.462526";
max_framerate = "60";
min_exp_time = "16.165";
max_exp_time = "33191";
embedded_metadata_height = "0";
};
mode2 { // MODE_1920X1080@60fps
mclk_khz = "24000";
num_lanes = "4";
tegra_sinterface = "serial_e";
discontinuous_clk = "yes";
cil_settletime = "0";
active_w = "1932";
active_h = "1080";
pixel_t = "bayer_rggb";
readout_orientation = "90";
line_length = "4200";
inherent_gain = "1";
mclk_multiplier = "25";
pix_clk_hz = "576000000";
min_gain_val = "1.0";
max_gain_val = "22.2";
min_hdr_ratio = "1";
max_hdr_ratio = "64";
min_framerate = "1.462526";
max_framerate = "60";
min_exp_time = "16.165";
max_exp_time = "33191";
embedded_metadata_height = "0";
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
mysens_out0: endpoint {
csi-port = <4>;
bus-width = <4>;
remote-endpoint = <&mysens_vi_in0>;
};
};
};
};
};
tegra-camera-platform {
compatible = "nvidia, tegra-camera-platform";
/**
* 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 {
module0 {
badge = "mysens_front_A6V24";
position = "rear";
orientation = "1";
status = "okay";
drivernode0 {
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_sensor";
/* Driver's v4l2 device name */
devname = "my sensor";
/* Declare the device-tree hierarchy to driver instance */
proc-device-tree = "/proc/device-tree/i2c@7000c500/mysens@10";
status = "okay";
};
};
};
};
};
Relevant kernel log during booting
i2c /dev entries driver
[1322] : drivers/media/i2c/mysens.c : mysens_init() ENTER
[756] : drivers/media/i2c/mysens.c : mysens_probe() ENTER
Node name: mysens
[637] : drivers/media/i2c/mysens.c : mysens_parse_dt() ENTER
[688] : drivers/media/i2c/mysens.c : mysens_parse_dt() EXIT
[389] : drivers/media/i2c/mysens.c : mysens_power_get() ENTER
[405] : drivers/media/i2c/mysens.c : mysens_power_get() EXIT
Inside camera_common_parse_ports()
mysens_v4l2 2-0010: camera_common_parse_ports: csi port 4 num of lanes 4
Exiting camera_common_parse_ports()
[mysens]CSI Port:4 Lane conf: 4
[578] : drivers/media/i2c/mysens.c : mysens_ctrls_init() ENTER
[541] : drivers/media/i2c/mysens.c : mysens_s_ctrl() ENTER
[541] : drivers/media/i2c/mysens.c : mysens_s_ctrl() ENTER
[541] : drivers/media/i2c/mysens.c : mysens_s_ctrl() ENTER
[541] : drivers/media/i2c/mysens.c : mysens_s_ctrl() ENTER
[541] : drivers/media/i2c/mysens.c : mysens_s_ctrl() ENTER
[541] : drivers/media/i2c/mysens.c : mysens_s_ctrl() ENTER
[616] : drivers/media/i2c/mysens.c : mysens_ctrls_init() EXIT
[928] : drivers/media/i2c/mysens.c : mysens_probe() EXIT
[1339] : drivers/media/i2c/mysens.c : mysens_init() EXIT
virtual_init
[IMX135] sensor driver loading
[imx132] sensor driver loading
[ar0261] sensor driver loading
.
.
.
platform d3.regulator: Driver reg-fixed-sync-voltage requests probe deferral
vi vi: vi_probe: ++
vi vi: vi_intr_init: ++
vi vi: initialized
vi vi: parsing node /host1x/vi
vi vi: handling endpoint /host1x/vi/ports/port@0/endpoint
vi vi: parsing node /i2c@7000c500/mysens@10
vi vi: handling endpoint /i2c@7000c500/mysens@10/ports/port@0/endpoint
vi vi: subdev mysens_v4l2 2-0010 bound
vi vi: notify complete, all subdevs registered
vi vi: creating links for entity mysens_v4l2 2-0010
vi vi: processing endpoint /i2c@7000c500/mysens@10/ports/port@0/endpoint
vi vi: skipping channel port /i2c@7000c500/mysens@10:0
vi vi: creating links for channels
vi vi: processing endpoint /host1x/vi/ports/port@0/endpoint
vi vi: creating link for channel vi-output-255
vi vi: creating mysens_v4l2 2-0010:0 -> vi-output-255:0 link
mysens_v4l2 2-0010: camera_common_g_fmt++
reg-fixed-sync-voltage 5.regulator: Consumer c1 does not have device name
.
.
.
[699] : drivers/media/i2c/mysens.c : mysens_open() ENTER
[701] : drivers/media/i2c/mysens.c : mysens_open() EXIT
mysens_v4l2 2-0010: camera_common_mclk_enable: enable MCLK with 27000000 Hz
[280] : drivers/media/i2c/mysens.c : mysens_power_on() ENTER
[322] : drivers/media/i2c/mysens.c : mysens_power_on() EXIT
[340] : drivers/media/i2c/mysens.c : mysens_power_off() ENTER
[370] : drivers/media/i2c/mysens.c : mysens_power_off() EXIT
mysens_v4l2 2-0010: camera_common_mclk_disable: disable MCLK
Please note that, in the dtsi file, I have put i2c info outside host1x node since I am using I2C_2 . Is there something wrong with my dtsi file or should I concentrate on my driver code? Any pointer/help is really appreciated as I am kind of stuck at the moment.