Hello
I want to develop the driver for my camera. First, I decided to copy the ov5693 driver with a different name. I copy and rename ov5693.c, ov5693_mode_tbls.h, ov5693.h. In the new files, I change all “ov5693” to a new name.
In the / drivers / media / makefile, I added:
obj - $ (CONFIG_VIDEO_NEWNAME) + = newname.o
In / drivers / media / kconfig, I added:
config VIDEO_NEWNAME
tristate "support for the NEWNAME camera sensor"
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
---Help---
This is a Video4Linux2 level sensor driver for OmniVision
NEWNAME camera.
To compile this driver as a module, select M here: module
will be called NEWNAME.
In kernel-4.4 / arch / arm64 / configs / tegra21_defconfig, I added the line:
CONFIG_VIDEO_NEWNAME = y
Then I used the “Building an NVIDIA Kernel” from nvl4t_docs / index.html for L4T 28.1
After “make O = $ TEGRA_KERNEL_OUT zImage”, I can see the newname.o file in the drivers / media / i2c folder
In the generated dtb-file (I converted it to dts, and then returned to dtb). I manually change “ov5693” to newname. Before it i checked that this dtb works correctly with ov5693.
.....
i2c@546c0000 {
#address-cells = <0x1>;
#size-cells = <0x0>;
compatible = "nvidia,tegra210-vii2c";
reg = <0x0 0x546c0000 0x0 0x34000>;
iommus = <0x52 0x12>;
interrupts = <0x0 0x11 0x4>;
scl-gpio = <0x7b 0x92 0x0>;
sda-gpio = <0x7b 0x93 0x0>;
status = "okay";
clocks = <0x41 0xd0 0x41 0x51 0x41 0x1c>;
clock-names = "vii2c", "i2cslow", "host1x";
resets = <0x41 0xd0>;
reset-names = "vii2c";
clock-frequency = <0x61a80>;
bus-pullup-supply = <0x69>;
avdd_dsi_csi-supply = <0x67>;
linux,phandle = <0xe0>;
phandle = <0xe0>;
newname_c@20 {
compatible = "nvidia,newname";
reg = <0x36>;
devnode = "video0";
physical_w = "3.674";
physical_h = "2.738";
vertical-flip = "true";
avdd-reg = "vana";
iovdd-reg = "vif";
clocks = <0x41 0x117>;
clock-names = "clk_out_3";
clock-frequency = <0x16e3600>;
mclk = "clk_out_3";
reset-gpios = <0x7b 0x94 0x0>;
pwdn-gpios = <0x7b 0x97 0x0>;
vana-supply = <0x94>;
vif-supply = <0x93>;
status = "disabled";
linux,phandle = <0xe1>;
phandle = <0xe1>;
mode0 {
mclk_khz = "24000";
num_lanes = [32 00];
tegra_sinterface = "serial_c";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = [30 00];
active_w = "2592";
active_h = "1944";
pixel_t = "bayer_bggr";
readout_orientation = "90";
line_length = "2688";
inherent_gain = [31 00];
mclk_multiplier = "6.67";
pix_clk_hz = "160000000";
min_gain_val = "1.0";
max_gain_val = "16";
min_hdr_ratio = [31 00];
max_hdr_ratio = "64";
min_framerate = "1.816577";
max_framerate = "30";
min_exp_time = "34";
max_exp_time = "550385";
};
mode1 {
mclk_khz = "24000";
num_lanes = [32 00];
tegra_sinterface = "serial_c";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = [30 00];
active_w = "2592";
active_h = "1458";
pixel_t = "bayer_bggr";
readout_orientation = "90";
line_length = "2688";
inherent_gain = [31 00];
mclk_multiplier = "6.67";
pix_clk_hz = "160000000";
min_gain_val = "1.0";
max_gain_val = "16";
min_hdr_ratio = [31 00];
max_hdr_ratio = "64";
min_framerate = "1.816577";
max_framerate = "30";
min_exp_time = "34";
max_exp_time = "550385";
};
mode2 {
mclk_khz = "24000";
num_lanes = [32 00];
tegra_sinterface = "serial_c";
discontinuous_clk = "no";
dpcm_enable = "false";
cil_settletime = [30 00];
active_w = "1280";
active_h = "720";
pixel_t = "bayer_bggr";
readout_orientation = "90";
line_length = "1752";
inherent_gain = [31 00];
mclk_multiplier = "6.67";
pix_clk_hz = "160000000";
min_gain_val = "1.0";
max_gain_val = "16";
min_hdr_ratio = [31 00];
max_hdr_ratio = "64";
min_framerate = "2.787078";
max_framerate = "120";
min_exp_time = "22";
max_exp_time = "358733";
};
ports {
#address-cells = <0x1>;
#size-cells = <0x0>;
port@0 {
reg = <0x0>;
endpoint {
csi-port = <0x2>;
bus-width = <0x2>;
remote-endpoint = <0x96>;
linux,phandle = <0xea>;
phandle = <0xea>;
};
};
};
};
};
e3333_lens_newname@P5V27C {
min_focus_distance = "0.0";
hyper_focal = "0.0";
focal_length = "2.67";
f_number = "2.0";
aperture = "2.0";
};
e3326_lens_newname@P5V27C {
min_focus_distance = "0.0";
hyper_focal = "0.0";
focal_length = "2.67";
f_number = "2.0";
aperture = "2.0";
};
.......
plugin-manager {
fragment-e3326@0 {
ids = "3326-*";
override@0 {
target = <0xe1>;
_overlay_ {
status = "okay";
};
};
override@1 {
target = <0xe2>;
_overlay_ {
status = "okay";
badge = "e3326_front_P5V27C";
position = "rear";
orientation = [31 00];
};
};
override@2 {
target = <0xe3>;
_overlay_ {
status = "okay";
pcl_id = "v4l2_sensor";
devname = "newname 6-0036";
proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/newname_c@20";
};
};
.....
Then I run the script flash.sh and after starting the board I check the file /proc/config.gz - it does not have the line “CONFIG_VIDEO_NEWNAME = y”, and the driver also does not work.
In / dev / folder I do not have / video0 device. I think it means, that driver “newname” is missing in kernel.
I think I’m making some mistakes in the kernel configuration before building it. Could you help me?