media: Add driver for the Raspberry Pi <5 CSI-2 receiver
Subsystems (5)
v11 cover media: Add driver for the Raspberry Pi <5 CSI-2 receiver
Hello everybody,
This patch series adds a new driver for the BCM2835 (and derivative) CCP2/CSI2 camera interface named Unicam. This IP core is found in the VC4-based Raspberry Pi, namely the Pi Zero, Pi 3 and Pi 4.
Camera support for Raspberry Pi 4 currently relies on a downstream Unicam driver that lives in the Raspberry Pi kernel tree ([1]). The driver uses the V4L2 API, but works around the lack of features in V4L2 to properly support sensor embedded data. Since the Unicam driver development by Raspberry Pi, some of those features have been merged in the kernel (namely the V4L2 streams API) or are being developed (namely generic metadata formats and subdev internal pads), with patches posted for review on the linux-media mailing list ([2], [3]).
This new upstream driver is based on the downstream code, extensively reworked to use the new V4L2 APIs.
The series is based on the generic metadata ([2]) and internal pads ([3], v9) APIs. It can be found in my tree in [4]. Testing it requires extra branches, which are also pushed to the same tree, and organized as follows:
- rpi/v6.9/base: The mainline tag that all the work is based on (currently v6.9-rc2)
- rpi/v6.9/backports: DT integration fixes for bcm238x, backported from linux-next
- rpi/v6.9/isp/v2: The ISP driver, which is getting upstreamed separately
- rpi/v6.9/metadata/v10/base: The V4L2 embedded data patches
- rpi/v6.9/metadata/v10/sensors: The V4L2 internal pads patches
- rpi/v6.9/unicam/next: The Unicam driver, based on the rpi/v6.9/metadata/v10/base branch that it depends on
- rpi/v6.9/imx219: Embedded data support for the imx219 driver, based on the rpi/v6.9/metadata/v10/sensors branch that it depends on
- rpi/v6.9/merge: A merge of the backports, isp/v2, unicam/next and imx219 branches
- rpi/v6.9/overlays: A sample overlay for the imx219 camera sensor connected to a Raspberry Pi 4
The series starts with two patches that add new V4L2 pixel formats (1/5 and 2/5), followed by the Unicam DT bindings (3/5) and driver (4/5). Finally, it ends with DT integration for the Unicam devices (5/5).
Compared to v10, I have rebased the patches on top of the latest version of the generic metadata series ([2]), to prepare for a merge in (hopefully) v6.10.
The patches have been tested on a Raspberry Pi 4 using an IMX219 camera module (the Raspberry Pi camera v2), with libcamera. Updates are needed to libcamera to use the new V4L2 APIs, patches have been posted to [5]. For manual testing with media-ctl, corresponding API updates to v4l-utils have been posted to the linux-media mailing list ([6]) and pushed to [7].
With this version I believe we are ready to merge the driver upstream. Sensor driver changes, which require more work, with their corresponding V4L2 API extensions, have been split out. The Unicam driver now depends only on the core part of the embedded data API extensions, which I believe is ready. Corresponding updates for v4l-utils have been developed and submitted. This series, along with the libcamera support, helps validating the new kernel APIs.
Sakari, please feel free to apply this on top of your generic metadata branch and include it in your pull request for v6.10.
Below you will find the mandatory v4l2-compliance reports. It requires the v4l-utils updates from [7]. There is a total of 4 warnings, all related to the imx219 driver. They will be addressed separately, as part of the effort to add embedded data support to the imx219 driver.
[1] https://github.com/raspberrypi/linux/tree/rpi-6.1.y/drivers/media/platform/bcm2835
[3] https://lore.kernel.org/linux-media/[email protected]/
[4] https://lore.kernel.org/linux-media/[email protected]/
[4] https://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git/log/?h=rpi/v6.9/unicam/next
[5] https://lists.libcamera.org/pipermail/libcamera-devel/2024-March/040711.html
[6] https://lore.kernel.org/linux-media/[email protected]/
[7] https://git.linuxtv.org/pinchartl/v4l-utils.git/log/?h=metadata
v4l2-compliance 1.27.0-5195, 64 bits, 64-bit time_t v4l2-compliance SHA: 9356d44374db 2024-04-24 11:58:36
Compliance test for unicam device /dev/media0:
Media Driver Info:
Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0
Required ioctls:
test MEDIA_IOC_DEVICE_INFO: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/media0 open: OK
test MEDIA_IOC_DEVICE_INFO: OK
test for unlimited opens: OK
Media Controller ioctls:
test MEDIA_IOC_G_TOPOLOGY: OK
Entities: 4 Interfaces: 4 Pads: 8 Links: 7 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK test MEDIA_IOC_SETUP_LINK: OK
Total for unicam device /dev/media0: 8, Succeeded: 8, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device /dev/video0:
Driver Info:
Driver name : unicam Card type : unicam Bus info : platform:fe801000.csi Driver version : 6.9.0 Capabilities : 0xa4a00001
Video Capture
Metadata Capture
I/O MC
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x24200001
Video Capture
I/O MC
Streaming
Extended Pix Format
Media Driver Info:
Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x0300000d Type : V4L Video Entity Info: ID : 0x0000000b (11) Name : unicam-image Function : V4L2 I/O Flags : default Pad 0x0100000c : 0: Sink Link 0x0200000f: from remote pad 0x1000003 of entity 'unicam' (Video Interface Bridge): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0
Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK
Codec ioctls (Input 0):
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)
Total for unicam device /dev/video0: 48, Succeeded: 48, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device /dev/video1:
Driver Info:
Driver name : unicam Card type : unicam Bus info : platform:fe801000.csi Driver version : 6.9.0 Capabilities : 0xa4a00001
Video Capture
Metadata Capture
I/O MC
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x24a00000
Metadata Capture
I/O MC
Streaming
Extended Pix Format
Media Driver Info:
Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x03000013 Type : V4L Video Entity Info: ID : 0x00000011 (17) Name : unicam-embedded Function : V4L2 I/O Pad 0x01000012 : 0: Sink Link 0x02000015: from remote pad 0x1000004 of entity 'unicam' (Video Interface Bridge): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0
Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) test VIDIOC_G_FBUF: OK (Not Supported) test VIDIOC_G_FMT: OK
test VIDIOC_TRY_FMT: OK
test VIDIOC_S_FMT: OK
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls (Input 0):
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)
Total for unicam device /dev/video1: 48, Succeeded: 48, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device /dev/v4l-subdev0:
Driver Info:
Driver version : 6.9.0 Capabilities : 0x00000002 Streams Support Client Capabilities: 0x0000000000000003 streams interval-uses-which Media Driver Info: Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x03000017 Type : V4L Sub-Device Entity Info: ID : 0x00000001 (1) Name : unicam Function : Video Interface Bridge Pad 0x01000002 : 0: Sink Link 0x02000009: from remote pad 0x1000006 of entity 'imx219 5-0010' (Camera Sensor): Data, Enabled, Immutable Pad 0x01000003 : 1: Source Link 0x0200000f: to remote pad 0x100000c of entity 'unicam-image' (V4L2 I/O): Data, Enabled, Immutable Pad 0x01000004 : 2: Source Link 0x02000015: to remote pad 0x1000012 of entity 'unicam-embedded' (V4L2 I/O): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/v4l-subdev0 open: OK
test VIDIOC_SUBDEV_QUERYCAP: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Sub-Device routing ioctls:
test Try VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OK test Active VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OK
Sub-Device ioctls (Sink Pad 0):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
Sub-Device ioctls (Source Pad 1):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
Sub-Device ioctls (Source Pad 2):
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) test VIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported) test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK (Not Supported)
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) test CREATE_BUFS maximum buffers: OK
test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)
Total for unicam device /dev/v4l-subdev0: 62, Succeeded: 62, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device /dev/v4l-subdev1:
Driver Info:
Driver version : 6.9.0 Capabilities : 0x00000002 Streams Support Client Capabilities: 0x0000000000000003 streams interval-uses-which Media Driver Info: Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x03000019 Type : V4L Sub-Device Entity Info: ID : 0x00000005 (5) Name : imx219 5-0010 Function : Camera Sensor Pad 0x01000006 : 0: Source Link 0x02000009: to remote pad 0x1000002 of entity 'unicam' (Video Interface Bridge): Data, Enabled, Immutable Pad 0x01000007 : 1: Sink, 00000008 Pad 0x01000008 : 2: Sink, 00000008
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/v4l-subdev1 open: OK
test VIDIOC_SUBDEV_QUERYCAP: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_LOG_STATUS: OK (Not Supported)
Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0
Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0
Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)
Sub-Device routing ioctls:
test Try VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OK test Active VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OK
Sub-Device ioctls (Source Pad 0):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Try VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566): VIDIOC_SUBDEV_G_SELECTION is supported for target 0 but not VIDIOC_SUBDEV_S_SELECTION
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
Try Stream 1
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported)
Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Active VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566): VIDIOC_SUBDEV_G_SELECTION is supported for target 0 but not VIDIOC_SUBDEV_S_SELECTION
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
Active Stream 1
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported)
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
Sub-Device ioctls (Sink Pad 1):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Try VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566): VIDIOC_SUBDEV_G_SELECTION is supported for target 0 but not VIDIOC_SUBDEV_S_SELECTION
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Active VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566): VIDIOC_SUBDEV_G_SELECTION is supported for target 0 but not VIDIOC_SUBDEV_S_SELECTION
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
Sub-Device ioctls (Sink Pad 2):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 20 Private Controls: 0
Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported) test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK (Not Supported)
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)
Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)
Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) test CREATE_BUFS maximum buffers: OK
test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)
Total for unicam device /dev/v4l-subdev1: 76, Succeeded: 76, Failed: 0, Warnings: 4
Grand Total for unicam device /dev/media0: 242, Succeeded: 242, Failed: 0, Warnings: 4
Dave Stevenson (2):
dt-bindings: media: Add bindings for bcm2835-unicam
media: bcm2835-unicam: Add support for CCP2/CSI2 camera interface
Jean-Michel Hautbois (3):
media: v4l: Add V4L2-PIX-FMT-Y12P format
media: v4l: Add V4L2-PIX-FMT-Y14P format
ARM: dts: bcm2835: Add Unicam CSI nodes
.../bindings/media/brcm,bcm2835-unicam.yaml | 127 + .../media/v4l/pixfmt-yuv-luma.rst | 48 + MAINTAINERS | 7 + arch/arm/boot/dts/broadcom/bcm2711.dtsi | 8 + arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi | 14 + arch/arm/boot/dts/broadcom/bcm283x.dtsi | 24 + drivers/media/platform/Kconfig | 1 + drivers/media/platform/Makefile | 1 + drivers/media/platform/broadcom/Kconfig | 23 + drivers/media/platform/broadcom/Makefile | 3 + .../platform/broadcom/bcm2835-unicam-regs.h | 246 ++ .../media/platform/broadcom/bcm2835-unicam.c | 2741 +++++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 2 + include/uapi/linux/videodev2.h | 2 + 14 files changed, 3247 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml create mode 100644 drivers/media/platform/broadcom/Kconfig create mode 100644 drivers/media/platform/broadcom/Makefile create mode 100644 drivers/media/platform/broadcom/bcm2835-unicam-regs.h create mode 100644 drivers/media/platform/broadcom/bcm2835-unicam.c
base-commit: 47120f3da814440058a9823bf9ac3a660b2ce9c0
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v11 1/5 media: v4l: Add V4L2-PIX-FMT-Y12P format
From: Jean-Michel Hautbois <[email protected]>
This is a packed grey-scale image format with a depth of 12 bits per pixel. Two consecutive pixels are packed into 3 bytes. The first 2 bytes contain the 8 high order bits of the pixels, and the 3rd byte contains the 4 least significants bits of each pixel, in the same order.
Add the entry in userspace API, and document it.
--- .../userspace-api/media/v4l/pixfmt-yuv-luma.rst | 11 +++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 13 insertions(+)
Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +11 -0
@@ -114,6 +114,17 @@ are often referred to as greyscale formats. - ... - ... + * .. _V4L2-PIX-FMT-Y12P: + + - ``V4L2_PIX_FMT_Y12P`` + - 'Y12P' + + - Y'\ :sub:`0`\ [11:4] + - Y'\ :sub:`1`\ [11:4] + - Y'\ :sub:`1`\ [3:0] Y'\ :sub:`0`\ [3:0] + - ... + - ... + * .. _V4L2-PIX-FMT-Y14: - ``V4L2_PIX_FMT_Y14``
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1321,6 +1321,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_Y10BPACK : descr ="10-bit Greyscale (Packed)" ;break ;case V4L2_PIX_FMT_Y10P : descr ="10-bit Greyscale (MIPI Packed)" ;break ;case V4L2_PIX_FMT_IPU3_Y10 : descr ="10-bit greyscale (IPU3 Packed)" ;break ; +case V4L2_PIX_FMT_Y12P : descr ="12-bit Greyscale (MIPI Packed)" ;break ;case V4L2_PIX_FMT_Y8I : descr ="Interleaved 8-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y12I : descr ="Interleaved 12-bit Greyscale" ;break ;case V4L2_PIX_FMT_Z16 : descr ="16-bit Depth" ;break ;
include/uapi/linux/videodev2.h +1 -0
@@ -599,6 +599,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B')/* 10 Greyscale bit-packed */ #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P')/* 10 Greyscale, MIPI RAW10 packed */ #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y')/* IPU3 packed 10-bit greyscale */ +#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P')/* 12 Greyscale, MIPI RAW12 packed */ /* Palette formats */ #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8')/* 8 8-bit palette */
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v11 2/5 media: v4l: Add V4L2-PIX-FMT-Y14P format
In reply to Laurent PinchartFrom: Jean-Michel Hautbois <[email protected]>
This is a packed grey-scale image format with a depth of 14 bits per pixel. Every four consecutive samples are packed into seven bytes. Each of the first four bytes contain the eight high order bits of the pixels, and the three following bytes contains the six least significants bits of each pixel, in the same order.
As the other formats only needed 5 bytes before, append two bytes in the documentation array.
--- .../media/v4l/pixfmt-yuv-luma.rst | 37 +++++++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 3 files changed, 39 insertions(+)
Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst +37 -0
@@ -36,6 +36,8 @@ are often referred to as greyscale formats. - Byte 2 - Byte 3 - Byte 4 + - Byte 5 + - Byte 6 * .. _V4L2-PIX-FMT-GREY:
@@ -47,6 +49,8 @@ are often referred to as greyscale formats. - ... - ... - ... + - ... + - ... * .. _V4L2-PIX-FMT-IPU3-Y10:
@@ -58,6 +62,8 @@ are often referred to as greyscale formats. - Y'\ :sub:`2`\ [3:0] Y'\ :sub:`1`\ [9:6] - Y'\ :sub:`3`\ [1:0] Y'\ :sub:`2`\ [9:4] - Y'\ :sub:`3`\ [9:2] + - ... + - ... * .. _V4L2-PIX-FMT-Y10:
@@ -69,6 +75,8 @@ are often referred to as greyscale formats. - ... - ... - ... + - ... + - ... * .. _V4L2-PIX-FMT-Y10BPACK:
@@ -80,6 +88,8 @@ are often referred to as greyscale formats. - Y'\ :sub:`1`\ [3:0] Y'\ :sub:`2`\ [9:6] - Y'\ :sub:`2`\ [5:0] Y'\ :sub:`3`\ [9:8] - Y'\ :sub:`3`\ [7:0] + - ... + - ... * .. _V4L2-PIX-FMT-Y10P:
@@ -91,6 +101,8 @@ are often referred to as greyscale formats. - Y'\ :sub:`2`\ [9:2] - Y'\ :sub:`3`\ [9:2] - Y'\ :sub:`3`\ [1:0] Y'\ :sub:`2`\ [1:0] Y'\ :sub:`1`\ [1:0] Y'\ :sub:`0`\ [1:0] + - ... + - ... * .. _V4L2-PIX-FMT-Y12:
@@ -102,6 +114,8 @@ are often referred to as greyscale formats. - ... - ... - ... + - ... + - ... * .. _V4L2-PIX-FMT-Y012:
@@ -113,6 +127,8 @@ are often referred to as greyscale formats. - ... - ... - ... + - ... + - ... * .. _V4L2-PIX-FMT-Y12P:
@@ -124,6 +140,8 @@ are often referred to as greyscale formats. - Y'\ :sub:`1`\ [3:0] Y'\ :sub:`0`\ [3:0] - ... - ... + - ... + - ... * .. _V4L2-PIX-FMT-Y14:
@@ -135,6 +153,21 @@ are often referred to as greyscale formats. - ... - ... - ... + - ... + - ... + + * .. _V4L2-PIX-FMT-Y14P: + + - ``V4L2_PIX_FMT_Y14P`` + - 'Y14P' + + - Y'\ :sub:`0`\ [13:6] + - Y'\ :sub:`1`\ [13:6] + - Y'\ :sub:`2`\ [13:6] + - Y'\ :sub:`3`\ [13:6] + - Y'\ :sub:`1`\ [1:0] Y'\ :sub:`0`\ [5:0] + - Y'\ :sub:`2`\ [3:0] Y'\ :sub:`1`\ [5:2] + - Y'\ :sub:`3`\ [5:0] Y'\ :sub:`2`\ [5:4] * .. _V4L2-PIX-FMT-Y16:
@@ -146,6 +179,8 @@ are often referred to as greyscale formats. - ... - ... - ... + - ... + - ... * .. _V4L2-PIX-FMT-Y16-BE:
@@ -157,6 +192,8 @@ are often referred to as greyscale formats. - ... - ... - ... + - ... + - ... .. raw:: latex
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1322,6 +1322,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_PIX_FMT_Y10P : descr ="10-bit Greyscale (MIPI Packed)" ;break ;case V4L2_PIX_FMT_IPU3_Y10 : descr ="10-bit greyscale (IPU3 Packed)" ;break ;case V4L2_PIX_FMT_Y12P : descr ="12-bit Greyscale (MIPI Packed)" ;break ; +case V4L2_PIX_FMT_Y14P : descr ="14-bit Greyscale (MIPI Packed)" ;break ;case V4L2_PIX_FMT_Y8I : descr ="Interleaved 8-bit Greyscale" ;break ;case V4L2_PIX_FMT_Y12I : descr ="Interleaved 12-bit Greyscale" ;break ;case V4L2_PIX_FMT_Z16 : descr ="16-bit Depth" ;break ;
include/uapi/linux/videodev2.h +1 -0
@@ -600,6 +600,7 @@ struct v4l2_pix_format {#define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P')/* 10 Greyscale, MIPI RAW10 packed */ #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y')/* IPU3 packed 10-bit greyscale */ #define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P')/* 12 Greyscale, MIPI RAW12 packed */ +#define V4L2_PIX_FMT_Y14P v4l2_fourcc('Y', '1', '4', 'P')/* 14 Greyscale, MIPI RAW14 packed */ /* Palette formats */ #define V4L2_PIX_FMT_PAL8 v4l2_fourcc('P', 'A', 'L', '8')/* 8 8-bit palette */
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v11 3/5 dt-bindings: media: Add bindings for bcm2835-unicam
In reply to Laurent PinchartFrom: Dave Stevenson <[email protected]>
Introduce the dt-bindings documentation for bcm2835 CCP2/CSI2 Unicam camera interface.
---
Changes since v7:
- Make bus-type mandatory
- Refuse additional properties for endpoint
Changes since v5:
- Squash MAINTAINERS changes in
Changes since v3:
- Make MAINTAINERS its own patch
- Describe the reg and clocks correctly
- Use a vendor entry for the number of data lanes
--- .../bindings/media/brcm,bcm2835-unicam.yaml | 127 ++++++++++++++++++ MAINTAINERS | 6 + 2 files changed, 133 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml
Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml new file +127 -0
@@ -0,0 +1,127 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/brcm,bcm2835-unicam.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Broadcom BCM283x Camera Interface (Unicam) + +maintainers: + - Raspberry Pi Kernel Maintenance <[email protected]> + +description: |- + The Unicam block on BCM283x SoCs is the receiver for either + CSI-2 or CCP2 data from image sensors or similar devices. + + The main platform using this SoC is the Raspberry Pi family of boards. On + the Pi the VideoCore firmware can also control this hardware block, and + driving it from two different processors will cause issues. To avoid this, + the firmware checks the device tree configuration during boot. If it finds + device tree nodes whose name starts with 'csi' then it will stop the firmware + accessing the block, and it can then safely be used via the device tree + binding. + +properties: + compatible: + const: brcm,bcm2835-unicam + + reg: + items: + - description: Unicam block. + - description: Clock Manager Image (CMI) block. + + reg-names: + items: + - const: unicam + - const: cmi + + interrupts: + maxItems: 1 + + clocks: + items: + - description: Clock to drive the LP state machine of Unicam. + - description: Clock for the VPU (core clock). + + clock-names: + items: + - const: lp + - const: vpu + + power-domains: + items: + - description: Unicam power domain + + brcm,num-data-lanes: + $ref: /schemas/types.yaml#/definitions/uint32 + enum: [ 2, 4 ] + description: | + Number of CSI-2 data lanes supported by this Unicam instance. The number + of data lanes actively used is specified with the data-lanes endpoint + property. + + port: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + + properties: + endpoint: + $ref: /schemas/media/video-interfaces.yaml# + additionalProperties: false + + properties: + bus-type: + enum: [ 3, 4 ] + + clock-noncontinuous: true + data-lanes: true + remote-endpoint: true + + required: + - bus-type + - data-lanes + - remote-endpoint + + required: + - endpoint + +required: + - compatible + - reg + - reg-names + - interrupts + - clocks + - clock-names + - power-domains + - brcm,num-data-lanes + - port + +additionalProperties: False + +examples: + - | + #include <dt-bindings/clock/bcm2835.h> + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/media/video-interfaces.h> + #include <dt-bindings/power/raspberrypi-power.h> + + csi1: csi@7e801000 { + compatible = "brcm,bcm2835-unicam"; + reg = <0x7e801000 0x800>, + <0x7e802004 0x4>; + reg-names = "unicam", "cmi"; + interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&clocks BCM2835_CLOCK_CAM1>, + <&firmware_clocks 4>; + clock-names = "lp", "vpu"; + power-domains = <&power RPI_POWER_DOMAIN_UNICAM1>; + brcm,num-data-lanes = <2>; + port { + csi1_ep: endpoint { + remote-endpoint = <&imx219_0>; + bus-type = <MEDIA_BUS_TYPE_CSI2_DPHY>; + data-lanes = <1 2>; + }; + }; + }; +...
MAINTAINERS +6 -0
@@ -4034,6 +4034,12 @@ N: bcm113* N: bcm216* N: kona +BROADCOM BCM2835 CAMERA DRIVERS +M: Raspberry Pi Kernel Maintenance <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml + BROADCOM BCM47XX MIPS ARCHITECTURE M: Hauke Mehrtens <[email protected]> M: Rafał Miłecki <[email protected]>
Signature · 3 lines
Regards, Laurent Pinchart
PATCH v11 4/5 media: bcm2835-unicam: Add support for CCP2/CSI2 camera interface
In reply to Laurent PinchartFrom: Dave Stevenson <[email protected]>
Add a driver for the Unicam camera receiver block on BCM283x processors. It is represented as two video device nodes: unicam-image and unicam-embedded which are connected to an internal subdev (named unicam-subdev) in order to manage streams routing.
---
Changes since v8:
- Use MIPI_CSI2_DT_* macros
- Disable image stream on start error
- Move hardware configuration to unicam_sd_enable_streams()
- Get VC and DT from frame descriptor
- Don't cache fmtinfo in unicam_node
- Calculate line_int_freq based on subdev format
- Fix try_fmt_meta regression from v5
- Replace streaming flag with vb2_start_streaming_called()
- Use vb2_video_unregister_device()
Changes since v7:
- Indentation, line wrap and white space fixes
- Add copyright notice for Ideas on Board
- Use unsigned values for shifts in macro
- Replace condition and assignment with max()
- Don't set the serial to an empty string manually
- Don't use loop for lane clocks setting
- Store PUM value in struct unicam_format_info
Changes since v6:
- Fix typos in comments
- Drop outdated comment
- Indentation fixes
- Turn UNICAM_SD_PAD_* into an enum
- Drop unicam_format_info.metadata_fmt
- Remove unneeded dev_dbg()
- Report meta frame sizes as V4L2_FRMSIZE_TYPE_STEPWISE
- Drop stray semicolons
- Set V4L2_FMT_FLAG_META_LINE_BASED for metadata format
- Rename error label
- Use .get_mbus_config() to get number of data lanes
- Drop minimum of 3 buffers in .queue_setup()
- Merge locks for the two video nodes
- Rework start/stop to avoid race conditions
Changes since v5:
- Move to drivers/media/platform/broadcom/
- Port to the upstream V4L2 streams API
- Rebase on latest metadata API proposal
- Add missing error message
- Drop unneeded documentation block for unicam_isr()
- Drop unneeded dev_dbg() and dev_err() messages
- Drop unneeded streams_mask and fmt checks
- Drop unused unicam_sd_pad_is_sink()
- Drop unneeded includes
- Drop v4l2_ctrl_subscribe_event() call
- Use pm_runtime_resume_and_get()
- Indentation and line wrap fixes
- Let the framework set bus_info
- Use v4l2_fwnode_endpoint_parse()
- Fix media device cleanup
- Drop lane reordering checks
- Fix subdev state locking
- Drop extra debug messages
- Move clock handling to runtime PM handlers
- Reorder functions
- Rename init functions for more clarity
- Initialize runtime PM earlier
- Clarify error messages
- Simplify subdev init with local variable
- Fix subdev cleanup
- Fix typos and indentation
- Don't initialize local variables needlessly
- Simplify num lanes check
- Fix metadata handling in subdev set_fmt
- Drop manual fallback to .s_stream()
- Pass v4l2_pix_format to unicam_calc_format_size_bpl()
- Simplify unicam_set_default_format()
- Fix default format settings
- Add busy check in unicam_s_fmt_meta()
- Add missing \n at end of format strings
- Fix metadata handling in subdev set_fmt
- Fix locking when starting streaming
- Return buffers from start streaming fails
- Fix format validation for metadata node
- Use video_device_pipeline_{start,stop}() helpers
- Simplify format enumeration
- Drop unset variable
- Update MAINTAINERS entry
- Update to the upstream v4l2_async_nf API
- Update to the latest subdev routing API
- Update to the latest subdev state API
- Move from subdev .init_cfg() to .init_state()
- Update to the latest videobuf2 API
- Fix v4l2_subdev_enable_streams() error check
- Use correct pad for the connected subdev
- Return buffers to vb2 when start streaming fails
- Improve debugging in start streaming handler
- Simplify DMA address management
- Drop comment about bcm2835-camera driver
- Clarify comments that explain min/max sizes
- Pass v4l2_pix_format to unicam_try_fmt()
- Drop unneeded local variables
- Rename image-related constants and functions
- Turn unicam_fmt.metadata_fmt into bool
- Rename unicam_fmt to unicam_format_info
- Rename unicam_format_info variables to fmtinfo
- Rename unicam_node.v_fmt to fmt
- Add metadata formats for RAW10, RAW12 and RAW14
- Make metadata formats line-based
- Validate format on metadata video device
- Add Co-devlopped-by tags
Changes since v3:
- Add the vendor prefix for DT name
- Use the reg-names in DT parsing
- Remove MAINTAINERS entry
Changes since v2:
- Change code organization
- Remove unused variables
- Correct the fmt_meta functions
- Rewrite the start/stop streaming
- You can now start the image node alone, but not the metadata one
- The buffers are allocated per-node
- only the required stream is started, if the route exists and is enabled
- Prefix the macros with UNICAM_ to not have too generic names
- Drop colorspace support
Changes since v1:
- Replace the unicam_{info,debug,error} macros with dev_*()
--- MAINTAINERS | 1 + drivers/media/platform/Kconfig | 1 + drivers/media/platform/Makefile | 1 + drivers/media/platform/broadcom/Kconfig | 23 + drivers/media/platform/broadcom/Makefile | 3 + .../platform/broadcom/bcm2835-unicam-regs.h | 246 ++ .../media/platform/broadcom/bcm2835-unicam.c | 2741 +++++++++++++++++ 7 files changed, 3016 insertions(+) create mode 100644 drivers/media/platform/broadcom/Kconfig create mode 100644 drivers/media/platform/broadcom/Makefile create mode 100644 drivers/media/platform/broadcom/bcm2835-unicam-regs.h create mode 100644 drivers/media/platform/broadcom/bcm2835-unicam.c
MAINTAINERS +1 -0
@@ -4039,6 +4039,7 @@ M: Raspberry Pi Kernel Maintenance <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yaml +F: drivers/media/platform/bcm2835/ BROADCOM BCM47XX MIPS ARCHITECTURE M: Hauke Mehrtens <[email protected]>
drivers/media/platform/Kconfig +1 -0
@@ -67,6 +67,7 @@ source "drivers/media/platform/amlogic/Kconfig" source "drivers/media/platform/amphion/Kconfig" source "drivers/media/platform/aspeed/Kconfig" source "drivers/media/platform/atmel/Kconfig" +source "drivers/media/platform/broadcom/Kconfig" source "drivers/media/platform/cadence/Kconfig" source "drivers/media/platform/chips-media/Kconfig" source "drivers/media/platform/intel/Kconfig"
drivers/media/platform/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-y += amlogic/ obj-y += amphion/ obj-y += aspeed/ obj-y += atmel/ +obj-y += broadcom/ obj-y += cadence/ obj-y += chips-media/ obj-y += intel/
drivers/media/platform/broadcom/Kconfig new file +23 -0
@@ -0,0 +1,23 @@ +# SPDX-License-Identifier: GPL-2.0 + +config VIDEO_BCM2835_UNICAM + tristate "Broadcom BCM283x/BCM271x Unicam video capture driver" + depends on ARCH_BCM2835 || COMPILE_TEST + depends on PM + depends on VIDEO_DEV + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + select VIDEOBUF2_DMA_CONTIG + help + Say Y here to enable support for the BCM283x/BCM271x CSI-2 receiver. + This is a V4L2 driver that controls the CSI-2 receiver directly, + independently from the VC4 firmware. + + This driver is mutually exclusive with the use of bcm2835-camera. The + firmware will disable all access to the peripheral from within the + firmware if it finds a DT node using it, and bcm2835-camera will + therefore fail to probe. + + To compile this driver as a module, choose M here. The module will be + called bcm2835-unicam.
drivers/media/platform/broadcom/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_VIDEO_BCM2835_UNICAM) += bcm2835-unicam.o
drivers/media/platform/broadcom/bcm2835-unicam-regs.h new file +246 -0
246 lines not on this page · raw message
drivers/media/platform/broadcom/bcm2835-unicam.c new file +2741 -0
2,707 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 3 lines
Regards, Laurent Pinchart
Part of the diff is not shown here. View the raw message.
PATCH v11 5/5 ARM: dts: bcm2835: Add Unicam CSI nodes
In reply to Laurent PinchartFrom: Jean-Michel Hautbois <[email protected]>
Add both MIPI CSI-2 nodes in the bcm283x tree and take care of the Raspberry Pi / BCM2711 specific in the related files.
--- arch/arm/boot/dts/broadcom/bcm2711.dtsi | 8 +++++++ arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi | 14 ++++++++++++ arch/arm/boot/dts/broadcom/bcm283x.dtsi | 24 +++++++++++++++++++++ 3 files changed, 46 insertions(+)
arch/arm/boot/dts/broadcom/bcm2711.dtsi +8 -0
@@ -1114,6 +1114,14 @@ &rmem { #address-cells = <2>; }; +&csi0 { + interrupts = <GIC_SPI 102 IRQ_TYPE_LEVEL_HIGH>; +}; + +&csi1 { + interrupts = <GIC_SPI 103 IRQ_TYPE_LEVEL_HIGH>; +}; + &cma { /* * arm64 reserves the CMA by default somewhere in ZONE_DMA32,
arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi +14 -0
@@ -25,6 +25,20 @@ vchiq: mailbox@7e00b840 { }; }; +&csi0 { + clocks = <&clocks BCM2835_CLOCK_CAM0>, + <&firmware_clocks 4>; + clock-names = "lp", "vpu"; + power-domains = <&power RPI_POWER_DOMAIN_UNICAM0>; +}; + +&csi1 { + clocks = <&clocks BCM2835_CLOCK_CAM1>, + <&firmware_clocks 4>; + clock-names = "lp", "vpu"; + power-domains = <&power RPI_POWER_DOMAIN_UNICAM1>; +}; + &gpio { gpioout: gpioout { brcm,pins = <6>;
arch/arm/boot/dts/broadcom/bcm283x.dtsi +24 -0
@@ -454,6 +454,30 @@ dsi1: dsi@7e700000 { status = "disabled"; }; + csi0: csi@7e800000 { + compatible = "brcm,bcm2835-unicam"; + reg = <0x7e800000 0x800>, + <0x7e802000 0x4>; + reg-names = "unicam", "cmi"; + interrupts = <2 6>; + brcm,num-data-lanes = <2>; + status = "disabled"; + port { + }; + }; + + csi1: csi@7e801000 { + compatible = "brcm,bcm2835-unicam"; + reg = <0x7e801000 0x800>, + <0x7e802004 0x4>; + reg-names = "unicam", "cmi"; + interrupts = <2 7>; + brcm,num-data-lanes = <4>; + status = "disabled"; + port { + }; + }; + i2c1: i2c@7e804000 { compatible = "brcm,bcm2835-i2c"; reg = <0x7e804000 0x1000>;
Signature · 3 lines
Regards, Laurent Pinchart
Re: [PATCH v11 5/5] ARM: dts: bcm2835: Add Unicam CSI nodes
Quoted 8 lines · Laurent Pinchart
From: Jean-Michel Hautbois <[email protected]>
Add both MIPI CSI-2 nodes in the bcm283x tree and take care of the Raspberry Pi / BCM2711 specific in the related files.
Signed-off-by Jean-Michel Hautbois <[email protected]>Reviewed-by Laurent Pinchart <[email protected]>Signed-off-by Stefan Wahren <[email protected]>
Applied to https://github.com/Broadcom/stblinux/commits/devicetree/next, thanks! --
Florian
Florian Fainelli
maintainerHi Laurent,
Quoted 63 lines · Laurent Pinchart
Hello everybody,
This patch series adds a new driver for the BCM2835 (and derivative) CCP2/CSI2 camera interface named Unicam. This IP core is found in the VC4-based Raspberry Pi, namely the Pi Zero, Pi 3 and Pi 4.
Camera support for Raspberry Pi 4 currently relies on a downstream Unicam driver that lives in the Raspberry Pi kernel tree ([1]). The driver uses the V4L2 API, but works around the lack of features in V4L2 to properly support sensor embedded data. Since the Unicam driver development by Raspberry Pi, some of those features have been merged in the kernel (namely the V4L2 streams API) or are being developed (namely generic metadata formats and subdev internal pads), with patches posted for review on the linux-media mailing list ([2], [3]).
This new upstream driver is based on the downstream code, extensively reworked to use the new V4L2 APIs.
The series is based on the generic metadata ([2]) and internal pads ([3], v9) APIs. It can be found in my tree in [4]. Testing it requires extra branches, which are also pushed to the same tree, and organized as follows:
- rpi/v6.9/base: The mainline tag that all the work is based on (currently v6.9-rc2)
- rpi/v6.9/backports: DT integration fixes for bcm238x, backported from linux-next
- rpi/v6.9/isp/v2: The ISP driver, which is getting upstreamed separately
- rpi/v6.9/metadata/v10/base: The V4L2 embedded data patches
- rpi/v6.9/metadata/v10/sensors: The V4L2 internal pads patches
- rpi/v6.9/unicam/next: The Unicam driver, based on the rpi/v6.9/metadata/v10/base branch that it depends on
- rpi/v6.9/imx219: Embedded data support for the imx219 driver, based on the rpi/v6.9/metadata/v10/sensors branch that it depends on
- rpi/v6.9/merge: A merge of the backports, isp/v2, unicam/next and imx219 branches
- rpi/v6.9/overlays: A sample overlay for the imx219 camera sensor connected to a Raspberry Pi 4The series starts with two patches that add new V4L2 pixel formats (1/5 and 2/5), followed by the Unicam DT bindings (3/5) and driver (4/5). Finally, it ends with DT integration for the Unicam devices (5/5).
Compared to v10, I have rebased the patches on top of the latest version of the generic metadata series ([2]), to prepare for a merge in (hopefully) v6.10.
The patches have been tested on a Raspberry Pi 4 using an IMX219 camera module (the Raspberry Pi camera v2), with libcamera. Updates are needed to libcamera to use the new V4L2 APIs, patches have been posted to [5]. For manual testing with media-ctl, corresponding API updates to v4l-utils have been posted to the linux-media mailing list ([6]) and pushed to [7].
With this version I believe we are ready to merge the driver upstream. Sensor driver changes, which require more work, with their corresponding V4L2 API extensions, have been split out. The Unicam driver now depends only on the core part of the embedded data API extensions, which I believe is ready. Corresponding updates for v4l-utils have been developed and submitted. This series, along with the libcamera support, helps validating the new kernel APIs.
Quoted 2 lines
Sakari, please feel free to apply this on top of your generic metadata branch and include it in your pull request for v6.10.
To miminize conflicts, I believe I should be taking patch #5 via the ARM SoC pull request since I already have merged patches there that are pre-requisites for patch #5 to apply. Let me know if that does not work.
Quoted 577 lines
Below you will find the mandatory v4l2-compliance reports. It requires the v4l-utils updates from [7]. There is a total of 4 warnings, all related to the imx219 driver. They will be addressed separately, as part of the effort to add embedded data support to the imx219 driver.
[1] https://github.com/raspberrypi/linux/tree/rpi-6.1.y/drivers/media/platform/bcm2835
[3] https://lore.kernel.org/linux-media/[email protected]/
[4] https://lore.kernel.org/linux-media/[email protected]/
[4] https://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git/log/?h=rpi/v6.9/unicam/next
[5] https://lists.libcamera.org/pipermail/libcamera-devel/2024-March/040711.html
[6] https://lore.kernel.org/linux-media/[email protected]/
[7] https://git.linuxtv.org/pinchartl/v4l-utils.git/log/?h=metadatav4l2-compliance 1.27.0-5195, 64 bits, 64-bit
time_tv4l2-compliance SHA:9356d44374db2024-04-24 11:58:36Compliance test for unicam device
/dev/media0:Media Driver Info:
Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0Required ioctls:
testMEDIA_IOC_DEVICE_INFO: OK
test invalid ioctls: OKAllow for multiple opens:
test second/dev/media0open: OK
testMEDIA_IOC_DEVICE_INFO: OK
test for unlimited opens: OKMedia Controller ioctls:
testMEDIA_IOC_G_TOPOLOGY: OK
Entities: 4 Interfaces: 4 Pads: 8 Links: 7 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK testMEDIA_IOC_SETUP_LINK: OKTotal for unicam device
/dev/media0: 8, Succeeded: 8, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device/dev/video0:Driver Info:
Driver name : unicam Card type : unicam Bus info : platform:fe801000.csi Driver version : 6.9.0 Capabilities : 0xa4a00001Video Capture
Metadata Capture
I/O MC
Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x24200001
Video Capture
I/O MC
Streaming
Extended Pix Format
Media Driver Info:Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x0300000d Type : V4L Video Entity Info: ID : 0x0000000b (11) Name : unicam-image Function : V4L2 I/O Flags : default Pad 0x0100000c : 0: Sink Link 0x0200000f: from remote pad 0x1000003 of entity 'unicam' (Video Interface Bridge): Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OK
test invalid ioctls: OKAllow for multiple opens:
test second/dev/video0open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OKInput ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) testVIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) testVIDIOC_G_FBUF: OK (Not Supported) testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
testVIDIOC_S_FMT: OK
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OKCodec ioctls (Input 0):
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK testCREATE_BUFSmaximum buffers: OK testVIDIOC_REMOVE_BUFS: OK
testVIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)Total for unicam device
/dev/video0: 48, Succeeded: 48, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device/dev/video1:Driver Info:
Driver name : unicam Card type : unicam Bus info : platform:fe801000.csi Driver version : 6.9.0 Capabilities : 0xa4a00001Video Capture
Metadata Capture
I/O MC
Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x24a00000
Metadata Capture
I/O MC
Streaming
Extended Pix Format
Media Driver Info:Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x03000013 Type : V4L Video Entity Info: ID : 0x00000011 (17) Name : unicam-embedded Function : V4L2 I/O Pad 0x01000012 : 0: Sink Link 0x02000015: from remote pad 0x1000004 of entity 'unicam' (Video Interface Bridge): Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OK
test invalid ioctls: OKAllow for multiple opens:
test second/dev/video1open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OKInput ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) testVIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) testVIDIOC_G_FBUF: OK (Not Supported) testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
testVIDIOC_S_FMT: OK
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)Codec ioctls (Input 0):
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK testCREATE_BUFSmaximum buffers: OK testVIDIOC_REMOVE_BUFS: OK
testVIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)Total for unicam device
/dev/video1: 48, Succeeded: 48, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device/dev/v4l-subdev0:Driver Info:
Driver version : 6.9.0 Capabilities : 0x00000002 Streams Support Client Capabilities: 0x0000000000000003 streams interval-uses-which Media Driver Info: Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x03000017 Type : V4L Sub-Device Entity Info: ID : 0x00000001 (1) Name : unicam Function : Video Interface Bridge Pad 0x01000002 : 0: Sink Link 0x02000009: from remote pad 0x1000006 of entity 'imx219 5-0010' (Camera Sensor): Data, Enabled, Immutable Pad 0x01000003 : 1: Source Link 0x0200000f: to remote pad 0x100000c of entity 'unicam-image' (V4L2 I/O): Data, Enabled, Immutable Pad 0x01000004 : 2: Source Link 0x02000015: to remote pad 0x1000012 of entity 'unicam-embedded' (V4L2 I/O): Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OKAllow for multiple opens:
test second/dev/v4l-subdev0open: OK
testVIDIOC_SUBDEV_QUERYCAP: OK
test for unlimited opens: OKDebug ioctls:
testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Sub-Device routing ioctls:
test Try VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OK test Active VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OKSub-Device ioctls (Sink Pad 0):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)Sub-Device ioctls (Source Pad 1):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)Sub-Device ioctls (Source Pad 2):
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) testVIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported) test VIDIOC_G/S_PARM: OK (Not Supported)
testVIDIOC_G_FBUF: OK (Not Supported)
testVIDIOC_G_FMT: OK (Not Supported)
testVIDIOC_TRY_FMT: OK (Not Supported)
testVIDIOC_S_FMT: OK (Not Supported)
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) testCREATE_BUFSmaximum buffers: OK
testVIDIOC_REMOVE_BUFS: OK
testVIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)Total for unicam device
/dev/v4l-subdev0: 62, Succeeded: 62, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device/dev/v4l-subdev1:Driver Info:
Driver version : 6.9.0 Capabilities : 0x00000002 Streams Support Client Capabilities: 0x0000000000000003 streams interval-uses-which Media Driver Info: Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x03000019 Type : V4L Sub-Device Entity Info: ID : 0x00000005 (5) Name : imx219 5-0010 Function : Camera Sensor Pad 0x01000006 : 0: Source Link 0x02000009: to remote pad 0x1000002 of entity 'unicam' (Video Interface Bridge): Data, Enabled, Immutable Pad 0x01000007 : 1: Sink, 00000008 Pad 0x01000008 : 2: Sink, 00000008Required ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OKAllow for multiple opens:
test second/dev/v4l-subdev1open: OK
testVIDIOC_SUBDEV_QUERYCAP: OK
test for unlimited opens: OKDebug ioctls:
testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Sub-Device routing ioctls:
test Try VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OK test Active VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OKSub-Device ioctls (Source Pad 0):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Try VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566):VIDIOC_SUBDEV_G_SELECTIONis supported for target 0 but notVIDIOC_SUBDEV_S_SELECTION
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
Try Stream 1
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported)
Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Active VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566):VIDIOC_SUBDEV_G_SELECTIONis supported for target 0 but notVIDIOC_SUBDEV_S_SELECTION
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
Active Stream 1
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported)
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)Sub-Device ioctls (Sink Pad 1):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Try VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566):VIDIOC_SUBDEV_G_SELECTIONis supported for target 0 but notVIDIOC_SUBDEV_S_SELECTION
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Active VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566):VIDIOC_SUBDEV_G_SELECTIONis supported for target 0 but notVIDIOC_SUBDEV_S_SELECTION
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)Sub-Device ioctls (Sink Pad 2):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK testVIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 20 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported) test VIDIOC_G/S_PARM: OK (Not Supported)
testVIDIOC_G_FBUF: OK (Not Supported)
testVIDIOC_G_FMT: OK (Not Supported)
testVIDIOC_TRY_FMT: OK (Not Supported)
testVIDIOC_S_FMT: OK (Not Supported)
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) testCREATE_BUFSmaximum buffers: OK
testVIDIOC_REMOVE_BUFS: OK
testVIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)Total for unicam device
/dev/v4l-subdev1: 76, Succeeded: 76, Failed: 0, Warnings: 4Grand Total for unicam device
/dev/media0: 242, Succeeded: 242, Failed: 0, Warnings: 4Dave Stevenson (2):
dt-bindings: media: Add bindings for bcm2835-unicam
media: bcm2835-unicam: Add support for CCP2/CSI2 camera interfaceJean-Michel Hautbois (3):
media: v4l: Add V4L2-PIX-FMT-Y12P format
media: v4l: Add V4L2-PIX-FMT-Y14P format
ARM: dts: bcm2835: Add Unicam CSI nodes.../bindings/media/brcm,bcm2835-unicam.yaml | 127 + .../media/v4l/pixfmt-yuv-luma.rst | 48 + MAINTAINERS | 7 + arch/arm/boot/dts/broadcom/bcm2711.dtsi | 8 + arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi | 14 + arch/arm/boot/dts/broadcom/bcm283x.dtsi | 24 + drivers/media/platform/Kconfig | 1 + drivers/media/platform/Makefile | 1 + drivers/media/platform/broadcom/Kconfig | 23 + drivers/media/platform/broadcom/Makefile | 3 + .../platform/broadcom/bcm2835-unicam-regs.h | 246 ++ .../media/platform/broadcom/bcm2835-unicam.c | 2741 +++++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 2 + include/uapi/linux/videodev2.h | 2 + 14 files changed, 3247 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yamlcreate mode 100644drivers/media/platform/broadcom/Kconfig
create mode 100644drivers/media/platform/broadcom/Makefile
create mode 100644drivers/media/platform/broadcom/bcm2835-unicam-regs.hcreate mode 100644drivers/media/platform/broadcom/bcm2835-unicam.cbase-commit:
47120f3da814440058a9823bf9ac3a660b2ce9c0
Signature · 1 line
Florian
Hi Florian,
Quoted 64 lines · Florian Fainelli
Quoted 63 lines · Laurent Pinchart
Hello everybody,
This patch series adds a new driver for the BCM2835 (and derivative) CCP2/CSI2 camera interface named Unicam. This IP core is found in the VC4-based Raspberry Pi, namely the Pi Zero, Pi 3 and Pi 4.
Camera support for Raspberry Pi 4 currently relies on a downstream Unicam driver that lives in the Raspberry Pi kernel tree ([1]). The driver uses the V4L2 API, but works around the lack of features in V4L2 to properly support sensor embedded data. Since the Unicam driver development by Raspberry Pi, some of those features have been merged in the kernel (namely the V4L2 streams API) or are being developed (namely generic metadata formats and subdev internal pads), with patches posted for review on the linux-media mailing list ([2], [3]).
This new upstream driver is based on the downstream code, extensively reworked to use the new V4L2 APIs.
The series is based on the generic metadata ([2]) and internal pads ([3], v9) APIs. It can be found in my tree in [4]. Testing it requires extra branches, which are also pushed to the same tree, and organized as follows:
- rpi/v6.9/base: The mainline tag that all the work is based on (currently v6.9-rc2)
- rpi/v6.9/backports: DT integration fixes for bcm238x, backported from linux-next
- rpi/v6.9/isp/v2: The ISP driver, which is getting upstreamed separately
- rpi/v6.9/metadata/v10/base: The V4L2 embedded data patches
- rpi/v6.9/metadata/v10/sensors: The V4L2 internal pads patches
- rpi/v6.9/unicam/next: The Unicam driver, based on the rpi/v6.9/metadata/v10/base branch that it depends on
- rpi/v6.9/imx219: Embedded data support for the imx219 driver, based on the rpi/v6.9/metadata/v10/sensors branch that it depends on
- rpi/v6.9/merge: A merge of the backports, isp/v2, unicam/next and imx219 branches
- rpi/v6.9/overlays: A sample overlay for the imx219 camera sensor connected to a Raspberry Pi 4The series starts with two patches that add new V4L2 pixel formats (1/5 and 2/5), followed by the Unicam DT bindings (3/5) and driver (4/5). Finally, it ends with DT integration for the Unicam devices (5/5).
Compared to v10, I have rebased the patches on top of the latest version of the generic metadata series ([2]), to prepare for a merge in (hopefully) v6.10.
The patches have been tested on a Raspberry Pi 4 using an IMX219 camera module (the Raspberry Pi camera v2), with libcamera. Updates are needed to libcamera to use the new V4L2 APIs, patches have been posted to [5]. For manual testing with media-ctl, corresponding API updates to v4l-utils have been posted to the linux-media mailing list ([6]) and pushed to [7].
With this version I believe we are ready to merge the driver upstream. Sensor driver changes, which require more work, with their corresponding V4L2 API extensions, have been split out. The Unicam driver now depends only on the core part of the embedded data API extensions, which I believe is ready. Corresponding updates for v4l-utils have been developed and submitted. This series, along with the libcamera support, helps validating the new kernel APIs.
Quoted 6 lines
Quoted 2 lines
Sakari, please feel free to apply this on top of your generic metadata branch and include it in your pull request for v6.10.
To miminize conflicts, I believe I should be taking patch #5 via the ARM SoC pull request since I already have merged patches there that are pre-requisites for patch #5 to apply. Let me know if that does not work.
That works for me. Sakari, please don't take patch 5/5 in your branch.
Quoted 576 lines
Quoted 576 lines
Below you will find the mandatory v4l2-compliance reports. It requires the v4l-utils updates from [7]. There is a total of 4 warnings, all related to the imx219 driver. They will be addressed separately, as part of the effort to add embedded data support to the imx219 driver.
[1] https://github.com/raspberrypi/linux/tree/rpi-6.1.y/drivers/media/platform/bcm2835
[3] https://lore.kernel.org/linux-media/[email protected]/
[4] https://lore.kernel.org/linux-media/[email protected]/
[4] https://git.kernel.org/pub/scm/linux/kernel/git/pinchartl/linux.git/log/?h=rpi/v6.9/unicam/next
[5] https://lists.libcamera.org/pipermail/libcamera-devel/2024-March/040711.html
[6] https://lore.kernel.org/linux-media/[email protected]/
[7] https://git.linuxtv.org/pinchartl/v4l-utils.git/log/?h=metadatav4l2-compliance 1.27.0-5195, 64 bits, 64-bit
time_tv4l2-compliance SHA:9356d44374db2024-04-24 11:58:36Compliance test for unicam device
/dev/media0:Media Driver Info:
Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0Required ioctls:
testMEDIA_IOC_DEVICE_INFO: OK
test invalid ioctls: OKAllow for multiple opens:
test second/dev/media0open: OK
testMEDIA_IOC_DEVICE_INFO: OK
test for unlimited opens: OKMedia Controller ioctls:
testMEDIA_IOC_G_TOPOLOGY: OK
Entities: 4 Interfaces: 4 Pads: 8 Links: 7 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK testMEDIA_IOC_SETUP_LINK: OKTotal for unicam device
/dev/media0: 8, Succeeded: 8, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device/dev/video0:Driver Info:
Driver name : unicam Card type : unicam Bus info : platform:fe801000.csi Driver version : 6.9.0 Capabilities : 0xa4a00001Video Capture
Metadata Capture
I/O MC
Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x24200001
Video Capture
I/O MC
Streaming
Extended Pix Format
Media Driver Info:Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x0300000d Type : V4L Video Entity Info: ID : 0x0000000b (11) Name : unicam-image Function : V4L2 I/O Flags : default Pad 0x0100000c : 0: Sink Link 0x0200000f: from remote pad 0x1000003 of entity 'unicam' (Video Interface Bridge): Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OK
test invalid ioctls: OKAllow for multiple opens:
test second/dev/video0open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OKInput ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) testVIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) testVIDIOC_G_FBUF: OK (Not Supported) testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
testVIDIOC_S_FMT: OK
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OKCodec ioctls (Input 0):
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK testCREATE_BUFSmaximum buffers: OK testVIDIOC_REMOVE_BUFS: OK
testVIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)Total for unicam device
/dev/video0: 48, Succeeded: 48, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device/dev/video1:Driver Info:
Driver name : unicam Card type : unicam Bus info : platform:fe801000.csi Driver version : 6.9.0 Capabilities : 0xa4a00001Video Capture
Metadata Capture
I/O MC
Streaming
Extended Pix Format
Device Capabilities
Device Caps :0x24a00000
Metadata Capture
I/O MC
Streaming
Extended Pix Format
Media Driver Info:Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x03000013 Type : V4L Video Entity Info: ID : 0x00000011 (17) Name : unicam-embedded Function : V4L2 I/O Pad 0x01000012 : 0: Sink Link 0x02000015: from remote pad 0x1000004 of entity 'unicam' (Video Interface Bridge): Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_QUERYCAP: OK
test invalid ioctls: OKAllow for multiple opens:
test second/dev/video1open: OK
testVIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OKDebug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) testVIDIOC_LOG_STATUS: OKInput ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK
test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 1 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Control ioctls (Input 0):
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) testVIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0Format ioctls (Input 0):
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK test VIDIOC_G/S_PARM: OK (Not Supported) testVIDIOC_G_FBUF: OK (Not Supported) testVIDIOC_G_FMT: OK
testVIDIOC_TRY_FMT: OK
testVIDIOC_S_FMT: OK
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported) test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)Codec ioctls (Input 0):
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls (Input 0):
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK testCREATE_BUFSmaximum buffers: OK testVIDIOC_REMOVE_BUFS: OK
testVIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)Total for unicam device
/dev/video1: 48, Succeeded: 48, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device/dev/v4l-subdev0:Driver Info:
Driver version : 6.9.0 Capabilities : 0x00000002 Streams Support Client Capabilities: 0x0000000000000003 streams interval-uses-which Media Driver Info: Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x03000017 Type : V4L Sub-Device Entity Info: ID : 0x00000001 (1) Name : unicam Function : Video Interface Bridge Pad 0x01000002 : 0: Sink Link 0x02000009: from remote pad 0x1000006 of entity 'imx219 5-0010' (Camera Sensor): Data, Enabled, Immutable Pad 0x01000003 : 1: Source Link 0x0200000f: to remote pad 0x100000c of entity 'unicam-image' (V4L2 I/O): Data, Enabled, Immutable Pad 0x01000004 : 2: Source Link 0x02000015: to remote pad 0x1000012 of entity 'unicam-embedded' (V4L2 I/O): Data, Enabled, ImmutableRequired ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OKAllow for multiple opens:
test second/dev/v4l-subdev0open: OK
testVIDIOC_SUBDEV_QUERYCAP: OK
test for unlimited opens: OKDebug ioctls:
testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Sub-Device routing ioctls:
test Try VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OK test Active VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OKSub-Device ioctls (Sink Pad 0):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)Sub-Device ioctls (Source Pad 1):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)Sub-Device ioctls (Source Pad 2):
Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK (Not Supported) testVIDIOC_QUERYCTRL: OK (Not Supported)
test VIDIOC_G/S_CTRL: OK (Not Supported)
test VIDIOC_G/S/TRY_EXT_CTRLS: OK (Not Supported) test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK (Not Supported) test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 0 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported) test VIDIOC_G/S_PARM: OK (Not Supported)
testVIDIOC_G_FBUF: OK (Not Supported)
testVIDIOC_G_FMT: OK (Not Supported)
testVIDIOC_TRY_FMT: OK (Not Supported)
testVIDIOC_S_FMT: OK (Not Supported)
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) testCREATE_BUFSmaximum buffers: OK
testVIDIOC_REMOVE_BUFS: OK
testVIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)Total for unicam device
/dev/v4l-subdev0: 62, Succeeded: 62, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for unicam device/dev/v4l-subdev1:Driver Info:
Driver version : 6.9.0 Capabilities : 0x00000002 Streams Support Client Capabilities: 0x0000000000000003 streams interval-uses-which Media Driver Info: Driver name : unicam Model : unicam Serial : Bus info : platform:fe801000.csi Media version : 6.9.0 Hardware revision: 0x00000000 (0) Driver version : 6.9.0 Interface Info: ID : 0x03000019 Type : V4L Sub-Device Entity Info: ID : 0x00000005 (5) Name : imx219 5-0010 Function : Camera Sensor Pad 0x01000006 : 0: Source Link 0x02000009: to remote pad 0x1000002 of entity 'unicam' (Video Interface Bridge): Data, Enabled, Immutable Pad 0x01000007 : 1: Sink, 00000008 Pad 0x01000008 : 2: Sink, 00000008Required ioctls:
test MC information (see 'Media Driver Info' above): OK testVIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OKAllow for multiple opens:
test second/dev/v4l-subdev1open: OK
testVIDIOC_SUBDEV_QUERYCAP: OK
test for unlimited opens: OKDebug ioctls:
testVIDIOC_LOG_STATUS: OK (Not Supported)Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) testVIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) testVIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) testVIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)Sub-Device routing ioctls:
test Try VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OK test Active VIDIOC_SUBDEV_G_ROUTING/VIDIOC_SUBDEV_S_ROUTING: OKSub-Device ioctls (Source Pad 0):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Try VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566):VIDIOC_SUBDEV_G_SELECTIONis supported for target 0 but notVIDIOC_SUBDEV_S_SELECTION
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
Try Stream 1
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported)
Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Active VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566):VIDIOC_SUBDEV_G_SELECTIONis supported for target 0 but notVIDIOC_SUBDEV_S_SELECTION
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
Active Stream 1
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported)
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)Sub-Device ioctls (Sink Pad 1):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Try VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566):VIDIOC_SUBDEV_G_SELECTIONis supported for target 0 but notVIDIOC_SUBDEV_S_SELECTION
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Active VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566):VIDIOC_SUBDEV_G_SELECTIONis supported for target 0 but notVIDIOC_SUBDEV_S_SELECTION
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)Sub-Device ioctls (Sink Pad 2):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK (Not Supported) test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK testVIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 20 Private Controls: 0Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported) test VIDIOC_G/S_PARM: OK (Not Supported)
testVIDIOC_G_FBUF: OK (Not Supported)
testVIDIOC_G_FMT: OK (Not Supported)
testVIDIOC_TRY_FMT: OK (Not Supported)
testVIDIOC_S_FMT: OK (Not Supported)
testVIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) testVIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) testCREATE_BUFSmaximum buffers: OK
testVIDIOC_REMOVE_BUFS: OK
testVIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)Total for unicam device
/dev/v4l-subdev1: 76, Succeeded: 76, Failed: 0, Warnings: 4Grand Total for unicam device
/dev/media0: 242, Succeeded: 242, Failed: 0, Warnings: 4Dave Stevenson (2):
dt-bindings: media: Add bindings for bcm2835-unicam
media: bcm2835-unicam: Add support for CCP2/CSI2 camera interfaceJean-Michel Hautbois (3):
media: v4l: Add V4L2-PIX-FMT-Y12P format
media: v4l: Add V4L2-PIX-FMT-Y14P format
ARM: dts: bcm2835: Add Unicam CSI nodes.../bindings/media/brcm,bcm2835-unicam.yaml | 127 + .../media/v4l/pixfmt-yuv-luma.rst | 48 + MAINTAINERS | 7 + arch/arm/boot/dts/broadcom/bcm2711.dtsi | 8 + arch/arm/boot/dts/broadcom/bcm2835-rpi.dtsi | 14 + arch/arm/boot/dts/broadcom/bcm283x.dtsi | 24 + drivers/media/platform/Kconfig | 1 + drivers/media/platform/Makefile | 1 + drivers/media/platform/broadcom/Kconfig | 23 + drivers/media/platform/broadcom/Makefile | 3 + .../platform/broadcom/bcm2835-unicam-regs.h | 246 ++ .../media/platform/broadcom/bcm2835-unicam.c | 2741 +++++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 2 + include/uapi/linux/videodev2.h | 2 + 14 files changed, 3247 insertions(+)create mode 100644
Documentation/devicetree/bindings/media/brcm,bcm2835-unicam.yamlcreate mode 100644drivers/media/platform/broadcom/Kconfig
create mode 100644drivers/media/platform/broadcom/Makefile
create mode 100644drivers/media/platform/broadcom/bcm2835-unicam-regs.hcreate mode 100644drivers/media/platform/broadcom/bcm2835-unicam.cbase-commit:
47120f3da814440058a9823bf9ac3a660b2ce9c0
Signature · 3 lines
Regards, Laurent Pinchart
Hi Laurent, Florian,
Quoted 8 lines · Laurent Pinchart
Quoted 6 lines
Quoted 2 lines
Sakari, please feel free to apply this on top of your generic metadata branch and include it in your pull request for v6.10.
To miminize conflicts, I believe I should be taking patch #5 via the ARM SoC pull request since I already have merged patches there that are pre-requisites for patch #5 to apply. Let me know if that does not work.
That works for me. Sakari, please don't take patch 5/5 in your branch.
Ack. Thanks for confirming this.
Signature · 3 lines
Regards, Sakari Ailus
[PATCH v11 6/5] media: bcm2835-unicam: Return error code when DT parsing fails
In reply to Laurent PinchartTwo of the error paths in unicam_async_nf_init() when DT parsing fails are not setting the ret variable, resulting in the function returning 0 on error. Fix it.
---
This patch should be squashed with "[PATCH v11 4/5] media:
bcm2835-unicam: Add support for CCP2/CSI2 camera interface".
--- drivers/media/platform/broadcom/bcm2835-unicam.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/platform/broadcom/bcm2835-unicam.c +2 -0
@@ -2519,6 +2519,7 @@ static int unicam_async_nf_init(struct unicam_device *unicam) num_data_lanes != 4) {dev_err (unicam->dev,"%u data lanes not supported\n" , num_data_lanes); + ret = -EINVAL ; goto error; }
@@ -2526,6 +2527,7 @@ static int unicam_async_nf_init(struct unicam_device *unicam)dev_err (unicam->dev,"Endpoint uses %u data lanes when %u are supported\n" , num_data_lanes, unicam->max_data_lanes); + ret = -EINVAL ; goto error; }
Signature · 3 lines
Regards, Laurent Pinchart
[PATCH v11.1 6/5] media: bcm2835-unicam: Return error code when DT parsing fails
Three of the error paths in unicam_async_nf_init() when DT parsing fails are not setting the ret variable, resulting in the function returning 0 on error. Fix it.
---
Changes since v11:
- Address a third error path
--- drivers/media/platform/broadcom/bcm2835-unicam.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/media/platform/broadcom/bcm2835-unicam.c +3 -0
@@ -2519,6 +2519,7 @@ static int unicam_async_nf_init(struct unicam_device *unicam) num_data_lanes != 4) {dev_err (unicam->dev,"%u data lanes not supported\n" , num_data_lanes); + ret = -EINVAL ; goto error; }
@@ -2526,6 +2527,7 @@ static int unicam_async_nf_init(struct unicam_device *unicam)dev_err (unicam->dev,"Endpoint uses %u data lanes when %u are supported\n" , num_data_lanes, unicam->max_data_lanes); + ret = -EINVAL ; goto error; }
@@ -2542,6 +2544,7 @@ static int unicam_async_nf_init(struct unicam_device *unicam)default :/* Unsupported bus type */ dev_err (unicam->dev,"Unsupported bus type %u\n" , ep.bus_type); + ret = -EINVAL ; goto error; }
base-commit: ddf6839f6b00b8c8f5f460452476a894417db4f2
Signature · 3 lines
Regards, Laurent Pinchart