Add Arm Mali-C720 Image Signal Processor Driver
Subsystems (2)
cover Add Arm Mali-C720 Image Signal Processor Driver
This patchset introduces a driver for Arm's Mali-C720 Image Signal Processor. The driver uses the V4L2 / media controller API and implements the following ISP features:
- Input and human vision pipelines:
The ISP has numerous processing pipelines. We implement support for the input pipeline as well as the human vision processing pipeline.
- Full resolution capture pipeline:
This capture pipeline supports both cropping and downscaling, as well as simultaneously outputting RGB and YUV data.
- Basic statistics and parameters blocks:
We have implemented a small set of the ISP statistics, covering pixel intensity histograms across both the input and human vision pipelines, as well as color statistics. We also include a small set of parameter blocks for digital gain, white balance, black level, square and square root transforms, and lastly decompanding.
- Basic output format support:
Currently we provide support for RGB24 and NV12 output formats.
The ISP supports much more functionality than this which we wish to include in future patch series, some of which is possible in the existing framework while others will require further development.
Alongside this we also have a series to enable support in libcamera. Both branches can be found on our GitLab [1]. We also have branches present for features currently in development that are not included in this series [2].
The features we would like to implement in the future include:
- Multi-context:
The ISP supports up to 16 contexts, plus 4 additional contexts reserved for functional safety. This series only adds support for a single context, though infrastructure is in place to configure the ISP's context manager unit. Please see our GitLab where we have implemented a temporary solution for enabling multi-context by duplicating the media device [3].
- Additional capture pipelines:
The ISP has a number of capture pipelines that can be used in parallel. This can include up to four "full resolution" capture pipelines, a raw pipeline for Bayer data, a "foveated" pipeline for three separate ROIs of the same image, and lastly a Gaussian pyramid pipeline. The latter introduces a challenge with representing the image format since the output data is four levels, each being a quarter the resolution (half the width and height) of the previous level.
- Dual image processing pipelines:
In addition to the human vision processing pipeline, the ISP has a separate processing pipeline that targets computer vision applications. This allows the same input frame to be processed for both human and computer vision applications in parallel, and be output simultaneously through separate capture pipelines.
- Multiple input ports:
The ISP input frontend supports up to four physical inputs and each of these can carry up to four virtual channels, for a total of 16 inputs. This series only enables support for input 0/stream 0 until userspace routing ioctls are enabled to configure a route from the desired input/stream to the input source pad. You may refer to our multi-context implementation where we must split this frontend to provide each context its own input, which limits our flexibility.
- Additional format support:
This initial candidate supports a basic set of output formats, with further support planned in a future series.
- Processing modes:
The ISP can operate in various modes: Streaming, TDMF fix, TDMF flex, and memory-to-memory (M2M). This series uses TDMF flex mode with a single context. Support for the other modes is planned for future series.
- TDMF fix/flex: Frames are written from the input frontend to DMA buffers. When a buffer is written, that context is marked as schedulable. For flex mode, contexts are then scheduled on a first-come, first-served basis. For fix mode, the processing order is strict and preconfigured.
- Streaming: Used for low-latency operation with a single camera. Frames are fed directly from the input to the pipeline. The DMA buffer is only used if internal FIFOs overflow.
- M2M: Allows frame buffers to be provided directly, bypassing the input frontend.
The mode of operation is configurable per-context, meaning it is possible to have one context running in TDMF flex, while another is using M2M mode.
- Multiple exposure:
The ISP can support up to two exposures, using a pipeline frame stitching module. This also requires input routing support, as well as the ability for sensor subdevices to output multiple streams.
- RGB-IR support:
Our ISP can receive a 4x4 RGBIr CFA pattern and internally split this into separate RGB and monochrome images which may be independently processed in the pipeline. Support would require describing the RGB-IR CFA pattern, potentially using the generic raw formats and CFA controls proposed in Sakari's metadata series [4].
- Streaming outputs:
Alongside the traditional memory outputs, some capture pipelines have outputs that physically connect to a downstream device. This may already be possible with a downstream video capture device and V4L2 async notifier callbacks, but there may also be cases where the ISP is connected to a downstream subdevice that consumes the data directly and thus requires no capture device or any allocated buffers. In such a case, this subdevice should be able to start the media pipeline without a video device that traditionally exposes STREAMON/STREAMOFF ioctls.
Our ISP is also configurable at synthesis time. This means that certain ISP features may only be present depending on the customer's implementation. Our driver tackles this by parsing the ISP's "capability discovery" table, which provides details about available pipelines and the presence of particular modules within a given pipeline. Some details are not fully exposed by this table, in which case we use hardware identification checks.
Details about the ISP can be found on Arm's support page [5].
The driver exposes 6 V4L2 subdevices:
- mali-c720 tpg X: 2 test pattern generator inputs
- mali-c720 input: Frontend for receiving sensor inputs
- mali-c720 isp: Represents the ISP input pipeline
- mali-c720 hv pipe: Vision pipeline for human vision processing
- mali-c720 fr 0 pipe: Full resolution pipeline with downscaling and cropping
Along with 4 V4L2 video devices:
- mali-c720 fr0-rgb/yuv: Separate RGB and YUV capture devices for the FR0 pipe
- mali-c720 3a stats: Capture device for statistics to support 3A algorithms
- mali-c720 3a params: Output device for parameter buffers to configure the ISP
Support is implemented in the parameters video device code for a few of the ISP's hardware blocks, with more support planned in future patch series. The buffer format uses the v4l2-isp extensible parameters.
Statistics support follows a similar pattern, in that we currently only support the pixel intensity histogram present on the input and human vision pipelines, as well as HV's color statistics. We make use of the v4l2-isp extensible statistics here, allowing for additional blocks to be supported in the future.
The driver exposes custom V4L2 controls to enumerate the supported statistics and parameter block IDs. This aims to account for hardware being synthesised with or without particular modules, as well as future revisions including new modules or updated modules that require a different register set. Userspace should query these to determine what algorithms it should enable based on what statistics it will receive and what modules are programmable.
Below is the v4l2-compliance report for the driver. The failures reported relate to width and height being set to 0 for MEDIA_BUS_FMT_METADATA_FIXED in the ISP subdevice. This appears to be a tool limitation as seen in other drivers.
[1] Upstream submission branches:
- https://gitlab.arm.com/media/isp/linux/-/tree/mali-c720/r0p1/v7.4-rc4/mainline-v1
- https://gitlab.arm.com/media/isp/libcamera/-/tree/mali-c720/r0p1/v7.4-rc4/mainline-v1
[2] Development branches:
- https://gitlab.arm.com/media/isp/linux/-/tree/mali-c720/r0p1/v6.18/dev-v1
- https://gitlab.arm.com/media/isp/libcamera/-/tree/mali-c720/r0p1/v6.18/dev-v1
[3] Multi-context temporary implementation:
- https://gitlab.arm.com/media/isp/linux/-/tree/mali-c720/r0p1/v6.18/dev-v2-multicontext
- https://gitlab.arm.com/media/isp/libcamera/-/tree/mali-c720/r0p1/v6.18/dev-v2-multicontext
[4] Sakari's metadata series - https://lore.kernel.org/linux-media/[email protected]/T/
[5] Arm support page - https://support.arm.com/compute-ip/mali-c720ae
v4l2-compliance 1.33.0-5455, 64 bits, 64-bit time_t v4l2-compliance SHA: 95ad25f6a77a 2026-03-17 13:08:36
Compliance test for mali-c720 device /dev/media0:
Media Driver Info:
Driver name : mali-c720 Model : ARM Mali-C720 ISP Serial : Bus info : platform:60400000.isp Media version : 7.4.0 Hardware revision: 0x00000000 (0) Driver version : 7.4.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: 12 Interfaces: 12 Pads: 20 Links: 23 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK test MEDIA_IOC_SETUP_LINK: OK
Total for mali-c720 device /dev/media0: 8, Succeeded: 8, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for mali-c720 device /dev/video0:
Driver Info:
Driver name : mali-c720 Card type : ARM Mali-C720 ISP Bus info : platform:60400000.isp Driver version : 7.4.0 Capabilities : 0xa4201000
Video Capture Multiplanar
I/O MC
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x24201000
Video Capture Multiplanar
I/O MC
Streaming
Extended Pix Format
Media Driver Info:
Driver name : mali-c720 Model : ARM Mali-C720 ISP Serial : Bus info : platform:60400000.isp Media version : 7.4.0 Hardware revision: 0x00000000 (0) Driver version : 7.4.0 Interface Info: ID : 0x03000016 Type : V4L Video Entity Info: ID : 0x00000014 (20) Name : mali-c720 fr0-rgb Function : V4L2 I/O Pad 0x01000015 : 0: Sink, Must Connect
Link 0x0200002e: from remote pad 0x1000012 of entity 'mali-c720 fr 0
pipe' (Image Signal Processor): Data
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 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
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
Total for mali-c720 device /dev/video0: 48, Succeeded: 48, Failed: 0, Warnings:
0
--------------------------------------------------------------------------------
Compliance test for mali-c720 device /dev/video1:
Driver Info:
Driver name : mali-c720 Card type : ARM Mali-C720 ISP Bus info : platform:60400000.isp Driver version : 7.4.0 Capabilities : 0xa4201000
Video Capture Multiplanar
I/O MC
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x24201000
Video Capture Multiplanar
I/O MC
Streaming
Extended Pix Format
Media Driver Info:
Driver name : mali-c720 Model : ARM Mali-C720 ISP Serial : Bus info : platform:60400000.isp Media version : 7.4.0 Hardware revision: 0x00000000 (0) Driver version : 7.4.0 Interface Info: ID : 0x0300001a Type : V4L Video Entity Info: ID : 0x00000018 (24) Name : mali-c720 fr0-yuv Function : V4L2 I/O Pad 0x01000019 : 0: Sink, Must Connect
Link 0x02000030: from remote pad 0x1000013 of entity 'mali-c720 fr 0
pipe' (Image Signal Processor): Data, Enabled
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 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
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
Total for mali-c720 device /dev/video1: 48, Succeeded: 48, Failed: 0, Warnings:
0
--------------------------------------------------------------------------------
Compliance test for mali-c720 device /dev/video2:
Driver Info:
Driver name : mali-c720 Card type : ARM Mali-C720 ISP Bus info : platform:60400000.isp Driver version : 7.4.0 Capabilities : 0xa4a00000
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 : mali-c720 Model : ARM Mali-C720 ISP Serial : Bus info : platform:60400000.isp Media version : 7.4.0 Hardware revision: 0x00000000 (0) Driver version : 7.4.0 Interface Info: ID : 0x0300001e Type : V4L Video Entity Info: ID : 0x0000001c (28) Name : mali-c720 3a stats Function : V4L2 I/O Pad 0x0100001d : 0: Sink, Must Connect
Link 0x02000032: from remote pad 0x100000b of entity 'mali-c720 isp'
(Image Signal Processor): Data, Enabled
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/video2 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 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
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
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: 0 Private Controls: 0 Standard Compound Controls: 0 Private Compound Controls: 1
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
Total for mali-c720 device /dev/video2: 48, Succeeded: 48, Failed: 0, Warnings:
0
--------------------------------------------------------------------------------
Compliance test for mali-c720 device /dev/video3:
Driver Info:
Driver name : mali-c720 Card type : ARM Mali-C720 ISP Bus info : platform:60400000.isp Driver version : 7.4.0 Capabilities : 0xac200000
Metadata Output
I/O MC
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x2c200000
Metadata Output
I/O MC
Streaming
Extended Pix Format
Media Driver Info:
Driver name : mali-c720 Model : ARM Mali-C720 ISP Serial : Bus info : platform:60400000.isp Media version : 7.4.0 Hardware revision: 0x00000000 (0) Driver version : 7.4.0 Interface Info: ID : 0x03000022 Type : V4L Video Entity Info: ID : 0x00000020 (32) Name : mali-c720 3a params Function : V4L2 I/O Pad 0x01000021 : 0: Source, Must Connect
Link 0x02000034: to remote pad 0x100000c of entity 'mali-c720 isp'
(Image Signal Processor): Data, Enabled
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/video3 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 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
test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 1 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 (Output 0):
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: 0 Private Controls: 0 Standard Compound Controls: 0 Private Compound Controls: 1
Format ioctls (Output 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 (Output 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 (Output 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
Total for mali-c720 device /dev/video3: 48, Succeeded: 48, Failed: 0, Warnings:
0
--------------------------------------------------------------------------------
Compliance test for mali-c720 device /dev/v4l-subdev0:
Driver Info:
Driver version : 7.4.0 Capabilities : 0x00000000 Client Capabilities: 0x0000000000000002 interval-uses-which Media Driver Info: Driver name : mali-c720 Model : ARM Mali-C720 ISP Serial : Bus info : platform:60400000.isp Media version : 7.4.0 Hardware revision: 0x00000000 (0) Driver version : 7.4.0 Interface Info: ID : 0x0300003f Type : V4L Sub-Device Entity Info: ID : 0x00000001 (1) Name : mali-c720 tpg 0 Function : Camera Sensor Pad 0x01000002 : 0: Source
Link 0x02000024: to remote pad 0x1000007 of entity 'mali-c720 input'
(Image Signal Processor): Data
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 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
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: 6 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)
test blocking wait: OK (Not Supported)
Total for mali-c720 device /dev/v4l-subdev0: 54, Succeeded: 54, Failed: 0,
Warnings: 0
--------------------------------------------------------------------------------
Compliance test for mali-c720 device /dev/v4l-subdev1:
Driver Info:
Driver version : 7.4.0 Capabilities : 0x00000000 Client Capabilities: 0x0000000000000002 interval-uses-which Media Driver Info: Driver name : mali-c720 Model : ARM Mali-C720 ISP Serial : Bus info : platform:60400000.isp Media version : 7.4.0 Hardware revision: 0x00000000 (0) Driver version : 7.4.0 Interface Info: ID : 0x03000041 Type : V4L Sub-Device Entity Info: ID : 0x00000003 (3) Name : mali-c720 tpg 1 Function : Camera Sensor Pad 0x01000004 : 0: Source
Link 0x02000026: to remote pad 0x1000007 of entity 'mali-c720 input'
(Image Signal Processor): Data
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 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
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: 6 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)
test blocking wait: OK (Not Supported)
Total for mali-c720 device /dev/v4l-subdev1: 54, Succeeded: 54, Failed: 0,
Warnings: 0
--------------------------------------------------------------------------------
Compliance test for mali-c720 device /dev/v4l-subdev2:
Driver Info:
Driver version : 7.4.0
Capabilities : 0x00000000
Client Capabilities: 0x0000000000000002
interval-uses-which Media Driver Info:
Driver name : mali-c720
Model : ARM Mali-C720 ISP
Serial :
Bus info : platform:60400000.isp
Media version : 7.4.0
Hardware revision: 0x00000000 (0)
Driver version : 7.4.0
Interface Info:
ID : 0x03000043
Type : V4L Sub-Device
Entity Info:
ID : 0x00000005 (5)
Name : mali-c720 input
Function : Image Signal Processor
Pad 0x01000006 : 0: Source
Link 0x02000028: to remote pad 0x1000009 of entity 'mali-c720 isp'
(Image Signal Processor): Data, Enabled
Pad 0x01000007 : 1: Sink, Must Connect
Link 0x02000024: from remote pad 0x1000002 of entity 'mali-c720 tpg 0'
(Camera Sensor): Data
Link 0x02000026: from remote pad 0x1000004 of entity 'mali-c720 tpg 1'
(Camera Sensor): Data
Link 0x02000039: from remote pad 0x1000038 of entity 'lte-csi2-rx'
(Video Interface Bridge): Data, EnabledRequired 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-subdev2 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 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
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 (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
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 (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)
test blocking wait: OK (Not Supported)
Total for mali-c720 device /dev/v4l-subdev2: 61, Succeeded: 61, Failed: 0,
Warnings: 0
--------------------------------------------------------------------------------
Compliance test for mali-c720 device /dev/v4l-subdev3:
Driver Info:
Driver version : 7.4.0
Capabilities : 0x00000000
Client Capabilities: 0x0000000000000002
interval-uses-which Media Driver Info:
Driver name : mali-c720
Model : ARM Mali-C720 ISP
Serial :
Bus info : platform:60400000.isp
Media version : 7.4.0
Hardware revision: 0x00000000 (0)
Driver version : 7.4.0
Interface Info:
ID : 0x03000045
Type : V4L Sub-Device
Entity Info:
ID : 0x00000008 (8)
Name : mali-c720 isp
Function : Image Signal Processor
Pad 0x01000009 : 0: Sink, Must Connect
Link 0x02000028: from remote pad 0x1000006 of entity 'mali-c720 input'
(Image Signal Processor): Data, Enabled
Pad 0x0100000a : 1: Source
Link 0x0200002a: to remote pad 0x100000e of entity 'mali-c720 hv pipe'
(Image Signal Processor): Data, Enabled
Pad 0x0100000b : 2: Source
Link 0x02000032: to remote pad 0x100001d of entity 'mali-c720 3a
stats' (V4L2 I/O): Data, Enabled
Pad 0x0100000c : 3: Sink
Link 0x02000034: from remote pad 0x1000021 of entity 'mali-c720 3a
params' (V4L2 I/O): Data, EnabledRequired 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-subdev3 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 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):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
fail: v4l2-test-subdevs.cpp(369): fmt.width == 0 || fmt.width >
65536
fail: v4l2-test-subdevs.cpp(418): checkMBusFrameFmt(node,
fmt.format)
test Try VIDIOC_SUBDEV_G/S_FMT: FAIL
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
fail: v4l2-test-subdevs.cpp(369): fmt.width == 0 || fmt.width >
65536
fail: v4l2-test-subdevs.cpp(418): checkMBusFrameFmt(node,
fmt.format)
test Active VIDIOC_SUBDEV_G/S_FMT: FAIL
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 3):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
fail: v4l2-test-subdevs.cpp(369): fmt.width == 0 || fmt.width >
65536
fail: v4l2-test-subdevs.cpp(418): checkMBusFrameFmt(node,
fmt.format)
test Try VIDIOC_SUBDEV_G/S_FMT: FAIL
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
fail: v4l2-test-subdevs.cpp(369): fmt.width == 0 || fmt.width >
65536
fail: v4l2-test-subdevs.cpp(418): checkMBusFrameFmt(node,
fmt.format)
test Active VIDIOC_SUBDEV_G/S_FMT: FAIL
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 (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)
test blocking wait: OK (Not Supported)
Total for mali-c720 device /dev/v4l-subdev3: 75, Succeeded: 71, Failed: 4,
Warnings: 0
--------------------------------------------------------------------------------
Compliance test for mali-c720 device /dev/v4l-subdev4:
Driver Info:
Driver version : 7.4.0
Capabilities : 0x00000000
Client Capabilities: 0x0000000000000002
interval-uses-which Media Driver Info:
Driver name : mali-c720
Model : ARM Mali-C720 ISP
Serial :
Bus info : platform:60400000.isp
Media version : 7.4.0
Hardware revision: 0x00000000 (0)
Driver version : 7.4.0
Interface Info:
ID : 0x03000047
Type : V4L Sub-Device
Entity Info:
ID : 0x0000000d (13)
Name : mali-c720 hv pipe
Function : Image Signal Processor
Pad 0x0100000e : 0: Sink, Must Connect
Link 0x0200002a: from remote pad 0x100000a of entity 'mali-c720 isp'
(Image Signal Processor): Data, Enabled
Pad 0x0100000f : 1: Source
Link 0x0200002c: to remote pad 0x1000011 of entity 'mali-c720 fr 0
pipe' (Image Signal Processor): Data, EnabledRequired 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-subdev4 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 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)
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)
test blocking wait: OK (Not Supported)
Total for mali-c720 device /dev/v4l-subdev4: 61, Succeeded: 61, Failed: 0,
Warnings: 0
--------------------------------------------------------------------------------
Compliance test for mali-c720 device /dev/v4l-subdev5:
Driver Info:
Driver version : 7.4.0
Capabilities : 0x00000000
Client Capabilities: 0x0000000000000002
interval-uses-which Media Driver Info:
Driver name : mali-c720
Model : ARM Mali-C720 ISP
Serial :
Bus info : platform:60400000.isp
Media version : 7.4.0
Hardware revision: 0x00000000 (0)
Driver version : 7.4.0
Interface Info:
ID : 0x03000049
Type : V4L Sub-Device
Entity Info:
ID : 0x00000010 (16)
Name : mali-c720 fr 0 pipe
Function : Image Signal Processor
Pad 0x01000011 : 0: Sink, Must Connect
Link 0x0200002c: from remote pad 0x100000f of entity 'mali-c720 hv
pipe' (Image Signal Processor): Data, Enabled
Pad 0x01000012 : 1: Source
Link 0x0200002e: to remote pad 0x1000015 of entity 'mali-c720 fr0-rgb'
(V4L2 I/O): Data
Pad 0x01000013 : 2: Source
Link 0x02000030: to remote pad 0x1000019 of entity 'mali-c720 fr0-yuv'
(V4L2 I/O): Data, EnabledRequired 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-subdev5 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 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
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
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
Sub-Device ioctls (Source 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
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
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
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)
test blocking wait: OK (Not Supported)
Total for mali-c720 device /dev/v4l-subdev5: 68, Succeeded: 68, Failed: 0,
Warnings: 0
Grand Total for mali-c720 device /dev/media0: 573, Succeeded: 569, Failed: 4,
Warnings: 0
---
Anthony McGivern (24):
media: uapi: Add 24-bit Bayer media bus formats
dt-bindings: media: Add bindings for Arm Mali-C720
media: uapi: Add a control ID base for Mali-C720 ISP
media: mali-c720: Add register access helpers
media: mali-c720: Add hardware identification
media: mali-c720: Add format handling
media: mali-c720: Add hardware discovery support
media: mali-c720: Add context manager and interrupt handling
media: mali-c720: Add input frontend subdevice
media: mali-c720: Add ISP and human vision subdevices
media: mali-c720: Add full-resolution output subdevice
media: mali-c720: Add video capture nodes
media: mali-c720: Add Mali-C720 ISP driver
media: mali-c720: Add test pattern generator subdevices
media: Documentation: Add Mali-C720 ISP documentation
media: uapi: Add Mali-C720 statistics meta format
media: uapi: Add statistics structs to mali-c720-config.h
media: mali-c720: Add 3A statistics video node
media: Documentation: Document Mali-C720 statistics capture
media: uapi: Add Mali-C720 parameters meta format
media: uapi: Add parameter structs to mali-c720-config.h
media: mali-c720: Add parameters video node
media: Documentation: Document Mali-C720 parameter settings
MAINTAINERS: Add entry for mali-c720 driver
.../admin-guide/media/mali-c720-graph.dot | 26 + Documentation/admin-guide/media/mali-c720.rst | 435 +++++ Documentation/admin-guide/media/v4l-drivers.rst | 1 + .../devicetree/bindings/media/arm,mali-c720.yaml | 134 ++ .../userspace-api/media/drivers/index.rst | 1 + .../userspace-api/media/drivers/mali-c720.rst | 47 + .../userspace-api/media/v4l/meta-formats.rst | 1 + .../media/v4l/metafmt-arm-mali-c720.rst | 112 ++ .../userspace-api/media/v4l/subdev-formats.rst | 289 ++- MAINTAINERS | 13 + drivers/media/platform/arm/Kconfig | 1 + drivers/media/platform/arm/Makefile | 1 + drivers/media/platform/arm/mali-c720/Kconfig | 18 + drivers/media/platform/arm/mali-c720/Makefile | 23 + .../platform/arm/mali-c720/mali-c720-capture.c | 775 ++++++++ .../platform/arm/mali-c720/mali-c720-common.h | 451 +++++ .../media/platform/arm/mali-c720/mali-c720-core.c | 985 ++++++++++ .../platform/arm/mali-c720/mali-c720-ctx-mgr.c | 1923 ++++++++++++++++++++ .../platform/arm/mali-c720/mali-c720-ctx-mgr.h | 327 ++++ .../platform/arm/mali-c720/mali-c720-discovery.c | 1172 ++++++++++++ .../platform/arm/mali-c720/mali-c720-discovery.h | 212 +++ .../platform/arm/mali-c720/mali-c720-formats.c | 452 +++++ .../platform/arm/mali-c720/mali-c720-formats.h | 132 ++ .../platform/arm/mali-c720/mali-c720-fr-pipe.c | 1178 ++++++++++++ .../media/platform/arm/mali-c720/mali-c720-id.c | 165 ++ .../media/platform/arm/mali-c720/mali-c720-id.h | 34 + .../media/platform/arm/mali-c720/mali-c720-input.c | 598 ++++++ .../platform/arm/mali-c720/mali-c720-interrupts.c | 436 +++++ .../platform/arm/mali-c720/mali-c720-interrupts.h | 34 + .../media/platform/arm/mali-c720/mali-c720-isp.c | 456 +++++ .../platform/arm/mali-c720/mali-c720-params.c | 1450 +++++++++++++++ .../arm/mali-c720/mali-c720-register-access.c | 205 +++ .../arm/mali-c720/mali-c720-register-access.h | 55 + .../arm/mali-c720/mali-c720-registers-ctx-mgr.c | 226 +++ .../arm/mali-c720/mali-c720-registers-ctx-mgr.h | 207 +++ .../arm/mali-c720/mali-c720-registers-modules.c | 148 ++ .../arm/mali-c720/mali-c720-registers-modules.h | 136 ++ .../arm/mali-c720/mali-c720-registers-top.c | 173 ++ .../arm/mali-c720/mali-c720-registers-top.h | 228 +++ .../platform/arm/mali-c720/mali-c720-registers.c | 57 + .../platform/arm/mali-c720/mali-c720-registers.h | 84 + .../media/platform/arm/mali-c720/mali-c720-stats.c | 730 ++++++++ .../media/platform/arm/mali-c720/mali-c720-tpg.c | 581 ++++++ .../platform/arm/mali-c720/mali-c720-vision-pipe.c | 260 +++ drivers/media/v4l2-core/v4l2-ioctl.c | 2 + include/uapi/linux/media-bus-format.h | 6 +- include/uapi/linux/media/arm/mali-c720-config.h | 738 ++++++++ include/uapi/linux/v4l2-controls.h | 6 + include/uapi/linux/videodev2.h | 4 + 49 files changed, 15724 insertions(+), 4 deletions(-)
---
base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f
change-id: 20261113-b4-initial-upstream-candidate-fce192163026
Best regards,
Signature · 1 line
Anthony McGivern <[email protected]>
PATCH 1/24 media: uapi: Add 24-bit Bayer media bus formats
From: Anthony McGivern <[email protected]>
The Mali-C720 ISP processes Bayer data on a 24-bit internal bus. Add media bus format codes for all four Bayer orders and document their data layout.
--- .../userspace-api/media/v4l/subdev-formats.rst | 289 ++++++++++++++++++++- include/uapi/linux/media-bus-format.h | 6 +- 2 files changed, 291 insertions(+), 4 deletions(-)
Documentation/userspace-api/media/v4l/subdev-formats.rst +286 -3
@@ -2821,11 +2821,11 @@ organization is given as an example for the first pixel only. \tiny \setlength{\tabcolsep}{2pt} -.. tabularcolumns:: |p{6.0cm}|p{0.7cm}|p{0.3cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}| +.. tabularcolumns:: |p{6.0cm}|p{0.7cm}|p{0.3cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}|p{0.22cm}| .. _v4l2-mbus-pixelcode-bayer: -.. cssclass: longtable +.. cssclass:: longtable .. flat-table:: Bayer Formats :header-rows: 2
@@ -2834,10 +2834,14 @@ organization is given as an example for the first pixel only. * - Identifier - Code - - - :cspan:`19` Data organization + - :cspan:`23` Data organization * - - - Bit + - 23 + - 22 + - 21 + - 20 - 19 - 18 - 17
@@ -2875,6 +2879,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`7` - b\ :sub:`6` - b\ :sub:`5`
@@ -2900,6 +2908,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`7` - g\ :sub:`6` - g\ :sub:`5`
@@ -2925,6 +2937,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`7` - g\ :sub:`6` - g\ :sub:`5`
@@ -2950,6 +2966,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - r\ :sub:`7` - r\ :sub:`6` - r\ :sub:`5`
@@ -2975,6 +2995,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`7` - b\ :sub:`6` - b\ :sub:`5`
@@ -3000,6 +3024,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`7` - g\ :sub:`6` - g\ :sub:`5`
@@ -3025,6 +3053,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`7` - g\ :sub:`6` - g\ :sub:`5`
@@ -3050,6 +3082,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - r\ :sub:`7` - r\ :sub:`6` - r\ :sub:`5`
@@ -3075,6 +3111,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`7` - b\ :sub:`6` - b\ :sub:`5`
@@ -3100,6 +3140,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`7` - g\ :sub:`6` - g\ :sub:`5`
@@ -3125,6 +3169,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`7` - g\ :sub:`6` - g\ :sub:`5`
@@ -3150,6 +3198,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - r\ :sub:`7` - r\ :sub:`6` - r\ :sub:`5`
@@ -3175,6 +3227,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - 0 - 0 - 0
@@ -3198,6 +3254,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`7` - b\ :sub:`6` - b\ :sub:`5`
@@ -3223,6 +3283,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`7` - b\ :sub:`6` - b\ :sub:`5`
@@ -3246,6 +3310,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - 0 - 0 - 0
@@ -3271,6 +3339,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`9` - b\ :sub:`8` - b\ :sub:`7`
@@ -3294,6 +3366,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`1` - b\ :sub:`0` - 0
@@ -3319,6 +3395,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`1` - b\ :sub:`0` - 0
@@ -3342,6 +3422,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`9` - b\ :sub:`8` - b\ :sub:`7`
@@ -3365,6 +3449,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`9` - b\ :sub:`8` - b\ :sub:`7`
@@ -3390,6 +3478,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`9` - g\ :sub:`8` - g\ :sub:`7`
@@ -3415,6 +3507,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`9` - g\ :sub:`8` - g\ :sub:`7`
@@ -3440,6 +3536,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - r\ :sub:`9` - r\ :sub:`8` - r\ :sub:`7`
@@ -3463,6 +3563,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`11` - b\ :sub:`10` - b\ :sub:`9`
@@ -3488,6 +3592,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`11` - g\ :sub:`10` - g\ :sub:`9`
@@ -3513,6 +3621,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`11` - g\ :sub:`10` - g\ :sub:`9`
@@ -3538,6 +3650,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - r\ :sub:`11` - r\ :sub:`10` - r\ :sub:`9`
@@ -3561,6 +3677,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`13` - b\ :sub:`12` - b\ :sub:`11`
@@ -3586,6 +3706,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`13` - g\ :sub:`12` - g\ :sub:`11`
@@ -3611,6 +3735,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`13` - g\ :sub:`12` - g\ :sub:`11`
@@ -3636,6 +3764,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - r\ :sub:`13` - r\ :sub:`12` - r\ :sub:`11`
@@ -3659,6 +3791,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - b\ :sub:`15` - b\ :sub:`14` - b\ :sub:`13`
@@ -3684,6 +3820,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`15` - g\ :sub:`14` - g\ :sub:`13`
@@ -3709,6 +3849,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - g\ :sub:`15` - g\ :sub:`14` - g\ :sub:`13`
@@ -3734,6 +3878,10 @@ organization is given as an example for the first pixel only. - - - + - + - + - + - - r\ :sub:`15` - r\ :sub:`14` - r\ :sub:`13`
@@ -3755,6 +3903,10 @@ organization is given as an example for the first pixel only. - MEDIA_BUS_FMT_SBGGR20_1X20 - 0x3021 - + - + - + - + - - b\ :sub:`19` - b\ :sub:`18` - b\ :sub:`17`
@@ -3780,6 +3932,10 @@ organization is given as an example for the first pixel only. - MEDIA_BUS_FMT_SGBRG20_1X20 - 0x3022 - + - + - + - + - - g\ :sub:`19` - g\ :sub:`18` - g\ :sub:`17`
@@ -3805,6 +3961,10 @@ organization is given as an example for the first pixel only. - MEDIA_BUS_FMT_SGRBG20_1X20 - 0x3023 - + - + - + - + - - g\ :sub:`19` - g\ :sub:`18` - g\ :sub:`17`
@@ -3830,6 +3990,129 @@ organization is given as an example for the first pixel only. - MEDIA_BUS_FMT_SRGGB20_1X20 - 0x3024 - + - + - + - + - + - r\ :sub:`19` + - r\ :sub:`18` + - r\ :sub:`17` + - r\ :sub:`16` + - r\ :sub:`15` + - r\ :sub:`14` + - r\ :sub:`13` + - r\ :sub:`12` + - r\ :sub:`11` + - r\ :sub:`10` + - r\ :sub:`9` + - r\ :sub:`8` + - r\ :sub:`7` + - r\ :sub:`6` + - r\ :sub:`5` + - r\ :sub:`4` + - r\ :sub:`3` + - r\ :sub:`2` + - r\ :sub:`1` + - r\ :sub:`0` + * .. _MEDIA-BUS-FMT-SBGGR24-1X24: + + - MEDIA_BUS_FMT_SBGGR24_1X24 + - 0x3025 + - + - b\ :sub:`23` + - b\ :sub:`22` + - b\ :sub:`21` + - b\ :sub:`20` + - b\ :sub:`19` + - b\ :sub:`18` + - b\ :sub:`17` + - b\ :sub:`16` + - b\ :sub:`15` + - b\ :sub:`14` + - b\ :sub:`13` + - b\ :sub:`12` + - b\ :sub:`11` + - b\ :sub:`10` + - b\ :sub:`9` + - b\ :sub:`8` + - b\ :sub:`7` + - b\ :sub:`6` + - b\ :sub:`5` + - b\ :sub:`4` + - b\ :sub:`3` + - b\ :sub:`2` + - b\ :sub:`1` + - b\ :sub:`0` + + * .. _MEDIA-BUS-FMT-SGBRG24-1X24: + + - MEDIA_BUS_FMT_SGBRG24_1X24 + - 0x3026 + - + - g\ :sub:`23` + - g\ :sub:`22` + - g\ :sub:`21` + - g\ :sub:`20` + - g\ :sub:`19` + - g\ :sub:`18` + - g\ :sub:`17` + - g\ :sub:`16` + - g\ :sub:`15` + - g\ :sub:`14` + - g\ :sub:`13` + - g\ :sub:`12` + - g\ :sub:`11` + - g\ :sub:`10` + - g\ :sub:`9` + - g\ :sub:`8` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + + * .. _MEDIA-BUS-FMT-SGRBG24-1X24: + + - MEDIA_BUS_FMT_SGRBG24_1X24 + - 0x3027 + - + - g\ :sub:`23` + - g\ :sub:`22` + - g\ :sub:`21` + - g\ :sub:`20` + - g\ :sub:`19` + - g\ :sub:`18` + - g\ :sub:`17` + - g\ :sub:`16` + - g\ :sub:`15` + - g\ :sub:`14` + - g\ :sub:`13` + - g\ :sub:`12` + - g\ :sub:`11` + - g\ :sub:`10` + - g\ :sub:`9` + - g\ :sub:`8` + - g\ :sub:`7` + - g\ :sub:`6` + - g\ :sub:`5` + - g\ :sub:`4` + - g\ :sub:`3` + - g\ :sub:`2` + - g\ :sub:`1` + - g\ :sub:`0` + + * .. _MEDIA-BUS-FMT-SRGGB24-1X24: + + - MEDIA_BUS_FMT_SRGGB24_1X24 + - 0x3028 + - + - r\ :sub:`23` + - r\ :sub:`22` + - r\ :sub:`21` + - r\ :sub:`20` - r\ :sub:`19` - r\ :sub:`18` - r\ :sub:`17`
include/uapi/linux/media-bus-format.h +5 -1
@@ -124,7 +124,7 @@#define MEDIA_BUS_FMT_YUV16_1X48 0x202a#define MEDIA_BUS_FMT_UYYVYY16_0_5X48 0x202b -/* Bayer - next is 0x3025 */ +/* Bayer - next is 0x3029 */ #define MEDIA_BUS_FMT_SBGGR8_1X8 0x3001#define MEDIA_BUS_FMT_SGBRG8_1X8 0x3013#define MEDIA_BUS_FMT_SGRBG8_1X8 0x3002
@@ -161,6 +161,10 @@#define MEDIA_BUS_FMT_SGBRG20_1X20 0x3022#define MEDIA_BUS_FMT_SGRBG20_1X20 0x3023#define MEDIA_BUS_FMT_SRGGB20_1X20 0x3024 +#define MEDIA_BUS_FMT_SBGGR24_1X24 0x3025 +#define MEDIA_BUS_FMT_SGBRG24_1X24 0x3026 +#define MEDIA_BUS_FMT_SGRBG24_1X24 0x3027 +#define MEDIA_BUS_FMT_SRGGB24_1X24 0x3028/* JPEG compressed formats - next is 0x4002 */ #define MEDIA_BUS_FMT_JPEG_1X8 0x4001
Signature · 1 line
2.55.0
PATCH 2/24 dt-bindings: media: Add bindings for Arm Mali-C720
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add the device tree binding for the Arm Mali-C720 Image Signal Processor.
--- .../devicetree/bindings/media/arm,mali-c720.yaml | 134 +++++++++++++++++++++ 1 file changed, 134 insertions(+)
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +134 -0
@@ -0,0 +1,134 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/arm,mali-c720.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ARM Mali-C720 Image Signal Processor + +maintainers: + - Anthony McGivern <[email protected]> + +properties: + compatible: + const: arm,mali-c720 + + reg: + maxItems: 1 + + interrupts: + minItems: 1 + items: + - description: ISP main interrupt + - description: ISP fault interrupt + + interrupt-names: + minItems: 1 + items: + - const: isp + - const: fault + + iommus: + minItems: 1 + maxItems: 3 + + clocks: + items: + - description: ISP main processing clock + + clock-names: + items: + - const: vclk + + resets: + items: + - description: ISP main processing clock domain reset + + reset-names: + items: + - const: reset + + memory-region: + maxItems: 1 + description: Reserved memory pool for ISP DMA allocations. + + power-domains: + description: Power domain containing the ISP. + maxItems: 1 + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: Parallel video input ports. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: Input port 0 + + properties: + reg: + const: 0 + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: Input port 1 + + properties: + reg: + const: 1 + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: Input port 2 + + properties: + reg: + const: 2 + + port@3: + $ref: /schemas/graph.yaml#/properties/port + description: Input port 3 + + properties: + reg: + const: 3 + +required: + - compatible + - reg + - interrupts + - interrupt-names + - clocks + - clock-names + - resets + - reset-names + +additionalProperties: false + +examples: + - | + mali_c720: isp@400000 { + compatible = "arm,mali-c720"; + reg = <0x400000 0x200000>; + clocks = <&clk 0>; + clock-names = "vclk"; + resets = <&resets 0>; + reset-names = "reset"; + memory-region = <&isp_reserved>; + interrupts = <0>; + interrupt-names = "isp"; + power-domains = <&power 0>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + isp_in: endpoint { + remote-endpoint = <&csi2_rx_out>; + }; + }; + }; + }; +...
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 02/24] dt-bindings: media: Add bindings for Arm Mali-C720
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Low] dt-bindings: media: redundant bindings word in commit subject - [Low] dt-bindings: media…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Low] dt-bindings: media: redundant bindings word in commit subject
- [Low] dt-bindings: media: non-canonical property ordering in arm,mali-c720.yaml
- [Low] dt-bindings: media: DTS example style violations in arm,mali-c720.yaml
--
commit 57de6a2d5cbf4773def077645c097e562455ec9a
Author: Anthony McGivern <[email protected]>
dt-bindings: media: Add bindings for Arm Mali-C720
This commit adds the Device Tree binding schema for the Arm Mali-C720 Image Signal Processor.
Quoted 1 line
dt-bindings: media: Add bindings for Arm Mali-C720
[Severity: Low]
The "dt-bindings:" prefix already indicates that this adds a binding, so "bindings for" is redundant and the subject can be "dt-bindings: media: Add Arm Mali-C720".
Quoted 6 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +0
-0@@ -0,0 +1,134 @@
[ ... ]
Quoted 30 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +30
-0+properties: + compatible: + const: arm,mali-c720 + + reg: + maxItems: 1 + + interrupts: + minItems: 1 + items: + - description: ISP main interrupt + - description: ISP fault interrupt + + interrupt-names: + minItems: 1 + items: + - const: isp + - const: fault + + iommus: + minItems: 1 + maxItems: 3 + + clocks: + items: + - description: ISP main processing clock + + clock-names: + items: + - const: vclk
[ ... ]
Documentation/devicetree/bindings/media/arm,mali-c720.yaml line 104
Quoted 9 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +9
-0+required: + - compatible + - reg + - interrupts + - interrupt-names + - clocks + - clock-names + - resets + - reset-names
[Severity: Low]
Could the properties in "properties:" and "required:" be ordered to follow the canonical DT schema sequence, placing clocks and clock-names before interrupts and interrupt-names? The example node below already lists clocks and clock-names before interrupts and interrupt-names, so aligning "properties:" and "required:" with that order would also keep all three sections consistent.
Quoted 19 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +19
-0+ +additionalProperties: false + +examples: + - | + mali_c720: isp@400000 { + compatible = "arm,mali-c720"; + reg = <0x400000 0x200000>; + clocks = <&clk 0>; + clock-names = "vclk"; + resets = <&resets 0>; + reset-names = "reset"; + memory-region = <&isp_reserved>; + interrupts = <0>; + interrupt-names = "isp"; + power-domains = <&power 0>; + + ports { + #address-cells = <1>;
Documentation/devicetree/bindings/media/arm,mali-c720.yaml line 133
Quoted 10 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +10
-0+ #size-cells = <0>; + + port@0 { + reg = <0>; + isp_in: endpoint { + remote-endpoint = <&csi2_rx_out>; + }; + }; + }; + };
[Severity: Low]
The example node causes scripts/dtc/dt-check-style --mode=strict to report
warnings: it uses 2-space indentation instead of 4-space indentation, defines the unused labels mali_c720 and isp_in, and omits a blank line between "reg = <0>;" and the endpoint child node inside port@0.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
Re: [PATCH 02/24] dt-bindings: media: Add bindings for Arm Mali-C720
In reply to Anthony McGivernQuoted 5 lines · Anthony McGivern
From: Anthony McGivern <[email protected]>
Add the device tree binding for the Arm Mali-C720 Image Signal Processor.
A nit, subject: drop second/last, redundant "bindings". The "dt-bindings" prefix is already stating that these are bindings. See also:
https://elixir.bootlin.com/linux/v7.1-rc7/source/Documentation/devicetree/bindings/submitting-patches.rst#L23
Quoted 21 lines
Signed-off-by Anthony McGivern <[email protected]>--- .../devicetree/bindings/media/arm,mali-c720.yaml | 134 +++++++++++++++++++++ 1 file changed, 134 insertions(+)Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +10
-0@@ -0,0 +1,134 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/arm,mali-c720.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: ARM Mali-C720 Image Signal Processor + +maintainers: + - Anthony McGivern <[email protected]>
Documentation/devicetree/bindings/media/arm,mali-c720.yaml line 20
Quoted 10 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +10
-0+ +properties: + compatible: + const: arm,mali-c720 + + reg: + maxItems: 1 + + interrupts: + minItems: 1
Why is this flexible?
Documentation/devicetree/bindings/media/arm,mali-c720.yaml line 33
Quoted 13 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +13
-0+ items: + - description: ISP main interrupt + - description: ISP fault interrupt + + interrupt-names: + minItems: 1 + items: + - const: isp + - const: fault + + iommus: + minItems: 1 + maxItems: 3
Same question. List items with description instead.
Quoted 6 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +6
-0+ + clocks: + items: + - description: ISP main processing clock + + clock-names:
Documentation/devicetree/bindings/media/arm,mali-c720.yaml line 49
Quoted 10 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +10
-0+ items: + - const: vclk + + resets: + items: + - description: ISP main processing clock domain reset + + reset-names: + items: + - const: reset
Drop names
Documentation/devicetree/bindings/media/arm,mali-c720.yaml line 56
Quoted 7 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +7
-0+ + memory-region: + maxItems: 1 + description: Reserved memory pool for ISP DMA allocations. + + power-domains: + description: Power domain containing the ISP.
Drop description
Quoted 4 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +4
-0+ maxItems: 1 + + ports: + $ref: /schemas/graph.yaml#/properties/ports
Documentation/devicetree/bindings/media/arm,mali-c720.yaml line 70
Quoted 10 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +10
-0+ description: Parallel video input ports. + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: Input port 0 + + properties: + reg: + const: 0
Drop properties, should not be needed, same in places below.
Quoted 30 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +30
-0+ + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: Input port 1 + + properties: + reg: + const: 1 + + port@2: + $ref: /schemas/graph.yaml#/properties/port + description: Input port 2 + + properties: + reg: + const: 2 + + port@3: + $ref: /schemas/graph.yaml#/properties/port + description: Input port 3 + + properties: + reg: + const: 3 + +required: + - compatible + - reg + - interrupts + - interrupt-names
Documentation/devicetree/bindings/media/arm,mali-c720.yaml line 110
Quoted 10 lines
Documentation/devicetree/bindings/media/arm,mali-c720.yaml new file +10
-0+ - clocks + - clock-names + - resets + - reset-names + +additionalProperties: false + +examples: + - | + mali_c720: isp@400000 {
Drop unused label
Best regards,
Krzysztof
Signature · 1 line
Krzysztof Kozlowski <[email protected]>
PATCH 3/24 media: uapi: Add a control ID base for Mali-C720 ISP
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add the base definition for custom controls exposed by the Mali-C720 ISP driver.
--- include/uapi/linux/v4l2-controls.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/uapi/linux/v4l2-controls.h +6 -0
@@ -255,6 +255,12 @@ enum v4l2_colorfx {*/ #define V4L2_CID_USER_IT6625_BASE (V4L2_CID_USER_BASE + 0x1250) +/* +* The base for the Arm Mali-C720 ISP driver controls. +* We reserve 16 controls for this driver. +*/ +#define V4L2_CID_USER_MALI_C720_BASE (V4L2_CID_USER_BASE + 0x1260) +/* MPEG-class control IDs */ /* The MPEG controls are applicable to all codec controls * and the 'MPEG' part of the define is historical */
Signature · 1 line
2.55.0
PATCH 4/24 media: mali-c720: Add register access helpers
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add register-field and indexed-group definitions for the ISP registers. Represent register layouts using structures to accommodate future hardware revisions.
Provide access helpers for the memory-mapped global registers and the in-memory context register image used by the ISP's configuration DMA engine (CDMA).
--- .../platform/arm/mali-c720/mali-c720-common.h | 45 ++++ .../arm/mali-c720/mali-c720-register-access.c | 205 ++++++++++++++++++ .../arm/mali-c720/mali-c720-register-access.h | 55 +++++ .../arm/mali-c720/mali-c720-registers-ctx-mgr.c | 226 ++++++++++++++++++++ .../arm/mali-c720/mali-c720-registers-ctx-mgr.h | 207 +++++++++++++++++++ .../arm/mali-c720/mali-c720-registers-modules.c | 148 +++++++++++++ .../arm/mali-c720/mali-c720-registers-modules.h | 136 ++++++++++++ .../arm/mali-c720/mali-c720-registers-top.c | 173 ++++++++++++++++ .../arm/mali-c720/mali-c720-registers-top.h | 228 +++++++++++++++++++++ .../platform/arm/mali-c720/mali-c720-registers.c | 50 +++++ .../platform/arm/mali-c720/mali-c720-registers.h | 81 ++++++++ 11 files changed, 1554 insertions(+)
drivers/media/platform/arm/mali-c720/mali-c720-common.h new file +45 -0
@@ -0,0 +1,45 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* ARM Mali-C720 ISP Driver - Image signal processor +* +* Copyright (C) 2026 Arm Ltd +*/ + +#ifndef MALI_C720_COMMON_H +#define MALI_C720_COMMON_H + +#include <linux/io.h> +#include <linux/mutex.h> +#include <linux/refcount.h> +#include <linux/spinlock.h> + +#include "mali-c720-register-access.h" +#include "mali-c720-registers.h" +#include "mali-c720-registers-top.h" +#include "mali-c720-registers-ctx-mgr.h" +#include "mali-c720-registers-modules.h" + +struct mali_c720_context_regs { +dma_addr_t dma_handle; +u8 *base; +size_t size; + +/* Serializes allocation, initialization and final release. */ +struct mutex allocation_lock; +refcount_t users; +}; + +struct mali_c720_context { +struct mali_c720 *mali_c720; +struct mali_c720_context_regs regs; +}; + +struct mali_c720 { +struct device *dev; +u8 __iomem *base; +resource_size_t mmio_size; + +struct mali_c720_registers registers; +}; + +#endif /* MALI_C720_COMMON_H */
drivers/media/platform/arm/mali-c720/mali-c720-register-access.c new file +205 -0
205 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-register-access.h new file +55 -0
55 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-registers-ctx-mgr.c new file +226 -0
226 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-registers-ctx-mgr.h new file +207 -0
207 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-registers-modules.c new file +148 -0
148 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-registers-modules.h new file +136 -0
136 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-registers-top.c new file +173 -0
173 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-registers-top.h new file +228 -0
228 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-registers.c new file +50 -0
50 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-registers.h new file +81 -0
81 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 5/24 media: mali-c720: Add hardware identification
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Read the ISP identification registers and match the device against the currently supported hardware revisions, rejecting unsupported hardware.
Add register-map selection based on the identified hardware revision.
--- .../platform/arm/mali-c720/mali-c720-common.h | 3 + .../media/platform/arm/mali-c720/mali-c720-id.c | 165 +++++++++++++++++++++ .../media/platform/arm/mali-c720/mali-c720-id.h | 34 +++++ .../platform/arm/mali-c720/mali-c720-registers.c | 27 ++-- .../platform/arm/mali-c720/mali-c720-registers.h | 5 +- 5 files changed, 223 insertions(+), 11 deletions(-)
drivers/media/platform/arm/mali-c720/mali-c720-common.h +3 -0
@@ -13,6 +13,7 @@#include <linux/refcount.h> #include <linux/spinlock.h> +#include "mali-c720-id.h" #include "mali-c720-register-access.h" #include "mali-c720-registers.h" #include "mali-c720-registers-top.h"
@@ -40,6 +41,8 @@ struct mali_c720 {resource_size_t mmio_size;struct mali_c720_registers registers; + + const struct mali_c720_hw_version *hw_version; };#endif /* MALI_C720_COMMON_H */
drivers/media/platform/arm/mali-c720/mali-c720-id.c new file +165 -0
165 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-id.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* ARM Mali-C720 ISP Driver - Hardware identification +* +* Copyright (C) 2026 Arm Ltd +*/ + +#ifndef MALI_C720_ID_H +#define MALI_C720_ID_H + +#include <linux/types.h> + +#define MALI_C720_ID_SIZE 0x1000 + +struct mali_c720 ; + +enum mali_c720_version_id { +MALI_C720_VERSION_ID_R0_P0 , +MALI_C720_VERSION_ID_R0_P1 , +MALI_C720_VERSION_ID_MAX , +}; + +struct mali_c720_hw_version { +const char *name; +enum mali_c720_version_id id; +u16 part; +u8 revision; +u8 revand; +u8 cmod; +}; + +int mali_c720_identify_hw (struct mali_c720 *mali_c720); + +#endif /* MALI_C720_ID_H */
drivers/media/platform/arm/mali-c720/mali-c720-registers.c +17 -10
@@ -36,15 +36,22 @@ const struct mali_c720_id_regs *mali_c720_get_id_regs(void)return &id_regs; } -int mali_c720_get_registers (struct mali_c720_registers *regs) +int mali_c720_get_registers (enum mali_c720_version_id version, +struct mali_c720_registers *regs) { - *regs = (struct mali_c720_registers ) { - .id = &id_regs, - .top =mali_c720_get_top_regs (), - .cm =mali_c720_get_ctx_mgr_regs (), - .modules =mali_c720_get_modules_regs (), - .context_offset =0x80000 , - .context_size =0x100000 , - }; -return 0 ; +switch (version) { +case MALI_C720_VERSION_ID_R0_P0 : +case MALI_C720_VERSION_ID_R0_P1 : + *regs = (struct mali_c720_registers ) { + .id = &id_regs, + .top =mali_c720_get_top_regs (), + .cm =mali_c720_get_ctx_mgr_regs (), + .modules =mali_c720_get_modules_regs (), + .context_offset =0x80000 , + .context_size =0x100000 , + }; +return 0 ; +default : +return -ENODEV ; + } }
drivers/media/platform/arm/mali-c720/mali-c720-registers.h +4 -1
@@ -10,6 +10,8 @@#include <linux/types.h> +enum mali_c720_version_id ; +struct mali_c720_top_regs ;struct mali_c720_ctx_mgr_regs ;struct mali_c720_modules_regs ;
@@ -56,7 +58,8 @@ struct mali_c720_registers { };const struct mali_c720_id_regs *mali_c720_get_id_regs (void ); -int mali_c720_get_registers (struct mali_c720_registers *regs); +int mali_c720_get_registers (enum mali_c720_version_id version, +struct mali_c720_registers *regs);static inline u32 mali_c720_reg_addr (u32 base,const struct mali_c720_reg_field *field) {
Signature · 1 line
2.55.0
Re: [PATCH 05/24] media: mali-c720: Add hardware identification
drivers/media/platform/arm/mali-c720/mali-c720-registers.h struct mali_c720_registers { · line 62
Quoted 10 lines · Anthony McGivern
struct
mali_c720_top_regs;
structmali_c720_ctx_mgr_regs;
structmali_c720_modules_regs;drivers/media/platform/arm/mali-c720/mali-c720-registers.h +2
-1@@ -56,7 +58,8 @@ struct mali_c720_registers { };const struct mali_c720_id_regs *mali_c720_get_id_regs (void ); -int mali_c720_get_registers (struct mali_c720_registers *regs); +int mali_c720_get_registers (enum mali_c720_version_id version, +struct mali_c720_registers *regs);
You just added this code. Add complete pieces of code, not half-baked which you immediately need to fix/change.
Best regards,
Krzysztof
Signature · 1 line
Krzysztof Kozlowski <[email protected]>
PATCH 6/24 media: mali-c720: Add format handling
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Define the supported media bus and capture formats, their bit depths and hardware buffer layouts. Add helpers to select formats and check which capture outputs support them.
A future series may extend format enumeration to expose different sets of supported formats depending on the hardware version.
--- .../platform/arm/mali-c720/mali-c720-common.h | 8 + .../platform/arm/mali-c720/mali-c720-formats.c | 452 +++++++++++++++++++++ .../platform/arm/mali-c720/mali-c720-formats.h | 132 ++++++ 3 files changed, 592 insertions(+)
drivers/media/platform/arm/mali-c720/mali-c720-common.h +8 -0
@@ -12,7 +12,9 @@#include <linux/mutex.h> #include <linux/refcount.h> #include <linux/spinlock.h> +#include <linux/videodev2.h> +#include "mali-c720-formats.h" #include "mali-c720-id.h" #include "mali-c720-register-access.h" #include "mali-c720-registers.h"
@@ -20,6 +22,12 @@#include "mali-c720-registers-ctx-mgr.h" #include "mali-c720-registers-modules.h" +enum mali_c720_cap_devs { +MALI_C720_CAP_DEV_FR0_RGB , +MALI_C720_CAP_DEV_FR0_YUV , +MALI_C720_MAX_NUM_CAP_DEVS , +}; +struct mali_c720_context_regs {dma_addr_t dma_handle;u8 *base;
drivers/media/platform/arm/mali-c720/mali-c720-formats.c new file +452 -0
452 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-formats.h new file +132 -0
132 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 7/24 media: mali-c720: Add hardware discovery support
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
The Mali-C720 can be configured at synthesis time with different pipelines and processing modules. Its discovery table describes the resulting hardware configuration.
Parse and validate this table during probe, cache its records and provide helpers to locate pipelines, modules, register addresses and memory tables.
--- .../platform/arm/mali-c720/mali-c720-common.h | 2 + .../platform/arm/mali-c720/mali-c720-discovery.c | 1172 ++++++++++++++++++++ .../platform/arm/mali-c720/mali-c720-discovery.h | 212 ++++ 3 files changed, 1386 insertions(+)
drivers/media/platform/arm/mali-c720/mali-c720-common.h +2 -0
@@ -14,6 +14,7 @@#include <linux/spinlock.h> #include <linux/videodev2.h> +#include "mali-c720-discovery.h" #include "mali-c720-formats.h" #include "mali-c720-id.h" #include "mali-c720-register-access.h"
@@ -50,6 +51,7 @@ struct mali_c720 {struct mali_c720_registers registers; +struct mali_c720_discovery discovery;const struct mali_c720_hw_version *hw_version; };
drivers/media/platform/arm/mali-c720/mali-c720-discovery.c new file +1172 -0
1,172 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-discovery.h new file +212 -0
212 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 8/24 media: mali-c720: Add context manager and interrupt handling
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add support for the ISP context manager unit. Once software marks a context ready and transfers control to hardware, the unit schedules frame processing across hardware contexts. Initial support uses a single context.
Provide API functions for other driver components to configure, start and stop contexts, and handle frame-completion events. These include programming hardware descriptors for contexts, inputs, the CDMA engine and input/output buffers. API calls may reserve resources from hardware pools shared across all contexts, such as buffer descriptors.
Add handling for input frame-start and backend frame-completion interrupts.
--- .../platform/arm/mali-c720/mali-c720-common.h | 45 + .../platform/arm/mali-c720/mali-c720-ctx-mgr.c | 1754 ++++++++++++++++++++ .../platform/arm/mali-c720/mali-c720-ctx-mgr.h | 303 ++++ .../platform/arm/mali-c720/mali-c720-interrupts.c | 432 +++++ .../platform/arm/mali-c720/mali-c720-interrupts.h | 34 + 5 files changed, 2568 insertions(+)
drivers/media/platform/arm/mali-c720/mali-c720-common.h +45 -0
@@ -9,20 +9,25 @@#define MALI_C720_COMMON_H #include <linux/io.h> +#include <linux/kfifo.h> #include <linux/mutex.h> #include <linux/refcount.h> #include <linux/spinlock.h> #include <linux/videodev2.h> +#include "mali-c720-ctx-mgr.h" #include "mali-c720-discovery.h" #include "mali-c720-formats.h" #include "mali-c720-id.h" +#include "mali-c720-interrupts.h" #include "mali-c720-register-access.h" #include "mali-c720-registers.h" #include "mali-c720-registers-top.h" #include "mali-c720-registers-ctx-mgr.h" #include "mali-c720-registers-modules.h" +#define MALI_C720_FRAME_TIMESTAMP_COUNT 256 +enum mali_c720_cap_devs {MALI_C720_CAP_DEV_FR0_RGB ,MALI_C720_CAP_DEV_FR0_YUV ,
@@ -39,20 +44,60 @@ struct mali_c720_context_regs {refcount_t users; }; +struct mali_c720_frame_timestamp { +u64 timestamp; +u32 sequence; +bool valid; +}; +struct mali_c720_context { +unsigned int id;struct mali_c720 *mali_c720;struct mali_c720_context_regs regs; +struct mali_c720_cdma_desc cdma_desc; +struct mali_c720_slot_desc slot_desc; +struct mali_c720_input_cfg input_cfg; +unsigned int active_fifos_by_output[MALI_C720_MAX_NUM_CAP_DEVS ]; +bool slot_desc_updated; + +/* Protects request submission */ +spinlock_t req_lock; +unsigned int request_sequence; + +/* Protects context state and input_cfg. */ +spinlock_t state_lock; +int state; +bool pipeline_busy; + +unsigned int input_frame_sequence; +unsigned int frame_sequence; +struct mali_c720_frame_timestamp frame_timestamps[MALI_C720_FRAME_TIMESTAMP_COUNT ]; +u64 timestamp; };struct mali_c720 {struct device *dev; +unsigned int irq;u8 __iomem *base;resource_size_t mmio_size; +u32 top_base;struct mali_c720_registers registers; +u8 *default_regs;struct mali_c720_discovery discovery;const struct mali_c720_hw_version *hw_version; +struct mali_c720_context context; +struct mali_c720_ctx_mgr ctx_mgr; + +/* Serializes media registration, start/stop and resource allocation. */ +struct mutex device_lock; +u8 num_active_contexts; + + DECLARE_KFIFO(irq_fifo, struct mali_c720_interrupt_data, MALI_C720_IRQ_FIFO_SIZE); + +/* Spinlock to guard IRQ fifo */ +spinlock_t irq_lock; };#endif /* MALI_C720_COMMON_H */
drivers/media/platform/arm/mali-c720/mali-c720-ctx-mgr.c new file +1754 -0
1,754 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-ctx-mgr.h new file +303 -0
303 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-interrupts.c new file +432 -0
432 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-interrupts.h new file +34 -0
@@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* +* ARM Mali-C720 ISP Driver - Image signal processor +* +* Copyright (C) 2026 Arm Ltd +*/ + +#ifndef MALI_C720_INTERRUPTS_H +#define MALI_C720_INTERRUPTS_H + +#include <linux/interrupt.h> +#include <linux/types.h> + +struct mali_c720 ; +struct mali_c720_context ; + +#define MALI_C720_IRQ_FIFO_SIZE 256 + +struct mali_c720_interrupt_data { +u64 timestamp; + +unsigned long input_frame_start; + +unsigned long frame_end; +}; + +irqreturn_t mali_c720_isr_top (int irq,void *dev_id); +irqreturn_t mali_c720_isr (int irq,void *dev_id); + +void mali_c720_set_slot_interrupt (struct mali_c720 *mali_c720, +unsigned int slot_id,bool enable); +void mali_c720_set_frontend_interrupts (struct mali_c720_context *ctx,bool enable); + +#endif /* MALI_C720_INTERRUPTS_H */
Signature · 1 line
2.55.0
PATCH 9/24 media: mali-c720: Add input frontend subdevice
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add the subdevice connecting parallel input port 0 to a single context input through a fixed route. Support for the remaining inputs is planned when userspace routing ioctls are enabled.
--- .../platform/arm/mali-c720/mali-c720-common.h | 49 ++ .../media/platform/arm/mali-c720/mali-c720-input.c | 598 +++++++++++++++++++++ 2 files changed, 647 insertions(+)
drivers/media/platform/arm/mali-c720/mali-c720-common.h +49 -0
@@ -15,6 +15,9 @@#include <linux/spinlock.h> #include <linux/videodev2.h> +#include <media/v4l2-device.h> +#include <media/v4l2-subdev.h> +#include "mali-c720-ctx-mgr.h" #include "mali-c720-discovery.h" #include "mali-c720-formats.h"
@@ -26,8 +29,46 @@#include "mali-c720-registers-ctx-mgr.h" #include "mali-c720-registers-modules.h" +#define MALI_C720_MIN_INPUT_WIDTH 256 +#define MALI_C720_MIN_INPUT_HEIGHT 256 +#define MALI_C720_MAX_WIDTH 8192 +#define MALI_C720_MAX_HEIGHT 4608 +#define MALI_C720_DEFAULT_WIDTH 1920 +#define MALI_C720_DEFAULT_HEIGHT 1080 +#define MALI_C720_FRAME_TIMESTAMP_COUNT 256 +struct mali_c720_subdev { +struct v4l2_subdev sd; +struct mali_c720 *mali_c720; +}; + +#define v4l2_sd_to_mali_c720_sd (_sd) \ + container_of(_sd, struct mali_c720_subdev, sd) + +#define mali_c720_sd_to_sd (_mdev, type) \ + container_of(_mdev, type, mdev) + +enum mali_c720_input_pads { +MALI_C720_INPUT_PAD_SOURCE_SLOT_INPUT , +MALI_C720_INPUT_PAD_SINK_INPUT0 , +MALI_C720_INPUT_NUM_PADS , +}; + +struct mali_c720_slot_input { +struct mali_c720_buffer_pool raw_buffer_desc; +struct media_pad *sink_pad; +struct media_pad *src_pad; +u32 stream; +bool prepared; +}; + +struct mali_c720_input { +struct mali_c720_subdev mdev; +struct media_pad pads[MALI_C720_INPUT_NUM_PADS ]; +struct mali_c720_slot_input slot_input; +}; +enum mali_c720_cap_devs {MALI_C720_CAP_DEV_FR0_RGB ,MALI_C720_CAP_DEV_FR0_YUV ,
@@ -82,6 +123,10 @@ struct mali_c720 {resource_size_t mmio_size;u32 top_base; +struct v4l2_device v4l2_dev; + +struct mali_c720_input input; +struct mali_c720_registers registers;u8 *default_regs;
@@ -100,4 +145,8 @@ struct mali_c720 { spinlock_t irq_lock; }; +int mali_c720_register_input (struct mali_c720 *mali_c720); +void mali_c720_unregister_input (struct mali_c720 *mali_c720); +void mali_c720_cleanup_input (struct mali_c720 *mali_c720); +#endif /* MALI_C720_COMMON_H */
drivers/media/platform/arm/mali-c720/mali-c720-input.c new file +598 -0
598 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 10/24 media: mali-c720: Add ISP and human vision subdevices
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add subdevices for the ISP input pipeline and human vision (HV) pipeline. HV processes images intended for human viewing, while the computer vision (CV) pipeline targets machine-processing applications. This initial driver supports only the HV path.
Expose frame-start events for sensor control timing.
--- .../platform/arm/mali-c720/mali-c720-common.h | 38 ++ .../platform/arm/mali-c720/mali-c720-interrupts.c | 2 + .../media/platform/arm/mali-c720/mali-c720-isp.c | 422 +++++++++++++++++++++ .../platform/arm/mali-c720/mali-c720-vision-pipe.c | 260 +++++++++++++ 4 files changed, 722 insertions(+)
drivers/media/platform/arm/mali-c720/mali-c720-common.h +38 -0
@@ -69,6 +69,30 @@ struct mali_c720_input {struct mali_c720_slot_input slot_input; }; +enum mali_c720_isp_pads { +MALI_C720_ISP_PAD_SINK_VIDEO , +MALI_C720_ISP_PAD_SOURCE_HV , +MALI_C720_ISP_NUM_PADS , +}; + +struct mali_c720_isp { +struct mali_c720_subdev mdev; +struct media_pad pads[MALI_C720_ISP_NUM_PADS ]; +struct media_pad *remote_src; +bool enabled; +}; + +enum mali_c720_vision_pipe_pads { +MALI_C720_VISION_PIPE_PAD_SINK_VIDEO , +MALI_C720_VISION_PIPE_PAD_SOURCE_RGB , +MALI_C720_VISION_PIPE_NUM_PADS , +}; + +struct mali_c720_vision_pipe { +struct mali_c720_subdev mdev; +struct media_pad pads[MALI_C720_VISION_PIPE_NUM_PADS ]; +}; +enum mali_c720_cap_devs {MALI_C720_CAP_DEV_FR0_RGB ,MALI_C720_CAP_DEV_FR0_YUV ,
@@ -126,6 +150,8 @@ struct mali_c720 {struct v4l2_device v4l2_dev;struct mali_c720_input input; +struct mali_c720_isp isp; +struct mali_c720_vision_pipe vision_pipe;struct mali_c720_registers registers;u8 *default_regs;
@@ -145,8 +171,20 @@ struct mali_c720 { spinlock_t irq_lock; }; +/* ISP subdevice registration functions */ +int mali_c720_register_input (struct mali_c720 *mali_c720);void mali_c720_unregister_input (struct mali_c720 *mali_c720);void mali_c720_cleanup_input (struct mali_c720 *mali_c720); +int mali_c720_register_isp (struct mali_c720 *mali_c720); +void mali_c720_unregister_isp (struct mali_c720 *mali_c720); +void mali_c720_cleanup_isp (struct mali_c720 *mali_c720); + +int mali_c720_register_vision_pipe (struct mali_c720 *mali_c720); +void mali_c720_unregister_vision_pipe (struct mali_c720 *mali_c720); +void mali_c720_cleanup_vision_pipe (struct mali_c720 *mali_c720); + +void mali_c720_isp_queue_event_sof (struct mali_c720 *mali_c720,u32 sequence); +#endif /* MALI_C720_COMMON_H */
drivers/media/platform/arm/mali-c720/mali-c720-interrupts.c +2 -0
@@ -156,6 +156,8 @@ static void mali_c720_handle_input_frame_start(struct mali_c720 *mali_c720, entry->sequence = sequence; entry->timestamp = timestamp; entry->valid = true; + +mali_c720_isp_queue_event_sof (mali_c720, sequence); }static void mali_c720_update_frame_timestamp (struct mali_c720_context *ctx)
drivers/media/platform/arm/mali-c720/mali-c720-isp.c new file +422 -0
422 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-vision-pipe.c new file +260 -0
260 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 11/24 media: mali-c720: Add full-resolution output subdevice
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add the full-resolution output 0 (FR0) subdevice with RGB and YUV source pads. It is currently connected to the human vision (HV) pipeline. Support for additional full-resolution output pipelines and connections to the computer vision (CV) pipeline will be added in the future.
Configure scaling through the sink-pad compose rectangle, followed by cropping on the source pads. Both outputs share the scaling and crop configuration.
Provide default scaler coefficients and YUV output formatter settings.
--- .../platform/arm/mali-c720/mali-c720-common.h | 53 + .../platform/arm/mali-c720/mali-c720-fr-pipe.c | 1178 ++++++++++++++++++++ 2 files changed, 1231 insertions(+)
drivers/media/platform/arm/mali-c720/mali-c720-common.h +53 -0
@@ -31,11 +31,15 @@#define MALI_C720_MIN_INPUT_WIDTH 256#define MALI_C720_MIN_INPUT_HEIGHT 256 +#define MALI_C720_MIN_OUTPUT_WIDTH 64 +#define MALI_C720_MIN_OUTPUT_HEIGHT 64#define MALI_C720_MAX_WIDTH 8192#define MALI_C720_MAX_HEIGHT 4608#define MALI_C720_DEFAULT_WIDTH 1920#define MALI_C720_DEFAULT_HEIGHT 1080 +#define MALI_C720_MAX_DOWNSCALE_RATIO 0xffffff/* Q4.20 */ +#define MALI_C720_FRAME_TIMESTAMP_COUNT 256struct mali_c720_subdev {
@@ -93,6 +97,48 @@ struct mali_c720_vision_pipe {struct media_pad pads[MALI_C720_VISION_PIPE_NUM_PADS ]; }; +enum mali_c720_fr_pipe_pads { +MALI_C720_FR_PIPE_PAD_SINK_VIDEO , +MALI_C720_FR_PIPE_PAD_SOURCE_RGB , +MALI_C720_FR_PIPE_PAD_SOURCE_YUV , +MALI_C720_FR_PIPE_NUM_PADS , +}; + +struct mali_c720_crop_config { +u32 start_x; +u32 start_y; +u32 size_x; +u32 size_y; +bool bypass; +}; + +struct mali_c720_fr_resizer_config { +struct mali_c720_crop_config crop; +u32 hfilt_tincr; +u32 vfilt_tincr; +unsigned int hbank; +unsigned int vbank; +bool hfilt_enable; +bool vfilt_enable; +}; + +struct mali_c720_fr_pipe { +struct mali_c720_subdev mdev; +struct media_pad pads[MALI_C720_FR_PIPE_NUM_PADS ]; +struct media_pad *remote_src; +u32 crop_base; +u32 scaler_base; +u32 scaler_hmem_base; +u32 scaler_vmem_base; +u32 output_formatter_base; + +/* Protect resizer_config, resizer_updated and enabled_crops. */ +spinlock_t resizer_lock; +struct mali_c720_fr_resizer_config resizer_config; +bool resizer_updated; +unsigned long enabled_crops; +}; +enum mali_c720_cap_devs {MALI_C720_CAP_DEV_FR0_RGB ,MALI_C720_CAP_DEV_FR0_YUV ,
@@ -152,6 +198,7 @@ struct mali_c720 {struct mali_c720_input input;struct mali_c720_isp isp;struct mali_c720_vision_pipe vision_pipe; +struct mali_c720_fr_pipe fr_pipe;struct mali_c720_registers registers;u8 *default_regs;
@@ -185,6 +232,12 @@ int mali_c720_register_vision_pipe(struct mali_c720 *mali_c720);void mali_c720_unregister_vision_pipe (struct mali_c720 *mali_c720);void mali_c720_cleanup_vision_pipe (struct mali_c720 *mali_c720); +int mali_c720_register_fr_pipe (struct mali_c720 *mali_c720); +void mali_c720_unregister_fr_pipe (struct mali_c720 *mali_c720); +void mali_c720_cleanup_fr_pipe (struct mali_c720 *mali_c720); + +void mali_c720_fr_pipe_apply_resizer_config (struct mali_c720_fr_pipe *pipe); +void mali_c720_isp_queue_event_sof (struct mali_c720 *mali_c720,u32 sequence);#endif /* MALI_C720_COMMON_H */
drivers/media/platform/arm/mali-c720/mali-c720-fr-pipe.c new file +1178 -0
1,178 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 11/24] media: mali-c720: Add full-resolution output subdevice
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] media: mali-c720: premature stream disable in mali_c720_fr_pipe_disable_streams() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Medium] media: mali-c720: premature stream disable in mali_c720_fr_pipe_disable_streams()
--
commit e9291c2295f3f6641b25d61f1e2d851fc6eecc95
Author: Anthony McGivern <[email protected]>
media: mali-c720: Add full-resolution output subdevice
This commit adds the full-resolution output 0 (FR0) V4L2 subdevice with RGB and YUV source pads, including scaler and crop configuration.
Quoted 6 lines
drivers/media/platform/arm/mali-c720/mali-c720-fr-pipe.c new file +0
-0@@ -0,0 +1,1178 @@
[ ... ]
Quoted 53 lines
drivers/media/platform/arm/mali-c720/mali-c720-fr-pipe.c new file +53
-0+static int mali_c720_fr_pipe_enable_streams (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state,u32 pad, +u64 streams_mask) +{ +struct mali_c720_subdev *mdev =v4l2_sd_to_mali_c720_sd (sd); +struct mali_c720 *mali_c720 = mdev->mali_c720; +const struct mali_c720_pipeline_regs *pipeline = mali_c720->registers.top->pipeline; +struct mali_c720_fr_pipe *pipe = + mali_c720_sd_to_sd(mdev, struct mali_c720_fr_pipe); +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +struct v4l2_subdev *src_sd; +struct media_pad *sink_pad; +int ret; + + sink_pad = &pipe->pads[MALI_C720_FR_PIPE_PAD_SINK_VIDEO ]; + pipe->remote_src =media_pad_remote_pad_unique (sink_pad); +if (IS_ERR (pipe->remote_src)) { +dev_err (mali_c720->dev, +"No remote source for fr 0 pipe\n" ); +return -EINVAL ; + } + + src_sd =media_entity_to_v4l2_subdev (pipe->remote_src->entity); +mali_c720_ctx_group_write (ctx, mali_c720->top_base, + &pipeline->fr0_hv_cv_mux_sel, +ISP_TOP_FR0_HV_CV_MUX_SEL_HV ); + +/* Enable the upstream subdevice unless another output already enabled it. */ + ret =v4l2_subdev_enable_streams (src_sd, pipe->remote_src->index,BIT (0 )); +if (ret && ret != -EALREADY ) +return ret; + +mali_c720_fr_pipe_update_resizer_config (pipe, state); +if (pad ==MALI_C720_FR_PIPE_PAD_SOURCE_YUV ) +mali_c720_fr_pipe_program_output_formatter (pipe); + +guard (spinlock)(&pipe->resizer_lock); + pipe->enabled_crops |=BIT (pad); + +return 0 ; +} + +static int mali_c720_fr_pipe_disable_streams (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state,u32 pad, +u64 streams_mask) +{ +struct mali_c720_subdev *mdev =v4l2_sd_to_mali_c720_sd (sd); +struct mali_c720_fr_pipe *pipe = + mali_c720_sd_to_sd(mdev, struct mali_c720_fr_pipe); +struct v4l2_subdev *src_sd; + +if (pipe->remote_src) { + src_sd =media_entity_to_v4l2_subdev (pipe->remote_src->entity);
drivers/media/platform/arm/mali-c720/mali-c720-fr-pipe.c line 974
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-fr-pipe.c new file +10
-0+v4l2_subdev_disable_streams (src_sd, pipe->remote_src->index, +BIT (0 )); + } + pipe->remote_src =NULL ; + +guard (spinlock)(&pipe->resizer_lock); + pipe->enabled_crops &= ~BIT (pad); + +return 0 ; +}
[Severity: Medium]
Does mali_c720_fr_pipe_disable_streams() stop the upstream subdevice while the other source pad is still streaming?
mali_c720_fr_pipe_enable_streams() allows both the RGB and YUV source pads to share the upstream stream by ignoring -EALREADY, and records each active pad in pipe->enabled_crops. However, mali_c720_fr_pipe_disable_streams() unconditionally disables the upstream stream and clears pipe->remote_src without checking whether the other pad bit is still set in pipe->enabled_crops.
Also, if media_pad_remote_pad_unique() fails in mali_c720_fr_pipe_enable_streams(), pipe->remote_src is left holding an ERR_PTR, which the truthiness check in mali_c720_fr_pipe_disable_streams() would treat as a valid pointer.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=11
PATCH 12/24 media: mali-c720: Add video capture nodes
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add RGB and YUV video capture nodes for the full-resolution output 0 (FR0) subdevice. The capture-node implementation can be extended to support other subdevice outputs in the future, such as raw capture.
--- .../platform/arm/mali-c720/mali-c720-capture.c | 747 +++++++++++++++++++++ .../platform/arm/mali-c720/mali-c720-common.h | 56 ++ .../platform/arm/mali-c720/mali-c720-ctx-mgr.c | 6 + 3 files changed, 809 insertions(+)
drivers/media/platform/arm/mali-c720/mali-c720-capture.c new file +747 -0
@@ -0,0 +1,747 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* ARM Mali-C720 ISP Driver - Image signal processor +* +* Copyright (C) 2026 Arm Ltd +*/ + +#include <linux/align.h> +#include <linux/cleanup.h> +#include <linux/dev_printk.h> +#include <linux/minmax.h> +#include <linux/pm_runtime.h> +#include <linux/string.h> + +#include <media/v4l2-common.h> +#include <media/v4l2-event.h> +#include <media/v4l2-fh.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> + +#include "mali-c720-common.h" + +static const char *const capture_device_names[] = { +"mali-c720 fr0-rgb" , +"mali-c720 fr0-yuv" , +}; + +static int mali_c720_link_validate (struct media_link *link) +{ +struct video_device *vdev = +media_entity_to_video_device (link->sink->entity); +struct mali_c720_cap_dev *cap_dev =video_get_drvdata (vdev); +struct v4l2_subdev *sd = +media_entity_to_v4l2_subdev (link->source->entity); +const struct v4l2_pix_format_mplane *pix_mp; +const struct mali_c720_v4l2_format_info *cap_fmt; +int ret; + +struct v4l2_subdev_format sd_fmt = { + .which =V4L2_SUBDEV_FORMAT_ACTIVE , + .pad = link->source->index, + }; + + ret =v4l2_subdev_call (sd, pad, get_fmt,NULL , &sd_fmt); +if (ret) +return ret; + + pix_mp = &cap_dev->format.pix_mp; + cap_fmt = cap_dev->format.info; + +if (sd_fmt.format.width != pix_mp->width || + sd_fmt.format.height != pix_mp->height) { +dev_err (cap_dev->mali_c720->dev, +"link '%s':%u -> '%s':%u not valid: %ux%u != %ux%u\n" , + link->source->entity->name, link->source->index, + link->sink->entity->name, link->sink->index, + sd_fmt.format.width, sd_fmt.format.height, + pix_mp->width, pix_mp->height); +return -EPIPE ; + } + +if (!mali_c720_mbus_code_supports_fmt (cap_fmt, sd_fmt.format.code)) { +dev_err (cap_dev->mali_c720->dev, +"link '%s':%u -> '%s':%u not valid: mbus_code 0x%04x cannot produce pixel format %p4cc\n" , + link->source->entity->name, link->source->index, + link->sink->entity->name, link->sink->index, + sd_fmt.format.code, &pix_mp->pixelformat); +return -EPIPE ; + } + +return 0 ; +} + +static const struct media_entity_operations mali_c720_media_ops = { + .link_validate = mali_c720_link_validate, +}; + +static int mali_c720_vb2_queue_setup (struct vb2_queue *q,unsigned int *num_buffers, +unsigned int *num_planes,unsigned int sizes[], +struct device *alloc_devs[]) +{ +struct mali_c720_cap_dev *cap_dev = q->drv_priv; +unsigned int i; + +if (*num_planes) { +if (*num_planes != cap_dev->format.pix_mp.num_planes) +return -EINVAL ; + +for (i =0 ; i < cap_dev->format.pix_mp.num_planes; i++) +if (sizes[i] < cap_dev->format.pix_mp.plane_fmt[i].sizeimage) +return -EINVAL ; + }else { + *num_planes = cap_dev->format.pix_mp.num_planes; +for (i =0 ; i < cap_dev->format.pix_mp.num_planes; i++) + sizes[i] = cap_dev->format.pix_mp.plane_fmt[i].sizeimage; + } + +return 0 ; +} + +static void mali_c720_buf_queue (struct vb2_buffer *vb) +{ +struct mali_c720_cap_dev *cap_dev =vb2_get_drv_priv (vb->vb2_queue); +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +struct mali_c720_cap_buffer *buf =container_of (vbuf, + struct mali_c720_cap_buffer, vb); +unsigned int i; + +for (i =0 ; i < cap_dev->format.pix_mp.num_planes; i++) { +unsigned long size = cap_dev->format.pix_mp.plane_fmt[i].sizeimage; + +vb2_set_plane_payload (vb, i, size); + } + + buf->vb.field =V4L2_FIELD_NONE ; + + scoped_guard(spinlock, &cap_dev->buffers.lock) +list_add_tail (&buf->queue, &cap_dev->buffers.input); +} + +static int mali_c720_buf_init (struct vb2_buffer *vb) +{ +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +struct mali_c720_cap_buffer *buf =container_of (vbuf, + struct mali_c720_cap_buffer, vb); + + buf->addr =vb2_dma_contig_plane_dma_addr (vb,0 ); +if (!IS_ALIGNED (buf->addr,32 )) { +dev_dbg (vb->vb2_queue->dev, +"Capture buffer DMA address is not 32-byte aligned\n" ); +return -EINVAL ; + } + +return 0 ; +} + +static void mali_c720_buf_request_complete (struct vb2_buffer *vb) +{ +} + +bool mali_c720_cap_dev_uses_requests (struct mali_c720_cap_dev *cap_dev) +{ +return video_is_registered (&cap_dev->vdev) && +vb2_is_streaming (&cap_dev->queue) && + cap_dev->queue.uses_requests; +} + +struct media_request *mali_c720_cap_dev_get_request (struct mali_c720_cap_dev *cap_dev) +{ +struct mali_c720_cap_buffer *buf; + +if (!mali_c720_cap_dev_uses_requests (cap_dev)) +return NULL ; + +guard (spinlock)(&cap_dev->buffers.lock); + + buf =list_first_entry_or_null (&cap_dev->buffers.input, + struct mali_c720_cap_buffer, queue); + +return buf ? buf->vb.vb2_buf.request :NULL ; +} + +int mali_c720_cap_dev_is_ready (struct mali_c720_cap_dev *cap_dev) +{ +struct mali_c720_cap_buffer *buf; + +if (!video_is_registered (&cap_dev->vdev)) +return -ENODEV ; + +if (!vb2_is_streaming (&cap_dev->queue)) +return -ENODEV ; + + scoped_guard(spinlock, &cap_dev->buffers.lock) { + buf =list_first_entry_or_null (&cap_dev->buffers.input, + struct mali_c720_cap_buffer, queue); + +if (!buf) +return -ENOENT ; + } + +return 0 ; +} + +void mali_c720_cap_dev_set_next_buffer (struct mali_c720_cap_dev *cap_dev, +struct media_request *req) +{ +struct mali_c720 *mali_c720 = cap_dev->mali_c720; +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +struct mali_c720_buffer_pool *pool = &cap_dev->buffers.pool; +struct mali_c720_cap_buffer *buf; + +if (!video_is_registered (&cap_dev->vdev)) +return ; + +if (!vb2_is_streaming (&cap_dev->queue)) +return ; + + scoped_guard(spinlock, &cap_dev->buffers.lock) { + buf =list_first_entry_or_null (&cap_dev->buffers.input, + struct mali_c720_cap_buffer, queue); + +if (buf && (!buf->vb.vb2_buf.request || + buf->vb.vb2_buf.request == req)) { +mali_c720_ctx_mgr_update_buffer (ctx, pool, &buf->addr,0 ); +list_move_tail (&buf->queue, &cap_dev->buffers.processing); +return ; + } + } + +mali_c720_ctx_mgr_update_buffer (ctx, pool,NULL ,0 ); +} + +void mali_c720_cap_dev_buffer_done (struct mali_c720_cap_dev *cap_dev, +bool success) +{ +struct mali_c720 *mali_c720 = cap_dev->mali_c720; +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +struct mali_c720_cap_buffer *buf; + +if (!video_is_registered (&cap_dev->vdev)) +return ; + +if (!vb2_is_streaming (&cap_dev->queue)) +return ; + +guard (spinlock)(&cap_dev->buffers.lock); + + buf =list_first_entry_or_null (&cap_dev->buffers.processing, + struct mali_c720_cap_buffer, queue); +if (!buf) +return ; + +if (mali_c720_ctx_mgr_check_output_buffer_status (ctx, &cap_dev->buffers.pool)) + success = false; + +if (success) { + buf->vb.vb2_buf.timestamp = ctx->timestamp; + buf->vb.sequence = ctx->frame_sequence; + } + +vb2_buffer_done (&buf->vb.vb2_buf, success ?VB2_BUF_STATE_DONE :VB2_BUF_STATE_ERROR ); +list_del (&buf->queue); +} + +static void mali_c720_cap_dev_return_buffers (struct mali_c720_cap_dev *cap_dev, +enum vb2_buffer_state state) +{ +struct mali_c720_cap_buffer *buf, *tmp; + +guard (spinlock)(&cap_dev->buffers.lock); + +list_for_each_entry_safe (buf, tmp, &cap_dev->buffers.input, queue) { +list_del (&buf->queue); +vb2_buffer_done (&buf->vb.vb2_buf, state); + } + +list_for_each_entry_safe (buf, tmp, &cap_dev->buffers.processing, queue) { +list_del (&buf->queue); +vb2_buffer_done (&buf->vb.vb2_buf, state); + } +} + +static int mali_c720_cap_dev_buffer_pool_configure (struct mali_c720_cap_dev *cap_dev) +{ +struct mali_c720 *mali_c720 = cap_dev->mali_c720; +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +int ret; + + ret =mali_c720_ctx_mgr_request_buffer_pool (ctx, + &cap_dev->format.buffer_request, + &cap_dev->buffers.pool); +if (ret) +return ret; + +return 0 ; +} + +static void mali_c720_cap_dev_release_buffer_pool (struct mali_c720_cap_dev *cap_dev) +{ +struct mali_c720 *mali_c720 = cap_dev->mali_c720; +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +struct mali_c720_buffer_pool *pool = &cap_dev->buffers.pool; + +mali_c720_ctx_mgr_release_buffer_pool (ctx, pool); +} + +static int mali_c720_vb2_start_streaming (struct vb2_queue *q,unsigned int count) +{ +struct mali_c720_cap_dev *cap_dev = q->drv_priv; +struct mali_c720 *mali_c720 = cap_dev->mali_c720; +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +int ret; + +guard (mutex)(&mali_c720->device_lock); + +if (!media_devnode_is_registered (mali_c720->media_dev.devnode)) { + ret = -ENODEV ; + goto err_return_buffers; + } + + ret =pm_runtime_resume_and_get (mali_c720->dev); +if (ret) + goto err_return_buffers; + + ret =video_device_pipeline_start (&cap_dev->vdev, &mali_c720->pipe); +if (ret) { +dev_err (mali_c720->dev,"%s failed to start media pipeline\n" , + cap_dev->vdev.name); + goto err_pm_put; + } + + ret =mali_c720_alloc_context (ctx); +if (ret) + goto err_stop_video_pipeline; + + ret =mali_c720_cap_dev_buffer_pool_configure (cap_dev); +if (ret) { +dev_err (mali_c720->dev,"%s failed to request output buffers\n" , + cap_dev->vdev.name); + goto err_free_context; + } + + ret =v4l2_subdev_enable_streams (cap_dev->src_sd, cap_dev->src_pad, +BIT (0 )); +if (ret && ret != -EALREADY ) { +dev_err (mali_c720->dev,"%s failed to start src subdev\n" , + cap_dev->vdev.name); + goto err_release_buffer_pool; + } + +return 0 ; + +err_release_buffer_pool: +mali_c720_cap_dev_release_buffer_pool (cap_dev); +err_free_context: +mali_c720_free_context (ctx); +err_stop_video_pipeline: +video_device_pipeline_stop (&cap_dev->vdev); +err_pm_put: +pm_runtime_put (mali_c720->dev); +err_return_buffers: +mali_c720_cap_dev_return_buffers (cap_dev,VB2_BUF_STATE_QUEUED ); + +return ret; +} + +static void mali_c720_vb2_stop_streaming (struct vb2_queue *q) +{ +struct mali_c720_cap_dev *cap_dev = q->drv_priv; +struct mali_c720 *mali_c720 = cap_dev->mali_c720; +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +struct mali_c720_isp *isp = &mali_c720->isp; +struct v4l2_subdev *isp_sd = &isp->mdev.sd; + +guard (mutex)(&mali_c720->device_lock); + +v4l2_subdev_disable_streams (isp_sd,MALI_C720_ISP_PAD_SOURCE_HV , +BIT (0 )); +v4l2_subdev_disable_streams (cap_dev->src_sd, cap_dev->src_pad, +BIT (0 )); +mali_c720_cap_dev_release_buffer_pool (cap_dev); +mali_c720_cap_dev_return_buffers (cap_dev,VB2_BUF_STATE_ERROR ); + +mali_c720_free_context (ctx); + +video_device_pipeline_stop (&cap_dev->vdev); + +pm_runtime_put_autosuspend (mali_c720->dev); +pm_runtime_mark_last_busy (mali_c720->dev); +} + +static const struct vb2_ops mali_c720_vb2_ops = { + .queue_setup = &mali_c720_vb2_queue_setup, + .buf_queue = &mali_c720_buf_queue, + .buf_init = &mali_c720_buf_init, + .start_streaming = &mali_c720_vb2_start_streaming, + .stop_streaming = &mali_c720_vb2_stop_streaming, + .buf_request_complete = &mali_c720_buf_request_complete, +}; + +static const struct v4l2_file_operations mali_c720_v4l2_fops = { + .owner =THIS_MODULE , + .unlocked_ioctl = video_ioctl2, + .open = v4l2_fh_open, + .release = vb2_fop_release, + .poll = vb2_fop_poll, + .mmap = vb2_fop_mmap, +}; + +static void mali_c720_try_fmt (struct mali_c720_cap_dev *cap_dev, +struct v4l2_pix_format_mplane *pix_mp) +{ +const struct mali_c720_v4l2_format_info *info; +const struct mali_c720_mbus_format_info *cfg; +struct v4l2_plane_pix_format *plane, *y_plane; +u32 requested_stride = pix_mp->plane_fmt[0 ].bytesperline; +unsigned int i; + + info =mali_c720_get_v4l2_config_by_fourcc (pix_mp->pixelformat); +if (!info || !mali_c720_format_supported_by_vdev (info, cap_dev->id)) + info =mali_c720_get_v4l2_config_by_fourcc (cap_dev->format.default_format); + + cfg =mali_c720_get_mbus_config_by_code (info->mbus_code); + + pix_mp->pixelformat = info->fourcc; +v4l_bound_align_image (&pix_mp->width,MALI_C720_MIN_OUTPUT_WIDTH , +MALI_C720_MAX_WIDTH ,1 , + &pix_mp->height,MALI_C720_MIN_OUTPUT_HEIGHT , +MALI_C720_MAX_HEIGHT ,1 ,0 ); + + pix_mp->field =V4L2_FIELD_NONE ; +if (cfg->type & (MALI_C720_FORMAT_RGB |MALI_C720_FORMAT_YUV )) + pix_mp->colorspace =V4L2_COLORSPACE_SRGB ; +else + pix_mp->colorspace =V4L2_COLORSPACE_RAW ; + + pix_mp->xfer_func =V4L2_MAP_XFER_FUNC_DEFAULT (pix_mp->colorspace); +if (cfg->type &MALI_C720_FORMAT_YUV ) + pix_mp->ycbcr_enc =V4L2_YCBCR_ENC_709 ; +else + pix_mp->ycbcr_enc =V4L2_MAP_YCBCR_ENC_DEFAULT (pix_mp->colorspace); + +if (pix_mp->colorspace ==V4L2_COLORSPACE_RAW ) + pix_mp->quantization =V4L2_QUANTIZATION_FULL_RANGE ; +else + pix_mp->quantization = +V4L2_MAP_QUANTIZATION_DEFAULT (cfg->type &MALI_C720_FORMAT_RGB , + pix_mp->colorspace, + pix_mp->ycbcr_enc); + +/* Only contiguous multi-planar formats are supported. */ + pix_mp->num_planes =1 ; +memset (pix_mp->plane_fmt,0 ,sizeof (pix_mp->plane_fmt)); + + y_plane = &pix_mp->plane_fmt[0 ]; + y_plane->bytesperline =clamp (requested_stride, +DIV_ROUND_UP (info->bpp[0 ] * pix_mp->width,8 ), +65504U ); + y_plane->bytesperline =ALIGN (y_plane->bytesperline,32 ); + y_plane->sizeimage = y_plane->bytesperline * pix_mp->height; + +for (i =1 ; i < info->comp_planes; i++) { + plane = &pix_mp->plane_fmt[i]; + + plane->bytesperline = y_plane->bytesperline; + plane->sizeimage =DIV_ROUND_UP (plane->bytesperline * pix_mp->height, + info->vdiv); + + y_plane->sizeimage += plane->sizeimage; + } +} + +static int mali_c720_try_fmt_vid_cap_mplane (struct file *file,void *fh, +struct v4l2_format *f) +{ +struct mali_c720_cap_dev *cap_dev =video_drvdata (file); + +mali_c720_try_fmt (cap_dev, &f->fmt.pix_mp); +return 0 ; +} + +static void mali_c720_set_format (struct mali_c720_cap_dev *cap_dev, +struct v4l2_pix_format_mplane *pix_mp) +{ +struct mali_c720_buffer_request_info *req = &cap_dev->format.buffer_request; +const struct mali_c720_v4l2_format_info *info; +unsigned int i; + +mali_c720_try_fmt (cap_dev, pix_mp); + + cap_dev->format.pix_mp = *pix_mp; + cap_dev->format.info =mali_c720_get_v4l2_config_by_fourcc (pix_mp->pixelformat); + info = cap_dev->format.info; + +memset (req,0 ,sizeof (*req)); + req->type =MALI_C720_BUF_TYPE_OUT ; + req->sub_type = cap_dev->id; + req->width = pix_mp->width; + req->height = pix_mp->height; + + req->line_offset[0 ] = pix_mp->plane_fmt[0 ].bytesperline; + req->plane_size[0 ] = pix_mp->plane_fmt[0 ].bytesperline * pix_mp->height; +for (i =1 ; i < info->comp_planes; i++) { + req->line_offset[i] = pix_mp->plane_fmt[i].bytesperline; + req->plane_size[i] = pix_mp->plane_fmt[i].sizeimage; + } + + req->num_out_planes = info->comp_planes; + req->buffer_cfg = info->buffer_cfg; +} + +static int mali_c720_s_fmt_vid_cap_mplane (struct file *file,void *fh, +struct v4l2_format *f) +{ +struct mali_c720_cap_dev *cap_dev =video_drvdata (file); + +if (media_entity_is_streaming (&cap_dev->vdev.entity)) +return -EBUSY ; + +if (vb2_is_busy (&cap_dev->queue)) +return -EBUSY ; + +mali_c720_set_format (cap_dev, &f->fmt.pix_mp); +return 0 ; +} + +static int mali_c720_g_fmt_vid_cap_mplane (struct file *file,void *fh, +struct v4l2_format *f) +{ +struct mali_c720_cap_dev *cap_dev =video_drvdata (file); + + f->fmt.pix_mp = cap_dev->format.pix_mp; + +return 0 ; +} + +static int mali_c720_enum_fmt_vid_cap_mplane (struct file *file,void *fh, +struct v4l2_fmtdesc *f) +{ +struct mali_c720_cap_dev *cap_dev =video_drvdata (file); +const struct mali_c720_v4l2_format_info *info; +struct mali_c720_v4l2_format_match match; + + match.dev_id = cap_dev->id; + match.mbus_code = f->mbus_code; + + info =mali_c720_get_v4l2_config_by_matched_index (f->index, &match); +if (info) { + f->pixelformat = info->fourcc; +return 0 ; + } + +return -EINVAL ; +} + +static int mali_c720_enum_framesizes (struct file *file,void *fh, +struct v4l2_frmsizeenum *fsize) +{ +struct mali_c720_cap_dev *cap_dev =video_drvdata (file); +const struct mali_c720_v4l2_format_info *info; + +if (fsize->index) +return -EINVAL ; + + info =mali_c720_get_v4l2_config_by_fourcc (fsize->pixel_format); +if (!info || !mali_c720_format_supported_by_vdev (info, cap_dev->id)) +return -EINVAL ; + + fsize->type =V4L2_FRMSIZE_TYPE_STEPWISE ; + fsize->stepwise.min_width =MALI_C720_MIN_OUTPUT_WIDTH ; + fsize->stepwise.max_width =MALI_C720_MAX_WIDTH ; + fsize->stepwise.step_width =2 ; + fsize->stepwise.min_height =MALI_C720_MIN_OUTPUT_HEIGHT ; + fsize->stepwise.max_height =MALI_C720_MAX_HEIGHT ; + fsize->stepwise.step_height =2 ; + +return 0 ; +} + +static int mali_c720_querycap (struct file *file,void *fh, +struct v4l2_capability *cap) +{ +strscpy (cap->driver,MALI_C720_DRIVER_NAME ,sizeof (cap->driver)); +strscpy (cap->card,"ARM Mali-C720 ISP" ,sizeof (cap->card)); + +return 0 ; +} + +static const struct v4l2_ioctl_ops mali_c720_v4l2_ioctl_ops = { + .vidioc_reqbufs = vb2_ioctl_reqbufs, + .vidioc_querybuf = vb2_ioctl_querybuf, + .vidioc_create_bufs = vb2_ioctl_create_bufs, + .vidioc_qbuf = vb2_ioctl_qbuf, + .vidioc_expbuf = vb2_ioctl_expbuf, + .vidioc_dqbuf = vb2_ioctl_dqbuf, + .vidioc_prepare_buf = vb2_ioctl_prepare_buf, + .vidioc_streamon = vb2_ioctl_streamon, + .vidioc_streamoff = vb2_ioctl_streamoff, + .vidioc_try_fmt_vid_cap_mplane = mali_c720_try_fmt_vid_cap_mplane, + .vidioc_s_fmt_vid_cap_mplane = mali_c720_s_fmt_vid_cap_mplane, + .vidioc_g_fmt_vid_cap_mplane = mali_c720_g_fmt_vid_cap_mplane, + .vidioc_enum_fmt_vid_cap = mali_c720_enum_fmt_vid_cap_mplane, + .vidioc_enum_framesizes = mali_c720_enum_framesizes, + .vidioc_querycap = mali_c720_querycap, + .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, + .vidioc_unsubscribe_event = v4l2_event_unsubscribe, +}; + +static int mali_c720_register_cap_dev (struct mali_c720 *mali_c720, +enum mali_c720_cap_devs cap_dev_id) +{ +struct mali_c720_cap_dev *cap_dev = &mali_c720->cap_devs[cap_dev_id]; +struct v4l2_pix_format_mplane pix_mp; +struct video_device *vdev; +struct vb2_queue *vb2q; +int ret; + + vdev = &cap_dev->vdev; + vb2q = &cap_dev->queue; + + cap_dev->id = cap_dev_id; + cap_dev->mali_c720 = mali_c720; +mutex_init (&cap_dev->lock); +INIT_LIST_HEAD (&cap_dev->buffers.input); +INIT_LIST_HEAD (&cap_dev->buffers.processing); +spin_lock_init (&cap_dev->buffers.lock); + +memset (&pix_mp,0 ,sizeof (pix_mp)); + + pix_mp.width =MALI_C720_DEFAULT_WIDTH ; + pix_mp.height =MALI_C720_DEFAULT_HEIGHT ; + +switch (cap_dev->id) { +case MALI_C720_CAP_DEV_FR0_RGB : + cap_dev->src_sd = + &mali_c720->fr_pipe.mdev.sd; + cap_dev->src_pad =MALI_C720_FR_PIPE_PAD_SOURCE_RGB ; + cap_dev->format.default_format =V4L2_PIX_FMT_RGB24 ; +break ; +case MALI_C720_CAP_DEV_FR0_YUV : + cap_dev->src_sd = + &mali_c720->fr_pipe.mdev.sd; + cap_dev->src_pad =MALI_C720_FR_PIPE_PAD_SOURCE_YUV ; + cap_dev->format.default_format =V4L2_PIX_FMT_NV12 ; +break ; +default : +dev_warn_once (mali_c720->dev, +"Invalid capture device id %u\n" , cap_dev->id); + ret = -EINVAL ; + goto err_destroy_mutex; + } + + cap_dev->pad.flags =MEDIA_PAD_FL_SINK |MEDIA_PAD_FL_MUST_CONNECT ; + ret =media_entity_pads_init (&cap_dev->vdev.entity,1 , &cap_dev->pad); +if (ret) + goto err_destroy_mutex; + + vb2q->type =V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ; + vb2q->io_modes =VB2_MMAP |VB2_DMABUF ; + vb2q->drv_priv = cap_dev; + vb2q->mem_ops = &vb2_dma_contig_memops; + vb2q->ops = &mali_c720_vb2_ops; + vb2q->buf_struct_size =sizeof (struct mali_c720_cap_buffer ); + vb2q->min_queued_buffers =0 ; + vb2q->supports_requests =1 ; + vb2q->timestamp_flags =V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC | +V4L2_BUF_FLAG_TSTAMP_SRC_SOE ; + vb2q->lock = &cap_dev->lock; + vb2q->dev = mali_c720->dev; + + ret =vb2_queue_init (vb2q); +if (ret) { +dev_err (mali_c720->dev,"%s vb2 queue init failed\n" , + cap_dev->vdev.name); + goto err_cleanup_media_entity; + } + +strscpy (cap_dev->vdev.name, capture_device_names[cap_dev_id], +sizeof (cap_dev->vdev.name)); + vdev->release = video_device_release_empty; + vdev->fops = &mali_c720_v4l2_fops; + vdev->ioctl_ops = &mali_c720_v4l2_ioctl_ops; + vdev->lock = &cap_dev->lock; + vdev->v4l2_dev = &mali_c720->v4l2_dev; + vdev->queue = &cap_dev->queue; + vdev->device_caps =V4L2_CAP_VIDEO_CAPTURE_MPLANE | +V4L2_CAP_STREAMING |V4L2_CAP_IO_MC ; + vdev->entity.ops = &mali_c720_media_ops; +video_set_drvdata (vdev, cap_dev); + + pix_mp.pixelformat = cap_dev->format.default_format; +mali_c720_set_format (cap_dev, &pix_mp); + + ret =video_register_device (vdev,VFL_TYPE_VIDEO ,-1 ); +if (ret) { +dev_err (mali_c720->dev, +"%s failed to register video device\n" , + cap_dev->vdev.name); + goto err_release_vb2q; + } + +return 0 ; + +err_release_vb2q: +vb2_queue_release (vb2q); +err_cleanup_media_entity: +media_entity_cleanup (&cap_dev->vdev.entity); +err_destroy_mutex: +mutex_destroy (&cap_dev->lock); + cap_dev->mali_c720 =NULL ; + +return ret; +} + +int mali_c720_register_capture_devs (struct mali_c720 *mali_c720) +{ +unsigned int i; +int ret; + +for (i =0 ; i <MALI_C720_MAX_NUM_CAP_DEVS ; i++) { + ret =mali_c720_register_cap_dev (mali_c720, i); +if (ret) +return ret; + } + +return 0 ; +} + +static void mali_c720_unregister_cap_dev (struct mali_c720 *mali_c720, +enum mali_c720_cap_devs cap_dev_id) +{ +struct mali_c720_cap_dev *cap_dev = &mali_c720->cap_devs[cap_dev_id]; + +if (!video_is_registered (&cap_dev->vdev)) +return ; + +vb2_video_unregister_device (&cap_dev->vdev); +} + +static void mali_c720_cleanup_cap_dev (struct mali_c720 *mali_c720, +enum mali_c720_cap_devs cap_dev_id) +{ +struct mali_c720_cap_dev *cap_dev = &mali_c720->cap_devs[cap_dev_id]; + +if (!cap_dev->mali_c720) +return ; + +media_entity_cleanup (&cap_dev->vdev.entity); +mutex_destroy (&cap_dev->lock); + cap_dev->mali_c720 =NULL ; +} + +void mali_c720_unregister_capture_devs (struct mali_c720 *mali_c720) +{ +unsigned int i; + +for (i =0 ; i <MALI_C720_MAX_NUM_CAP_DEVS ; i++) +mali_c720_unregister_cap_dev (mali_c720, i); +} + +void mali_c720_cleanup_capture_devs (struct mali_c720 *mali_c720) +{ +unsigned int i; + +for (i =0 ; i <MALI_C720_MAX_NUM_CAP_DEVS ; i++) +mali_c720_cleanup_cap_dev (mali_c720, i); +}
drivers/media/platform/arm/mali-c720/mali-c720-common.h +56 -0
101 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-ctx-mgr.c +6 -0
@@ -1266,7 +1266,13 @@ void mali_c720_ctx_mgr_prepare_frame(struct mali_c720_context *ctx)void mali_c720_ctx_mgr_buffer_done (struct mali_c720_context *ctx,bool success) { +struct mali_c720 *mali_c720 = ctx->mali_c720; +unsigned int i; +lockdep_assert_held (&ctx->state_lock); + +for (i =0 ; i <MALI_C720_MAX_NUM_CAP_DEVS ; i++) +mali_c720_cap_dev_buffer_done (&mali_c720->cap_devs[i], success); }void mali_c720_ctx_mgr_handle_sw_ready (struct mali_c720_context *ctx)
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 12/24] media: mali-c720: Add video capture nodes
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] media: mali-c720: unrecovered output buffer state on context stop - [Medium] media: mali-c720…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Medium] media: mali-c720: unrecovered output buffer state on context stop
- [Medium] media: mali-c720: race between mali_c720_s_fmt_vid_cap_mplane() and link validation
- [Low] media: mali-c720: uninitialized vdev.name logged in mali_c720_register_cap_dev()
--
commit 5de5962e721900ab8951fa2e8cce61caedd37777
Author: Anthony McGivern <[email protected]>
media: mali-c720: Add video capture nodes
This commit adds RGB and YUV V4L2 video capture nodes for the full-resolution output 0 (FR0) subdevice and wires up their buffer completion handling.
Quoted 6 lines
drivers/media/platform/arm/mali-c720/mali-c720-capture.c new file +0
-0@@ -0,0 +1,747 @@
[ ... ]
Quoted 21 lines
drivers/media/platform/arm/mali-c720/mali-c720-capture.c new file +21
-0+void mali_c720_cap_dev_buffer_done (struct mali_c720_cap_dev *cap_dev, +bool success) +{ +struct mali_c720 *mali_c720 = cap_dev->mali_c720; +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +struct mali_c720_cap_buffer *buf; + +if (!video_is_registered (&cap_dev->vdev)) +return ; + +if (!vb2_is_streaming (&cap_dev->queue)) +return ; + +guard (spinlock)(&cap_dev->buffers.lock); + + buf =list_first_entry_or_null (&cap_dev->buffers.processing, + struct mali_c720_cap_buffer, queue); +if (!buf) +return ; + +if (mali_c720_ctx_mgr_check_output_buffer_status (ctx, &cap_dev->buffers.pool))
drivers/media/platform/arm/mali-c720/mali-c720-capture.c line 243
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-capture.c new file +10
-0+ success = false; + +if (success) { + buf->vb.vb2_buf.timestamp = ctx->timestamp; + buf->vb.sequence = ctx->frame_sequence; + } + +vb2_buffer_done (&buf->vb.vb2_buf, success ?VB2_BUF_STATE_DONE :VB2_BUF_STATE_ERROR ); +list_del (&buf->queue); +}
[Severity: Medium]
When one capture device stops streaming while another capture device is still streaming with an in-flight buffer in buffers.processing, does retiring that buffer leave the still-streaming device's hardware output buffer descriptor in MALI_C720_BUFFER_STATE_HW_EMPTY (or MALI_C720_BUFFER_STATE_HW_ERROR) instead of resetting it to MALI_C720_BUFFER_STATE_SW_EMPTY?
mali_c720_vb2_stop_streaming() disables isp_sd, which invokes mali_c720_ctx_mgr_stop_context():
drivers/media/platform/arm/mali-c720/mali-c720-ctx-mgr.c:mali_c720_ctx_mgr_stop_context() {
...
scoped_guard(spinlock_irq, &ctx->state_lock) {
ctx->state = MALI_C720_SLOT_STATE_STOPPED;
...
/* Retire in-flight buffers on all queues, including those still streaming. */
mali_c720_ctx_mgr_buffer_done(ctx, false);Because ctx->state is already MALI_C720_SLOT_STATE_STOPPED when mali_c720_cap_dev_buffer_done() runs, mali_c720_ctx_mgr_check_output_buffer_status() returns 0 immediately:
drivers/media/platform/arm/mali-c720/mali-c720-ctx-mgr.c:mali_c720_ctx_mgr_check_output_buffer_status() {
...
if (ctx->state == MALI_C720_SLOT_STATE_STOPPED)
return 0;The stopping capture device then releases its buffer pool, which cancels and uninitializes its descriptor, but the sibling capture device that remains streaming keeps its pool with the hardware descriptor still under hardware control and pointing at the retired vb2 buffer's DMA address.
[ ... ]
Quoted 4 lines
drivers/media/platform/arm/mali-c720/mali-c720-capture.c new file +4
-0+static int mali_c720_s_fmt_vid_cap_mplane (struct file *file,void *fh, +struct v4l2_format *f) +{ +struct mali_c720_cap_dev *cap_dev =video_drvdata (file);
drivers/media/platform/arm/mali-c720/mali-c720-capture.c line 505
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-capture.c new file +10
-0+ +if (media_entity_is_streaming (&cap_dev->vdev.entity)) +return -EBUSY ; + +if (vb2_is_busy (&cap_dev->queue)) +return -EBUSY ; + +mali_c720_set_format (cap_dev, &f->fmt.pix_mp); +return 0 ; +}
[Severity: Medium]
Can mali_c720_s_fmt_vid_cap_mplane() race with mali_c720_link_validate() on a sibling capture device sharing the media pipeline?
Each capture device has its own cap_dev->lock, while both FR0 capture nodes share mali_c720->pipe when both links from fr_pipe are enabled:
CPU0 (cap_devs[0] STREAMON) CPU1 (cap_devs[1] S_FMT)mali_c720_vb2_start_streaming()
lock(&mali_c720->device_lock)
video_device_pipeline_start()
...
mali_c720_link_validate()
/* on cap_devs[1] */
mali_c720_s_fmt_vid_cap_mplane()
/* lock(&cap_devs[1].lock) held */
media_entity_is_streaming() -> false
reads cap_devs[1].format
mali_c720_set_format()
writes cap_devs[1].format <-- data race
sets cap_devs[1].pad.pipeBecause pad->pipe is only assigned after link_validate() succeeds and mali_c720_s_fmt_vid_cap_mplane() does not take mali_c720->device_lock, CPU1 passes media_entity_is_streaming() and can overwrite cap_dev->format with an unvalidated resolution or pixel format while or right after mali_c720_link_validate() checks it.
[ ... ]
Quoted 3 lines
drivers/media/platform/arm/mali-c720/mali-c720-capture.c new file +3
-0+static int mali_c720_register_cap_dev (struct mali_c720 *mali_c720, +enum mali_c720_cap_devs cap_dev_id) +{
[ ... ]
drivers/media/platform/arm/mali-c720/mali-c720-capture.c line 659
Quoted 9 lines
drivers/media/platform/arm/mali-c720/mali-c720-capture.c new file +9
-0+ ret =vb2_queue_init (vb2q); +if (ret) { +dev_err (mali_c720->dev,"%s vb2 queue init failed\n" , + cap_dev->vdev.name); + goto err_cleanup_media_entity; + } + +strscpy (cap_dev->vdev.name, capture_device_names[cap_dev_id], +sizeof (cap_dev->vdev.name));
[Severity: Low]
If vb2_queue_init() fails, dev_err() logs cap_dev->vdev.name before strscpy() initializes it, printing an empty name.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=12
PATCH 13/24 media: mali-c720: Add Mali-C720 ISP driver
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Integrate hardware identification, capability discovery, context management and the V4L2 subdevices into a functional Mali-C720 ISP driver. Add device probing, power management, media graph registration and frame scheduling.
Add Kconfig and Makefile integration to build the driver. The preceding commits introduce its components but do not build them.
Initial support covers the human vision (HV) pipeline with one full-resolution output pipeline providing RGB and YUV capture nodes. Support for computer vision (CV) and additional output pipelines will be added in the future.
--- drivers/media/platform/arm/Kconfig | 1 + drivers/media/platform/arm/Makefile | 1 + drivers/media/platform/arm/mali-c720/Kconfig | 17 + drivers/media/platform/arm/mali-c720/Makefile | 20 + .../platform/arm/mali-c720/mali-c720-capture.c | 30 +- .../platform/arm/mali-c720/mali-c720-common.h | 26 + .../media/platform/arm/mali-c720/mali-c720-core.c | 873 +++++++++++++++++++++ .../platform/arm/mali-c720/mali-c720-interrupts.c | 2 + 8 files changed, 969 insertions(+), 1 deletion(-)
drivers/media/platform/arm/Kconfig +1 -0
@@ -3,3 +3,4 @@ comment "ARM media platform drivers" source "drivers/media/platform/arm/mali-c55/Kconfig" +source "drivers/media/platform/arm/mali-c720/Kconfig"
drivers/media/platform/arm/Makefile +1 -0
@@ -1,2 +1,3 @@ # SPDX-License-Identifier: GPL-2.0-only obj-y += mali-c55/ +obj-y += mali-c720/
drivers/media/platform/arm/mali-c720/Kconfig new file +17 -0
@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only +config VIDEO_MALI_C720 + tristate "ARM Mali-C720 Image Signal Processor driver" + depends on V4L_PLATFORM_DRIVERS + depends on VIDEO_DEV && OF + select CRC_CCITT + select CRC_ITU_T + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + select VIDEOBUF2_DMA_CONTIG + select VIDEOBUF2_VMALLOC + help + Enable this to support Arm's Mali-C720 Image Signal Processor. + + To compile this driver as a module, choose M here: the module + will be called mali-c720.
drivers/media/platform/arm/mali-c720/Makefile new file +20 -0
@@ -0,0 +1,20 @@ +# SPDX-License-Identifier: GPL-2.0-only + +mali-c720-y := mali-c720-capture.o \ + mali-c720-core.o \ + mali-c720-ctx-mgr.o \ + mali-c720-discovery.o \ + mali-c720-formats.o \ + mali-c720-fr-pipe.o \ + mali-c720-id.o \ + mali-c720-input.o \ + mali-c720-interrupts.o \ + mali-c720-isp.o \ + mali-c720-register-access.o \ + mali-c720-registers.o \ + mali-c720-registers-top.o \ + mali-c720-registers-ctx-mgr.o \ + mali-c720-registers-modules.o \ + mali-c720-vision-pipe.o \ + +obj-$(CONFIG_VIDEO_MALI_C720) += mali-c720.o
drivers/media/platform/arm/mali-c720/mali-c720-capture.c +29 -1
@@ -101,6 +101,8 @@ static int mali_c720_vb2_queue_setup(struct vb2_queue *q, unsigned int *num_buffstatic void mali_c720_buf_queue (struct vb2_buffer *vb) {struct mali_c720_cap_dev *cap_dev =vb2_get_drv_priv (vb->vb2_queue); +struct mali_c720 *mali_c720 = cap_dev->mali_c720; +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720);struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb);struct mali_c720_cap_buffer *buf =container_of (vbuf, struct mali_c720_cap_buffer, vb);
@@ -116,6 +118,9 @@ static void mali_c720_buf_queue(struct vb2_buffer *vb) scoped_guard(spinlock, &cap_dev->buffers.lock)list_add_tail (&buf->queue, &cap_dev->buffers.input); + +if (!mali_c720_cap_dev_uses_requests (cap_dev)) +mali_c720_try_schedule_frame (ctx); }static int mali_c720_buf_init (struct vb2_buffer *vb)
@@ -289,6 +294,7 @@ static int mali_c720_vb2_start_streaming(struct vb2_queue *q, unsigned int countstruct mali_c720_cap_dev *cap_dev = q->drv_priv;struct mali_c720 *mali_c720 = cap_dev->mali_c720;struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +struct v4l2_subdev *isp_sd = &mali_c720->isp.mdev.sd;int ret;guard (mutex)(&mali_c720->device_lock);
@@ -328,8 +334,30 @@ static int mali_c720_vb2_start_streaming(struct vb2_queue *q, unsigned int count goto err_release_buffer_pool; } +/* +* All ISP source pads use the same start process, so the HV pad can +* represent the ISP when starting the pipeline. +*/ + ret =mali_c720_pipeline_ready (mali_c720); +if (ret && ret != -EAGAIN ) + goto err_disable_src; + +if (!ret) { + ret =v4l2_subdev_enable_streams (isp_sd, +MALI_C720_ISP_PAD_SOURCE_HV , +BIT (0 )); +if (ret) { +dev_err (mali_c720->dev,"%s failed to start ISP subdevice\n" , + cap_dev->vdev.name); + goto err_disable_src; + } + } +return 0 ; +err_disable_src: +v4l2_subdev_disable_streams (cap_dev->src_sd, cap_dev->src_pad, +BIT (0 )); err_release_buffer_pool:mali_c720_cap_dev_release_buffer_pool (cap_dev); err_free_context:
@@ -574,7 +602,7 @@ static const struct v4l2_ioctl_ops mali_c720_v4l2_ioctl_ops = { .vidioc_expbuf = vb2_ioctl_expbuf, .vidioc_dqbuf = vb2_ioctl_dqbuf, .vidioc_prepare_buf = vb2_ioctl_prepare_buf, - .vidioc_streamon = vb2_ioctl_streamon, + .vidioc_streamon = mali_c720_streamon, .vidioc_streamoff = vb2_ioctl_streamoff, .vidioc_try_fmt_vid_cap_mplane = mali_c720_try_fmt_vid_cap_mplane, .vidioc_s_fmt_vid_cap_mplane = mali_c720_s_fmt_vid_cap_mplane,
drivers/media/platform/arm/mali-c720/mali-c720-common.h +26 -0
@@ -8,15 +8,18 @@#ifndef MALI_C720_COMMON_H #define MALI_C720_COMMON_H +#include <linux/clk.h> #include <linux/io.h> #include <linux/kfifo.h> #include <linux/list.h> #include <linux/mutex.h> #include <linux/refcount.h> +#include <linux/reset.h> #include <linux/spinlock.h> #include <linux/videodev2.h> #include <media/media-device.h> +#include <media/v4l2-async.h> #include <media/v4l2-ctrls.h> #include <media/v4l2-dev.h> #include <media/v4l2-device.h>
@@ -186,6 +189,18 @@ struct mali_c720_cap_dev { } buffers; }; +struct mali_c720_request { +struct media_request req; +unsigned int queue_sequence; +bool submitted; +}; + +static inline struct mali_c720_request * +to_mali_c720_request (struct media_request *req) +{ + return container_of(req, struct mali_c720_request, req); +} +struct mali_c720_context_regs {dma_addr_t dma_handle;u8 *base;
@@ -233,9 +248,12 @@ struct mali_c720 {u8 __iomem *base;resource_size_t mmio_size;u32 top_base; +struct clk *clk; +struct reset_control *reset;struct media_device media_dev;struct v4l2_device v4l2_dev; +struct v4l2_async_notifier notifier;struct media_pipeline pipe;struct mali_c720_input input;
@@ -244,6 +262,8 @@ struct mali_c720 {struct mali_c720_fr_pipe fr_pipe;struct mali_c720_cap_dev cap_devs[MALI_C720_MAX_NUM_CAP_DEVS ]; +unsigned int num_async_endpoints; +struct mali_c720_registers registers;u8 *default_regs;
@@ -296,4 +316,10 @@ void mali_c720_cap_dev_buffer_done(struct mali_c720_cap_dev *cap_dev,void mali_c720_isp_queue_event_sof (struct mali_c720 *mali_c720,u32 sequence); +int mali_c720_pipeline_ready (struct mali_c720 *mali_c720); + +int mali_c720_streamon (struct file *file,void *priv,enum v4l2_buf_type type); + +void mali_c720_try_schedule_frame (struct mali_c720_context *ctx); +#endif /* MALI_C720_COMMON_H */
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +873 -0
873 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-interrupts.c +2 -0
@@ -202,6 +202,8 @@ static void mali_c720_handle_frame_end(struct mali_c720 *mali_c720, ctx->pipeline_busy = false; } + +mali_c720_try_schedule_frame (ctx); }irqreturn_t mali_c720_isr (int irq,void *dev_id)
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 13/24] media: mali-c720: Add Mali-C720 ISP driver
Thank you for your contribution! Sashiko AI review found 5 potential issues to consider: - [High] media: mali-c720: reuse_buffer descriptor lost across runtime PM reset - [Medium] media: mali-c720…
Thank you for your contribution! Sashiko AI review found 5 potential issues to consider:
- [High] media: mali-c720: reuse_buffer descriptor lost across runtime PM reset
- [Medium] media: mali-c720: premature upstream disable in fr_pipe disable_streams()
- [Medium] media: mali-c720: unbalanced power off on probe error in mali_c720_probe()
- [Medium] media: mali-c720: race on capture format in mali_c720_s_fmt_vid_cap_mplane()
- [Low] media: mali-c720: legacy PM ops macros and missing pm_ptr() in mali-c720-core
--
commit 673cd59feb7192d4abbadb5d84db3f82e14b2c89
Author: Anthony McGivern <[email protected]>
media: mali-c720: Add Mali-C720 ISP driver
This commit integrates the hardware identification, capability discovery, context management, V4L2 subdevices, power management, media graph registration, frame scheduling, and build configuration for the Mali-C720 ISP driver.
Quoted 32 lines
drivers/media/platform/arm/mali-c720/mali-c720-capture.c +17
-0@@ -289,6 +294,7 @@ static int mali_c720_vb2_start_streaming(struct vb2_queue *q, unsigned int countstruct mali_c720_cap_dev *cap_dev = q->drv_priv;struct mali_c720 *mali_c720 = cap_dev->mali_c720;struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +struct v4l2_subdev *isp_sd = &mali_c720->isp.mdev.sd;int ret;guard (mutex)(&mali_c720->device_lock);@@ -328,8 +334,30 @@ static int mali_c720_vb2_start_streaming(struct vb2_queue *q, unsigned int count goto err_release_buffer_pool; } +/* +* All ISP source pads use the same start process, so the HV pad can +* represent the ISP when starting the pipeline. +*/ + ret =mali_c720_pipeline_ready (mali_c720); +if (ret && ret != -EAGAIN ) + goto err_disable_src; + +if (!ret) { + ret =v4l2_subdev_enable_streams (isp_sd, +MALI_C720_ISP_PAD_SOURCE_HV , +BIT (0 )); +if (ret) { +dev_err (mali_c720->dev,"%s failed to start ISP subdevice\n" , + cap_dev->vdev.name); + goto err_disable_src;
drivers/media/platform/arm/mali-c720/mali-c720-capture.c static int mali_c720_vb2_start_streaming(struct vb2_queue *q, unsigned int count · line 362
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-capture.c +6
-0+ } + } +return 0 ; +err_disable_src: +v4l2_subdev_disable_streams (cap_dev->src_sd, cap_dev->src_pad, +BIT (0 )); err_release_buffer_pool:mali_c720_cap_dev_release_buffer_pool (cap_dev);
[Severity: Medium]
Can a concurrent VIDIOC_S_FMT on one capture device race with VIDIOC_STREAMON on the other capture device in the pipeline and bypass link validation?
Each capture node has its own cap_dev->lock (used for vdev->lock and vb2q->lock). When both FR0_RGB and FR0_YUV links are enabled:
CPU0 (cap_devs[0] VIDIOC_STREAMON) CPU1 (cap_devs[1] VIDIOC_S_FMT) lock(&cap_devs[0].lock) lock(&cap_devs[1].lock) mali_c720_vb2_start_streaming() mali_c720_s_fmt_vid_cap_mplane()
lock(&mali_c720->device_lock) media_entity_is_streaming() -> false
video_device_pipeline_start()
__media_pipeline_start()
mali_c720_link_validate()
reads cap_devs[1].format mali_c720_set_format()
cap_devs[1].pad.pipe = pipe writes cap_devs[1].format <-- race
When VIDIOC_STREAMON is subsequently called on cap_devs[1], __media_pipeline_start() sees pipe->start_count > 0 and skips link validation, so the buffer pool is configured with an unvalidated cap_devs[1].format that may not match the upstream FR pipe pad format. Taking mali_c720->device_lock in mali_c720_s_fmt_vid_cap_mplane() would serialize format updates against video_device_pipeline_start().
[Severity: Medium]
When both FR0_RGB and FR0_YUV links on the FR pipe are enabled, does disabling one source pad stream here (or in mali_c720_vb2_stop_streaming()) prematurely disable the upstream vision_pipe subdevice while the other FR pipe source pad is still active?
When the second capture device starts streaming, mali_c720_fr_pipe_enable_streams() calls v4l2_subdev_enable_streams() on pipe->remote_src (which returns -EALREADY without incrementing the upstream stream count) and sets the second pad bit in pipe->enabled_crops. However, mali_c720_fr_pipe_disable_streams() disables pipe->remote_src unconditionally:
drivers/media/platform/arm/mali-c720/mali-c720-fr-pipe.c:mali_c720_fr_pipe_disable_streams() {
if (pipe->remote_src) {
src_sd = media_entity_to_v4l2_subdev(pipe->remote_src->entity);
v4l2_subdev_disable_streams(src_sd, pipe->remote_src->index,
BIT(0));
}
pipe->remote_src = NULL;
guard(spinlock)(&pipe->resizer_lock);
pipe->enabled_crops &= ~BIT(pad);
}If starting the second capture device fails and jumps to err_disable_src, or if one of the two capture devices stops streaming first, the upstream vision_pipe subdevice is disabled and pipe->remote_src is cleared while the remaining FR pipe pad is still enabled.
Quoted 5 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +0
-0
[ ... ]
Quoted 33 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +33
-0+static int mali_c720_power_on (struct mali_c720 *mali_c720) +{ +int ret; + + ret =clk_prepare_enable (mali_c720->clk); +if (ret) { +dev_err (mali_c720->dev,"failed to enable clocks\n" ); +return ret; + } + + ret =reset_control_deassert (mali_c720->reset); +if (ret) { +dev_err (mali_c720->dev,"failed to deassert resets\n" ); + goto err_disable_clk; + } + +return 0 ; + +err_disable_clk: +clk_disable_unprepare (mali_c720->clk); +return ret; +} + +static void mali_c720_power_off (struct mali_c720 *mali_c720) +{ +reset_control_assert (mali_c720->reset); +clk_disable_unprepare (mali_c720->clk); +} + +static int __maybe_unused mali_c720_runtime_resume (struct device *dev) +{ +struct mali_c720 *mali_c720 =dev_get_drvdata (dev); +
drivers/media/platform/arm/mali-c720/mali-c720-core.c line 640
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +10
-0+return mali_c720_power_on (mali_c720); +} + +static int __maybe_unused mali_c720_runtime_suspend (struct device *dev) +{ +struct mali_c720 *mali_c720 =dev_get_drvdata (dev); + +mali_c720_power_off (mali_c720); +return 0 ; +}
[Severity: High]
Does asserting mali_c720->reset in mali_c720_power_off() wipe the ctx_mgr->reuse_buffer descriptor registers that were only programmed during probe?
In mali_c720_probe(), mali_c720_init_ctx_mgr() calls mali_c720_ctx_mgr_init_reuse_buffer() once to program the hardware raw buffer descriptor at index ctx_mgr->reuse_buffer (including setting buffer->nonsecure to 1) before calling pm_runtime_idle(&pdev->dev):
drivers/media/platform/arm/mali-c720/mali-c720-ctx-mgr.c:mali_c720_ctx_mgr_init_reuse_buffer() {
...
buffer_addr = mali_c720_group_base(&buffer->raw_group, ctx_mgr->reuse_buffer);
mali_c720_ctx_mgr_buffer_request(mali_c720, buffer_addr,
MALI_C720_BUFFER_STATE_SW_EMPTY);
mali_c720_group_write(mali_c720, buffer_addr,
&buffer->nonsecure, 1);
...
}When the ISP enters runtime suspend (or system suspend), mali_c720_power_off() asserts mali_c720->reset and disables mali_c720->clk, resetting the MMIO registers. On runtime resume, mali_c720_power_on() does not re-initialize ctx_mgr->reuse_buffer, so when streaming later stops, mali_c720_ctx_mgr_stop_input_port() enables the input port with an unconfigured reuse_buffer descriptor (nonsecure = 0), breaking the r0p0/r0p1 input cleanup workaround and timing out waiting for the input port to stop.
Quoted 20 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +20
-0+ +static int __maybe_unused mali_c720_suspend (struct device *dev) +{ +struct mali_c720 *mali_c720 =dev_get_drvdata (dev); + +guard (mutex)(&mali_c720->device_lock); + +/* Active pipelines cannot survive the hardware reset during suspend. */ +if (media_entity_is_streaming (&mali_c720->isp.mdev.sd.entity)) +return -EBUSY ; + +return pm_runtime_force_suspend (dev); +} + +static const struct dev_pm_ops mali_c720_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(mali_c720_suspend, + pm_runtime_force_resume) +SET_RUNTIME_PM_OPS (mali_c720_runtime_suspend, mali_c720_runtime_resume, +NULL ) +};
[ ... ]
Quoted 34 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +34
-0+pm_runtime_set_autosuspend_delay (&pdev->dev,2000 ); +pm_runtime_use_autosuspend (&pdev->dev); +pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (&pdev->dev); + + ret =platform_get_irq_byname (pdev,"isp" ); +if (ret <0 ) { +dev_err (dev,"Failed to get interrupt\n" ); + goto err_pm_runtime_disable; + } + irq = (unsigned int )ret; + +spin_lock_init (&mali_c720->irq_lock); +INIT_KFIFO (mali_c720->irq_fifo); + ret =devm_request_threaded_irq (&pdev->dev, irq, + mali_c720_isr_top, mali_c720_isr, +0 , +dev_driver_string (&pdev->dev), + &pdev->dev); +if (ret) { +dev_err (dev,"Failed to request threaded IRQ\n" ); + goto err_pm_runtime_disable; + } + mali_c720->irq = irq; + + mali_c720->media_dev.dev = dev; + mali_c720->media_dev.ops = &mali_c720_media_device_ops; + ret =mali_c720_media_frameworks_init (mali_c720); +if (ret) + goto err_free_irq; + +pm_runtime_idle (&pdev->dev); + +dev_info (&pdev->dev,"Media frameworks and entities registered successfully\n" );
drivers/media/platform/arm/mali-c720/mali-c720-core.c line 817
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +10
-0+ +return 0 ; + +err_free_irq: +devm_free_irq (dev, mali_c720->irq, dev); +err_pm_runtime_disable: +pm_runtime_disable (&pdev->dev); +pm_runtime_set_suspended (&pdev->dev); +err_power_off: +mali_c720_power_off (mali_c720);
[Severity: Medium]
Can the err_pm_runtime_disable error path call mali_c720_power_off() a second time if the device has already runtime-suspended after pm_runtime_enable()?
Runtime PM is enabled with usage_count == 0 before IRQ request and mali_c720_media_frameworks_init(). If the device runtime-suspends during that window and a later step fails, err_pm_runtime_disable falls through to err_power_off without checking !pm_runtime_status_suspended(&pdev->dev) the way mali_c720_remove() does, causing an unbalanced clk_disable_unprepare(). Also, neither err_pm_runtime_disable nor mali_c720_remove() calls pm_runtime_dont_use_autosuspend(&pdev->dev) to pair with pm_runtime_use_autosuspend(&pdev->dev).
[ ... ]
drivers/media/platform/arm/mali-c720/mali-c720-core.c line 866
Quoted 9 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +9
-0+static struct platform_driver mali_c720_driver = { + .driver = { + .name ="mali-c720" , + .of_match_table = mali_c720_of_match, + .pm = &mali_c720_pm_ops, + }, + .probe = mali_c720_probe, + .remove = mali_c720_remove, +};
[Severity: Low]
This isn't a bug, but using SYSTEM_SLEEP_PM_OPS() and RUNTIME_PM_OPS() in mali_c720_pm_ops along with .pm = pm_ptr(&mali_c720_pm_ops) here would let the compiler drop the PM callbacks and drop the __maybe_unused annotations when CONFIG_PM or CONFIG_PM_SLEEP is disabled.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=13
Re: [PATCH 13/24] media: mali-c720: Add Mali-C720 ISP driver
In reply to Anthony McGivernQuoted 4 lines · Anthony McGivern
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +4
-0+ +static int mali_c720_probe (struct platform_device *pdev) +{ +const struct mali_c720_discovery_target top = {
drivers/media/platform/arm/mali-c720/mali-c720-core.c line 674
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +10
-0+ .module_id = MALI_C720_DISC_MODULE_ID_PIPELINE_GLOBAL_CONTROL, + .pipeline_id = MALI_C720_DISC_PIPE_GLOBAL, + }; +struct device *dev = &pdev->dev; +struct mali_c720 *mali_c720; +struct resource *res; +unsigned int irq; +int ret; + + mali_c720 =kvzalloc_obj (*mali_c720,GFP_KERNEL );
Why absolutely nothing here is resource managed?
Quoted 97 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +97
-0+if (!mali_c720) +return -ENOMEM ; + + mali_c720->dev =get_device (dev); +platform_set_drvdata (pdev, mali_c720); + +mutex_init (&mali_c720->device_lock); + + mali_c720->base =devm_platform_get_and_ioremap_resource (pdev,0 , + &res); + ret =PTR_ERR_OR_ZERO (mali_c720->base); +if (ret) { +dev_err_probe (dev, ret,"failed to map IO memory\n" ); + goto err_free; + } + + mali_c720->mmio_size =resource_size (res); + +if (resource_size (res) <MALI_C720_ID_SIZE ) { + ret =dev_err_probe (dev, -EINVAL , +"IO memory resource %pR is too small (minimum %#x bytes)\n" , + res,MALI_C720_ID_SIZE ); + goto err_free; + } + + mali_c720->clk =devm_clk_get (dev,"vclk" ); + ret =PTR_ERR_OR_ZERO (mali_c720->clk); +if (ret) { +dev_err_probe (dev, ret,"failed to acquire clock\n" ); + goto err_free; + } + + mali_c720->reset =devm_reset_control_get_optional_shared (dev,"reset" ); + ret =PTR_ERR_OR_ZERO (mali_c720->reset); +if (ret) { +dev_err_probe (dev, ret,"failed to acquire reset\n" ); + goto err_free; + } + + ret =of_reserved_mem_device_init (dev); +if (ret && ret != -ENODEV ) { +dev_err_probe (dev, ret,"failed to initialize reserved memory\n" ); + goto err_free; + } + + ret =vb2_dma_contig_set_max_seg_size (dev,UINT_MAX ); +if (ret) + goto err_release_mem; + + ret =dma_set_mask_and_coherent (dev,DMA_BIT_MASK (48 )); +if (ret) { +dev_err_probe (dev, ret,"failed to set DMA mask\n" ); + goto err_release_mem; + } + + ret =mali_c720_power_on (mali_c720); +if (ret) { +dev_err (dev,"failed to power on: %d\n" , ret); + goto err_release_mem; + } + + mali_c720->registers.id =mali_c720_get_id_regs (); + ret =mali_c720_identify_hw (mali_c720); +if (ret) + goto err_power_off; + + ret =mali_c720_get_registers (mali_c720->hw_version->id, &mali_c720->registers); +if (ret) { +dev_err_probe (dev, ret,"unsupported register layout\n" ); + goto err_power_off; + } + +if (resource_size (res) < mali_c720->registers.context_size) { + ret =dev_err_probe (dev, -EINVAL , +"IO memory resource %pR is too small (minimum %#x bytes)\n" , + res, mali_c720->registers.context_size); + goto err_power_off; + } + + ret =mali_c720_discovery_init (mali_c720,resource_size (res)); +if (ret) { +dev_err (dev,"failed to parse capability discovery data\n" ); + goto err_power_off; + } + + ret =mali_c720_discovery_get_module_base (mali_c720, &top, &mali_c720->top_base); +if (ret) { +dev_err (dev,"failed to get top base address from discovery data\n" ); + goto err_power_off; + } + + ret =mali_c720_init_contexts (mali_c720); +if (ret) + goto err_power_off; + + ret =mali_c720_init_ctx_mgr (mali_c720); +if (ret)
drivers/media/platform/arm/mali-c720/mali-c720-core.c line 781
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +10
-0+ goto err_power_off; + +pm_runtime_set_autosuspend_delay (&pdev->dev,2000 ); +pm_runtime_use_autosuspend (&pdev->dev); +pm_runtime_set_active (&pdev->dev); +pm_runtime_enable (&pdev->dev); + + ret =platform_get_irq_byname (pdev,"isp" ); +if (ret <0 ) { +dev_err (dev,"Failed to get interrupt\n" );
Please use modern Linux drivers as an example for your code. All this should be dev_err_probe or dropped, because core takes care of.
Quoted 16 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +16
-0+ goto err_pm_runtime_disable; + } + irq = (unsigned int )ret; + +spin_lock_init (&mali_c720->irq_lock); +INIT_KFIFO (mali_c720->irq_fifo); + ret =devm_request_threaded_irq (&pdev->dev, irq, + mali_c720_isr_top, mali_c720_isr, +0 , +dev_driver_string (&pdev->dev), + &pdev->dev); +if (ret) { +dev_err (dev,"Failed to request threaded IRQ\n" ); + goto err_pm_runtime_disable; + } + mali_c720->irq = irq;
drivers/media/platform/arm/mali-c720/mali-c720-core.c line 807
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +10
-0+ + mali_c720->media_dev.dev = dev; + mali_c720->media_dev.ops = &mali_c720_media_device_ops; + ret =mali_c720_media_frameworks_init (mali_c720); +if (ret) + goto err_free_irq; + +pm_runtime_idle (&pdev->dev); + +dev_info (&pdev->dev,"Media frameworks and entities registered successfully\n" );
Drop, drivers should be silent on success.
Quoted 12 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +12
-0+ +return 0 ; + +err_free_irq: +devm_free_irq (dev, mali_c720->irq, dev); +err_pm_runtime_disable: +pm_runtime_disable (&pdev->dev); +pm_runtime_set_suspended (&pdev->dev); +err_power_off: +mali_c720_power_off (mali_c720); +err_release_mem: +of_reserved_mem_device_release (dev);
drivers/media/platform/arm/mali-c720/mali-c720-core.c line 829
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-core.c new file +10
-0+err_free: +platform_set_drvdata (pdev,NULL ); +if (mali_c720->v4l2_dev.release) +v4l2_device_put (&mali_c720->v4l2_dev); +else +mali_c720_free (mali_c720); + +return ret; +} +
Best regards,
Krzysztof
Signature · 1 line
Krzysztof Kozlowski <[email protected]>
PATCH 14/24 media: mali-c720: Add test pattern generator subdevices
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Expose the two internal test pattern generators as subdevices linked to the input frontend when their presence is reported by hardware discovery.
Allow pattern selection through the V4L2_CID_TEST_PATTERN control.
--- drivers/media/platform/arm/mali-c720/Makefile | 1 + .../platform/arm/mali-c720/mali-c720-common.h | 26 + .../media/platform/arm/mali-c720/mali-c720-core.c | 48 ++ .../media/platform/arm/mali-c720/mali-c720-tpg.c | 581 +++++++++++++++++++++ 4 files changed, 656 insertions(+)
drivers/media/platform/arm/mali-c720/Makefile +1 -0
@@ -15,6 +15,7 @@ mali-c720-y := mali-c720-capture.o \ mali-c720-registers-top.o \ mali-c720-registers-ctx-mgr.o \ mali-c720-registers-modules.o \ + mali-c720-tpg.o \ mali-c720-vision-pipe.o \ obj-$(CONFIG_VIDEO_MALI_C720) += mali-c720.o
drivers/media/platform/arm/mali-c720/mali-c720-common.h +26 -0
@@ -64,6 +64,27 @@ struct mali_c720_subdev {#define mali_c720_sd_to_sd (_mdev, type) \ container_of(_mdev, type, mdev) +enum mali_c720_tpg_ids { +MALI_C720_TPG0 , +MALI_C720_TPG1 , +MALI_C720_NUM_TPGS , +}; + +struct mali_c720_tpg { +struct mali_c720_subdev mdev; +unsigned int id; +unsigned long clk_rate; + +struct media_pad pad; +struct media_pad *remote; + +struct mali_c720_tpg_ctrls { +struct v4l2_ctrl_handler handler; +struct v4l2_ctrl *pattern; +struct v4l2_ctrl *vblank; + } ctrls; +}; +enum mali_c720_input_pads {MALI_C720_INPUT_PAD_SOURCE_SLOT_INPUT ,MALI_C720_INPUT_PAD_SINK_INPUT0 ,
@@ -256,6 +277,7 @@ struct mali_c720 {struct v4l2_async_notifier notifier;struct media_pipeline pipe; +struct mali_c720_tpg tpg[MALI_C720_NUM_TPGS ];struct mali_c720_input input;struct mali_c720_isp isp;struct mali_c720_vision_pipe vision_pipe;
@@ -284,6 +306,10 @@ struct mali_c720 {/* ISP subdevice registration functions */ +int mali_c720_register_tpgs (struct mali_c720 *mali_c720); +void mali_c720_unregister_tpgs (struct mali_c720 *mali_c720); +void mali_c720_cleanup_tpgs (struct mali_c720 *mali_c720); +int mali_c720_register_input (struct mali_c720 *mali_c720);void mali_c720_unregister_input (struct mali_c720 *mali_c720);void mali_c720_cleanup_input (struct mali_c720 *mali_c720);
drivers/media/platform/arm/mali-c720/mali-c720-core.c +48 -0
88 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-tpg.c new file +581 -0
581 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 15/24 media: Documentation: Add Mali-C720 ISP documentation
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Document the Mali-C720 ISP hardware, configuration DMA engine and media graph topology.
Provide examples for selecting an input source, using the internal test pattern generators and capturing RGB and YUV images. Describe the input and output resolution limits and how to configure scaling and cropping.
Explain the different frame scheduling modes, including free-running capture and the use of Media Requests for atomic buffer queuing.
--- .../admin-guide/media/mali-c720-graph.dot | 22 ++ Documentation/admin-guide/media/mali-c720.rst | 370 +++++++++++++++++++++ Documentation/admin-guide/media/v4l-drivers.rst | 1 + 3 files changed, 393 insertions(+)
Documentation/admin-guide/media/mali-c720-graph.dot new file +22 -0
@@ -0,0 +1,22 @@ +digraph board { + rankdir=TB + n00000001 [label="{{} | mali-c720 tpg 0\n/dev/v4l-subdev0 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000001:port0 -> n00000009:port1 [style=dashed] + n00000003 [label="{{} | mali-c720 tpg 1\n/dev/v4l-subdev1 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000003:port0 -> n00000009:port1 [style=dashed] + n00000009 [label="{{<port1> 1} | mali-c720 input\n/dev/v4l-subdev2 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000009:port0 -> n0000000c:port0 + n0000000c [label="{{<port0> 0} | mali-c720 isp\n/dev/v4l-subdev3 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n0000000c:port1 -> n00000014:port0 + n00000014 [label="{{<port0> 0} | mali-c720 hv pipe\n/dev/v4l-subdev4 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000014:port1 -> n0000001c:port0 + n0000001c [label="{{<port0> 0} | mali-c720 fr 0 pipe\n/dev/v4l-subdev5 | {<port1> 1 | <port2> 2}}", shape=Mrecord, style=filled, fillcolor=green] + n0000001c:port1 -> n00000038 + n0000001c:port2 -> n0000003c [style=dashed] + n00000038 [label="mali-c720 fr0-rgb\n/dev/video0", shape=box, style=filled, fillcolor=yellow] + n0000003c [label="mali-c720 fr0-yuv\n/dev/video1", shape=box, style=filled, fillcolor=yellow] + n00000074 [label="{{<port0> 0} | csi2-rx\n/dev/v4l-subdev6 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000074:port1 -> n00000009:port1 + n00000079 [label="{{} | imx415 1-001a\n/dev/v4l-subdev7 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green] + n00000079:port0 -> n00000074:port0 [style=bold] +}
Documentation/admin-guide/media/mali-c720.rst new file +370 -0
370 lines not on this page · raw message
Documentation/admin-guide/media/v4l-drivers.rst +1 -0
@@ -21,6 +21,7 @@ Video4Linux (V4L) driver-specific documentation ipu6-isys ivtv mali-c55 + mali-c720 mgb4 omap3isp philips
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 15/24] media: Documentation: Add Mali-C720 ISP documentation
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Low] media: Documentation: short title underline in mali-c720.rst - [Low] media: Documentation…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Low] media: Documentation: short title underline in mali-c720.rst
- [Low] media: Documentation: unreferenced footnote [3] in mali-c720.rst --
commit c4c33a88cca59317f92c1365b5db2c5c6579612d
Author: Anthony McGivern <[email protected]>
media: Documentation: Add Mali-C720 ISP documentation
This commit adds admin-guide documentation and a media graph topology diagram for the Arm Mali-C720 ISP driver.
Quoted 6 lines
Documentation/admin-guide/media/mali-c720.rst new file +0
-0@@ -0,0 +1,370 @@
[ ... ]
Quoted 2 lines
+Capturing Bayer data and processing it to RGB
+--------------------------------------------
[Severity: Low]
The hyphen underline here is 44 characters long for a 45-character title, which triggers a "Title underline too short" warning during make htmldocs.
[ ... ]
Documentation/admin-guide/media/mali-c720.rst line 370
Quoted 6 lines
Documentation/admin-guide/media/mali-c720.rst new file +6
-0+References +========== + +.. [1] https://git.linuxtv.org/v4l-utils.git/ +.. [2] https://git.ideasonboard.org/yavta.git/ +.. [3] https://support.arm.com/compute-ip/mali-c720ae
[Severity: Low]
Is footnote [3] supposed to be referenced in the text above? Without a corresponding [3]_ reference, Sphinx emits a "Footnote [3] is not referenced" warning when building the documentation.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=15
PATCH 16/24 media: uapi: Add Mali-C720 statistics meta format
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add a new meta format for the Mali-C720 ISP's 3A statistics along with a format description.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 3 +++ 2 files changed, 4 insertions(+)
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1471,6 +1471,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_C3ISP_STATS : descr ="Amlogic C3 ISP Statistics" ;break ;case V4L2_META_FMT_MALI_C55_PARAMS : descr ="ARM Mali-C55 ISP Parameters" ;break ;case V4L2_META_FMT_MALI_C55_STATS : descr ="ARM Mali-C55 ISP 3A Statistics" ;break ; +case V4L2_META_FMT_MALI_C720_STATS : descr ="ARM Mali-C720 ISP 3A Statistics" ;break ;case V4L2_META_FMT_RPPX1_PARAMS : descr ="Dreamchip RPP-X1 ISP Parameters" ;break ;case V4L2_META_FMT_RPPX1_STATS : descr ="Dreamchip RPP-X1 ISP Statistics" ;break ;case V4L2_PIX_FMT_NV12_8L128 : descr ="NV12 (8x128 Linear)" ;break ;
include/uapi/linux/videodev2.h +3 -0
@@ -889,6 +889,9 @@ struct v4l2_pix_format {#define V4L2_META_FMT_MALI_C55_PARAMS v4l2_fourcc('C', '5', '5', 'P')/* ARM Mali-C55 Parameters */ #define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S')/* ARM Mali-C55 3A Statistics */ +/* Vendor specific - used for Arm Mali-C720 ISP */ +#define V4L2_META_FMT_MALI_C720_STATS v4l2_fourcc('C', '7', '2', 'S')/* ARM Mali-C720 3A Statistics */ +/* Vendor specific - used for Dreamchip RPP-X1 ISP */ #define V4L2_META_FMT_RPPX1_PARAMS v4l2_fourcc('D', 'R', '1', 'P')/* Dreamchip RPP-X1 Parameters */ #define V4L2_META_FMT_RPPX1_STATS v4l2_fourcc('D', 'R', '1', 'S')/* Dreamchip RPP-X1 Statistics */
Signature · 1 line
2.55.0
PATCH 17/24 media: uapi: Add statistics structs to mali-c720-config.h
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Describe the format of the 3A statistics buffers in the userspace API for the Mali-C720 ISP.
--- include/uapi/linux/media/arm/mali-c720-config.h | 184 ++++++++++++++++++++++++ 1 file changed, 184 insertions(+)
include/uapi/linux/media/arm/mali-c720-config.h new file +184 -0
@@ -0,0 +1,184 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +/* +* ARM Mali-C720 ISP Driver - Image signal processor +* +* Copyright (C) 2026 Arm Ltd +*/ + +#ifndef __UAPI_MALI_C720_CONFIG_H +#define __UAPI_MALI_C720_CONFIG_H + +#include <linux/types.h> +#include <linux/v4l2-controls.h> +#include <linux/media/v4l2-isp.h> + +#define MALI_C720_MAX_ZONES 1024 + +/** +* struct mali_c720_awb_stats_nodes_used - Color statistics zone dimensions +* @reserved1: Undefined buffer space +* @nodes_used_horiz: Number of horizontal zones used for this frame +* @nodes_used_vert: Number of vertical zones used for this frame +* @reserved2: Undefined buffer space +* +* The product of the dimensions gives the number of valid zone records in +* &struct mali_c720_awb_statistics, up to MALI_C720_MAX_ZONES. +*/ +struct mali_c720_awb_stats_nodes_used { +__u8 reserved1[8 ]; +__u8 nodes_used_horiz; +__u8 nodes_used_vert; +__u8 reserved2[6 ]; +} __attribute__((aligned (16 ))); + +/** +* struct mali_c720_awb_statistics_tail - Global color statistics +* @global_rg: Global R/G or G/R ratio, in Q4.8 format +* @global_bg: Global B/G or G/B ratio, in Q4.8 format +* @global_num_pixels: Number of accepted pixels after zone weighting +* @frame_count: Frame counter +* @crc16: Statistics CRC +* @reserved: Undefined buffer space +* +* This structure contains the global color ratios and pixel count. It follows +* the active zone records and can be located using mali_c720_awb_stats_tail(). +* The ratio mode is selected by awb_stats_mode in +* &struct mali_c720_params_color_stats. See &enum mali_c720_awb_stats_mode. +*/ +struct mali_c720_awb_statistics_tail { +__le16 global_rg; +__le16 global_bg; +__le32 global_num_pixels; +__le32 frame_count; +__le16 crc16; +__u8 reserved[2 ]; +}; + +/** +* struct mali_c720_awb_statistics - Per-zone and global color statistics +* @zones: Zone records in row-major order, starting at the top left +* @zones.avg_rg: R/G or G/R ratio, in Q4.8 format +* @zones.avg_bg: B/G or G/B ratio, in Q4.8 format +* @zones.num_pixels: Number of accepted pixels in the zone before weighting +* @tail_reserved: Undefined buffer space +* @nodes_used: Zone dimensions used for this frame +* +* The ISP collects average color ratios and pixel counts for each zone. The +* global statistics follow the last active zone and can be located using +* mali_c720_awb_stats_tail(). The ratio mode is selected by awb_stats_mode in +* &struct mali_c720_params_color_stats. See &enum mali_c720_awb_stats_mode. +*/ +struct mali_c720_awb_statistics { +struct { +__le16 avg_rg; +__le16 avg_bg; +__le32 num_pixels; + } zones[MALI_C720_MAX_ZONES ]; + +__u8 tail_reserved[sizeof (struct mali_c720_awb_statistics_tail )]; +struct mali_c720_awb_stats_nodes_used nodes_used; +} __attribute__((aligned (16 ))); + +static inline struct mali_c720_awb_statistics_tail * +mali_c720_awb_stats_tail (struct mali_c720_awb_statistics *stats) +{ +return (struct mali_c720_awb_statistics_tail *) + (stats->zones + stats->nodes_used.nodes_used_horiz * + stats->nodes_used.nodes_used_vert); +} + +/** +* struct mali_c720_ae_1024bin_hist - Histogram statistics +* @bins: 1024 compressed, weighted pixel counts +* @total_pixels: Number of sampled pixels before weighting +* @counted_pixels: Sum of weights accumulated in all histogram banks +* @plane_total: Sampled pixel counts for each bank before weighting +* @plane_counted: Sum of weights accumulated in each bank +* @frame_count: Frame counter +* @crc16: Statistics CRC +* @reserved: Undefined buffer space +* +* The histogram collects a zone-weighted distribution of pixel intensities. +* The configured plane mode selects one 1024-bin histogram, four 256-bin +* histograms or two 512-bin histograms, stored consecutively in @bins. The +* bank counters follow the same order. +* +* Each bin contains a four-bit exponent followed by a twelve-bit mantissa. +* An approximate weighted pixel count can be decoded as:: +* +* e = bin >> 12; +* m = bin & 0xfff; +* count = (e ? (m + 4096) << (e - 1) : m) * 4; +*/ +struct mali_c720_ae_1024bin_hist { +__le16 bins[1024 ]; +__le32 total_pixels; +__le32 counted_pixels; +__le32 plane_total[4 ]; +__le32 plane_counted[4 ]; +__le32 frame_count; +__le16 crc16; +__u8 reserved[2 ]; +} __attribute__((aligned (16 ))); + +/** +* enum mali_c720_stats_type - Mali-C720 statistics block targets +* @MALI_C720_STATS_NOOP: No data; skip the block using its size. +* @MALI_C720_STATS_HISTOGRAM_INP: Input histogram statistics. +* @MALI_C720_STATS_HISTOGRAM_HV: HV histogram statistics (pre-Iridix). +* @MALI_C720_STATS_HISTOGRAM_HV_IRIDIX: HV histogram statistics (post-Iridix). +* @MALI_C720_STATS_COLOR_HV: HV color statistics. +*/ +enum mali_c720_stats_type { +MALI_C720_STATS_NOOP , +MALI_C720_STATS_HISTOGRAM_INP , +MALI_C720_STATS_HISTOGRAM_HV , +MALI_C720_STATS_HISTOGRAM_HV_IRIDIX , +MALI_C720_STATS_COLOR_HV , +MALI_C720_STATS_MAX , +}; + +/** +* struct mali_c720_stats_color - Color statistics block +* @header: Generic V4L2 ISP block header; type identifies the color statistics +* target from &enum mali_c720_stats_type +* @reserved: Undefined buffer space +* @data: Color statistics payload +*/ +struct mali_c720_stats_color { +struct v4l2_isp_block_header header; +__u8 reserved[8 ]; +struct mali_c720_awb_statistics data; +}; + +/** +* struct mali_c720_stats_histogram - Histogram statistics block +* @header: Generic V4L2 ISP block header; type identifies the histogram target +* from &enum mali_c720_stats_type +* @reserved: Undefined buffer space +* @data: Histogram payload +*/ +struct mali_c720_stats_histogram { +struct v4l2_isp_block_header header; +__u8 reserved[8 ]; +struct mali_c720_ae_1024bin_hist data; +}; + +/** +* MALI_C720_STATS_MAX_SIZE - Maximum serialized statistics block size +* +* Maximum size of all statistics blocks in a full hardware configuration, +* including the initial NOOP block used for alignment, but excluding the +* struct v4l2_isp_buffer header. The actual buffer size depends on the +* discovered statistics blocks and is reported through the metadata format. +*/ +#define MALI_C720_STATS_MAX_SIZE \ + (sizeof(struct v4l2_isp_block_header) + \ + sizeof(struct mali_c720_stats_color) + \ + sizeof(struct mali_c720_stats_histogram) + \ + sizeof(struct mali_c720_stats_histogram) + \ + sizeof(struct mali_c720_stats_histogram)) + +#define V4L2_CID_MALI_C720_STATS_CAPABILITIES (V4L2_CID_USER_MALI_C720_BASE + 0) + +#endif
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 17/24] media: uapi: Add statistics structs to mali-c720-config.h
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] media: uapi: undocumented MALI_C720_STATS_MAX in enum mali_c720_stats_type --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] media: uapi: undocumented MALI_C720_STATS_MAX in enum mali_c720_stats_type
--
commit 69f08e39ef3ea35be2a6109a1c325ef3b69ded6d
Author: Anthony McGivern <[email protected]>
media: uapi: Add statistics structs to mali-c720-config.h
This commit adds the UAPI header definitions describing the 3A statistics buffer format for the Mali-C720 ISP.
Quoted 6 lines
include/uapi/linux/media/arm/mali-c720-config.h new file +0
-0@@ -0,0 +1,184 @@
[ ... ]
Quoted 6 lines
include/uapi/linux/media/arm/mali-c720-config.h new file +6
-0+/** +* enum mali_c720_stats_type - Mali-C720 statistics block targets +* @MALI_C720_STATS_NOOP: No data; skip the block using its size. +* @MALI_C720_STATS_HISTOGRAM_INP: Input histogram statistics. +* @MALI_C720_STATS_HISTOGRAM_HV: HV histogram statistics (pre-Iridix). +* @MALI_C720_STATS_HISTOGRAM_HV_IRIDIX: HV histogram statistics (post-Iridix).
include/uapi/linux/media/arm/mali-c720-config.h line 139
Quoted 10 lines
include/uapi/linux/media/arm/mali-c720-config.h new file +10
-0+* @MALI_C720_STATS_COLOR_HV: HV color statistics. +*/ +enum mali_c720_stats_type { +MALI_C720_STATS_NOOP , +MALI_C720_STATS_HISTOGRAM_INP , +MALI_C720_STATS_HISTOGRAM_HV , +MALI_C720_STATS_HISTOGRAM_HV_IRIDIX , +MALI_C720_STATS_COLOR_HV , +MALI_C720_STATS_MAX , +};
[Severity: Low]
Should MALI_C720_STATS_MAX be documented in the kernel-doc comment or marked with /* private: */? As written, scripts/kernel-doc warns that MALI_C720_STATS_MAX is not described in enum mali_c720_stats_type.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=17
PATCH 18/24 media: mali-c720: Add 3A statistics video node
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add a metadata capture node for ISP statistics used by userspace image processing algorithms, such as auto-exposure and auto-white-balance.
Use the ISP's configuration DMA engine (CDMA) scatter-gather unit to transfer statistics into queued buffers and return them at frame end. Each buffer carries the sequence number of the processed frame, matching image buffers produced from that frame.
Initial support exposes colour statistics and pixel intensity histograms. Available statistics blocks are reported through a read-only capability control.
--- drivers/media/platform/arm/mali-c720/Kconfig | 1 + drivers/media/platform/arm/mali-c720/Makefile | 1 + .../platform/arm/mali-c720/mali-c720-common.h | 51 ++ .../media/platform/arm/mali-c720/mali-c720-core.c | 43 +- .../platform/arm/mali-c720/mali-c720-ctx-mgr.c | 166 ++++- .../platform/arm/mali-c720/mali-c720-ctx-mgr.h | 24 + .../media/platform/arm/mali-c720/mali-c720-isp.c | 17 +- .../media/platform/arm/mali-c720/mali-c720-stats.c | 730 +++++++++++++++++++++ 8 files changed, 1028 insertions(+), 5 deletions(-)
drivers/media/platform/arm/mali-c720/Kconfig +1 -0
@@ -7,6 +7,7 @@ config VIDEO_MALI_C720 select CRC_ITU_T select MEDIA_CONTROLLER select V4L2_FWNODE + select V4L2_ISP select VIDEO_V4L2_SUBDEV_API select VIDEOBUF2_DMA_CONTIG select VIDEOBUF2_VMALLOC
drivers/media/platform/arm/mali-c720/Makefile +1 -0
@@ -15,6 +15,7 @@ mali-c720-y := mali-c720-capture.o \ mali-c720-registers-top.o \ mali-c720-registers-ctx-mgr.o \ mali-c720-registers-modules.o \ + mali-c720-stats.o \ mali-c720-tpg.o \ mali-c720-vision-pipe.o \
drivers/media/platform/arm/mali-c720/mali-c720-common.h +51 -0
87 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-core.c +42 -1
105 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-ctx-mgr.c +164 -2
227 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-ctx-mgr.h +24 -0
@@ -24,6 +24,7 @@ struct mali_c720_context;#define MALI_C720_MAX_STREAMS_PER_INPUT 4#define MALI_C720_MAX_VIRTUAL_INPUTS (MALI_C720_MAX_INPUTS * MALI_C720_MAX_STREAMS_PER_INPUT)#define MALI_C720_MAX_CONTEXTS 16 +#define MALI_C720_MAX_CDMA_SG_DESCRIPTORS 32#define MALI_C720_NUM_SAFETY_SLOTS 4enum mali_c720_input_command {
@@ -185,6 +186,20 @@ struct mali_c720_cdma_desc {u32 alt_base_address_high; }; +struct mali_c720_cdma_sg_cfg { +u32 isp_address; +u16 length_low; +u8 length_high; +u32 axi_address; +u8 alt_address; +}; + +struct mali_c720_cdma_sg_table { +struct mali_c720_cdma_sg_cfg desc[MALI_C720_MAX_CDMA_SG_DESCRIPTORS ]; +u16 crc; +u8 num_desc; +}; +struct mali_c720_buffer_desc {u16 crc;u8 data_format;
@@ -253,6 +268,10 @@ struct mali_c720_ctx_mgr {u8 input_context_map[MALI_C720_MAX_VIRTUAL_INPUTS ];unsigned long raw_buffer_descriptors[BITS_TO_LONGS (MALI_C720_MAX_RAW_BUFFERS )];unsigned long out_buffer_descriptors[BITS_TO_LONGS (MALI_C720_MAX_OUT_BUFFERS )]; +struct { +struct mali_c720_cdma_sg_table load; +struct mali_c720_cdma_sg_table store; + } sg_descriptors;unsigned int num_raw_buffer_descriptors;unsigned int reuse_buffer;unsigned int num_out_buffer_descriptors;
@@ -260,6 +279,7 @@ struct mali_c720_ctx_mgr {unsigned int num_input_streams;unsigned int num_virtual_inputs;unsigned int num_contexts; +unsigned int cdma_sg_size;unsigned int input_fifo_size;unsigned int output_fifo_size; };
@@ -272,6 +292,8 @@ void mali_c720_free_context(struct mali_c720_context *ctx);int mali_c720_init_ctx_mgr (struct mali_c720 *mali_c720); +int mali_c720_ctx_mgr_prepare_cdma_sg_descriptors (struct mali_c720 *mali_c720); +int mali_c720_ctx_mgr_start_context_inputs (struct mali_c720_context *ctx);void mali_c720_ctx_mgr_stop_context_inputs (struct mali_c720_context *ctx);
@@ -287,6 +309,8 @@ void mali_c720_ctx_mgr_update_buffer(struct mali_c720_context *ctx,struct mali_c720_buffer_pool *pool, dma_addr_t *addr, unsigned int index); +void mali_c720_ctx_mgr_set_stats_buffer_address (struct mali_c720_context *ctx, +dma_addr_t *addr);void mali_c720_ctx_mgr_configure_context (struct mali_c720_context *ctx,const struct mali_c720_top_cfg *cfg);
drivers/media/platform/arm/mali-c720/mali-c720-isp.c +15 -2
@@ -23,7 +23,11 @@ static int mali_c720_isp_enum_mbus_code(struct v4l2_subdev *sd,struct mali_c720_mbus_format_match match;/* HV uses the sink Bayer order at the internal 16-bit precision. */ -if (code->pad ==MALI_C720_ISP_PAD_SOURCE_HV ) { +if (code->pad ==MALI_C720_ISP_PAD_SOURCE_STATS ) { +if (code->index) +return -EINVAL ; + code->code =MEDIA_BUS_FMT_METADATA_FIXED ; + }else if (code->pad ==MALI_C720_ISP_PAD_SOURCE_HV ) {if (code->index)return -EINVAL ;
@@ -89,6 +93,8 @@ static int mali_c720_isp_enum_frame_size(struct v4l2_subdev *sd,if (!cfg || !mali_c720_validate_mbus_format_match (cfg, &match))return -EINVAL ;break ; +case MALI_C720_ISP_PAD_SOURCE_STATS : +return -ENOTTY ;default :return -EINVAL ; }
@@ -292,7 +298,7 @@ static const struct v4l2_subdev_ops mali_c720_isp_ops = {static int mali_c720_isp_init_state (struct v4l2_subdev *sd,struct v4l2_subdev_state *state) { -struct v4l2_mbus_framefmt *sink_fmt, *src_fmt; +struct v4l2_mbus_framefmt *sink_fmt, *src_fmt, *stats_fmt; sink_fmt =v4l2_subdev_state_get_format (state,MALI_C720_ISP_PAD_SINK_VIDEO ); sink_fmt->width =MALI_C720_DEFAULT_WIDTH ;
@@ -308,6 +314,12 @@ static int mali_c720_isp_init_state(struct v4l2_subdev *sd, *src_fmt = *sink_fmt; src_fmt->code =MEDIA_BUS_FMT_SRGGB16_1X16 ; + stats_fmt =v4l2_subdev_state_get_format (state,MALI_C720_ISP_PAD_SOURCE_STATS ); + stats_fmt->width =0 ; + stats_fmt->height =0 ; + stats_fmt->field =V4L2_FIELD_NONE ; + stats_fmt->code =MEDIA_BUS_FMT_METADATA_FIXED ; +return 0 ; }
@@ -370,6 +382,7 @@ int mali_c720_register_isp(struct mali_c720 *mali_c720) isp->pads[MALI_C720_ISP_PAD_SINK_VIDEO ].flags =MEDIA_PAD_FL_SINK |MEDIA_PAD_FL_MUST_CONNECT ; isp->pads[MALI_C720_ISP_PAD_SOURCE_HV ].flags =MEDIA_PAD_FL_SOURCE ; + isp->pads[MALI_C720_ISP_PAD_SOURCE_STATS ].flags =MEDIA_PAD_FL_SOURCE ; ret = media_entity_pads_init(&sd->entity, MALI_C720_ISP_NUM_PADS,
drivers/media/platform/arm/mali-c720/mali-c720-stats.c new file +730 -0
730 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 18/24] media: mali-c720: Add 3A statistics video node
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] media: mali-c720: unlinked stats streamon leaks pipe.start_count on stop --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] media: mali-c720: unlinked stats streamon leaks pipe.start_count on stop
--
commit acde35ee7e30f91ca98dde1602bdd7e3bb4e0204
Author: Anthony McGivern <[email protected]>
media: mali-c720: Add 3A statistics video node
This commit adds a metadata capture video node for ISP 3A statistics and configures the CDMA scatter-gather engine to transfer colour statistics and pixel intensity histograms into queued buffers.
Quoted 5 lines
drivers/media/platform/arm/mali-c720/mali-c720-stats.c new file +0
-0
[ ... ]
Quoted 41 lines
drivers/media/platform/arm/mali-c720/mali-c720-stats.c new file +41
-0+static int mali_c720_stats_start_streaming (struct vb2_queue *q, +unsigned int count) +{ +struct mali_c720_stats *stats =vb2_get_drv_priv (q); +struct mali_c720 *mali_c720 = stats->mali_c720; +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +struct v4l2_subdev *isp_sd = &mali_c720->isp.mdev.sd; +int ret; + +guard (mutex) (&mali_c720->device_lock); + +if (!media_devnode_is_registered (mali_c720->media_dev.devnode)) { + ret = -ENODEV ; + goto err_return_buffers; + } + + ret =pm_runtime_resume_and_get (mali_c720->dev); +if (ret) + goto err_return_buffers; + + ret =video_device_pipeline_start (&stats->vdev, &mali_c720->pipe); +if (ret) + goto err_pm_put; + + ret =mali_c720_alloc_context (ctx); +if (ret) + goto err_stop_pipeline; + + ret =mali_c720_pipeline_ready (mali_c720); +if (ret && ret != -EAGAIN ) + goto err_free_context; + +if (!ret) { + ret =v4l2_subdev_enable_streams (isp_sd, +MALI_C720_ISP_PAD_SOURCE_HV , +BIT (0 )); +if (ret) + goto err_free_context; + } + +return 0 ;
[ ... ]
Quoted 7 lines
drivers/media/platform/arm/mali-c720/mali-c720-stats.c new file +7
-0+static void mali_c720_stats_stop_streaming (struct vb2_queue *q) +{ +struct mali_c720_stats *stats =vb2_get_drv_priv (q); +struct mali_c720 *mali_c720 = stats->mali_c720; +struct mali_c720_context *ctx =mali_c720_get_active_context (mali_c720); +struct mali_c720_isp *isp = &mali_c720->isp; +struct v4l2_subdev *isp_sd = &isp->mdev.sd;
drivers/media/platform/arm/mali-c720/mali-c720-stats.c line 593
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-stats.c new file +10
-0+ +guard (mutex) (&mali_c720->device_lock); + +v4l2_subdev_disable_streams (isp_sd,MALI_C720_ISP_PAD_SOURCE_HV , +BIT (0 )); +mali_c720_stats_return_buffers (stats,VB2_BUF_STATE_ERROR ); + +mali_c720_free_context (ctx); + +video_device_pipeline_stop (&stats->vdev);
[Severity: High]
Can starting and stopping streaming on the 3A stats node while its media link is disabled leak mali_c720->pipe.start_count and stop an active capture stream?
mali_c720_create_3a_links() creates the link to stats.vdev disabled by default. When a linked capture node (such as fr0-rgb) is already streaming, mali_c720->pipe.start_count is non-zero and stats->pad.pipe is NULL. If userspace then calls VIDIOC_STREAMON on the unlinked stats node, __media_pipeline_start() takes its start_count > 0 early return without checking MEDIA_PAD_FL_MUST_CONNECT or setting stats->pad.pipe, and mali_c720_stats_start_streaming() ignores the resulting -EAGAIN from mali_c720_pipeline_ready().
When the stats node later stops streaming, mali_c720_stats_stop_streaming() disables the active ISP stream for the still-running capture node and calls video_device_pipeline_stop(&stats->vdev) with stats->pad.pipe == NULL, which triggers WARN_ON(!pipe) in __media_pipeline_stop() and returns without decrementing mali_c720->pipe.start_count.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=18
PATCH 19/24 media: Documentation: Document Mali-C720 statistics capture
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Document statistics capture and querying available statistics blocks through the capability control. Include a capture example and explain how frame sequence numbers associate statistics with image buffers.
Describe the statistics metadata format, its use of the generic V4L2 ISP buffer layout and the Mali-C720 UAPI structures.
--- .../admin-guide/media/mali-c720-graph.dot | 4 +- Documentation/admin-guide/media/mali-c720.rst | 55 ++++++++++++++++++---- .../userspace-api/media/drivers/index.rst | 1 + .../userspace-api/media/drivers/mali-c720.rst | 41 ++++++++++++++++ .../userspace-api/media/v4l/meta-formats.rst | 1 + .../media/v4l/metafmt-arm-mali-c720.rst | 40 ++++++++++++++++ 6 files changed, 132 insertions(+), 10 deletions(-)
Documentation/admin-guide/media/mali-c720-graph.dot +3 -1
@@ -6,8 +6,9 @@ digraph board { n00000003:port0 -> n00000009:port1 [style=dashed] n00000009 [label="{{<port1> 1} | mali-c720 input\n/dev/v4l-subdev2 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green] n00000009:port0 -> n0000000c:port0 - n0000000c [label="{{<port0> 0} | mali-c720 isp\n/dev/v4l-subdev3 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n0000000c [label="{{<port0> 0} | mali-c720 isp\n/dev/v4l-subdev3 | {<port1> 1 | <port2> 2}}", shape=Mrecord, style=filled, fillcolor=green] n0000000c:port1 -> n00000014:port0 + n0000000c:port2 -> n0000006c [style=dashed] n00000014 [label="{{<port0> 0} | mali-c720 hv pipe\n/dev/v4l-subdev4 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] n00000014:port1 -> n0000001c:port0 n0000001c [label="{{<port0> 0} | mali-c720 fr 0 pipe\n/dev/v4l-subdev5 | {<port1> 1 | <port2> 2}}", shape=Mrecord, style=filled, fillcolor=green]
@@ -15,6 +16,7 @@ digraph board { n0000001c:port2 -> n0000003c [style=dashed] n00000038 [label="mali-c720 fr0-rgb\n/dev/video0", shape=box, style=filled, fillcolor=yellow] n0000003c [label="mali-c720 fr0-yuv\n/dev/video1", shape=box, style=filled, fillcolor=yellow] + n0000006c [label="mali-c720 3a stats\n/dev/video2", shape=box, style=filled, fillcolor=yellow] n00000074 [label="{{<port0> 0} | csi2-rx\n/dev/v4l-subdev6 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] n00000074:port1 -> n00000009:port1 n00000079 [label="{{} | imx415 1-001a\n/dev/v4l-subdev7 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
Documentation/admin-guide/media/mali-c720.rst +46 -9
87 lines not on this page · raw message
Documentation/userspace-api/media/drivers/index.rst +1 -0
@@ -34,6 +34,7 @@ For more details see the file COPYING in the source distribution of Linux. dw100 imx-uapi mali-c55 + mali-c720 max2175 npcm-video omap3isp-uapi
Documentation/userspace-api/media/drivers/mali-c720.rst new file +41 -0
41 lines not on this page · raw message
Documentation/userspace-api/media/v4l/meta-formats.rst +1 -0
@@ -14,6 +14,7 @@ These formats are used for the :ref:`metadata` interface only. :maxdepth: 1 metafmt-arm-mali-c55 + metafmt-arm-mali-c720 metafmt-c3-isp metafmt-d4xx metafmt-generic
Documentation/userspace-api/media/v4l/metafmt-arm-mali-c720.rst new file +40 -0
@@ -0,0 +1,40 @@ +.. SPDX-License-Identifier: GPL-2.0 + +.. _v4l2-meta-fmt-mali-c720-stats: + +******************************************************************************* +V4L2_META_FMT_MALI_C720_STATS ('C72S') +******************************************************************************* + +For details on queueing statistics buffers and synchronizing them with +image buffers using Media Requests, see :ref:`mali-c720-frame-scheduling`. + +3A Statistics +============= + +The ISP collects statistics at different stages of frame processing. These +may describe Bayer or processed image data, depending on the statistics +block and its configuration. Userspace can obtain these statistics from the +:ref:`mali-c720 3a stats <mali-c720-3a-stats>` metadata capture video node, using +the :c:type:`v4l2_meta_format` interface. + +Userspace may consume these statistics in 3A algorithms, including +auto-exposure, auto-white balance and autofocus, to compute adjustments to +sensor and ISP settings. + +Statistics for the Mali-C720 use the :ref:`generic V4L2 ISP format <v4l2-isp>`. +The buffer contains a :c:type:`v4l2_isp_buffer` header followed by statistics +blocks in its ``data`` member. Each block embeds +:c:type:`v4l2_isp_block_header` as its first member, with the ``type`` member +set to a value from :c:type:`mali_c720_stats_type`. The available statistics +depend on the hardware configuration. These can be queried via the statistics +capability control +:ref:`V4L2_CID_MALI_C720_STATS_CAPABILITIES <mali-c720-controls>`. + +For details of the statistics, see the statistics blocks defined in +``mali-c720-config.h``. + +Arm Mali-C720 uAPI data types +============================= + +.. kernel-doc:: include/uapi/linux/media/arm/mali-c720-config.h
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 19/24] media: Documentation: Document Mali-C720 statistics capture
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Low] media: Documentation: kernel-doc warning for undescribed MALI_C720_STATS_MAX --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [Low] media: Documentation: kernel-doc warning for undescribed MALI_C720_STATS_MAX
--
commit 47e2e3be519a4bd1656602aa074bece5f7c29afe
Author: Anthony McGivern <[email protected]>
media: Documentation: Document Mali-C720 statistics capture
This commit documents Mali-C720 statistics capture, the V4L2_CID_MALI_C720_STATS_CAPABILITIES control, and the V4L2_META_FMT_MALI_C720_STATS metadata format.
Quoted 6 lines
Documentation/userspace-api/media/v4l/metafmt-arm-mali-c720.rst new file +0
-0@@ -0,0 +1,40 @@
[ ... ]
Documentation/userspace-api/media/v4l/metafmt-arm-mali-c720.rst line 40
Quoted 4 lines
Documentation/userspace-api/media/v4l/metafmt-arm-mali-c720.rst new file +4
-0+Arm Mali-C720 uAPI data types +============================= + +.. kernel-doc:: include/uapi/linux/media/arm/mali-c720-config.h
[Severity: Low]
Does pulling mali-c720-config.h into the documentation build trigger a kernel-doc warning for MALI_C720_STATS_MAX?
In include/uapi/linux/media/arm/mali-c720-config.h, enum mali_c720_stats_type defines MALI_C720_STATS_MAX without a kernel-doc entry or a /*< private >*/ marker, causing make htmldocs to warn that MALI_C720_STATS_MAX is not described in enum mali_c720_stats_type.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=19
PATCH 20/24 media: uapi: Add Mali-C720 parameters meta format
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add a new V4L2 meta format code for Mali-C720 ISP parameters.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 1 + include/uapi/linux/videodev2.h | 1 + 2 files changed, 2 insertions(+)
drivers/media/v4l2-core/v4l2-ioctl.c +1 -0
@@ -1471,6 +1471,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_C3ISP_STATS : descr ="Amlogic C3 ISP Statistics" ;break ;case V4L2_META_FMT_MALI_C55_PARAMS : descr ="ARM Mali-C55 ISP Parameters" ;break ;case V4L2_META_FMT_MALI_C55_STATS : descr ="ARM Mali-C55 ISP 3A Statistics" ;break ; +case V4L2_META_FMT_MALI_C720_PARAMS : descr ="ARM Mali-C720 ISP Parameters" ;break ;case V4L2_META_FMT_MALI_C720_STATS : descr ="ARM Mali-C720 ISP 3A Statistics" ;break ;case V4L2_META_FMT_RPPX1_PARAMS : descr ="Dreamchip RPP-X1 ISP Parameters" ;break ;case V4L2_META_FMT_RPPX1_STATS : descr ="Dreamchip RPP-X1 ISP Statistics" ;break ;
include/uapi/linux/videodev2.h +1 -0
@@ -890,6 +890,7 @@ struct v4l2_pix_format {#define V4L2_META_FMT_MALI_C55_STATS v4l2_fourcc('C', '5', '5', 'S')/* ARM Mali-C55 3A Statistics */ /* Vendor specific - used for Arm Mali-C720 ISP */ +#define V4L2_META_FMT_MALI_C720_PARAMS v4l2_fourcc('C', '7', '2', 'P')/* ARM Mali-C720 Parameters */ #define V4L2_META_FMT_MALI_C720_STATS v4l2_fourcc('C', '7', '2', 'S')/* ARM Mali-C720 3A Statistics */ /* Vendor specific - used for Dreamchip RPP-X1 ISP */
Signature · 1 line
2.55.0
PATCH 21/24 media: uapi: Add parameter structs to mali-c720-config.h
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add structures defining the ISP parameters to mali-c720-config.h. Additionally add a custom control ID for querying supported parameter blocks.
--- include/uapi/linux/media/arm/mali-c720-config.h | 554 ++++++++++++++++++++++++ 1 file changed, 554 insertions(+)
include/uapi/linux/media/arm/mali-c720-config.h +554 -0
@@ -14,6 +14,8 @@#define MALI_C720_MAX_ZONES 1024 +#define MALI_C720_NUM_DECOMPANDER_LUT_ELEMENTS 33 +/** * struct mali_c720_awb_stats_nodes_used - Color statistics zone dimensions * @reserved1: Undefined buffer space
@@ -179,6 +181,558 @@ struct mali_c720_stats_histogram { sizeof(struct mali_c720_stats_histogram) + \ sizeof(struct mali_c720_stats_histogram)) +/** +* enum mali_c720_param_block_type - Mali-C720 parameter block targets +* +* @MALI_C720_PARAM_BLOCK_DIGITAL_GAIN_INP: Digital gain for the input pipeline. +* @MALI_C720_PARAM_BLOCK_HISTOGRAM_INP: Histogram configuration for the input pipeline. +* @MALI_C720_PARAM_BLOCK_AWB_GAINS_HV: Auto-white balance gains for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_HISTOGRAM_HV: HV histogram configuration (pre-Iridix). +* @MALI_C720_PARAM_BLOCK_HISTOGRAM_HV_IRIDIX: HV histogram configuration (post-Iridix). +* @MALI_C720_PARAM_BLOCK_COLOR_STATS_HV: Color stats configuration for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_BLACK_LEVEL_HV: Black level offsets for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_SQRT_INP: Square root configuration for the input pipeline. +* @MALI_C720_PARAM_BLOCK_SQUARE_A_HV: Square A configuration for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_SQUARE_B_HV: Square B configuration for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_SQRT_HV: Square root configuration for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_DECOMPANDER_INP: Decompander configuration. +* +* Each identifier selects one logical module and instance. Applications can +* query V4L2_CID_MALI_C720_PARAM_CAPABILITIES for the targets present on the +* device. The control returns a read-only U16 array of supported identifiers. +*/ +enum mali_c720_param_block_type { +MALI_C720_PARAM_BLOCK_DIGITAL_GAIN_INP , +MALI_C720_PARAM_BLOCK_HISTOGRAM_INP , +MALI_C720_PARAM_BLOCK_AWB_GAINS_HV , +MALI_C720_PARAM_BLOCK_HISTOGRAM_HV , +MALI_C720_PARAM_BLOCK_HISTOGRAM_HV_IRIDIX , +MALI_C720_PARAM_BLOCK_COLOR_STATS_HV , +MALI_C720_PARAM_BLOCK_BLACK_LEVEL_HV , +MALI_C720_PARAM_BLOCK_SQRT_INP , +MALI_C720_PARAM_BLOCK_SQUARE_A_HV , +MALI_C720_PARAM_BLOCK_SQUARE_B_HV , +MALI_C720_PARAM_BLOCK_SQRT_HV , +MALI_C720_PARAM_BLOCK_DECOMPANDER_INP , +MALI_C720_PARAM_BLOCK_MAX , +}; +#define V4L2_CID_MALI_C720_STATS_CAPABILITIES (V4L2_CID_USER_MALI_C720_BASE + 0) +#define V4L2_CID_MALI_C720_PARAM_CAPABILITIES (V4L2_CID_USER_MALI_C720_BASE + 1) + +enum mali_c720_params_digital_gain_mask { +MALI_C720_PARAMS_DIGITAL_GAIN_MASK_GAIN , +MALI_C720_PARAMS_DIGITAL_GAIN_MASK_OFFSET , +}; + +/** +* struct mali_c720_params_digital_gain - Digital gain settings +* +* This struct configures the digital gain and a common black level for all +* color channels. +* +* Set header.type to the target from &enum mali_c720_param_block_type. +* See &enum mali_c720_params_digital_gain_mask for the @updated_mask bit positions. +* Undefined bits are reserved and must be set to zero. +* +* @header: The generic V4L2 ISP block header +* @updated_mask: Mask of configuration fields to update +* @gain: Input digital gain in unsigned Q12.8 format [0..1048575]; 256 = 1x +* @offset: Input black level [0..16777215] +*/ +struct mali_c720_params_digital_gain { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u32 gain; +__u32 offset; +}; + +enum mali_c720_params_awb_gains_mask { +MALI_C720_PARAMS_AWB_GAINS_MASK_GAIN00 , +MALI_C720_PARAMS_AWB_GAINS_MASK_GAIN01 , +MALI_C720_PARAMS_AWB_GAINS_MASK_GAIN10 , +MALI_C720_PARAMS_AWB_GAINS_MASK_GAIN11 , +}; + +/** +* struct mali_c720_params_awb_gains - Gain settings for auto white balance +* +* There are four gain settings corresponding to the Bayer color channels. +* The ISP accounts for the input Bayer order, so the mapping to R, Gr, Gb +* and B is independent of that order. A value of 256 represents a 1x gain. +* +* Set header.type to the target from &enum mali_c720_param_block_type. +* See &enum mali_c720_params_awb_gains_mask for the @updated_mask bit positions. +* Undefined bits are reserved and must be set to zero. +* +* @header: The generic V4L2 ISP block header +* @updated_mask: Mask of configuration fields to update +* @gain00: Multiplier for color channel 00 (R), unsigned Q4.8 [0..4095] +* @gain01: Multiplier for color channel 01 (Gr), unsigned Q4.8 [0..4095] +* @gain10: Multiplier for color channel 10 (Gb), unsigned Q4.8 [0..4095] +* @gain11: Multiplier for color channel 11 (B), unsigned Q4.8 [0..4095] +*/ +struct mali_c720_params_awb_gains { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u16 gain00; +__u16 gain01; +__u16 gain10; +__u16 gain11; +}; + +enum mali_c720_params_black_level_mask { +MALI_C720_PARAMS_BLACK_LEVEL_MASK_CHAN00 , +MALI_C720_PARAMS_BLACK_LEVEL_MASK_CHAN01 , +MALI_C720_PARAMS_BLACK_LEVEL_MASK_CHAN10 , +MALI_C720_PARAMS_BLACK_LEVEL_MASK_CHAN11 , +}; + +/** +* struct mali_c720_params_black_level - Black level for each color channel +* +* This struct configures black level subtraction from each Bayer color channel. +* +* Set header.type to the target from &enum mali_c720_param_block_type. +* See &enum mali_c720_params_black_level_mask for the @updated_mask bit positions. +* Undefined bits are reserved and must be set to zero. +* +* @header: The generic V4L2 ISP block header +* @updated_mask: Mask of configuration fields to update +* @chan00: Offset from color channel 00 (R); HV range [0..65535] +* @chan01: Offset from color channel 01 (Gr); HV range [0..65535] +* @chan10: Offset from color channel 10 (Gb); HV range [0..65535] +* @chan11: Offset from color channel 11 (B); HV range [0..65535] +*/ +struct mali_c720_params_black_level { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u32 chan00; +__u32 chan01; +__u32 chan10; +__u32 chan11; +}; + +enum mali_c720_params_square_sqrt_mask { +MALI_C720_PARAMS_SQUARE_SQRT_MASK_BL_IN , +MALI_C720_PARAMS_SQUARE_SQRT_MASK_BL_OUT , +MALI_C720_PARAMS_SQUARE_SQRT_MASK_NORMALIZATION , +}; + +/** +* struct mali_c720_params_sqrt - Configuration for the square root module +* +* The square root module compands linear data into the square root domain, +* with black level correction and normalization. +* +* Set header.type to the target from &enum mali_c720_param_block_type. +* See &enum mali_c720_params_square_sqrt_mask for the @updated_mask bit positions. +* Undefined bits are reserved and must be set to zero. +* +* @header: The generic V4L2 ISP block header +* @updated_mask: Mask of configuration fields to update +* @normalization: Normalization coefficient applied before the square root, +* in Q1.16 format [0..131071]; 65536 = 1.0 +* @black_level_linear: Input black level in the linear domain [0..16777215] +* @black_level_sqrt: Output black level in the square root domain [0..4095] +*/ +struct mali_c720_params_sqrt { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u32 normalization; +__u32 black_level_linear; +__u16 black_level_sqrt; +}; + +/** +* struct mali_c720_params_square - Configuration for the square module +* +* The square module converts square root data back into the linear domain, +* with black level correction and normalization. +* +* Set header.type to the target from &enum mali_c720_param_block_type. +* See &enum mali_c720_params_square_sqrt_mask for the @updated_mask bit positions. +* Undefined bits are reserved and must be set to zero. +* +* @header: The generic V4L2 ISP block header +* @updated_mask: Mask of configuration fields to update +* @black_level_linear: Output black level, [0..4095] for Square-A or +* [0..16777215] for Square-B +* @black_level_sqrt: Input black level, [0..16777215] for Square-A or +* [0..4095] for Square-B +* @normalization: Normalization coefficient applied after squaring, +* in Q1.16 format [0..131071]; 65536 = 1.0 +*/ +struct mali_c720_params_square { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u32 black_level_linear; +__u32 black_level_sqrt; +__u32 normalization; +}; + +enum mali_c720_params_decompander_mask { +MALI_C720_PARAMS_DECOMPANDER_MASK_ENABLE , +MALI_C720_PARAMS_DECOMPANDER_MASK_LUT_X , +MALI_C720_PARAMS_DECOMPANDER_MASK_LUT_Y , +}; + +/** +* struct mali_c720_params_decompander - Configuration for the decompander +* +* The input decompander expands compressed sensor data using a piecewise +* linear curve defined by 33 points. Each X/Y pair maps an input pixel +* intensity to an expanded output intensity, with linear interpolation +* between points. +* +* The X coordinates must be in nondecreasing order and cover the input range. +* A nonzero difference between adjacent X coordinates must be at least 8. +* Repeated X coordinates must have equal Y coordinates. +* Both lut_x and lut_y fields must be provided together, with their respective +* updated_mask bits set. +* +* Y coordinates may exceed the 24-bit output range or be negative. +* Interpolation uses these extended values before clamping the final pixel +* output to the 24-bit range [0..16777215]. Nonnegative Y coordinates +* [0..0x17fffff] are stored directly; encodings [0x1800000..0x1ffffff] +* represent negative values, decoded by subtracting 0x2000000. +* +* Set header.type to the target from &enum mali_c720_param_block_type. +* See &enum mali_c720_params_decompander_mask for the @updated_mask bit positions. +* Undefined bits are reserved and must be set to zero. +* +* @header: The generic V4L2 ISP block header +* @updated_mask: Mask of configuration fields to update +* @enable: Enable decompanding: 0 = bypass, 1 = enabled +* @reserved: Reserved; set to zero +* @lut_x: 33 input pixel intensities, unsigned 24-bit [0..16777215] +* @lut_y: 33 corresponding output pixel intensities, using the encoding above +*/ +struct mali_c720_params_decompander { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u8 enable; +__u8 reserved[3 ]; +__u32 lut_x[MALI_C720_NUM_DECOMPANDER_LUT_ELEMENTS ]; +__u32 lut_y[MALI_C720_NUM_DECOMPANDER_LUT_ELEMENTS ]; +}; + +/** +* enum mali_c720_awb_stats_mode - Statistics mode for auto white balance +* @MALI_C720_AWB_MODE_GRGB: Green/Red and Green/Blue ratios +* @MALI_C720_AWB_MODE_RGBG: Red/Green and Blue/Green ratios +*/ +enum mali_c720_awb_stats_mode { +MALI_C720_AWB_MODE_GRGB =0 , +MALI_C720_AWB_MODE_RGBG =1 , +}; + +enum mali_c720_params_color_stats_mask { +MALI_C720_PARAMS_COLOR_STATS_MASK_NODES_USED_HORIZ , +MALI_C720_PARAMS_COLOR_STATS_MASK_NODES_USED_VERT , +MALI_C720_PARAMS_COLOR_STATS_MASK_AWB_STATS_MODE , +MALI_C720_PARAMS_COLOR_STATS_MASK_WHITE_LEVEL_AWB , +MALI_C720_PARAMS_COLOR_STATS_MASK_BLACK_LEVEL_AWB , +MALI_C720_PARAMS_COLOR_STATS_MASK_CR_REF_MAX_AWB , +MALI_C720_PARAMS_COLOR_STATS_MASK_CR_REF_MIN_AWB , +MALI_C720_PARAMS_COLOR_STATS_MASK_CR_REF_HIGH_AWB , +MALI_C720_PARAMS_COLOR_STATS_MASK_CR_REF_LOW_AWB , +MALI_C720_PARAMS_COLOR_STATS_MASK_CB_REF_MAX_AWB , +MALI_C720_PARAMS_COLOR_STATS_MASK_CB_REF_MIN_AWB , +MALI_C720_PARAMS_COLOR_STATS_MASK_CB_REF_HIGH_AWB , +MALI_C720_PARAMS_COLOR_STATS_MASK_CB_REF_LOW_AWB , +MALI_C720_PARAMS_COLOR_STATS_MASK_WEIGHTS , +}; + +/** +* struct mali_c720_params_color_stats - Color statistics configuration +* +* This struct configures the statistics generated for auto white balance. +* Pixel intensity limits exclude overly bright or dark pixels from the +* statistics. Color ratio minima and maxima bound a region in R/G and B/G +* space, while the high and low ratios trim its upper-right and lower-left +* corners. Only pixels whose ratios fall inside the region marked "A" are +* counted, independently of @awb_stats_mode:: +* +* B/G +* ^ +* max | +-----------------+ (high, max) +* | | \ +* high| | + (max, high) +* | | A | +* low | + | +* | \ | +* min | +-----------------+ +* +--------------------------> R/G +* min low high max +* +* Setting low to min and high to max selects the full rectangle. +* +* The product of @nodes_used_horiz and @nodes_used_vert must not exceed +* MALI_C720_MAX_ZONES (1024). Exceeding this limit produces invalid statistics +* that cannot be parsed reliably. +* When updating zone dimensions, both horizontal and vertical directions must +* be provided with their respective updated_mask bits set. +* +* Zone weights control each zone's contribution to the global statistics. +* A weight of 0 excludes the zone; values 1..14 represent weights of +* 1/16..14/16 and 15 applies the full weight. Per-zone results are not weighted. +* +* Set header.type to the target from &enum mali_c720_param_block_type. +* See &enum mali_c720_params_color_stats_mask for the @updated_mask bit positions. +* Undefined bits are reserved and must be set to zero. +* +* @header: The generic V4L2 ISP block header +* @updated_mask: Mask of configuration fields to update +* @nodes_used_horiz: Number of horizontal zones [3..32] +* @nodes_used_vert: Number of vertical zones [3..255], subject to the total +* zone limit above +* @awb_stats_mode: Ratio mode, see &enum mali_c720_awb_stats_mode +* @reserved: Reserved; set to zero +* @white_level_awb: Upper pixel intensity limit (exclusive), 14-bit [0..16383] +* @black_level_awb: Lower pixel intensity limit (exclusive), 14-bit [0..16383] +* @cr_ref_max_awb: Maximum R/G ratio, unsigned Q4.8 [0..4095] +* @cr_ref_min_awb: Minimum R/G ratio, unsigned Q4.8 [0..4095] +* @cr_ref_high_awb: R/G ratio trim high, unsigned Q4.8 [0..4095] +* @cr_ref_low_awb: R/G ratio trim low, unsigned Q4.8 [0..4095] +* @cb_ref_max_awb: Maximum B/G ratio, unsigned Q4.8 [0..4095] +* @cb_ref_min_awb: Minimum B/G ratio, unsigned Q4.8 [0..4095] +* @cb_ref_high_awb: B/G ratio trim high, unsigned Q4.8 [0..4095] +* @cb_ref_low_awb: B/G ratio trim low, unsigned Q4.8 [0..4095] +* @weights: Zone weights in row-major order from the top left, one byte per +* zone [0..15]. Index is y * nodes_used_horiz + x. +*/ +struct mali_c720_params_color_stats { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u8 nodes_used_horiz; +__u8 nodes_used_vert; +__u8 awb_stats_mode; +__u8 reserved; +__u16 white_level_awb; +__u16 black_level_awb; +__u16 cr_ref_max_awb; +__u16 cr_ref_min_awb; +__u16 cr_ref_high_awb; +__u16 cr_ref_low_awb; +__u16 cb_ref_max_awb; +__u16 cb_ref_min_awb; +__u16 cb_ref_high_awb; +__u16 cb_ref_low_awb; +__u8 weights[MALI_C720_MAX_ZONES ]; +}; + +/** +* enum mali_c720_histogram_input - Input for pre-Iridix histograms +* @MALI_C720_HISTOGRAM_INPUT_RAW: Raw Bayer data +* @MALI_C720_HISTOGRAM_INPUT_LUMA: Luminance data +*/ +enum mali_c720_histogram_input { +MALI_C720_HISTOGRAM_INPUT_RAW =0 , +MALI_C720_HISTOGRAM_INPUT_LUMA =1 , +}; + +/** +* enum mali_c720_histogram_skip_x - Horizontal pixel skipping +* @MALI_C720_HISTOGRAM_SKIP_X_EVERY_2ND: Collect every 2nd pixel horizontally +* @MALI_C720_HISTOGRAM_SKIP_X_EVERY_3RD: Collect every 3rd pixel horizontally +* @MALI_C720_HISTOGRAM_SKIP_X_EVERY_4TH: Collect every 4th pixel horizontally +* @MALI_C720_HISTOGRAM_SKIP_X_EVERY_5TH: Collect every 5th pixel horizontally +* @MALI_C720_HISTOGRAM_SKIP_X_EVERY_8TH: Collect every 8th pixel horizontally +* @MALI_C720_HISTOGRAM_SKIP_X_EVERY_9TH: Collect every 9th pixel horizontally +*/ +enum mali_c720_histogram_skip_x { +MALI_C720_HISTOGRAM_SKIP_X_EVERY_2ND =0 , +MALI_C720_HISTOGRAM_SKIP_X_EVERY_3RD =1 , +MALI_C720_HISTOGRAM_SKIP_X_EVERY_4TH =2 , +MALI_C720_HISTOGRAM_SKIP_X_EVERY_5TH =3 , +MALI_C720_HISTOGRAM_SKIP_X_EVERY_8TH =4 , +MALI_C720_HISTOGRAM_SKIP_X_EVERY_9TH =5 , +}; + +/** +* enum mali_c720_histogram_skip_y - Vertical pixel skipping +* @MALI_C720_HISTOGRAM_SKIP_Y_ALL: Collect every row +* @MALI_C720_HISTOGRAM_SKIP_Y_EVERY_2ND: Collect every 2nd row +* @MALI_C720_HISTOGRAM_SKIP_Y_EVERY_3RD: Collect every 3rd row +* @MALI_C720_HISTOGRAM_SKIP_Y_EVERY_4TH: Collect every 4th row +* @MALI_C720_HISTOGRAM_SKIP_Y_EVERY_5TH: Collect every 5th row +* @MALI_C720_HISTOGRAM_SKIP_Y_EVERY_8TH: Collect every 8th row +* @MALI_C720_HISTOGRAM_SKIP_Y_EVERY_9TH: Collect every 9th row +*/ +enum mali_c720_histogram_skip_y { +MALI_C720_HISTOGRAM_SKIP_Y_ALL =0 , +MALI_C720_HISTOGRAM_SKIP_Y_EVERY_2ND =1 , +MALI_C720_HISTOGRAM_SKIP_Y_EVERY_3RD =2 , +MALI_C720_HISTOGRAM_SKIP_Y_EVERY_4TH =3 , +MALI_C720_HISTOGRAM_SKIP_Y_EVERY_5TH =4 , +MALI_C720_HISTOGRAM_SKIP_Y_EVERY_8TH =5 , +MALI_C720_HISTOGRAM_SKIP_Y_EVERY_9TH =6 , +}; + +/** +* enum mali_c720_histogram_row_column_offset - Starting row or column +* @MALI_C720_HISTOGRAM_FIRST_ROW_OR_COL: Start from the first row or column +* @MALI_C720_HISTOGRAM_SECOND_ROW_OR_COL: Start from the second row or column +*/ +enum mali_c720_histogram_row_column_offset { +MALI_C720_HISTOGRAM_FIRST_ROW_OR_COL =0 , +MALI_C720_HISTOGRAM_SECOND_ROW_OR_COL =1 , +}; + +/** +* enum mali_c720_histogram_scale - Intensity range scaling +* @MALI_C720_HISTOGRAM_SCALE_1X: No scaling +* @MALI_C720_HISTOGRAM_SCALE_2X: Scale by 2 +* @MALI_C720_HISTOGRAM_SCALE_4X: Scale by 4 +* @MALI_C720_HISTOGRAM_SCALE_8X: Scale by 8 +* @MALI_C720_HISTOGRAM_SCALE_16X: Scale by 16 +*/ +enum mali_c720_histogram_scale { +MALI_C720_HISTOGRAM_SCALE_1X =0 , +MALI_C720_HISTOGRAM_SCALE_2X =1 , +MALI_C720_HISTOGRAM_SCALE_4X =2 , +MALI_C720_HISTOGRAM_SCALE_8X =3 , +MALI_C720_HISTOGRAM_SCALE_16X =4 , +}; + +/** +* enum mali_c720_histogram_plane_mode - Mode for histogram collection +* @MALI_C720_HISTOGRAM_COMBINED: All color planes in one 1024-bin histogram +* with a bin width of 16384 +* @MALI_C720_HISTOGRAM_SEPARATE: Each color plane in one 256-bin histogram +* with a bin width of 65536 +* @MALI_C720_HISTOGRAM_SEPARATE_ALL: As %MALI_C720_HISTOGRAM_SEPARATE, without +* pixel skipping; ignores skip and offset fields +* @MALI_C720_HISTOGRAM_FOCUS_00: Top left plane in the first bank, rest in second bank +* @MALI_C720_HISTOGRAM_FOCUS_01: Top right plane in the first bank, rest in second bank +* @MALI_C720_HISTOGRAM_FOCUS_10: Bottom left plane in the first bank, rest in second bank +* @MALI_C720_HISTOGRAM_FOCUS_11: Bottom right plane in the first bank, rest in second bank +* +* In the "focus" modes statistics are collected into two 512-bin histograms +* with a bin width of 32768. One color plane is in the first histogram with +* the remainder combined into the second. The four options represent which +* of the four positions in a Bayer pattern is the focused plane. +* +* Bin widths are expressed in 24-bit input levels with intensity scaling set +* to %MALI_C720_HISTOGRAM_SCALE_1X. Value 3 is reserved. +*/ +enum mali_c720_histogram_plane_mode { +MALI_C720_HISTOGRAM_COMBINED =0 , +MALI_C720_HISTOGRAM_SEPARATE =1 , +MALI_C720_HISTOGRAM_SEPARATE_ALL =2 , +MALI_C720_HISTOGRAM_FOCUS_00 =4 , +MALI_C720_HISTOGRAM_FOCUS_01 =5 , +MALI_C720_HISTOGRAM_FOCUS_10 =6 , +MALI_C720_HISTOGRAM_FOCUS_11 =7 , +}; + +enum mali_c720_params_histogram_mask { +MALI_C720_PARAMS_HISTOGRAM_MASK_STREAM_MUX_SEL , +MALI_C720_PARAMS_HISTOGRAM_MASK_NODES_USED_HORIZ , +MALI_C720_PARAMS_HISTOGRAM_MASK_NODES_USED_VERT , +MALI_C720_PARAMS_HISTOGRAM_MASK_SKIP_X , +MALI_C720_PARAMS_HISTOGRAM_MASK_SKIP_Y , +MALI_C720_PARAMS_HISTOGRAM_MASK_OFFSET_X , +MALI_C720_PARAMS_HISTOGRAM_MASK_OFFSET_Y , +MALI_C720_PARAMS_HISTOGRAM_MASK_SCALE_BOTTOM , +MALI_C720_PARAMS_HISTOGRAM_MASK_SCALE_TOP , +MALI_C720_PARAMS_HISTOGRAM_MASK_PLANE_MODE , +MALI_C720_PARAMS_HISTOGRAM_MASK_WEIGHTS , +}; + +/** +* struct mali_c720_params_histogram - Histogram configuration +* +* This struct configures the 1024-bin histograms. The parameters allow +* particular regions of the image to be masked and different kinds of +* histogram to be selected. +* +* The @skip_x, @offset_x, @skip_y and @offset_y fields select pixels by their +* position relative to the top left of the image. These fields reduce the +* number of pixels counted, but some combinations exclude entire Bayer color +* components. +* +* The zone dimensions define the spatial weighting grid, whose total number +* of zones must not exceed MALI_C720_MAX_ZONES (1024). A zero weight +* excludes the zone from the histogram. +* When updating zone dimensions, both horizontal and vertical directions must +* be provided with their respective updated_mask bits set. +* +* @scale_bottom and @scale_top increase bin resolution at the dark and bright +* ends of the input range respectively. Samples outside the selected ranges +* do not contribute to the histogram. +* +* Set header.type to the target from &enum mali_c720_param_block_type. +* See &enum mali_c720_params_histogram_mask for the @updated_mask bit positions. +* Undefined bits are reserved and must be set to zero. +* +* @header: The generic V4L2 ISP block header +* @updated_mask: Mask of configuration fields to update +* @stream_mux_select: Input selection for pre-Iridix histograms. See +* &enum mali_c720_histogram_input. Ignored for other targets. +* @nodes_used_horiz: Number of active zones horizontally [1..255], subject to the total +* zone limit above +* @nodes_used_vert: Number of active zones vertically [1..255], subject to the total +* zone limit above +* @skip_x: Horizontal decimation. See &enum mali_c720_histogram_skip_x +* @skip_y: Vertical decimation. See &enum mali_c720_histogram_skip_y +* @offset_x: Skip the first column, or not. See &enum mali_c720_histogram_row_column_offset +* @offset_y: Skip the first row, or not. See &enum mali_c720_histogram_row_column_offset. +* With @skip_y set to %MALI_C720_HISTOGRAM_SKIP_Y_ALL, this selects +* the starting column on alternate rows instead. +* @scale_bottom: Scale pixels in the bottom half of the intensity range. +* See &enum mali_c720_histogram_scale +* @scale_top: Scale pixels in the top half of the intensity range. +* See &enum mali_c720_histogram_scale +* @plane_mode: Plane separation mode. See &enum mali_c720_histogram_plane_mode +* @reserved: Reserved; set to zero +* @weights: Zone weighting, one byte per zone, starting at the top left and +* continuing in raster order. Each zone can be weighted in [0..15]. +* The grid has @nodes_used_horiz columns and @nodes_used_vert rows. +*/ +struct mali_c720_params_histogram { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u8 stream_mux_select; +__u8 nodes_used_horiz; +__u8 nodes_used_vert; +__u8 skip_x; +__u8 skip_y; +__u8 offset_x; +__u8 offset_y; +__u8 scale_bottom; +__u8 scale_top; +__u8 plane_mode; +__u8 reserved[2 ]; +__u8 weights[MALI_C720_MAX_ZONES ]; +}; + +/** +* MALI_C720_PARAMS_MAX_SIZE - Maximum size of all parameters for Mali-C720 +* in a full hardware configuration. +* +* Though the parameters for the Mali-C720 are passed as optional blocks, the +* driver still needs to know the absolute maximum size so that it can allocate +* a buffer sized appropriately to accommodate userspace attempting to set all +* possible parameters in a single frame. +* +* Some structs are in this list multiple times. Where that's the case, it just +* reflects the fact that several block identifiers share the same payload +* structure. +*/ +#define MALI_C720_PARAMS_MAX_SIZE \ + (sizeof(struct mali_c720_params_digital_gain) + \ + sizeof(struct mali_c720_params_histogram) + \ + sizeof(struct mali_c720_params_awb_gains) + \ + sizeof(struct mali_c720_params_histogram) + \ + sizeof(struct mali_c720_params_histogram) + \ + sizeof(struct mali_c720_params_color_stats) + \ + sizeof(struct mali_c720_params_black_level) + \ + sizeof(struct mali_c720_params_sqrt) + \ + sizeof(struct mali_c720_params_square) + \ + sizeof(struct mali_c720_params_square) + \ + sizeof(struct mali_c720_params_sqrt) + \ + sizeof(struct mali_c720_params_decompander))#endif
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 21/24] media: uapi: Add parameter structs to mali-c720-config.h
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Low] media: uapi: implicit trailing padding in mali-c720 parameter structs - [Low] media: uapi…
Thank you for your contribution! Sashiko AI review found 3 potential issues to consider:
- [Low] media: uapi: implicit trailing padding in mali-c720 parameter structs
- [Low] media: uapi: undocumented MALI_C720_PARAM_BLOCK_MAX in kernel-doc
- [Low] media: uapi: missing kernel-doc on mali_c720_params_*_mask enums --
commit e1aa4f73c1087846692d06506ff1d937ae9e0835
Author: Anthony McGivern <[email protected]>
media: uapi: Add parameter structs to mali-c720-config.h
This commit adds the UAPI parameter block structures, mask enums, and V4L2_CID_MALI_C720_PARAM_CAPABILITIES control ID to mali-c720-config.h.
Quoted 4 lines
include/uapi/linux/media/arm/mali-c720-config.h +0
-0
[ ... ]
Quoted 29 lines
include/uapi/linux/media/arm/mali-c720-config.h +25
-0@@ -179,6 +181,558 @@ struct mali_c720_stats_histogram { sizeof(struct mali_c720_stats_histogram) + \ sizeof(struct mali_c720_stats_histogram)) +/** +* enum mali_c720_param_block_type - Mali-C720 parameter block targets +* +* @MALI_C720_PARAM_BLOCK_DIGITAL_GAIN_INP: Digital gain for the input pipeline. +* @MALI_C720_PARAM_BLOCK_HISTOGRAM_INP: Histogram configuration for the input pipeline. +* @MALI_C720_PARAM_BLOCK_AWB_GAINS_HV: Auto-white balance gains for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_HISTOGRAM_HV: HV histogram configuration (pre-Iridix). +* @MALI_C720_PARAM_BLOCK_HISTOGRAM_HV_IRIDIX: HV histogram configuration (post-Iridix). +* @MALI_C720_PARAM_BLOCK_COLOR_STATS_HV: Color stats configuration for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_BLACK_LEVEL_HV: Black level offsets for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_SQRT_INP: Square root configuration for the input pipeline. +* @MALI_C720_PARAM_BLOCK_SQUARE_A_HV: Square A configuration for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_SQUARE_B_HV: Square B configuration for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_SQRT_HV: Square root configuration for the HV pipeline. +* @MALI_C720_PARAM_BLOCK_DECOMPANDER_INP: Decompander configuration. +* +* Each identifier selects one logical module and instance. Applications can +* query V4L2_CID_MALI_C720_PARAM_CAPABILITIES for the targets present on the +* device. The control returns a read-only U16 array of supported identifiers. +*/ +enum mali_c720_param_block_type { +MALI_C720_PARAM_BLOCK_DIGITAL_GAIN_INP , +MALI_C720_PARAM_BLOCK_HISTOGRAM_INP , +MALI_C720_PARAM_BLOCK_AWB_GAINS_HV , +MALI_C720_PARAM_BLOCK_HISTOGRAM_HV ,
include/uapi/linux/media/arm/mali-c720-config.h struct mali_c720_stats_histogram { · line 218
Quoted 10 lines
include/uapi/linux/media/arm/mali-c720-config.h +10
-0+MALI_C720_PARAM_BLOCK_HISTOGRAM_HV_IRIDIX , +MALI_C720_PARAM_BLOCK_COLOR_STATS_HV , +MALI_C720_PARAM_BLOCK_BLACK_LEVEL_HV , +MALI_C720_PARAM_BLOCK_SQRT_INP , +MALI_C720_PARAM_BLOCK_SQUARE_A_HV , +MALI_C720_PARAM_BLOCK_SQUARE_B_HV , +MALI_C720_PARAM_BLOCK_SQRT_HV , +MALI_C720_PARAM_BLOCK_DECOMPANDER_INP , + MALI_C720_PARAM_BLOCK_MAX, +};
[Severity: Low]
Should MALI_C720_PARAM_BLOCK_MAX either be documented in the kernel-doc comment or marked with /* private: */? Without one of those, kernel-doc emits a warning that MALI_C720_PARAM_BLOCK_MAX is not described in enum mali_c720_param_block_type.
Quoted 7 lines
include/uapi/linux/media/arm/mali-c720-config.h +6
-0+#define V4L2_CID_MALI_C720_STATS_CAPABILITIES (V4L2_CID_USER_MALI_C720_BASE + 0) +#define V4L2_CID_MALI_C720_PARAM_CAPABILITIES (V4L2_CID_USER_MALI_C720_BASE + 1) + +enum mali_c720_params_digital_gain_mask { +MALI_C720_PARAMS_DIGITAL_GAIN_MASK_GAIN , +MALI_C720_PARAMS_DIGITAL_GAIN_MASK_OFFSET ,
include/uapi/linux/media/arm/mali-c720-config.h struct mali_c720_stats_histogram { · line 235
Quoted 10 lines
include/uapi/linux/media/arm/mali-c720-config.h +10
-0+}; + +/** +* struct mali_c720_params_digital_gain - Digital gain settings +* +* This struct configures the digital gain and a common black level for all +* color channels. +* +* Set header.type to the target from &enum mali_c720_param_block_type. +* See &enum mali_c720_params_digital_gain_mask for the @updated_mask bit positions.
[Severity: Low]
Should enum mali_c720_params_digital_gain_mask and the other six mali_c720_params_*_mask enums in this header have kernel-doc comments? Each parameter struct's kernel-doc links to its mask enum via &enum mali_c720_params_*_mask, so without kernel-doc on the enums they are omitted from the generated UAPI documentation and those Sphinx cross-references remain unresolved.
[ ... ]
Quoted 7 lines
include/uapi/linux/media/arm/mali-c720-config.h +7
-0+struct mali_c720_params_sqrt { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u32 normalization; +__u32 black_level_linear; +__u16 black_level_sqrt; +};
[ ... ]
Quoted 7 lines
include/uapi/linux/media/arm/mali-c720-config.h +7
-0+struct mali_c720_params_square { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u32 black_level_linear; +__u32 black_level_sqrt; +__u32 normalization; +};
[ ... ]
Quoted 8 lines
include/uapi/linux/media/arm/mali-c720-config.h +8
-0+struct mali_c720_params_decompander { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u8 enable; +__u8 reserved[3 ]; +__u32 lut_x[MALI_C720_NUM_DECOMPANDER_LUT_ELEMENTS ]; +__u32 lut_y[MALI_C720_NUM_DECOMPANDER_LUT_ELEMENTS ]; +};
[ ... ]
Quoted 6 lines
include/uapi/linux/media/arm/mali-c720-config.h +6
-0+struct mali_c720_params_histogram { +struct v4l2_isp_block_header header; +__u64 updated_mask; +__u8 stream_mux_select; +__u8 nodes_used_horiz; +__u8 nodes_used_vert;
include/uapi/linux/media/arm/mali-c720-config.h struct mali_c720_stats_histogram { · line 709
Quoted 10 lines
include/uapi/linux/media/arm/mali-c720-config.h +10
-0+__u8 skip_x; +__u8 skip_y; +__u8 offset_x; +__u8 offset_y; +__u8 scale_bottom; +__u8 scale_top; +__u8 plane_mode; +__u8 reserved[2 ]; +__u8 weights[MALI_C720_MAX_ZONES ]; +};
[Severity: Low]
Should struct mali_c720_params_sqrt, struct mali_c720_params_square, struct mali_c720_params_decompander, and struct mali_c720_params_histogram pad out to their 8-byte alignment boundary with explicit reserved fields?
Because struct v4l2_isp_block_header and updated_mask require 8-byte alignment, the compiler adds unnamed trailing padding to each of these four UAPI structs (6 bytes in mali_c720_params_sqrt, and 4 bytes each in mali_c720_params_square, mali_c720_params_decompander, and mali_c720_params_histogram where reserved[2] only aligns to a 4-byte boundary). That leaves implicit padding in the serialized buffer layout that triggers -Wpadded warnings and cannot be zeroed or validated via named reserved fields.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=21
PATCH 22/24 media: mali-c720: Add parameters video node
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add a metadata output node for userspace to configure ISP processing.
Validate and copy queued parameter data before applying it to the context register image. The ISP's configuration DMA engine (CDMA) loads these settings before processing the frame.
Initial support includes statistics configuration, digital gain, white balance, black level correction, square/square-root transformations and input decompanding. Available parameter blocks are reported through a read-only capability control.
--- drivers/media/platform/arm/mali-c720/Makefile | 1 + .../platform/arm/mali-c720/mali-c720-common.h | 49 + .../media/platform/arm/mali-c720/mali-c720-core.c | 25 +- .../platform/arm/mali-c720/mali-c720-ctx-mgr.c | 1 + .../media/platform/arm/mali-c720/mali-c720-isp.c | 27 +- .../platform/arm/mali-c720/mali-c720-params.c | 1450 ++++++++++++++++++++ 6 files changed, 1549 insertions(+), 4 deletions(-)
drivers/media/platform/arm/mali-c720/Makefile +1 -0
@@ -10,6 +10,7 @@ mali-c720-y := mali-c720-capture.o \ mali-c720-input.o \ mali-c720-interrupts.o \ mali-c720-isp.o \ + mali-c720-params.o \ mali-c720-register-access.o \ mali-c720-registers.o \ mali-c720-registers-top.o \
drivers/media/platform/arm/mali-c720/mali-c720-common.h +49 -0
85 lines not on this page · raw message
drivers/media/platform/arm/mali-c720/mali-c720-core.c +24 -1
@@ -47,6 +47,7 @@ static void mali_c720_remove_links(struct mali_c720 *mali_c720)media_entity_remove_links (&mali_c720->cap_devs[i].vdev.entity);media_entity_remove_links (&mali_c720->stats.vdev.entity); +media_entity_remove_links (&mali_c720->params.vdev.entity); } static int mali_c720_create_tpg_links(struct mali_c720 *mali_c720,
@@ -159,6 +160,13 @@ static int mali_c720_create_3a_links(struct mali_c720 *mali_c720)return ret; } + ret =media_create_pad_link (&mali_c720->params.vdev.entity,0 , + &isp_sd->entity, +MALI_C720_ISP_PAD_SINK_PARAMS , +0 ); +if (ret) +dev_err (mali_c720->dev,"Failed to link 3A params node and ISP\n" ); +return ret; }
@@ -206,6 +214,7 @@ static void mali_c720_unregister_video_devices(struct mali_c720 *mali_c720)mali_c720_unregister_capture_devs (mali_c720);mali_c720_unregister_stats (mali_c720); +mali_c720_unregister_params (mali_c720); }static void mali_c720_unregister_entities (struct mali_c720 *mali_c720)
@@ -250,6 +259,10 @@ static int mali_c720_register_entities(struct mali_c720 *mali_c720)if (ret) goto err_unregister_entities; + ret =mali_c720_register_params (mali_c720); +if (ret) + goto err_unregister_entities; + ret =mali_c720_create_links (mali_c720);if (ret) goto err_unregister_entities;
@@ -371,6 +384,7 @@ static void mali_c720_release(struct v4l2_device *v4l2_dev)mali_c720_cleanup_capture_devs (mali_c720);mali_c720_cleanup_stats (mali_c720); +mali_c720_cleanup_params (mali_c720);mali_c720_cleanup_fr_pipe (mali_c720);mali_c720_cleanup_vision_pipe (mali_c720);mali_c720_cleanup_isp (mali_c720);
@@ -608,6 +622,9 @@ static struct media_request *mali_c720_find_request(struct mali_c720 *mali_c720) candidate =mali_c720_stats_get_request (&mali_c720->stats); req =mali_c720_oldest_request (NULL , candidate); + candidate =mali_c720_params_get_request (&mali_c720->params); + req =mali_c720_oldest_request (req, candidate); +for (i =0 ; i <MALI_C720_MAX_NUM_CAP_DEVS ; i++) { candidate =mali_c720_cap_dev_get_request (&mali_c720->cap_devs[i]); req =mali_c720_oldest_request (req, candidate);
@@ -620,7 +637,8 @@ static bool mali_c720_uses_requests(struct mali_c720 *mali_c720) {unsigned int i; -if (mali_c720_stats_uses_requests (&mali_c720->stats)) +if (mali_c720_stats_uses_requests (&mali_c720->stats) || +mali_c720_params_uses_requests (&mali_c720->params))return true;for (i =0 ; i <MALI_C720_MAX_NUM_CAP_DEVS ; i++) {
@@ -651,6 +669,7 @@ static struct media_request *mali_c720_can_schedule_request(struct mali_c720_convoid mali_c720_try_schedule_frame (struct mali_c720_context *ctx) {struct mali_c720 *mali_c720 = ctx->mali_c720; +struct mali_c720_params_buf *params_buf =NULL ;struct media_request *req =NULL ;unsigned int i;
@@ -673,6 +692,7 @@ void mali_c720_try_schedule_frame(struct mali_c720_context *ctx)mali_c720_cap_dev_set_next_buffer (&mali_c720->cap_devs[i], req);mali_c720_stats_set_next_buffer (&mali_c720->stats, req); + params_buf =mali_c720_params_get_next_buffer (&mali_c720->params, req); } ctx->pipeline_busy = true;
@@ -681,6 +701,9 @@ void mali_c720_try_schedule_frame(struct mali_c720_context *ctx)/* Resizer configurations should be synchronised with CDMA */ mali_c720_fr_pipe_apply_resizer_config (&mali_c720->fr_pipe); +if (params_buf) +mali_c720_params_apply_config (mali_c720, params_buf); +mali_c720_ctx_mgr_handle_sw_ready (ctx); }
drivers/media/platform/arm/mali-c720/mali-c720-ctx-mgr.c +1 -0
@@ -1426,6 +1426,7 @@ void mali_c720_ctx_mgr_buffer_done(struct mali_c720_context *ctx, bool success)mali_c720_cap_dev_buffer_done (&mali_c720->cap_devs[i], success);mali_c720_stats_buffer_done (&mali_c720->stats, success); +mali_c720_params_buffer_done (&mali_c720->params, success); }void mali_c720_ctx_mgr_handle_sw_ready (struct mali_c720_context *ctx)
drivers/media/platform/arm/mali-c720/mali-c720-isp.c +24 -3
@@ -23,7 +23,8 @@ static int mali_c720_isp_enum_mbus_code(struct v4l2_subdev *sd,struct mali_c720_mbus_format_match match;/* HV uses the sink Bayer order at the internal 16-bit precision. */ -if (code->pad ==MALI_C720_ISP_PAD_SOURCE_STATS ) { +if (code->pad ==MALI_C720_ISP_PAD_SOURCE_STATS || + code->pad ==MALI_C720_ISP_PAD_SINK_PARAMS ) {if (code->index)return -EINVAL ; code->code =MEDIA_BUS_FMT_METADATA_FIXED ;
@@ -94,6 +95,7 @@ static int mali_c720_isp_enum_frame_size(struct v4l2_subdev *sd,return -EINVAL ;break ;case MALI_C720_ISP_PAD_SOURCE_STATS : +case MALI_C720_ISP_PAD_SINK_PARAMS :return -ENOTTY ;default :return -EINVAL ;
@@ -298,7 +300,7 @@ static const struct v4l2_subdev_ops mali_c720_isp_ops = {static int mali_c720_isp_init_state (struct v4l2_subdev *sd,struct v4l2_subdev_state *state) { -struct v4l2_mbus_framefmt *sink_fmt, *src_fmt, *stats_fmt; +struct v4l2_mbus_framefmt *sink_fmt, *src_fmt, *stats_fmt, *params_fmt; sink_fmt =v4l2_subdev_state_get_format (state,MALI_C720_ISP_PAD_SINK_VIDEO ); sink_fmt->width =MALI_C720_DEFAULT_WIDTH ;
@@ -320,6 +322,12 @@ static int mali_c720_isp_init_state(struct v4l2_subdev *sd, stats_fmt->field =V4L2_FIELD_NONE ; stats_fmt->code =MEDIA_BUS_FMT_METADATA_FIXED ; + params_fmt =v4l2_subdev_state_get_format (state,MALI_C720_ISP_PAD_SINK_PARAMS ); + params_fmt->width =0 ; + params_fmt->height =0 ; + params_fmt->field =V4L2_FIELD_NONE ; + params_fmt->code =MEDIA_BUS_FMT_METADATA_FIXED ; +return 0 ; }
@@ -357,9 +365,21 @@ static int mali_c720_isp_subdev_link_setup(struct media_entity *entity,return 0 ; } +static int mali_c720_isp_subdev_link_validate (struct media_link *link) +{ +/* +* Skip validation for the parameters sink pad, as the source is not +* a subdevice. +*/ +if (link->sink->index ==MALI_C720_ISP_PAD_SINK_PARAMS ) +return 0 ; + +return v4l2_subdev_link_validate (link); +} +static const struct media_entity_operations mali_c720_isp_media_ops = { .link_setup = mali_c720_isp_subdev_link_setup, - .link_validate = v4l2_subdev_link_validate, + .link_validate = mali_c720_isp_subdev_link_validate, };int mali_c720_register_isp (struct mali_c720 *mali_c720)
@@ -383,6 +403,7 @@ int mali_c720_register_isp(struct mali_c720 *mali_c720)MEDIA_PAD_FL_MUST_CONNECT ; isp->pads[MALI_C720_ISP_PAD_SOURCE_HV ].flags =MEDIA_PAD_FL_SOURCE ; isp->pads[MALI_C720_ISP_PAD_SOURCE_STATS ].flags =MEDIA_PAD_FL_SOURCE ; + isp->pads[MALI_C720_ISP_PAD_SINK_PARAMS ].flags =MEDIA_PAD_FL_SINK ; ret = media_entity_pads_init(&sd->entity, MALI_C720_ISP_NUM_PADS,
drivers/media/platform/arm/mali-c720/mali-c720-params.c new file +1450 -0
1,450 lines not on this page · raw message
Signature · 1 line
2.55.0
[email protected]
AI reviewRe: [PATCH 22/24] media: mali-c720: Add parameters video node
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [High] media: mali-c720: fortify_panic() in mali_c720_params_buf_prepare() --
Thank you for your contribution! Sashiko AI review found 1 potential issue to consider:
- [High] media: mali-c720: fortify_panic() in mali_c720_params_buf_prepare()
--
commit e3100256e90cde8dbdd6f531f1884f00ae417d6f
Author: Anthony McGivern <[email protected]>
media: mali-c720: Add parameters video node
This commit adds a metadata output video node that validates and copies queued userspace ISP parameter blocks into the context register image for CDMA loading.
Quoted 5 lines
drivers/media/platform/arm/mali-c720/mali-c720-params.c new file +0
-0
[ ... ]
Quoted 21 lines
drivers/media/platform/arm/mali-c720/mali-c720-params.c new file +21
-0+static int mali_c720_params_buf_prepare (struct vb2_buffer *vb) +{ +struct mali_c720_params *params =vb2_get_drv_priv (vb->vb2_queue); +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +struct mali_c720_params_buf *buf =to_mali_c720_params_buf (vbuf); +struct mali_c720 *mali_c720 = params->mali_c720; +struct v4l2_isp_params_buffer *config =vb2_plane_vaddr (vb,0 ); +struct dma_buf *dbuf = vb->planes[0 ].dbuf; +size_t block_offset =0 ; +int ret; + + ret =v4l2_isp_params_validate_buffer_size (mali_c720->dev, + vb, +v4l2_isp_buffer_size + (MALI_C720_PARAMS_MAX_SIZE )); +if (ret) +return ret; + +if (dbuf) { + ret =dma_buf_begin_cpu_access (dbuf,DMA_FROM_DEVICE ); +if (ret)
drivers/media/platform/arm/mali-c720/mali-c720-params.c line 1101
Quoted 10 lines
drivers/media/platform/arm/mali-c720/mali-c720-params.c new file +10
-0+return ret; + } + +/* +* Copy the parameters buffer provided by userspace to the internal +* scratch buffer. This protects against the chance of userspace making +* changes to the buffer content whilst the driver processes it. +*/ +memcpy (buf->config, config, +v4l2_isp_buffer_size (MALI_C720_PARAMS_MAX_SIZE ));
[Severity: High]
Can this memcpy() trigger a fortify_panic() when CONFIG_FORTIFY_SOURCE and CONFIG_CC_HAS_COUNTED_BY are enabled?
Both buf->config and config are typed as struct v4l2_isp_params_buffer * (an alias of struct v4l2_isp_buffer), which declares its flexible array as:
include/uapi/linux/media/v4l2-isp.h:
struct v4l2_isp_buffer {
__u32 version;
__u32 data_size;
__u8 data[] __counted_by(data_size);
};Fortified memcpy() evaluates __builtin_dynamic_object_size() on both pointers using offsetof(struct v4l2_isp_buffer, data) + ptr->data_size. At this point buf->config->data_size has not been populated yet (holding 0 or a prior frame's size), and config->data_size is smaller than MALI_C720_PARAMS_MAX_SIZE whenever userspace queues a subset of parameter blocks, so the bounds check against v4l2_isp_buffer_size(MALI_C720_PARAMS_MAX_SIZE) fails and panics the kernel.
Typing config as void * (or copying through a void * destination before populating data_size, as v4l2_isp_params_validate_buffer() does) avoids evaluating the __counted_by(data_size) bound during the copy.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=22
PATCH 23/24 media: Documentation: Document Mali-C720 parameter settings
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Document ISP parameter configuration and querying supported parameter blocks through the capability control. Describe the parameter buffer layout and provide an example of populating the configuration blocks.
--- .../admin-guide/media/mali-c720-graph.dot | 4 +- Documentation/admin-guide/media/mali-c720.rst | 46 ++++++++++--- .../userspace-api/media/drivers/mali-c720.rst | 14 ++-- .../media/v4l/metafmt-arm-mali-c720.rst | 78 +++++++++++++++++++++- 4 files changed, 125 insertions(+), 17 deletions(-)
Documentation/admin-guide/media/mali-c720-graph.dot +3 -1
@@ -6,7 +6,7 @@ digraph board { n00000003:port0 -> n00000009:port1 [style=dashed] n00000009 [label="{{<port1> 1} | mali-c720 input\n/dev/v4l-subdev2 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green] n00000009:port0 -> n0000000c:port0 - n0000000c [label="{{<port0> 0} | mali-c720 isp\n/dev/v4l-subdev3 | {<port1> 1 | <port2> 2}}", shape=Mrecord, style=filled, fillcolor=green] + n0000000c [label="{{<port0> 0 | <port3> 3} | mali-c720 isp\n/dev/v4l-subdev3 | {<port1> 1 | <port2> 2}}", shape=Mrecord, style=filled, fillcolor=green] n0000000c:port1 -> n00000014:port0 n0000000c:port2 -> n0000006c [style=dashed] n00000014 [label="{{<port0> 0} | mali-c720 hv pipe\n/dev/v4l-subdev4 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
@@ -17,6 +17,8 @@ digraph board { n00000038 [label="mali-c720 fr0-rgb\n/dev/video0", shape=box, style=filled, fillcolor=yellow] n0000003c [label="mali-c720 fr0-yuv\n/dev/video1", shape=box, style=filled, fillcolor=yellow] n0000006c [label="mali-c720 3a stats\n/dev/video2", shape=box, style=filled, fillcolor=yellow] + n00000070 [label="mali-c720 3a params\n/dev/video3", shape=box, style=filled, fillcolor=yellow] + n00000070 -> n0000000c:port3 [style=dashed] n00000074 [label="{{<port0> 0} | csi2-rx\n/dev/v4l-subdev6 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] n00000074:port1 -> n00000009:port1 n00000079 [label="{{} | imx415 1-001a\n/dev/v4l-subdev7 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
Documentation/admin-guide/media/mali-c720.rst +37 -9
82 lines not on this page · raw message
Documentation/userspace-api/media/drivers/mali-c720.rst +10 -4
@@ -5,15 +5,19 @@ Arm Mali-C720 ISP driver ======================== -The Arm Mali-C720 ISP driver implements the following driver-specific control: +The Arm Mali-C720 ISP driver implements two driver-specific controls: + +``V4L2_CID_MALI_C720_PARAM_CAPABILITIES (__u16 array)`` + Lists the parameter block types accepted by the ISP. Each element is a + value from :c:type:`mali_c720_param_block_type`. ``V4L2_CID_MALI_C720_STATS_CAPABILITIES (__u16 array)`` Lists the statistics block types supported by the ISP. Each element is a value from :c:type:`mali_c720_stats_type`. -The Mali-C720 ISP can be configured to include or exclude statistics blocks. -This control allows the driver to communicate to userspace which statistics -block types are supported by the driver and present in the hardware. +The Mali-C720 ISP can be configured to include or exclude processing and +statistics blocks. These controls allow the driver to communicate to userspace +which block types are supported by the driver and present in the hardware. Format enumeration ------------------
@@ -31,6 +35,8 @@ Buffer alignment Image capture buffers require DMA base addresses aligned to 32 bytes. Statistics capture buffers require DMA base addresses aligned to 16 bytes. +Parameter buffers have no additional hardware DMA address alignment +requirement. Buffers allocated by the driver using MMAP satisfy these requirements automatically. Imported DMA-BUFs must provide suitable alignment.
Documentation/userspace-api/media/v4l/metafmt-arm-mali-c720.rst +75 -3
94 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 24/24 MAINTAINERS: Add entry for mali-c720 driver
In reply to Anthony McGivernFrom: Anthony McGivern <[email protected]>
Add a MAINTAINERS entry for the mali-c720 driver and its associated documentation.
--- MAINTAINERS | 13 +++++++++++++ 1 file changed, 13 insertions(+)
MAINTAINERS +13 -0
@@ -2392,6 +2392,19 @@ F: Documentation/userspace-api/media/v4l/metafmt-arm-mali-c55.rst F: drivers/media/platform/arm/mali-c55/ F: include/uapi/linux/media/arm/mali-c55-config.h +ARM MALI-C720 ISP DRIVER +M: Anthony McGivern <[email protected]> +M: Vincenzo Frascino <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/admin-guide/media/mali-c720-graph.dot +F: Documentation/admin-guide/media/mali-c720.rst +F: Documentation/devicetree/bindings/media/arm,mali-c720.yaml +F: Documentation/userspace-api/media/drivers/mali-c720.rst +F: Documentation/userspace-api/media/v4l/metafmt-arm-mali-c720.rst +F: drivers/media/platform/arm/mali-c720/ +F: include/uapi/linux/media/arm/mali-c720-config.h + ARM MALI PANTHOR DRM DRIVER M: Boris Brezillon <[email protected]> M: Steven Price <[email protected]>
Signature · 1 line
2.55.0