SOC_CAMERA driver in L4T R24.1

I have developed driver for Toshiba TC358748 (Parallel to MIPI converter) based on soc_camera V4L2 framework in L4T R23.2.

But in L4T R24.1, soc_camera is deprecated and replaced by V4L2 media-controller driver support for camera sensors (bypassing ISP).

So how to modify my current driver to make compatible with media-controller?

Or if i want to use tegra_camera.ko (soc_camera v4l2) framework in L24.1 what changes need to make in tegra21_defconfig file? Because default Media Controller is by default added as build-in and all other sensors also added as build-in in tegra21_defconfig file.

whats the benefits of media-controller framework over soc_camera framework? Does this improves latency?

I had the same issue you have. I made custom soc_camera driver and it worked fine on 23.2. 24.1 came out with documentation that only talks about 23.2, with kernel code somewhere in limbo regarding soc_camera vs media controller, and the threat of soc_camera no longer being supported starting from the next revision.

Thankfully, you can still make your soc_camera driver work without modification (at least it worked for me). You just need to make a slight change to the device tree and the .config.

The main thing is to include the soc_camera stuff, and also allow the nvhost_vi to be rmmod, since the stock .config puts it as built-in module. I basically diff’ed the working .config from 23.2 with the stock 24.1 and figured out the changes.

Basically:

CONFIG_VIDEO_TEGRA=m # so that it can be rmmod
CONFIG_VIDEO_TEGRA_VI=m # so that it can be rmmod
CONFIG_SOC_CAMERA=y # soc_camera
CONFIG_VIDEO_TEGRA_VI2=y # this one replaces the nvhost_vi
CONFIG_SOC_CAMERA_YOURCUSTOMSENSOR=m # your custom i2c soc_camera driver

You need to add drivers/media/i2c/soc_camera/yourcustomsensor_v4l2.c to the Makefile (but you already knew that). And include the platform device registration code in board-t210ref-camera.c (you already knew this too).

Regarding the device tree, they made some significant changes, but you just need to make sure that yourcustomsensor.dtsi gets included. I put the #include in the new file they put in there: tegra210-jetson-cv-camera-modules.dtsi.

I personally don’t use menuconfig, I just edit the .config directly. ‘make O=$OUT mrproper’ will delete it, so I just put it back (it is in svn anyway, so ‘svn up’ will put it back in an instant).

Then at start up you need to:
sudo rmmod nvhost_vi sudo modprobe tegra_camera

I don’t know if using media controller offers any advantage(s), but until they come out with a revision with an example that actually works with it (e.g. you can open ov5693 with yavta, which apparently you can’t right now), I’ll stick with soc_camera. It works.

Hello,

We are trying to run an object tracking application using opencv on L4T 24.1 with ov5693 sensor. It uses V4L2 framework. We were able to run it on 23.2 (using tegra_camera.ko and ov5693_v4l2.ko). After moving to 24.1, we are facing a lot of roadblocks. We could stream videos using nvgstcapture application, though. But it uses V4L2 non-compliant driver nvhost_vi.

However, the above post helped us a lot, but still we are stuck. Thank you, apalopohapa.

At first, the issue was that we couldn’t see any tegra_camera.ko, nvhost_vi.ko ,ov5693_v4l2.ko which were the modules of interest when working with 23.2. But after applying the above changes in the config file the modules were built.

However, we couldn’t remove nvhost_vi using ‘sudo rmmod nvhost_vi’. ‘dmesg’ showed some stack dump (seemingly a segfault). Hence tegra_camera cannot be inserted without properly removing nvhost_vi.

Then we renamed nvhost_vi module and rebooted the system so that it is not inserted at boot time. Now lsmod did not show nvhost_vi. Then we inserted tegra_camera.

The issue now is that /dev/video0 is not created. And when analyzing further found that ov5693_v4l2 registration as i2c device has failed.

Any suggestion on how ov5693_v4l2 can be loaded?

Thanks in advance

Krishh

I am in the same boat as Ritesh here. I developed my own driver by modifying the ov5693_v4l2 driver found in the previous release. But now Nvidia is switching to media controller.

Can Nvidia give any insight as to why this switch occurred and if there are any advantages to doing so? I am somewhat frustrated I have spent so much time on the soc_camera version only to learn it is now to be deprecated. Yes i understand I can take my existing version and place it on 24-1 via mods, but my main fear is if supporting my soc_camera driver will now conflict with bug fixes nvidia will be applying in the future.

I don’t want to work on porting over to this new media controller version unless there is a good reason to do so.

Hello apalopohapa,

Thanks for the Reply. Due to some other tasks i left this. But i am back on it.
Now its R24.2. And i still want to use soc_camera based driver.

I have done as per your steps. I have added following in my tegra21_defconfig

CONFIG_VIDEO_TEGRA=m
CONFIG_VIDEO_TEGRA_VI=m
CONFIG_SOC_CAMERA=y
CONFIG_VIDEO_TEGRA_VI2=y
CONFIG_SOC_CAMERA_TC358748=m

And zImage build command gives me following errors

..
..
CHK     include/generated/compile.h
UPD     include/generated/compile.h
CC      init/version.o
LD      init/built-in.o
drivers/built-in.o: In function `tegra_vi_v4l2_init':
/home/ritesh/kernel_R24.2.1/kernel/drivers/media/platform/tegra/camera/mc_common.c:192: undefined reference to `tegra_vi_get'
drivers/built-in.o: In function `tegra_channel_update_clknbw':
/home/ritesh/kernel_R24.2.1/kernel/drivers/media/platform/tegra/camera/channel.c:850: undefined reference to `tegra_vi_get'
/home/ritesh/kernel_R24.2.1/kernel/Makefile:794: recipe for target 'vmlinux' failed
make[1]: *** [vmlinux] Error 1
Makefile:130: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

To solve error, i have to enable following modules as build in from menuconfig

Media Controller API 
V4L2 sub-device userspace API
Tegra video input host1x client driver

After that if i flashed this kernel. modprobe tegra_camera gives following error

modprobe : ERROR: could not insert 'tegra_camera' : Device or resource busy

So whats wrong here?

Hi RiteshPanchal
For the r24.2 and later version due to enable the “Media Controller Framework” that will impact the soc_camera. It’s better to use the media controller framework to bring up your sensor. You can download the document to get the detail information.

Hi Shane,

I have already started working in Media Controller.
I am developing driver for TC358748.
TC358748 requires 4 CSI lanes and connected to CSI-A.

I have added sensor driver in /media/i2c and added dtsi file in “arch/arm64/boot/dts/tegra210-platforms/tegra210-camera-tc358748-a00.dtsi”.
And as per the user guide i have done below 2 changes
1.In kernel/arch/arm64/boot/dts/tegra210-plugin-manager/tegra210-jetson-cv-plugin-manager.dtsi, remove the following line:
#include “tegra210-jetson-cv-camera-plugin-manager.dtsi”

2.In kernel/arch/arm64/boot/dts/tegra210-jetson-cv-base-p2597-2180-a00.dts, replace the following line:
#include “tegra210-platforms/tegra210-jetson-cv-camera-modules.dtsi”
With an #include statement specifying your new device DTSI file

Below is my dtsi file

//#include <tegra210-jetson-tx1-p2597-2180-a01-devkit.dts>
#include <dt-bindings/media/camera.h>
#include <dt-bindings/platform/t210/t210.h>

/* camera control gpio definitions */

/ {
        host1x {
                vi {
                        num-channels = <1>;
                        ports {
                                #address-cells = <1>;
                                #size-cells = <0>;

                                port@0 { // CSI A
                                        status = "okay";
                                        reg = <0>;
                                        vi_in0: endpoint {
                                                status = "okay";
                                                csi-port = <0x0>;
                                                bus-width = <4>;
                                                remote-endpoint = <&tc358748_out0>;
                                                clock-lanes = <0>;
                                                data-lanes = <1 2 3 4>;
                                        };
                                };

                                port@1 { // CSI B
                                        status = "disabled";
                                        reg = <0>;
                                };

                                port@2 { // CSI C
                                        status = "disabled";
                                        reg = <0>;
                                };

                                port@3 { // CSI D
                                        status = "disabled";
                                        reg = <0>;
                                };

                                port@4 { // CSI E
                                        status = "disabled";
                                        reg = <0>;
                                };

                                port@5 { // CSI F
                                        status = "disabled";
                                        reg = <0>;
                                };
                        };
                };


                i2c@546c0000 {
			status = "okay";
			#address-cells = <1>;
			#size-cells = <0>;

                        // disable ov5693 (kernel configuration should exclude the driver, so probably shouldn't
                        // be necessary)
                        ov5693_c@36 {
                                status = "disabled";
                        };

			tc358748_a@0E {
				compatible = "nvidia,tc358748";
				reg = <0x0E>;
				sensor_model ="tc358748";
				avdd-reg = "vana";
				iovdd-reg = "vif";
				devnode = "video0";
				post_crop_frame_drop = "0";
				mclk = "cam_mclk1";
				vana-supply = <&en_vdd_cam_hv_2v8>;
                                vif-supply = <&en_vdd_cam>;

				ports {
					#address-cells = <1>;
					#size-cells = <0>;
					port@0 {
						reg = <0>;
						tc358748_out0: endpoint {
							csi-port = <0>;
							bus-width = <4>;
							remote-endpoint = <&vi_in0>;
						};
					};
				};
			};
                };
        };

        tegra-camera-platform {
		compatible = "nvidia, tegra-camera-platform";

		modules {
			module0 {
				badge = "tc358748";
				position = "rear";
				orientation = "1";
				status = "okay";
				drivernode0 {
					pcl_id = "v4l2_sensor";
					devname = "TC358748 6-0036";
					proc-device-tree = "/proc/device-tree/host1x/i2c@546c0000/tc358748_a@0E";
					status = "okay";
				};
				drivernode1 {
					pcl_id = "v4l2_focuser_stub";
					status = "okay";
				};
			};
		};
	};
};

This gives me following boot logs

[    8.056827] vi vi: vi_probe: ++
[    8.065160] vi vi: initialized
[    8.071655] vi vi: parsing node /host1x/vi
[    8.078778] vi vi: handling endpoint /host1x/vi/ports/port@0/endpoint
[    8.088306] vi vi: parsing node /host1x/i2c@546c0000/tc358748_a@0E
[    8.097535] vi vi: handling endpoint /host1x/i2c@546c0000/tc358748_a@0E/ports/port@0/endpoint
[    8.109175] vi vi: subdev tc358748 6-000e bound
[    8.116729] vi vi: notify complete, all subdevs registered
[    8.125183] vi vi: creating links for entity tc358748 6-000e
[    8.133822] vi vi: processing endpoint /host1x/i2c@546c0000/tc358748_a@0E/ports/port@0/endpoint
[    8.145563] vi vi: skipping channel port /host1x/i2c@546c0000/tc358748_a@0E:0
[    8.155761] vi vi: creating links for channels
[    8.163296] vi vi: processing endpoint /host1x/vi/ports/port@0/endpoint
[    8.173052] vi vi: creating link for channel vi-output-0
[    8.181487] vi vi: creating tc358748 6-000e:0 -> vi-output-0:0 link

But i am also getting some memory dumping in kernel boot log. So still something is missing.

Welcome to Ubuntu 16.04 LTS!

[    8.802255] systemd[1]: Set hostname to <tegra-ubuntu>.
[    8.936589] systemd[1]: Listening on udev Kernel Socket.
[  OK  ] Listening on udev Kernel Socket.
[    8.961446] systemd[1]: Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Started Forward Password Requests to Wall Directory Watch.
[    8.991355] systemd[1]: Reached target Encrypted Volumes.
[  OK  ] Reached target Encrypted Volumes.
[    9.011376] systemd[1]: Reached target Swap.
...
...
...
[    9.741894] systemd[1]: Started Remount Root and Kernel File Systems.
[  OK  ] Started Remount Root and Kernel File Systems.
[    9.771896] systemd[1]: Started Load Kernel Modules.
[  OK  ] Started Load Kernel Modules.
[    9.791601] systemd[1]: Started Journal Service.
[  OK  ] Started Journal Service.
[  OK  ] Started LVM2 metadata daemon.
         Mounting FUSE Control File System...
         Mounting Configuration File System...
         Starting Apply Kernel Variables...
         Starting Flush Journal to Persistent Storage...
         Starting Load/Save Random Seed...
         Starting udev Coldplug all Devices...
         Starting Create Static Device Nodes in /dev...
[  OK  ] Mounted FUSE Control File System.
[  OK  ] Mounted Configuration File System.
[  OK  ] Started Apply Kernel Variables.
[  OK  ] Started Load/Save Random Seed.
[  OK  ] Started Create Static Device Nodes in /dev.
[  OK  ] Started Flush Journal to Persistent Storage.
         Starting udev Kernel Device Manager...
[  OK  ] Started udev Kernel Device Manager.
[  OK  ] Started udev Coldplug all Devices.
[  OK  ] Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Started Monitoring of LVM2 mirrors,...ng dmeventd or progress polling.
[  OK  ] Reached target Local File Systems (Pre).
[  OK  ] Reached target Local File Systems.
         Starting Tell Plymouth To Write Out Runtime Data...
         Starting Create Volatile Files and Directories...
[   10.440707] Unable to handle kernel NULL pointer dereference at virtual address 00000058
[   10.451329] pgd = ffffffc0f431e000
[   10.456853] [00000058] *pgd=0000000000000000
[   10.460984] Internal error: Oops: 96000005 [#1] PREEMPT SMP
[   10.460986] Enter nvdumper_crash_setup_regs
[   10.460991] nvdumper: all registers are saved.
[   10.460992] nvdumper: all registers are saved.
[   10.463283] nvdumper: all registers are saved.
[   10.463284] nvdumper: all registers are saved.
[   10.463288] Modules linked in: bluedroid_pm
[   10.463292] CPU: 1 PID: 225 Comm: v4l_id Not tainted 3.10.96 #52
[   10.463295] task: ffffffc0f43b28c0 ti: ffffffc0f43b8000 task.ti: ffffffc0f43b8000
[   10.463302] PC is at clk_set_rate+0x0/0x1cc
[   10.463307] LR is at camera_common_mclk_enable+0x7c/0xcc
[   10.463309] pc : [<ffffffc0007fce50>] lr : [<ffffffc0006d28dc>] pstate: 20000105
[   10.463310] sp : ffffffc0f43bbb00
[   10.463313] x29: 0000007fe2f82b60 x28: ffffffc0ff802ec0 
[   10.463316] x27: ffffffc0f43bbd64 x26: 0000000000000000 
[   10.463318] x25: ffffffc0f75646a8 x24: ffffffc0f7565018 
[   10.463321] x23: ffffffc0f7564038 x22: ffffffc0f41ca5c0 
[   10.463323] x21: 0000000000000001 x20: 00000000016e3600 
[   10.463325] x19: ffffffc0fc5aa618 x18: 0000000000000a03 
[   10.463328] x17: 0000007f82b35250 x16: ffffffc0001a08c0 
[   10.463330] x15: ffffffffffffffff x14: ffffffffffffffff 
[   10.463332] x13: 0000000000000000 x12: 0101010101010101 
[   10.463335] x11: 0000000000000007 x10: 0000000000000000 
[   10.463337] x9 : ffffffc000b93810 x8 : 0000000000000001 
[   10.463339] x7 : ffffffc0011eba20 x6 : 0000000000001340 
[   10.463342] x5 : ffffffc0f43b8000 x4 : 0000000000000000 
[   10.463344] x3 : 0000000036b7917f x2 : ffffffc0006d29b8 
[   10.463346] x1 : 00000000016e3600 x0 : 0000000000000000 
[   10.463347] 
[   10.463347] PC: 0xffffffc0007fcdd0:
[   10.463354] cdd0  aa1303e0 97fffd4f 2a1403e0 14000018 128004a0 d65f03c0 128004a0 d65f03c0
[   10.463360] cdf0  eb1702bf 1a9f97e1 39422260 6a00003f 54000141 52800018 17ffffbb aa1503e1
[   10.463366] ce10  aa1303e0 97fff1a1 2a0003f4 52800038 34fff6a0 17ffffeb aa1503e1 aa1303e0
[   10.463371] ce30  97fff19a 52800018 34fff5e0 a9415bf5 a94263f7 f9401bfe a8c453f3 d65f03c0
[   10.463377] ce50  f9402c02 b4000d22 f9401042 b4000d22 a9bc53f3 a9015bf5 a90263f7 f9001bfe
[   10.463383] ce70  aa0103f8 aa0003f5 2a0103f4 910003e1 d00055a0 91356000 b9400800 34000360
[   10.463388] ce90  f9404eb7 9272c421 b9404c36 b9404820 11000400 b9004820 d00055a0 91356000
[   10.463394] ceb0  f9401013 b4000133 f9400264 2a1603e3 2a1403e2 aa1703e1 f9400660 d63f0080
[   10.463395] 
[   10.463395] LR: 0xffffffc0006d285c:
[   10.463401] 285c  d65f03c0 a9be53f3 f9000bfe f9402013 b981bc14 b5000153 b0002502 91100042
[   10.463407] 287c  91090042 b0004861 91072021 f9400c00 97f84889 12800240 14000023 90005fe1
[   10.463412] 289c  79554421 36100181 aa1403e4 b0002503 91100063 91090063 b0004862 9107a042
[   10.463418] 28bc  f9400c01 90005fe0 91214000 9108c000 97f1789d aa1403e1 f9401260 9404a95e
[   10.463424] 28dc  35000220 f9401273 52800002 52800c81 f0004480 9118a000 97e81dd1 aa1303e0
[   10.463429] 28fc  9404a767 2a0003f3 340000e0 52800002 52800ee1 f0004480 9118a000 97e81dc8
[   10.463435] 291c  2a1303e0 f9400bfe a8c253f3 d65f03c0 a9bf7bf3 f9402013 b5000153 f9400800
[   10.463441] 293c  b0002502 91100042 91098042 b0004861 91072021 9100a000 97f84857 14000016
[   10.463442] 
[   10.463442] SP: 0xffffffc0f43bba80:
[   10.463448] ba80  016e3600 00000000 00000001 00000000 f41ca5c0 ffffffc0 f7564038 ffffffc0
[   10.463454] baa0  f7565018 ffffffc0 f75646a8 ffffffc0 00000000 00000000 f43bbd64 ffffffc0
[   10.463462] bac0  ff802ec0 ffffffc0 e2f82b60 0000007f 006d28dc ffffffc0 f43bbb00 ffffffc0
[   10.463468] bae0  007fce50 ffffffc0 20000105 00000000 00fdeda0 ffffffc0 00000000 00000000
[   10.463474] bb00  fc5aa860 ffffffc0 fc5aa818 ffffffc0 006d29e4 ffffffc0 fc7ba018 ffffffc0
[   10.463480] bb20  00000000 00000000 fc7ba018 ffffffc0 fc7ba440 ffffffc0 006d41e4 ffffffc0
[   10.463485] bb40  006d6678 ffffffc0 006d6590 ffffffc0 fc7ba028 ffffffc0 f41ca5c0 ffffffc0
[   10.463491] bb60  fc7ba0b0 ffffffc0 00000000 00000000 001a64a8 ffffffc0 f41ca5d0 ffffffc0
[   10.463493] 
[   10.463493] X2: 0xffffffc0006d2938:
[   10.463499] 2938  f9400800 b0002502 91100042 91098042 b0004861 91072021 9100a000 97f84857
[   10.463504] 2958  14000016 90005fe1 79559421 36100181 f9400801 b0002503 91100063 91098063
[   10.463510] 2978  b0004862 91082042 9100a021 90005fe0 91214000 91096000 97f1786c f9401260
[   10.463516] 2998  9404a6b3 52800002 52800ee1 f0004480 9118a000 97e81da3 a8c17bf3 d65f03c0
[   10.463522] 29b8  a9be53f3 a9017bf5 2a0103f5 f9407400 9100a000 97f85328 aa0003f3 d1012014
[   10.463527] 29d8  340002f5 aa1403e0 97ffffa0 35000420 f85b8260 b4000380 f9400001 b4000381
[   10.463533] 29f8  aa1403e0 d63f0020 2a0003f5 34000320 b0002502 91100042 910a0042 b0004861
[   10.463539] 2a18  91088021 f85d0260 97f84824 aa1403e0 97ffffc1 2a1503e0 1400000e f85b8000
[   10.463540] 
[   10.463540] X5: 0xffffffc0f43b7f80:
[   10.463546] 7f80  92b80760 00000055 00000000 00000000 92b73000 00000055 00000000 00000000
[   10.463552] 7fa0  92b74110 00000055 92b74111 00000055 92b737b8 00000055 f2307d80 0000007f
[   10.463557] 7fc0  92b55cf0 00000055 f2307d80 0000007f 82b352c8 0000007f 60000000 00000000
[   10.463563] 7fe0  ffffff9c ffffffff 00000038 00000000 00000000 00000000 00000000 00000000
[   10.463569] 8000  00000008 00000000 ffffffff ffffffff f43b28c0 ffffffc0 000bb2c4 ffffffc0
[   10.463574] 8020  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463580] 8040  00000000 00000000 00000002 00000001 00000100 00000000 57ac6e9d 00000000
[   10.463585] 8060  00000000 b00e8123 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463586] 
[   10.463586] X7: 0xffffffc0011eb9a0:
[   10.463592] b9a0  00000000 00000000 2faf0800 00000000 5f5e1000 00000000 00c28cb0 00000000
[   10.463598] b9c0  00010101 00000882 00000039 00000000 01016900 ffffffc0 0000000d 00000001
[   10.463603] b9e0  011ebd68 ffffffc0 00000002 00000002 00000000 00000000 00000000 00000000
[   10.463609] ba00  00000000 00000000 ffff8ad0 00000000 01216380 ffffffc0 0000019c 00000000
[   10.463615] ba20  01201808 ffffffc0 011ed168 ffffffc0 00000000 00000000 00000000 00000000
[   10.463620] ba40  00000000 00000000 01215250 ffffffc0 00000000 00000000 00000000 00000000
[   10.463625] ba60  00000039 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463631] ba80  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463632] 
[   10.463632] X9: 0xffffffc000b93790:
[   10.463638] 3790  6c635f6c 65735f6b 61725f74 00006574 72676574 6c705f61 6c635f6c 6e655f6b
[   10.463644] 37b0  656c6261 00000000 72676574 6c705f61 6c635f6c 69645f6b 6c626173 00000065
[   10.463649] 37d0  72676574 6c705f61 6c635f6c 6e695f6b 00007469 00000000 72676574 6c705f61
[   10.463655] 37f0  756f5f6c 6c635f74 65735f6b 61725f74 00006574 00000000 260e0800 00000426
[   10.463661] 3810  112e0c03 00000700 72676574 5f313261 5f63736f 62616e65 0000656c 00000000
[   10.463666] 3830  72676574 5f313261 5f6b6c63 6e655f6d 656c6261 00000000 72676574 5f313261
[   10.463672] 3850  5f6b6c63 5f74756f 61736964 00656c62 72676574 5f313261 5f6b6c63 5f74756f
[   10.463678] 3870  62616e65 0000656c 72676574 5f313261 5f6b6c63 73756267 7465735f 7461725f
[   10.463680] 
[   10.463680] X16: 0xffffffc0001a0840:
[   10.463686] 0840  b9400800 34000340 910003e0 9272c401 b9404820 11000400 b9004820 d0008880
[   10.463692] 0860  91176000 f9401013 b4000133 d0006fd4 91074294 f9400262 aa1403e1 f9400660
[   10.463698] 0880  d63f0040 f8410e60 b5ffff60 910003e0 9272c400 b9404801 51000421 b9004801
[   10.463703] 08a0  f9400000 36080040 94245c2d aa1503e0 a9415bf5 a9427bf7 a8c353f3 d65f03c0
[   10.463709] 08c0  a9bc53f3 a9015bf5 a90263f7 f9001bfe aa0003f5 aa0103f6 aa0203f7 aa0303f8
[   10.463714] 08e0  d0008880 9116c000 b9400800 34000340 910003e0 9272c401 b9404820 11000400
[   10.463720] 0900  b9004820 d0008880 9116c000 f9401013 b4000133 90006d14 91096294 f9400262
[   10.463725] 0920  aa1403e1 f9400660 d63f0040 f8410e60 b5ffff60 910003e0 9272c400 b9404801
[   10.463727] 
[   10.463727] X19: 0xffffffc0fc5aa598:
[   10.463732] a598  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463738] a5b8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463743] a5d8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463749] a5f8  00000000 00000000 fc5ae0c0 ffffffc0 fc5aa800 ffffffc0 004eaff8 ffffffc0
[   10.463754] a618  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463760] a638  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463765] a658  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463771] a678  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463772] 
[   10.463772] X22: 0xffffffc0f41ca540:
[   10.463778] a540  00000000 00000000 00000020 00000000 ffffffff ffffffff 00000000 00000000
[   10.463784] a560  00000000 00000000 00000000 00000000 f41ca570 ffffffc0 f41ca570 ffffffc0
[   10.463790] a580  f41ca580 ffffffc0 f41ca580 ffffffc0 f7196960 ffffffc0 18313034 30203030
[   10.463795] a5a0  30302030 ffbf8d00 0000006e 00000000 00000000 00000000 0010a008 f7e7fe80
[   10.463801] a5c0  00000000 00000000 00000000 00000000 fc44b0a0 ffffffc0 fd913440 ffffffc0
[   10.463806] a5e0  f7524300 ffffffc0 00b6d950 ffffffc0 00000000 00000000 00000001 00000000
[   10.463812] a600  00020000 0000001d 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463817] a620  00000000 00000000 00000000 00000000 f41cf9c0 ffffffc0 00000000 00000000
[   10.463818] 
[   10.463818] X23: 0xffffffc0f7563fb8:
[   10.463824] 3fb8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463830] 3fd8  00000005 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463835] 3ff8  00000000 00000000 f78c4a80 ffffffc0 fe1cda58 ffffffc0 004eaff8 ffffffc0
[   10.463841] 4018  00000000 00000000 fe1cd800 ffffffc0 fe1cd810 ffffffc0 011b2f58 ffffffc0
[   10.463847] 4038  f7564018 ffffffc0 fe1cd800 ffffffc0 fe1cd810 ffffffc0 f75640e8 ffffffc0
[   10.463852] 4058  fc5aa8e0 ffffffc0 fc5aa8e0 ffffffc0 00010001 76206976 00000069 00000000
[   10.463858] 4078  00000000 00000000 00000000 00000000 00000000 00000000 006d3544 ffffffc0
[   10.463863] 4098  f7564590 ffffffc0 00000000 00000000 00000001 00000000 00000001 00000000
[   10.463864] 
[   10.463864] X24: 0xffffffc0f7564f98:
[   10.463870] 4f98  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463875] 4fb8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463883] 4fd8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463888] 4ff8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463894] 5018  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463899] 5038  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463904] 5058  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463910] 5078  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463911] 
[   10.463911] X25: 0xffffffc0f7564628:
[   10.463917] 4628  00000000 00000001 00000001 00000000 00000001 00000000 f7564640 ffffffc0
[   10.463923] 4648  f7564640 ffffffc0 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463928] 4668  00000000 00000000 00000001 00000000 f7564678 ffffffc0 f7564678 ffffffc0
[   10.463934] 4688  00000000 00000000 00000000 00000000 00000001 00000001 011b3010 ffffffc0
[   10.463939] 46a8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463945] 46c8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463950] 46e8  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463955] 4708  00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.463957] 
[   10.463957] X27: 0xffffffc0f43bbce4:
[   10.463963] bce4  ffffffc0 00000001 00000000 ffffff9c 00000000 f5203000 ffffffc0 00000000
[   10.463968] bd04  00000000 00000000 00000000 00000116 00000000 00000038 00000000 01140000
[   10.463974] bd24  ffffffc0 f43b8000 ffffffc0 001b2320 ffffffc0 988bc000 0000007f f75a33c0
[   10.463980] bd44  ffffffc0 00000010 00000000 f718b600 ffffffc0 001a3940 ffffffc0 988bc000
[   10.463985] bd64  00000000 fc44b0a0 ffffffc0 fd913440 ffffffc0 00000000 00000000 00000001
[   10.463991] bd84  00000000 00000003 00000000 ffffff9c 00000000 f5203000 ffffffc0 001a06fc
[   10.463996] bda4  ffffffc0 00020000 00000000 fc44b0a0 ffffffc0 fd913440 ffffffc0 24129add
[   10.464002] bdc4  00000006 f5203025 ffffffc0 00000000 00000000 f7172440 ffffffc0 f7524300
[   10.464003] 
[   10.464003] X28: 0xffffffc0ff802e40:
[   10.464011] 2e40  00726574 6fffbfff efb5ffef fffffff3 f9fbfbff 00fffa7f 00000001 00060006
[   10.464017] 2e60  00ad5c00 ffffffc0 fe091c00 ffffffc0 effffef7 ff4ffaff 00000000 00000000
[   10.464023] 2e80  ff802e80 ffffffc0 ff802e80 ffffffc0 ff802f60 ffffffc0 ff802dd0 ffffffc0
[   10.464028] 2ea0  ff802ea0 ffffffc0 ff802ea0 ffffffc0 00000000 00000000 fe092ba8 ffffffc0
[   10.464034] 2ec0  00000000 00000002 00000000 00000000 00000000 00000000 ff802ec0 ffffffc0
[   10.464039] 2ee0  00000000 00000001 ff802ef8 ffffffc0 fe092d00 ffffffc0 ffff002f dfffbbf7
[   10.464045] 2f00  bfbbfff6 ffdfffff faedbdfd feff7d8f ffffffff 00ff4ff7 000000f1 03440344
[   10.464051] 2f20  00000000 00000000 fe091c00 ffffffc0 ffffe1df ffffffdd 00000000 00000000
[   10.464052] 
[   10.464054] Process v4l_id (pid: 225, stack limit = 0xffffffc0f43b8058)
[   10.464056] Stack: (0xffffffc0f43bbb00 to 0xffffffc0f43bc000)
[   10.464060] bb00: fc5aa860 ffffffc0 fc5aa818 ffffffc0 006d29e4 ffffffc0 fc7ba018 ffffffc0
[   10.464063] bb20: 00000000 00000000 fc7ba018 ffffffc0 fc7ba440 ffffffc0 006d41e4 ffffffc0
[   10.464066] bb40: 006d6678 ffffffc0 006d6590 ffffffc0 fc7ba028 ffffffc0 f41ca5c0 ffffffc0
[   10.464068] bb60: fc7ba0b0 ffffffc0 00000000 00000000 001a64a8 ffffffc0 f41ca5d0 ffffffc0
[   10.464071] bb80: f41ca5c0 ffffffc0 006af574 ffffffc0 f7bc70c0 ffffffc0 f7524300 ffffffc0
[   10.464074] bba0: f41ca5c0 ffffffc0 001a6598 ffffffc0 f41ca5c0 ffffffc0 f7524300 ffffffc0
[   10.464076] bbc0: 00000000 00000000 f41cf9c0 ffffffc0 0019e570 ffffffc0 f7524300 ffffffc0
[   10.464079] bbe0: 0019e52c ffffffc0 0019e50c 00000000 f43bbd64 ffffffc0 00000000 00000000
[   10.464082] bc00: f43bbe80 ffffffc0 00020000 00000000 f43bbd68 ffffffc0 00000024 00000000
[   10.464084] bc20: 0019e69c ffffffc0 00000000 00000000 f43bbdb0 ffffffc0 001b0fe4 ffffffc0
[   10.464087] bc40: 00000000 00000000 f43bbdb0 ffffffc0 f41ca5c0 ffffffc0 f5203000 ffffffc0
[   10.464090] bc60: f43bbe80 ffffffc0 00000041 00000000 00000116 00000000 00000038 00000000
[   10.464092] bc80: 01140000 ffffffc0 f43b8000 ffffffc0 001b1258 ffffffc0 f43bbdb0 ffffffc0
[   10.464095] bca0: f41ca5c0 ffffffc0 00000000 00000000 00000000 ffffffc0 f43bbdb0 ffffffc0
[   10.464098] bcc0: fe092d00 ffffffc0 00000000 00000000 00000000 00000000 f7524300 ffffffc0
[   10.464100] bce0: f43bbe80 ffffffc0 00000001 00000000 ffffff9c 00000000 f5203000 ffffffc0
[   10.464103] bd00: 00000000 00000000 00000000 00000000 00000116 00000000 00000038 00000000
[   10.464106] bd20: 01140000 ffffffc0 f43b8000 ffffffc0 001b2320 ffffffc0 988bc000 0000007f
[   10.464108] bd40: f75a33c0 ffffffc0 00000010 00000000 f718b600 ffffffc0 001a3940 ffffffc0
[   10.464111] bd60: 988bc000 00000000 fc44b0a0 ffffffc0 fd913440 ffffffc0 00000000 00000000
[   10.464113] bd80: 00000001 00000000 00000003 00000000 ffffff9c 00000000 f5203000 ffffffc0
[   10.464116] bda0: 001a06fc ffffffc0 00020000 00000000 fc44b0a0 ffffffc0 fd913440 ffffffc0
[   10.464119] bdc0: 24129add 00000006 f5203025 ffffffc0 00000000 00000000 f7172440 ffffffc0
[   10.464121] bde0: f7524300 ffffffc0 00000101 00000004 00000000 00000000 f5203000 ffffffc0
[   10.464124] be00: 00000000 00000000 00000000 00000000 00000116 00000000 00000038 00000000
[   10.464127] be20: 01140000 ffffffc0 001c00b8 ffffffc0 001a06e0 ffffffc0 987a9a90 0000007f
[   10.464129] be40: 8d86e000 00000055 e2f82e48 0000007f ffffff9c ffffffff e2f83f38 0000007f
[   10.464132] be60: 00000000 00000000 00000000 00000000 001a0968 ffffffc0 00000015 00000000
[   10.464135] be80: 00020000 ffff0000 00000024 00000100 8d86e000 00000055 e2f82e48 0000007f
[   10.464137] bea0: ffffffff ffffffff 9888a2c8 0000007f 80000000 00000000 00000015 00000000
[   10.464140] bec0: 000853c8 ffffffc0 ffffffff ffffffff ffffff9c ffffffff e2f83f38 0000007f
[   10.464142] bee0: 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000000
[   10.464145] bf00: 51514e42 ff534244 00000000 00000000 00000038 00000000 ffffffff 0000ffff
[   10.464148] bf20: 00000000 00008000 00404000 00000001 00000000 00000000 00000000 00000000
[   10.464150] bf40: 00000000 00000000 988e8000 0000007f 8d86efa0 00000055 9888a250 0000007f
[   10.464153] bf60: 00000a03 00000000 8d86e000 00000055 e2f82e48 0000007f 00000003 00000000
[   10.464156] bf80: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[   10.464158] bfa0: 00000000 00000000 00000000 00000000 00000000 00000000 e2f82b60 0000007f
[   10.464161] bfc0: 8d8505e8 00000055 e2f82b60 0000007f 9888a2c8 0000007f 80000000 00000000
[   10.464163] bfe0: ffffff9c ffffffff 00000038 00000000 00000000 00000000 00000000 00000000
[   10.464164] Call trace:
[   10.464167] Code: a94263f7 f9401bfe a8c453f3 d65f03c0 (f9402c02) 
[   10.464401] ---[ end trace 3b1250a779519581 ]---
[   10.590540] cfg80211: Calling CRDA to update world regulatory domain
[   10.599586] sdhci-tegra sdhci-tegra.1: Card already in requested state
[   10.601590] sdhci-tegra sdhci-tegra.1: Card already in requested state
[   10.677273] dhd_module_init in
[   10.677945] Power-up adapter 'DHD generic adapter'
[   10.678421] wifi_platform_set_power = 1
[   10.881315] wifi_platform_bus_enumerate device present 1
[   10.916927] wifi_platform_bus_enumerate device present 0
[   10.988004] SDIO Vendor ID:02d0 and SDIO Device ID: 4354
[   11.008642] F1 signature read @0x18000000=0x17214354
[   11.014294] F1 signature OK, socitype:0x1 chip:0x4354 rev:0x1 pkg:0x2
[   11.015029] DHD: dongle ram size is set to 786432(orig 786432) at 0x180000
[   11.015097] wifi_platform_prealloc: failed to alloc static mem section 7
[   11.015103] wifi_platform_get_mac_addr
[   11.015362] of_get_mac_address: checking /chosen dtb node for mac address property nvidia,wifi-mac
[   11.015437] wifi_get_mac_addr: 00:04:4b:58:13:20
[   11.026466]  wl_setup_wiphy : Registering Vendor80211
[   11.026642] wl_create_event_handler(): thread:wl_event_handler:119 started
[   11.026718]  wl_event_handler : tsk Enter, tsk = 0xffffffc0f03219f0
[   11.037002] dhd_attach(): thread:dhd_watchdog_thread:11a started
[   11.048072] dhd_attach(): thread:dhd_dpc:11c started
[   11.069765] dhd_attach(): thread:dhd_rxf:11d started
[   11.069772] dhd_deferred_work_init: work queue initialized 
[   11.070067] Dongle Host Driver, version 1.201.82 (r)
[   11.070067] Compiled in drivers/net/wireless/bcmdhd on Dec  2 2016 at 14:29:07
[   11.070346] Register interface [wlan0]  MAC: 00:04:4b:58:13:20
...
...
...

And then i am getting Ubuntu Home screen successfully.
But not able to start video preview using gstreamer. even not getting any error log.

So whats the problem now? in dtsi file or driver file?

Could you try the V4L2-ctrl to verify it first.

v4l2-ctl -d /dev/videoX --set-fmt-video=width=1920,height=1080, --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=f.raw

I am not getting any log or error on terminal after running your command nor any f.raw file is created.
I not getting any log on UART also.
even i am not able to terminate this command using “Ctrl+C”.

Try below command to see if it can pass.
v4l2-compliance -d /dev/videoX

v4l2-compliance -d /dev/video0

Doesn’t give any output on terminal or UART. and the same as your previous command i am not able to terminate this command using “Ctrl+C”.
So i am clueless is there problem in dtsi file or sensor driver?
And Now i am using R24.2.1

Does this sensor output YUV format?

Yes. The Sensor output UYVY (4:2:2).

Did you modify any driver to support YUV422 sensor output? Current we are planing a YUV sensor reference board until that we can provide reference driver.

No i haven’t modify any driver file.
So MEDIA_CONTROLLER doesn’t support YUV in R24.2?

Negative, the tc358840 is an YUV sensor like driver. But this is a HDMI-IN to CSI mipi bridge. It’s a not good reference. BTW, could you past you sensor v4l2 driver here to check.

I forgot but i have changed “camera_common.c
I have added UYVY color format. So now i think YUV is missing in camera_common. Right? I need to modify for some other files for UYVY?

static const struct camera_common_colorfmt camera_common_color_fmts[] = {
	{
		V4L2_MBUS_FMT_SRGGB12_1X12,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB12,
	},
	{
		V4L2_MBUS_FMT_SRGGB10_1X10,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB10,
	},
	{
		V4L2_MBUS_FMT_SRGGB8_1X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_SRGGB8,
	},
	{
	    V4L2_MBUS_FMT_UYVY8_2X8,
		V4L2_COLORSPACE_SRGB,
		V4L2_PIX_FMT_UYVY,
	},
};

Below is my driver i have deleted some TC358748 I2C related functions.

#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/gpio.h>
#include <linux/module.h>

#include <linux/seq_file.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>

#include <media/camera_common.h>
#include "cam_dev/camera_gpio.h"

enum {
	TC358748_MODE_1920X1080,
};

static const int tc358748_60fps[] = {
	60,
};

static const struct camera_common_frmfmt tc358748_frmfmt[] = {
	{{1920, 1080},	tc358748_60fps,	1, 0,	TC358748_MODE_1920X1080},
};

#define TC358748_DEFAULT_DATAFMT	V4L2_MBUS_FMT_UYVY8_2X8

struct tc358748 {
	struct camera_common_power_rail	power;
	int				numctrls;
	struct v4l2_ctrl_handler	ctrl_handler;
	struct i2c_client		*i2c_client;
	struct v4l2_subdev		*subdev;
	struct media_pad		pad;

	int				reg_offset;

	s32				group_hold_prev;
	bool				group_hold_en;
	struct regmap			*regmap;
	struct camera_common_data	*s_data;
	struct camera_common_pdata	*pdata;
	struct v4l2_ctrl		*ctrls[];
};

static int tc358748_power_on(struct camera_common_data *s_data)
{
	int err = 0;
	struct tc358748 *priv = (struct tc358748 *)s_data->priv;
	struct camera_common_power_rail *pw = &priv->power;

	dev_dbg(&priv->i2c_client->dev, "%s: power on\n", __func__);

	if (priv->pdata && priv->pdata->power_on) {
		err = priv->pdata->power_on(pw);
		if (err)
			pr_err("%s failed.\n", __func__);
		else
			pw->state = SWITCH_ON;
		return err;
	}

	pw->state = SWITCH_ON;
	return 0;
}

static int tc358748_power_off(struct camera_common_data *s_data)
{
	int err = 0;
	struct tc358748 *priv = (struct tc358748 *)s_data->priv;
	struct camera_common_power_rail *pw = &priv->power;

	dev_dbg(&priv->i2c_client->dev, "%s: power off\n", __func__);

	if (priv->pdata && priv->pdata->power_on) {
		err = priv->pdata->power_off(pw);
		if (!err)
			pw->state = SWITCH_OFF;
		else
			pr_err("%s failed.\n", __func__);
		return err;
	}

	return 0;
}

static int tc358748_power_put(struct tc358748 *priv)
{
	return 0;
}

static int tc358748_power_get(struct tc358748 *priv)
{
	return 0;
}

static int tc358748_s_stream(struct v4l2_subdev *sd, int enable)
{
	return 0;
}

static int tc358748_g_input_status(struct v4l2_subdev *sd, u32 *status)
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);
	struct camera_common_data *s_data = to_camera_common_data(client);
	struct tc358748 *priv = (struct tc358748 *)s_data->priv;
	struct camera_common_power_rail *pw = &priv->power;

	*status = pw->state == SWITCH_ON;
	return 0;
}

static struct v4l2_subdev_video_ops tc358748_subdev_video_ops = {
	.s_stream	= tc358748_s_stream,
	.s_mbus_fmt	= camera_common_s_fmt,
	.g_mbus_fmt	= camera_common_g_fmt,
	.try_mbus_fmt	= camera_common_try_fmt,
	.enum_mbus_fmt	= camera_common_enum_fmt,
	.g_mbus_config	= camera_common_g_mbus_config,
	.g_input_status = tc358748_g_input_status,
	.enum_framesizes	= camera_common_enum_framesizes,
	.enum_frameintervals	= camera_common_enum_frameintervals,
};

static struct v4l2_subdev_core_ops tc358748_subdev_core_ops = {
	.s_power	= camera_common_s_power,
};

static int tc358748_get_fmt(struct v4l2_subdev *sd,
		struct v4l2_subdev_fh *fh,
		struct v4l2_subdev_format *format)
{
	return camera_common_g_fmt(sd, &format->format);
}

static int tc358748_set_fmt(struct v4l2_subdev *sd,
		struct v4l2_subdev_fh *fh,
	struct v4l2_subdev_format *format)
{
	int ret;

	if (format->which == V4L2_SUBDEV_FORMAT_TRY)
		ret = camera_common_try_fmt(sd, &format->format);
	else
		ret = camera_common_s_fmt(sd, &format->format);

	return ret;
}

static struct v4l2_subdev_pad_ops tc358748_subdev_pad_ops = {
	.enum_mbus_code = camera_common_enum_mbus_code,
	.set_fmt = tc358748_set_fmt,
	.get_fmt = tc358748_get_fmt,
};

static struct v4l2_subdev_ops tc358748_subdev_ops = {
	.core	= &tc358748_subdev_core_ops,
	.video	= &tc358748_subdev_video_ops,
	.pad	= &tc358748_subdev_pad_ops,
};

static struct of_device_id tc358748_of_match[] = {
	{ .compatible = "nvidia,tc358748", },
	{ },
};

static struct camera_common_sensor_ops tc358748_common_ops = {
	.power_on = tc358748_power_on,
	.power_off = tc358748_power_off,
};

MODULE_DEVICE_TABLE(of, tc358748_of_match);

static struct camera_common_pdata *tc358748_parse_dt(struct i2c_client *client)
{
	struct device_node *node = client->dev.of_node;
	struct camera_common_pdata *board_priv_pdata;
	const struct of_device_id *match;
	int err;

	if (!node)
		return NULL;

	match = of_match_device(tc358748_of_match, &client->dev);
	if (!match) {
		dev_err(&client->dev, "Failed to find matching dt id\n");
		return NULL;
	}

	board_priv_pdata = devm_kzalloc(&client->dev,
			   sizeof(*board_priv_pdata), GFP_KERNEL);
	if (!board_priv_pdata)
		return NULL;

	err = camera_common_parse_clocks(client, board_priv_pdata);
	if (err) {
		dev_err(&client->dev, "Failed to find clocks\n");
		goto error;
	}

	return board_priv_pdata;

error:
	devm_kfree(&client->dev, board_priv_pdata);
	return NULL;
}

static int tc358748_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
{
	struct i2c_client *client = v4l2_get_subdevdata(sd);

	dev_dbg(&client->dev, "%s:\n", __func__);
	return 0;
}

static const struct v4l2_subdev_internal_ops tc358748_subdev_internal_ops = {
	.open = tc358748_open,
};

static const struct media_entity_operations tc358748_media_ops = {
	.link_validate = v4l2_subdev_link_validate,
};

static int tc358748_probe(struct i2c_client *client,
			const struct i2c_device_id *id)
{
	struct camera_common_data *common_data;
	struct device_node *node = client->dev.of_node;
	struct tc358748 *priv;
	char debugfs_name[10];
	int err;
	int ReadData, i;

	pr_info("[TC358748]: [Ritesh] probing v4l2 sensor.\n");

	if (!IS_ENABLED(CONFIG_OF) || !node)
	{
		pr_info("[TC358748]: [Ritesh] IS_ENABLED(CONFIG_OF).\n");
		return -EINVAL;
	}

	common_data = devm_kzalloc(&client->dev,
			    sizeof(struct camera_common_data), GFP_KERNEL);
	if (!common_data)
	{
		pr_info("[TC358748]: [Ritesh] common_data.\n");
		return -ENOMEM;
	}

	priv = devm_kzalloc(&client->dev,sizeof(struct tc358748),GFP_KERNEL);

	priv->pdata = tc358748_parse_dt(client);
	if (!priv->pdata) {
		dev_err(&client->dev, "unable to get platform data\n");
		pr_info("[TC358748]: [Ritesh]unable to get platform data\n");
		return -EFAULT;
	}

	common_data->ops		= &tc358748_common_ops;
	common_data->i2c_client		= client;
	common_data->frmfmt		= tc358748_frmfmt;
	common_data->colorfmt		= camera_common_find_datafmt(TC358748_DEFAULT_DATAFMT);
	common_data->power		= &priv->power;
	common_data->priv		= (void *)priv;
	common_data->numfmts		= ARRAY_SIZE(tc358748_frmfmt);
	common_data->def_mode		= TC358748_MODE_1920X1080;
	common_data->def_width		= 1920;
	common_data->def_height		= 1080;
	common_data->fmt_width		= common_data->def_width;
	common_data->fmt_height		= common_data->def_height;
	common_data->def_clk_freq	= 24000000;

	priv->i2c_client = client;
	priv->s_data			= common_data;
	priv->subdev			= &common_data->subdev;
	priv->subdev->dev		= &client->dev;
	priv->s_data->dev		= &client->dev;

	err = tc358748_power_get(priv);
	if (err)
		return err;

	err = camera_common_parse_ports(client, common_data);
	if (err) {
		dev_err(&client->dev, "Failed to find port info\n");
		pr_info("[TC358748]: [Ritesh] Failed to find port info.\n");
		return err;
	}
	sprintf(debugfs_name, "tc358748_%c", common_data->csi_port + 'a');
	dev_dbg(&client->dev, "%s: name %s\n", __func__, debugfs_name);
	camera_common_create_debugfs(common_data, debugfs_name);

	v4l2_i2c_subdev_init(priv->subdev, client, &tc358748_subdev_ops);

	priv->subdev->internal_ops = &tc358748_subdev_internal_ops;
	priv->subdev->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
			       V4L2_SUBDEV_FL_HAS_EVENTS;

#if defined(CONFIG_MEDIA_CONTROLLER)
	priv->pad.flags = MEDIA_PAD_FL_SOURCE;
	priv->subdev->entity.type = MEDIA_ENT_T_V4L2_SUBDEV_SENSOR;
	priv->subdev->entity.ops = &tc358748_media_ops;
	err = media_entity_init(&priv->subdev->entity, 1, &priv->pad, 0);
	pr_info("[TC358748]: [Ritesh] Media Controller.\n");
	if (err < 0) {
		dev_err(&client->dev, "unable to init media entity\n");
		pr_info("[TC358748]: [Ritesh] unable to init media entity.\n");
		return err;
	}
#endif

	err = v4l2_async_register_subdev(priv->subdev);
	if (err)
	{
		pr_info("[TC358748]: [Ritesh] v4l2_async_register_subdev.\n");
		return err;
	}

	tc358748_write_table(client,
			tc358748_setting_YUV422_4lane_1080P_60fps_1920_1080,
			ARRAY_SIZE(tc358748_setting_YUV422_4lane_1080P_60fps_1920_1080));

	for(i = 0; i < 27; i++)
	{
		ReadData = i2c_rd(client, tc358748_setting_YUV422_4lane_1080P_60fps_1920_1080[i].addr, tc358748_setting_YUV422_4lane_1080P_60fps_1920_1080[i].len);
		pr_err("[TC] ADDR: 0x%04x, Write: 0x%08x, Read: 0x%08x \n", tc358748_setting_YUV422_4lane_1080P_60fps_1920_1080[i].addr, tc358748_setting_YUV422_4lane_1080P_60fps_1920_1080[i].val, ReadData);
	}

	dev_dbg(&client->dev, "Detected TC358748 sensor\n");


	return 0;
}

static int
tc358748_remove(struct i2c_client *client)
{
	struct camera_common_data *s_data = to_camera_common_data(client);
	struct tc358748 *priv = (struct tc358748 *)s_data->priv;

	v4l2_async_unregister_subdev(priv->subdev);
#if defined(CONFIG_MEDIA_CONTROLLER)
	media_entity_cleanup(&priv->subdev->entity);
#endif

	v4l2_ctrl_handler_free(&priv->ctrl_handler);
	tc358748_power_put(priv);
	camera_common_remove_debugfs(s_data);

	return 0;
}

static const struct i2c_device_id tc358748_id[] = {
	{ "tc358748", 0 },
	{ }
};

MODULE_DEVICE_TABLE(i2c, tc358748_id);

static struct i2c_driver tc358748_i2c_driver = {
	.driver = {
		.name = "tc358748",
		.owner = THIS_MODULE,
		.of_match_table = of_match_ptr(tc358748_of_match),
	},
	.probe = tc358748_probe,
	.remove = tc358748_remove,
	.id_table = tc358748_id,
};

module_i2c_driver(tc358748_i2c_driver);

MODULE_DESCRIPTION("Camera driver for Toshiba TC358748");
MODULE_AUTHOR("Ritesh Panchal <ritesh@syntronstech.com>");
MODULE_LICENSE("GPL v2");

As i am testing the driver i have only added support for single fixed format without any ioctl or v4l2_ctrl_handler.

Hello Shane,

Any update from your side?
Have you reviewed my driver?

Is there any chance i can develop UYVY sensor driver using MEDIA_CONTROLLER or any other framework in R24.2.1?

Hi RiteshPanchal

I can’t see any problem on your driver source. As I mention early we are going to build a YUV sensor reference board. Before that done I think you have to debug why the v4l2-ctl/v4l2-compile can’t working with you driver.

Hi ShaneCCC,

I’m going same problem. My camera driver work well in 24.1 kernel version. Now I want to use NVIDIA multimedia APIs so I want to update to 24.2.1 kernel version.

Everything is done. However this function in my camera driver

pw->dvdd = devm_regulator_get(&priv->i2c_client->dev, "vdig");

work well in 24.1 but now it cause issue as below

isx017_v4l2 6-0010: Dev node doesn't have vdig supply props

.
Even though I see “vdig” has been defined in “tegra210-jetson-e-pmic-p2530-0930-e03.dtsi” file as

max77620_ldo0: ldo0 {
					regulator-name = "avdd-sys";
					regulator-min-microvolt = <1200000>;
					regulator-max-microvolt = <1200000>;
					regulator-always-on;
					regulator-boot-on;
					maxim,fps-source = <FPS_SRC_NONE>;
					consumers {
						c0 {
							regulator-consumer-supply = "vddio_hsic";
							regulator-consumer-device = "tegra-ehci.1";
						};
						c1 {
							regulator-consumer-supply = "vddio_hsic";
							regulator-consumer-device = "tegra-ehci.2";
						};
						c2 {
							regulator-consumer-supply = "vdig";
						};
						c3 {
							regulator-consumer-supply = "isx017_reg2";
						};
					};
				};

I need fix this soon because this is so urgent. Please give me some advices.
Thanks