您尚未登录。

#1 全志 SOC » V3S, Mainline Kernel 5.10, OV2640 (lichee pi gen 2) » 2022-01-19 17:04:47

jelly
回复: 0

Hello Friends,

Using Mainline kernel 5.10, 5.15, and 5.16, I can successfully use FSWebcam or OPENCV to stream images from both OV2640 and OV5640. I believe my device tree is correct.

Despite this, I have a problem:

> media-ctl --print-topology
Media controller API version 5.16.0

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial          
bus info        platform:1cb4000.camera
hw revision     0x0
driver version  5.16.0

Device topology
- entity 1: sun6i-csi (1 pad, 1 link)
            type Node subtype V4L flags 0
	pad0: Sink
		<- "ov5640 0-003c":0 [ENABLED,IMMUTABLE]

- entity 5: ov5640 0-003c (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
	pad0: Source
		-> "sun6i-csi":0 [ENABLED,IMMUTABLE]




> v4l2-ctl --all
Unable to detect what device /dev/video0 is, exiting.

I always receive this message:
Unable to detect what device /dev/video0 is, exiting.

I cannot change video format, fps, resolution, etc on OOV2640 and OV5640 but I can save images, read from openCV, etc. For example, OV2640 forces 800x600 at 30fps.

Any ideas? I thought the mainline drivers were fully functional.

Thank you!

Dmesg Output & OV2640 DTS:

[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: LimelightMicro
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000040000000-0x0000000043ffffff]
[    0.000000]   HighMem  empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x0000000043ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x0000000043ffffff]
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: Using PSCI v0.1 Function IDs from DT
[    0.000000] percpu: Embedded 11 pages/cpu s15308 r8192 d21556 u45056
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16256
[    0.000000] Kernel command line: console=ttyS0,115200 panic=5 console=tty0 rootwait root=/dev/mmcblk0p2 earlyprintk rw
[    0.000000] Unknown kernel command line parameters "earlyprintk", will be passed to user space.
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 51468K/65536K available (8192K kernel code, 826K rwdata, 2060K rodata, 1024K init, 235K bss, 14068K reserved, 0K cma-reserved, 0K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] random: get_random_bytes called from start_kernel+0x490/0x628 with crng_init=0
[    0.000000] arch_timer: cp15 timer(s) running at 24.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x588fe9dc0, max_idle_ns: 440795202592 ns
[    0.000002] sched_clock: 56 bits at 24MHz, resolution 41ns, wraps every 4398046511097ns
[    0.000020] Switching to timer-based delay loop, resolution 41ns
[    0.000253] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 79635851949 ns
[    0.000577] Console: colour dummy device 80x30
[    0.000988] printk: console [tty0] enabled
[    0.001059] Calibrating delay loop (skipped), value calculated using timer frequency.. 48.00 BogoMIPS (lpj=240000)
[    0.001101] pid_max: default: 32768 minimum: 301
[    0.001244] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.001288] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.002201] CPU: Testing write buffer coherency: ok
[    0.002650] /cpus/cpu@0 missing clock-frequency property
[    0.002733] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.003557] Setting up static identity map for 0x40100000 - 0x40100060
[    0.003845] rcu: Hierarchical SRCU implementation.
[    0.004433] smp: Bringing up secondary CPUs ...
[    0.004489] smp: Brought up 1 node, 1 CPU
[    0.004516] SMP: Total of 1 processors activated (48.00 BogoMIPS).
[    0.004535] CPU: All CPU(s) started in HYP mode.
[    0.004549] CPU: Virtualization extensions available.
[    0.005254] devtmpfs: initialized
[    0.009519] VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
[    0.009981] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.010050] futex hash table entries: 256 (order: 2, 16384 bytes, linear)
[    0.010276] pinctrl core: initialized pinctrl subsystem
[    0.011654] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.012266] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.013492] thermal_sys: Registered thermal governor 'step_wise'
[    0.013865] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.013943] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.032109] SCSI subsystem initialized
[    0.032911] usbcore: registered new interface driver usbfs
[    0.033028] usbcore: registered new interface driver hub
[    0.033119] usbcore: registered new device driver usb
[    0.033241] mc: Linux media interface: v0.10
[    0.033294] videodev: Linux video capture interface: v2.00
[    0.033437] pps_core: LinuxPPS API ver. 1 registered
[    0.033461] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.033500] PTP clock support registered
[    0.034179] Advanced Linux Sound Architecture Driver Initialized.
[    0.035652] clocksource: Switched to clocksource arch_sys_counter
[    0.046465] NET: Registered PF_INET protocol family
[    0.046743] IP idents hash table entries: 2048 (order: 2, 16384 bytes, linear)
[    0.047329] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.047420] TCP established hash table entries: 1024 (order: 0, 4096 bytes, linear)
[    0.047474] TCP bind hash table entries: 1024 (order: 1, 8192 bytes, linear)
[    0.047513] TCP: Hash tables configured (established 1024 bind 1024)
[    0.047677] UDP hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.047757] UDP-Lite hash table entries: 256 (order: 1, 8192 bytes, linear)
[    0.048034] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.049070] RPC: Registered named UNIX socket transport module.
[    0.049145] RPC: Registered udp transport module.
[    0.049162] RPC: Registered tcp transport module.
[    0.049176] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.051192] workingset: timestamp_bits=30 max_order=14 bucket_order=0
[    0.058298] NFS: Registering the id_resolver key type
[    0.058409] Key type id_resolver registered
[    0.058430] Key type id_legacy registered
[    0.058753] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 246)
[    0.058802] io scheduler mq-deadline registered
[    0.058821] io scheduler kyber registered
[    0.063628] sun8i-v3s-pinctrl 1c20800.pinctrl: initialized sunXi PIO driver
[    0.128123] Serial: 8250/16550 driver, 8 ports, IRQ sharing disabled
[    0.130680] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pb not found, using dummy regulator
[    0.131992] printk: console [ttyS0] disabled
[    0.152362] 1c28000.serial: ttyS0 at MMIO 0x1c28000 (irq = 42, base_baud = 1500000) is a U6_16550A
[    0.774295] printk: console [ttyS0] enabled
[    0.783814] libphy: Fixed MDIO Bus: probed
[    0.789035] CAN device driver interface
[    0.793356] dwmac-sun8i 1c30000.ethernet: IRQ eth_wake_irq not found
[    0.799829] dwmac-sun8i 1c30000.ethernet: IRQ eth_lpi not found
[    0.805890] dwmac-sun8i 1c30000.ethernet: No regulator found
[    0.811677] dwmac-sun8i 1c30000.ethernet: PTP uses main clock
[    0.817930] dwmac-sun8i 1c30000.ethernet: No HW DMA feature register supported
[    0.825202] dwmac-sun8i 1c30000.ethernet: RX Checksum Offload Engine supported
[    0.832511] dwmac-sun8i 1c30000.ethernet: COE Type 2
[    0.837513] dwmac-sun8i 1c30000.ethernet: TX Checksum insertion supported
[    0.844311] dwmac-sun8i 1c30000.ethernet: Normal descriptors
[    0.849989] dwmac-sun8i 1c30000.ethernet: Chain mode enabled
[    0.855679] dwmac-sun8i 1c30000.ethernet: device MAC address 76:c2:21:89:5c:5f
[    0.863561] libphy: stmmac: probed
[    0.868315] dwmac-sun8i 1c30000.ethernet: Found internal PHY node
[    0.874987] libphy: mdio_mux: probed
[    0.878742] dwmac-sun8i 1c30000.ethernet: Switch mux to internal PHY
[    0.885153] dwmac-sun8i 1c30000.ethernet: Powering internal PHY
[    0.892999] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.899702] ehci-platform: EHCI generic platform driver
[    0.905113] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.911455] ohci-platform: OHCI generic platform driver
[    0.917777] input: 1c22800.lradc as /devices/platform/soc/1c22800.lradc/input/input0
[    0.927617] sun6i-rtc 1c20400.rtc: registered as rtc0
[    0.932763] sun6i-rtc 1c20400.rtc: setting system clock to 1970-01-01T00:00:04 UTC (4)
[    0.940826] sun6i-rtc 1c20400.rtc: RTC enabled
[    0.945502] i2c_dev: i2c /dev entries driver
[    0.950199] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pe not found, using dummy regulator
[    0.960176] i2c 0-0030: Fixing up cyclic dependency with 1cb4000.camera
[    0.969916] ov2640 0-0030: ov2640 Product ID 26:42 Manufacturer ID 7f:a2
[    0.976781] i2c i2c-0: OV2640 Probed
[    0.984332] sunxi-wdt 1c20ca0.watchdog: Watchdog enabled (timeout=16 sec, nowayout=0)
[    0.993397] sun4i-ss 1c15000.crypto: Die ID 7
[    0.999102] usbcore: registered new interface driver usbhid
[    1.004723] usbhid: USB HID core driver
[    1.009473] sun8i-v3s-pinctrl 1c20800.pinctrl: supply vcc-pf not found, using dummy regulator
[    1.022486] NET: Registered PF_INET6 protocol family
[    1.029393] Segment Routing with IPv6
[    1.033231] In-situ OAM (IOAM) with IPv6
[    1.037375] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    1.044171] NET: Registered PF_PACKET protocol family
[    1.049423] can: controller area network core
[    1.053916] NET: Registered PF_CAN protocol family
[    1.058797] can: raw protocol
[    1.061788] can: broadcast manager protocol
[    1.066018] can: netlink gateway - max_hops=1
[    1.070681] Key type dns_resolver registered
[    1.075164] Registering SWP/SWPB emulation handler
[    1.090600] ALSA device list:
[    1.093687]   No soundcards found.
[    1.097431] sunxi-mmc 1c0f000.mmc: initialized, max. request size: 16384 KB
[    1.104885] Waiting for root device /dev/mmcblk0p2...
[    1.144021] mmc0: host does not support reading read-only switch, assuming write-enable
[    1.155185] mmc0: new high speed SDHC card at address aaaa
[    1.162061] mmcblk0: mmc0:aaaa SL16G 14.8 GiB 
[    1.173679]  mmcblk0: p1 p2
[    1.213322] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null). Quota mode: disabled.
[    1.223726] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    1.233852] devtmpfs: mounted
[    1.238397] Freeing unused kernel image (initmem) memory: 1024K
[    1.244581] Run /sbin/init as init process
[    1.391819] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null). Quota mode: disabled.
[    1.638056] random: dd: uninitialized urandom read (512 bytes read)
[   16.483123] random: fast init done




# media-ctl --print-topology
Media controller API version 5.16.0

Media device information
------------------------
driver          sun6i-csi
model           Allwinner Video Capture Device
serial          
bus info        platform:1cb4000.camera
hw revision     0x0
driver version  5.16.0

Device topology
- entity 1: sun6i-csi (1 pad, 1 link)
            type Node subtype V4L flags 0
	pad0: Sink
		<- "ov2640 0-0030":0 [ENABLED,IMMUTABLE]

- entity 5: ov2640 0-0030 (1 pad, 1 link)
            type V4L2 subdev subtype Sensor flags 0
	pad0: Source
		-> "sun6i-csi":0 [ENABLED,IMMUTABLE]

# v4l2-ctl --all
Unable to detect what device /dev/video0 is, exiting.

dts:

&mmc1 {
	broken-cd;
	bus-width = <4>;
	vmmc-supply = <&reg_vcc3v3>;
	status = "disabled";
}; 

&csi1 {
	status = "okay";
    pinctrl-names = "default";
    pinctrl-0 = <&csi1_clk &csi1_8bit>;

	port{
	
			csi1_ep: endpoint {
				remote-endpoint = <&ov2640_0>;
				hsync-active = <0>;
				vsync-active = <0>;
				bus-width = <10>;
				pclk-sample = <1>;
				};
		};
};
&i2c1 {
    	pinctrl-0 = <&i2c1_pins>;
		pinctrl-names = "default";
		//clock-frequency = <400000>;
		status = "okay";
			
	ov2640: camera@30 {
		compatible = "ovti,ov2640";
		reg = <0x30>;
		pinctrl-names = "default";
		pinctrl-0 = <&csi1_mclk>;
		clocks = <&ccu CLK_CSI1_MCLK>;
		clock-names = "xvclk";
		assigned-clocks = <&ccu CLK_CSI1_MCLK>;
		assigned-clock-rates = <24000000>;
		
		port {
			ov2640_0: endpoint {
				remote-endpoint = <&csi1_ep>;
				bus-width = <10>;
			};
		};
	};
};
&i2c0{
	 status = "disabled";
};

/*
&csi1 {
	pinctrl-names = "default";
	pinctrl-0 = <&csi1_ov5640>;
	status = "okay";

	port {
		#address-cells = <1>;
		#size-cells = <0>;

		csi1_ep: endpoint {
			remote-endpoint = <&ov5640_ep>;
			bus-width = <8>;
			hsync-active = <1>; // Active high
			vsync-active = <0>; // Active low
			data-active = <1>;  // Active high
			pclk-sample = <1>;  // Rising
		};
	};
};

&i2c1 {
	pinctrl-names = "default";
	pinctrl-0 = <&i2c1_pe_pins>;
	status = "okay";

	ov5640: camera@3c {
		compatible = "ovti,ov5640";
		reg = <0x3c>;
		pinctrl-names = "default";
		pinctrl-0 = <&csi1_mclk>;
		clocks = <&ccu CLK_CSI1_MCLK>;
		clock-names = "xclk"; //might need to be xvclk

		//AVDD-supply = <&reg_ldo3>;
		//DOVDD-supply = <&reg_ldo3>;
		//DVDD-supply = <&reg_ldo4>;
		reset-gpios = <&pio 4 23 GPIO_ACTIVE_LOW>; // PE23 
		powerdown-gpios = <&pio 4 24 GPIO_ACTIVE_HIGH>; // PE24 

		port {
			ov5640_ep: endpoint {
				remote-endpoint = <&csi1_ep>;
				bus-width = <8>;
				hsync-active = <1>; //Active high 
				vsync-active = <0>; //Active low 
				data-active = <1>;  //Active high 
				pclk-sample = <1>;  //Rising 
			};
		};
	};
};
*/
/*
&ohci0 {
	staus = "okay";
};
&ehci0 {
	status = "okay";
};
*/
&usb_otg {
	dr_mode = "otg";
	status = "disabled";
};

&usbphy {
	pinctrl-0 = <&usb0_id_detect_pin>;
	usb0_id_det-gpio = <&pio 5 6 GPIO_ACTIVE_HIGH>;
	status = "disabled";
};
&pio {
	csi1_8bit: csi1-8bit@0 {
	       pins 	 = "PE6","PE7","PE8","PE9","PE10","PE11","PE12","PE13","PE14","PE15";
	       bias-disable;
	       function = "csi";
    	};

	csi1_clk: csi1-clk@0 {
	        pins = "PE0","PE2","PE3";
	        bias-disable;
	        function = "csi";
    	};
	
	csi1_ov5640: csi1-ov5640@0{
			pins = "PE0", "PE2", "PE3", "PE8", "PE9",
				       "PE10", "PE11", "PE12", "PE13", "PE14",
				       "PE15";
			function = "csi";

		};
    	
    csi1_mclk: csi1-mclk@0 {
	        pins = "PE1";
	        bias-disable;
	        function = "csi";
    	};

	i2c1_pins: i2c1 {
		pins = "PE21", "PE22";
		function = "i2c1";
	};
	
	uart0_pins: uart0@0 {
	 	pins = "PB8", "PB9";
		function = "uart0";
	};

	usb0_id_detect_pin: usbid@0 {
	 	pins = "PF6";
		function = "gpio_in";
	};
	
	
};

mainline kernel modification

CONFIG_MEDIA_SUPPORT=y
CONFIG_V4L_PLATFORM_DRIVERS=y
CONFIG_MEDIA_CAMERA_SUPPORT=y

#CONFIG_VIDEO_MUX is not set
#CONFIG_VIDEO_MEM2MEM_DEINTERLACE is not set
#CONFIG_MULTIPLEXER s not set

# CONFIG_VIDEO_SUN4I_CSI is not set
CONFIG_VIDEO_SUN6I_CSI=y
CONFIG_VIDEO_OV2640=y
CONFIG_VIDEO_OV5640=y
CONFIG_VIDEO_OV772X=y

页脚

工信部备案:粤ICP备20025096号 Powered by FluxBB

感谢为中文互联网持续输出优质内容的各位老铁们。 QQ: 516333132, 微信(wechat): whycan_cn (哇酷网/挖坑网/填坑网) service@whycan.cn