Hi,
On Tx2 board, I refer imx274.dtsi and modify tc358840.c, compile and install successfully, my tc358840 device tree is:
/ {
host1x {
vi@15700000 {
num-channels = <1>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
tc358840a_vi_in0: endpoint {
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&tc358840a_csi_out0>;
};
};
};
};
nvcsi@150c0000 {
num-channels = <1>;
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
tc358840a_csi_in0: endpoint@0 {
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&tc358840a_imx274_out0>;
};
};
port@1 {
reg = <1>;
tc358840a_csi_out0: endpoint@1 {
remote-endpoint = <&tc358840a_vi_in0>;
};
};
};
};
};
};
i2c@3180000 {
tc358840@0f {
compatible = "toshiba,tc358840";
/* I2C device address */
reg = <0x0f>;
/* V4L2 device node location */
devnode = "video0";
/* Physical dimensions of sensor */
physical_w = "3.674";
physical_h = "2.738";
sensor_model = "tc358840";
lineinitcnt = <0x00000FA0>;
lptxtimecnt = <0x00000004>;
tclk_headercnt = <0x00180203>;
tclk_trailcnt = <0x00040005>;
ths_headercnt = <0x000D0004>;
twakeup = <0x00003E80>;
tclk_postcnt = <0x0000000A>;
ths_trailcnt = <0x00080006>;
hstxvregcnt = <0x00000020>;
btacnt = <0>;
pll_prd = <10>;
pll_fbd = <230>;
pll_frs = <0>;
refclk_hz = <27000000>;
//mclk = "cam_mclk1";
ddc5v_delay = <1>;
enable_hdcp = <0>;
csi_port = <0>;
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
tc358840a_imx274_out0: endpoint {
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&tc358840a_csi_in0>;
};
};
};
};
};
};
/ {
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 = <16>;
vi_peak_byte_per_pixel = <2>;
vi_bw_margin_pct = <25>;
max_pixel_rate = <750000>;
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 vender.
*/
modules {
module0 {
badge = "tc358840_bottom_A6V26";
position = "rear";
orientation = "0";
drivernode0 {
/* Declare PCL support driver (classically known as guid) */
pcl_id = "v4l2_sensor";
/* Driver v4l2 device name */
devname = "tc358840 2-000f";
/* Declare the device-tree hierarchy to driver instance */
proc-device-tree = "/proc/device-tree/i2c@3180000/tc358840@0f";
};
};
};
};
};
However, I got kernel error after added mode parameters into tc358840@0f node:
i2c@3180000 {
tc358840@0f {
compatible = "toshiba,tc358840";
/* I2C device address */
reg = <0x0f>;
/* V4L2 device node location */
devnode = "video0";
/* Physical dimensions of sensor */
physical_w = "3.674";
physical_h = "2.738";
sensor_model = "tc358840";
lineinitcnt = <0x00000FA0>;
lptxtimecnt = <0x00000004>;
tclk_headercnt = <0x00180203>;
tclk_trailcnt = <0x00040005>;
ths_headercnt = <0x000D0004>;
twakeup = <0x00003E80>;
tclk_postcnt = <0x0000000A>;
ths_trailcnt = <0x00080006>;
hstxvregcnt = <0x00000020>;
btacnt = <0>;
pll_prd = <10>;
pll_fbd = <230>;
pll_frs = <0>;
refclk_hz = <27000000>;
//mclk = "cam_mclk1";
ddc5v_delay = <1>;
enable_hdcp = <0>;
csi_port = <0>;
mode0 {
mclk_khz = "27000";
num_lanes = [32 00];
tegra_sinterface = "serial_c";
phy_mode = "DPHY";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = [30 00];
active_w = "1920";
active_h = "1080";
mode_type = "yuv";
pixel_phase = "uyvy";
csi_pixel_bit_depth = "16";
readout_orientation = [30 00];
line_length = "2688";
inherent_gain = [31 00];
mclk_multiplier = "6.67";
pix_clk_hz = "160000000";
gain_factor = "10";
min_gain_val = "10";
max_gain_val = "160";
step_gain_val = [31 00];
default_gain = "10";
min_hdr_ratio = [31 00];
max_hdr_ratio = [31 00];
framerate_factor = "1000000";
min_framerate = "1816577";
max_framerate = "30000000";
step_framerate = [31 00];
default_framerate = "30000000";
exposure_factor = "1000000";
min_exp_time = "34";
max_exp_time = "550385";
step_exp_time = [31 00];
default_exp_time = "33334";
embedded_metadata_height = [30 00];
};
ports {
#address-cells = <1>;
#size-cells = <0>;
port@0 {
reg = <0>;
tc358840a_imx274_out0: endpoint {
port-index = <0>;
bus-width = <2>;
remote-endpoint = <&tc358840a_csi_in0>;
};
};
};
};
};
};
the error message is:
[ 33.207041] tc358840 2-000f: tc358840_get_fmt():
[ 33.211690] tc358840 2-000f: tc358840_get_fmt(): width=1920, height=1080, code=0x0000200F, field=1
[ 33.220662] tegra_channel_init_subdevices: 4
[ 33.225034] tegra_channel_init_subdevices: 5
[ 33.229324] tegra_channel_init_subdevices: 5-3
[ 33.233837] tegra_channel_sensorprops_setup: 1
[ 33.238360] tegra_channel_sensorprops_setup: 2
[ 33.242880] tegra_channel_sensorprops_setup: 3
[ 33.247401] tegra_channel_sensorprops_setup: num_modes = 1
[ 33.252946] tegra_channel_sensorprops_setup: 3-1
[ 33.257725] Internal error: Accessing user space memory outside uaccess.h routines: 96000005 [#1] PREEMPT SMP
[ 33.267647] Modules linked in: tc358840(+) bnep fuse bcmdhd zram cfg80211 spidev overlay userspace_alert nvgpu bluedroid_pm ip_tables x_tables
[ 33.280751] CPU: 0 PID: 7281 Comm: insmod Not tainted 4.9.201-tegra #41
[ 33.287371] Hardware name: quill (DT)
[ 33.291047] task: ffffffc1b8975400 task.stack: ffffffc1c155c000
[ 33.297007] PC is at tegra_channel_init_subdevices+0x79c/0x868
[ 33.302852] LR is at tegra_channel_init_subdevices+0x784/0x868
[ 33.308693] pc : [<ffffff8008b3e5dc>] lr : [<ffffff8008b3e5c4>] pstate: 40400045
[ 33.316091] sp : ffffffc1c155f810
[ 33.319413] x29: ffffffc1c155f810 x28: 0000000000000000
[ 33.324775] x27: 0000000000000002 x26: ffffffc1c06c2000
[ 33.330135] x25: ffffffc1c59dc000 x24: ffffffc1b76a8000
[ 33.335495] x23: ffffffc1b76cd858 x22: 0000000000000000
[ 33.340854] x21: ffffffc1c59d8000 x20: ffffff8009071000
[ 33.346212] x19: ffffffc1e93cf018 x18: 0000000000000010
[ 33.351568] x17: 0000000000000000 x16: 0000000000000000
[ 33.356924] x15: ffffffffffffffff x14: ffffff808a14a5b7
[ 33.362282] x13: ffffff800a14a5c5 x12: 0000000000000000
[ 33.367640] x11: 0000000005f5e0ff x10: 000000000000054d
[ 33.372998] x9 : ffffffc1c06c20d0 x8 : ffffff80083d6638
[ 33.378356] x7 : ffffff8009eb4440 x6 : ffffffc1f5f74bf0
[ 33.383714] x5 : ffffffc1f5f74bf0 x4 : 0000000000000000
[ 33.389071] x3 : ffffffc1f5f7a7f8 x2 : 0000000000000000
[ 33.394428] x1 : ffffff8009072048 x0 : ffffff80094c9ec8
[ 33.399785]
[ 33.401288] Process insmod (pid: 7281, stack limit = 0xffffffc1c155c000)
[ 33.407993] Call trace:
[ 33.410462] [<ffffff8008b3e5dc>] tegra_channel_init_subdevices+0x79c/0x868
[ 33.417348] [<ffffff8008b3f2d0>] tegra_vi_graph_notify_complete+0x2e8/0x6e8
[ 33.424324] [<ffffff8008b22cd4>] v4l2_async_test_notify+0x104/0x120
[ 33.430601] [<ffffff8008b22f10>] v4l2_async_register_subdev+0x88/0x100
[ 33.437183] [<ffffff8001153ae8>] tc358840_probe+0x5a8/0x738 [tc358840]
[ 33.443725] [<ffffff8008aebeb4>] i2c_device_probe+0x144/0x258
[ 33.449492] [<ffffff8008780ee8>] driver_probe_device+0xd8/0x408
[ 33.455419] [<ffffff80087812f4>] __driver_attach+0xdc/0x128
[ 33.461000] [<ffffff800877e964>] bus_for_each_dev+0x5c/0xa8
[ 33.466579] [<ffffff80087806e8>] driver_attach+0x30/0x40
[ 33.471898] [<ffffff800878011c>] bus_add_driver+0x20c/0x2a8
[ 33.477481] [<ffffff800878222c>] driver_register+0x6c/0x110
[ 33.483061] [<ffffff8008aec5a4>] i2c_register_driver+0x4c/0xb0
[ 33.488929] [<ffffff8001141018>] tc358840_driver_init+0x18/0x30 [tc358840]
[ 33.495819] [<ffffff8008083b3c>] do_one_initcall+0x44/0x130
[ 33.501409] [<ffffff80081c1644>] do_init_module+0x64/0x1a8
[ 33.506909] [<ffffff8008156698>] load_module+0x10a0/0x12d0
[ 33.512402] [<ffffff8008156b78>] SyS_finit_module+0xd8/0xf0
[ 33.517980] [<ffffff8008083900>] el0_svc_naked+0x34/0x38
[ 33.523304] ---[ end trace f97d58752f93ac6d ]---
What is the problem?