Skip to content

rp1-cfe doesn't forward V4L2_EVENT_SOURCE_CHANGE event from csi-2 sensor driver to userspace app #7399

@hryhoriitur

Description

@hryhoriitur

Describe the bug

Currently, I am developing driver for csi-2 camera, and noticed that when I execute v4l2_subdev_notify_event in my driver, it is not being received by my userspace application.
What I do:

memset(&ev, 0, sizeof(ev));
ev.type = V4L2_EVENT_SOURCE_CHANGE;
ev.u.src_change.changes = V4L2_EVENT_SRC_CH_RESOLUTION;
v4l2_subdev_notify_event(my_subdev, &ev);

After a quick debugging I found the reason in rp1-cfe driver. It looks that the check whether the node in NODE_REGISTERED state in function cfe_notify is incorrect:

case V4L2_DEVICE_NOTIFY_EVENT:
for (i = 0; i < NUM_NODES; i++) {
struct cfe_node *node = &cfe->node[i];

  	if (check_state(cfe, NODE_REGISTERED, i))
  		continue;

  	v4l2_event_queue(&node->video_dev, arg);

According to this code, the event will be sent only if the corresponding cfe node is not in NODE_REGISTERED state..
The fix is trivial:

if (!check_state(cfe, NODE_REGISTERED, i))

Steps to reproduce the behaviour

  1. Start listening for V4L2_EVENT_SOURCE_CHANGE event using v4l2-ctl:
    v4l2-ctl -d /dev/video0 --all --verbose --wait-for-event=source_change
  2. Try to send event from csi-2 sensor driver using v4l2_subdev_notify_event
  3. v4l2-ctl doesn't receive corresponding event

Device (s)

Raspberry Pi 5

System

raspinfo | head -n 17
System Information
Raspberry Pi 5 Model B Rev 1.0
PRETTY_NAME="Debian GNU/Linux 13 (trixie)"
NAME="Debian GNU/Linux"
VERSION_ID="13"
VERSION="13 (trixie)"

Raspberry Pi reference 2025-12-04
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 4997bf4e4e49bc3305eb182a4a08bd023529da04, stage4

Linux raspberrypi 6.12.47+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64 GNU/Linux
Revision : d04170
Serial : 7c04ad32b8996900
Model : Raspberry Pi 5 Model B Rev 1.0
Throttled flag : throttled=0x0

vcgencmd version
2025/11/05 17:37:18
Copyright (c) 2012 Broadcom
version 57db150d (release) (embedded)

Logs

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions