Skip to content

bcm2835-v4l2 broken in 6.12.20 #6753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
lpla opened this issue Apr 1, 2025 · 7 comments
Open

bcm2835-v4l2 broken in 6.12.20 #6753

lpla opened this issue Apr 1, 2025 · 7 comments

Comments

@lpla
Copy link

lpla commented Apr 1, 2025

Describe the bug

After updating all my Raspberry Pis (1, Zero W, Zero 2 W, 3, 4...) under Bookworm to the kernel 6.12.20, all cameras stopped working. Checked the program using the cameras (mjpg-streamer) and says:

MJPG Streamer Version: git rev: 310b29f4a94c46652b20c4b7b6e5cf24e532af39
 i: Using V4L2 device.: /dev/video0
 i: Desired Resolution: 640 x 480
 i: Frames Per Second.: -1
 i: Format............: JPEG
 i: TV-Norm...........: DEFAULT
ERROR opening V4L interface: No such file or directory
 i: init_VideoIn failed

Which is correct, as ls /dev/video* does not show any /dev/video0 device. Then, went to trace the kernel driver. Started with sudo modprobe -v bcm2835-v4l2 and gets stuck with this only output line:

insmod /lib/modules/6.12.20+rpt-rpi-v7l/kernel/drivers/staging/vc04_services/bcm2835-camera/bcm2835-v4l2.ko.xz

Steps to reproduce the behaviour

  • Update to Bookworm latest master kernel 6.12.20 using apt
  • Restart
  • Bye v4l2 cameras

Device (s)

Raspberry Pi 4 Mod. B, Raspberry Pi Zero 2 W, Raspberry Pi Zero W / WH, Raspberry Pi 3 Mod. A+, Raspberry Pi 1 Mod. B, Raspberry Pi Zero

System

Raspberry Pi reference 2021-05-07
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, dcfd74d7d1fa293065ac6d565711e9ff891fe2b8, stage2
Mar 19 2025 18:26:12
Copyright (c) 2012 Broadcom
version ca6e8171a80ea46924ffaa629250bfb482f3a02c (clean) (release) (start_x)
Linux raspberrypi 6.12.20+rpt-rpi-v7 #1 SMP Raspbian 1:6.12.20-1+rpt1~bpo12+1 (2025-03-19) armv7l GNU/Linux

Logs

$ dmesg | grep v4l2
[   11.209368] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[   11.531084] Modules linked in: brcmfmac_wcc brcmfmac bcm2835_v4l2(C+) bcm2835_codec(C+) v4l2_mem2mem bcm2835_isp(C+) brcmutil cfg80211 bcm2835_mmal_vchiq(C) vc_sm_cma(C) hci_uart videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops btbcm videobuf2_v4l2 bluetooth videodev snd_bcm2835(C) raspberrypi_hwmon videobuf2_common ecdh_generic ecc snd_pcm mc rfkill snd_timer snd raspberrypi_gpiomem uio_pdrv_genirq uio drm fuse drm_panel_orientation_quirks dm_mod backlight ip_tables x_tables ipv6 r8153_ecm cdc_ether r8152 fixed
[   11.531280] LR is at mmal_init+0x4c/0x504 [bcm2835_v4l2]
[   11.609819]  vchiq_mmal_init [bcm2835_mmal_vchiq] from mmal_init+0x4c/0x504 [bcm2835_v4l2]
[   11.609893]  mmal_init [bcm2835_v4l2] from bcm2835_mmal_probe+0x1d4/0x490 [bcm2835_v4l2]
[   11.609939]  bcm2835_mmal_probe [bcm2835_v4l2] from really_probe+0xd0/0x2d0

Additional context

In previous syslog files (that is, previous stable kernel 6.6.74), the driver only output these messages:

[    8.390067] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    8.731751] bcm2835_v4l2-0: scene mode selected 0, was 0
[    8.734946] bcm2835_v4l2-0: V4L2 device registered as video0 - stills mode > 1280x720
[    8.741166] bcm2835_v4l2-0: Broadcom 2835 MMAL video capture loaded.
@pelwell
Copy link
Contributor

pelwell commented Apr 1, 2025

[   11.531280] LR is at mmal_init+0x4c/0x504 [bcm2835_v4l2]

This line is clearly part of a kernel stack trace. Please post the output of dmesg -l err,warn.

@lpla
Copy link
Author

lpla commented Apr 1, 2025

Here you have:

$ dmesg -l err,warn
[    0.000000] Kernel parameter elevator= does not have any effect anymore.
               Please use sysfs to set IO scheduler for individual devices.
[    2.456102] Core Release: 2.80a
[    2.457223] Setting default values for core params
[    2.458319] Finished setting default values for core params
[    2.659586] Using Buffer DMA mode
[    2.660692] Periodic Transfer Interrupt Enhancement - disabled
[    2.661855] Multiprocessor Interrupt Enhancement - disabled
[    2.663007] OTG VER PARAM: 0, OTG VER FLAG: 0
[    2.664165] Dedicated Tx FIFOs mode

[    2.665993] WARN::dwc_otg_hcd_init:1072: FIQ DMA bounce buffers: virt = 93514000 dma = 0xd3514000 len=9024
[    2.669241] FIQ FSM acceleration enabled for :
               Non-periodic Split Transactions
               Periodic Split Transactions
               High-Speed Isochronous Endpoints
               Interrupt/Control Split Transaction hack enabled

[    2.674411] WARN::hcd_init_fiq:457: FIQ on core 1

[    2.676433] WARN::hcd_init_fiq:458: FIQ ASM at 808d8cb0 length 36

[    2.678519] WARN::hcd_init_fiq:496: MPHI regs_base at 98810000
[    2.683998] Init: Port Power? op_state=1
[    2.685039] Init: Power Port (0)
[    2.825317] Indeed it is in host mode hprt0 = 00021501
[    3.003424] mmc0: host does not support reading read-only switch, assuming write-enable
[    3.016610] Indeed it is in host mode hprt0 = 00001101
[    3.377191] Indeed it is in host mode hprt0 = 00001101
[    3.567811] Indeed it is in host mode hprt0 = 00001101
[    8.190605] systemd[1]: /lib/systemd/system/telegraf.service:12: Unknown key 'ImportCredential' in section [Service], ignoring.
[    9.394131] systemd-journald[229]: File /var/log/journal/81e6ad093f794da489ec227601f4d079/system.journal corrupted or uncleanly shut down, renaming and replacing.
[   10.705344] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[   10.875344] hci_uart_bcm serial0-0: supply vbat not found, using dummy regulator
[   10.875609] hci_uart_bcm serial0-0: supply vddio not found, using dummy regulator
[   10.883157] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[   10.940306] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[   11.157250] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[   11.182053] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[   11.209368] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[   11.531084] Modules linked in: brcmfmac_wcc brcmfmac bcm2835_v4l2(C+) bcm2835_codec(C+) v4l2_mem2mem bcm2835_isp(C+) brcmutil cfg80211 bcm2835_mmal_vchiq(C) vc_sm_cma(C) hci_uart videobuf2_dma_contig videobuf2_vmalloc videobuf2_memops btbcm videobuf2_v4l2 bluetooth videodev snd_bcm2835(C) raspberrypi_hwmon videobuf2_common ecdh_generic ecc snd_pcm mc rfkill snd_timer snd raspberrypi_gpiomem uio_pdrv_genirq uio drm fuse drm_panel_orientation_quirks dm_mod backlight ip_tables x_tables ipv6 r8153_ecm cdc_ether r8152 fixed
[   11.531223] CPU: 0 UID: 0 PID: 262 Comm: (udev-worker) Tainted: G         C         6.12.20+rpt-rpi-v7 #1  Raspbian 1:6.12.20-1+rpt1~bpo12+1
[   11.531236] Tainted: [C]=CRAP
[   11.531239] Hardware name: BCM2835
[   11.531243] PC is at vchiq_mmal_init+0x24/0x1c4 [bcm2835_mmal_vchiq]
[   11.531280] LR is at mmal_init+0x4c/0x504 [bcm2835_v4l2]
[   11.531312] pc : [<7f2852d4>]    lr : [<7f4bc270>]    psr: 40000113
[   11.531318] sp : 98a01cc8  ip : 00000000  fp : 98a01dbc
[   11.531323] r10: 00000000  r9 : 00000001  r8 : 8155fb28
[   11.531328] r7 : 00000000  r6 : 00000050  r5 : 7f4c1004  r4 : 8155f800
[   11.531334] r3 : 7f24817c  r2 : 84b6b600  r1 : 8155fc6c  r0 : 00000000
[   11.531341] Flags: nZcv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
[   11.531348] Control: 10c5383d  Table: 0444006a  DAC: 00000051
[   11.610487] ---[ end trace 0000000000000000 ]---
[   28.726189] systemd-journald[229]: File /var/log/journal/81e6ad093f794da489ec227601f4d079/user-1000.journal corrupted or uncleanly shut down, renaming and replacing.

@pelwell
Copy link
Contributor

pelwell commented Apr 1, 2025

Thanks. That still looks oddly incomplete (no ---[ start trace ]---), but not in a way that makes it impossible to interpret.

You said this happens after "updating all my Raspberry Pis ... under Bookworm to the kernel 6.12.20". What were you running before? Is this your first 6.12 kernel?

@lpla
Copy link
Author

lpla commented Apr 1, 2025

I never run any testing kernel, so, the previous kernel was the last one released through apt before the 6.12 kernel released yesterday. As I mentioned in "Additional context", the previous kernel was 6.6.74 (which is actually still installed) and cameras worked there.

@pelwell
Copy link
Contributor

pelwell commented Apr 1, 2025

I think there's a slight difference between "the last stable kernel was 6.6.74" and "I was last running 6.6.74", but no matter.

@6by9
Copy link
Contributor

6by9 commented Apr 1, 2025

Please do note that bcm2835-v4l2 is relying on the legacy camera stack that has been deprecated since Nov 2021 (3.5 years ago).
At some point it may get removed or just totally break.

https://github.com/raspberrypi/linux/blob/rpi-6.12.y/drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c#L1559
ret = vchiq_mmal_init(dev->v4l2_dev.dev, &dev->instance);
dev->v4l2_dev.dev is NULL.

This path only gets executed if the legacy stack is enabled with a camera connected, which is why it hasn't been noticed until now.

@6by9
Copy link
Contributor

6by9 commented Apr 1, 2025

PR at #6754 should fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants