Skip to contentSkip to conversation

Capture image from imx219 sensor on i.MX8MM

RFC In review Frieder Schrempf 6 participants 30 messages Feb 6, 2023 – Jul 13, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Thanks for any help!
Frieder

~# media-ctl -d /dev/media0 -p
Media controller API version 6.1.8

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  6.1.8

Device topology
- entity 1: csi (2 pads, 1 link)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

        pad1: Source
                [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

maintainer
#1 lore raw

Hi Frieder,

Quoted 12 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

Quoted 5 lines

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Quoted 27 lines

~# media-ctl -d /dev/media0 -p
Media controller API version 6.1.8

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  6.1.8

Device topology
- entity 1: csi (2 pads, 1 link)

            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
        pad0: Sink
                [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
        pad1: Source
                [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

Signature · 3 lines
Regards,

Laurent Pinchart
#2 lore raw

Hi Laurent,

Quoted 18 lines · Laurent Pinchart

Hi Frieder,

Quoted 15 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Quoted 6 lines
Quoted 2 lines

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Yes, the imx219_probe() works just fine and returns with code 0. I also see v4l2_async_register_subdev_sensor() and the underlying code being called.

So I really don't understand why I'm missing the sensor subdev. Any ideas how to continue debugging?

Thanks!
Frieder

#3 lore raw

Hi Frieder

Quoted 29 lines · Frieder Schrempf

Hi Laurent,

Quoted 18 lines · Laurent Pinchart

Hi Frieder,

Quoted 15 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Quoted 6 lines
Quoted 2 lines

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Quoted 6 lines

Yes, the imx219_probe() works just fine and returns with code 0. I also see v4l2_async_register_subdev_sensor() and the underlying code being called.

So I really don't understand why I'm missing the sensor subdev. Any ideas how to continue debugging?

It'd be worth checking /sys/kernel/debug/v4l2-async/pending_async_subdevices to see if the v4l2_async framework is waiting on any (sub)devices.

Dave

maintainer
#4 lore raw
In reply to Frieder Schrempf
Quoted 24 lines · Frieder Schrempf
Quoted 16 lines · Laurent Pinchart
Quoted 15 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Quoted 6 lines
Quoted 2 lines

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Quoted 6 lines

Yes, the imx219_probe() works just fine and returns with code 0. I also see v4l2_async_register_subdev_sensor() and the underlying code being called.

So I really don't understand why I'm missing the sensor subdev. Any ideas how to continue debugging?

The issue seems to be with v4l2-async then. There's a debugfs file that lists the missing v4l2-async subdevs (I don't recall the path by heard), that can give useful information. Enabling the debug messages from v4l2-async.c may helpt too.

Signature · 3 lines
Regards,

Laurent Pinchart
#5 lore raw
Quoted 29 lines · Laurent Pinchart
Quoted 28 lines · Frieder Schrempf
Quoted 16 lines · Laurent Pinchart
Quoted 15 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Quoted 6 lines
Quoted 2 lines

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Yes, the imx219_probe() works just fine and returns with code 0. I also see v4l2_async_register_subdev_sensor() and the underlying code being called.

Quoted 7 lines
Quoted 2 lines

So I really don't understand why I'm missing the sensor subdev. Any ideas how to continue debugging?

The issue seems to be with v4l2-async then. There's a debugfs file that lists the missing v4l2-async subdevs (I don't recall the path by heard), that can give useful information. Enabling the debug messages from v4l2-async.c may helpt too.

+Cc: Dave, Sakari, Javier (thanks for your help and debugging hints via mail/IRC)

/sys/kernel/debug/v4l2-async/pending_async_subdevices gives me:

csis-32e30000.mipi-csi:
[fwnode] dev=1-0010,
node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint imx219 1-0010:
imx-media:

So it looks like the async subdev for the imx219 sensor is still pending.

I have spent quite a few hours trying to understand how the code is supposed to work, but I'm afraid it's too much for my brain at the moment ;)

I have attached a debug patch [1] adding printks in v4l2-async.c and the boot log [2] with all the output below. Hopefully someone can have a look and make something out of that. Feel free to let me know via email or IRC if I can provide any further information.

Thanks!

[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.2.0-rc7-ktn (oe-user@oe-host) (aarch64-ktn-linux-gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT Tue Feb  7 08:25:13 UTC 2023
[    0.000000] Machine model: Kontron BL i.MX8MM (N801X S)
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x13f7c2b00-0x13f7c4fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x00000000ffffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000013fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] cma: Reserved 1024 MiB at 0x00000000bbe00000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 20 pages/cpu s42024 r8192 d31704 u81920
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] CPU features: detected: ARM erratum 845719
[    0.000000] alternatives: applying boot alternatives
[    0.000000] Fallback order for Node 0: 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1032192
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: root=/dev/nfs ip=192.168.1.11:192.168.1.10:::kontron-mx8mm:eth0:any nfsroot=192.168.1.10:/nfsroot,v3,tcp cma=1G rootwait
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: area num 4.
[    0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[    0.000000] Memory: 2976216K/4194304K available (13568K kernel code, 1222K rwdata, 4840K rodata, 2368K init, 545K bss, 169512K reserved, 1048576K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 128 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv3: GICv3 features: 16 PPIs
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000038880000
[    0.000000] ITS: No ITS available, not enabling LPIs
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] arch_timer: cp15 timer(s) running at 8.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[    0.000000] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[    0.000353] Console: colour dummy device 80x25
[    0.000363] printk: console [tty0] enabled
[    0.000858] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=32000)
[    0.000881] pid_max: default: 32768 minimum: 301
[    0.000940] LSM: initializing lsm=capability,integrity
[    0.001043] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.001072] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.002504] rcu: Hierarchical SRCU implementation.
[    0.002526] rcu: 	Max phase no-delay instances is 1000.
[    0.003357] EFI services will not be available.
[    0.003583] smp: Bringing up secondary CPUs ...
[    0.004061] Detected VIPT I-cache on CPU1
[    0.004136] GICv3: CPU1: found redistributor 1 region 0:0x00000000388a0000
[    0.004178] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.004649] Detected VIPT I-cache on CPU2
[    0.004712] GICv3: CPU2: found redistributor 2 region 0:0x00000000388c0000
[    0.004736] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.005177] Detected VIPT I-cache on CPU3
[    0.005238] GICv3: CPU3: found redistributor 3 region 0:0x00000000388e0000
[    0.005259] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.005316] smp: Brought up 1 node, 4 CPUs
[    0.005403] SMP: Total of 4 processors activated.
[    0.005414] CPU features: detected: 32-bit EL0 Support
[    0.005424] CPU features: detected: 32-bit EL1 Support
[    0.005440] CPU features: detected: CRC32 instructions
[    0.005506] CPU: All CPU(s) started at EL2
[    0.005524] alternatives: applying system-wide alternatives
[    0.007432] devtmpfs: initialized
[    0.013542] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.013594] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.043563] pinctrl core: initialized pinctrl subsystem
[    0.045549] DMI not present or invalid.
[    0.046159] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.047073] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[    0.047276] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.047441] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.047501] audit: initializing netlink subsys (disabled)
[    0.047623] audit: type=2000 audit(0.044:1): state=initialized audit_enabled=0 res=1
[    0.048000] thermal_sys: Registered thermal governor 'step_wise'
[    0.048033] cpuidle: using governor menu
[    0.048199] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.048287] ASID allocator initialised with 65536 entries
[    0.048955] Serial: AMBA PL011 UART driver
[    0.055254] imx8mm-pinctrl 30330000.pinctrl: initialized IMX pinctrl driver
[    0.066886] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
[    0.066917] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page
[    0.066932] HugeTLB: registered 32.0 MiB page size, pre-allocated 0 pages
[    0.066944] HugeTLB: 508 KiB vmemmap can be freed for a 32.0 MiB page
[    0.066958] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[    0.066972] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[    0.066987] HugeTLB: registered 64.0 KiB page size, pre-allocated 0 pages
[    0.067000] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
[    0.068588] ACPI: Interpreter disabled.
[    0.069385] iommu: Default domain type: Translated
[    0.069405] iommu: DMA domain TLB invalidation policy: strict mode
[    0.069649] SCSI subsystem initialized
[    0.069932] usbcore: registered new interface driver usbfs
[    0.069969] usbcore: registered new interface driver hub
[    0.070007] usbcore: registered new device driver usb
[    0.070643] mc: Linux media interface: v0.10
[    0.070690] videodev: Linux video capture interface: v2.00
[    0.070754] pps_core: LinuxPPS API ver. 1 registered
[    0.070765] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.070791] PTP clock support registered
[    0.070920] EDAC MC: Ver: 3.0.0
[    0.071496] FPGA manager framework
[    0.071573] Advanced Linux Sound Architecture Driver Initialized.
[    0.072353] vgaarb: loaded
[    0.072652] clocksource: Switched to clocksource arch_sys_counter
[    0.072831] VFS: Disk quotas dquot_6.6.0
[    0.072867] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.073038] pnp: PnP ACPI: disabled
[    0.079203] NET: Registered PF_INET protocol family
[    0.079432] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.082247] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
[    0.082335] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.082361] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.082592] TCP bind hash table entries: 32768 (order: 8, 1048576 bytes, linear)
[    0.083553] TCP: Hash tables configured (established 32768 bind 32768)
[    0.083705] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.083806] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.084021] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.084433] RPC: Registered named UNIX socket transport module.
[    0.084451] RPC: Registered udp transport module.
[    0.084462] RPC: Registered tcp transport module.
[    0.084474] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.084493] PCI: CLS 0 bytes, default 64
[    0.085132] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.085846] kvm [1]: IPA Size Limit: 40 bits
[    0.087132] kvm [1]: GICv3: no GICV resource entry
[    0.087146] kvm [1]: disabling GICv2 emulation
[    0.087164] kvm [1]: GIC system register CPU interface enabled
[    0.087258] kvm [1]: vgic interrupt IRQ9
[    0.087360] kvm [1]: Hyp mode initialized successfully
[    0.088486] Initialise system trusted keyrings
[    0.088687] workingset: timestamp_bits=42 max_order=20 bucket_order=0
[    0.088988] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.089207] NFS: Registering the id_resolver key type
[    0.089262] Key type id_resolver registered
[    0.089274] Key type id_legacy registered
[    0.089303] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.089317] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.089466] 9p: Installing v9fs 9p2000 file system support
[    0.124669] Key type asymmetric registered
[    0.124683] Asymmetric key parser 'x509' registered
[    0.124735] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    0.124753] io scheduler mq-deadline registered
[    0.124764] io scheduler kyber registered
[    0.128006] EINJ: ACPI disabled.
[    0.136799] SoC: i.MX8MM revision 1.0
[    0.141870] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.143967] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 16, base_baud = 1500000) is a IMX
[    0.144488] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 17, base_baud = 1500000) is a IMX
[    0.144522] imx-uart 30880000.serial: Console IMX rounded baud rate from 114286 to 114300
[    0.144571] printk: console [ttymxc2] enabled
[    1.126108] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 18, base_baud = 1500000) is a IMX
[    1.144256] loop: module loaded
[    1.150889] tun: Universal TUN/TAP device driver, 1.6
[    1.156153] CAN device driver interface
[    1.160606] thunder_xcv, ver 1.0
[    1.163879] thunder_bgx, ver 1.0
[    1.167145] nicpf, ver 1.0
[    1.170627] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    1.177871] hns3: Copyright (c) 2017 Huawei Corporation.
[    1.183231] hclge is initializing
[    1.186586] e1000e: Intel(R) PRO/1000 Network Driver
[    1.191565] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.197519] igb: Intel(R) Gigabit Ethernet Network Driver
[    1.202932] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.208538] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    1.214821] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    1.220881] sky2: driver version 1.30
[    1.225044] VFIO - User Level meta-driver version: 0.3
[    1.231934] usbcore: registered new interface driver usb-storage
[    1.240846] snvs_rtc 30370000.snvs:snvs-rtc-lp: registered as rtc0
[    1.247080] snvs_rtc 30370000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01T00:00:00 UTC (0)
[    1.256271] i2c_dev: i2c /dev entries driver
[    1.261317] imx7-csi 32e20000.csi: Registered csi capture as /dev/video0
[    1.268186] __v4l2_async_nf_register:610
[    1.272130]   imx-media:
[    1.274676] v4l2_async_nf_try_all_subdevs:447
[    1.279048]   imx-media:
[    1.281593] v4l2_async_nf_try_all_subdevs:454
[    1.285965] imx7_csi_notify_complete:2178
[    1.291153] i.mx8mm_thermal 30260000.tmu: No OCOTP nvmem reference found, SoC-specific calibration not loaded. Please update your DT.
[    1.303945] ghes_edac: GHES probing device list is empty
[    1.304979] sdhci: Secure Digital Host Controller Interface driver
[    1.316524] sdhci: Copyright(c) Pierre Ossman
[    1.321082] Synopsys Designware Multimedia Card Interface Driver
[    1.327600] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.334945] ledtrig-cpu: registered to indicate activity on CPUs
[    1.341184] SMCCC: SOC_ID: ARCH_SOC_ID not implemented, skipping ....
[    1.348164] caam 30900000.crypto: device ID = 0x0a16040100000000 (Era 9)
[    1.354896] caam 30900000.crypto: job rings = 2, qi = 0
[    1.362676] caam algorithms registered in /proc/crypto
[    1.368007] caam 30900000.crypto: caam pkc algorithms registered in /proc/crypto
[    1.375430] caam 30900000.crypto: registering rng-caam
[    1.382285] caam 30900000.crypto: rng crypto API alg registered prng-caam
[    1.390544] usbcore: registered new interface driver usbhid
[    1.396148] usbhid: USB HID core driver
[    1.404433] NET: Registered PF_PACKET protocol family
[    1.409533] can: controller area network core
[    1.413943] NET: Registered PF_CAN protocol family
[    1.418750] can: raw protocol
[    1.421735] can: broadcast manager protocol
[    1.425933] can: netlink gateway - max_hops=1
[    1.430383] 9pnet: Installing 9P2000 support
[    1.434710] Key type dns_resolver registered
[    1.448009] Loading compiled-in X.509 certificates
[    1.471560] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.481811] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.492337] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.501638] random: crng init done
[    1.502850] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.515529] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.526485] usb_phy_generic usbphynop1: dummy supplies not allowed for exclusive requests
[    1.534906] usb_phy_generic usbphynop2: dummy supplies not allowed for exclusive requests
[    1.563552] nxp-pca9450 0-0025: pca9450a probed.
[    1.568286] i2c i2c-0: IMX I2C adapter registered
[    1.574158] i2c 1-0010: Fixing up cyclic dependency with 32e30000.mipi-csi
[    1.581331] imx219 1-0010: supply VANA not found, using dummy regulator
[    1.588140] imx219 1-0010: supply VDDL not found, using dummy regulator
[    1.604714] v4l2_async_register_subdev_sensor:1296
[    1.609531] v4l2_async_register_subdev_sensor:1311
[    1.614336] __v4l2_async_nf_register:610
[    1.618273]   imx219 1-0010:
[    1.621166] v4l2_async_nf_try_all_subdevs:447
[    1.625534]   imx219 1-0010:
[    1.628423]   imx-media:
[    1.630968] v4l2_async_register_subdev_sensor:1317
[    1.635773] v4l2_async_register_subdev:858
[    1.639880]   imx219 1-0010:
[    1.642771]   imx-media:
[    1.645317] v4l2_async_register_subdev:866
[    1.649426]   imx219 1-0010:
[    1.652309] v4l2_async_register_subdev:866
[    1.656422]   imx-media:
[    1.658964] v4l2_async_register_subdev:872
[    1.663075] v4l2_async_find_match:231
[    1.666749] v4l2_async_register_subdev_sensor:1323
[    1.671693] i2c i2c-1: IMX I2C adapter registered
[    1.678216] rtc-rv8803 3-0032: An alarm maybe have been missed.
[    1.689415] rtc-rv8803 3-0032: registered as rtc1
[    1.694258] i2c i2c-3: IMX I2C adapter registered
[    1.701296] imx6q-pcie 33800000.pcie: host bridge /soc@0/pcie@33800000 ranges:
[    1.708603] imx6q-pcie 33800000.pcie:       IO 0x001ff80000..0x001ff8ffff -> 0x0000000000
[    1.710257] etnaviv etnaviv: bound 38000000.gpu (ops gpu_ops)
[    1.716820] imx6q-pcie 33800000.pcie:      MEM 0x0018000000..0x001fefffff -> 0x0018000000
[    1.723602] etnaviv etnaviv: bound 38008000.gpu (ops gpu_ops)
[    1.736530] etnaviv-gpu 38000000.gpu: model: GC600, revision: 4653
[    1.742802] etnaviv-gpu 38000000.gpu: Need to move linear window on MC1.0, disabling TS
[    1.750837] etnaviv-gpu 38008000.gpu: model: GC520, revision: 5341
[    1.758304] [drm] Initialized etnaviv 1.3.0 20151214 for etnaviv on minor 0
[    1.768636] pps pps0: new PPS source ptp0
[    1.839197] fec 30be0000.ethernet eth0: registered PHC device 0
[    1.945171] imx6q-pcie 33800000.pcie: iATU: unroll T, 4 ob, 4 ib, align 64K, limit 4G
[    1.960957] ci_hdrc ci_hdrc.1: EHCI Host Controller
[    1.965895] ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 1
[    1.989045] ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
[    1.995595] hub 1-0:1.0: USB hub found
[    1.999385] hub 1-0:1.0: 1 port detected
[    2.005195] pwm-beeper pwm-beeper: supply amp not found, using dummy regulator
[    2.012684] input: pwm-beeper as /devices/platform/pwm-beeper/input/input0
[    2.021068] __v4l2_async_nf_register:610
[    2.025028]   csis-32e30000.mipi-csi:
[    2.028714] __v4l2_async_nf_register:619
[    2.032653]  [fwnode] dev=1-0010, node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint
[    2.041386] __v4l2_async_nf_register:625
[    2.045323] v4l2_async_nf_try_all_subdevs:447
[    2.049694]   csis-32e30000.mipi-csi:
[    2.053375]   imx219 1-0010:
[    2.053677] imx6q-pcie 33800000.pcie: PCIe Gen.1 x1 link up
[    2.056256]   imx-media:
[    2.056259] v4l2_async_register_subdev:858
[    2.068481]   csis-32e30000.mipi-csi:
[    2.072157]  [fwnode] dev=1-0010, node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint
[    2.080888]   imx219 1-0010:
[    2.083772]   imx-media:
[    2.086319] v4l2_async_register_subdev:866
[    2.090426]   csis-32e30000.mipi-csi:
[    2.094099] v4l2_async_register_subdev:866
[    2.098210]   imx219 1-0010:
[    2.101103] v4l2_async_register_subdev:866
[    2.105211]   imx-media:
[    2.107752] v4l2_async_register_subdev:872
[    2.111860] v4l2_async_find_match:231
[    2.115586] imx-mipi-csis 32e30000.mipi-csi: lanes: 2, freq: 333000000
[    2.122481] imx-cpufreq-dt imx-cpufreq-dt: cpu speed grade 2 mkt segment 2 supported-hw 0x4 0x4
[    2.135942] sdhci-esdhc-imx 30b50000.mmc: Got CD GPIO
[    2.156722] imx6q-pcie 33800000.pcie: PCIe Gen.2 x1 link up
[    2.161522] mmc0: SDHCI controller on 30b40000.mmc [30b40000.mmc] using ADMA
[    2.162324] imx6q-pcie 33800000.pcie: Link up, Gen2
[    2.173599] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA
[    2.174245] imx6q-pcie 33800000.pcie: PCIe Gen.2 x1 link up
[    2.187152] imx6q-pcie 33800000.pcie: PCI host bridge to bus 0000:00
[    2.193541] pci_bus 0000:00: root bus resource [bus 00-ff]
[    2.199042] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    2.205236] pci_bus 0000:00: root bus resource [mem 0x18000000-0x1fefffff]
[    2.212149] pci 0000:00:00.0: [16c3:abcd] type 01 class 0x060400
[    2.218177] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x000fffff]
[    2.224462] pci 0000:00:00.0: reg 0x38: [mem 0x00000000-0x0000ffff pref]
[    2.228210] mmc1: host does not support reading read-only switch, assuming write-enable
[    2.231208] pci 0000:00:00.0: supports D1
[    2.243214] pci 0000:00:00.0: PME# supported from D0 D1 D3hot D3cold
[    2.251105] pci 0000:01:00.0: [1d79:2263] type 00 class 0x010802
[    2.257216] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00003fff 64bit]
[    2.262659] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[    2.264520] pci 0000:01:00.0: 4.000 Gb/s available PCIe bandwidth, limited by 5.0 GT/s PCIe x1 link at 0000:00:00.0 (capable of 15.752 Gb/s with 8.0 GT/s PCIe x2 link)
[    2.264662] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[    2.271786] mmcblk0: mmc0:0001 032GB2 29.1 GiB
[    2.285638] pci 0000:00:00.0: BAR 0: assigned [mem 0x18000000-0x180fffff]
[    2.295739] mmcblk0boot0: mmc0:0001 032GB2 4.00 MiB
[    2.296312] pci 0000:00:00.0: BAR 14: assigned [mem 0x18100000-0x181fffff]
[    2.304956] mmcblk0boot1: mmc0:0001 032GB2 4.00 MiB
[    2.308058] pci 0000:00:00.0: BAR 6: assigned [mem 0x18200000-0x1820ffff pref]
[    2.316622] mmcblk0rpmb: mmc0:0001 032GB2 4.00 MiB, chardev (241:0)
[    2.319904] pci 0000:01:00.0: BAR 0: assigned [mem 0x18100000-0x18103fff 64bit]
[    2.340843] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    2.346091] pci 0000:00:00.0:   bridge window [mem 0x18100000-0x181fffff]
[    2.350724] mmc1: new ultra high speed SDR104 SDHC card at address aaaa
[    2.353190] pcieport 0000:00:00.0: PME: Signaling with IRQ 215
[    2.360527] mmcblk1: mmc1:aaaa SL16G 14.8 GiB
[    2.375373]  mmcblk1: p1 p2
[    2.428063] hub 1-1:1.0: USB hub found
[    2.432315] hub 1-1:1.0: 5 ports detected
[    2.512067] Microsemi VSC8531 30be0000.ethernet-1:00: attached PHY driver (mii_bus:phy_addr=30be0000.ethernet-1:00, irq=POLL)
[    2.729028] usb 1-1.1: new high-speed USB device number 3 using ci_hdrc
[    5.602118] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[    5.625029] IP-Config: Guessing netmask 255.255.255.0
[    5.630108] IP-Config: Complete:
[    5.633354]      device=eth0, hwaddr=70:82:0e:13:9a:32, ipaddr=192.168.1.11, mask=255.255.255.0, gw=255.255.255.255
[    5.643814]      host=kontron-mx8mm, domain=, nis-domain=(none)
[    5.649751]      bootserver=192.168.1.10, rootserver=192.168.1.10, rootpath=
[    5.651593] ALSA device list:
[    5.661655]   No soundcards found.
[    5.688286] VFS: Mounted root (nfs filesystem) readonly on device 0:20.
[    5.696353] devtmpfs: mounted
[    5.699869] Freeing unused kernel memory: 2368K
[    5.708679] Run /sbin/init as init process
drivers/media/platform/nxp/imx-mipi-csis.c +2 -0
index 905072871ed2..eb35657bb7a2 100644
@@ -1275,6 +1275,8 @@ static int mipi_csis_notify_bound(struct v4l2_async_notifier *notifier,
 	struct mipi_csis_device *csis = mipi_notifier_to_csis_state(notifier);
 	struct media_pad *sink = &csis->sd.entity.pads[CSIS_PAD_SINK];
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	return v4l2_create_fwnode_links_to_pad(sd, sink, 0);
 }
 
drivers/media/platform/nxp/imx7-media-csi.c +4 -0
index 886374d3a6ff..6fc7bafdd436 100644
@@ -2165,6 +2165,8 @@ static int imx7_csi_notify_bound(struct v4l2_async_notifier *notifier,
 
 	csi->src_sd = sd;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	return v4l2_create_fwnode_links_to_pad(sd, sink, MEDIA_LNK_FL_ENABLED |
 					       MEDIA_LNK_FL_IMMUTABLE);
 }
@@ -2173,6 +2175,8 @@ static int imx7_csi_notify_complete(struct v4l2_async_notifier *notifier)
 {
 	struct imx7_csi *csi = imx7_csi_notifier_to_dev(notifier);
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	return v4l2_device_register_subdev_nodes(&csi->v4l2_dev);
 }
 
drivers/media/v4l2-core/v4l2-async.c +99 -11

233 lines not on this page · raw message

drivers/media/v4l2-core/v4l2-fwnode.c +8 -0
index 3d9533c1b202..45ed62b16327 100644
@@ -1293,6 +1293,8 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
 	struct v4l2_async_notifier *notifier;
 	int ret;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	if (WARN_ON(!sd->dev))
 		return -ENODEV;
 
@@ -1306,14 +1308,20 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
 	if (ret < 0)
 		goto out_cleanup;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	ret = v4l2_async_subdev_nf_register(sd, notifier);
 	if (ret < 0)
 		goto out_cleanup;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	ret = v4l2_async_register_subdev(sd);
 	if (ret < 0)
 		goto out_unregister;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	sd->subdev_notifier = notifier;
 
 	return 0;
maintainer
#6 lore raw

RFC 1/1 v4l: async: Add some debug prints

Just add some debug prints for V4L2 async sub-device matching process. These might come useful in figuring out why things don't work as expected.

---
Frieder,

Can you try this? It prints what is being matched with what. Perhaps this could be merged in a bit more refined form if it proves useful.

Not tested in any way.

 drivers/media/v4l2-core/v4l2-async.c | 41 ++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-async.c +36 -5
index 2f1b718a9189..6c13a9488415 100644
@@ -86,13 +86,18 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	bool sd_fwnode_is_ep;
 	struct device *dev;
 
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);
+
 	/*
 	 * Both the subdev and the async subdev can provide either an endpoint
 	 * fwnode or a device fwnode. Start with the simple case of direct
 	 * fwnode matching.
 	 */
-	if (sd_fwnode == asd->match.fwnode)
+	if (sd_fwnode == asd->match.fwnode) {
+		dev_dbg(sd->dev, "true\n");
 		return true;
+	}
 
 	/*
 	 * Otherwise, check if the sd fwnode and the asd fwnode refer to an
@@ -105,8 +110,12 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	sd_fwnode_is_ep = fwnode_graph_is_endpoint(sd_fwnode);
 	asd_fwnode_is_ep = fwnode_graph_is_endpoint(asd->match.fwnode);
 
-	if (sd_fwnode_is_ep == asd_fwnode_is_ep)
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);
+	if (sd_fwnode_is_ep == asd_fwnode_is_ep) {
+		dev_dbg(sd->dev, "unmatching node types (false)\n");
 		return false;
+	}
 
 	/*
 	 * The sd and asd fwnodes are of different types. Get the device fwnode
@@ -120,10 +129,15 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 		other_fwnode = sd_fwnode;
 	}
 
+	dev_dbg(sd->dev, "async fwnode (compat) match %pfw vs. %pfw\n",
+		dev_fwnode, other_fwnode);
+
 	fwnode_handle_put(dev_fwnode);
 
-	if (dev_fwnode != other_fwnode)
+	if (dev_fwnode != other_fwnode) {
+		dev_dbg(sd->dev, "false\n");
 		return false;
+	}
 
 	/*
 	 * We have a heterogeneous match. Retrieve the struct device of the side
@@ -143,6 +157,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 			   dev->driver->name);
 	}
 
+	dev_dbg(sd->dev, "true\n");
+
 	return true;
 }
 
@@ -255,7 +271,10 @@ v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier)
 			v4l2_async_find_subdev_notifier(sd);
 
 		if (subdev_notifier &&
-		    !v4l2_async_nf_can_complete(subdev_notifier))
+		    !v4l2_async_nf_can_complete(subdev_notifier)) {
+			if (subdev_notifier->sd)
+				deb_dbg(subdev_notifier->sd->dev,
+					"cannot complete\n");
 			return false;
 	}
 
@@ -273,18 +292,27 @@ v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier)
 	if (!list_empty(&notifier->waiting))
 		return 0;
 
+	if (notifier->sd)
+		deb_dbg(notifier->sd->dev, "trying to complete\n");
+
 	/* Check the entire notifier tree; find the root notifier first. */
 	while (notifier->parent)
 		notifier = notifier->parent;
 
 	/* This is root if it has v4l2_dev. */
-	if (!notifier->v4l2_dev)
+	if (!notifier->v4l2_dev) {
+		if (notifier->sd)
+			deb_dbg(notifier->sd->dev,
+				"V4L2 device not available\n");
 		return 0;
+	}
 
 	/* Is everything ready? */
 	if (!v4l2_async_nf_can_complete(notifier))
 		return 0;
 
+	deb_dbg(notifier->sd->dev, "complete\n");
+
 	return v4l2_async_nf_call_complete(notifier);
 }
 
@@ -386,6 +414,9 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier)
 			continue;
 
 		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
+		deb_dbg(sd->dev, "bound to %s's notifier (ret %d)\n",
+			notifier->sd ? dev_name(notifier->sd->dev) : "no-dev",
+			ret);
 		if (ret < 0)
 			return ret;
 
Signature · 1 line
2.30.2
maintainer
#7 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

Hi Sakari,

Thank you for the patch.

Quoted 20 lines · Sakari Ailus

Just add some debug prints for V4L2 async sub-device matching process. These might come useful in figuring out why things don't work as expected.

---
Frieder,

Can you try this? It prints what is being matched with what. Perhaps this could be merged in a bit more refined form if it proves useful.

Not tested in any way.

 drivers/media/v4l2-core/v4l2-async.c | 41 ++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-async.c +0 -0
index 2f1b718a9189..6c13a9488415 100644

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 90

Quoted 5 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
@@ -86,13 +86,18 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	bool sd_fwnode_is_ep;
 	struct device *dev;
 
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);

Let's be more explicit:

	dev_dbg(sd->dev, "async fwnode match: need %pfw, trying %pfw\n",
		sd_fwnode, asd->match.fwnode);

(feel free to adjust, as long as we differentiate what we're looking for from what we're testing)

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 98

Quoted 9 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
+
 	/*
 	 * Both the subdev and the async subdev can provide either an endpoint
 	 * fwnode or a device fwnode. Start with the simple case of direct
 	 * fwnode matching.
 	 */
-	if (sd_fwnode == asd->match.fwnode)
+	if (sd_fwnode == asd->match.fwnode) {
+		dev_dbg(sd->dev, "true\n");
		dev_dbg(sd->dev, "direct match found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 114

Quoted 12 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
 		return true;
+	}
 
 	/*
 	 * Otherwise, check if the sd fwnode and the asd fwnode refer to an
@@ -105,8 +110,12 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	sd_fwnode_is_ep = fwnode_graph_is_endpoint(sd_fwnode);
 	asd_fwnode_is_ep = fwnode_graph_is_endpoint(asd->match.fwnode);
 
-	if (sd_fwnode_is_ep == asd_fwnode_is_ep)
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);

You've already printed this above, no need to repeat it.

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 116

Quoted 2 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
+	if (sd_fwnode_is_ep == asd_fwnode_is_ep) {
+		dev_dbg(sd->dev, "unmatching node types (false)\n");
		dev_dbg(sd->dev, "direct match not found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 133

Quoted 11 lines
drivers/media/v4l2-core/v4l2-async.c +3 -0
 		return false;
+	}
 
 	/*
 	 * The sd and asd fwnodes are of different types. Get the device fwnode
@@ -120,10 +129,15 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 		other_fwnode = sd_fwnode;
 	}
 
+	dev_dbg(sd->dev, "async fwnode (compat) match %pfw vs. %pfw\n",
+		dev_fwnode, other_fwnode);

Same comment as above regarding "vs." not telling which is which.

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 138

Quoted 6 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
+
 	fwnode_handle_put(dev_fwnode);
 
-	if (dev_fwnode != other_fwnode)
+	if (dev_fwnode != other_fwnode) {
+		dev_dbg(sd->dev, "false\n");
		dev_dbg(sd->dev, "compat match not found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 160

Quoted 10 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
 		return false;
+	}
 
 	/*
 	 * We have a heterogeneous match. Retrieve the struct device of the side
@@ -143,6 +157,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 			   dev->driver->name);
 	}
 
+	dev_dbg(sd->dev, "true\n");
	dev_dbg(sd->dev, "compat match found\n");

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier) · line 277

Quoted 13 lines
drivers/media/v4l2-core/v4l2-async.c +5 -1
+
 	return true;
 }
 
@@ -255,7 +271,10 @@ v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier)
 			v4l2_async_find_subdev_notifier(sd);
 
 		if (subdev_notifier &&
-		    !v4l2_async_nf_can_complete(subdev_notifier))
+		    !v4l2_async_nf_can_complete(subdev_notifier)) {
+			if (subdev_notifier->sd)
+				deb_dbg(subdev_notifier->sd->dev,
+					"cannot complete\n");

I'd add a reference to v4l2-async, either directly in the string, or with a "%s: ", __func__ prefix. Otherwise the message will be easy to miss. Same in other messages. Maybe a "v4l2-async: " prefix for all debug messages ?

Quoted 18 lines
drivers/media/v4l2-core/v4l2-async.c +5 -1
 			return false;
 	}
 
@@ -273,18 +292,27 @@ v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier)
 	if (!list_empty(&notifier->waiting))
 		return 0;
 
+	if (notifier->sd)
+		deb_dbg(notifier->sd->dev, "trying to complete\n");
+
 	/* Check the entire notifier tree; find the root notifier first. */
 	while (notifier->parent)
 		notifier = notifier->parent;
 
 	/* This is root if it has v4l2_dev. */
-	if (!notifier->v4l2_dev)
+	if (!notifier->v4l2_dev) {
+		if (notifier->sd)

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier) · line 314

Quoted 10 lines
drivers/media/v4l2-core/v4l2-async.c +4 -0
+			deb_dbg(notifier->sd->dev,
+				"V4L2 device not available\n");
 		return 0;
+	}
 
 	/* Is everything ready? */
 	if (!v4l2_async_nf_can_complete(notifier))
 		return 0;
 
+	deb_dbg(notifier->sd->dev, "complete\n");

You guard against notifier->sd being NULL above, but not here. At least one of the two is wrong.

Quoted 14 lines
drivers/media/v4l2-core/v4l2-async.c +4 -0
+
 	return v4l2_async_nf_call_complete(notifier);
 }
 
@@ -386,6 +414,9 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier)
 			continue;
 
 		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
+		deb_dbg(sd->dev, "bound to %s's notifier (ret %d)\n",
+			notifier->sd ? dev_name(notifier->sd->dev) : "no-dev",
+			ret);
 		if (ret < 0)
 			return ret;
 
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#8 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

Hi Laurent,

Quoted 1 line · Laurent Pinchart

Thank you for the patch.

Thanks for the review!

This was indeed hastily written, to help debugging a particular issue. But I hope it'll be useful for other purposes, too. V4L2 async is about to get more complicated soon.

Quoted 30 lines · Sakari Ailus
Quoted 20 lines

Just add some debug prints for V4L2 async sub-device matching process. These might come useful in figuring out why things don't work as expected.

---
Frieder,

Can you try this? It prints what is being matched with what. Perhaps this could be merged in a bit more refined form if it proves useful.

Not tested in any way.

 drivers/media/v4l2-core/v4l2-async.c | 41 ++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-async.c +0 -0
index 2f1b718a9189..6c13a9488415 100644

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 90

Quoted 5 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
@@ -86,13 +86,18 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	bool sd_fwnode_is_ep;
 	struct device *dev;
 
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);

Let's be more explicit:

Quoted 5 lines
	dev_dbg(sd->dev, "async fwnode match: need %pfw, trying %pfw\n",
		sd_fwnode, asd->match.fwnode);

(feel free to adjust, as long as we differentiate what we're looking for from what we're testing)

Yes.

Quoted 76 lines

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 98

Quoted 10 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
+
 	/*
 	 * Both the subdev and the async subdev can provide either an endpoint
 	 * fwnode or a device fwnode. Start with the simple case of direct
 	 * fwnode matching.
 	 */
-	if (sd_fwnode == asd->match.fwnode)
+	if (sd_fwnode == asd->match.fwnode) {
+		dev_dbg(sd->dev, "true\n");
		dev_dbg(sd->dev, "direct match found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 114

Quoted 12 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
 		return true;
+	}
 
 	/*
 	 * Otherwise, check if the sd fwnode and the asd fwnode refer to an
@@ -105,8 +110,12 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	sd_fwnode_is_ep = fwnode_graph_is_endpoint(sd_fwnode);
 	asd_fwnode_is_ep = fwnode_graph_is_endpoint(asd->match.fwnode);
 
-	if (sd_fwnode_is_ep == asd_fwnode_is_ep)
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);

You've already printed this above, no need to repeat it.

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 116

Quoted 2 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
+	if (sd_fwnode_is_ep == asd_fwnode_is_ep) {
+		dev_dbg(sd->dev, "unmatching node types (false)\n");
		dev_dbg(sd->dev, "direct match not found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 133

Quoted 11 lines
drivers/media/v4l2-core/v4l2-async.c +3 -0
 		return false;
+	}
 
 	/*
 	 * The sd and asd fwnodes are of different types. Get the device fwnode
@@ -120,10 +129,15 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 		other_fwnode = sd_fwnode;
 	}
 
+	dev_dbg(sd->dev, "async fwnode (compat) match %pfw vs. %pfw\n",
+		dev_fwnode, other_fwnode);

Same comment as above regarding "vs." not telling which is which.

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 138

Quoted 6 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
+
 	fwnode_handle_put(dev_fwnode);
 
-	if (dev_fwnode != other_fwnode)
+	if (dev_fwnode != other_fwnode) {
+		dev_dbg(sd->dev, "false\n");
		dev_dbg(sd->dev, "compat match not found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 160

Quoted 10 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
 		return false;
+	}
 
 	/*
 	 * We have a heterogeneous match. Retrieve the struct device of the side
@@ -143,6 +157,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 			   dev->driver->name);
 	}
 
+	dev_dbg(sd->dev, "true\n");
	dev_dbg(sd->dev, "compat match found\n");
Quoted 7 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+
 	return true;
 }
 
@@ -255,7 +271,10 @@ v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier)
 			v4l2_async_find_subdev_notifier(sd);
 
Quoted 11 lines

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier) · line 277

Quoted 6 lines
drivers/media/v4l2-core/v4l2-async.c +4 -1
 		if (subdev_notifier &&
-		    !v4l2_async_nf_can_complete(subdev_notifier))
+		    !v4l2_async_nf_can_complete(subdev_notifier)) {
+			if (subdev_notifier->sd)
+				deb_dbg(subdev_notifier->sd->dev,
+					"cannot complete\n");

I'd add a reference to v4l2-async, either directly in the string, or with a "%s: ", __func__ prefix. Otherwise the message will be easy to miss. Same in other messages. Maybe a "v4l2-async: " prefix for all debug messages ?

How about just "async: " for all of these? It's shorther, still unique, and these lines will be long.

Quoted 24 lines
Quoted 24 lines
drivers/media/v4l2-core/v4l2-async.c +8 -1
 			return false;
 	}
 
@@ -273,18 +292,27 @@ v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier)
 	if (!list_empty(&notifier->waiting))
 		return 0;
 
+	if (notifier->sd)
+		deb_dbg(notifier->sd->dev, "trying to complete\n");
+
 	/* Check the entire notifier tree; find the root notifier first. */
 	while (notifier->parent)
 		notifier = notifier->parent;
 
 	/* This is root if it has v4l2_dev. */
-	if (!notifier->v4l2_dev)
+	if (!notifier->v4l2_dev) {
+		if (notifier->sd)
+			deb_dbg(notifier->sd->dev,
+				"V4L2 device not available\n");
 		return 0;
+	}
 
Quoted 8 lines

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier) · line 314

Quoted 5 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
 	/* Is everything ready? */
 	if (!v4l2_async_nf_can_complete(notifier))
 		return 0;
 
+	deb_dbg(notifier->sd->dev, "complete\n");

You guard against notifier->sd being NULL above, but not here. At least one of the two is wrong.

I'll add a helper function to get the device safely.

Quoted 16 lines
Quoted 15 lines
drivers/media/v4l2-core/v4l2-async.c +4 -0
+
 	return v4l2_async_nf_call_complete(notifier);
 }
 
@@ -386,6 +414,9 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier)
 			continue;
 
 		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
+		deb_dbg(sd->dev, "bound to %s's notifier (ret %d)\n",
+			notifier->sd ? dev_name(notifier->sd->dev) : "no-dev",
+			ret);
 		if (ret < 0)
 			return ret;
 
Signature · 3 lines
Kind regards,

Sakari Ailus
maintainer
#9 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

Hi Sakari,

Quoted 8 lines · Sakari Ailus
Quoted 1 line · Laurent Pinchart

Thank you for the patch.

Thanks for the review!

This was indeed hastily written, to help debugging a particular issue. But I hope it'll be useful for other purposes, too. V4L2 async is about to get more complicated soon.

Could it get simpler instead ? :-) Maybe one day v4l2-async may cross the threshold of how much pain I can bear, and I'll rewrite it...

Quoted 124 lines
Quoted 29 lines · Sakari Ailus
Quoted 20 lines

Just add some debug prints for V4L2 async sub-device matching process. These might come useful in figuring out why things don't work as expected.

---
Frieder,

Can you try this? It prints what is being matched with what. Perhaps this could be merged in a bit more refined form if it proves useful.

Not tested in any way.

 drivers/media/v4l2-core/v4l2-async.c | 41 ++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-async.c +0 -0
index 2f1b718a9189..6c13a9488415 100644

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 90

Quoted 5 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
@@ -86,13 +86,18 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	bool sd_fwnode_is_ep;
 	struct device *dev;
 
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);

Let's be more explicit:

Quoted 5 lines
	dev_dbg(sd->dev, "async fwnode match: need %pfw, trying %pfw\n",
		sd_fwnode, asd->match.fwnode);

(feel free to adjust, as long as we differentiate what we're looking for from what we're testing)

Yes.

Quoted 75 lines

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 98

Quoted 9 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
+
 	/*
 	 * Both the subdev and the async subdev can provide either an endpoint
 	 * fwnode or a device fwnode. Start with the simple case of direct
 	 * fwnode matching.
 	 */
-	if (sd_fwnode == asd->match.fwnode)
+	if (sd_fwnode == asd->match.fwnode) {
+		dev_dbg(sd->dev, "true\n");
		dev_dbg(sd->dev, "direct match found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 114

Quoted 12 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
 		return true;
+	}
 
 	/*
 	 * Otherwise, check if the sd fwnode and the asd fwnode refer to an
@@ -105,8 +110,12 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	sd_fwnode_is_ep = fwnode_graph_is_endpoint(sd_fwnode);
 	asd_fwnode_is_ep = fwnode_graph_is_endpoint(asd->match.fwnode);
 
-	if (sd_fwnode_is_ep == asd_fwnode_is_ep)
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);

You've already printed this above, no need to repeat it.

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 116

Quoted 2 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
+	if (sd_fwnode_is_ep == asd_fwnode_is_ep) {
+		dev_dbg(sd->dev, "unmatching node types (false)\n");
		dev_dbg(sd->dev, "direct match not found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 133

Quoted 11 lines
drivers/media/v4l2-core/v4l2-async.c +3 -0
 		return false;
+	}
 
 	/*
 	 * The sd and asd fwnodes are of different types. Get the device fwnode
@@ -120,10 +129,15 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 		other_fwnode = sd_fwnode;
 	}
 
+	dev_dbg(sd->dev, "async fwnode (compat) match %pfw vs. %pfw\n",
+		dev_fwnode, other_fwnode);

Same comment as above regarding "vs." not telling which is which.

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 138

Quoted 6 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
+
 	fwnode_handle_put(dev_fwnode);
 
-	if (dev_fwnode != other_fwnode)
+	if (dev_fwnode != other_fwnode) {
+		dev_dbg(sd->dev, "false\n");
		dev_dbg(sd->dev, "compat match not found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 160

Quoted 10 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
 		return false;
+	}
 
 	/*
 	 * We have a heterogeneous match. Retrieve the struct device of the side
@@ -143,6 +157,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 			   dev->driver->name);
 	}
 
+	dev_dbg(sd->dev, "true\n");
	dev_dbg(sd->dev, "compat match found\n");
Quoted 7 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+
 	return true;
 }
 
@@ -255,7 +271,10 @@ v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier)
 			v4l2_async_find_subdev_notifier(sd);
 
Quoted 11 lines

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier) · line 277

Quoted 6 lines
drivers/media/v4l2-core/v4l2-async.c +4 -1
 		if (subdev_notifier &&
-		    !v4l2_async_nf_can_complete(subdev_notifier))
+		    !v4l2_async_nf_can_complete(subdev_notifier)) {
+			if (subdev_notifier->sd)
+				deb_dbg(subdev_notifier->sd->dev,
+					"cannot complete\n");

I'd add a reference to v4l2-async, either directly in the string, or with a "%s: ", __func__ prefix. Otherwise the message will be easy to miss. Same in other messages. Maybe a "v4l2-async: " prefix for all debug messages ?

Quoted 2 lines

How about just "async: " for all of these? It's shorther, still unique, and these lines will be long.

"async" is a bit vague, I think you should mention V4L2 too. If this ends up printing

3-0010 async: cannot complete

someone may wonder what it relates to. We're talking about debugging messages here, let's make sure they improve debugging as much as possible.

Quoted 48 lines
Quoted 23 lines
Quoted 23 lines
drivers/media/v4l2-core/v4l2-async.c +8 -1
 			return false;
 	}
 
@@ -273,18 +292,27 @@ v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier)
 	if (!list_empty(&notifier->waiting))
 		return 0;
 
+	if (notifier->sd)
+		deb_dbg(notifier->sd->dev, "trying to complete\n");
+
 	/* Check the entire notifier tree; find the root notifier first. */
 	while (notifier->parent)
 		notifier = notifier->parent;
 
 	/* This is root if it has v4l2_dev. */
-	if (!notifier->v4l2_dev)
+	if (!notifier->v4l2_dev) {
+		if (notifier->sd)
+			deb_dbg(notifier->sd->dev,
+				"V4L2 device not available\n");
 		return 0;
+	}
 
Quoted 8 lines

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier) · line 314

Quoted 5 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
 	/* Is everything ready? */
 	if (!v4l2_async_nf_can_complete(notifier))
 		return 0;
 
+	deb_dbg(notifier->sd->dev, "complete\n");

You guard against notifier->sd being NULL above, but not here. At least one of the two is wrong.

I'll add a helper function to get the device safely.

Quoted 14 lines
Quoted 14 lines
drivers/media/v4l2-core/v4l2-async.c +4 -0
+
 	return v4l2_async_nf_call_complete(notifier);
 }
 
@@ -386,6 +414,9 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier)
 			continue;
 
 		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
+		deb_dbg(sd->dev, "bound to %s's notifier (ret %d)\n",
+			notifier->sd ? dev_name(notifier->sd->dev) : "no-dev",
+			ret);
 		if (ret < 0)
 			return ret;
 
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#10 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

Hi Laurent,

Quoted 6 lines · Laurent Pinchart

Hi Sakari,

Quoted 3 lines · Sakari Ailus
Quoted 1 line · Laurent Pinchart

Thank you for the patch.

Quoted 8 lines
Quoted 5 lines

Thanks for the review!

This was indeed hastily written, to help debugging a particular issue. But I hope it'll be useful for other purposes, too. V4L2 async is about to get more complicated soon.

Could it get simpler instead ? :-) Maybe one day v4l2-async may cross the threshold of how much pain I can bear, and I'll rewrite it...

I wish it could, but often supporting complex needs is complicated. "Simplicated" is not even a proper word after all. Let's see.

Quoted 128 lines
Quoted 125 lines
Quoted 30 lines · Sakari Ailus
Quoted 20 lines

Just add some debug prints for V4L2 async sub-device matching process. These might come useful in figuring out why things don't work as expected.

---
Frieder,

Can you try this? It prints what is being matched with what. Perhaps this could be merged in a bit more refined form if it proves useful.

Not tested in any way.

 drivers/media/v4l2-core/v4l2-async.c | 41 ++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-async.c +0 -0
index 2f1b718a9189..6c13a9488415 100644

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 90

Quoted 5 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
@@ -86,13 +86,18 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	bool sd_fwnode_is_ep;
 	struct device *dev;
 
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);

Let's be more explicit:

Quoted 5 lines
	dev_dbg(sd->dev, "async fwnode match: need %pfw, trying %pfw\n",
		sd_fwnode, asd->match.fwnode);

(feel free to adjust, as long as we differentiate what we're looking for from what we're testing)

Yes.

Quoted 75 lines

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 98

Quoted 9 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
+
 	/*
 	 * Both the subdev and the async subdev can provide either an endpoint
 	 * fwnode or a device fwnode. Start with the simple case of direct
 	 * fwnode matching.
 	 */
-	if (sd_fwnode == asd->match.fwnode)
+	if (sd_fwnode == asd->match.fwnode) {
+		dev_dbg(sd->dev, "true\n");
		dev_dbg(sd->dev, "direct match found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 114

Quoted 12 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
 		return true;
+	}
 
 	/*
 	 * Otherwise, check if the sd fwnode and the asd fwnode refer to an
@@ -105,8 +110,12 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	sd_fwnode_is_ep = fwnode_graph_is_endpoint(sd_fwnode);
 	asd_fwnode_is_ep = fwnode_graph_is_endpoint(asd->match.fwnode);
 
-	if (sd_fwnode_is_ep == asd_fwnode_is_ep)
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);

You've already printed this above, no need to repeat it.

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 116

Quoted 2 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
+	if (sd_fwnode_is_ep == asd_fwnode_is_ep) {
+		dev_dbg(sd->dev, "unmatching node types (false)\n");
		dev_dbg(sd->dev, "direct match not found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 133

Quoted 11 lines
drivers/media/v4l2-core/v4l2-async.c +3 -0
 		return false;
+	}
 
 	/*
 	 * The sd and asd fwnodes are of different types. Get the device fwnode
@@ -120,10 +129,15 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 		other_fwnode = sd_fwnode;
 	}
 
+	dev_dbg(sd->dev, "async fwnode (compat) match %pfw vs. %pfw\n",
+		dev_fwnode, other_fwnode);

Same comment as above regarding "vs." not telling which is which.

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 138

Quoted 6 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
+
 	fwnode_handle_put(dev_fwnode);
 
-	if (dev_fwnode != other_fwnode)
+	if (dev_fwnode != other_fwnode) {
+		dev_dbg(sd->dev, "false\n");
		dev_dbg(sd->dev, "compat match not found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 160

Quoted 10 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
 		return false;
+	}
 
 	/*
 	 * We have a heterogeneous match. Retrieve the struct device of the side
@@ -143,6 +157,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 			   dev->driver->name);
 	}
 
+	dev_dbg(sd->dev, "true\n");
	dev_dbg(sd->dev, "compat match found\n");
Quoted 7 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+
 	return true;
 }
 
@@ -255,7 +271,10 @@ v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier)
 			v4l2_async_find_subdev_notifier(sd);
 
Quoted 11 lines

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier) · line 277

Quoted 6 lines
drivers/media/v4l2-core/v4l2-async.c +4 -1
 		if (subdev_notifier &&
-		    !v4l2_async_nf_can_complete(subdev_notifier))
+		    !v4l2_async_nf_can_complete(subdev_notifier)) {
+			if (subdev_notifier->sd)
+				deb_dbg(subdev_notifier->sd->dev,
+					"cannot complete\n");

I'd add a reference to v4l2-async, either directly in the string, or with a "%s: ", __func__ prefix. Otherwise the message will be easy to miss. Same in other messages. Maybe a "v4l2-async: " prefix for all debug messages ?

Quoted 2 lines

How about just "async: " for all of these? It's shorther, still unique, and these lines will be long.

Quoted 8 lines

"async" is a bit vague, I think you should mention V4L2 too. If this ends up printing

3-0010 async: cannot complete

someone may wonder what it relates to. We're talking about debugging messages here, let's make sure they improve debugging as much as possible.

These messages include the device name which already implies what it is about, so I'm frankly not concerned about this. Also these messages tend to occur in series. Having them shorter, instead, is a small plus. An example:

[    5.716093] dw9807 i2c-PRP0001:01: async: matching for notifier \_SB.PCI0.CIO2, sd \_SB.PCI0.I2C2.VCM0
[    5.716109] dw9807 i2c-PRP0001:01: async: fwnode match: need \_SB.PCI0.I2C2.VCM0, trying \_SB_.PCI0.I2C2.CAM0/port@0/endpoint@0
[    5.716123] dw9807 i2c-PRP0001:01: async: fwnode compat match, need \_SB_.PCI0.I2C2.CAM0, trying \_SB.PCI0.I2C2.VCM0
[    5.716131] dw9807 i2c-PRP0001:01: async: compat match not found
[   30.333138] imx258 i2c-SONY258A:00: async: matching for notifier \_SB.PCI0.CIO2, sd \_SB.PCI0.I2C2.CAM0
[   30.333154] imx258 i2c-SONY258A:00: async: fwnode match: need \_SB.PCI0.I2C2.CAM0, trying \_SB_.PCI0.I2C2.CAM0/port@0/endpoint@0
[   30.333168] imx258 i2c-SONY258A:00: async: fwnode compat match, need \_SB_.PCI0.I2C2.CAM0, trying \_SB.PCI0.I2C2.CAM0
[   30.333175] imx258 i2c-SONY258A:00: async: compat match not found
[   30.333178] imx258 i2c-SONY258A:00: async: trying secondary fwnode match
[   30.333181] imx258 i2c-SONY258A:00: async: fwnode match: need \_SB_.PCI0.I2C2.CAM0, trying \_SB_.PCI0.I2C2.CAM0/port@0/endpoint@0
[   30.333189] imx258 i2c-SONY258A:00: async: fwnode compat match, need \_SB_.PCI0.I2C2.CAM0, trying \_SB_.PCI0.I2C2.CAM0
[   30.333196] imx258 i2c-SONY258A:00: async: compat match found
[   30.333214] dw9807 i2c-PRP0001:01: async: matching for notifier \_SB.PCI0.I2C2.CAM0, sd \_SB.PCI0.I2C2.VCM0
[   30.333225] dw9807 i2c-PRP0001:01: async: fwnode match: need \_SB.PCI0.I2C2.VCM0, trying \_SB.PCI0.I2C2.VCM0
[   30.333235] dw9807 i2c-PRP0001:01: async: direct match found
[   30.333248] dw9807 i2c-PRP0001:01: async: bound to i2c-SONY258A:00's notifier (ret 0)
[   30.333252] ipu3-cio2 0000:00:14.3: async: complete
Quoted 49 lines
Quoted 49 lines
Quoted 24 lines
Quoted 24 lines
drivers/media/v4l2-core/v4l2-async.c +8 -1
 			return false;
 	}
 
@@ -273,18 +292,27 @@ v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier)
 	if (!list_empty(&notifier->waiting))
 		return 0;
 
+	if (notifier->sd)
+		deb_dbg(notifier->sd->dev, "trying to complete\n");
+
 	/* Check the entire notifier tree; find the root notifier first. */
 	while (notifier->parent)
 		notifier = notifier->parent;
 
 	/* This is root if it has v4l2_dev. */
-	if (!notifier->v4l2_dev)
+	if (!notifier->v4l2_dev) {
+		if (notifier->sd)
+			deb_dbg(notifier->sd->dev,
+				"V4L2 device not available\n");
 		return 0;
+	}
 
Quoted 8 lines

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier) · line 314

Quoted 5 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
 	/* Is everything ready? */
 	if (!v4l2_async_nf_can_complete(notifier))
 		return 0;
 
+	deb_dbg(notifier->sd->dev, "complete\n");

You guard against notifier->sd being NULL above, but not here. At least one of the two is wrong.

I'll add a helper function to get the device safely.

Quoted 14 lines
Quoted 14 lines
drivers/media/v4l2-core/v4l2-async.c +4 -0
+
 	return v4l2_async_nf_call_complete(notifier);
 }
 
@@ -386,6 +414,9 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier)
 			continue;
 
 		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
+		deb_dbg(sd->dev, "bound to %s's notifier (ret %d)\n",
+			notifier->sd ? dev_name(notifier->sd->dev) : "no-dev",
+			ret);
 		if (ret < 0)
 			return ret;
 
Signature · 3 lines
Regards,

Sakari Ailus
maintainer
#11 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

Hi Sakari,

Quoted 11 lines · Sakari Ailus
Quoted 10 lines · Laurent Pinchart
Quoted 8 lines · Sakari Ailus
Quoted 1 line · Laurent Pinchart

Thank you for the patch.

Thanks for the review!

This was indeed hastily written, to help debugging a particular issue. But I hope it'll be useful for other purposes, too. V4L2 async is about to get more complicated soon.

Quoted 5 lines
Quoted 2 lines

Could it get simpler instead ? :-) Maybe one day v4l2-async may cross the threshold of how much pain I can bear, and I'll rewrite it...

I wish it could, but often supporting complex needs is complicated. "Simplicated" is not even a proper word after all. Let's see.

Don't try to lure me into rewriting it sooner than later ;-)

Quoted 149 lines
Quoted 127 lines
Quoted 124 lines
Quoted 29 lines · Sakari Ailus
Quoted 20 lines

Just add some debug prints for V4L2 async sub-device matching process. These might come useful in figuring out why things don't work as expected.

---
Frieder,

Can you try this? It prints what is being matched with what. Perhaps this could be merged in a bit more refined form if it proves useful.

Not tested in any way.

 drivers/media/v4l2-core/v4l2-async.c | 41 ++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-async.c +0 -0
index 2f1b718a9189..6c13a9488415 100644

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 90

Quoted 5 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
@@ -86,13 +86,18 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	bool sd_fwnode_is_ep;
 	struct device *dev;
 
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);

Let's be more explicit:

Quoted 5 lines
	dev_dbg(sd->dev, "async fwnode match: need %pfw, trying %pfw\n",
		sd_fwnode, asd->match.fwnode);

(feel free to adjust, as long as we differentiate what we're looking for from what we're testing)

Yes.

Quoted 75 lines

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 98

Quoted 9 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
+
 	/*
 	 * Both the subdev and the async subdev can provide either an endpoint
 	 * fwnode or a device fwnode. Start with the simple case of direct
 	 * fwnode matching.
 	 */
-	if (sd_fwnode == asd->match.fwnode)
+	if (sd_fwnode == asd->match.fwnode) {
+		dev_dbg(sd->dev, "true\n");
		dev_dbg(sd->dev, "direct match found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 114

Quoted 12 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
 		return true;
+	}
 
 	/*
 	 * Otherwise, check if the sd fwnode and the asd fwnode refer to an
@@ -105,8 +110,12 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	sd_fwnode_is_ep = fwnode_graph_is_endpoint(sd_fwnode);
 	asd_fwnode_is_ep = fwnode_graph_is_endpoint(asd->match.fwnode);
 
-	if (sd_fwnode_is_ep == asd_fwnode_is_ep)
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);

You've already printed this above, no need to repeat it.

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 116

Quoted 2 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
+	if (sd_fwnode_is_ep == asd_fwnode_is_ep) {
+		dev_dbg(sd->dev, "unmatching node types (false)\n");
		dev_dbg(sd->dev, "direct match not found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 133

Quoted 11 lines
drivers/media/v4l2-core/v4l2-async.c +3 -0
 		return false;
+	}
 
 	/*
 	 * The sd and asd fwnodes are of different types. Get the device fwnode
@@ -120,10 +129,15 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 		other_fwnode = sd_fwnode;
 	}
 
+	dev_dbg(sd->dev, "async fwnode (compat) match %pfw vs. %pfw\n",
+		dev_fwnode, other_fwnode);

Same comment as above regarding "vs." not telling which is which.

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 138

Quoted 6 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
+
 	fwnode_handle_put(dev_fwnode);
 
-	if (dev_fwnode != other_fwnode)
+	if (dev_fwnode != other_fwnode) {
+		dev_dbg(sd->dev, "false\n");
		dev_dbg(sd->dev, "compat match not found\n");

drivers/media/v4l2-core/v4l2-async.c match_fwnode_one(struct v4l2_async_notifier *notifier, · line 160

Quoted 10 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
 		return false;
+	}
 
 	/*
 	 * We have a heterogeneous match. Retrieve the struct device of the side
@@ -143,6 +157,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 			   dev->driver->name);
 	}
 
+	dev_dbg(sd->dev, "true\n");
	dev_dbg(sd->dev, "compat match found\n");
Quoted 7 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+
 	return true;
 }
 
@@ -255,7 +271,10 @@ v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier)
 			v4l2_async_find_subdev_notifier(sd);
 
Quoted 11 lines

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier) · line 277

Quoted 6 lines
drivers/media/v4l2-core/v4l2-async.c +4 -1
 		if (subdev_notifier &&
-		    !v4l2_async_nf_can_complete(subdev_notifier))
+		    !v4l2_async_nf_can_complete(subdev_notifier)) {
+			if (subdev_notifier->sd)
+				deb_dbg(subdev_notifier->sd->dev,
+					"cannot complete\n");

I'd add a reference to v4l2-async, either directly in the string, or with a "%s: ", __func__ prefix. Otherwise the message will be easy to miss. Same in other messages. Maybe a "v4l2-async: " prefix for all debug messages ?

Quoted 2 lines

How about just "async: " for all of these? It's shorther, still unique, and these lines will be long.

Quoted 8 lines

"async" is a bit vague, I think you should mention V4L2 too. If this ends up printing

3-0010 async: cannot complete

someone may wonder what it relates to. We're talking about debugging messages here, let's make sure they improve debugging as much as possible.

These messages include the device name which already implies what it is about, so I'm frankly not concerned about this. Also these messages tend to occur in series. Having them shorter, instead, is a small plus. An example:

[    5.716093] dw9807 i2c-PRP0001:01: async: matching for notifier \_SB.PCI0.CIO2, sd \_SB.PCI0.I2C2.VCM0
[    5.716109] dw9807 i2c-PRP0001:01: async: fwnode match: need \_SB.PCI0.I2C2.VCM0, trying \_SB_.PCI0.I2C2.CAM0/port@0/endpoint@0
[    5.716123] dw9807 i2c-PRP0001:01: async: fwnode compat match, need \_SB_.PCI0.I2C2.CAM0, trying \_SB.PCI0.I2C2.VCM0
[    5.716131] dw9807 i2c-PRP0001:01: async: compat match not found
[   30.333138] imx258 i2c-SONY258A:00: async: matching for notifier \_SB.PCI0.CIO2, sd \_SB.PCI0.I2C2.CAM0
[   30.333154] imx258 i2c-SONY258A:00: async: fwnode match: need \_SB.PCI0.I2C2.CAM0, trying \_SB_.PCI0.I2C2.CAM0/port@0/endpoint@0
[   30.333168] imx258 i2c-SONY258A:00: async: fwnode compat match, need \_SB_.PCI0.I2C2.CAM0, trying \_SB.PCI0.I2C2.CAM0
[   30.333175] imx258 i2c-SONY258A:00: async: compat match not found
[   30.333178] imx258 i2c-SONY258A:00: async: trying secondary fwnode match
Quoted 8 lines
[   30.333181] imx258 i2c-SONY258A:00: async: fwnode match: need \_SB_.PCI0.I2C2.CAM0, trying \_SB_.PCI0.I2C2.CAM0/port@0/endpoint@0
[   30.333189] imx258 i2c-SONY258A:00: async: fwnode compat match, need \_SB_.PCI0.I2C2.CAM0, trying \_SB_.PCI0.I2C2.CAM0
[   30.333196] imx258 i2c-SONY258A:00: async: compat match found
[   30.333214] dw9807 i2c-PRP0001:01: async: matching for notifier \_SB.PCI0.I2C2.CAM0, sd \_SB.PCI0.I2C2.VCM0
[   30.333225] dw9807 i2c-PRP0001:01: async: fwnode match: need \_SB.PCI0.I2C2.VCM0, trying \_SB.PCI0.I2C2.VCM0
[   30.333235] dw9807 i2c-PRP0001:01: async: direct match found
[   30.333248] dw9807 i2c-PRP0001:01: async: bound to i2c-SONY258A:00's notifier (ret 0)
[   30.333252] ipu3-cio2 0000:00:14.3: async: complete

I would still prefer v4l2-async, but I won't nack the patch just for that.

Quoted 48 lines
Quoted 48 lines
Quoted 48 lines
Quoted 23 lines
Quoted 23 lines
drivers/media/v4l2-core/v4l2-async.c +8 -1
 			return false;
 	}
 
@@ -273,18 +292,27 @@ v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier)
 	if (!list_empty(&notifier->waiting))
 		return 0;
 
+	if (notifier->sd)
+		deb_dbg(notifier->sd->dev, "trying to complete\n");
+
 	/* Check the entire notifier tree; find the root notifier first. */
 	while (notifier->parent)
 		notifier = notifier->parent;
 
 	/* This is root if it has v4l2_dev. */
-	if (!notifier->v4l2_dev)
+	if (!notifier->v4l2_dev) {
+		if (notifier->sd)
+			deb_dbg(notifier->sd->dev,
+				"V4L2 device not available\n");
 		return 0;
+	}
 
Quoted 8 lines

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier) · line 314

Quoted 5 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
 	/* Is everything ready? */
 	if (!v4l2_async_nf_can_complete(notifier))
 		return 0;
 
+	deb_dbg(notifier->sd->dev, "complete\n");

You guard against notifier->sd being NULL above, but not here. At least one of the two is wrong.

I'll add a helper function to get the device safely.

Quoted 14 lines
Quoted 14 lines
drivers/media/v4l2-core/v4l2-async.c +4 -0
+
 	return v4l2_async_nf_call_complete(notifier);
 }
 
@@ -386,6 +414,9 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier)
 			continue;
 
 		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
+		deb_dbg(sd->dev, "bound to %s's notifier (ret %d)\n",
+			notifier->sd ? dev_name(notifier->sd->dev) : "no-dev",
+			ret);
 		if (ret < 0)
 			return ret;
 
Signature · 3 lines
Regards,

Laurent Pinchart
maintainer
#12 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

Hi Laurent,

Quoted 14 lines · Laurent Pinchart

Hi Sakari,

Quoted 11 lines · Sakari Ailus
Quoted 10 lines · Laurent Pinchart
Quoted 8 lines · Sakari Ailus
Quoted 1 line · Laurent Pinchart

Thank you for the patch.

Thanks for the review!

This was indeed hastily written, to help debugging a particular issue. But I hope it'll be useful for other purposes, too. V4L2 async is about to get more complicated soon.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

Could it get simpler instead ? :-) Maybe one day v4l2-async may cross the threshold of how much pain I can bear, and I'll rewrite it...

I wish it could, but often supporting complex needs is complicated. "Simplicated" is not even a proper word after all. Let's see.

Don't try to lure me into rewriting it sooner than later ;-)

This could be all avoided if drivers got all what they need during probe.

It would require vast changes accross a large number of drivers and might never happen.

Also this is related to not exposing access any hardware before all of it is available.

Signature · 3 lines
Regards,

Sakari Ailus
#13 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

In reply to Sakari Ailus
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…

Hi Sakari,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on media-tree/master]
[also build test WARNING on sailus-media-tree/streams soc/for-next linus/master v6.2-rc7 next-20230209] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sakari-Ailus/v4l-async-Add-some-debug-prints/20230210-061721
base:   git://linuxtv.org/media_tree.git master
patch link:    https://lore.kernel.org/r/20230209221634.35239-1-sakari.ailus%40linux.intel.com
patch subject: [RFC 1/1] v4l: async: Add some debug prints
config: m68k-allyesconfig (https://download.01.org/0day-ci/archive/20230210/[email protected]/config)
compiler: m68k-linux-gcc (GCC) 12.1.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/e7f54a8293c1023ad1d5c5cd757278037d55088f
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sakari-Ailus/v4l-async-Add-some-debug-prints/20230210-061721
git checkout e7f54a8293c1023ad1d5c5cd757278037d55088f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash drivers/media/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/media/v4l2-core/v4l2-async.c: In function 'v4l2_async_nf_can_complete':
drivers/media/v4l2-core/v4l2-async.c:276:33: error: implicit declaration of function 'deb_dbg'; did you mean 'dev_dbg'? [-Werror=implicit-function-declaration]

     276 |                                 deb_dbg(subdev_notifier->sd->dev,
         |                                 ^~~~~~~
         |                                 dev_dbg
   drivers/media/v4l2-core/v4l2-async.c:289:1: error: invalid storage class for function 'v4l2_async_nf_try_complete'
     289 | v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/v4l2-core/v4l2-async.c:288:1: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     288 | static int
         | ^~~~~~
   drivers/media/v4l2-core/v4l2-async.c:320:1: error: invalid storage class for function 'v4l2_async_nf_try_all_subdevs'
     320 | v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:322:12: error: invalid storage class for function 'v4l2_async_create_ancillary_links'
     322 | static int v4l2_async_create_ancillary_links(struct v4l2_async_notifier *n,
         |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:340:12: error: invalid storage class for function 'v4l2_async_match_notify'
     340 | static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
         |            ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c: In function 'v4l2_async_match_notify':
   drivers/media/v4l2-core/v4l2-async.c:393:16: error: implicit declaration of function 'v4l2_async_nf_try_all_subdevs'; did you mean 'v4l2_async_nf_try_complete'? [-Werror=implicit-function-declaration]
     393 |         return v4l2_async_nf_try_all_subdevs(subdev_notifier);
         |                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                v4l2_async_nf_try_complete
   drivers/media/v4l2-core/v4l2-async.c: In function 'v4l2_async_nf_can_complete':
   drivers/media/v4l2-core/v4l2-async.c:398:1: error: invalid storage class for function 'v4l2_async_nf_try_all_subdevs'
     398 | v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:435:13: error: invalid storage class for function 'v4l2_async_cleanup'
     435 | static void v4l2_async_cleanup(struct v4l2_subdev *sd)
         |             ^~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:448:1: error: invalid storage class for function 'v4l2_async_nf_unbind_all_subdevs'
     448 | v4l2_async_nf_unbind_all_subdevs(struct v4l2_async_notifier *notifier)
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:470:1: error: invalid storage class for function '__v4l2_async_nf_has_async_subdev'
     470 | __v4l2_async_nf_has_async_subdev(struct v4l2_async_notifier *notifier,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:497:1: error: invalid storage class for function 'v4l2_async_nf_has_async_subdev'
     497 | v4l2_async_nf_has_async_subdev(struct v4l2_async_notifier *notifier,
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:521:12: error: invalid storage class for function 'v4l2_async_nf_asd_valid'
     521 | static int v4l2_async_nf_asd_valid(struct v4l2_async_notifier *notifier,
         |            ^~~~~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/linkage.h:7,
                    from include/linux/fs.h:5,
                    from include/linux/debugfs.h:15,
                    from drivers/media/v4l2-core/v4l2-async.c:8:
   drivers/media/v4l2-core/v4l2-async.c:552:15: error: non-static declaration of 'v4l2_async_nf_init' follows static declaration
     552 | EXPORT_SYMBOL(v4l2_async_nf_init);
         |               ^~~~~~~~~~~~~~~~~~
   include/linux/export.h:87:28: note: in definition of macro '___EXPORT_SYMBOL'
      87 |         extern typeof(sym) sym;                                                 \
         |                            ^~~
   include/linux/export.h:147:41: note: in expansion of macro '__EXPORT_SYMBOL'
     147 | #define _EXPORT_SYMBOL(sym, sec)        __EXPORT_SYMBOL(sym, sec, "")
         |                                         ^~~~~~~~~~~~~~~
   include/linux/export.h:150:41: note: in expansion of macro '_EXPORT_SYMBOL'
     150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:552:1: note: in expansion of macro 'EXPORT_SYMBOL'
     552 | EXPORT_SYMBOL(v4l2_async_nf_init);
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:548:6: note: previous definition of 'v4l2_async_nf_init' with type 'void(struct v4l2_async_notifier *)'
     548 | void v4l2_async_nf_init(struct v4l2_async_notifier *notifier)
         |      ^~~~~~~~~~~~~~~~~~
   include/linux/export.h:57:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      57 |         static const struct kernel_symbol __ksymtab_##sym               \
         |         ^~~~~~
   include/linux/export.h:96:9: note: in expansion of macro '__KSYMTAB_ENTRY'
      96 |         __KSYMTAB_ENTRY(sym, sec)
         |         ^~~~~~~~~~~~~~~
   include/linux/export.h:140:41: note: in expansion of macro '___EXPORT_SYMBOL'
     140 | #define __EXPORT_SYMBOL(sym, sec, ns)   ___EXPORT_SYMBOL(sym, sec, ns)
         |                                         ^~~~~~~~~~~~~~~~
   include/linux/export.h:147:41: note: in expansion of macro '__EXPORT_SYMBOL'
     147 | #define _EXPORT_SYMBOL(sym, sec)        __EXPORT_SYMBOL(sym, sec, "")
         |                                         ^~~~~~~~~~~~~~~
   include/linux/export.h:150:41: note: in expansion of macro '_EXPORT_SYMBOL'
     150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:552:1: note: in expansion of macro 'EXPORT_SYMBOL'
     552 | EXPORT_SYMBOL(v4l2_async_nf_init);
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:554:12: error: invalid storage class for function '__v4l2_async_nf_register'
     554 | static int __v4l2_async_nf_register(struct v4l2_async_notifier *notifier)
         |            ^~~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:615:15: error: non-static declaration of 'v4l2_async_nf_register' follows static declaration
     615 | EXPORT_SYMBOL(v4l2_async_nf_register);
         |               ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:87:28: note: in definition of macro '___EXPORT_SYMBOL'
      87 |         extern typeof(sym) sym;                                                 \
         |                            ^~~
   include/linux/export.h:147:41: note: in expansion of macro '__EXPORT_SYMBOL'
     147 | #define _EXPORT_SYMBOL(sym, sec)        __EXPORT_SYMBOL(sym, sec, "")
         |                                         ^~~~~~~~~~~~~~~
   include/linux/export.h:150:41: note: in expansion of macro '_EXPORT_SYMBOL'
     150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:615:1: note: in expansion of macro 'EXPORT_SYMBOL'
     615 | EXPORT_SYMBOL(v4l2_async_nf_register);
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:599:5: note: previous definition of 'v4l2_async_nf_register' with type 'int(struct v4l2_device *, struct v4l2_async_notifier *)'
     599 | int v4l2_async_nf_register(struct v4l2_device *v4l2_dev,
         |     ^~~~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:57:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      57 |         static const struct kernel_symbol __ksymtab_##sym               \
         |         ^~~~~~
   include/linux/export.h:96:9: note: in expansion of macro '__KSYMTAB_ENTRY'
--
   include/linux/export.h:150:41: note: in expansion of macro '_EXPORT_SYMBOL'
     150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:875:1: note: in expansion of macro 'EXPORT_SYMBOL'
     875 | EXPORT_SYMBOL(v4l2_async_unregister_subdev);
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:851:6: note: previous definition of 'v4l2_async_unregister_subdev' with type 'void(struct v4l2_subdev *)'
     851 | void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:57:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      57 |         static const struct kernel_symbol __ksymtab_##sym               \
         |         ^~~~~~
   include/linux/export.h:96:9: note: in expansion of macro '__KSYMTAB_ENTRY'
      96 |         __KSYMTAB_ENTRY(sym, sec)
         |         ^~~~~~~~~~~~~~~
   include/linux/export.h:140:41: note: in expansion of macro '___EXPORT_SYMBOL'
     140 | #define __EXPORT_SYMBOL(sym, sec, ns)   ___EXPORT_SYMBOL(sym, sec, ns)
         |                                         ^~~~~~~~~~~~~~~~
   include/linux/export.h:147:41: note: in expansion of macro '__EXPORT_SYMBOL'
     147 | #define _EXPORT_SYMBOL(sym, sec)        __EXPORT_SYMBOL(sym, sec, "")
         |                                         ^~~~~~~~~~~~~~~
   include/linux/export.h:150:41: note: in expansion of macro '_EXPORT_SYMBOL'
     150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:875:1: note: in expansion of macro 'EXPORT_SYMBOL'
     875 | EXPORT_SYMBOL(v4l2_async_unregister_subdev);
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:877:13: error: invalid storage class for function 'print_waiting_subdev'
     877 | static void print_waiting_subdev(struct seq_file *s,
         |             ^~~~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:903:1: error: invalid storage class for function 'v4l2_async_nf_name'
     903 | v4l2_async_nf_name(struct v4l2_async_notifier *notifier)
         | ^~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:913:12: error: invalid storage class for function 'pending_subdevs_show'
     913 | static int pending_subdevs_show(struct seq_file *s, void *data)
         |            ^~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/debugfs.h:16:
   drivers/media/v4l2-core/v4l2-async.c:930:23: error: invalid storage class for function 'pending_subdevs_open'
     930 | DEFINE_SHOW_ATTRIBUTE(pending_subdevs);
         |                       ^~~~~~~~~~~~~~~
   include/linux/seq_file.h:197:12: note: in definition of macro 'DEFINE_SHOW_ATTRIBUTE'
     197 | static int __name ## _open(struct inode *inode, struct file *file)      \
         |            ^~~~~~
   drivers/media/v4l2-core/v4l2-async.c:930:23: error: initializer element is not constant
     930 | DEFINE_SHOW_ATTRIBUTE(pending_subdevs);
         |                       ^~~~~~~~~~~~~~~
   include/linux/seq_file.h:204:27: note: in definition of macro 'DEFINE_SHOW_ATTRIBUTE'
     204 |         .open           = __name ## _open,                              \
         |                           ^~~~~~
   drivers/media/v4l2-core/v4l2-async.c:930:23: note: (near initialization for 'pending_subdevs_fops.open')
     930 | DEFINE_SHOW_ATTRIBUTE(pending_subdevs);
         |                       ^~~~~~~~~~~~~~~
   include/linux/seq_file.h:204:27: note: in definition of macro 'DEFINE_SHOW_ATTRIBUTE'
     204 |         .open           = __name ## _open,                              \
         |                           ^~~~~~
   drivers/media/v4l2-core/v4l2-async.c:934:19: error: invalid storage class for function 'v4l2_async_init'
     934 | static int __init v4l2_async_init(void)
         |                   ^~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:944:20: error: invalid storage class for function 'v4l2_async_exit'
     944 | static void __exit v4l2_async_exit(void)
         |                    ^~~~~~~~~~~~~~~
   In file included from include/linux/printk.h:6,
                    from include/asm-generic/bug.h:22,
                    from arch/m68k/include/asm/bug.h:32,
                    from include/linux/bug.h:5,
                    from include/linux/thread_info.h:13,
                    from include/asm-generic/preempt.h:5,
                    from ./arch/m68k/include/generated/asm/preempt.h:1,
                    from include/linux/preempt.h:78,
                    from include/linux/spinlock.h:56,
                    from include/linux/wait.h:9,
                    from include/linux/wait_bit.h:8,
                    from include/linux/fs.h:6:
   drivers/media/v4l2-core/v4l2-async.c:949:17: error: initializer element is not constant
     949 | subsys_initcall(v4l2_async_init);
         |                 ^~~~~~~~~~~~~~~
   include/linux/init.h:253:55: note: in definition of macro '____define_initcall'
     253 |                 __attribute__((__section__(__sec))) = fn;
         |                                                       ^~
   include/linux/init.h:263:9: note: in expansion of macro '__unique_initcall'
     263 |         __unique_initcall(fn, id, __sec, __initcall_id(fn))
         |         ^~~~~~~~~~~~~~~~~
   include/linux/init.h:265:35: note: in expansion of macro '___define_initcall'
     265 | #define __define_initcall(fn, id) ___define_initcall(fn, id, .initcall##id)
         |                                   ^~~~~~~~~~~~~~~~~~
   include/linux/init.h:289:41: note: in expansion of macro '__define_initcall'
     289 | #define subsys_initcall(fn)             __define_initcall(fn, 4)
         |                                         ^~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:949:1: note: in expansion of macro 'subsys_initcall'
     949 | subsys_initcall(v4l2_async_init);
         | ^~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:950:13: error: initializer element is not constant
     950 | module_exit(v4l2_async_exit);
         |             ^~~~~~~~~~~~~~~
   include/linux/init.h:302:57: note: in definition of macro '__exitcall'
     302 |         static exitcall_t __exitcall_##fn __exit_call = fn
         |                                                         ^~
   drivers/media/v4l2-core/v4l2-async.c:950:1: note: in expansion of macro 'module_exit'
     950 | module_exit(v4l2_async_exit);
         | ^~~~~~~~~~~
>> include/linux/init.h:302:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     302 |         static exitcall_t __exitcall_##fn __exit_call = fn
         |         ^~~~~~
   include/linux/module.h:99:25: note: in expansion of macro '__exitcall'
      99 | #define module_exit(x)  __exitcall(x);
         |                         ^~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:950:1: note: in expansion of macro 'module_exit'
     950 | module_exit(v4l2_async_exit);
         | ^~~~~~~~~~~
   In file included from include/linux/module.h:22,
                    from include/linux/device/driver.h:21,
                    from include/linux/device.h:32,
                    from drivers/media/v4l2-core/v4l2-async.c:9:
>> include/linux/moduleparam.h:24:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      24 |         static const char __UNIQUE_ID(name)[]                             \
         |         ^~~~~~
   include/linux/module.h:165:32: note: in expansion of macro '__MODULE_INFO'
     165 | #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
         |                                ^~~~~~~~~~~~~
   include/linux/module.h:235:32: note: in expansion of macro 'MODULE_INFO'
     235 | #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
         |                                ^~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:952:1: note: in expansion of macro 'MODULE_AUTHOR'
     952 | MODULE_AUTHOR("Guennadi Liakhovetski <[email protected]>");
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:955:1: error: expected declaration or statement at end of input
     955 | MODULE_LICENSE("GPL");
         | ^~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +288 drivers/media/v4l2-core/v4l2-async.c

2cab00bb076b9f Sakari Ailus          2017-09-24  257  
2cab00bb076b9f Sakari Ailus          2017-09-24  258  /*
2cab00bb076b9f Sakari Ailus          2017-09-24  259   * Return true if all child sub-device notifiers are complete, false otherwise.
2cab00bb076b9f Sakari Ailus          2017-09-24  260   */
6087b21533fed7 Mauro Carvalho Chehab 2018-10-04  261  static bool
3c8c153914812a Sakari Ailus          2021-03-05  262  v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier)
2cab00bb076b9f Sakari Ailus          2017-09-24  263  {
2cab00bb076b9f Sakari Ailus          2017-09-24  264  	struct v4l2_subdev *sd;
2cab00bb076b9f Sakari Ailus          2017-09-24  265  
2cab00bb076b9f Sakari Ailus          2017-09-24  266  	if (!list_empty(&notifier->waiting))
2cab00bb076b9f Sakari Ailus          2017-09-24  267  		return false;
2cab00bb076b9f Sakari Ailus          2017-09-24  268  
2cab00bb076b9f Sakari Ailus          2017-09-24  269  	list_for_each_entry(sd, &notifier->done, async_list) {
2cab00bb076b9f Sakari Ailus          2017-09-24  270  		struct v4l2_async_notifier *subdev_notifier =
2cab00bb076b9f Sakari Ailus          2017-09-24  271  			v4l2_async_find_subdev_notifier(sd);
2cab00bb076b9f Sakari Ailus          2017-09-24  272  
2cab00bb076b9f Sakari Ailus          2017-09-24  273  		if (subdev_notifier &&
e7f54a8293c102 Sakari Ailus          2023-02-10  274  		    !v4l2_async_nf_can_complete(subdev_notifier)) {
e7f54a8293c102 Sakari Ailus          2023-02-10  275  			if (subdev_notifier->sd)
e7f54a8293c102 Sakari Ailus          2023-02-10 @276  				deb_dbg(subdev_notifier->sd->dev,
e7f54a8293c102 Sakari Ailus          2023-02-10  277  					"cannot complete\n");
2cab00bb076b9f Sakari Ailus          2017-09-24  278  			return false;
2cab00bb076b9f Sakari Ailus          2017-09-24  279  	}
2cab00bb076b9f Sakari Ailus          2017-09-24  280  
2cab00bb076b9f Sakari Ailus          2017-09-24  281  	return true;
2cab00bb076b9f Sakari Ailus          2017-09-24  282  }
2cab00bb076b9f Sakari Ailus          2017-09-24  283  
2cab00bb076b9f Sakari Ailus          2017-09-24  284  /*
2cab00bb076b9f Sakari Ailus          2017-09-24  285   * Complete the master notifier if possible. This is done when all async
2cab00bb076b9f Sakari Ailus          2017-09-24  286   * sub-devices have been bound; v4l2_device is also available then.
2cab00bb076b9f Sakari Ailus          2017-09-24  287   */
6087b21533fed7 Mauro Carvalho Chehab 2018-10-04 @288  static int
3c8c153914812a Sakari Ailus          2021-03-05  289  v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier)
2cab00bb076b9f Sakari Ailus          2017-09-24  290  {
2cab00bb076b9f Sakari Ailus          2017-09-24  291  	/* Quick check whether there are still more sub-devices here. */
2cab00bb076b9f Sakari Ailus          2017-09-24  292  	if (!list_empty(&notifier->waiting))
2cab00bb076b9f Sakari Ailus          2017-09-24  293  		return 0;
2cab00bb076b9f Sakari Ailus          2017-09-24  294  
e7f54a8293c102 Sakari Ailus          2023-02-10  295  	if (notifier->sd)
e7f54a8293c102 Sakari Ailus          2023-02-10  296  		deb_dbg(notifier->sd->dev, "trying to complete\n");
e7f54a8293c102 Sakari Ailus          2023-02-10  297  
2cab00bb076b9f Sakari Ailus          2017-09-24  298  	/* Check the entire notifier tree; find the root notifier first. */
2cab00bb076b9f Sakari Ailus          2017-09-24  299  	while (notifier->parent)
2cab00bb076b9f Sakari Ailus          2017-09-24  300  		notifier = notifier->parent;
2cab00bb076b9f Sakari Ailus          2017-09-24  301  
2cab00bb076b9f Sakari Ailus          2017-09-24  302  	/* This is root if it has v4l2_dev. */
e7f54a8293c102 Sakari Ailus          2023-02-10  303  	if (!notifier->v4l2_dev) {
e7f54a8293c102 Sakari Ailus          2023-02-10  304  		if (notifier->sd)
e7f54a8293c102 Sakari Ailus          2023-02-10  305  			deb_dbg(notifier->sd->dev,
e7f54a8293c102 Sakari Ailus          2023-02-10  306  				"V4L2 device not available\n");
2cab00bb076b9f Sakari Ailus          2017-09-24  307  		return 0;
e7f54a8293c102 Sakari Ailus          2023-02-10  308  	}
2cab00bb076b9f Sakari Ailus          2017-09-24  309  
2cab00bb076b9f Sakari Ailus          2017-09-24  310  	/* Is everything ready? */
3c8c153914812a Sakari Ailus          2021-03-05  311  	if (!v4l2_async_nf_can_complete(notifier))
2cab00bb076b9f Sakari Ailus          2017-09-24  312  		return 0;
2cab00bb076b9f Sakari Ailus          2017-09-24  313  
e7f54a8293c102 Sakari Ailus          2023-02-10  314  	deb_dbg(notifier->sd->dev, "complete\n");
e7f54a8293c102 Sakari Ailus          2023-02-10  315  
3c8c153914812a Sakari Ailus          2021-03-05  316  	return v4l2_async_nf_call_complete(notifier);
2cab00bb076b9f Sakari Ailus          2017-09-24  317  }
2cab00bb076b9f Sakari Ailus          2017-09-24  318  
Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#14 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

In reply to Sakari Ailus
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…

Hi Sakari,

[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on media-tree/master]
[also build test ERROR on sailus-media-tree/streams soc/for-next linus/master v6.2-rc7 next-20230209] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sakari-Ailus/v4l-async-Add-some-debug-prints/20230210-061721
base:   git://linuxtv.org/media_tree.git master
patch link:    https://lore.kernel.org/r/20230209221634.35239-1-sakari.ailus%40linux.intel.com
patch subject: [RFC 1/1] v4l: async: Add some debug prints
config: nios2-randconfig-r021-20230209 (https://download.01.org/0day-ci/archive/20230210/[email protected]/config)
compiler: nios2-linux-gcc (GCC) 12.1.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/e7f54a8293c1023ad1d5c5cd757278037d55088f
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sakari-Ailus/v4l-async-Add-some-debug-prints/20230210-061721
git checkout e7f54a8293c1023ad1d5c5cd757278037d55088f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=nios2 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=nios2 SHELL=/bin/bash drivers/media/v4l2-core/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All error/warnings (new ones prefixed by >>):

include/linux/export.h:150:41: note: in expansion of macro '_EXPORT_SYMBOL'

     150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:849:1: note: in expansion of macro 'EXPORT_SYMBOL'
     849 | EXPORT_SYMBOL(v4l2_async_register_subdev);
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:783:5: note: previous definition of 'v4l2_async_register_subdev' with type 'int(struct v4l2_subdev *)'
     783 | int v4l2_async_register_subdev(struct v4l2_subdev *sd)
         |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:57:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      57 |         static const struct kernel_symbol __ksymtab_##sym               \
         |         ^~~~~~
   include/linux/export.h:96:9: note: in expansion of macro '__KSYMTAB_ENTRY'
      96 |         __KSYMTAB_ENTRY(sym, sec)
         |         ^~~~~~~~~~~~~~~
   include/linux/export.h:140:41: note: in expansion of macro '___EXPORT_SYMBOL'
     140 | #define __EXPORT_SYMBOL(sym, sec, ns)   ___EXPORT_SYMBOL(sym, sec, ns)
         |                                         ^~~~~~~~~~~~~~~~
   include/linux/export.h:147:41: note: in expansion of macro '__EXPORT_SYMBOL'
     147 | #define _EXPORT_SYMBOL(sym, sec)        __EXPORT_SYMBOL(sym, sec, "")
         |                                         ^~~~~~~~~~~~~~~
   include/linux/export.h:150:41: note: in expansion of macro '_EXPORT_SYMBOL'
     150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:849:1: note: in expansion of macro 'EXPORT_SYMBOL'
     849 | EXPORT_SYMBOL(v4l2_async_register_subdev);
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:875:15: error: non-static declaration of 'v4l2_async_unregister_subdev' follows static declaration
     875 | EXPORT_SYMBOL(v4l2_async_unregister_subdev);
         |               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:87:28: note: in definition of macro '___EXPORT_SYMBOL'
      87 |         extern typeof(sym) sym;                                                 \
         |                            ^~~
   include/linux/export.h:147:41: note: in expansion of macro '__EXPORT_SYMBOL'
     147 | #define _EXPORT_SYMBOL(sym, sec)        __EXPORT_SYMBOL(sym, sec, "")
         |                                         ^~~~~~~~~~~~~~~
   include/linux/export.h:150:41: note: in expansion of macro '_EXPORT_SYMBOL'
     150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:875:1: note: in expansion of macro 'EXPORT_SYMBOL'
     875 | EXPORT_SYMBOL(v4l2_async_unregister_subdev);
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:851:6: note: previous definition of 'v4l2_async_unregister_subdev' with type 'void(struct v4l2_subdev *)'
     851 | void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
         |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
   include/linux/export.h:57:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      57 |         static const struct kernel_symbol __ksymtab_##sym               \
         |         ^~~~~~
   include/linux/export.h:96:9: note: in expansion of macro '__KSYMTAB_ENTRY'
      96 |         __KSYMTAB_ENTRY(sym, sec)
         |         ^~~~~~~~~~~~~~~
   include/linux/export.h:140:41: note: in expansion of macro '___EXPORT_SYMBOL'
     140 | #define __EXPORT_SYMBOL(sym, sec, ns)   ___EXPORT_SYMBOL(sym, sec, ns)
         |                                         ^~~~~~~~~~~~~~~~
   include/linux/export.h:147:41: note: in expansion of macro '__EXPORT_SYMBOL'
     147 | #define _EXPORT_SYMBOL(sym, sec)        __EXPORT_SYMBOL(sym, sec, "")
         |                                         ^~~~~~~~~~~~~~~
   include/linux/export.h:150:41: note: in expansion of macro '_EXPORT_SYMBOL'
     150 | #define EXPORT_SYMBOL(sym)              _EXPORT_SYMBOL(sym, "")
         |                                         ^~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:875:1: note: in expansion of macro 'EXPORT_SYMBOL'
     875 | EXPORT_SYMBOL(v4l2_async_unregister_subdev);
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:877:13: error: invalid storage class for function 'print_waiting_subdev'
     877 | static void print_waiting_subdev(struct seq_file *s,
         |             ^~~~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:903:1: error: invalid storage class for function 'v4l2_async_nf_name'
     903 | v4l2_async_nf_name(struct v4l2_async_notifier *notifier)
         | ^~~~~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:913:12: error: invalid storage class for function 'pending_subdevs_show'
     913 | static int pending_subdevs_show(struct seq_file *s, void *data)
         |            ^~~~~~~~~~~~~~~~~~~~
   In file included from include/linux/debugfs.h:16:
   drivers/media/v4l2-core/v4l2-async.c:930:23: error: invalid storage class for function 'pending_subdevs_open'
     930 | DEFINE_SHOW_ATTRIBUTE(pending_subdevs);
         |                       ^~~~~~~~~~~~~~~
   include/linux/seq_file.h:197:12: note: in definition of macro 'DEFINE_SHOW_ATTRIBUTE'
     197 | static int __name ## _open(struct inode *inode, struct file *file)      \
         |            ^~~~~~
   drivers/media/v4l2-core/v4l2-async.c:930:23: error: initializer element is not constant
     930 | DEFINE_SHOW_ATTRIBUTE(pending_subdevs);
         |                       ^~~~~~~~~~~~~~~
   include/linux/seq_file.h:204:27: note: in definition of macro 'DEFINE_SHOW_ATTRIBUTE'
     204 |         .open           = __name ## _open,                              \
         |                           ^~~~~~
   drivers/media/v4l2-core/v4l2-async.c:930:23: note: (near initialization for 'pending_subdevs_fops.open')
     930 | DEFINE_SHOW_ATTRIBUTE(pending_subdevs);
         |                       ^~~~~~~~~~~~~~~
   include/linux/seq_file.h:204:27: note: in definition of macro 'DEFINE_SHOW_ATTRIBUTE'
     204 |         .open           = __name ## _open,                              \
         |                           ^~~~~~
   drivers/media/v4l2-core/v4l2-async.c:934:19: error: invalid storage class for function 'v4l2_async_init'
     934 | static int __init v4l2_async_init(void)
         |                   ^~~~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:944:20: error: invalid storage class for function 'v4l2_async_exit'
     944 | static void __exit v4l2_async_exit(void)
         |                    ^~~~~~~~~~~~~~~
   In file included from include/linux/device/driver.h:21,
                    from include/linux/device.h:32,
                    from drivers/media/v4l2-core/v4l2-async.c:9:
>> include/linux/module.h:130:49: error: invalid storage class for function '__inittest'
     130 |         static inline initcall_t __maybe_unused __inittest(void)                \
         |                                                 ^~~~~~~~~~
   include/linux/module.h:116:41: note: in expansion of macro 'module_init'
     116 | #define subsys_initcall(fn)             module_init(fn)
         |                                         ^~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:949:1: note: in expansion of macro 'subsys_initcall'
     949 | subsys_initcall(v4l2_async_init);
         | ^~~~~~~~~~~~~~~
>> drivers/media/v4l2-core/v4l2-async.c:949:1: warning: 'alias' attribute ignored [-Wattributes]
>> include/linux/module.h:138:49: error: invalid storage class for function '__exittest'
     138 |         static inline exitcall_t __maybe_unused __exittest(void)                \
         |                                                 ^~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:950:1: note: in expansion of macro 'module_exit'
     950 | module_exit(v4l2_async_exit);
         | ^~~~~~~~~~~
>> include/linux/module.h:138:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
     138 |         static inline exitcall_t __maybe_unused __exittest(void)                \
         |         ^~~~~~
   drivers/media/v4l2-core/v4l2-async.c:950:1: note: in expansion of macro 'module_exit'
     950 | module_exit(v4l2_async_exit);
         | ^~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:950:1: warning: 'alias' attribute ignored [-Wattributes]
   In file included from include/linux/module.h:22:
   include/linux/moduleparam.h:24:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
      24 |         static const char __UNIQUE_ID(name)[]                             \
         |         ^~~~~~
   include/linux/module.h:165:32: note: in expansion of macro '__MODULE_INFO'
     165 | #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
         |                                ^~~~~~~~~~~~~
   include/linux/module.h:235:32: note: in expansion of macro 'MODULE_INFO'
     235 | #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
         |                                ^~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:952:1: note: in expansion of macro 'MODULE_AUTHOR'
     952 | MODULE_AUTHOR("Guennadi Liakhovetski <[email protected]>");
         | ^~~~~~~~~~~~~
   drivers/media/v4l2-core/v4l2-async.c:955:1: error: expected declaration or statement at end of input
     955 | MODULE_LICENSE("GPL");
         | ^~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +/alias +949 drivers/media/v4l2-core/v4l2-async.c

ff3cc65cadb5d7 Sakari Ailus 2021-03-05 948
ff3cc65cadb5d7 Sakari Ailus 2021-03-05 @949 subsys_initcall(v4l2_async_init); ff3cc65cadb5d7 Sakari Ailus 2021-03-05 950 module_exit(v4l2_async_exit); ff3cc65cadb5d7 Sakari Ailus 2021-03-05 951

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#15 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

In reply to Sakari Ailus
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…

Hi Sakari,

[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on media-tree/master]
[also build test ERROR on sailus-media-tree/streams soc/for-next linus/master v6.2-rc7 next-20230209] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sakari-Ailus/v4l-async-Add-some-debug-prints/20230210-061721
base:   git://linuxtv.org/media_tree.git master
patch link:    https://lore.kernel.org/r/20230209221634.35239-1-sakari.ailus%40linux.intel.com
patch subject: [RFC 1/1] v4l: async: Add some debug prints
config: hexagon-randconfig-r024-20230209 (https://download.01.org/0day-ci/archive/20230210/[email protected]/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project db0e6591612b53910a1b366863348bdb9d7d2fb1)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/e7f54a8293c1023ad1d5c5cd757278037d55088f
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sakari-Ailus/v4l-async-Add-some-debug-prints/20230210-061721
git checkout e7f54a8293c1023ad1d5c5cd757278037d55088f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/media/v4l2-core/

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

In file included from drivers/media/v4l2-core/v4l2-async.c:11:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:9:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]

           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from drivers/media/v4l2-core/v4l2-async.c:11:
   In file included from include/linux/i2c.h:19:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from drivers/media/v4l2-core/v4l2-async.c:11:
   In file included from include/linux/i2c.h:19:
   In file included from include/linux/regulator/consumer.h:35:
   In file included from include/linux/suspend.h:5:
   In file included from include/linux/swap.h:9:
   In file included from include/linux/memcontrol.h:13:
   In file included from include/linux/cgroup.h:26:
   In file included from include/linux/kernel_stat.h:9:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/hexagon/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/hexagon/include/asm/io.h:334:
   include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
>> drivers/media/v4l2-core/v4l2-async.c:276:5: error: call to undeclared function 'deb_dbg'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
                                   deb_dbg(subdev_notifier->sd->dev,
                                   ^

drivers/media/v4l2-core/v4l2-async.c:290:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:319:1: error: function declared in block scope cannot have 'static' storage class static int
^
drivers/media/v4l2-core/v4l2-async.c:324:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:344:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:399:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:436:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:449:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:472:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:499:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:524:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:549:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:555:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:601:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:619:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:637:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:650:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:660:1: error: function definition is not allowed here
{
^
drivers/media/v4l2-core/v4l2-async.c:682:1: error: function definition is not allowed here
{
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
6 warnings and 20 errors generated.

vim +/deb_dbg +276 drivers/media/v4l2-core/v4l2-async.c

257
258 /*
259 * Return true if all child sub-device notifiers are complete, false otherwise.
260 */
261 static bool
262 v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier)
263 {
264 struct v4l2_subdev *sd;
265
266 if (!list_empty(&notifier->waiting))
267 return false;
268
269 list_for_each_entry(sd, &notifier->done, async_list) {
270 struct v4l2_async_notifier *subdev_notifier =
271 v4l2_async_find_subdev_notifier(sd);
272
273 if (subdev_notifier &&
274 !v4l2_async_nf_can_complete(subdev_notifier)) {
275 if (subdev_notifier->sd)

 > 276					deb_dbg(subdev_notifier->sd->dev,

277 "cannot complete\n");
278 return false;
279 }
280
281 return true;
282 }
283

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#16 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

In reply to Sakari Ailus
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in…

Hi Sakari,

[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on media-tree/master]
[also build test ERROR on sailus-media-tree/streams soc/for-next linus/master v6.2-rc7 next-20230209] [If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Sakari-Ailus/v4l-async-Add-some-debug-prints/20230210-061721
base:   git://linuxtv.org/media_tree.git master
patch link:    https://lore.kernel.org/r/20230209221634.35239-1-sakari.ailus%40linux.intel.com
patch subject: [RFC 1/1] v4l: async: Add some debug prints
config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20230210/[email protected]/config)
compiler: clang version 14.0.6 (https://github.com/llvm/llvm-project f28c006a5895fc0e329fe15fead81e37457cb1d1)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/intel-lab-lkp/linux/commit/e7f54a8293c1023ad1d5c5cd757278037d55088f
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Sakari-Ailus/v4l-async-Add-some-debug-prints/20230210-061721 git checkout e7f54a8293c1023ad1d5c5cd757278037d55088f
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>
| Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All errors (new ones prefixed by >>):

>> drivers/media/v4l2-core/v4l2-async.c:276:5: error: implicit declaration of function 'deb_dbg' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                                   deb_dbg(subdev_notifier->sd->dev,
                                   ^
>> drivers/media/v4l2-core/v4l2-async.c:290:1: error: function definition is not allowed here
   {
   ^
>> drivers/media/v4l2-core/v4l2-async.c:319:1: error: function declared in block scope cannot have 'static' storage class

static int
^
drivers/media/v4l2-core/v4l2-async.c:324:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:344:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:399:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:436:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:449:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:472:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:499:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:524:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:549:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:555:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:601:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:619:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:637:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:650:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:660:1: error: function definition is not allowed here {
^
drivers/media/v4l2-core/v4l2-async.c:682:1: error: function definition is not allowed here {
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.

vim +/deb_dbg +276 drivers/media/v4l2-core/v4l2-async.c

257
258 /*
259 * Return true if all child sub-device notifiers are complete, false otherwise.
260 */
261 static bool
262 v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier)
263 {
264 struct v4l2_subdev *sd;
265
266 if (!list_empty(&notifier->waiting))
267 return false;
268
269 list_for_each_entry(sd, &notifier->done, async_list) {
270 struct v4l2_async_notifier *subdev_notifier =
271 v4l2_async_find_subdev_notifier(sd);
272
273 if (subdev_notifier &&
274 !v4l2_async_nf_can_complete(subdev_notifier)) {
275 if (subdev_notifier->sd)

 > 276					deb_dbg(subdev_notifier->sd->dev,
   277						"cannot complete\n");
   278				return false;
   279		}
   280	
   281		return true;
   282	}
   283	
   284	/*
   285	 * Complete the master notifier if possible. This is done when all async
   286	 * sub-devices have been bound; v4l2_device is also available then.
   287	 */
   288	static int
   289	v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier)
 > 290	{
   291		/* Quick check whether there are still more sub-devices here. */
   292		if (!list_empty(&notifier->waiting))
   293			return 0;
   294	
   295		if (notifier->sd)
   296			deb_dbg(notifier->sd->dev, "trying to complete\n");
   297	
   298		/* Check the entire notifier tree; find the root notifier first. */
   299		while (notifier->parent)
   300			notifier = notifier->parent;
   301	
   302		/* This is root if it has v4l2_dev. */
   303		if (!notifier->v4l2_dev) {
   304			if (notifier->sd)
   305				deb_dbg(notifier->sd->dev,
   306					"V4L2 device not available\n");
   307			return 0;
   308		}
   309	
   310		/* Is everything ready? */
   311		if (!v4l2_async_nf_can_complete(notifier))
   312			return 0;
   313	
   314		deb_dbg(notifier->sd->dev, "complete\n");
   315	
   316		return v4l2_async_nf_call_complete(notifier);
   317	}
   318	
 > 319	static int

320 v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier);
321

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
#17 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

In reply to Sakari Ailus

Hi Sakari,

Quoted 12 lines · Sakari Ailus

Just add some debug prints for V4L2 async sub-device matching process. These might come useful in figuring out why things don't work as expected.

---
Frieder,

Can you try this? It prints what is being matched with what. Perhaps this could be merged in a bit more refined form if it proves useful.

Not tested in any way.

Thanks for the patch!

I fixed a few issues (see below) and gave this patch a try. Though in my case it doesn't seem to help much as the problem is somewhere before the matching actually happens. The only output from this patch I get is:

[    1.536479] imx219 1-0010: trying to complete
[    1.540856] imx219 1-0010: V4L2 device not available

Thanks
Frieder

Quoted 68 lines
 drivers/media/v4l2-core/v4l2-async.c | 41 ++++++++++++++++++++++++----
 1 file changed, 36 insertions(+), 5 deletions(-)
drivers/media/v4l2-core/v4l2-async.c +19 -3
index 2f1b718a9189..6c13a9488415 100644
@@ -86,13 +86,18 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	bool sd_fwnode_is_ep;
 	struct device *dev;
 
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);
+
 	/*
 	 * Both the subdev and the async subdev can provide either an endpoint
 	 * fwnode or a device fwnode. Start with the simple case of direct
 	 * fwnode matching.
 	 */
-	if (sd_fwnode == asd->match.fwnode)
+	if (sd_fwnode == asd->match.fwnode) {
+		dev_dbg(sd->dev, "true\n");
 		return true;
+	}
 
 	/*
 	 * Otherwise, check if the sd fwnode and the asd fwnode refer to an
@@ -105,8 +110,12 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	sd_fwnode_is_ep = fwnode_graph_is_endpoint(sd_fwnode);
 	asd_fwnode_is_ep = fwnode_graph_is_endpoint(asd->match.fwnode);
 
-	if (sd_fwnode_is_ep == asd_fwnode_is_ep)
+	dev_dbg(sd->dev, "async fwnode match %pfw vs. %pfw\n", sd_fwnode,
+		asd->match.fwnode);
+	if (sd_fwnode_is_ep == asd_fwnode_is_ep) {
+		dev_dbg(sd->dev, "unmatching node types (false)\n");
 		return false;
+	}
 
 	/*
 	 * The sd and asd fwnodes are of different types. Get the device fwnode
@@ -120,10 +129,15 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 		other_fwnode = sd_fwnode;
 	}
 
+	dev_dbg(sd->dev, "async fwnode (compat) match %pfw vs. %pfw\n",
+		dev_fwnode, other_fwnode);
+
 	fwnode_handle_put(dev_fwnode);
 
-	if (dev_fwnode != other_fwnode)
+	if (dev_fwnode != other_fwnode) {
+		dev_dbg(sd->dev, "false\n");
 		return false;
+	}
 
 	/*
 	 * We have a heterogeneous match. Retrieve the struct device of the side
@@ -143,6 +157,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 			   dev->driver->name);
 	}
 
+	dev_dbg(sd->dev, "true\n");
+
 	return true;
 }
 

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier) · line 276

Quoted 7 lines
drivers/media/v4l2-core/v4l2-async.c +3 -1
@@ -255,7 +271,10 @@ v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier)
 			v4l2_async_find_subdev_notifier(sd);
 
 		if (subdev_notifier &&
-		    !v4l2_async_nf_can_complete(subdev_notifier))
+		    !v4l2_async_nf_can_complete(subdev_notifier)) {
+			if (subdev_notifier->sd)
+				deb_dbg(subdev_notifier->sd->dev,

dev_dbg()

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_can_complete(struct v4l2_async_notifier *notifier) · line 278

Quoted 2 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+					"cannot complete\n");
 			return false;

missing }

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier) · line 296

Quoted 8 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
 	}
 
@@ -273,18 +292,27 @@ v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier)
 	if (!list_empty(&notifier->waiting))
 		return 0;
 
+	if (notifier->sd)
+		deb_dbg(notifier->sd->dev, "trying to complete\n");

dev_dbg()

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier) · line 305

Quoted 10 lines
drivers/media/v4l2-core/v4l2-async.c +4 -1
+
 	/* Check the entire notifier tree; find the root notifier first. */
 	while (notifier->parent)
 		notifier = notifier->parent;
 
 	/* This is root if it has v4l2_dev. */
-	if (!notifier->v4l2_dev)
+	if (!notifier->v4l2_dev) {
+		if (notifier->sd)
+			deb_dbg(notifier->sd->dev,

dev_dbg()

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_try_complete(struct v4l2_async_notifier *notifier) · line 314

Quoted 9 lines
drivers/media/v4l2-core/v4l2-async.c +3 -0
+				"V4L2 device not available\n");
 		return 0;
+	}
 
 	/* Is everything ready? */
 	if (!v4l2_async_nf_can_complete(notifier))
 		return 0;
 
+	deb_dbg(notifier->sd->dev, "complete\n");

missing guard "if (notifier->sd)"
dev_dbg()

drivers/media/v4l2-core/v4l2-async.c v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier) · line 417

Quoted 9 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
+
 	return v4l2_async_nf_call_complete(notifier);
 }
 
@@ -386,6 +414,9 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier)
 			continue;
 
 		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
+		deb_dbg(sd->dev, "bound to %s's notifier (ret %d)\n",

dev_dbg()

Quoted 5 lines
drivers/media/v4l2-core/v4l2-async.c +2 -0
+			notifier->sd ? dev_name(notifier->sd->dev) : "no-dev",
+			ret);
 		if (ret < 0)
 			return ret;
 
maintainer
#18 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

Quoted 16 lines · Frieder Schrempf

Hi Sakari,

Quoted 12 lines · Sakari Ailus

Just add some debug prints for V4L2 async sub-device matching process. These might come useful in figuring out why things don't work as expected.

---
Frieder,

Can you try this? It prints what is being matched with what. Perhaps this could be merged in a bit more refined form if it proves useful.

Not tested in any way.

Quoted 8 lines

Thanks for the patch!

I fixed a few issues (see below) and gave this patch a try. Though in my case it doesn't seem to help much as the problem is somewhere before the matching actually happens. The only output from this patch I get is:

[    1.536479] imx219 1-0010: trying to complete
[    1.540856] imx219 1-0010: V4L2 device not available

Yeah, the problem, as I understand, is a driver bug combined with a DTS bug... oh well.

So not a V4L2 async problem at all. :-)

Signature · 1 line
Sakari Ailus
#19 lore raw

Re: [RFC 1/1] v4l: async: Add some debug prints

Quoted 23 lines · Sakari Ailus
Quoted 22 lines · Frieder Schrempf

Hi Sakari,

Quoted 12 lines · Sakari Ailus

Just add some debug prints for V4L2 async sub-device matching process. These might come useful in figuring out why things don't work as expected.

---
Frieder,

Can you try this? It prints what is being matched with what. Perhaps this could be merged in a bit more refined form if it proves useful.

Not tested in any way.

Thanks for the patch!

I fixed a few issues (see below) and gave this patch a try. Though in my case it doesn't seem to help much as the problem is somewhere before the matching actually happens. The only output from this patch I get is:

Quoted 7 lines
Quoted 2 lines
[    1.536479] imx219 1-0010: trying to complete
[    1.540856] imx219 1-0010: V4L2 device not available

Yeah, the problem, as I understand, is a driver bug combined with a DTS bug... oh well.

So not a V4L2 async problem at all. :-)

Correct! Thanks for your help anyway!

maintainer
#20 lore raw
In reply to Frieder Schrempf
Quoted 41 lines · Frieder Schrempf
Quoted 29 lines · Laurent Pinchart
Quoted 28 lines · Frieder Schrempf
Quoted 16 lines · Laurent Pinchart
Quoted 15 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Quoted 6 lines
Quoted 2 lines

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Yes, the imx219_probe() works just fine and returns with code 0. I also see v4l2_async_register_subdev_sensor() and the underlying code being called.

Quoted 7 lines
Quoted 2 lines

So I really don't understand why I'm missing the sensor subdev. Any ideas how to continue debugging?

The issue seems to be with v4l2-async then. There's a debugfs file that lists the missing v4l2-async subdevs (I don't recall the path by heard), that can give useful information. Enabling the debug messages from v4l2-async.c may helpt too.

+Cc: Dave, Sakari, Javier (thanks for your help and debugging hints via mail/IRC)

Quoted 8 lines

/sys/kernel/debug/v4l2-async/pending_async_subdevices gives me:

csis-32e30000.mipi-csi:
[fwnode] dev=1-0010, node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint
imx219 1-0010:
imx-media:

So it looks like the async subdev for the imx219 sensor is still pending.

Indeed, that seems to be the problem.

Quoted 7 lines

I have spent quite a few hours trying to understand how the code is supposed to work, but I'm afraid it's too much for my brain at the moment ;)

I have attached a debug patch [1] adding printks in v4l2-async.c and the boot log [2] with all the output below. Hopefully someone can have a look and make something out of that. Feel free to let me know via email or IRC if I can provide any further information.

To be honest your debug messages are quite cryptic. They may be readable when tracing the code on a live system, but offline, that's a different story.

More comments below.

Quoted 190 lines
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.2.0-rc7-ktn (oe-user@oe-host) (aarch64-ktn-linux-gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT Tue Feb  7 08:25:13 UTC 2023
[    0.000000] Machine model: Kontron BL i.MX8MM (N801X S)
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x13f7c2b00-0x13f7c4fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x00000000ffffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000013fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] cma: Reserved 1024 MiB at 0x00000000bbe00000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 20 pages/cpu s42024 r8192 d31704 u81920
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] CPU features: detected: ARM erratum 845719
[    0.000000] alternatives: applying boot alternatives
[    0.000000] Fallback order for Node 0: 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1032192
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: root=/dev/nfs ip=192.168.1.11:192.168.1.10:::kontron-mx8mm:eth0:any nfsroot=192.168.1.10:/nfsroot,v3,tcp cma=1G rootwait
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: area num 4.
[    0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[    0.000000] Memory: 2976216K/4194304K available (13568K kernel code, 1222K rwdata, 4840K rodata, 2368K init, 545K bss, 169512K reserved, 1048576K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 128 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv3: GICv3 features: 16 PPIs
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000038880000
[    0.000000] ITS: No ITS available, not enabling LPIs
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] arch_timer: cp15 timer(s) running at 8.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[    0.000000] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[    0.000353] Console: colour dummy device 80x25
[    0.000363] printk: console [tty0] enabled
[    0.000858] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=32000)
[    0.000881] pid_max: default: 32768 minimum: 301
[    0.000940] LSM: initializing lsm=capability,integrity
[    0.001043] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.001072] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.002504] rcu: Hierarchical SRCU implementation.
[    0.002526] rcu: 	Max phase no-delay instances is 1000.
[    0.003357] EFI services will not be available.
[    0.003583] smp: Bringing up secondary CPUs ...
[    0.004061] Detected VIPT I-cache on CPU1
[    0.004136] GICv3: CPU1: found redistributor 1 region 0:0x00000000388a0000
[    0.004178] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.004649] Detected VIPT I-cache on CPU2
[    0.004712] GICv3: CPU2: found redistributor 2 region 0:0x00000000388c0000
[    0.004736] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.005177] Detected VIPT I-cache on CPU3
[    0.005238] GICv3: CPU3: found redistributor 3 region 0:0x00000000388e0000
[    0.005259] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.005316] smp: Brought up 1 node, 4 CPUs
[    0.005403] SMP: Total of 4 processors activated.
[    0.005414] CPU features: detected: 32-bit EL0 Support
[    0.005424] CPU features: detected: 32-bit EL1 Support
[    0.005440] CPU features: detected: CRC32 instructions
[    0.005506] CPU: All CPU(s) started at EL2
[    0.005524] alternatives: applying system-wide alternatives
[    0.007432] devtmpfs: initialized
[    0.013542] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.013594] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.043563] pinctrl core: initialized pinctrl subsystem
[    0.045549] DMI not present or invalid.
[    0.046159] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.047073] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[    0.047276] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.047441] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.047501] audit: initializing netlink subsys (disabled)
[    0.047623] audit: type=2000 audit(0.044:1): state=initialized audit_enabled=0 res=1
[    0.048000] thermal_sys: Registered thermal governor 'step_wise'
[    0.048033] cpuidle: using governor menu
[    0.048199] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.048287] ASID allocator initialised with 65536 entries
[    0.048955] Serial: AMBA PL011 UART driver
[    0.055254] imx8mm-pinctrl 30330000.pinctrl: initialized IMX pinctrl driver
[    0.066886] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
[    0.066917] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page
[    0.066932] HugeTLB: registered 32.0 MiB page size, pre-allocated 0 pages
[    0.066944] HugeTLB: 508 KiB vmemmap can be freed for a 32.0 MiB page
[    0.066958] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[    0.066972] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[    0.066987] HugeTLB: registered 64.0 KiB page size, pre-allocated 0 pages
[    0.067000] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
[    0.068588] ACPI: Interpreter disabled.
[    0.069385] iommu: Default domain type: Translated
[    0.069405] iommu: DMA domain TLB invalidation policy: strict mode
[    0.069649] SCSI subsystem initialized
[    0.069932] usbcore: registered new interface driver usbfs
[    0.069969] usbcore: registered new interface driver hub
[    0.070007] usbcore: registered new device driver usb
[    0.070643] mc: Linux media interface: v0.10
[    0.070690] videodev: Linux video capture interface: v2.00
[    0.070754] pps_core: LinuxPPS API ver. 1 registered
[    0.070765] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.070791] PTP clock support registered
[    0.070920] EDAC MC: Ver: 3.0.0
[    0.071496] FPGA manager framework
[    0.071573] Advanced Linux Sound Architecture Driver Initialized.
[    0.072353] vgaarb: loaded
[    0.072652] clocksource: Switched to clocksource arch_sys_counter
[    0.072831] VFS: Disk quotas dquot_6.6.0
[    0.072867] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.073038] pnp: PnP ACPI: disabled
[    0.079203] NET: Registered PF_INET protocol family
[    0.079432] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.082247] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
[    0.082335] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.082361] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.082592] TCP bind hash table entries: 32768 (order: 8, 1048576 bytes, linear)
[    0.083553] TCP: Hash tables configured (established 32768 bind 32768)
[    0.083705] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.083806] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.084021] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.084433] RPC: Registered named UNIX socket transport module.
[    0.084451] RPC: Registered udp transport module.
[    0.084462] RPC: Registered tcp transport module.
[    0.084474] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.084493] PCI: CLS 0 bytes, default 64
[    0.085132] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.085846] kvm [1]: IPA Size Limit: 40 bits
[    0.087132] kvm [1]: GICv3: no GICV resource entry
[    0.087146] kvm [1]: disabling GICv2 emulation
[    0.087164] kvm [1]: GIC system register CPU interface enabled
[    0.087258] kvm [1]: vgic interrupt IRQ9
[    0.087360] kvm [1]: Hyp mode initialized successfully
[    0.088486] Initialise system trusted keyrings
[    0.088687] workingset: timestamp_bits=42 max_order=20 bucket_order=0
[    0.088988] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.089207] NFS: Registering the id_resolver key type
[    0.089262] Key type id_resolver registered
[    0.089274] Key type id_legacy registered
[    0.089303] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.089317] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.089466] 9p: Installing v9fs 9p2000 file system support
[    0.124669] Key type asymmetric registered
[    0.124683] Asymmetric key parser 'x509' registered
[    0.124735] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    0.124753] io scheduler mq-deadline registered
[    0.124764] io scheduler kyber registered
[    0.128006] EINJ: ACPI disabled.
[    0.136799] SoC: i.MX8MM revision 1.0
[    0.141870] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.143967] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 16, base_baud = 1500000) is a IMX
[    0.144488] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 17, base_baud = 1500000) is a IMX
[    0.144522] imx-uart 30880000.serial: Console IMX rounded baud rate from 114286 to 114300
[    0.144571] printk: console [ttymxc2] enabled
[    1.126108] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 18, base_baud = 1500000) is a IMX
[    1.144256] loop: module loaded
[    1.150889] tun: Universal TUN/TAP device driver, 1.6
[    1.156153] CAN device driver interface
[    1.160606] thunder_xcv, ver 1.0
[    1.163879] thunder_bgx, ver 1.0
[    1.167145] nicpf, ver 1.0
[    1.170627] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    1.177871] hns3: Copyright (c) 2017 Huawei Corporation.
[    1.183231] hclge is initializing
[    1.186586] e1000e: Intel(R) PRO/1000 Network Driver
[    1.191565] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.197519] igb: Intel(R) Gigabit Ethernet Network Driver
[    1.202932] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.208538] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    1.214821] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    1.220881] sky2: driver version 1.30
[    1.225044] VFIO - User Level meta-driver version: 0.3
[    1.231934] usbcore: registered new interface driver usb-storage
[    1.240846] snvs_rtc 30370000.snvs:snvs-rtc-lp: registered as rtc0
[    1.247080] snvs_rtc 30370000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01T00:00:00 UTC (0)
Quoted 8 lines
[    1.256271] i2c_dev: i2c /dev entries driver
[    1.261317] imx7-csi 32e20000.csi: Registered csi capture as /dev/video0
[    1.268186] __v4l2_async_nf_register:610
[    1.272130]   imx-media:
[    1.274676] v4l2_async_nf_try_all_subdevs:447
[    1.279048]   imx-media:
[    1.281593] v4l2_async_nf_try_all_subdevs:454
[    1.285965] imx7_csi_notify_complete:2178

This doesn't seem right. The complete function should only be called once all the subdevices required by the notifier have been found, and at this point, the csis hasn't even probed. You may want to check the device tree.

Quoted 475 lines
[    1.291153] i.mx8mm_thermal 30260000.tmu: No OCOTP nvmem reference found, SoC-specific calibration not loaded. Please update your DT.
[    1.303945] ghes_edac: GHES probing device list is empty
[    1.304979] sdhci: Secure Digital Host Controller Interface driver
[    1.316524] sdhci: Copyright(c) Pierre Ossman
[    1.321082] Synopsys Designware Multimedia Card Interface Driver
[    1.327600] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.334945] ledtrig-cpu: registered to indicate activity on CPUs
[    1.341184] SMCCC: SOC_ID: ARCH_SOC_ID not implemented, skipping ....
[    1.348164] caam 30900000.crypto: device ID = 0x0a16040100000000 (Era 9)
[    1.354896] caam 30900000.crypto: job rings = 2, qi = 0
[    1.362676] caam algorithms registered in /proc/crypto
[    1.368007] caam 30900000.crypto: caam pkc algorithms registered in /proc/crypto
[    1.375430] caam 30900000.crypto: registering rng-caam
[    1.382285] caam 30900000.crypto: rng crypto API alg registered prng-caam
[    1.390544] usbcore: registered new interface driver usbhid
[    1.396148] usbhid: USB HID core driver
[    1.404433] NET: Registered PF_PACKET protocol family
[    1.409533] can: controller area network core
[    1.413943] NET: Registered PF_CAN protocol family
[    1.418750] can: raw protocol
[    1.421735] can: broadcast manager protocol
[    1.425933] can: netlink gateway - max_hops=1
[    1.430383] 9pnet: Installing 9P2000 support
[    1.434710] Key type dns_resolver registered
[    1.448009] Loading compiled-in X.509 certificates
[    1.471560] gpio gpiochip0: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.481811] gpio gpiochip1: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.492337] gpio gpiochip2: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.501638] random: crng init done
[    1.502850] gpio gpiochip3: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.515529] gpio gpiochip4: Static allocation of GPIO base is deprecated, use dynamic allocation.
[    1.526485] usb_phy_generic usbphynop1: dummy supplies not allowed for exclusive requests
[    1.534906] usb_phy_generic usbphynop2: dummy supplies not allowed for exclusive requests
[    1.563552] nxp-pca9450 0-0025: pca9450a probed.
[    1.568286] i2c i2c-0: IMX I2C adapter registered
[    1.574158] i2c 1-0010: Fixing up cyclic dependency with 32e30000.mipi-csi
[    1.581331] imx219 1-0010: supply VANA not found, using dummy regulator
[    1.588140] imx219 1-0010: supply VDDL not found, using dummy regulator
[    1.604714] v4l2_async_register_subdev_sensor:1296
[    1.609531] v4l2_async_register_subdev_sensor:1311
[    1.614336] __v4l2_async_nf_register:610
[    1.618273]   imx219 1-0010:
[    1.621166] v4l2_async_nf_try_all_subdevs:447
[    1.625534]   imx219 1-0010:
[    1.628423]   imx-media:
[    1.630968] v4l2_async_register_subdev_sensor:1317
[    1.635773] v4l2_async_register_subdev:858
[    1.639880]   imx219 1-0010:
[    1.642771]   imx-media:
[    1.645317] v4l2_async_register_subdev:866
[    1.649426]   imx219 1-0010:
[    1.652309] v4l2_async_register_subdev:866
[    1.656422]   imx-media:
[    1.658964] v4l2_async_register_subdev:872
[    1.663075] v4l2_async_find_match:231
[    1.666749] v4l2_async_register_subdev_sensor:1323
[    1.671693] i2c i2c-1: IMX I2C adapter registered
[    1.678216] rtc-rv8803 3-0032: An alarm maybe have been missed.
[    1.689415] rtc-rv8803 3-0032: registered as rtc1
[    1.694258] i2c i2c-3: IMX I2C adapter registered
[    1.701296] imx6q-pcie 33800000.pcie: host bridge /soc@0/pcie@33800000 ranges:
[    1.708603] imx6q-pcie 33800000.pcie:       IO 0x001ff80000..0x001ff8ffff -> 0x0000000000
[    1.710257] etnaviv etnaviv: bound 38000000.gpu (ops gpu_ops)
[    1.716820] imx6q-pcie 33800000.pcie:      MEM 0x0018000000..0x001fefffff -> 0x0018000000
[    1.723602] etnaviv etnaviv: bound 38008000.gpu (ops gpu_ops)
[    1.736530] etnaviv-gpu 38000000.gpu: model: GC600, revision: 4653
[    1.742802] etnaviv-gpu 38000000.gpu: Need to move linear window on MC1.0, disabling TS
[    1.750837] etnaviv-gpu 38008000.gpu: model: GC520, revision: 5341
[    1.758304] [drm] Initialized etnaviv 1.3.0 20151214 for etnaviv on minor 0
[    1.768636] pps pps0: new PPS source ptp0
[    1.839197] fec 30be0000.ethernet eth0: registered PHC device 0
[    1.945171] imx6q-pcie 33800000.pcie: iATU: unroll T, 4 ob, 4 ib, align 64K, limit 4G
[    1.960957] ci_hdrc ci_hdrc.1: EHCI Host Controller
[    1.965895] ci_hdrc ci_hdrc.1: new USB bus registered, assigned bus number 1
[    1.989045] ci_hdrc ci_hdrc.1: USB 2.0 started, EHCI 1.00
[    1.995595] hub 1-0:1.0: USB hub found
[    1.999385] hub 1-0:1.0: 1 port detected
[    2.005195] pwm-beeper pwm-beeper: supply amp not found, using dummy regulator
[    2.012684] input: pwm-beeper as /devices/platform/pwm-beeper/input/input0
[    2.021068] __v4l2_async_nf_register:610
[    2.025028]   csis-32e30000.mipi-csi:
[    2.028714] __v4l2_async_nf_register:619
[    2.032653]  [fwnode] dev=1-0010, node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint
[    2.041386] __v4l2_async_nf_register:625
[    2.045323] v4l2_async_nf_try_all_subdevs:447
[    2.049694]   csis-32e30000.mipi-csi:
[    2.053375]   imx219 1-0010:
[    2.053677] imx6q-pcie 33800000.pcie: PCIe Gen.1 x1 link up
[    2.056256]   imx-media:
[    2.056259] v4l2_async_register_subdev:858
[    2.068481]   csis-32e30000.mipi-csi:
[    2.072157]  [fwnode] dev=1-0010, node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint
[    2.080888]   imx219 1-0010:
[    2.083772]   imx-media:
[    2.086319] v4l2_async_register_subdev:866
[    2.090426]   csis-32e30000.mipi-csi:
[    2.094099] v4l2_async_register_subdev:866
[    2.098210]   imx219 1-0010:
[    2.101103] v4l2_async_register_subdev:866
[    2.105211]   imx-media:
[    2.107752] v4l2_async_register_subdev:872
[    2.111860] v4l2_async_find_match:231
[    2.115586] imx-mipi-csis 32e30000.mipi-csi: lanes: 2, freq: 333000000
[    2.122481] imx-cpufreq-dt imx-cpufreq-dt: cpu speed grade 2 mkt segment 2 supported-hw 0x4 0x4
[    2.135942] sdhci-esdhc-imx 30b50000.mmc: Got CD GPIO
[    2.156722] imx6q-pcie 33800000.pcie: PCIe Gen.2 x1 link up
[    2.161522] mmc0: SDHCI controller on 30b40000.mmc [30b40000.mmc] using ADMA
[    2.162324] imx6q-pcie 33800000.pcie: Link up, Gen2
[    2.173599] mmc1: SDHCI controller on 30b50000.mmc [30b50000.mmc] using ADMA
[    2.174245] imx6q-pcie 33800000.pcie: PCIe Gen.2 x1 link up
[    2.187152] imx6q-pcie 33800000.pcie: PCI host bridge to bus 0000:00
[    2.193541] pci_bus 0000:00: root bus resource [bus 00-ff]
[    2.199042] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    2.205236] pci_bus 0000:00: root bus resource [mem 0x18000000-0x1fefffff]
[    2.212149] pci 0000:00:00.0: [16c3:abcd] type 01 class 0x060400
[    2.218177] pci 0000:00:00.0: reg 0x10: [mem 0x00000000-0x000fffff]
[    2.224462] pci 0000:00:00.0: reg 0x38: [mem 0x00000000-0x0000ffff pref]
[    2.228210] mmc1: host does not support reading read-only switch, assuming write-enable
[    2.231208] pci 0000:00:00.0: supports D1
[    2.243214] pci 0000:00:00.0: PME# supported from D0 D1 D3hot D3cold
[    2.251105] pci 0000:01:00.0: [1d79:2263] type 00 class 0x010802
[    2.257216] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00003fff 64bit]
[    2.262659] mmc0: new HS400 Enhanced strobe MMC card at address 0001
[    2.264520] pci 0000:01:00.0: 4.000 Gb/s available PCIe bandwidth, limited by 5.0 GT/s PCIe x1 link at 0000:00:00.0 (capable of 15.752 Gb/s with 8.0 GT/s PCIe x2 link)
[    2.264662] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[    2.271786] mmcblk0: mmc0:0001 032GB2 29.1 GiB
[    2.285638] pci 0000:00:00.0: BAR 0: assigned [mem 0x18000000-0x180fffff]
[    2.295739] mmcblk0boot0: mmc0:0001 032GB2 4.00 MiB
[    2.296312] pci 0000:00:00.0: BAR 14: assigned [mem 0x18100000-0x181fffff]
[    2.304956] mmcblk0boot1: mmc0:0001 032GB2 4.00 MiB
[    2.308058] pci 0000:00:00.0: BAR 6: assigned [mem 0x18200000-0x1820ffff pref]
[    2.316622] mmcblk0rpmb: mmc0:0001 032GB2 4.00 MiB, chardev (241:0)
[    2.319904] pci 0000:01:00.0: BAR 0: assigned [mem 0x18100000-0x18103fff 64bit]
[    2.340843] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    2.346091] pci 0000:00:00.0:   bridge window [mem 0x18100000-0x181fffff]
[    2.350724] mmc1: new ultra high speed SDR104 SDHC card at address aaaa
[    2.353190] pcieport 0000:00:00.0: PME: Signaling with IRQ 215
[    2.360527] mmcblk1: mmc1:aaaa SL16G 14.8 GiB
[    2.375373]  mmcblk1: p1 p2
[    2.428063] hub 1-1:1.0: USB hub found
[    2.432315] hub 1-1:1.0: 5 ports detected
[    2.512067] Microsemi VSC8531 30be0000.ethernet-1:00: attached PHY driver (mii_bus:phy_addr=30be0000.ethernet-1:00, irq=POLL)
[    2.729028] usb 1-1.1: new high-speed USB device number 3 using ci_hdrc
[    5.602118] fec 30be0000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[    5.625029] IP-Config: Guessing netmask 255.255.255.0
[    5.630108] IP-Config: Complete:
[    5.633354]      device=eth0, hwaddr=70:82:0e:13:9a:32, ipaddr=192.168.1.11, mask=255.255.255.0, gw=255.255.255.255
[    5.643814]      host=kontron-mx8mm, domain=, nis-domain=(none)
[    5.649751]      bootserver=192.168.1.10, rootserver=192.168.1.10, rootpath=
[    5.651593] ALSA device list:
[    5.661655]   No soundcards found.
[    5.688286] VFS: Mounted root (nfs filesystem) readonly on device 0:20.
[    5.696353] devtmpfs: mounted
[    5.699869] Freeing unused kernel memory: 2368K
[    5.708679] Run /sbin/init as init process
drivers/media/platform/nxp/imx-mipi-csis.c +2 -0
index 905072871ed2..eb35657bb7a2 100644
@@ -1275,6 +1275,8 @@ static int mipi_csis_notify_bound(struct v4l2_async_notifier *notifier,
 	struct mipi_csis_device *csis = mipi_notifier_to_csis_state(notifier);
 	struct media_pad *sink = &csis->sd.entity.pads[CSIS_PAD_SINK];
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	return v4l2_create_fwnode_links_to_pad(sd, sink, 0);
 }
 
drivers/media/platform/nxp/imx7-media-csi.c +4 -0
index 886374d3a6ff..6fc7bafdd436 100644
@@ -2165,6 +2165,8 @@ static int imx7_csi_notify_bound(struct v4l2_async_notifier *notifier,
 
 	csi->src_sd = sd;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	return v4l2_create_fwnode_links_to_pad(sd, sink, MEDIA_LNK_FL_ENABLED |
 					       MEDIA_LNK_FL_IMMUTABLE);
 }
@@ -2173,6 +2175,8 @@ static int imx7_csi_notify_complete(struct v4l2_async_notifier *notifier)
 {
 	struct imx7_csi *csi = imx7_csi_notifier_to_dev(notifier);
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	return v4l2_device_register_subdev_nodes(&csi->v4l2_dev);
 }
 
drivers/media/v4l2-core/v4l2-async.c +99 -11
index 2f1b718a9189..820abb5ce77c 100644
@@ -86,6 +86,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	bool sd_fwnode_is_ep;
 	struct device *dev;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	/*
 	 * Both the subdev and the async subdev can provide either an endpoint
 	 * fwnode or a device fwnode. Start with the simple case of direct
@@ -94,6 +96,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	if (sd_fwnode == asd->match.fwnode)
 		return true;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	/*
 	 * Otherwise, check if the sd fwnode and the asd fwnode refer to an
 	 * endpoint or a device. If they're of the same type, there's no match.
@@ -108,6 +112,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	if (sd_fwnode_is_ep == asd_fwnode_is_ep)
 		return false;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	/*
 	 * The sd and asd fwnodes are of different types. Get the device fwnode
 	 * parent of the endpoint fwnode, and compare it with the other fwnode.
@@ -125,6 +131,8 @@ match_fwnode_one(struct v4l2_async_notifier *notifier,
 	if (dev_fwnode != other_fwnode)
 		return false;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	/*
 	 * We have a heterogeneous match. Retrieve the struct device of the side
 	 * that matched on a device fwnode to print its driver name.
@@ -163,6 +171,55 @@ static LIST_HEAD(subdev_list);
 static LIST_HEAD(notifier_list);
 static DEFINE_MUTEX(list_lock);
 
+static const char *
+v4l2_async_nf_name(struct v4l2_async_notifier *notifier)
+{
+	if (notifier->v4l2_dev)
+		return notifier->v4l2_dev->name;
+	else if (notifier->sd)
+		return notifier->sd->name;
+	else
+		return "nil";
+}
+
+static void print_subdev(struct v4l2_async_subdev *asd)
+{
+	switch (asd->match_type) {
+	case V4L2_ASYNC_MATCH_I2C:
+		printk(" [i2c] dev=%d-%04x\n", asd->match.i2c.adapter_id,
+			   asd->match.i2c.address);
+		break;
+	case V4L2_ASYNC_MATCH_FWNODE: {
+		struct fwnode_handle *devnode, *fwnode = asd->match.fwnode;
+
+		devnode = fwnode_graph_is_endpoint(fwnode) ?
+			  fwnode_graph_get_port_parent(fwnode) :
+			  fwnode_handle_get(fwnode);
+
+		printk(" [fwnode] dev=%s, node=%pfw\n",
+			   devnode->dev ? dev_name(devnode->dev) : "nil",
+			   fwnode);
+
+		fwnode_handle_put(devnode);
+		break;
+	}
+	}
+}
+
+static int print_notifiers_subdevs(void)
+{
+	struct v4l2_async_notifier *notif;
+	struct v4l2_async_subdev *asd;
+
+	list_for_each_entry(notif, &notifier_list, list) {
+		printk("  %s:\n", v4l2_async_nf_name(notif));
+		list_for_each_entry(asd, &notif->waiting, list)
+			print_subdev(asd);
+	}
+
+	return 0;
+}
+
 static struct v4l2_async_subdev *
 v4l2_async_find_match(struct v4l2_async_notifier *notifier,
 		      struct v4l2_subdev *sd)
@@ -171,7 +228,11 @@ v4l2_async_find_match(struct v4l2_async_notifier *notifier,
 		      struct v4l2_subdev *sd, struct v4l2_async_subdev *asd);
 	struct v4l2_async_subdev *asd;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	list_for_each_entry(asd, &notifier->waiting, list) {
+		printk("%s:%d\n", __func__, __LINE__);
+		print_subdev(asd);
 		/* bus_type has been verified valid before */
 		switch (asd->match_type) {
 		case V4L2_ASYNC_MATCH_I2C:
@@ -317,16 +378,22 @@ static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
 	struct v4l2_async_notifier *subdev_notifier;
 	int ret;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	ret = v4l2_device_register_subdev(v4l2_dev, sd);
 	if (ret < 0)
 		return ret;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	ret = v4l2_async_nf_call_bound(notifier, sd, asd);
 	if (ret < 0) {
 		v4l2_device_unregister_subdev(sd);
 		return ret;
 	}
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	/*
 	 * Depending of the function of the entities involved, we may want to
 	 * create links between them (for example between a sensor and its lens
@@ -340,6 +407,8 @@ static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
 		return ret;
 	}
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	/* Remove from the waiting list */
 	list_del(&asd->list);
 	sd->asd = asd;
@@ -355,6 +424,8 @@ static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
 	if (!subdev_notifier || subdev_notifier->parent)
 		return 0;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	/*
 	 * Proceed with checking for the sub-device notifier's async
 	 * sub-devices, and return the result. The error will be handled by the
@@ -373,18 +444,29 @@ v4l2_async_nf_try_all_subdevs(struct v4l2_async_notifier *notifier)
 		v4l2_async_nf_find_v4l2_dev(notifier);
 	struct v4l2_subdev *sd;
 
+	printk("%s:%d\n", __func__, __LINE__);
+	printk("  %s:\n", v4l2_async_nf_name(notifier));
+	print_notifiers_subdevs();
+
 	if (!v4l2_dev)
 		return 0;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 again:
 	list_for_each_entry(sd, &subdev_list, async_list) {
 		struct v4l2_async_subdev *asd;
 		int ret;
 
+		printk("%s:%d\n", __func__, __LINE__);
+
 		asd = v4l2_async_find_match(notifier, sd);
 		if (!asd)
 			continue;
 
+		printk("%s:%d\n", __func__, __LINE__);
+		print_subdev(asd);
+
 		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
 		if (ret < 0)
 			return ret;
@@ -525,16 +607,22 @@ static int __v4l2_async_nf_register(struct v4l2_async_notifier *notifier)
 	struct v4l2_async_subdev *asd;
 	int ret, i = 0;
 
+	printk("%s:%d\n", __func__, __LINE__);
+	printk("  %s:\n", v4l2_async_nf_name(notifier));
+
 	INIT_LIST_HEAD(&notifier->waiting);
 	INIT_LIST_HEAD(&notifier->done);
 
 	mutex_lock(&list_lock);
 
 	list_for_each_entry(asd, &notifier->asd_list, asd_list) {
+		printk("%s:%d\n", __func__, __LINE__);
+		print_subdev(asd);
 		ret = v4l2_async_nf_asd_valid(notifier, asd, i++);
 		if (ret)
 			goto err_unlock;
 
+		printk("%s:%d\n", __func__, __LINE__);
 		list_add_tail(&asd->list, &notifier->waiting);
 	}
 
@@ -767,18 +855,29 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
 
 	INIT_LIST_HEAD(&sd->async_list);
 
+	printk("%s:%d\n", __func__, __LINE__);
+	print_notifiers_subdevs();
+
 	list_for_each_entry(notifier, &notifier_list, list) {
 		struct v4l2_device *v4l2_dev =
 			v4l2_async_nf_find_v4l2_dev(notifier);
 		struct v4l2_async_subdev *asd;
 
+		printk("%s:%d\n", __func__, __LINE__);
+		printk("  %s:\n", v4l2_async_nf_name(notifier));
+
 		if (!v4l2_dev)
 			continue;
 
+		printk("%s:%d\n", __func__, __LINE__);
+
 		asd = v4l2_async_find_match(notifier, sd);
 		if (!asd)
 			continue;
 
+		printk("%s:%d\n", __func__, __LINE__);
+		print_subdev(asd);
+
 		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
 		if (ret)
 			goto err_unbind;
@@ -868,17 +967,6 @@ static void print_waiting_subdev(struct seq_file *s,
 	}
 }
 
-static const char *
-v4l2_async_nf_name(struct v4l2_async_notifier *notifier)
-{
-	if (notifier->v4l2_dev)
-		return notifier->v4l2_dev->name;
-	else if (notifier->sd)
-		return notifier->sd->name;
-	else
-		return "nil";
-}
-
 static int pending_subdevs_show(struct seq_file *s, void *data)
 {
 	struct v4l2_async_notifier *notif;
drivers/media/v4l2-core/v4l2-fwnode.c +8 -0
index 3d9533c1b202..45ed62b16327 100644
@@ -1293,6 +1293,8 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
 	struct v4l2_async_notifier *notifier;
 	int ret;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	if (WARN_ON(!sd->dev))
 		return -ENODEV;
 
@@ -1306,14 +1308,20 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)
 	if (ret < 0)
 		goto out_cleanup;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	ret = v4l2_async_subdev_nf_register(sd, notifier);
 	if (ret < 0)
 		goto out_cleanup;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	ret = v4l2_async_register_subdev(sd);
 	if (ret < 0)
 		goto out_unregister;
 
+	printk("%s:%d\n", __func__, __LINE__);
+
 	sd->subdev_notifier = notifier;
 
 	return 0;
Signature · 3 lines
Regards,

Laurent Pinchart
#21 lore raw

Hi Laurent,

Quoted 56 lines · Laurent Pinchart
Quoted 41 lines · Frieder Schrempf
Quoted 29 lines · Laurent Pinchart
Quoted 28 lines · Frieder Schrempf
Quoted 16 lines · Laurent Pinchart
Quoted 15 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Quoted 6 lines
Quoted 2 lines

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Yes, the imx219_probe() works just fine and returns with code 0. I also see v4l2_async_register_subdev_sensor() and the underlying code being called.

Quoted 7 lines
Quoted 2 lines

So I really don't understand why I'm missing the sensor subdev. Any ideas how to continue debugging?

The issue seems to be with v4l2-async then. There's a debugfs file that lists the missing v4l2-async subdevs (I don't recall the path by heard), that can give useful information. Enabling the debug messages from v4l2-async.c may helpt too.

+Cc: Dave, Sakari, Javier (thanks for your help and debugging hints via mail/IRC)

Quoted 8 lines

/sys/kernel/debug/v4l2-async/pending_async_subdevices gives me:

csis-32e30000.mipi-csi:
[fwnode] dev=1-0010, node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint
imx219 1-0010:
imx-media:

So it looks like the async subdev for the imx219 sensor is still pending.

Indeed, that seems to be the problem.

Quoted 3 lines

I have spent quite a few hours trying to understand how the code is supposed to work, but I'm afraid it's too much for my brain at the moment ;)

Quoted 8 lines
Quoted 4 lines

I have attached a debug patch [1] adding printks in v4l2-async.c and the boot log [2] with all the output below. Hopefully someone can have a look and make something out of that. Feel free to let me know via email or IRC if I can provide any further information.

To be honest your debug messages are quite cryptic. They may be readable when tracing the code on a live system, but offline, that's a different story.

I know. Sorry for that. I just posted what I hacked together for understanding the code flow. Sakari's debug patch is a better start, but it doesn't really cover the problem I see, as the matching code is never called. The issue is elsewhere and causes the fwnode matching to not take place at all.

Quoted 202 lines

More comments below.

Quoted 190 lines
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.2.0-rc7-ktn (oe-user@oe-host) (aarch64-ktn-linux-gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT Tue Feb  7 08:25:13 UTC 2023
[    0.000000] Machine model: Kontron BL i.MX8MM (N801X S)
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x13f7c2b00-0x13f7c4fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x00000000ffffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000013fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] cma: Reserved 1024 MiB at 0x00000000bbe00000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 20 pages/cpu s42024 r8192 d31704 u81920
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] CPU features: detected: ARM erratum 845719
[    0.000000] alternatives: applying boot alternatives
[    0.000000] Fallback order for Node 0: 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1032192
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: root=/dev/nfs ip=192.168.1.11:192.168.1.10:::kontron-mx8mm:eth0:any nfsroot=192.168.1.10:/nfsroot,v3,tcp cma=1G rootwait
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: area num 4.
[    0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[    0.000000] Memory: 2976216K/4194304K available (13568K kernel code, 1222K rwdata, 4840K rodata, 2368K init, 545K bss, 169512K reserved, 1048576K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 128 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv3: GICv3 features: 16 PPIs
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000038880000
[    0.000000] ITS: No ITS available, not enabling LPIs
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] arch_timer: cp15 timer(s) running at 8.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[    0.000000] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[    0.000353] Console: colour dummy device 80x25
[    0.000363] printk: console [tty0] enabled
[    0.000858] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=32000)
[    0.000881] pid_max: default: 32768 minimum: 301
[    0.000940] LSM: initializing lsm=capability,integrity
[    0.001043] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.001072] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.002504] rcu: Hierarchical SRCU implementation.
[    0.002526] rcu: 	Max phase no-delay instances is 1000.
[    0.003357] EFI services will not be available.
[    0.003583] smp: Bringing up secondary CPUs ...
[    0.004061] Detected VIPT I-cache on CPU1
[    0.004136] GICv3: CPU1: found redistributor 1 region 0:0x00000000388a0000
[    0.004178] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.004649] Detected VIPT I-cache on CPU2
[    0.004712] GICv3: CPU2: found redistributor 2 region 0:0x00000000388c0000
[    0.004736] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.005177] Detected VIPT I-cache on CPU3
[    0.005238] GICv3: CPU3: found redistributor 3 region 0:0x00000000388e0000
[    0.005259] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.005316] smp: Brought up 1 node, 4 CPUs
[    0.005403] SMP: Total of 4 processors activated.
[    0.005414] CPU features: detected: 32-bit EL0 Support
[    0.005424] CPU features: detected: 32-bit EL1 Support
[    0.005440] CPU features: detected: CRC32 instructions
[    0.005506] CPU: All CPU(s) started at EL2
[    0.005524] alternatives: applying system-wide alternatives
[    0.007432] devtmpfs: initialized
[    0.013542] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.013594] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.043563] pinctrl core: initialized pinctrl subsystem
[    0.045549] DMI not present or invalid.
[    0.046159] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.047073] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[    0.047276] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.047441] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.047501] audit: initializing netlink subsys (disabled)
[    0.047623] audit: type=2000 audit(0.044:1): state=initialized audit_enabled=0 res=1
[    0.048000] thermal_sys: Registered thermal governor 'step_wise'
[    0.048033] cpuidle: using governor menu
[    0.048199] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.048287] ASID allocator initialised with 65536 entries
[    0.048955] Serial: AMBA PL011 UART driver
[    0.055254] imx8mm-pinctrl 30330000.pinctrl: initialized IMX pinctrl driver
[    0.066886] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
[    0.066917] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page
[    0.066932] HugeTLB: registered 32.0 MiB page size, pre-allocated 0 pages
[    0.066944] HugeTLB: 508 KiB vmemmap can be freed for a 32.0 MiB page
[    0.066958] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[    0.066972] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[    0.066987] HugeTLB: registered 64.0 KiB page size, pre-allocated 0 pages
[    0.067000] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
[    0.068588] ACPI: Interpreter disabled.
[    0.069385] iommu: Default domain type: Translated
[    0.069405] iommu: DMA domain TLB invalidation policy: strict mode
[    0.069649] SCSI subsystem initialized
[    0.069932] usbcore: registered new interface driver usbfs
[    0.069969] usbcore: registered new interface driver hub
[    0.070007] usbcore: registered new device driver usb
[    0.070643] mc: Linux media interface: v0.10
[    0.070690] videodev: Linux video capture interface: v2.00
[    0.070754] pps_core: LinuxPPS API ver. 1 registered
[    0.070765] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.070791] PTP clock support registered
[    0.070920] EDAC MC: Ver: 3.0.0
[    0.071496] FPGA manager framework
[    0.071573] Advanced Linux Sound Architecture Driver Initialized.
[    0.072353] vgaarb: loaded
[    0.072652] clocksource: Switched to clocksource arch_sys_counter
[    0.072831] VFS: Disk quotas dquot_6.6.0
[    0.072867] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.073038] pnp: PnP ACPI: disabled
[    0.079203] NET: Registered PF_INET protocol family
[    0.079432] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.082247] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
[    0.082335] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.082361] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.082592] TCP bind hash table entries: 32768 (order: 8, 1048576 bytes, linear)
[    0.083553] TCP: Hash tables configured (established 32768 bind 32768)
[    0.083705] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.083806] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.084021] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.084433] RPC: Registered named UNIX socket transport module.
[    0.084451] RPC: Registered udp transport module.
[    0.084462] RPC: Registered tcp transport module.
[    0.084474] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.084493] PCI: CLS 0 bytes, default 64
[    0.085132] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.085846] kvm [1]: IPA Size Limit: 40 bits
[    0.087132] kvm [1]: GICv3: no GICV resource entry
[    0.087146] kvm [1]: disabling GICv2 emulation
[    0.087164] kvm [1]: GIC system register CPU interface enabled
[    0.087258] kvm [1]: vgic interrupt IRQ9
[    0.087360] kvm [1]: Hyp mode initialized successfully
[    0.088486] Initialise system trusted keyrings
[    0.088687] workingset: timestamp_bits=42 max_order=20 bucket_order=0
[    0.088988] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.089207] NFS: Registering the id_resolver key type
[    0.089262] Key type id_resolver registered
[    0.089274] Key type id_legacy registered
[    0.089303] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.089317] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.089466] 9p: Installing v9fs 9p2000 file system support
[    0.124669] Key type asymmetric registered
[    0.124683] Asymmetric key parser 'x509' registered
[    0.124735] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    0.124753] io scheduler mq-deadline registered
[    0.124764] io scheduler kyber registered
[    0.128006] EINJ: ACPI disabled.
[    0.136799] SoC: i.MX8MM revision 1.0
[    0.141870] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.143967] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 16, base_baud = 1500000) is a IMX
[    0.144488] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 17, base_baud = 1500000) is a IMX
[    0.144522] imx-uart 30880000.serial: Console IMX rounded baud rate from 114286 to 114300
[    0.144571] printk: console [ttymxc2] enabled
[    1.126108] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 18, base_baud = 1500000) is a IMX
[    1.144256] loop: module loaded
[    1.150889] tun: Universal TUN/TAP device driver, 1.6
[    1.156153] CAN device driver interface
[    1.160606] thunder_xcv, ver 1.0
[    1.163879] thunder_bgx, ver 1.0
[    1.167145] nicpf, ver 1.0
[    1.170627] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    1.177871] hns3: Copyright (c) 2017 Huawei Corporation.
[    1.183231] hclge is initializing
[    1.186586] e1000e: Intel(R) PRO/1000 Network Driver
[    1.191565] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.197519] igb: Intel(R) Gigabit Ethernet Network Driver
[    1.202932] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.208538] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    1.214821] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    1.220881] sky2: driver version 1.30
[    1.225044] VFIO - User Level meta-driver version: 0.3
[    1.231934] usbcore: registered new interface driver usb-storage
[    1.240846] snvs_rtc 30370000.snvs:snvs-rtc-lp: registered as rtc0
[    1.247080] snvs_rtc 30370000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01T00:00:00 UTC (0)
Quoted 8 lines
[    1.256271] i2c_dev: i2c /dev entries driver
[    1.261317] imx7-csi 32e20000.csi: Registered csi capture as /dev/video0
[    1.268186] __v4l2_async_nf_register:610
[    1.272130]   imx-media:
[    1.274676] v4l2_async_nf_try_all_subdevs:447
[    1.279048]   imx-media:
[    1.281593] v4l2_async_nf_try_all_subdevs:454
[    1.285965] imx7_csi_notify_complete:2178
Quoted 4 lines

This doesn't seem right. The complete function should only be called once all the subdevices required by the notifier have been found, and at this point, the csis hasn't even probed. You may want to check the device tree.

But it looks like the notifier for the csi doesn't have any subdev dependencies. The "imx-media: " shows that a notifier for the csi is in the notifier_list, but the notif->waiting is empty.

Is that correct? How is the dependency graph supposed to look like? Is it csi -> csis -> imx219 or the other way round? In the latter case the imx219 should wait for all the other subdevs, right?

Thanks
Frieder

[...]

maintainer
#22 lore raw

Hi Frieder,

Quoted 278 lines · Frieder Schrempf
Quoted 56 lines · Laurent Pinchart
Quoted 41 lines · Frieder Schrempf
Quoted 29 lines · Laurent Pinchart
Quoted 28 lines · Frieder Schrempf
Quoted 16 lines · Laurent Pinchart
Quoted 15 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Quoted 6 lines
Quoted 2 lines

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Yes, the imx219_probe() works just fine and returns with code 0. I also see v4l2_async_register_subdev_sensor() and the underlying code being called.

Quoted 7 lines
Quoted 2 lines

So I really don't understand why I'm missing the sensor subdev. Any ideas how to continue debugging?

The issue seems to be with v4l2-async then. There's a debugfs file that lists the missing v4l2-async subdevs (I don't recall the path by heard), that can give useful information. Enabling the debug messages from v4l2-async.c may helpt too.

+Cc: Dave, Sakari, Javier (thanks for your help and debugging hints via mail/IRC)

Quoted 8 lines

/sys/kernel/debug/v4l2-async/pending_async_subdevices gives me:

csis-32e30000.mipi-csi:
[fwnode] dev=1-0010, node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint
imx219 1-0010:
imx-media:

So it looks like the async subdev for the imx219 sensor is still pending.

Indeed, that seems to be the problem.

Quoted 3 lines

I have spent quite a few hours trying to understand how the code is supposed to work, but I'm afraid it's too much for my brain at the moment ;)

Quoted 8 lines
Quoted 4 lines

I have attached a debug patch [1] adding printks in v4l2-async.c and the boot log [2] with all the output below. Hopefully someone can have a look and make something out of that. Feel free to let me know via email or IRC if I can provide any further information.

To be honest your debug messages are quite cryptic. They may be readable when tracing the code on a live system, but offline, that's a different story.

I know. Sorry for that. I just posted what I hacked together for understanding the code flow. Sakari's debug patch is a better start, but it doesn't really cover the problem I see, as the matching code is never called. The issue is elsewhere and causes the fwnode matching to not take place at all.

Quoted 201 lines

More comments below.

Quoted 190 lines
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.2.0-rc7-ktn (oe-user@oe-host) (aarch64-ktn-linux-gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT Tue Feb  7 08:25:13 UTC 2023
[    0.000000] Machine model: Kontron BL i.MX8MM (N801X S)
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x13f7c2b00-0x13f7c4fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x00000000ffffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000013fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] cma: Reserved 1024 MiB at 0x00000000bbe00000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 20 pages/cpu s42024 r8192 d31704 u81920
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] CPU features: detected: ARM erratum 845719
[    0.000000] alternatives: applying boot alternatives
[    0.000000] Fallback order for Node 0: 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1032192
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: root=/dev/nfs ip=192.168.1.11:192.168.1.10:::kontron-mx8mm:eth0:any nfsroot=192.168.1.10:/nfsroot,v3,tcp cma=1G rootwait
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: area num 4.
[    0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[    0.000000] Memory: 2976216K/4194304K available (13568K kernel code, 1222K rwdata, 4840K rodata, 2368K init, 545K bss, 169512K reserved, 1048576K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 128 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv3: GICv3 features: 16 PPIs
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000038880000
[    0.000000] ITS: No ITS available, not enabling LPIs
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] arch_timer: cp15 timer(s) running at 8.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[    0.000000] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[    0.000353] Console: colour dummy device 80x25
[    0.000363] printk: console [tty0] enabled
[    0.000858] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=32000)
[    0.000881] pid_max: default: 32768 minimum: 301
[    0.000940] LSM: initializing lsm=capability,integrity
[    0.001043] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.001072] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.002504] rcu: Hierarchical SRCU implementation.
[    0.002526] rcu: 	Max phase no-delay instances is 1000.
[    0.003357] EFI services will not be available.
[    0.003583] smp: Bringing up secondary CPUs ...
[    0.004061] Detected VIPT I-cache on CPU1
[    0.004136] GICv3: CPU1: found redistributor 1 region 0:0x00000000388a0000
[    0.004178] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.004649] Detected VIPT I-cache on CPU2
[    0.004712] GICv3: CPU2: found redistributor 2 region 0:0x00000000388c0000
[    0.004736] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.005177] Detected VIPT I-cache on CPU3
[    0.005238] GICv3: CPU3: found redistributor 3 region 0:0x00000000388e0000
[    0.005259] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.005316] smp: Brought up 1 node, 4 CPUs
[    0.005403] SMP: Total of 4 processors activated.
[    0.005414] CPU features: detected: 32-bit EL0 Support
[    0.005424] CPU features: detected: 32-bit EL1 Support
[    0.005440] CPU features: detected: CRC32 instructions
[    0.005506] CPU: All CPU(s) started at EL2
[    0.005524] alternatives: applying system-wide alternatives
[    0.007432] devtmpfs: initialized
[    0.013542] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.013594] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.043563] pinctrl core: initialized pinctrl subsystem
[    0.045549] DMI not present or invalid.
[    0.046159] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.047073] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[    0.047276] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.047441] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.047501] audit: initializing netlink subsys (disabled)
[    0.047623] audit: type=2000 audit(0.044:1): state=initialized audit_enabled=0 res=1
[    0.048000] thermal_sys: Registered thermal governor 'step_wise'
[    0.048033] cpuidle: using governor menu
[    0.048199] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.048287] ASID allocator initialised with 65536 entries
[    0.048955] Serial: AMBA PL011 UART driver
[    0.055254] imx8mm-pinctrl 30330000.pinctrl: initialized IMX pinctrl driver
[    0.066886] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
[    0.066917] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page
[    0.066932] HugeTLB: registered 32.0 MiB page size, pre-allocated 0 pages
[    0.066944] HugeTLB: 508 KiB vmemmap can be freed for a 32.0 MiB page
[    0.066958] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[    0.066972] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[    0.066987] HugeTLB: registered 64.0 KiB page size, pre-allocated 0 pages
[    0.067000] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
[    0.068588] ACPI: Interpreter disabled.
[    0.069385] iommu: Default domain type: Translated
[    0.069405] iommu: DMA domain TLB invalidation policy: strict mode
[    0.069649] SCSI subsystem initialized
[    0.069932] usbcore: registered new interface driver usbfs
[    0.069969] usbcore: registered new interface driver hub
[    0.070007] usbcore: registered new device driver usb
[    0.070643] mc: Linux media interface: v0.10
[    0.070690] videodev: Linux video capture interface: v2.00
[    0.070754] pps_core: LinuxPPS API ver. 1 registered
[    0.070765] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.070791] PTP clock support registered
[    0.070920] EDAC MC: Ver: 3.0.0
[    0.071496] FPGA manager framework
[    0.071573] Advanced Linux Sound Architecture Driver Initialized.
[    0.072353] vgaarb: loaded
[    0.072652] clocksource: Switched to clocksource arch_sys_counter
[    0.072831] VFS: Disk quotas dquot_6.6.0
[    0.072867] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.073038] pnp: PnP ACPI: disabled
[    0.079203] NET: Registered PF_INET protocol family
[    0.079432] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.082247] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
[    0.082335] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.082361] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.082592] TCP bind hash table entries: 32768 (order: 8, 1048576 bytes, linear)
[    0.083553] TCP: Hash tables configured (established 32768 bind 32768)
[    0.083705] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.083806] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.084021] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.084433] RPC: Registered named UNIX socket transport module.
[    0.084451] RPC: Registered udp transport module.
[    0.084462] RPC: Registered tcp transport module.
[    0.084474] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.084493] PCI: CLS 0 bytes, default 64
[    0.085132] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.085846] kvm [1]: IPA Size Limit: 40 bits
[    0.087132] kvm [1]: GICv3: no GICV resource entry
[    0.087146] kvm [1]: disabling GICv2 emulation
[    0.087164] kvm [1]: GIC system register CPU interface enabled
[    0.087258] kvm [1]: vgic interrupt IRQ9
[    0.087360] kvm [1]: Hyp mode initialized successfully
[    0.088486] Initialise system trusted keyrings
[    0.088687] workingset: timestamp_bits=42 max_order=20 bucket_order=0
[    0.088988] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.089207] NFS: Registering the id_resolver key type
[    0.089262] Key type id_resolver registered
[    0.089274] Key type id_legacy registered
[    0.089303] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.089317] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.089466] 9p: Installing v9fs 9p2000 file system support
[    0.124669] Key type asymmetric registered
[    0.124683] Asymmetric key parser 'x509' registered
[    0.124735] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    0.124753] io scheduler mq-deadline registered
[    0.124764] io scheduler kyber registered
[    0.128006] EINJ: ACPI disabled.
[    0.136799] SoC: i.MX8MM revision 1.0
[    0.141870] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.143967] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 16, base_baud = 1500000) is a IMX
[    0.144488] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 17, base_baud = 1500000) is a IMX
[    0.144522] imx-uart 30880000.serial: Console IMX rounded baud rate from 114286 to 114300
[    0.144571] printk: console [ttymxc2] enabled
[    1.126108] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 18, base_baud = 1500000) is a IMX
[    1.144256] loop: module loaded
[    1.150889] tun: Universal TUN/TAP device driver, 1.6
[    1.156153] CAN device driver interface
[    1.160606] thunder_xcv, ver 1.0
[    1.163879] thunder_bgx, ver 1.0
[    1.167145] nicpf, ver 1.0
[    1.170627] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    1.177871] hns3: Copyright (c) 2017 Huawei Corporation.
[    1.183231] hclge is initializing
[    1.186586] e1000e: Intel(R) PRO/1000 Network Driver
[    1.191565] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.197519] igb: Intel(R) Gigabit Ethernet Network Driver
[    1.202932] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.208538] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    1.214821] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    1.220881] sky2: driver version 1.30
[    1.225044] VFIO - User Level meta-driver version: 0.3
[    1.231934] usbcore: registered new interface driver usb-storage
[    1.240846] snvs_rtc 30370000.snvs:snvs-rtc-lp: registered as rtc0
[    1.247080] snvs_rtc 30370000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01T00:00:00 UTC (0)
Quoted 8 lines
[    1.256271] i2c_dev: i2c /dev entries driver
[    1.261317] imx7-csi 32e20000.csi: Registered csi capture as /dev/video0
[    1.268186] __v4l2_async_nf_register:610
[    1.272130]   imx-media:
[    1.274676] v4l2_async_nf_try_all_subdevs:447
[    1.279048]   imx-media:
[    1.281593] v4l2_async_nf_try_all_subdevs:454
[    1.285965] imx7_csi_notify_complete:2178
Quoted 4 lines

This doesn't seem right. The complete function should only be called once all the subdevices required by the notifier have been found, and at this point, the csis hasn't even probed. You may want to check the device tree.

Quoted 7 lines

But it looks like the notifier for the csi doesn't have any subdev dependencies. The "imx-media: " shows that a notifier for the csi is in the notifier_list, but the notif->waiting is empty.

Is that correct? How is the dependency graph supposed to look like? Is it csi -> csis -> imx219 or the other way round? In the latter case the imx219 should wait for all the other subdevs, right?

The imx7-media-csi driver registers a notifier in imx7_csi_async_register(), which should have one entry corresponding to the imx-mipi-csis.

The code seems to silently ignore some errors, which I don't think is right. It originates from the shared code base with the i.MX6 IPUv3 drivers, and should be fixed now. I'd start by checking what happens there.

Signature · 3 lines
Regards,

Laurent Pinchart
#23 lore raw
Quoted 289 lines · Laurent Pinchart

Hi Frieder,

Quoted 278 lines · Frieder Schrempf
Quoted 56 lines · Laurent Pinchart
Quoted 41 lines · Frieder Schrempf
Quoted 29 lines · Laurent Pinchart
Quoted 28 lines · Frieder Schrempf
Quoted 16 lines · Laurent Pinchart
Quoted 15 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Quoted 6 lines
Quoted 2 lines

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Yes, the imx219_probe() works just fine and returns with code 0. I also see v4l2_async_register_subdev_sensor() and the underlying code being called.

Quoted 7 lines
Quoted 2 lines

So I really don't understand why I'm missing the sensor subdev. Any ideas how to continue debugging?

The issue seems to be with v4l2-async then. There's a debugfs file that lists the missing v4l2-async subdevs (I don't recall the path by heard), that can give useful information. Enabling the debug messages from v4l2-async.c may helpt too.

+Cc: Dave, Sakari, Javier (thanks for your help and debugging hints via mail/IRC)

Quoted 8 lines

/sys/kernel/debug/v4l2-async/pending_async_subdevices gives me:

csis-32e30000.mipi-csi:
[fwnode] dev=1-0010, node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint
imx219 1-0010:
imx-media:

So it looks like the async subdev for the imx219 sensor is still pending.

Indeed, that seems to be the problem.

Quoted 3 lines

I have spent quite a few hours trying to understand how the code is supposed to work, but I'm afraid it's too much for my brain at the moment ;)

Quoted 8 lines
Quoted 4 lines

I have attached a debug patch [1] adding printks in v4l2-async.c and the boot log [2] with all the output below. Hopefully someone can have a look and make something out of that. Feel free to let me know via email or IRC if I can provide any further information.

To be honest your debug messages are quite cryptic. They may be readable when tracing the code on a live system, but offline, that's a different story.

I know. Sorry for that. I just posted what I hacked together for understanding the code flow. Sakari's debug patch is a better start, but it doesn't really cover the problem I see, as the matching code is never called. The issue is elsewhere and causes the fwnode matching to not take place at all.

Quoted 201 lines

More comments below.

Quoted 190 lines
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.2.0-rc7-ktn (oe-user@oe-host) (aarch64-ktn-linux-gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT Tue Feb  7 08:25:13 UTC 2023
[    0.000000] Machine model: Kontron BL i.MX8MM (N801X S)
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x13f7c2b00-0x13f7c4fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x00000000ffffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000013fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] cma: Reserved 1024 MiB at 0x00000000bbe00000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 20 pages/cpu s42024 r8192 d31704 u81920
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] CPU features: detected: ARM erratum 845719
[    0.000000] alternatives: applying boot alternatives
[    0.000000] Fallback order for Node 0: 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1032192
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: root=/dev/nfs ip=192.168.1.11:192.168.1.10:::kontron-mx8mm:eth0:any nfsroot=192.168.1.10:/nfsroot,v3,tcp cma=1G rootwait
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: area num 4.
[    0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[    0.000000] Memory: 2976216K/4194304K available (13568K kernel code, 1222K rwdata, 4840K rodata, 2368K init, 545K bss, 169512K reserved, 1048576K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 128 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv3: GICv3 features: 16 PPIs
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000038880000
[    0.000000] ITS: No ITS available, not enabling LPIs
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] arch_timer: cp15 timer(s) running at 8.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[    0.000000] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[    0.000353] Console: colour dummy device 80x25
[    0.000363] printk: console [tty0] enabled
[    0.000858] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=32000)
[    0.000881] pid_max: default: 32768 minimum: 301
[    0.000940] LSM: initializing lsm=capability,integrity
[    0.001043] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.001072] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.002504] rcu: Hierarchical SRCU implementation.
[    0.002526] rcu: 	Max phase no-delay instances is 1000.
[    0.003357] EFI services will not be available.
[    0.003583] smp: Bringing up secondary CPUs ...
[    0.004061] Detected VIPT I-cache on CPU1
[    0.004136] GICv3: CPU1: found redistributor 1 region 0:0x00000000388a0000
[    0.004178] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.004649] Detected VIPT I-cache on CPU2
[    0.004712] GICv3: CPU2: found redistributor 2 region 0:0x00000000388c0000
[    0.004736] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.005177] Detected VIPT I-cache on CPU3
[    0.005238] GICv3: CPU3: found redistributor 3 region 0:0x00000000388e0000
[    0.005259] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.005316] smp: Brought up 1 node, 4 CPUs
[    0.005403] SMP: Total of 4 processors activated.
[    0.005414] CPU features: detected: 32-bit EL0 Support
[    0.005424] CPU features: detected: 32-bit EL1 Support
[    0.005440] CPU features: detected: CRC32 instructions
[    0.005506] CPU: All CPU(s) started at EL2
[    0.005524] alternatives: applying system-wide alternatives
[    0.007432] devtmpfs: initialized
[    0.013542] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.013594] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.043563] pinctrl core: initialized pinctrl subsystem
[    0.045549] DMI not present or invalid.
[    0.046159] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.047073] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[    0.047276] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.047441] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.047501] audit: initializing netlink subsys (disabled)
[    0.047623] audit: type=2000 audit(0.044:1): state=initialized audit_enabled=0 res=1
[    0.048000] thermal_sys: Registered thermal governor 'step_wise'
[    0.048033] cpuidle: using governor menu
[    0.048199] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.048287] ASID allocator initialised with 65536 entries
[    0.048955] Serial: AMBA PL011 UART driver
[    0.055254] imx8mm-pinctrl 30330000.pinctrl: initialized IMX pinctrl driver
[    0.066886] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
[    0.066917] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page
[    0.066932] HugeTLB: registered 32.0 MiB page size, pre-allocated 0 pages
[    0.066944] HugeTLB: 508 KiB vmemmap can be freed for a 32.0 MiB page
[    0.066958] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[    0.066972] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[    0.066987] HugeTLB: registered 64.0 KiB page size, pre-allocated 0 pages
[    0.067000] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
[    0.068588] ACPI: Interpreter disabled.
[    0.069385] iommu: Default domain type: Translated
[    0.069405] iommu: DMA domain TLB invalidation policy: strict mode
[    0.069649] SCSI subsystem initialized
[    0.069932] usbcore: registered new interface driver usbfs
[    0.069969] usbcore: registered new interface driver hub
[    0.070007] usbcore: registered new device driver usb
[    0.070643] mc: Linux media interface: v0.10
[    0.070690] videodev: Linux video capture interface: v2.00
[    0.070754] pps_core: LinuxPPS API ver. 1 registered
[    0.070765] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.070791] PTP clock support registered
[    0.070920] EDAC MC: Ver: 3.0.0
[    0.071496] FPGA manager framework
[    0.071573] Advanced Linux Sound Architecture Driver Initialized.
[    0.072353] vgaarb: loaded
[    0.072652] clocksource: Switched to clocksource arch_sys_counter
[    0.072831] VFS: Disk quotas dquot_6.6.0
[    0.072867] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.073038] pnp: PnP ACPI: disabled
[    0.079203] NET: Registered PF_INET protocol family
[    0.079432] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.082247] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
[    0.082335] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.082361] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.082592] TCP bind hash table entries: 32768 (order: 8, 1048576 bytes, linear)
[    0.083553] TCP: Hash tables configured (established 32768 bind 32768)
[    0.083705] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.083806] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.084021] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.084433] RPC: Registered named UNIX socket transport module.
[    0.084451] RPC: Registered udp transport module.
[    0.084462] RPC: Registered tcp transport module.
[    0.084474] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.084493] PCI: CLS 0 bytes, default 64
[    0.085132] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.085846] kvm [1]: IPA Size Limit: 40 bits
[    0.087132] kvm [1]: GICv3: no GICV resource entry
[    0.087146] kvm [1]: disabling GICv2 emulation
[    0.087164] kvm [1]: GIC system register CPU interface enabled
[    0.087258] kvm [1]: vgic interrupt IRQ9
[    0.087360] kvm [1]: Hyp mode initialized successfully
[    0.088486] Initialise system trusted keyrings
[    0.088687] workingset: timestamp_bits=42 max_order=20 bucket_order=0
[    0.088988] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.089207] NFS: Registering the id_resolver key type
[    0.089262] Key type id_resolver registered
[    0.089274] Key type id_legacy registered
[    0.089303] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.089317] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.089466] 9p: Installing v9fs 9p2000 file system support
[    0.124669] Key type asymmetric registered
[    0.124683] Asymmetric key parser 'x509' registered
[    0.124735] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    0.124753] io scheduler mq-deadline registered
[    0.124764] io scheduler kyber registered
[    0.128006] EINJ: ACPI disabled.
[    0.136799] SoC: i.MX8MM revision 1.0
[    0.141870] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.143967] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 16, base_baud = 1500000) is a IMX
[    0.144488] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 17, base_baud = 1500000) is a IMX
[    0.144522] imx-uart 30880000.serial: Console IMX rounded baud rate from 114286 to 114300
[    0.144571] printk: console [ttymxc2] enabled
[    1.126108] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 18, base_baud = 1500000) is a IMX
[    1.144256] loop: module loaded
[    1.150889] tun: Universal TUN/TAP device driver, 1.6
[    1.156153] CAN device driver interface
[    1.160606] thunder_xcv, ver 1.0
[    1.163879] thunder_bgx, ver 1.0
[    1.167145] nicpf, ver 1.0
[    1.170627] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    1.177871] hns3: Copyright (c) 2017 Huawei Corporation.
[    1.183231] hclge is initializing
[    1.186586] e1000e: Intel(R) PRO/1000 Network Driver
[    1.191565] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.197519] igb: Intel(R) Gigabit Ethernet Network Driver
[    1.202932] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.208538] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    1.214821] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    1.220881] sky2: driver version 1.30
[    1.225044] VFIO - User Level meta-driver version: 0.3
[    1.231934] usbcore: registered new interface driver usb-storage
[    1.240846] snvs_rtc 30370000.snvs:snvs-rtc-lp: registered as rtc0
[    1.247080] snvs_rtc 30370000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01T00:00:00 UTC (0)
Quoted 8 lines
[    1.256271] i2c_dev: i2c /dev entries driver
[    1.261317] imx7-csi 32e20000.csi: Registered csi capture as /dev/video0
[    1.268186] __v4l2_async_nf_register:610
[    1.272130]   imx-media:
[    1.274676] v4l2_async_nf_try_all_subdevs:447
[    1.279048]   imx-media:
[    1.281593] v4l2_async_nf_try_all_subdevs:454
[    1.285965] imx7_csi_notify_complete:2178
Quoted 4 lines

This doesn't seem right. The complete function should only be called once all the subdevices required by the notifier have been found, and at this point, the csis hasn't even probed. You may want to check the device tree.

Quoted 7 lines

But it looks like the notifier for the csi doesn't have any subdev dependencies. The "imx-media: " shows that a notifier for the csi is in the notifier_list, but the notif->waiting is empty.

Is that correct? How is the dependency graph supposed to look like? Is it csi -> csis -> imx219 or the other way round? In the latter case the imx219 should wait for all the other subdevs, right?

Quoted 8 lines

The imx7-media-csi driver registers a notifier in imx7_csi_async_register(), which should have one entry corresponding to the imx-mipi-csis.

The code seems to silently ignore some errors, which I don't think is right. It originates from the shared code base with the i.MX6 IPUv3 drivers, and should be fixed now. I'd start by checking what happens there.

Ok, I had a look at imx7_csi_async_register() and the call to fwnode_graph_get_endpoint_by_id() returns NULL. This probably should already cause the probe to fail, but is currently ignored.

It looks like the remote endpoint lookup cannot be resolved as the csi is probed first and the remote device (mipi_csis) is not yet available.

How is this supposed to work in the first place? Do we need to defer the probe of the csi until the mipi_csis is available?

#24 lore raw
Quoted 303 lines · Frieder Schrempf
Quoted 289 lines · Laurent Pinchart

Hi Frieder,

Quoted 278 lines · Frieder Schrempf
Quoted 56 lines · Laurent Pinchart
Quoted 41 lines · Frieder Schrempf
Quoted 29 lines · Laurent Pinchart
Quoted 28 lines · Frieder Schrempf
Quoted 16 lines · Laurent Pinchart
Quoted 15 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Quoted 6 lines
Quoted 2 lines

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Yes, the imx219_probe() works just fine and returns with code 0. I also see v4l2_async_register_subdev_sensor() and the underlying code being called.

Quoted 7 lines
Quoted 2 lines

So I really don't understand why I'm missing the sensor subdev. Any ideas how to continue debugging?

The issue seems to be with v4l2-async then. There's a debugfs file that lists the missing v4l2-async subdevs (I don't recall the path by heard), that can give useful information. Enabling the debug messages from v4l2-async.c may helpt too.

+Cc: Dave, Sakari, Javier (thanks for your help and debugging hints via mail/IRC)

Quoted 8 lines

/sys/kernel/debug/v4l2-async/pending_async_subdevices gives me:

csis-32e30000.mipi-csi:
[fwnode] dev=1-0010, node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint
imx219 1-0010:
imx-media:

So it looks like the async subdev for the imx219 sensor is still pending.

Indeed, that seems to be the problem.

Quoted 3 lines

I have spent quite a few hours trying to understand how the code is supposed to work, but I'm afraid it's too much for my brain at the moment ;)

Quoted 8 lines
Quoted 4 lines

I have attached a debug patch [1] adding printks in v4l2-async.c and the boot log [2] with all the output below. Hopefully someone can have a look and make something out of that. Feel free to let me know via email or IRC if I can provide any further information.

To be honest your debug messages are quite cryptic. They may be readable when tracing the code on a live system, but offline, that's a different story.

I know. Sorry for that. I just posted what I hacked together for understanding the code flow. Sakari's debug patch is a better start, but it doesn't really cover the problem I see, as the matching code is never called. The issue is elsewhere and causes the fwnode matching to not take place at all.

Quoted 201 lines

More comments below.

Quoted 190 lines
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.2.0-rc7-ktn (oe-user@oe-host) (aarch64-ktn-linux-gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT Tue Feb  7 08:25:13 UTC 2023
[    0.000000] Machine model: Kontron BL i.MX8MM (N801X S)
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x13f7c2b00-0x13f7c4fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x00000000ffffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000013fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] cma: Reserved 1024 MiB at 0x00000000bbe00000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 20 pages/cpu s42024 r8192 d31704 u81920
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] CPU features: detected: ARM erratum 845719
[    0.000000] alternatives: applying boot alternatives
[    0.000000] Fallback order for Node 0: 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1032192
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: root=/dev/nfs ip=192.168.1.11:192.168.1.10:::kontron-mx8mm:eth0:any nfsroot=192.168.1.10:/nfsroot,v3,tcp cma=1G rootwait
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: area num 4.
[    0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[    0.000000] Memory: 2976216K/4194304K available (13568K kernel code, 1222K rwdata, 4840K rodata, 2368K init, 545K bss, 169512K reserved, 1048576K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu: 	RCU event tracing is enabled.
[    0.000000] rcu: 	RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 128 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv3: GICv3 features: 16 PPIs
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000038880000
[    0.000000] ITS: No ITS available, not enabling LPIs
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] arch_timer: cp15 timer(s) running at 8.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[    0.000000] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[    0.000353] Console: colour dummy device 80x25
[    0.000363] printk: console [tty0] enabled
[    0.000858] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=32000)
[    0.000881] pid_max: default: 32768 minimum: 301
[    0.000940] LSM: initializing lsm=capability,integrity
[    0.001043] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.001072] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.002504] rcu: Hierarchical SRCU implementation.
[    0.002526] rcu: 	Max phase no-delay instances is 1000.
[    0.003357] EFI services will not be available.
[    0.003583] smp: Bringing up secondary CPUs ...
[    0.004061] Detected VIPT I-cache on CPU1
[    0.004136] GICv3: CPU1: found redistributor 1 region 0:0x00000000388a0000
[    0.004178] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.004649] Detected VIPT I-cache on CPU2
[    0.004712] GICv3: CPU2: found redistributor 2 region 0:0x00000000388c0000
[    0.004736] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.005177] Detected VIPT I-cache on CPU3
[    0.005238] GICv3: CPU3: found redistributor 3 region 0:0x00000000388e0000
[    0.005259] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.005316] smp: Brought up 1 node, 4 CPUs
[    0.005403] SMP: Total of 4 processors activated.
[    0.005414] CPU features: detected: 32-bit EL0 Support
[    0.005424] CPU features: detected: 32-bit EL1 Support
[    0.005440] CPU features: detected: CRC32 instructions
[    0.005506] CPU: All CPU(s) started at EL2
[    0.005524] alternatives: applying system-wide alternatives
[    0.007432] devtmpfs: initialized
[    0.013542] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.013594] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.043563] pinctrl core: initialized pinctrl subsystem
[    0.045549] DMI not present or invalid.
[    0.046159] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.047073] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[    0.047276] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.047441] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.047501] audit: initializing netlink subsys (disabled)
[    0.047623] audit: type=2000 audit(0.044:1): state=initialized audit_enabled=0 res=1
[    0.048000] thermal_sys: Registered thermal governor 'step_wise'
[    0.048033] cpuidle: using governor menu
[    0.048199] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.048287] ASID allocator initialised with 65536 entries
[    0.048955] Serial: AMBA PL011 UART driver
[    0.055254] imx8mm-pinctrl 30330000.pinctrl: initialized IMX pinctrl driver
[    0.066886] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
[    0.066917] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page
[    0.066932] HugeTLB: registered 32.0 MiB page size, pre-allocated 0 pages
[    0.066944] HugeTLB: 508 KiB vmemmap can be freed for a 32.0 MiB page
[    0.066958] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[    0.066972] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[    0.066987] HugeTLB: registered 64.0 KiB page size, pre-allocated 0 pages
[    0.067000] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
[    0.068588] ACPI: Interpreter disabled.
[    0.069385] iommu: Default domain type: Translated
[    0.069405] iommu: DMA domain TLB invalidation policy: strict mode
[    0.069649] SCSI subsystem initialized
[    0.069932] usbcore: registered new interface driver usbfs
[    0.069969] usbcore: registered new interface driver hub
[    0.070007] usbcore: registered new device driver usb
[    0.070643] mc: Linux media interface: v0.10
[    0.070690] videodev: Linux video capture interface: v2.00
[    0.070754] pps_core: LinuxPPS API ver. 1 registered
[    0.070765] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.070791] PTP clock support registered
[    0.070920] EDAC MC: Ver: 3.0.0
[    0.071496] FPGA manager framework
[    0.071573] Advanced Linux Sound Architecture Driver Initialized.
[    0.072353] vgaarb: loaded
[    0.072652] clocksource: Switched to clocksource arch_sys_counter
[    0.072831] VFS: Disk quotas dquot_6.6.0
[    0.072867] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.073038] pnp: PnP ACPI: disabled
[    0.079203] NET: Registered PF_INET protocol family
[    0.079432] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.082247] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
[    0.082335] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.082361] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.082592] TCP bind hash table entries: 32768 (order: 8, 1048576 bytes, linear)
[    0.083553] TCP: Hash tables configured (established 32768 bind 32768)
[    0.083705] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.083806] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.084021] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.084433] RPC: Registered named UNIX socket transport module.
[    0.084451] RPC: Registered udp transport module.
[    0.084462] RPC: Registered tcp transport module.
[    0.084474] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.084493] PCI: CLS 0 bytes, default 64
[    0.085132] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.085846] kvm [1]: IPA Size Limit: 40 bits
[    0.087132] kvm [1]: GICv3: no GICV resource entry
[    0.087146] kvm [1]: disabling GICv2 emulation
[    0.087164] kvm [1]: GIC system register CPU interface enabled
[    0.087258] kvm [1]: vgic interrupt IRQ9
[    0.087360] kvm [1]: Hyp mode initialized successfully
[    0.088486] Initialise system trusted keyrings
[    0.088687] workingset: timestamp_bits=42 max_order=20 bucket_order=0
[    0.088988] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.089207] NFS: Registering the id_resolver key type
[    0.089262] Key type id_resolver registered
[    0.089274] Key type id_legacy registered
[    0.089303] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.089317] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.089466] 9p: Installing v9fs 9p2000 file system support
[    0.124669] Key type asymmetric registered
[    0.124683] Asymmetric key parser 'x509' registered
[    0.124735] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    0.124753] io scheduler mq-deadline registered
[    0.124764] io scheduler kyber registered
[    0.128006] EINJ: ACPI disabled.
[    0.136799] SoC: i.MX8MM revision 1.0
[    0.141870] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.143967] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 16, base_baud = 1500000) is a IMX
[    0.144488] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 17, base_baud = 1500000) is a IMX
[    0.144522] imx-uart 30880000.serial: Console IMX rounded baud rate from 114286 to 114300
[    0.144571] printk: console [ttymxc2] enabled
[    1.126108] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 18, base_baud = 1500000) is a IMX
[    1.144256] loop: module loaded
[    1.150889] tun: Universal TUN/TAP device driver, 1.6
[    1.156153] CAN device driver interface
[    1.160606] thunder_xcv, ver 1.0
[    1.163879] thunder_bgx, ver 1.0
[    1.167145] nicpf, ver 1.0
[    1.170627] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    1.177871] hns3: Copyright (c) 2017 Huawei Corporation.
[    1.183231] hclge is initializing
[    1.186586] e1000e: Intel(R) PRO/1000 Network Driver
[    1.191565] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.197519] igb: Intel(R) Gigabit Ethernet Network Driver
[    1.202932] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.208538] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    1.214821] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    1.220881] sky2: driver version 1.30
[    1.225044] VFIO - User Level meta-driver version: 0.3
[    1.231934] usbcore: registered new interface driver usb-storage
[    1.240846] snvs_rtc 30370000.snvs:snvs-rtc-lp: registered as rtc0
[    1.247080] snvs_rtc 30370000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01T00:00:00 UTC (0)
Quoted 8 lines
[    1.256271] i2c_dev: i2c /dev entries driver
[    1.261317] imx7-csi 32e20000.csi: Registered csi capture as /dev/video0
[    1.268186] __v4l2_async_nf_register:610
[    1.272130]   imx-media:
[    1.274676] v4l2_async_nf_try_all_subdevs:447
[    1.279048]   imx-media:
[    1.281593] v4l2_async_nf_try_all_subdevs:454
[    1.285965] imx7_csi_notify_complete:2178
Quoted 4 lines

This doesn't seem right. The complete function should only be called once all the subdevices required by the notifier have been found, and at this point, the csis hasn't even probed. You may want to check the device tree.

Quoted 7 lines

But it looks like the notifier for the csi doesn't have any subdev dependencies. The "imx-media: " shows that a notifier for the csi is in the notifier_list, but the notif->waiting is empty.

Is that correct? How is the dependency graph supposed to look like? Is it csi -> csis -> imx219 or the other way round? In the latter case the imx219 should wait for all the other subdevs, right?

Quoted 8 lines

The imx7-media-csi driver registers a notifier in imx7_csi_async_register(), which should have one entry corresponding to the imx-mipi-csis.

The code seems to silently ignore some errors, which I don't think is right. It originates from the shared code base with the i.MX6 IPUv3 drivers, and should be fixed now. I'd start by checking what happens there.

Ok, I had a look at imx7_csi_async_register() and the call to fwnode_graph_get_endpoint_by_id() returns NULL. This probably should already cause the probe to fail, but is currently ignored.

Quoted 5 lines

It looks like the remote endpoint lookup cannot be resolved as the csi is probed first and the remote device (mipi_csis) is not yet available.

How is this supposed to work in the first place? Do we need to defer the probe of the csi until the mipi_csis is available?

As discussed on IRC, in the attachment there is the DTB from the device for further debugging.

#25 lore raw
Quoted 305 lines · Frieder Schrempf
Quoted 303 lines · Frieder Schrempf
Quoted 289 lines · Laurent Pinchart

Hi Frieder,

Quoted 278 lines · Frieder Schrempf
Quoted 56 lines · Laurent Pinchart
Quoted 41 lines · Frieder Schrempf
Quoted 29 lines · Laurent Pinchart
Quoted 28 lines · Frieder Schrempf
Quoted 16 lines · Laurent Pinchart
Quoted 15 lines · Frieder Schrempf

Hi,

I'm trying to get a camera stream on our i.MX8MM board up and running with Linux 6.1. I'm using the RPi v2.1 camera module (imx219) as sensor.

I basically copied the devicetree setup from Tim's overlay at arch/arm64/boot/dts/freescale/imx8mm-venice-gw72xx-0x-imx219.dts.

With all the drivers enabled the devices (imx219, imx7-media-csi, imx-mipi-csis) seem to probe just fine and I see /dev/video0 and /dev/media0.

For the v4l subdevices I would expect to see one for the sensor and one for the CSI bridge. But only the latter is there (see below).

Quoted 6 lines
Quoted 2 lines

Is this correct? Am I missing something? How can I setup/enable the pipeline/stream?

Your expectations are correct, but the result isn't. You should see the camera sensor in the media graph. Has the imx219 been probed by the driver ? Did probe succeed ?

Yes, the imx219_probe() works just fine and returns with code 0. I also see v4l2_async_register_subdev_sensor() and the underlying code being called.

Quoted 7 lines
Quoted 2 lines

So I really don't understand why I'm missing the sensor subdev. Any ideas how to continue debugging?

The issue seems to be with v4l2-async then. There's a debugfs file that lists the missing v4l2-async subdevs (I don't recall the path by heard), that can give useful information. Enabling the debug messages from v4l2-async.c may helpt too.

+Cc: Dave, Sakari, Javier (thanks for your help and debugging hints via mail/IRC)

Quoted 8 lines

/sys/kernel/debug/v4l2-async/pending_async_subdevices gives me:

csis-32e30000.mipi-csi:
[fwnode] dev=1-0010, node=/soc@0/bus@30800000/i2c@30a30000/sensor@10/port/endpoint
imx219 1-0010:
imx-media:

So it looks like the async subdev for the imx219 sensor is still pending.

Indeed, that seems to be the problem.

Quoted 3 lines

I have spent quite a few hours trying to understand how the code is supposed to work, but I'm afraid it's too much for my brain at the moment ;)

Quoted 8 lines
Quoted 4 lines

I have attached a debug patch [1] adding printks in v4l2-async.c and the boot log [2] with all the output below. Hopefully someone can have a look and make something out of that. Feel free to let me know via email or IRC if I can provide any further information.

To be honest your debug messages are quite cryptic. They may be readable when tracing the code on a live system, but offline, that's a different story.

I know. Sorry for that. I just posted what I hacked together for understanding the code flow. Sakari's debug patch is a better start, but it doesn't really cover the problem I see, as the matching code is never called. The issue is elsewhere and causes the fwnode matching to not take place at all.

Quoted 201 lines

More comments below.

Quoted 190 lines
[    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd034]
[    0.000000] Linux version 6.2.0-rc7-ktn (oe-user@oe-host) (aarch64-ktn-linux-gcc (GCC) 11.3.0, GNU ld (GNU Binutils) 2.38.20220708) #1 SMP PREEMPT Tue Feb  7 08:25:13 UTC 2023
[    0.000000] Machine model: Kontron BL i.MX8MM (N801X S)
[    0.000000] efi: UEFI not found.
[    0.000000] NUMA: No NUMA configuration found
[    0.000000] NUMA: Faking a node at [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] NUMA: NODE_DATA [mem 0x13f7c2b00-0x13f7c4fff]
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x0000000040000000-0x00000000ffffffff]
[    0.000000]   DMA32    empty
[    0.000000]   Normal   [mem 0x0000000100000000-0x000000013fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000040000000-0x000000013fffffff]
[    0.000000] cma: Reserved 1024 MiB at 0x00000000bbe00000
[    0.000000] psci: probing for conduit method from DT.
[    0.000000] psci: PSCIv1.1 detected in firmware.
[    0.000000] psci: Using standard PSCI v0.2 function IDs
[    0.000000] psci: MIGRATE_INFO_TYPE not supported.
[    0.000000] psci: SMC Calling Convention v1.2
[    0.000000] percpu: Embedded 20 pages/cpu s42024 r8192 d31704 u81920
[    0.000000] Detected VIPT I-cache on CPU0
[    0.000000] CPU features: detected: GIC system register CPU interface
[    0.000000] CPU features: detected: ARM erratum 845719
[    0.000000] alternatives: applying boot alternatives
[    0.000000] Fallback order for Node 0: 0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1032192
[    0.000000] Policy zone: Normal
[    0.000000] Kernel command line: root=/dev/nfs ip=192.168.1.11:192.168.1.10:::kontron-mx8mm:eth0:any nfsroot=192.168.1.10:/nfsroot,v3,tcp cma=1G rootwait
[    0.000000] Dentry cache hash table entries: 524288 (order: 10, 4194304 bytes, linear)
[    0.000000] Inode-cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: area num 4.
[    0.000000] software IO TLB: mapped [mem 0x00000000fbfff000-0x00000000fffff000] (64MB)
[    0.000000] Memory: 2976216K/4194304K available (13568K kernel code, 1222K rwdata, 4840K rodata, 2368K init, 545K bss, 169512K reserved, 1048576K cma-reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000] rcu:       RCU event tracing is enabled.
[    0.000000] rcu:       RCU restricting CPUs from NR_CPUS=256 to nr_cpu_ids=4.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 64, nr_irqs: 64, preallocated irqs: 0
[    0.000000] GICv3: GIC: Using split EOI/Deactivate mode
[    0.000000] GICv3: 128 SPIs implemented
[    0.000000] GICv3: 0 Extended SPIs implemented
[    0.000000] Root IRQ handler: gic_handle_irq
[    0.000000] GICv3: GICv3 features: 16 PPIs
[    0.000000] GICv3: CPU0: found redistributor 0 region 0:0x0000000038880000
[    0.000000] ITS: No ITS available, not enabling LPIs
[    0.000000] rcu: srcu_init: Setting srcu_struct sizes based on contention.
[    0.000000] arch_timer: cp15 timer(s) running at 8.00MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 440795202120 ns
[    0.000000] sched_clock: 56 bits at 8MHz, resolution 125ns, wraps every 2199023255500ns
[    0.000353] Console: colour dummy device 80x25
[    0.000363] printk: console [tty0] enabled
[    0.000858] Calibrating delay loop (skipped), value calculated using timer frequency.. 16.00 BogoMIPS (lpj=32000)
[    0.000881] pid_max: default: 32768 minimum: 301
[    0.000940] LSM: initializing lsm=capability,integrity
[    0.001043] Mount-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.001072] Mountpoint-cache hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.002504] rcu: Hierarchical SRCU implementation.
[    0.002526] rcu:       Max phase no-delay instances is 1000.
[    0.003357] EFI services will not be available.
[    0.003583] smp: Bringing up secondary CPUs ...
[    0.004061] Detected VIPT I-cache on CPU1
[    0.004136] GICv3: CPU1: found redistributor 1 region 0:0x00000000388a0000
[    0.004178] CPU1: Booted secondary processor 0x0000000001 [0x410fd034]
[    0.004649] Detected VIPT I-cache on CPU2
[    0.004712] GICv3: CPU2: found redistributor 2 region 0:0x00000000388c0000
[    0.004736] CPU2: Booted secondary processor 0x0000000002 [0x410fd034]
[    0.005177] Detected VIPT I-cache on CPU3
[    0.005238] GICv3: CPU3: found redistributor 3 region 0:0x00000000388e0000
[    0.005259] CPU3: Booted secondary processor 0x0000000003 [0x410fd034]
[    0.005316] smp: Brought up 1 node, 4 CPUs
[    0.005403] SMP: Total of 4 processors activated.
[    0.005414] CPU features: detected: 32-bit EL0 Support
[    0.005424] CPU features: detected: 32-bit EL1 Support
[    0.005440] CPU features: detected: CRC32 instructions
[    0.005506] CPU: All CPU(s) started at EL2
[    0.005524] alternatives: applying system-wide alternatives
[    0.007432] devtmpfs: initialized
[    0.013542] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.013594] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.043563] pinctrl core: initialized pinctrl subsystem
[    0.045549] DMI not present or invalid.
[    0.046159] NET: Registered PF_NETLINK/PF_ROUTE protocol family
[    0.047073] DMA: preallocated 512 KiB GFP_KERNEL pool for atomic allocations
[    0.047276] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA pool for atomic allocations
[    0.047441] DMA: preallocated 512 KiB GFP_KERNEL|GFP_DMA32 pool for atomic allocations
[    0.047501] audit: initializing netlink subsys (disabled)
[    0.047623] audit: type=2000 audit(0.044:1): state=initialized audit_enabled=0 res=1
[    0.048000] thermal_sys: Registered thermal governor 'step_wise'
[    0.048033] cpuidle: using governor menu
[    0.048199] hw-breakpoint: found 6 breakpoint and 4 watchpoint registers.
[    0.048287] ASID allocator initialised with 65536 entries
[    0.048955] Serial: AMBA PL011 UART driver
[    0.055254] imx8mm-pinctrl 30330000.pinctrl: initialized IMX pinctrl driver
[    0.066886] HugeTLB: registered 1.00 GiB page size, pre-allocated 0 pages
[    0.066917] HugeTLB: 16380 KiB vmemmap can be freed for a 1.00 GiB page
[    0.066932] HugeTLB: registered 32.0 MiB page size, pre-allocated 0 pages
[    0.066944] HugeTLB: 508 KiB vmemmap can be freed for a 32.0 MiB page
[    0.066958] HugeTLB: registered 2.00 MiB page size, pre-allocated 0 pages
[    0.066972] HugeTLB: 28 KiB vmemmap can be freed for a 2.00 MiB page
[    0.066987] HugeTLB: registered 64.0 KiB page size, pre-allocated 0 pages
[    0.067000] HugeTLB: 0 KiB vmemmap can be freed for a 64.0 KiB page
[    0.068588] ACPI: Interpreter disabled.
[    0.069385] iommu: Default domain type: Translated
[    0.069405] iommu: DMA domain TLB invalidation policy: strict mode
[    0.069649] SCSI subsystem initialized
[    0.069932] usbcore: registered new interface driver usbfs
[    0.069969] usbcore: registered new interface driver hub
[    0.070007] usbcore: registered new device driver usb
[    0.070643] mc: Linux media interface: v0.10
[    0.070690] videodev: Linux video capture interface: v2.00
[    0.070754] pps_core: LinuxPPS API ver. 1 registered
[    0.070765] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <[email protected]>
[    0.070791] PTP clock support registered
[    0.070920] EDAC MC: Ver: 3.0.0
[    0.071496] FPGA manager framework
[    0.071573] Advanced Linux Sound Architecture Driver Initialized.
[    0.072353] vgaarb: loaded
[    0.072652] clocksource: Switched to clocksource arch_sys_counter
[    0.072831] VFS: Disk quotas dquot_6.6.0
[    0.072867] VFS: Dquot-cache hash table entries: 512 (order 0, 4096 bytes)
[    0.073038] pnp: PnP ACPI: disabled
[    0.079203] NET: Registered PF_INET protocol family
[    0.079432] IP idents hash table entries: 65536 (order: 7, 524288 bytes, linear)
[    0.082247] tcp_listen_portaddr_hash hash table entries: 2048 (order: 3, 32768 bytes, linear)
[    0.082335] Table-perturb hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.082361] TCP established hash table entries: 32768 (order: 6, 262144 bytes, linear)
[    0.082592] TCP bind hash table entries: 32768 (order: 8, 1048576 bytes, linear)
[    0.083553] TCP: Hash tables configured (established 32768 bind 32768)
[    0.083705] UDP hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.083806] UDP-Lite hash table entries: 2048 (order: 4, 65536 bytes, linear)
[    0.084021] NET: Registered PF_UNIX/PF_LOCAL protocol family
[    0.084433] RPC: Registered named UNIX socket transport module.
[    0.084451] RPC: Registered udp transport module.
[    0.084462] RPC: Registered tcp transport module.
[    0.084474] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.084493] PCI: CLS 0 bytes, default 64
[    0.085132] hw perfevents: enabled with armv8_cortex_a53 PMU driver, 7 counters available
[    0.085846] kvm [1]: IPA Size Limit: 40 bits
[    0.087132] kvm [1]: GICv3: no GICV resource entry
[    0.087146] kvm [1]: disabling GICv2 emulation
[    0.087164] kvm [1]: GIC system register CPU interface enabled
[    0.087258] kvm [1]: vgic interrupt IRQ9
[    0.087360] kvm [1]: Hyp mode initialized successfully
[    0.088486] Initialise system trusted keyrings
[    0.088687] workingset: timestamp_bits=42 max_order=20 bucket_order=0
[    0.088988] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.089207] NFS: Registering the id_resolver key type
[    0.089262] Key type id_resolver registered
[    0.089274] Key type id_legacy registered
[    0.089303] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.089317] nfs4flexfilelayout_init: NFSv4 Flexfile Layout Driver Registering...
[    0.089466] 9p: Installing v9fs 9p2000 file system support
[    0.124669] Key type asymmetric registered
[    0.124683] Asymmetric key parser 'x509' registered
[    0.124735] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 244)
[    0.124753] io scheduler mq-deadline registered
[    0.124764] io scheduler kyber registered
[    0.128006] EINJ: ACPI disabled.
[    0.136799] SoC: i.MX8MM revision 1.0
[    0.141870] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    0.143967] 30860000.serial: ttymxc0 at MMIO 0x30860000 (irq = 16, base_baud = 1500000) is a IMX
[    0.144488] 30880000.serial: ttymxc2 at MMIO 0x30880000 (irq = 17, base_baud = 1500000) is a IMX
[    0.144522] imx-uart 30880000.serial: Console IMX rounded baud rate from 114286 to 114300
[    0.144571] printk: console [ttymxc2] enabled
[    1.126108] 30890000.serial: ttymxc1 at MMIO 0x30890000 (irq = 18, base_baud = 1500000) is a IMX
[    1.144256] loop: module loaded
[    1.150889] tun: Universal TUN/TAP device driver, 1.6
[    1.156153] CAN device driver interface
[    1.160606] thunder_xcv, ver 1.0
[    1.163879] thunder_bgx, ver 1.0
[    1.167145] nicpf, ver 1.0
[    1.170627] hns3: Hisilicon Ethernet Network Driver for Hip08 Family - version
[    1.177871] hns3: Copyright (c) 2017 Huawei Corporation.
[    1.183231] hclge is initializing
[    1.186586] e1000e: Intel(R) PRO/1000 Network Driver
[    1.191565] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    1.197519] igb: Intel(R) Gigabit Ethernet Network Driver
[    1.202932] igb: Copyright (c) 2007-2014 Intel Corporation.
[    1.208538] igbvf: Intel(R) Gigabit Virtual Function Network Driver
[    1.214821] igbvf: Copyright (c) 2009 - 2012 Intel Corporation.
[    1.220881] sky2: driver version 1.30
[    1.225044] VFIO - User Level meta-driver version: 0.3
[    1.231934] usbcore: registered new interface driver usb-storage
[    1.240846] snvs_rtc 30370000.snvs:snvs-rtc-lp: registered as rtc0
[    1.247080] snvs_rtc 30370000.snvs:snvs-rtc-lp: setting system clock to 1970-01-01T00:00:00 UTC (0)
Quoted 8 lines
[    1.256271] i2c_dev: i2c /dev entries driver
[    1.261317] imx7-csi 32e20000.csi: Registered csi capture as /dev/video0
[    1.268186] __v4l2_async_nf_register:610
[    1.272130]   imx-media:
[    1.274676] v4l2_async_nf_try_all_subdevs:447
[    1.279048]   imx-media:
[    1.281593] v4l2_async_nf_try_all_subdevs:454
[    1.285965] imx7_csi_notify_complete:2178
Quoted 4 lines

This doesn't seem right. The complete function should only be called once all the subdevices required by the notifier have been found, and at this point, the csis hasn't even probed. You may want to check the device tree.

Quoted 7 lines

But it looks like the notifier for the csi doesn't have any subdev dependencies. The "imx-media: " shows that a notifier for the csi is in the notifier_list, but the notif->waiting is empty.

Is that correct? How is the dependency graph supposed to look like? Is it csi -> csis -> imx219 or the other way round? In the latter case the imx219 should wait for all the other subdevs, right?

Quoted 8 lines

The imx7-media-csi driver registers a notifier in imx7_csi_async_register(), which should have one entry corresponding to the imx-mipi-csis.

The code seems to silently ignore some errors, which I don't think is right. It originates from the shared code base with the i.MX6 IPUv3 drivers, and should be fixed now. I'd start by checking what happens there.

Ok, I had a look at imx7_csi_async_register() and the call to fwnode_graph_get_endpoint_by_id() returns NULL. This probably should already cause the probe to fail, but is currently ignored.

Quoted 8 lines
Quoted 5 lines

It looks like the remote endpoint lookup cannot be resolved as the csi is probed first and the remote device (mipi_csis) is not yet available.

How is this supposed to work in the first place? Do we need to defer the probe of the csi until the mipi_csis is available?

As discussed on IRC, in the attachment there is the DTB from the device for further debugging.

Frieder,

Where did you end up with this? I have imx219 capture working on imx8mm on a 5.15 kernel with lots of backports but have not managed to repeat it on a 6.4 kernel. I don't run into the issue you are running into (I have the imx-media device showing) but the media-ctl entities have changed since my 5.15 kernel and I can't figure out how to link them up and configure them with media-ctl.

On my imx8mm-venice-gw72xx with imx8mm-venice-gw72xx-0x-imx219.dtso I see:

root@jammy-venice:~# cat /sys/bus/media/devices/media*/model
imx-media
hantro-vpu
hantro-vpu
root@jammy-venice:~# cat /sys/bus/media/devices/media0/model
imx-media
root@jammy-venice:~# media-ctl --device /dev/media0 -p
Media controller API version 6.4.0

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  6.4.0

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

                <- "csis-32e30000.mipi-csi":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: csis-32e30000.mipi-csi (2 pads, 2 links) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]

                <- "imx219 2-0010":0 []
        pad1: Source
                [fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

- entity 15: imx219 2-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:full-range

                 crop.bounds:(8,8)/3280x2464
                 crop:(8,8)/3280x2464]
                -> "csis-32e30000.mipi-csi":0 []

When I try to link and configure the pipeline I run into issues I don't know how to resolve:

root@jammy-venice:~# media-ctl --device /dev/media0 --reset
root@jammy-venice:~# media-ctl --device /dev/media0 --links "'imx219
2-0010':0->'csis-32e30000.mipi-csi.0':0[1]"
Unable to parse link: Invalid argument (22)
^^^ not sure why I can't link imx219 source pad with mipi-csi sink pad

What changed for me from my 5.15 kernel is the entities and pads above. My 5.15 kernel looks like this:

root@jammy-venice:~# cat /sys/bus/media/devices/media2/model
imx-media
root@jammy-venice:~# media-ctl --device /dev/media2 -p
Media controller API version 5.15.15

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  5.15.15

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/800x600 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

                <- "imx7-mipi-csis.0":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/800x600 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video2
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: imx7-mipi-csis.0 (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]

                <- "imx219 2-0010":0 []
        pad1: Source
                [fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

- entity 15: imx219 2-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:full-range

                 crop.bounds:(8,8)/3280x2464
                 crop:(8,8)/3280x2464]
                -> "imx7-mipi-csis.0":0 []
# configure media controller links
media-ctl --device /dev/media2 --reset
# link the imx219 source pad (0) to the imx7-mipi-csis sink pad (0)
media-ctl --device /dev/media2 --links "'imx219
2-0010':0->'imx7-mipi-csis.0':0[1]"
# configure the imx219 source pad (0) for srgb 640x480
media-ctl --device /dev/media2 -v -V "'imx219 2-0010':0
[fmt:SRGGB8/640x480 field:none]"
# configure the csi sink pad (0) for srgb 640x480
media-ctl --device /dev/media2 -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]"
# stream 640x480@30fps
gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-bayer,format=rggb,width=640,height=480,framerate=10/1 !
bayer2rgb ! fbdevsink # works

Maybe you have gotten further than this by now?

If you are still having issues getting imx-media to register we can look at kernel configs. I believe the following are necessary:
CONFIG_VIDEO_IMX219=y
CONFIG_VIDEO_IMX_MIPI_CSIS=y
CONFIG_VIDEO_IMX7_CSI=y

Best regards,

Tim

#26 lore raw

Hi Tim,

On 07.07.23 23:57, Tim Harvey wrote:
[...]

Quoted 149 lines

Frieder,

Where did you end up with this? I have imx219 capture working on imx8mm on a 5.15 kernel with lots of backports but have not managed to repeat it on a 6.4 kernel. I don't run into the issue you are running into (I have the imx-media device showing) but the media-ctl entities have changed since my 5.15 kernel and I can't figure out how to link them up and configure them with media-ctl.

On my imx8mm-venice-gw72xx with imx8mm-venice-gw72xx-0x-imx219.dtso I see:

root@jammy-venice:~# cat /sys/bus/media/devices/media*/model
imx-media
hantro-vpu
hantro-vpu
root@jammy-venice:~# cat /sys/bus/media/devices/media0/model
imx-media
root@jammy-venice:~# media-ctl --device /dev/media0 -p
Media controller API version 6.4.0

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  6.4.0

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

                <- "csis-32e30000.mipi-csi":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: csis-32e30000.mipi-csi (2 pads, 2 links) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]

                <- "imx219 2-0010":0 []
        pad1: Source
                [fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

- entity 15: imx219 2-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:full-range

                 crop.bounds:(8,8)/3280x2464
                 crop:(8,8)/3280x2464]
                -> "csis-32e30000.mipi-csi":0 []

When I try to link and configure the pipeline I run into issues I don't know how to resolve:

root@jammy-venice:~# media-ctl --device /dev/media0 --reset
root@jammy-venice:~# media-ctl --device /dev/media0 --links "'imx219
2-0010':0->'csis-32e30000.mipi-csi.0':0[1]"
Unable to parse link: Invalid argument (22)
^^^ not sure why I can't link imx219 source pad with mipi-csi sink pad

What changed for me from my 5.15 kernel is the entities and pads above. My 5.15 kernel looks like this:

root@jammy-venice:~# cat /sys/bus/media/devices/media2/model
imx-media
root@jammy-venice:~# media-ctl --device /dev/media2 -p
Media controller API version 5.15.15

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  5.15.15

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/800x600 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

                <- "imx7-mipi-csis.0":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/800x600 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video2
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: imx7-mipi-csis.0 (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]

                <- "imx219 2-0010":0 []
        pad1: Source
                [fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

- entity 15: imx219 2-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:full-range

                 crop.bounds:(8,8)/3280x2464
                 crop:(8,8)/3280x2464]
                -> "imx7-mipi-csis.0":0 []
# configure media controller links
media-ctl --device /dev/media2 --reset
# link the imx219 source pad (0) to the imx7-mipi-csis sink pad (0)
media-ctl --device /dev/media2 --links "'imx219
2-0010':0->'imx7-mipi-csis.0':0[1]"
# configure the imx219 source pad (0) for srgb 640x480
media-ctl --device /dev/media2 -v -V "'imx219 2-0010':0
[fmt:SRGGB8/640x480 field:none]"
# configure the csi sink pad (0) for srgb 640x480
media-ctl --device /dev/media2 -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]"
# stream 640x480@30fps
gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-bayer,format=rggb,width=640,height=480,framerate=10/1 !
bayer2rgb ! fbdevsink # works
Quoted 7 lines

Maybe you have gotten further than this by now?

If you are still having issues getting imx-media to register we can look at kernel configs. I believe the following are necessary:
CONFIG_VIDEO_IMX219=y
CONFIG_VIDEO_IMX_MIPI_CSIS=y
CONFIG_VIDEO_IMX7_CSI=y

I got this working back in February with Linux 6.2-rc8 and a few additional patches (see [1]), but I haven't tried this anymore since then.

In my notes I have the following commands to test the camera:

media-ctl -d /dev/media0 -l "'imx219 1-0010':0 -> 'csis-32e30000.mipi-csi':0[1]"
media-ctl -d /dev/media0 -V '"imx219 1-0010":0[fmt:SRGGB8_1X8/1920x1080 field:none]'
media-ctl -d /dev/media0 -V '"csis-32e30000.mipi-csi":0[fmt:SRGGB8_1X8/1920x1080 field:none]' media-ctl -d /dev/media0 -V '"csi":0[fmt:SRGGB8_1X8/1920x1080 field:none]'

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --stream-mmap

I currently don't have the time to look at this any closer, but maybe this already helps you in some way.

Best regards
Frieder

[1]
https://git.kontron-electronics.de/sw/misc/linux/-/commits/feature/v6.2-debug-csi

#27 lore raw
Quoted 162 lines · Frieder Schrempf

Hi Tim,

On 07.07.23 23:57, Tim Harvey wrote:
[...]

Quoted 149 lines

Frieder,

Where did you end up with this? I have imx219 capture working on imx8mm on a 5.15 kernel with lots of backports but have not managed to repeat it on a 6.4 kernel. I don't run into the issue you are running into (I have the imx-media device showing) but the media-ctl entities have changed since my 5.15 kernel and I can't figure out how to link them up and configure them with media-ctl.

On my imx8mm-venice-gw72xx with imx8mm-venice-gw72xx-0x-imx219.dtso I see:

root@jammy-venice:~# cat /sys/bus/media/devices/media*/model
imx-media
hantro-vpu
hantro-vpu
root@jammy-venice:~# cat /sys/bus/media/devices/media0/model
imx-media
root@jammy-venice:~# media-ctl --device /dev/media0 -p
Media controller API version 6.4.0

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  6.4.0

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

                <- "csis-32e30000.mipi-csi":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: csis-32e30000.mipi-csi (2 pads, 2 links) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]

                <- "imx219 2-0010":0 []
        pad1: Source
                [fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

- entity 15: imx219 2-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:full-range

                 crop.bounds:(8,8)/3280x2464
                 crop:(8,8)/3280x2464]
                -> "csis-32e30000.mipi-csi":0 []

When I try to link and configure the pipeline I run into issues I don't know how to resolve:

root@jammy-venice:~# media-ctl --device /dev/media0 --reset
root@jammy-venice:~# media-ctl --device /dev/media0 --links "'imx219
2-0010':0->'csis-32e30000.mipi-csi.0':0[1]"
Unable to parse link: Invalid argument (22)
^^^ not sure why I can't link imx219 source pad with mipi-csi sink pad

What changed for me from my 5.15 kernel is the entities and pads above. My 5.15 kernel looks like this:

root@jammy-venice:~# cat /sys/bus/media/devices/media2/model
imx-media
root@jammy-venice:~# media-ctl --device /dev/media2 -p
Media controller API version 5.15.15

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  5.15.15

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/800x600 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

                <- "imx7-mipi-csis.0":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/800x600 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video2
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: imx7-mipi-csis.0 (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]

                <- "imx219 2-0010":0 []
        pad1: Source
                [fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

- entity 15: imx219 2-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:full-range

                 crop.bounds:(8,8)/3280x2464
                 crop:(8,8)/3280x2464]
                -> "imx7-mipi-csis.0":0 []
# configure media controller links
media-ctl --device /dev/media2 --reset
# link the imx219 source pad (0) to the imx7-mipi-csis sink pad (0)
media-ctl --device /dev/media2 --links "'imx219
2-0010':0->'imx7-mipi-csis.0':0[1]"
# configure the imx219 source pad (0) for srgb 640x480
media-ctl --device /dev/media2 -v -V "'imx219 2-0010':0
[fmt:SRGGB8/640x480 field:none]"
# configure the csi sink pad (0) for srgb 640x480
media-ctl --device /dev/media2 -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]"
# stream 640x480@30fps
gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-bayer,format=rggb,width=640,height=480,framerate=10/1 !
bayer2rgb ! fbdevsink # works
Quoted 7 lines

Maybe you have gotten further than this by now?

If you are still having issues getting imx-media to register we can look at kernel configs. I believe the following are necessary:
CONFIG_VIDEO_IMX219=y
CONFIG_VIDEO_IMX_MIPI_CSIS=y
CONFIG_VIDEO_IMX7_CSI=y

Quoted 7 lines

I got this working back in February with Linux 6.2-rc8 and a few additional patches (see [1]), but I haven't tried this anymore since then.

In my notes I have the following commands to test the camera:

media-ctl -d /dev/media0 -l "'imx219 1-0010':0 ->
'csis-32e30000.mipi-csi':0[1]"

Hi Frieder,

Thank you - this helped me identify a typo in my link configuration.

My link configuration had an invalid argument in it which is why I was getting the invalid argument:

# media-ctl -l "'imx219 2-0010':0->'csis-32e30000.mipi-csi.0':0[1]"
Unable to parse link: Invalid argument (22)
^^^ the entity name does not include the .0 pad

I believe this is the correct setup for imx219 on 6.5-rc1 with imx219 for 640x480 raw8 bayer:
media-ctl -l "'imx219 2-0010':0 -> 'csis-32e30000.mipi-csi':0 [1]" media-ctl -v -V "'imx219 2-0010':0 [fmt:SRGGB8/640x480 field:none]" media-ctl -v -V "'csis-32e30000.mipi-csi':0 [fmt:SRGGB8/640x480 field:none]" media-ctl -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]"

I still can't get this to stream via gstreamer however:

# gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-bayer,format=rggb,width=640,height=480,framerate=10/1 !
bayer2rgb ! fbdevsink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
[  411.185357] imx7-csi 32e20000.csi: capture format not valid
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed
to allocate required memory.
Additional debug info:
../sys/v4l2/gstv4l2src.c(759): gst_v4l2src_decide_allocation ():
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:00.010357497
Setting pipeline to NULL ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop ():
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Freeing pipeline ...

I'm not sure if your notes show you how you captured/streamed data after the linux media pipeline configuration?

best regards,

Tim

Quoted 9 lines

media-ctl -d /dev/media0 -V '"imx219 1-0010":0[fmt:SRGGB8_1X8/1920x1080 field:none]'
media-ctl -d /dev/media0 -V '"csis-32e30000.mipi-csi":0[fmt:SRGGB8_1X8/1920x1080 field:none]' media-ctl -d /dev/media0 -V '"csi":0[fmt:SRGGB8_1X8/1920x1080 field:none]'

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --stream-mmap

Quoted 8 lines

I currently don't have the time to look at this any closer, but maybe this already helps you in some way.

Best regards
Frieder

[1]
https://git.kontron-electronics.de/sw/misc/linux/-/commits/feature/v6.2-debug-csi

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

#28 lore raw

Hi Tim,

Quoted 215 lines · Tim Harvey
Quoted 162 lines · Frieder Schrempf

Hi Tim,

On 07.07.23 23:57, Tim Harvey wrote:
[...]

Quoted 149 lines

Frieder,

Where did you end up with this? I have imx219 capture working on imx8mm on a 5.15 kernel with lots of backports but have not managed to repeat it on a 6.4 kernel. I don't run into the issue you are running into (I have the imx-media device showing) but the media-ctl entities have changed since my 5.15 kernel and I can't figure out how to link them up and configure them with media-ctl.

On my imx8mm-venice-gw72xx with imx8mm-venice-gw72xx-0x-imx219.dtso I see:

root@jammy-venice:~# cat /sys/bus/media/devices/media*/model
imx-media
hantro-vpu
hantro-vpu
root@jammy-venice:~# cat /sys/bus/media/devices/media0/model
imx-media
root@jammy-venice:~# media-ctl --device /dev/media0 -p
Media controller API version 6.4.0

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  6.4.0

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

                <- "csis-32e30000.mipi-csi":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: csis-32e30000.mipi-csi (2 pads, 2 links) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]

                <- "imx219 2-0010":0 []
        pad1: Source
                [fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

- entity 15: imx219 2-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:full-range

                 crop.bounds:(8,8)/3280x2464
                 crop:(8,8)/3280x2464]
                -> "csis-32e30000.mipi-csi":0 []

When I try to link and configure the pipeline I run into issues I don't know how to resolve:

root@jammy-venice:~# media-ctl --device /dev/media0 --reset
root@jammy-venice:~# media-ctl --device /dev/media0 --links "'imx219
2-0010':0->'csis-32e30000.mipi-csi.0':0[1]"
Unable to parse link: Invalid argument (22)
^^^ not sure why I can't link imx219 source pad with mipi-csi sink pad

What changed for me from my 5.15 kernel is the entities and pads above. My 5.15 kernel looks like this:

root@jammy-venice:~# cat /sys/bus/media/devices/media2/model
imx-media
root@jammy-venice:~# media-ctl --device /dev/media2 -p
Media controller API version 5.15.15

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  5.15.15

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/800x600 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

                <- "imx7-mipi-csis.0":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/800x600 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video2
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: imx7-mipi-csis.0 (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]

                <- "imx219 2-0010":0 []
        pad1: Source
                [fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

- entity 15: imx219 2-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:full-range

                 crop.bounds:(8,8)/3280x2464
                 crop:(8,8)/3280x2464]
                -> "imx7-mipi-csis.0":0 []
# configure media controller links
media-ctl --device /dev/media2 --reset
# link the imx219 source pad (0) to the imx7-mipi-csis sink pad (0)
media-ctl --device /dev/media2 --links "'imx219
2-0010':0->'imx7-mipi-csis.0':0[1]"
# configure the imx219 source pad (0) for srgb 640x480
media-ctl --device /dev/media2 -v -V "'imx219 2-0010':0
[fmt:SRGGB8/640x480 field:none]"
# configure the csi sink pad (0) for srgb 640x480
media-ctl --device /dev/media2 -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]"
# stream 640x480@30fps
gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-bayer,format=rggb,width=640,height=480,framerate=10/1 !
bayer2rgb ! fbdevsink # works
Quoted 7 lines

Maybe you have gotten further than this by now?

If you are still having issues getting imx-media to register we can look at kernel configs. I believe the following are necessary:
CONFIG_VIDEO_IMX219=y
CONFIG_VIDEO_IMX_MIPI_CSIS=y
CONFIG_VIDEO_IMX7_CSI=y

Quoted 7 lines

I got this working back in February with Linux 6.2-rc8 and a few additional patches (see [1]), but I haven't tried this anymore since then.

In my notes I have the following commands to test the camera:

media-ctl -d /dev/media0 -l "'imx219 1-0010':0 ->
'csis-32e30000.mipi-csi':0[1]"

Hi Frieder,

Thank you - this helped me identify a typo in my link configuration.

My link configuration had an invalid argument in it which is why I was getting the invalid argument:

# media-ctl -l "'imx219 2-0010':0->'csis-32e30000.mipi-csi.0':0[1]"
Unable to parse link: Invalid argument (22)
^^^ the entity name does not include the .0 pad

I believe this is the correct setup for imx219 on 6.5-rc1 with imx219 for 640x480 raw8 bayer:
media-ctl -l "'imx219 2-0010':0 -> 'csis-32e30000.mipi-csi':0 [1]" media-ctl -v -V "'imx219 2-0010':0 [fmt:SRGGB8/640x480 field:none]" media-ctl -v -V "'csis-32e30000.mipi-csi':0 [fmt:SRGGB8/640x480 field:none]" media-ctl -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]"

I still can't get this to stream via gstreamer however:

# gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-bayer,format=rggb,width=640,height=480,framerate=10/1 !
bayer2rgb ! fbdevsink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
[  411.185357] imx7-csi 32e20000.csi: capture format not valid
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed
to allocate required memory.
Additional debug info:
../sys/v4l2/gstv4l2src.c(759): gst_v4l2src_decide_allocation ():
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:00.010357497
Setting pipeline to NULL ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop ():
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Freeing pipeline ...
Quoted 2 lines

I'm not sure if your notes show you how you captured/streamed data after the linux media pipeline configuration?

I have the following gstreamer commands in my notes I used for streaming the raw data to a host machine via network and viewing it remotely:

Host:

gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=X-GST ! queue ! rtpgstdepay ! bayer2rgb ! videoconvert ! autovideosink

Client:

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-bayer,format=rggb,width=1920,height=1080' ! rtpgstpay ! queue ! udpsink host=192.168.1.10 port=5000

But as you are getting "imx7-csi 32e20000.csi: capture format not valid", I would assume that there is something wrong with the format and your gstreamer pipeline might be correct in general.

In contrast to my setup you are using fmt:SRGGB8 instead of fmt:SRGGB8_1X8. No idea if this makes any difference...

Does streaming with v4l2-ctl work for you without errors? I used the following for testing:

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --stream-mmap

Best regards
Frieder

#29 lore raw
Quoted 243 lines · Frieder Schrempf

Hi Tim,

Quoted 215 lines · Tim Harvey
Quoted 162 lines · Frieder Schrempf

Hi Tim,

On 07.07.23 23:57, Tim Harvey wrote:
[...]

Quoted 149 lines

Frieder,

Where did you end up with this? I have imx219 capture working on imx8mm on a 5.15 kernel with lots of backports but have not managed to repeat it on a 6.4 kernel. I don't run into the issue you are running into (I have the imx-media device showing) but the media-ctl entities have changed since my 5.15 kernel and I can't figure out how to link them up and configure them with media-ctl.

On my imx8mm-venice-gw72xx with imx8mm-venice-gw72xx-0x-imx219.dtso I see:

root@jammy-venice:~# cat /sys/bus/media/devices/media*/model
imx-media
hantro-vpu
hantro-vpu
root@jammy-venice:~# cat /sys/bus/media/devices/media0/model
imx-media
root@jammy-venice:~# media-ctl --device /dev/media0 -p
Media controller API version 6.4.0

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  6.4.0

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

                <- "csis-32e30000.mipi-csi":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/640x480 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: csis-32e30000.mipi-csi (2 pads, 2 links) type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]

                <- "imx219 2-0010":0 []
        pad1: Source
                [fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

- entity 15: imx219 2-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:full-range

                 crop.bounds:(8,8)/3280x2464
                 crop:(8,8)/3280x2464]
                -> "csis-32e30000.mipi-csi":0 []

When I try to link and configure the pipeline I run into issues I don't know how to resolve:

root@jammy-venice:~# media-ctl --device /dev/media0 --reset
root@jammy-venice:~# media-ctl --device /dev/media0 --links "'imx219
2-0010':0->'csis-32e30000.mipi-csi.0':0[1]"
Unable to parse link: Invalid argument (22)
^^^ not sure why I can't link imx219 source pad with mipi-csi sink pad

What changed for me from my 5.15 kernel is the entities and pads above. My 5.15 kernel looks like this:

root@jammy-venice:~# cat /sys/bus/media/devices/media2/model
imx-media
root@jammy-venice:~# media-ctl --device /dev/media2 -p
Media controller API version 5.15.15

Media device information
------------------------
driver imx7-csi
model imx-media
serial

bus info        platform:32e20000.csi
hw revision     0x0
driver version  5.15.15

Device topology
- entity 1: csi (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev0
pad0: Sink
[fmt:UYVY8_2X8/800x600 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]

                <- "imx7-mipi-csis.0":1 [ENABLED,IMMUTABLE]
        pad1: Source
                [fmt:UYVY8_2X8/800x600 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:lim-range]
                -> "csi capture":0 [ENABLED,IMMUTABLE]

- entity 4: csi capture (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video2
pad0: Sink
<- "csi":1 [ENABLED,IMMUTABLE]

- entity 10: imx7-mipi-csis.0 (2 pads, 2 links)
type V4L2 subdev subtype Unknown flags 0 device node name /dev/v4l-subdev1
pad0: Sink
[fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]

                <- "imx219 2-0010":0 []
        pad1: Source
                [fmt:UYVY8_1X16/640x480 field:none
colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range]
                -> "csi":0 [ENABLED,IMMUTABLE]

- entity 15: imx219 2-0010 (1 pad, 1 link)
type V4L2 subdev subtype Sensor flags 0
device node name /dev/v4l-subdev2
pad0: Source
[fmt:SRGGB10_1X10/3280x2464 field:none colorspace:srgb
xfer:srgb ycbcr:601 quantization:full-range

                 crop.bounds:(8,8)/3280x2464
                 crop:(8,8)/3280x2464]
                -> "imx7-mipi-csis.0":0 []
# configure media controller links
media-ctl --device /dev/media2 --reset
# link the imx219 source pad (0) to the imx7-mipi-csis sink pad (0)
media-ctl --device /dev/media2 --links "'imx219
2-0010':0->'imx7-mipi-csis.0':0[1]"
# configure the imx219 source pad (0) for srgb 640x480
media-ctl --device /dev/media2 -v -V "'imx219 2-0010':0
[fmt:SRGGB8/640x480 field:none]"
# configure the csi sink pad (0) for srgb 640x480
media-ctl --device /dev/media2 -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]"
# stream 640x480@30fps
gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-bayer,format=rggb,width=640,height=480,framerate=10/1 !
bayer2rgb ! fbdevsink # works
Quoted 7 lines

Maybe you have gotten further than this by now?

If you are still having issues getting imx-media to register we can look at kernel configs. I believe the following are necessary:
CONFIG_VIDEO_IMX219=y
CONFIG_VIDEO_IMX_MIPI_CSIS=y
CONFIG_VIDEO_IMX7_CSI=y

Quoted 7 lines

I got this working back in February with Linux 6.2-rc8 and a few additional patches (see [1]), but I haven't tried this anymore since then.

In my notes I have the following commands to test the camera:

media-ctl -d /dev/media0 -l "'imx219 1-0010':0 ->
'csis-32e30000.mipi-csi':0[1]"

Hi Frieder,

Thank you - this helped me identify a typo in my link configuration.

My link configuration had an invalid argument in it which is why I was getting the invalid argument:

# media-ctl -l "'imx219 2-0010':0->'csis-32e30000.mipi-csi.0':0[1]"
Unable to parse link: Invalid argument (22)
^^^ the entity name does not include the .0 pad

I believe this is the correct setup for imx219 on 6.5-rc1 with imx219 for 640x480 raw8 bayer:
media-ctl -l "'imx219 2-0010':0 -> 'csis-32e30000.mipi-csi':0 [1]" media-ctl -v -V "'imx219 2-0010':0 [fmt:SRGGB8/640x480 field:none]" media-ctl -v -V "'csis-32e30000.mipi-csi':0 [fmt:SRGGB8/640x480 field:none]" media-ctl -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]"

I still can't get this to stream via gstreamer however:

# gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-bayer,format=rggb,width=640,height=480,framerate=10/1 !
bayer2rgb ! fbdevsink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
[  411.185357] imx7-csi 32e20000.csi: capture format not valid
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed
to allocate required memory.
Additional debug info:
../sys/v4l2/gstv4l2src.c(759): gst_v4l2src_decide_allocation ():
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Buffer pool activation failed
Execution ended after 0:00:00.010357497
Setting pipeline to NULL ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop ():
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Freeing pipeline ...
Quoted 2 lines

I'm not sure if your notes show you how you captured/streamed data after the linux media pipeline configuration?

I have the following gstreamer commands in my notes I used for streaming the raw data to a host machine via network and viewing it remotely:

Host:

gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=X-GST ! queue ! rtpgstdepay ! bayer2rgb ! videoconvert ! autovideosink

Client:

gst-launch-1.0 v4l2src device=/dev/video0 ! 'video/x-bayer,format=rggb,width=1920,height=1080' ! rtpgstpay ! queue ! udpsink host=192.168.1.10 port=5000

But as you are getting "imx7-csi 32e20000.csi: capture format not valid", I would assume that there is something wrong with the format and your gstreamer pipeline might be correct in general.

In contrast to my setup you are using fmt:SRGGB8 instead of fmt:SRGGB8_1X8. No idea if this makes any difference...

Quoted 8 lines

Does streaming with v4l2-ctl work for you without errors? I used the following for testing:

v4l2-ctl -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat=RG10 --stream-mmap

Best regards
Frieder

Frieder,

The issue I seem to be running into is that when I configure the media pipeline for 640x480 v4l2 seems to think this is 768x480 (which it did not do in my previous 5.15 kernel):

# media-ctl --reset
# media-ctl -l "'imx219 2-0010':0 -> 'csis-32e30000.mipi-csi':0 [1]"
# media-ctl -v -V "'imx219 2-0010':0 [fmt:SRGGB8/640x480 field:none]"
Opening media device /dev/media0
Enumerating entities
looking up device: 81:3
looking up device: 81:0
looking up device: 81:4
looking up device: 81:5
Found 4 entities
Enumerating pads and links
Setting up format SRGGB8_1X8 640x480 on pad imx219 2-0010/0
Format set: SRGGB8_1X8 640x480
Setting up format SRGGB8_1X8 640x480 on pad csis-32e30000.mipi-csi/0
Format set: SRGGB8_1X8 640x480
# media-ctl -v -V "'csis-32e30000.mipi-csi':0 [fmt:SRGGB8/640x480 field:none]"
Opening media device /dev/media0
Enumerating entities
looking up device: 81:3
looking up device: 81:0
looking up device: 81:4
looking up device: 81:5
Found 4 entities
Enumerating pads and links
Setting up format SRGGB8_1X8 640x480 on pad csis-32e30000.mipi-csi/0
Format set: SRGGB8_1X8 640x480
# media-ctl -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]"
Opening media device /dev/media0
Enumerating entities
looking up device: 81:3
looking up device: 81:0
looking up device: 81:4
looking up device: 81:5
Found 4 entities
Enumerating pads and links
Setting up format SRGGB8_1X8 640x480 on pad csi/0
Format set: SRGGB8_1X8 640x480
# v4l2-ctl -d /dev/video0
--set-fmt-video=width=640,height=480,pixelformat=RGGB --verbose
VIDIOC_QUERYCAP: ok
VIDIOC_G_FMT: ok
VIDIOC_S_FMT: ok
Format Video Capture:
        Width/Height      : 768/480
        Pixel Format      : 'RGGB' (8-bit Bayer RGRG/GBGB)
        Field             : None
        Bytes per Line    : 768
        Size Image        : 368640
        Colorspace        : Default
        Transfer Function : Default (maps to Rec. 709)
        YCbCr/HSV Encoding: Default (maps to ITU-R 601)
        Quantization      : Default (maps to Full Range)
        Flags             :
^^^ not the 640/480 I asked for
# v4l2-ctl --device /dev/video0 --stream-mmap --stream-to=frame.raw
--stream-count=1 # captures 368640 bytes (768*480) not 307200
(640*480)
^^^ produces a corrupt frame
# gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-bayer,format=rggb,width=640,height=480,framerate=10/1 !
bayer2rgb ! fbdevsink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock

(gst-launch-1.0:1259): GStreamer-Base-WARNING **: 00:05:54.687:
bayer2rgb0: size 368640 is not a multi\ple of unit size 307200 ^^^ error due to unexpected frame size
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop ():
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason error (-5)
Execution ended after 0:00:00.098746098
Setting pipeline to NULL ...
Freeing pipeline ...

# gst-launch-1.0 v4l2src device=/dev/video0 !
video/x-bayer,format=rggb,width=768,height=480,framerate=10/1 !
bayer2rgb ! fbdevsink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
[ 1900.489707] imx7-csi 32e20000.csi: capture format not valid
^^^ error due to 768x480 not matching Linux media entity format
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed
to allocate required memory.
Additional debug info:
../sys/v4l2/gstv4l2src.c(759): gst_v4l2src_decide_allocation ():
/GstPipeline:pipeline0/GstV4l2Src:v4l
2src0:
Buffer pool activation failed
Execution ended after 0:00:00.010353615
Setting pipeline to NULL ...
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Internal data stream error.
Additional debug info:
../libs/gst/base/gstbasesrc.c(3127): gst_base_src_loop ():
/GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
streaming stopped, reason not-negotiated (-4)
Freeing pipeline ...

It doesn't look like there is any difference between SRGGB8_1X8 and SRGGB8 when setting up the link configurations as a '-v' shows SRGGB8_1X8 always and I've tried both. I see the same issue if I try 1920x1080 raw8 where there is a pixel size format but if I use raw10 like you were doing I don't get a resolution mismatch thus gstreamer to stream via rtp (like you were doing) it will stream but the image rolls like its not in sync. If I use gstreamer to bayer2rgb with raw10 it complains about the framesize. I'm not sure how to configure gstreamer for raw10 bayer vs raw8 bayer.

Whatever I'm running into it does not occur on the imx8mp with the same camera and 640x480 raw8 and I've proved it has nothing to do with changes to the imx219 driver so whatever it is it must have to do with the imx8mm mipi end. I'll start trying to figure out what kernel version affected this.

If you do find any time to test 640x480 raw8 on a modern kernel let me know what you find.

best regards,

Tim