Amlogic C3 ISP support
Subsystems (5)
Keke Li
maintainerv9 cover Amlogic C3 ISP support
The Amlogic C3 platform integrates an ISP capable of supporting multi-camera, multi-exposure high dynamic range (HDR) imaging with up to 14-bit raw RGB Bayer data.
Capturing images on the C3 involves operating the CSI2 receiver and PHY, an adapter layer that integrates the inline processing from the PHY to the ISP, and the ISP driver itself.
This implementation consists of several distinct module drivers and is expected to support different platforms in the future.
---
Changes in v9:
- Update the documentation file c3-isp.rst
- Link to v8: https://lore.kernel.org/r/[email protected]
Changes in v8:
- Improve the commit message of the C3 ISP driver.
- Update the v4l2-compliance report.
- Link to v7: https://lore.kernel.org/r/[email protected]
Changes in v7:
- Modify the issue of an initialization field being overwritten in c3-isp-capture.c
- Link to v6: https://lore.kernel.org/r/[email protected]
Changes in v6:
- Drop assigned-clocks and assigned-clock-rates in amlogic,c3-mipi-csi2.yaml and remove the Review-by tag.
- Drop assigned-clocks and assigned-clock-rates in amlogic,c3-mipi-adapter.yaml and remove the Review-by tag.
- Drop assigned-clocks and assigned-clock-rates in amlogic,c3-isp.yaml and remove the Review-by tag.
- Add the reset configuration in c3-mipi-adap.c.
- Support RAW format output in ISP driver.
- Link to v5: https://lore.kernel.org/r/[email protected]
Changes in v5:
- Add assigned-clocks and assigned-clock-rates in amlogic,c3-mipi-csi2.yaml, amlogic,c3-mipi-adapter.yaml and amlogic,c3-isp.yaml.
- Remove clock rate configuration in c3-mipi-csi2.c, c3-mipi-adap.c and c3-isp-dev.c.
- Indenting with Tab in register macro definitions for all drivers.
- Support V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE in c3-isp-capture.c
- Enable and check frame start interruption in c3-isp-dev.c.
- Align struct c3_isp_params_xxx to 8 bytes in c3-isp-config.h
- Remove c3_mipi_csi_cfg_routing() and c3_mipi_csi_init_routing() in c3-mipi-csi2.c.
- Remove c3_mipi_adap_cfg_routing() and c3_mipi_adap_init_routing() in c3-mipi-adap.c.
- Remove c3_isp_core_cfg_routing() and c3_isp_core_init_routing() in c3-isp-core.c.
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- Create c3 directory in drivers/media/platform/amlogic/
- Move isp, mipi-adapter and mipi-csi2 drivers to c3 directory.
- Create amlogic directory in include/uapi/linux/media/
- Move c3-isp-config.h to include/uapi/linux/media/amlogic
- Add .enable_streams() and .disable_streams() interface
in c3-isp-resizer.c.
- Remove .set_routing() interface in c3-isp-core.c,
c3-mipi-adap.c and c3-mipi-csi2.c.
- Update the parameter comments in c3-isp-config.h
- Update the bit macros of register in c3-isp-regs.h, c3-mipi-adap.c and c3-mipi-csi2.c.
- Move parameters validation to .buf_prepare() in c3-isp-params.c.
- Add c3_isp_core_queue_eof() in c3-isp-core.c
- Improve the c3 ISP documentation in c3-isp.rst
- Update the v4l2-compliance report.
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Moved change log here.
- Use "port" instead of "ports" in amogic,c3-isp.yaml.
- Reworked c3_xxx_vb2_queue_setup() to meet the request for larger size.
- Reworked c3_mipi_csi_write(), c3_mipi_csi_update_bits() and c3_mipi_csi_update_bits() to return void.
- Reworked c3_mipi_xxx_set_fmt() to return v4l2_subdev_get_fmt()
in second "if" segment and delete the first "if" segment.
- Switched back to .remove() in struct platform_driver c3_xxx_driver.
- Adjusted from three lines to two lines in some places
where registers are changed.
- Rename the title of the drivers in MAINTAINERS file.
- Update the v4l2-compliance report.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Drop "minItems" and some blank lines in amlogic,c3-xxx.yaml.
- Rename items of the reg-names in amlogic,c3-mipi-csi2.yaml and amlogic,c3-mipi-adapter.yaml.
- Replace dev_err and return with dev_err_probe in probe function.
- Change clock[] to clocks[] in struct c3_xxx_info.
- Change clock_rate[] to clock_rates[] in struct c3_xxx_info.
- Change clock[] to clks[] in struct xxx_device.
- Link to v1: https://lore.kernel.org/r/[email protected]
The rest of this message is the v4l2-compliance report for the driver. The v4l2-compliance reports 4 failures and 2 warnings. The 2 warnings are from imx290 driver(drivers/media/i2c/imx290.c). The 4 failures are because height and width are set to 0 for MEDIA_BUS_FMT_METADATA_FIXED in isp-core subdev, but this is a document requiement.
v4l2-compliance 1.29.0-5246, 64 bits, 64-bit time_t v4l2-compliance SHA: 201ccf743cde 2024-09-06 07:16:29
Compliance test for c3-isp device /dev/media0:
Media Driver Info:
Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.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: 22 Links: 23 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK test MEDIA_IOC_SETUP_LINK: OK
Total for c3-isp device /dev/media0: 8, Succeeded: 8, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/video0:
Driver Info:
Driver name : c3-isp Card type : AML C3 ISP Bus info : platform:ff000000.isp Driver version : 6.15.0 Capabilities : 0x84201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Media Driver Info:
Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x0300001d Type : V4L Video Entity Info: ID : 0x0000001b (27) Name : c3-isp-cap0 Function : V4L2 I/O Pad 0x0100001c : 0: Sink Link 0x0200002f: from remote pad 0x100000a of entity 'c3-isp-resizer0' (Video Scaler): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (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)
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 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:
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 test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK
Total for c3-isp device /dev/video0: 49, Succeeded: 49, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/video1:
Driver Info:
Driver name : c3-isp Card type : AML C3 ISP Bus info : platform:ff000000.isp Driver version : 6.15.0 Capabilities : 0x84201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Media Driver Info:
Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x03000021 Type : V4L Video Entity Info: ID : 0x0000001f (31) Name : c3-isp-cap1 Function : V4L2 I/O Pad 0x01000020 : 0: Sink Link 0x02000033: from remote pad 0x100000d of entity 'c3-isp-resizer1' (Video Scaler): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/video1 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (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)
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 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:
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 test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK
Total for c3-isp device /dev/video1: 49, Succeeded: 49, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/video2:
Driver Info:
Driver name : c3-isp Card type : AML C3 ISP Bus info : platform:ff000000.isp Driver version : 6.15.0 Capabilities : 0x84201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04201000
Video Capture Multiplanar
Streaming
Extended Pix Format
Media Driver Info:
Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x03000025 Type : V4L Video Entity Info: ID : 0x00000023 (35) Name : c3-isp-cap2 Function : V4L2 I/O Pad 0x01000024 : 0: Sink Link 0x02000037: from remote pad 0x1000010 of entity 'c3-isp-resizer2' (Video Scaler): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/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 (Not Supported) 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)
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 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:
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 test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK
Total for c3-isp device /dev/video2: 49, Succeeded: 49, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/video3:
Driver Info:
Driver name : c3-isp Card type : AML C3 ISP Bus info : platform:ff000000.isp Driver version : 6.15.0 Capabilities : 0x84a00000
Metadata Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04a00000
Metadata Capture
Streaming
Extended Pix Format
Media Driver Info:
Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x03000029 Type : V4L Video Entity Info: ID : 0x00000027 (39) Name : c3-isp-stats Function : V4L2 I/O Pad 0x01000028 : 0: Sink Link 0x0200003b: from remote pad 0x1000004 of entity 'c3-isp-core' (Video Pixel Formatter): 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 (Not Supported) 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)
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 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:
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 test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK
Total for c3-isp device /dev/video3: 49, Succeeded: 49, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/video4:
Driver Info:
Driver name : c3-isp Card type : AML C3 ISP Bus info : platform:ff000000.isp Driver version : 6.15.0 Capabilities : 0x8c200000
Metadata Output
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x0c200000
Metadata Output
Streaming
Extended Pix Format
Media Driver Info:
Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x0300002d Type : V4L Video Entity Info: ID : 0x0000002b (43) Name : c3-isp-params Function : V4L2 I/O Pad 0x0100002c : 0: Source Link 0x0200003d: to remote pad 0x1000003 of entity 'c3-isp-core' (Video Pixel Formatter): 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/video4 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK
Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (Not Supported) test VIDIOC_LOG_STATUS: OK (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)
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 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:
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 test CREATE_BUFS maximum buffers: OK test VIDIOC_REMOVE_BUFS: OK
test VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported) test blocking wait: OK
Total for c3-isp device /dev/video4: 49, Succeeded: 49, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/v4l-subdev0:
Driver Info:
Driver version : 6.15.0 Capabilities : 0x00000000 Client Capabilities: 0x0000000000000002 interval-uses-which Media Driver Info: Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x03000043 Type : V4L Sub-Device Entity Info: ID : 0x00000001 (1) Name : c3-isp-core Function : Video Pixel Formatter Pad 0x01000002 : 0: Sink Link 0x02000014: from remote pad 0x1000013 of entity 'c3-mipi-adapter' (Video Interface Bridge): Data, Enabled, Immutable Pad 0x01000003 : 1: Sink Link 0x0200003d: from remote pad 0x100002c of entity 'c3-isp-params' (V4L2 I/O): Data, Enabled Pad 0x01000004 : 2: Source Link 0x0200003b: to remote pad 0x1000028 of entity 'c3-isp-stats' (V4L2 I/O): Data, Enabled Pad 0x01000005 : 3: Source Link 0x02000031: to remote pad 0x1000009 of entity 'c3-isp-resizer0' (Video Scaler): Data, Enabled Pad 0x01000006 : 4: Source Link 0x02000035: to remote pad 0x100000c of entity 'c3-isp-resizer1' (Video Scaler): Data, Enabled Pad 0x01000007 : 5: Source Link 0x02000039: to remote pad 0x100000f of entity 'c3-isp-resizer2' (Video Scaler): Data, Enabled
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 (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 (Sink Pad 1):
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 (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 (Source Pad 3):
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 4):
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 5):
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 c3-isp device /dev/v4l-subdev0: 89, Succeeded: 85, Failed: 4, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/v4l-subdev1:
Driver Info:
Driver version : 6.15.0 Capabilities : 0x00000000 Client Capabilities: 0x0000000000000002 interval-uses-which Media Driver Info: Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x03000045 Type : V4L Sub-Device Entity Info: ID : 0x00000008 (8) Name : c3-isp-resizer0 Function : Video Scaler Pad 0x01000009 : 0: Sink Link 0x02000031: from remote pad 0x1000005 of entity 'c3-isp-core' (Video Pixel Formatter): Data, Enabled Pad 0x0100000a : 1: Source Link 0x0200002f: to remote pad 0x100001c of entity 'c3-isp-cap0' (V4L2 I/O): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/v4l-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 (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
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 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 c3-isp device /dev/v4l-subdev1: 61, Succeeded: 61, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/v4l-subdev2:
Driver Info:
Driver version : 6.15.0 Capabilities : 0x00000000 Client Capabilities: 0x0000000000000002 interval-uses-which Media Driver Info: Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x03000047 Type : V4L Sub-Device Entity Info: ID : 0x0000000b (11) Name : c3-isp-resizer1 Function : Video Scaler Pad 0x0100000c : 0: Sink Link 0x02000035: from remote pad 0x1000006 of entity 'c3-isp-core' (Video Pixel Formatter): Data, Enabled Pad 0x0100000d : 1: Source Link 0x02000033: to remote pad 0x1000020 of entity 'c3-isp-cap1' (V4L2 I/O): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/v4l-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 (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
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 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 c3-isp device /dev/v4l-subdev2: 61, Succeeded: 61, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/v4l-subdev3:
Driver Info:
Driver version : 6.15.0 Capabilities : 0x00000000 Client Capabilities: 0x0000000000000002 interval-uses-which Media Driver Info: Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x03000049 Type : V4L Sub-Device Entity Info: ID : 0x0000000e (14) Name : c3-isp-resizer2 Function : Video Scaler Pad 0x0100000f : 0: Sink Link 0x02000039: from remote pad 0x1000007 of entity 'c3-isp-core' (Video Pixel Formatter): Data, Enabled Pad 0x01000010 : 1: Source Link 0x02000037: to remote pad 0x1000024 of entity 'c3-isp-cap2' (V4L2 I/O): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/v4l-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
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 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 c3-isp device /dev/v4l-subdev3: 61, Succeeded: 61, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/v4l-subdev4:
Driver Info:
Driver version : 6.15.0 Capabilities : 0x00000000 Client Capabilities: 0x0000000000000002 interval-uses-which Media Driver Info: Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x0300004b Type : V4L Sub-Device Entity Info: ID : 0x00000011 (17) Name : c3-mipi-adapter Function : Video Interface Bridge Pad 0x01000012 : 0: Sink Link 0x02000019: from remote pad 0x1000018 of entity 'c3-mipi-csi2' (Video Interface Bridge): Data, Enabled, Immutable Pad 0x01000013 : 1: Source Link 0x02000014: to remote pad 0x1000002 of entity 'c3-isp-core' (Video Pixel Formatter): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/v4l-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 c3-isp device /dev/v4l-subdev4: 61, Succeeded: 61, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/v4l-subdev5:
Driver Info:
Driver version : 6.15.0 Capabilities : 0x00000000 Client Capabilities: 0x0000000000000002 interval-uses-which Media Driver Info: Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x0300004d Type : V4L Sub-Device Entity Info: ID : 0x00000016 (22) Name : c3-mipi-csi2 Function : Video Interface Bridge Pad 0x01000017 : 0: Sink Link 0x02000041: from remote pad 0x1000040 of entity 'imx290 2-001a' (Camera Sensor): Data, Enabled, Immutable Pad 0x01000018 : 1: Source Link 0x02000019: to remote pad 0x1000012 of entity 'c3-mipi-adapter' (Video Interface Bridge): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/v4l-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 (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 c3-isp device /dev/v4l-subdev5: 61, Succeeded: 61, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for c3-isp device /dev/v4l-subdev6:
Driver Info:
Driver version : 6.15.0 Capabilities : 0x00000000 Client Capabilities: 0x0000000000000002 interval-uses-which Media Driver Info: Driver name : c3-isp Model : c3-isp Serial : Bus info : platform:ff000000.isp Media version : 6.15.0 Hardware revision: 0x00000000 (0) Driver version : 6.15.0 Interface Info: ID : 0x0300004f Type : V4L Sub-Device Entity Info: ID : 0x0000003f (63) Name : imx290 2-001a Function : Camera Sensor Pad 0x01000040 : 0: Source Link 0x02000041: to remote pad 0x1000017 of entity 'c3-mipi-csi2' (Video Interface Bridge): Data, Enabled, Immutable
Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_SUDBEV_QUERYCAP: OK
test invalid ioctls: OK
Allow for multiple opens:
test second /dev/v4l-subdev6 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
warn: v4l2-test-subdevs.cpp(566): VIDIOC_SUBDEV_G_SELECTION is supported for target 0 but not VIDIOC_SUBDEV_S_SELECTION
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Active VIDIOC_SUBDEV_G/S_FMT: OK
warn: v4l2-test-subdevs.cpp(566): VIDIOC_SUBDEV_G_SELECTION is supported for target 0 but not VIDIOC_SUBDEV_S_SELECTION
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
test Active VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)
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: 12 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 c3-isp device /dev/v4l-subdev6: 54, Succeeded: 54, Failed: 0, Warnings: 2
Grand Total for c3-isp device /dev/media0: 701, Succeeded: 697, Failed: 4, Warnings: 2
To: Mauro Carvalho Chehab <[email protected]>
To: Rob Herring <[email protected]>
To: Krzysztof Kozlowski <[email protected]>
To: Conor Dooley <[email protected]>
---
Keke Li (10):
dt-bindings: media: Add amlogic,c3-mipi-csi2.yaml
media: platform: Add C3 MIPI CSI-2 driver
dt-bindings: media: Add amlogic,c3-mipi-adapter.yaml
media: platform: Add C3 MIPI adapter driver
dt-bindings: media: Add amlogic,c3-isp.yaml
media: Add C3ISP_PARAMS and C3ISP_STATS meta formats
media: uapi: Add stats info and parameters buffer for C3 ISP
media: platform: Add C3 ISP driver
Documentation: media: add documentation file metafmt-c3-isp.rst
Documentation: media: add documentation file c3-isp.rst
Documentation/admin-guide/media/c3-isp.dot | 26 + Documentation/admin-guide/media/c3-isp.rst | 101 ++ Documentation/admin-guide/media/v4l-drivers.rst | 1 + .../devicetree/bindings/media/amlogic,c3-isp.yaml | 88 ++ .../bindings/media/amlogic,c3-mipi-adapter.yaml | 111 +++ .../bindings/media/amlogic,c3-mipi-csi2.yaml | 127 +++ .../userspace-api/media/v4l/meta-formats.rst | 1 + .../userspace-api/media/v4l/metafmt-c3-isp.rst | 86 ++ MAINTAINERS | 25 + drivers/media/platform/amlogic/Kconfig | 1 + drivers/media/platform/amlogic/Makefile | 2 + drivers/media/platform/amlogic/c3/Kconfig | 5 + drivers/media/platform/amlogic/c3/Makefile | 5 + drivers/media/platform/amlogic/c3/isp/Kconfig | 18 + drivers/media/platform/amlogic/c3/isp/Makefile | 10 + .../media/platform/amlogic/c3/isp/c3-isp-capture.c | 806 ++++++++++++++++ .../media/platform/amlogic/c3/isp/c3-isp-common.h | 340 +++++++ .../media/platform/amlogic/c3/isp/c3-isp-core.c | 641 +++++++++++++ drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c | 421 ++++++++ .../media/platform/amlogic/c3/isp/c3-isp-params.c | 1010 ++++++++++++++++++++ .../media/platform/amlogic/c3/isp/c3-isp-regs.h | 618 ++++++++++++ .../media/platform/amlogic/c3/isp/c3-isp-resizer.c | 892 +++++++++++++++++ .../media/platform/amlogic/c3/isp/c3-isp-stats.c | 328 +++++++ .../media/platform/amlogic/c3/mipi-adapter/Kconfig | 16 + .../platform/amlogic/c3/mipi-adapter/Makefile | 3 + .../amlogic/c3/mipi-adapter/c3-mipi-adap.c | 842 ++++++++++++++++ .../media/platform/amlogic/c3/mipi-csi2/Kconfig | 16 + .../media/platform/amlogic/c3/mipi-csi2/Makefile | 3 + .../platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c | 827 ++++++++++++++++ drivers/media/v4l2-core/v4l2-ioctl.c | 2 + include/uapi/linux/media/amlogic/c3-isp-config.h | 564 +++++++++++ include/uapi/linux/videodev2.h | 4 + 32 files changed, 7940 insertions(+)
---
base-commit: 393d0c54cae31317deaa9043320c5fd9454deabc
change-id: 20240903-c3isp-7cfe70bb2583
Best regards,
Signature · 1 line
Keke Li <[email protected]>
Keke Li
maintainerPATCH v9 1/10 dt-bindings: media: Add amlogic,c3-mipi-csi2.yaml
c3-mipi-csi2 is used to receive mipi data from image sensor.
--- .../bindings/media/amlogic,c3-mipi-csi2.yaml | 127 +++++++++++++++++++++ MAINTAINERS | 6 + 2 files changed, 133 insertions(+)
Documentation/devicetree/bindings/media/amlogic,c3-mipi-csi2.yaml new file +127 -0
@@ -0,0 +1,127 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/amlogic,c3-mipi-csi2.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic C3 MIPI CSI-2 receiver + +maintainers: + - Keke Li <[email protected]> + +description: + MIPI CSI-2 receiver contains CSI-2 RX PHY and host controller. + It receives the MIPI data from the image sensor and sends MIPI data + to MIPI adapter. + +properties: + compatible: + enum: + - amlogic,c3-mipi-csi2 + + reg: + maxItems: 3 + + reg-names: + items: + - const: aphy + - const: dphy + - const: host + + power-domains: + maxItems: 1 + + clocks: + maxItems: 2 + + clock-names: + items: + - const: vapb + - const: phy0 + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/$defs/port-base + unevaluatedProperties: false + description: input port node, connected to sensor. + + properties: + endpoint: + $ref: video-interfaces.yaml# + unevaluatedProperties: false + + properties: + data-lanes: + minItems: 1 + maxItems: 4 + + required: + - data-lanes + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: output port node + + required: + - port@0 + - port@1 + +required: + - compatible + - reg + - reg-names + - power-domains + - clocks + - clock-names + - ports + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/amlogic,c3-peripherals-clkc.h> + #include <dt-bindings/power/amlogic,c3-pwrc.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + + csi: csi@ff018000 { + compatible = "amlogic,c3-mipi-csi2"; + reg = <0x0 0xff018000 0x0 0x400>, + <0x0 0xff019000 0x0 0x300>, + <0x0 0xff01a000 0x0 0x100>; + reg-names = "aphy", "dphy", "host"; + power-domains = <&pwrc PWRC_C3_MIPI_ISP_WRAP_ID>; + clocks = <&clkc_periphs CLKID_VAPB>, + <&clkc_periphs CLKID_CSI_PHY0>; + clock-names = "vapb", "phy0"; + assigned-clocks = <&clkc_periphs CLKID_VAPB>, + <&clkc_periphs CLKID_CSI_PHY0>; + assigned-clock-rates = <0>, <200000000>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + c3_mipi_csi_in: endpoint { + remote-endpoint = <&imx290_out>; + data-lanes = <1 2 3 4>; + }; + }; + + port@1 { + reg = <1>; + c3_mipi_csi_out: endpoint { + remote-endpoint = <&c3_adap_in>; + }; + }; + }; + }; + }; +...
MAINTAINERS +6 -0
@@ -1258,6 +1258,12 @@ F: Documentation/devicetree/bindings/perf/amlogic,g12-ddr-pmu.yaml F: drivers/perf/amlogic/ F: include/soc/amlogic/ +AMLOGIC MIPI CSI2 DRIVER +M: Keke Li <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/media/amlogic,c3-mipi-csi2.yaml + AMLOGIC PINCTRL DRIVER M: Xianwei Zhao <[email protected]> L: [email protected]
Signature · 1 line
2.49.0
Keke Li
maintainerPATCH v9 2/10 media: platform: Add C3 MIPI CSI-2 driver
In reply to Keke LiAdd a driver for the CSI-2 receiver uinit found on the Amlogic C3 SoC.
Create a drivers/media/platform/amlogic/c3/ directory to host the driver and the forthcoming support for the Amlogic C3 MIPI adapter and C3 ISP.
This driver is used to receive the MIPI data from image sensor.
--- MAINTAINERS | 1 + drivers/media/platform/amlogic/Kconfig | 1 + drivers/media/platform/amlogic/Makefile | 2 + drivers/media/platform/amlogic/c3/Kconfig | 3 + drivers/media/platform/amlogic/c3/Makefile | 3 + .../media/platform/amlogic/c3/mipi-csi2/Kconfig | 16 + .../media/platform/amlogic/c3/mipi-csi2/Makefile | 3 + .../platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c | 827 +++++++++++++++++++++ 8 files changed, 856 insertions(+)
MAINTAINERS +1 -0
@@ -1263,6 +1263,7 @@ M: Keke Li <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/media/amlogic,c3-mipi-csi2.yaml +F: drivers/media/platform/amlogic/c3/mipi-csi2/ AMLOGIC PINCTRL DRIVER M: Xianwei Zhao <[email protected]>
drivers/media/platform/amlogic/Kconfig +1 -0
@@ -2,4 +2,5 @@ comment "Amlogic media platform drivers" +source "drivers/media/platform/amlogic/c3/Kconfig" source "drivers/media/platform/amlogic/meson-ge2d/Kconfig"
drivers/media/platform/amlogic/Makefile +2 -0
@@ -1,2 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only + +obj-y += c3/ obj-y += meson-ge2d/
drivers/media/platform/amlogic/c3/Kconfig new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +source "drivers/media/platform/amlogic/c3/mipi-csi2/Kconfig"
drivers/media/platform/amlogic/c3/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-y += mipi-csi2/
drivers/media/platform/amlogic/c3/mipi-csi2/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config VIDEO_C3_MIPI_CSI2 + tristate "Amlogic C3 MIPI CSI-2 receiver" + depends on ARCH_MESON || COMPILE_TEST + depends on VIDEO_DEV + depends on OF + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + help + Video4Linux2 driver for Amlogic C3 MIPI CSI-2 receiver. + C3 MIPI CSI-2 receiver is used to receive MIPI data from + image sensor. + + To compile this driver as a module choose m here.
drivers/media/platform/amlogic/c3/mipi-csi2/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_VIDEO_C3_MIPI_CSI2) += c3-mipi-csi2.o
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +827 -0
827 lines not on this page · raw message
Signature · 1 line
2.49.0
Re: [PATCH v9 02/10] media: platform: Add C3 MIPI CSI-2 driver
Hi Keke,
A few relatively minor comments below...
Quoted 78 lines · On Sun, Apr 27, 2025 at 02:27:10PM +0800, Keke Li via B4 Relay wrote:
From: Keke Li <[email protected]>
Add a driver for the CSI-2 receiver uinit found on the Amlogic C3 SoC.
Create a
drivers/media/platform/amlogic/c3/directory to host the driver and the forthcoming support for the Amlogic C3 MIPI adapter and C3 ISP.This driver is used to receive the MIPI data from image sensor.
Reviewed-by Daniel Scally <[email protected]>Reviewed-by Jacopo Mondi <[email protected]>Signed-off-by Keke Li <[email protected]>--- MAINTAINERS | 1 + drivers/media/platform/amlogic/Kconfig | 1 + drivers/media/platform/amlogic/Makefile | 2 + drivers/media/platform/amlogic/c3/Kconfig | 3 + drivers/media/platform/amlogic/c3/Makefile | 3 + .../media/platform/amlogic/c3/mipi-csi2/Kconfig | 16 + .../media/platform/amlogic/c3/mipi-csi2/Makefile | 3 + .../platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c | 827 +++++++++++++++++++++ 8 files changed, 856 insertions(+)MAINTAINERS +1
-0@@ -1263,6 +1263,7 @@ M: Keke Li <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/media/amlogic,c3-mipi-csi2.yaml +F: drivers/media/platform/amlogic/c3/mipi-csi2/ AMLOGIC PINCTRL DRIVER M: Xianwei Zhao <[email protected]>drivers/media/platform/amlogic/Kconfig +1
-0@@ -2,4 +2,5 @@ comment "Amlogic media platform drivers" +source "drivers/media/platform/amlogic/c3/Kconfig" source "drivers/media/platform/amlogic/meson-ge2d/Kconfig"drivers/media/platform/amlogic/Makefile +2
-0@@ -1,2 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only + +obj-y += c3/ obj-y += meson-ge2d/drivers/media/platform/amlogic/c3/Kconfig new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +source "drivers/media/platform/amlogic/c3/mipi-csi2/Kconfig"drivers/media/platform/amlogic/c3/Makefile new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-y += mipi-csi2/drivers/media/platform/amlogic/c3/mipi-csi2/Kconfig new file +0
-0
drivers/media/platform/amlogic/c3/mipi-csi2/Kconfig line 7
Quoted 7 lines
drivers/media/platform/amlogic/c3/mipi-csi2/Kconfig new file +7
-0@@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config VIDEO_C3_MIPI_CSI2 + tristate "Amlogic C3 MIPI CSI-2 receiver" + depends on ARCH_MESON || COMPILE_TEST + depends on VIDEO_DEV + depends on OF
Does this really depend on OF?
Also see the rest of the comments.
Quoted 56 lines
drivers/media/platform/amlogic/c3/mipi-csi2/Kconfig new file +9
-0+ select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + help + Video4Linux2 driver for Amlogic C3 MIPI CSI-2 receiver. + C3 MIPI CSI-2 receiver is used to receive MIPI data from + image sensor. + + To compile this driver as a module choose m here.drivers/media/platform/amlogic/c3/mipi-csi2/Makefile new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_VIDEO_C3_MIPI_CSI2) += c3-mipi-csi2.odrivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +32
-0@@ -0,0 +1,827 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR MIT) +/* +* Copyright (C) 2024 Amlogic, Inc. All rights reserved +*/ + +#include <linux/clk.h> +#include <linux/device.h> +#include <linux/module.h> +#include <linux/mutex.h> +#include <linux/platform_device.h> +#include <linux/pm_runtime.h> + +#include <media/v4l2-async.h> +#include <media/v4l2-common.h> +#include <media/v4l2-device.h> +#include <media/v4l2-fwnode.h> +#include <media/v4l2-mc.h> +#include <media/v4l2-subdev.h> + +/* C3 CSI-2 submodule definition */ +enum { +SUBMD_APHY , +SUBMD_DPHY , +SUBMD_HOST , +}; + +#define CSI2_SUBMD_MASK GENMASK(17, 16) +#define CSI2_SUBMD_SHIFT 16 +#define CSI2_SUBMD (x) (((x) & (CSI2_SUBMD_MASK)) >> (CSI2_SUBMD_SHIFT)) +#define CSI2_REG_ADDR_MASK GENMASK(15, 0) +#define CSI2_REG_ADDR (x) ((x) & (CSI2_REG_ADDR_MASK)) +#define CSI2_REG_A (x) ((SUBMD_APHY << CSI2_SUBMD_SHIFT) | (x))
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 42
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +10
-0+#define CSI2_REG_D (x) ((SUBMD_DPHY << CSI2_SUBMD_SHIFT) | (x)) +#define CSI2_REG_H (x) ((SUBMD_HOST << CSI2_SUBMD_SHIFT) | (x)) + +#define MIPI_CSI2_CLOCK_NUM_MAX 3 +#define MIPI_CSI2_SUBDEV_NAME "c3-mipi-csi2" + +/* C3 CSI-2 APHY register */ +#define CSI_PHY_CNTL0 CSI2_REG_A(0x44) +#define CSI_PHY_CNTL0_HS_LP_BIAS_EN BIT(10) +#define CSI_PHY_CNTL0_HS_RX_TRIM_11 (11 << 11)
Please always use U specifier in such cases for the shifted value, i.e. (11U << 11) in this case.
Quoted 164 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +164
-0+#define CSI_PHY_CNTL0_LP_LOW_VTH_2 (2 << 16) +#define CSI_PHY_CNTL0_LP_HIGH_VTH_4 (4 << 20) +#define CSI_PHY_CNTL0_DATA_LANE0_HS_DIG_EN BIT(24) +#define CSI_PHY_CNTL0_DATA_LANE1_HS_DIG_EN BIT(25) +#define CSI_PHY_CNTL0_CLK0_LANE_HS_DIG_EN BIT(26) +#define CSI_PHY_CNTL0_DATA_LANE2_HS_DIG_EN BIT(27) +#define CSI_PHY_CNTL0_DATA_LANE3_HS_DIG_EN BIT(28) + +#define CSI_PHY_CNTL1 CSI2_REG_A(0x48) +#define CSI_PHY_CNTL1_HS_EQ_CAP_SMALL (2 << 16) +#define CSI_PHY_CNTL1_HS_EQ_CAP_BIG (3 << 16) +#define CSI_PHY_CNTL1_HS_EQ_RES_MIN (3 << 18) +#define CSI_PHY_CNTL1_HS_EQ_RES_MED (2 << 18) +#define CSI_PHY_CNTL1_HS_EQ_RES_MAX BIT(18) +#define CSI_PHY_CNTL1_CLK_CHN_EQ_MAX_GAIN BIT(20) +#define CSI_PHY_CNTL1_DATA_CHN_EQ_MAX_GAIN BIT(21) +#define CSI_PHY_CNTL1_COM_BG_EN BIT(24) +#define CSI_PHY_CNTL1_HS_SYNC_EN BIT(25) + +/* C3 CSI-2 DPHY register */ +#define MIPI_PHY_CTRL CSI2_REG_D(0x00) +#define MIPI_PHY_CTRL_DATA_LANE0_EN (0 << 0) +#define MIPI_PHY_CTRL_DATA_LANE0_DIS BIT(0) +#define MIPI_PHY_CTRL_DATA_LANE1_EN (0 << 1) +#define MIPI_PHY_CTRL_DATA_LANE1_DIS BIT(1) +#define MIPI_PHY_CTRL_DATA_LANE2_EN (0 << 2) +#define MIPI_PHY_CTRL_DATA_LANE2_DIS BIT(2) +#define MIPI_PHY_CTRL_DATA_LANE3_EN (0 << 3) +#define MIPI_PHY_CTRL_DATA_LANE3_DIS BIT(3) +#define MIPI_PHY_CTRL_CLOCK_LANE_EN (0 << 4) +#define MIPI_PHY_CTRL_CLOCK_LANE_DIS BIT(4) + +#define MIPI_PHY_CLK_LANE_CTRL CSI2_REG_D(0x04) +#define MIPI_PHY_CLK_LANE_CTRL_FORCE_ULPS_ENTER BIT(0) +#define MIPI_PHY_CLK_LANE_CTRL_FORCE_ULPS_EXIT BIT(1) +#define MIPI_PHY_CLK_LANE_CTRL_TCLK_ZERO_HS (0 << 3) +#define MIPI_PHY_CLK_LANE_CTRL_TCLK_ZERO_HS_2 BIT(3) +#define MIPI_PHY_CLK_LANE_CTRL_TCLK_ZERO_HS_4 (2 << 3) +#define MIPI_PHY_CLK_LANE_CTRL_TCLK_ZERO_HS_8 (3 << 3) +#define MIPI_PHY_CLK_LANE_CTRL_TCLK_ZERO_HS_16 (4 << 3) +#define MIPI_PHY_CLK_LANE_CTRL_TCLK_ZERO_EN BIT(6) +#define MIPI_PHY_CLK_LANE_CTRL_LPEN_DIS BIT(7) +#define MIPI_PHY_CLK_LANE_CTRL_END_EN BIT(8) +#define MIPI_PHY_CLK_LANE_CTRL_HS_RX_EN BIT(9) + +#define MIPI_PHY_DATA_LANE_CTRL1 CSI2_REG_D(0x0c) +#define MIPI_PHY_DATA_LANE_CTRL1_INSERT_ERRESC BIT(0) +#define MIPI_PHY_DATA_LANE_CTRL1_HS_SYNC_CHK_EN BIT(1) +#define MIPI_PHY_DATA_LANE_CTRL1_PIPE_MASK GENMASK(6, 2) +#define MIPI_PHY_DATA_LANE_CTRL1_PIPE_ALL_EN (0x1f << 2) +#define MIPI_PHY_DATA_LANE_CTRL1_PIPE_DELAY_MASK GENMASK(9, 7) +#define MIPI_PHY_DATA_LANE_CTRL1_PIPE_DELAY_3 (3 << 7) + +#define MIPI_PHY_TCLK_MISS CSI2_REG_D(0x10) +#define MIPI_PHY_TCLK_MISS_CYCLES_MASK GENMASK(7, 0) +#define MIPI_PHY_TCLK_MISS_CYCLES_9 (9 << 0) + +#define MIPI_PHY_TCLK_SETTLE CSI2_REG_D(0x14) +#define MIPI_PHY_TCLK_SETTLE_CYCLES_MASK GENMASK(7, 0) +#define MIPI_PHY_TCLK_SETTLE_CYCLES_31 (31 << 0) + +#define MIPI_PHY_THS_EXIT CSI2_REG_D(0x18) +#define MIPI_PHY_THS_EXIT_CYCLES_MASK GENMASK(7, 0) +#define MIPI_PHY_THS_EXIT_CYCLES_8 (8 << 0) + +#define MIPI_PHY_THS_SKIP CSI2_REG_D(0x1c) +#define MIPI_PHY_THS_SKIP_CYCLES_MASK GENMASK(7, 0) +#define MIPI_PHY_THS_SKIP_CYCLES_10 (10 << 0) + +#define MIPI_PHY_THS_SETTLE CSI2_REG_D(0x20) +#define MIPI_PHY_THS_SETTLE_CYCLES_MASK GENMASK(7, 0) + +#define MIPI_PHY_TINIT CSI2_REG_D(0x24) +#define MIPI_PHY_TINIT_CYCLES_MASK GENMASK(31, 0) +#define MIPI_PHY_TINIT_CYCLES_20000 (20000 << 0) + +#define MIPI_PHY_TULPS_C CSI2_REG_D(0x28) +#define MIPI_PHY_TULPS_C_CYCLES_MASK GENMASK(31, 0) +#define MIPI_PHY_TULPS_C_CYCLES_4096 (4096 << 0) + +#define MIPI_PHY_TULPS_S CSI2_REG_D(0x2c) +#define MIPI_PHY_TULPS_S_CYCLES_MASK GENMASK(31, 0) +#define MIPI_PHY_TULPS_S_CYCLES_256 (256 << 0) + +#define MIPI_PHY_TMBIAS CSI2_REG_D(0x30) +#define MIPI_PHY_TMBIAS_CYCLES_MASK GENMASK(31, 0) +#define MIPI_PHY_TMBIAS_CYCLES_256 (256 << 0) + +#define MIPI_PHY_TLP_EN_W CSI2_REG_D(0x34) +#define MIPI_PHY_TLP_EN_W_CYCLES_MASK GENMASK(31, 0) +#define MIPI_PHY_TLP_EN_W_CYCLES_12 (12 << 0) + +#define MIPI_PHY_TLPOK CSI2_REG_D(0x38) +#define MIPI_PHY_TLPOK_CYCLES_MASK GENMASK(31, 0) +#define MIPI_PHY_TLPOK_CYCLES_256 (256 << 0) + +#define MIPI_PHY_TWD_INIT CSI2_REG_D(0x3c) +#define MIPI_PHY_TWD_INIT_DOG_MASK GENMASK(31, 0) +#define MIPI_PHY_TWD_INIT_DOG_0X400000 (0x400000 << 0) + +#define MIPI_PHY_TWD_HS CSI2_REG_D(0x40) +#define MIPI_PHY_TWD_HS_DOG_MASK GENMASK(31, 0) +#define MIPI_PHY_TWD_HS_DOG_0X400000 (0x400000 << 0) + +#define MIPI_PHY_MUX_CTRL0 CSI2_REG_D(0x284) +#define MIPI_PHY_MUX_CTRL0_SFEN3_SRC_MASK GENMASK(3, 0) +#define MIPI_PHY_MUX_CTRL0_SFEN3_SRC_LANE0 (0 << 0) +#define MIPI_PHY_MUX_CTRL0_SFEN3_SRC_LANE1 BIT(0) +#define MIPI_PHY_MUX_CTRL0_SFEN3_SRC_LANE2 (2 << 0) +#define MIPI_PHY_MUX_CTRL0_SFEN3_SRC_LANE3 (3 << 0) +#define MIPI_PHY_MUX_CTRL0_SFEN2_SRC_MASK GENMASK(7, 4) +#define MIPI_PHY_MUX_CTRL0_SFEN2_SRC_LANE0 (0 << 4) +#define MIPI_PHY_MUX_CTRL0_SFEN2_SRC_LANE1 BIT(4) +#define MIPI_PHY_MUX_CTRL0_SFEN2_SRC_LANE2 (2 << 4) +#define MIPI_PHY_MUX_CTRL0_SFEN2_SRC_LANE3 (3 << 4) +#define MIPI_PHY_MUX_CTRL0_SFEN1_SRC_MASK GENMASK(11, 8) +#define MIPI_PHY_MUX_CTRL0_SFEN1_SRC_LANE0 (0 << 8) +#define MIPI_PHY_MUX_CTRL0_SFEN1_SRC_LANE1 BIT(8) +#define MIPI_PHY_MUX_CTRL0_SFEN1_SRC_LANE2 (2 << 8) +#define MIPI_PHY_MUX_CTRL0_SFEN1_SRC_LANE3 (3 << 8) +#define MIPI_PHY_MUX_CTRL0_SFEN0_SRC_MASK GENMASK(14, 12) +#define MIPI_PHY_MUX_CTRL0_SFEN0_SRC_LANE0 (0 << 12) +#define MIPI_PHY_MUX_CTRL0_SFEN0_SRC_LANE1 BIT(12) +#define MIPI_PHY_MUX_CTRL0_SFEN0_SRC_LANE2 (2 << 12) +#define MIPI_PHY_MUX_CTRL0_SFEN0_SRC_LANE3 (3 << 12) + +#define MIPI_PHY_MUX_CTRL1 CSI2_REG_D(0x288) +#define MIPI_PHY_MUX_CTRL1_LANE3_SRC_MASK GENMASK(3, 0) +#define MIPI_PHY_MUX_CTRL1_LANE3_SRC_SFEN0 (0 << 0) +#define MIPI_PHY_MUX_CTRL1_LANE3_SRC_SFEN1 BIT(0) +#define MIPI_PHY_MUX_CTRL1_LANE3_SRC_SFEN2 (2 << 0) +#define MIPI_PHY_MUX_CTRL1_LANE3_SRC_SFEN3 (3 << 0) +#define MIPI_PHY_MUX_CTRL1_LANE2_SRC_MASK GENMASK(7, 4) +#define MIPI_PHY_MUX_CTRL1_LANE2_SRC_SFEN0 (0 << 4) +#define MIPI_PHY_MUX_CTRL1_LANE2_SRC_SFEN1 BIT(4) +#define MIPI_PHY_MUX_CTRL1_LANE2_SRC_SFEN2 (2 << 4) +#define MIPI_PHY_MUX_CTRL1_LANE2_SRC_SFEN3 (3 << 4) +#define MIPI_PHY_MUX_CTRL1_LANE1_SRC_MASK GENMASK(11, 8) +#define MIPI_PHY_MUX_CTRL1_LANE1_SRC_SFEN0 (0 << 8) +#define MIPI_PHY_MUX_CTRL1_LANE1_SRC_SFEN1 BIT(8) +#define MIPI_PHY_MUX_CTRL1_LANE1_SRC_SFEN2 (2 << 8) +#define MIPI_PHY_MUX_CTRL1_LANE1_SRC_SFEN3 (3 << 8) +#define MIPI_PHY_MUX_CTRL1_LANE0_SRC_MASK GENMASK(14, 12) +#define MIPI_PHY_MUX_CTRL1_LANE0_SRC_SFEN0 (0 << 12) +#define MIPI_PHY_MUX_CTRL1_LANE0_SRC_SFEN1 BIT(12) +#define MIPI_PHY_MUX_CTRL1_LANE0_SRC_SFEN2 (2 << 12) +#define MIPI_PHY_MUX_CTRL1_LANE0_SRC_SFEN3 (3 << 12) + +/* C3 CSI-2 HOST register */ +#define CSI2_HOST_N_LANES CSI2_REG_H(0x04) +#define CSI2_HOST_N_LANES_MASK GENMASK(1, 0) +#define CSI2_HOST_N_LANES_1 (0 << 0) +#define CSI2_HOST_N_LANES_2 BIT(0) +#define CSI2_HOST_N_LANES_3 (2 << 0) +#define CSI2_HOST_N_LANES_4 (3 << 0) + +#define CSI2_HOST_CSI2_RESETN CSI2_REG_H(0x10) +#define CSI2_HOST_CSI2_RESETN_MASK BIT(0) +#define CSI2_HOST_CSI2_RESETN_ACTIVE (0 << 0) +#define CSI2_HOST_CSI2_RESETN_EXIT BIT(0) + +#define C3_MIPI_CSI2_MAX_WIDTH 2888 +#define C3_MIPI_CSI2_MIN_WIDTH 160 +#define C3_MIPI_CSI2_MAX_HEIGHT 2240
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 216
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +10
-0+#define C3_MIPI_CSI2_MIN_HEIGHT 120 +#define C3_MIPI_CSI2_DEFAULT_WIDTH 1920 +#define C3_MIPI_CSI2_DEFAULT_HEIGHT 1080 +#define C3_MIPI_CSI2_DEFAULT_FMT MEDIA_BUS_FMT_SRGGB10_1X10 + +/* C3 CSI-2 pad list */ +enum { +C3_MIPI_CSI2_PAD_SINK , +C3_MIPI_CSI2_PAD_SRC , +C3_MIPI_CSI2_PAD_MAX
_MAX suggests this is the maximu, but it rather looks like this is the number of pads. I'd use e.g. NR_OF_C3_MIPI_CSI2_PAD instead.
Quoted 98 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +98
-0+}; + +/* +* struct c3_csi_info - MIPI CSI2 information +* +* @clocks: array of MIPI CSI2 clock names +* @clock_num: actual clock number +*/ +struct c3_csi_info { +char *clocks[MIPI_CSI2_CLOCK_NUM_MAX ]; +u32 clock_num; +}; + +/* +* struct c3_csi_device - MIPI CSI2 platform device +* +* @dev: pointer to the struct device +* @aphy: MIPI CSI2 aphy register address +* @dphy: MIPI CSI2 dphy register address +* @host: MIPI CSI2 host register address +* @clks: array of MIPI CSI2 clocks +* @sd: MIPI CSI2 sub-device +* @pads: MIPI CSI2 sub-device pads +* @notifier: notifier to register on the v4l2-async API +* @src_pad: source sub-device pad +* @bus: MIPI CSI2 bus information +* @info: version-specific MIPI CSI2 information +*/ +struct c3_csi_device { +struct device *dev; +void __iomem *aphy; +void __iomem *dphy; +void __iomem *host; +struct clk_bulk_data clks[MIPI_CSI2_CLOCK_NUM_MAX ]; + +struct v4l2_subdev sd; +struct media_pad pads[C3_MIPI_CSI2_PAD_MAX ]; +struct v4l2_async_notifier notifier; +struct media_pad *src_pad; +struct v4l2_mbus_config_mipi_csi2 bus; + +const struct c3_csi_info *info; +}; + +static const u32 c3_mipi_csi_formats[] = { +MEDIA_BUS_FMT_SBGGR10_1X10 , +MEDIA_BUS_FMT_SGBRG10_1X10 , +MEDIA_BUS_FMT_SGRBG10_1X10 , +MEDIA_BUS_FMT_SRGGB10_1X10 , +MEDIA_BUS_FMT_SBGGR12_1X12 , +MEDIA_BUS_FMT_SGBRG12_1X12 , +MEDIA_BUS_FMT_SGRBG12_1X12 , +MEDIA_BUS_FMT_SRGGB12_1X12 , +}; + +/* Hardware configuration */ + +static void c3_mipi_csi_write (struct c3_csi_device *csi,u32 reg,u32 val) +{ +void __iomem *addr; + +switch (CSI2_SUBMD (reg)) { +case SUBMD_APHY : + addr = csi->aphy +CSI2_REG_ADDR (reg); +break ; +case SUBMD_DPHY : + addr = csi->dphy +CSI2_REG_ADDR (reg); +break ; +case SUBMD_HOST : + addr = csi->host +CSI2_REG_ADDR (reg); +break ; +default : +dev_err (csi->dev,"Invalid sub-module: %lu\n" ,CSI2_SUBMD (reg)); +return ; + } + +writel (val, addr); +} + +static void c3_mipi_csi_cfg_aphy (struct c3_csi_device *csi) +{ +c3_mipi_csi_write (csi,CSI_PHY_CNTL0 , +CSI_PHY_CNTL0_HS_LP_BIAS_EN | +CSI_PHY_CNTL0_HS_RX_TRIM_11 | +CSI_PHY_CNTL0_LP_LOW_VTH_2 | +CSI_PHY_CNTL0_LP_HIGH_VTH_4 | +CSI_PHY_CNTL0_DATA_LANE0_HS_DIG_EN | +CSI_PHY_CNTL0_DATA_LANE1_HS_DIG_EN | +CSI_PHY_CNTL0_CLK0_LANE_HS_DIG_EN | +CSI_PHY_CNTL0_DATA_LANE2_HS_DIG_EN | +CSI_PHY_CNTL0_DATA_LANE3_HS_DIG_EN ); + + c3_mipi_csi_write(csi, CSI_PHY_CNTL1, + CSI_PHY_CNTL1_HS_EQ_CAP_SMALL | + CSI_PHY_CNTL1_HS_EQ_RES_MED | + CSI_PHY_CNTL1_CLK_CHN_EQ_MAX_GAIN | + CSI_PHY_CNTL1_DATA_CHN_EQ_MAX_GAIN | + CSI_PHY_CNTL1_COM_BG_EN |
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 324
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +10
-0+ CSI_PHY_CNTL1_HS_SYNC_EN); +} + +static void c3_mipi_csi_cfg_dphy (struct c3_csi_device *csi,s64 rate) +{ +u32 val; +u32 settle; + +/* Calculate the high speed settle */ + val =DIV_ROUND_UP (1000000000 , rate);
GIGA?
Quoted 62 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +62
-0+ settle = (16 * val +230 ) /10 ; + +c3_mipi_csi_write (csi,MIPI_PHY_CLK_LANE_CTRL , +MIPI_PHY_CLK_LANE_CTRL_HS_RX_EN | +MIPI_PHY_CLK_LANE_CTRL_END_EN | +MIPI_PHY_CLK_LANE_CTRL_LPEN_DIS | +MIPI_PHY_CLK_LANE_CTRL_TCLK_ZERO_EN | +MIPI_PHY_CLK_LANE_CTRL_TCLK_ZERO_HS_8 ); + +c3_mipi_csi_write (csi,MIPI_PHY_TCLK_MISS ,MIPI_PHY_TCLK_MISS_CYCLES_9 ); +c3_mipi_csi_write (csi,MIPI_PHY_TCLK_SETTLE , +MIPI_PHY_TCLK_SETTLE_CYCLES_31 ); +c3_mipi_csi_write (csi,MIPI_PHY_THS_EXIT ,MIPI_PHY_THS_EXIT_CYCLES_8 ); +c3_mipi_csi_write (csi,MIPI_PHY_THS_SKIP ,MIPI_PHY_THS_SKIP_CYCLES_10 ); +c3_mipi_csi_write (csi,MIPI_PHY_THS_SETTLE , settle); +c3_mipi_csi_write (csi,MIPI_PHY_TINIT ,MIPI_PHY_TINIT_CYCLES_20000 ); +c3_mipi_csi_write (csi,MIPI_PHY_TMBIAS ,MIPI_PHY_TMBIAS_CYCLES_256 ); +c3_mipi_csi_write (csi,MIPI_PHY_TULPS_C ,MIPI_PHY_TULPS_C_CYCLES_4096 ); +c3_mipi_csi_write (csi,MIPI_PHY_TULPS_S ,MIPI_PHY_TULPS_S_CYCLES_256 ); +c3_mipi_csi_write (csi,MIPI_PHY_TLP_EN_W ,MIPI_PHY_TLP_EN_W_CYCLES_12 ); +c3_mipi_csi_write (csi,MIPI_PHY_TLPOK ,MIPI_PHY_TLPOK_CYCLES_256 ); +c3_mipi_csi_write (csi,MIPI_PHY_TWD_INIT , +MIPI_PHY_TWD_INIT_DOG_0X400000 ); +c3_mipi_csi_write (csi,MIPI_PHY_TWD_HS ,MIPI_PHY_TWD_HS_DOG_0X400000 ); + +c3_mipi_csi_write (csi,MIPI_PHY_DATA_LANE_CTRL1 , +MIPI_PHY_DATA_LANE_CTRL1_INSERT_ERRESC | +MIPI_PHY_DATA_LANE_CTRL1_HS_SYNC_CHK_EN | +MIPI_PHY_DATA_LANE_CTRL1_PIPE_ALL_EN | +MIPI_PHY_DATA_LANE_CTRL1_PIPE_DELAY_3 ); + +/* Set the order of lanes */ +c3_mipi_csi_write (csi,MIPI_PHY_MUX_CTRL0 , +MIPI_PHY_MUX_CTRL0_SFEN3_SRC_LANE3 | +MIPI_PHY_MUX_CTRL0_SFEN2_SRC_LANE2 | +MIPI_PHY_MUX_CTRL0_SFEN1_SRC_LANE1 | +MIPI_PHY_MUX_CTRL0_SFEN0_SRC_LANE0 ); + +c3_mipi_csi_write (csi,MIPI_PHY_MUX_CTRL1 , +MIPI_PHY_MUX_CTRL1_LANE3_SRC_SFEN3 | +MIPI_PHY_MUX_CTRL1_LANE2_SRC_SFEN2 | +MIPI_PHY_MUX_CTRL1_LANE1_SRC_SFEN1 | +MIPI_PHY_MUX_CTRL1_LANE0_SRC_SFEN0 ); + +/* Enable digital data and clock lanes */ +c3_mipi_csi_write (csi,MIPI_PHY_CTRL , +MIPI_PHY_CTRL_DATA_LANE0_EN | +MIPI_PHY_CTRL_DATA_LANE1_EN | +MIPI_PHY_CTRL_DATA_LANE2_EN | +MIPI_PHY_CTRL_DATA_LANE3_EN | +MIPI_PHY_CTRL_CLOCK_LANE_EN ); +} + +static void c3_mipi_csi_cfg_host (struct c3_csi_device *csi) +{ +/* Reset CSI-2 controller output */ +c3_mipi_csi_write (csi,CSI2_HOST_CSI2_RESETN , +CSI2_HOST_CSI2_RESETN_ACTIVE ); +c3_mipi_csi_write (csi,CSI2_HOST_CSI2_RESETN , +CSI2_HOST_CSI2_RESETN_EXIT ); + +/* Set data lane number */
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 396
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +10
-0+c3_mipi_csi_write (csi,CSI2_HOST_N_LANES , csi->bus.num_data_lanes -1 ); +} + +static int c3_mipi_csi_start_stream (struct c3_csi_device *csi, +struct v4l2_subdev *src_sd) +{ +s64 link_freq; +s64 lane_rate; + + link_freq =v4l2_get_link_freq (src_sd->ctrl_handler,0 ,0 );
Please get the link frequency from the pad instead, not from the control handler.
Quoted 28 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +28
-0+if (link_freq <0 ) { +dev_err (csi->dev, +"Unable to obtain link frequency: %lld\n" , link_freq); +return link_freq; + } + + lane_rate = link_freq *2 ; +if (lane_rate >1500000000 ) { +dev_err (csi->dev,"Invalid lane rate: %lld\n" , lane_rate); +return -EINVAL ; + } + +c3_mipi_csi_cfg_aphy (csi); +c3_mipi_csi_cfg_dphy (csi, lane_rate); +c3_mipi_csi_cfg_host (csi); + +return 0 ; +} + +static int c3_mipi_csi_enable_streams (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state, +u32 pad,u64 streams_mask) +{ +struct c3_csi_device *csi =v4l2_get_subdevdata (sd); +struct media_pad *sink_pad; +struct v4l2_subdev *src_sd; +int ret; +
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 434
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +10
-0+ sink_pad = &csi->pads[C3_MIPI_CSI2_PAD_SINK ]; + csi->src_pad =media_pad_remote_pad_unique (sink_pad); +if (IS_ERR (csi->src_pad)) { +dev_dbg (csi->dev,"Failed to get source pad for MIPI CSI-2\n" ); +return -EPIPE ; + } + + src_sd =media_entity_to_v4l2_subdev (csi->src_pad->entity); + +pm_runtime_resume_and_get (csi->dev);
Note that this will fail if any of the clock fail to enable.
Quoted 169 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +169
-0+ +c3_mipi_csi_start_stream (csi, src_sd); + + ret =v4l2_subdev_enable_streams (src_sd, csi->src_pad->index,BIT (0 )); +if (ret) { +pm_runtime_put (csi->dev); +return ret; + } + +return 0 ; +} + +static int c3_mipi_csi_disable_streams (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state, +u32 pad,u64 streams_mask) +{ +struct c3_csi_device *csi =v4l2_get_subdevdata (sd); +struct v4l2_subdev *src_sd; + +if (csi->src_pad) { + src_sd =media_entity_to_v4l2_subdev (csi->src_pad->entity); +v4l2_subdev_disable_streams (src_sd, csi->src_pad->index, +BIT (0 )); + } + csi->src_pad =NULL ; + +pm_runtime_put (csi->dev); + +return 0 ; +} + +static int c3_mipi_csi_enum_mbus_code (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state, +struct v4l2_subdev_mbus_code_enum *code) +{ +struct v4l2_mbus_framefmt *fmt; + +switch (code->pad) { +case C3_MIPI_CSI2_PAD_SINK : +if (code->index >=ARRAY_SIZE (c3_mipi_csi_formats)) +return -EINVAL ; + + code->code = c3_mipi_csi_formats[code->index]; +break ; +case C3_MIPI_CSI2_PAD_SRC : +if (code->index) +return -EINVAL ; + + fmt =v4l2_subdev_state_get_format (state, code->pad); + code->code = fmt->code; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} + +static int c3_mipi_csi_set_fmt (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state, +struct v4l2_subdev_format *format) +{ +struct v4l2_mbus_framefmt *fmt; +unsigned int i; + +if (format->pad !=C3_MIPI_CSI2_PAD_SINK ) +return v4l2_subdev_get_fmt (sd, state, format); + + fmt =v4l2_subdev_state_get_format (state, format->pad); + +for (i =0 ; i <ARRAY_SIZE (c3_mipi_csi_formats); i++) { +if (format->format.code == c3_mipi_csi_formats[i]) { + fmt->code = c3_mipi_csi_formats[i]; +break ; + } + } + +if (i ==ARRAY_SIZE (c3_mipi_csi_formats)) + fmt->code = c3_mipi_csi_formats[0 ]; + + fmt->width =clamp_t (u32, format->format.width, +C3_MIPI_CSI2_MIN_WIDTH ,C3_MIPI_CSI2_MAX_WIDTH ); + fmt->height =clamp_t (u32, format->format.height, +C3_MIPI_CSI2_MIN_HEIGHT ,C3_MIPI_CSI2_MAX_HEIGHT ); + fmt->colorspace =V4L2_COLORSPACE_RAW ; + fmt->xfer_func =V4L2_XFER_FUNC_NONE ; + fmt->ycbcr_enc =V4L2_YCBCR_ENC_601 ; + fmt->quantization =V4L2_QUANTIZATION_FULL_RANGE ; + + format->format = *fmt; + +/* Synchronize the format to source pad */ + fmt =v4l2_subdev_state_get_format (state,C3_MIPI_CSI2_PAD_SRC ); + *fmt = format->format; + +return 0 ; +} + +static int c3_mipi_csi_init_state (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state) +{ +struct v4l2_mbus_framefmt *sink_fmt; +struct v4l2_mbus_framefmt *src_fmt; + + sink_fmt =v4l2_subdev_state_get_format (state,C3_MIPI_CSI2_PAD_SINK ); + src_fmt =v4l2_subdev_state_get_format (state,C3_MIPI_CSI2_PAD_SRC ); + + sink_fmt->width =C3_MIPI_CSI2_DEFAULT_WIDTH ; + sink_fmt->height =C3_MIPI_CSI2_DEFAULT_HEIGHT ; + sink_fmt->field =V4L2_FIELD_NONE ; + sink_fmt->code =C3_MIPI_CSI2_DEFAULT_FMT ; + sink_fmt->colorspace =V4L2_COLORSPACE_RAW ; + sink_fmt->xfer_func =V4L2_XFER_FUNC_NONE ; + sink_fmt->ycbcr_enc =V4L2_YCBCR_ENC_601 ; + sink_fmt->quantization =V4L2_QUANTIZATION_FULL_RANGE ; + + *src_fmt = *sink_fmt; + +return 0 ; +} + +static const struct v4l2_subdev_pad_ops c3_mipi_csi_pad_ops = { + .enum_mbus_code = c3_mipi_csi_enum_mbus_code, + .get_fmt = v4l2_subdev_get_fmt, + .set_fmt = c3_mipi_csi_set_fmt, + .enable_streams = c3_mipi_csi_enable_streams, + .disable_streams = c3_mipi_csi_disable_streams, +}; + +static const struct v4l2_subdev_ops c3_mipi_csi_subdev_ops = { + .pad = &c3_mipi_csi_pad_ops, +}; + +static const struct v4l2_subdev_internal_ops c3_mipi_csi_internal_ops = { + .init_state = c3_mipi_csi_init_state, +}; + +/* Media entity operations */ +static const struct media_entity_operations c3_mipi_csi_entity_ops = { + .link_validate = v4l2_subdev_link_validate, +}; + +/* PM runtime */ + +static int c3_mipi_csi_runtime_suspend (struct device *dev) +{ +struct c3_csi_device *csi =dev_get_drvdata (dev); + +clk_bulk_disable_unprepare (csi->info->clock_num, csi->clks); + +return 0 ; +} + +static int c3_mipi_csi_runtime_resume (struct device *dev) +{ +struct c3_csi_device *csi =dev_get_drvdata (dev); + +return clk_bulk_prepare_enable (csi->info->clock_num, csi->clks); +} + +static const struct dev_pm_ops c3_mipi_csi_pm_ops = { + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) +RUNTIME_PM_OPS (c3_mipi_csi_runtime_suspend, + c3_mipi_csi_runtime_resume,NULL ) +}; + +/* Probe/remove & platform driver */ +
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 613
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +10
-0+static int c3_mipi_csi_subdev_init (struct c3_csi_device *csi) +{ +struct v4l2_subdev *sd = &csi->sd; +int ret; + +v4l2_subdev_init (sd, &c3_mipi_csi_subdev_ops); + sd->owner =THIS_MODULE ; + sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ; + sd->internal_ops = &c3_mipi_csi_internal_ops; +snprintf (sd->name,sizeof (sd->name),"%s" ,MIPI_CSI2_SUBDEV_NAME );
strscpy()?
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 621
Quoted 8 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +8
-0+ + sd->entity.function =MEDIA_ENT_F_VID_IF_BRIDGE ; + sd->entity.ops = &c3_mipi_csi_entity_ops; + + sd->dev = csi->dev; +v4l2_set_subdevdata (sd, csi); + + csi->pads[C3_MIPI_CSI2_PAD_SINK ].flags =MEDIA_PAD_FL_SINK ;
This pad should have MEDIA_PAD_FL_MUST_CONNECT set.
Quoted 32 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +32
-0+ csi->pads[C3_MIPI_CSI2_PAD_SRC ].flags =MEDIA_PAD_FL_SOURCE ; + ret =media_entity_pads_init (&sd->entity,C3_MIPI_CSI2_PAD_MAX , + csi->pads); +if (ret) +return ret; + + ret =v4l2_subdev_init_finalize (sd); +if (ret) { +media_entity_cleanup (&sd->entity); +return ret; + } + +return 0 ; +} + +static void c3_mipi_csi_subdev_deinit (struct c3_csi_device *csi) +{ +v4l2_subdev_cleanup (&csi->sd); +media_entity_cleanup (&csi->sd.entity); +} + +/* Subdev notifier register */ +static int c3_mipi_csi_notify_bound (struct v4l2_async_notifier *notifier, +struct v4l2_subdev *sd, +struct v4l2_async_connection *asc) +{ +struct c3_csi_device *csi =v4l2_get_subdevdata (notifier->sd); +struct media_pad *sink = &csi->sd.entity.pads[C3_MIPI_CSI2_PAD_SINK ]; + +return v4l2_create_fwnode_links_to_pad (sd, sink,MEDIA_LNK_FL_ENABLED | +MEDIA_LNK_FL_IMMUTABLE ); +}
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 663
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +10
-0+ +static const struct v4l2_async_notifier_operations c3_mipi_csi_notify_ops = { + .bound = c3_mipi_csi_notify_bound, +}; + +static int c3_mipi_csi_async_register (struct c3_csi_device *csi) +{ +struct v4l2_fwnode_endpoint vep = { + .bus_type =V4L2_MBUS_CSI2_DPHY , + };
Fits on a single line.
Quoted 6 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +6
-0+struct v4l2_async_connection *asc; +struct fwnode_handle *ep; +int ret; + +v4l2_async_subdev_nf_init (&csi->notifier, &csi->sd); +
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 679
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +10
-0+ ep =fwnode_graph_get_endpoint_by_id (dev_fwnode (csi->dev),0 ,0 , +FWNODE_GRAPH_ENDPOINT_NEXT ); +if (!ep) +return -ENOTCONN ; + + ret =v4l2_fwnode_endpoint_parse (ep, &vep); +if (ret) + goto err_put_handle; + + csi->bus = vep.bus.mipi_csi2;
You could store just the data lanes as you only use that.
Quoted 68 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +68
-0+ + asc =v4l2_async_nf_add_fwnode_remote (&csi->notifier, ep, + struct v4l2_async_connection); +if (IS_ERR (asc)) { + ret =PTR_ERR (asc); + goto err_put_handle; + } + + csi->notifier.ops = &c3_mipi_csi_notify_ops; + ret =v4l2_async_nf_register (&csi->notifier); +if (ret) + goto err_cleanup_nf; + + ret =v4l2_async_register_subdev (&csi->sd); +if (ret) + goto err_unregister_nf; + +fwnode_handle_put (ep); + +return 0 ; + +err_unregister_nf: +v4l2_async_nf_unregister (&csi->notifier); +err_cleanup_nf: +v4l2_async_nf_cleanup (&csi->notifier); +err_put_handle: +fwnode_handle_put (ep); +return ret; +} + +static void c3_mipi_csi_async_unregister (struct c3_csi_device *csi) +{ +v4l2_async_unregister_subdev (&csi->sd); +v4l2_async_nf_unregister (&csi->notifier); +v4l2_async_nf_cleanup (&csi->notifier); +} + +static int c3_mipi_csi_ioremap_resource (struct c3_csi_device *csi) +{ +struct device *dev = csi->dev; +struct platform_device *pdev =to_platform_device (dev); + + csi->aphy =devm_platform_ioremap_resource_byname (pdev,"aphy" ); +if (IS_ERR (csi->aphy)) +return PTR_ERR (csi->aphy); + + csi->dphy =devm_platform_ioremap_resource_byname (pdev,"dphy" ); +if (IS_ERR (csi->dphy)) +return PTR_ERR (csi->dphy); + + csi->host =devm_platform_ioremap_resource_byname (pdev,"host" ); +if (IS_ERR (csi->host)) +return PTR_ERR (csi->host); + +return 0 ; +} + +static int c3_mipi_csi_get_clocks (struct c3_csi_device *csi) +{ +const struct c3_csi_info *info = csi->info; + +for (unsigned int i =0 ; i < info->clock_num; i++) + csi->clks[i].id = info->clocks[i]; + +return devm_clk_bulk_get (csi->dev, info->clock_num, csi->clks); +} + +static int c3_mipi_csi_probe (struct platform_device *pdev)
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 757
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +10
-0+{ +struct device *dev = &pdev->dev; +struct c3_csi_device *csi; +int ret; + + csi =devm_kzalloc (dev,sizeof (*csi),GFP_KERNEL ); +if (!csi) +return -ENOMEM ; + + csi->info =of_device_get_match_data (dev);
device_get_match_data()?
Quoted 33 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +33
-0+ csi->dev = dev; + + ret =c3_mipi_csi_ioremap_resource (csi); +if (ret) +return dev_err_probe (dev, ret,"Failed to ioremap resource\n" ); + + ret =c3_mipi_csi_get_clocks (csi); +if (ret) +return dev_err_probe (dev, ret,"Failed to get clocks\n" ); + +platform_set_drvdata (pdev, csi); + +pm_runtime_enable (dev); + + ret =c3_mipi_csi_subdev_init (csi); +if (ret) + goto err_disable_runtime_pm; + + ret =c3_mipi_csi_async_register (csi); +if (ret) + goto err_deinit_subdev; + +return 0 ; + +err_deinit_subdev: +c3_mipi_csi_subdev_deinit (csi); +err_disable_runtime_pm: +pm_runtime_disable (dev); +return ret; +}; + +static void c3_mipi_csi_remove (struct platform_device *pdev) +{
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 800
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +10
-0+struct c3_csi_device *csi =platform_get_drvdata (pdev); + +c3_mipi_csi_async_unregister (csi); +c3_mipi_csi_subdev_deinit (csi); + +pm_runtime_disable (&pdev->dev); +}; + +static const struct c3_csi_info c3_mipi_csi_info = { + .clocks = {"vapb" ,"phy0" },
Spaces inside braces, please.
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c line 801
Quoted 1 line
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +1
-0+ .clock_num = 2
And do add the leading comma.
Quoted 27 lines
drivers/media/platform/amlogic/c3/mipi-csi2/c3-mipi-csi2.c new file +26
-0+}; + +static const struct of_device_id c3_mipi_csi_of_match[] = { + { + .compatible ="amlogic,c3-mipi-csi2" , + .data = &c3_mipi_csi_info, + }, + { }, +}; +MODULE_DEVICE_TABLE (of, c3_mipi_csi_of_match); + +static struct platform_driver c3_mipi_csi_driver = { + .probe = c3_mipi_csi_probe, + .remove = c3_mipi_csi_remove, + .driver = { + .name ="c3-mipi-csi2" , + .of_match_table = c3_mipi_csi_of_match, + .pm =pm_ptr (&c3_mipi_csi_pm_ops), + }, +}; + +module_platform_driver (c3_mipi_csi_driver); + +MODULE_AUTHOR ("Keke Li <[email protected]>" ); +MODULE_DESCRIPTION ("Amlogic C3 MIPI CSI-2 receiver" ); +MODULE_LICENSE ("GPL" );
Signature · 3 lines
Regards, Sakari Ailus
Keke Li
maintainerPATCH v9 3/10 dt-bindings: media: Add amlogic,c3-mipi-adapter.yaml
In reply to Keke Lic3-mipi-adapter is used to organize mipi data and
send raw data to ISP module.
--- .../bindings/media/amlogic,c3-mipi-adapter.yaml | 111 +++++++++++++++++++++ MAINTAINERS | 6 ++ 2 files changed, 117 insertions(+)
Documentation/devicetree/bindings/media/amlogic,c3-mipi-adapter.yaml new file +111 -0
@@ -0,0 +1,111 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/amlogic,c3-mipi-adapter.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic C3 MIPI adapter receiver + +maintainers: + - Keke Li <[email protected]> + +description: + MIPI adapter is used to convert the MIPI CSI-2 data + into an ISP supported data format. + +properties: + compatible: + enum: + - amlogic,c3-mipi-adapter + + reg: + maxItems: 3 + + reg-names: + items: + - const: top + - const: fd + - const: rd + + power-domains: + maxItems: 1 + + clocks: + maxItems: 2 + + clock-names: + items: + - const: vapb + - const: isp0 + + ports: + $ref: /schemas/graph.yaml#/properties/ports + + properties: + port@0: + $ref: /schemas/graph.yaml#/properties/port + description: input port node. + + port@1: + $ref: /schemas/graph.yaml#/properties/port + description: output port node. + + required: + - port@0 + - port@1 + +required: + - compatible + - reg + - reg-names + - power-domains + - clocks + - clock-names + - ports + +additionalProperties: false + +examples: + - | + #include <dt-bindings/clock/amlogic,c3-peripherals-clkc.h> + #include <dt-bindings/power/amlogic,c3-pwrc.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + + adap: adap@ff010000 { + compatible = "amlogic,c3-mipi-adapter"; + reg = <0x0 0xff010000 0x0 0x100>, + <0x0 0xff01b000 0x0 0x100>, + <0x0 0xff01d000 0x0 0x200>; + reg-names = "top", "fd", "rd"; + power-domains = <&pwrc PWRC_C3_ISP_TOP_ID>; + clocks = <&clkc_periphs CLKID_VAPB>, + <&clkc_periphs CLKID_ISP0>; + clock-names = "vapb", "isp0"; + assigned-clocks = <&clkc_periphs CLKID_VAPB>, + <&clkc_periphs CLKID_ISP0>; + assigned-clock-rates = <0>, <400000000>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + c3_adap_in: endpoint { + remote-endpoint = <&c3_mipi_csi_out>; + }; + }; + + port@1 { + reg = <1>; + c3_adap_out: endpoint { + remote-endpoint = <&c3_isp_in>; + }; + }; + }; + }; + }; +...
MAINTAINERS +6 -0
@@ -1258,6 +1258,12 @@ F: Documentation/devicetree/bindings/perf/amlogic,g12-ddr-pmu.yaml F: drivers/perf/amlogic/ F: include/soc/amlogic/ +AMLOGIC MIPI ADAPTER DRIVER +M: Keke Li <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/media/amlogic,c3-mipi-adapter.yaml + AMLOGIC MIPI CSI2 DRIVER M: Keke Li <[email protected]> L: [email protected]
Signature · 1 line
2.49.0
Keke Li
maintainerPATCH v9 4/10 media: platform: Add C3 MIPI adapter driver
In reply to Keke LiAdd a driver for the MIPI adapter unit found on the Amlogic C3 SoC.
This driver is used to align the MIPI data from the MIPI CSI-2 receiver unit and send the aligned data to the ISP unit.
--- MAINTAINERS | 1 + drivers/media/platform/amlogic/c3/Kconfig | 1 + drivers/media/platform/amlogic/c3/Makefile | 1 + .../media/platform/amlogic/c3/mipi-adapter/Kconfig | 16 + .../platform/amlogic/c3/mipi-adapter/Makefile | 3 + .../amlogic/c3/mipi-adapter/c3-mipi-adap.c | 842 +++++++++++++++++++++ 6 files changed, 864 insertions(+)
MAINTAINERS +1 -0
@@ -1263,6 +1263,7 @@ M: Keke Li <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/media/amlogic,c3-mipi-adapter.yaml +F: drivers/media/platform/amlogic/c3/mipi-adapter/ AMLOGIC MIPI CSI2 DRIVER M: Keke Li <[email protected]>
drivers/media/platform/amlogic/c3/Kconfig +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only +source "drivers/media/platform/amlogic/c3/mipi-adapter/Kconfig" source "drivers/media/platform/amlogic/c3/mipi-csi2/Kconfig"
drivers/media/platform/amlogic/c3/Makefile +1 -0
@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-y += mipi-adapter/ obj-y += mipi-csi2/
drivers/media/platform/amlogic/c3/mipi-adapter/Kconfig new file +16 -0
@@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config VIDEO_C3_MIPI_ADAPTER + tristate "Amlogic C3 MIPI adapter" + depends on ARCH_MESON || COMPILE_TEST + depends on VIDEO_DEV + depends on OF + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + help + Video4Linux2 driver for Amlogic C3 MIPI adapter. + C3 MIPI adapter mainly responsible for organizing + MIPI data and sending raw data to ISP pipeline. + + To compile this driver as a module choose m here.
drivers/media/platform/amlogic/c3/mipi-adapter/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_VIDEO_C3_MIPI_ADAPTER) += c3-mipi-adap.o
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c new file +842 -0
842 lines not on this page · raw message
Signature · 1 line
2.49.0
Re: [PATCH v9 04/10] media: platform: Add C3 MIPI adapter driver
Hi Keke,
Quoted 55 lines · On Sun, Apr 27, 2025 at 02:27:12PM +0800, Keke Li via B4 Relay wrote:
From: Keke Li <[email protected]>
Add a driver for the MIPI adapter unit found on the Amlogic C3 SoC.
This driver is used to align the MIPI data from the MIPI CSI-2 receiver unit and send the aligned data to the ISP unit.
Reviewed-by Daniel Scally <[email protected]>Reviewed-by Jacopo Mondi <[email protected]>Signed-off-by Keke Li <[email protected]>--- MAINTAINERS | 1 + drivers/media/platform/amlogic/c3/Kconfig | 1 + drivers/media/platform/amlogic/c3/Makefile | 1 + .../media/platform/amlogic/c3/mipi-adapter/Kconfig | 16 + .../platform/amlogic/c3/mipi-adapter/Makefile | 3 + .../amlogic/c3/mipi-adapter/c3-mipi-adap.c | 842 +++++++++++++++++++++ 6 files changed, 864 insertions(+)MAINTAINERS +1
-0@@ -1263,6 +1263,7 @@ M: Keke Li <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/media/amlogic,c3-mipi-adapter.yaml +F: drivers/media/platform/amlogic/c3/mipi-adapter/ AMLOGIC MIPI CSI2 DRIVER M: Keke Li <[email protected]>drivers/media/platform/amlogic/c3/Kconfig +1
-0@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only +source "drivers/media/platform/amlogic/c3/mipi-adapter/Kconfig" source "drivers/media/platform/amlogic/c3/mipi-csi2/Kconfig"drivers/media/platform/amlogic/c3/Makefile +1
-0@@ -1,3 +1,4 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-y += mipi-adapter/ obj-y += mipi-csi2/drivers/media/platform/amlogic/c3/mipi-adapter/Kconfig new file +0
-0
drivers/media/platform/amlogic/c3/mipi-adapter/Kconfig line 7
Quoted 7 lines
drivers/media/platform/amlogic/c3/mipi-adapter/Kconfig new file +7
-0@@ -0,0 +1,16 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config VIDEO_C3_MIPI_ADAPTER + tristate "Amlogic C3 MIPI adapter" + depends on ARCH_MESON || COMPILE_TEST + depends on VIDEO_DEV + depends on OF
I don't think this depends on OF as such, similarly to the 2nd patch.
Quoted 659 lines
drivers/media/platform/amlogic/c3/mipi-adapter/Kconfig new file +9
-0+ select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + help + Video4Linux2 driver for Amlogic C3 MIPI adapter. + C3 MIPI adapter mainly responsible for organizing + MIPI data and sending raw data to ISP pipeline. + + To compile this driver as a module choose m here.drivers/media/platform/amlogic/c3/mipi-adapter/Makefile new file +3
-0@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_VIDEO_C3_MIPI_ADAPTER) += c3-mipi-adap.odrivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c new file +635
-0@@ -0,0 +1,842 @@ +// SPDX-License-Identifier: (GPL-2.0-only OR MIT) +/* +* Copyright (C) 2024 Amlogic, Inc. All rights reserved +*/ + +#include <linux/clk.h> +#include <linux/device.h> +#include <linux/module.h> +#include <linux/mutex.h> +#include <linux/platform_device.h> +#include <linux/pm_runtime.h> + +#include <media/mipi-csi2.h> +#include <media/v4l2-async.h> +#include <media/v4l2-common.h> +#include <media/v4l2-device.h> +#include <media/v4l2-fwnode.h> +#include <media/v4l2-mc.h> +#include <media/v4l2-subdev.h> + +/* +* Adapter Block Diagram +* --------------------- +* +* +--------------------------------------------+ +* | Adapter | +* |--------------------------------------------| +* +------------+ | | | | | +-----+ +* | MIPI CSI-2 |--->| Frontend -> DDR_RD0 -> PIXEL0 -> ALIGNMENT |--->| ISP | +* +------------+ | | | | | +-----+ +* +--------------------------------------------+ +* +*/ + +/* C3 adapter submodule definition */ +enum { +SUBMD_TOP , +SUBMD_FD , +SUBMD_RD , +}; + +#define ADAP_SUBMD_MASK GENMASK(17, 16) +#define ADAP_SUBMD_SHIFT 16 +#define ADAP_SUBMD (x) (((x) & (ADAP_SUBMD_MASK)) >> (ADAP_SUBMD_SHIFT)) +#define ADAP_REG_ADDR_MASK GENMASK(15, 0) +#define ADAP_REG_ADDR (x) ((x) & (ADAP_REG_ADDR_MASK)) +#define ADAP_REG_T (x) ((SUBMD_TOP << ADAP_SUBMD_SHIFT) | (x)) +#define ADAP_REG_F (x) ((SUBMD_FD << ADAP_SUBMD_SHIFT) | (x)) +#define ADAP_REG_R (x) ((SUBMD_RD << ADAP_SUBMD_SHIFT) | (x)) + +#define MIPI_ADAP_CLOCK_NUM_MAX 3 +#define MIPI_ADAP_SUBDEV_NAME "c3-mipi-adapter" + +/* C3 MIPI adapter TOP register */ +#define MIPI_TOP_CTRL0 ADAP_REG_T(0x00) +#define MIPI_TOP_CTRL0_RST_ADAPTER_MASK BIT(1) +#define MIPI_TOP_CTRL0_RST_ADAPTER_APPLY BIT(1) +#define MIPI_TOP_CTRL0_RST_ADAPTER_EXIT (0 << 1) + +#define MIPI_ADAPT_DE_CTRL0 ADAP_REG_T(0x40) +#define MIPI_ADAPT_DE_CTRL0_RD_BUS_BYPASS_MASK BIT(3) +#define MIPI_ADAPT_DE_CTRL0_RD_BUS_BYPASS_EN BIT(3) +#define MIPI_ADAPT_DE_CTRL0_RD_BUS_BYPASS_DIS (0 << 3) +#define MIPI_ADAPT_DE_CTRL0_WR_BUS_BYPASS_MASK BIT(7) +#define MIPI_ADAPT_DE_CTRL0_WR_BUS_BYPASS_EN BIT(7) +#define MIPI_ADAPT_DE_CTRL0_WR_BUS_BYPASS_DIS (0 << 7) + +/* C3 MIPI adapter FRONTEND register */ +#define CSI2_CLK_RESET ADAP_REG_F(0x00) +#define CSI2_CLK_RESET_SW_RESET_MASK BIT(0) +#define CSI2_CLK_RESET_SW_RESET_APPLY BIT(0) +#define CSI2_CLK_RESET_SW_RESET_RELEASE (0 << 0) +#define CSI2_CLK_RESET_CLK_ENABLE_MASK BIT(1) +#define CSI2_CLK_RESET_CLK_ENABLE_EN BIT(1) +#define CSI2_CLK_RESET_CLK_ENABLE_DIS (0 << 1) + +#define CSI2_GEN_CTRL0 ADAP_REG_F(0x04) +#define CSI2_GEN_CTRL0_VC0_MASK BIT(0) +#define CSI2_GEN_CTRL0_VC0_EN BIT(0) +#define CSI2_GEN_CTRL0_VC0_DIS (0 << 0) +#define CSI2_GEN_CTRL0_ENABLE_PACKETS_MASK GENMASK(20, 16) +#define CSI2_GEN_CTRL0_ENABLE_PACKETS_RAW BIT(16) +#define CSI2_GEN_CTRL0_ENABLE_PACKETS_YUV (2 << 16) + +#define CSI2_X_START_END_ISP ADAP_REG_F(0x0c) +#define CSI2_X_START_END_ISP_X_START_MASK GENMASK(15, 0) +#define CSI2_X_START_END_ISP_X_START (x) ((x) << 0) +#define CSI2_X_START_END_ISP_X_END_MASK GENMASK(31, 16) +#define CSI2_X_START_END_ISP_X_END (x) (((x) - 1) << 16) + +#define CSI2_Y_START_END_ISP ADAP_REG_F(0x10) +#define CSI2_Y_START_END_ISP_Y_START_MASK GENMASK(15, 0) +#define CSI2_Y_START_END_ISP_Y_START (x) ((x) << 0) +#define CSI2_Y_START_END_ISP_Y_END_MASK GENMASK(31, 16) +#define CSI2_Y_START_END_ISP_Y_END (x) (((x) - 1) << 16) + +#define CSI2_VC_MODE ADAP_REG_F(0x1c) +#define CSI2_VC_MODE_VS_ISP_SEL_VC_MASK GENMASK(19, 16) +#define CSI2_VC_MODE_VS_ISP_SEL_VC_0 BIT(16) +#define CSI2_VC_MODE_VS_ISP_SEL_VC_1 (2 << 16) +#define CSI2_VC_MODE_VS_ISP_SEL_VC_2 (4 << 16) +#define CSI2_VC_MODE_VS_ISP_SEL_VC_3 (8 << 16) +#define CSI2_VC_MODE_HS_ISP_SEL_VC_MASK GENMASK(23, 20) +#define CSI2_VC_MODE_HS_ISP_SEL_VC_0 BIT(20) +#define CSI2_VC_MODE_HS_ISP_SEL_VC_1 (2 << 20) +#define CSI2_VC_MODE_HS_ISP_SEL_VC_2 (4 << 20) +#define CSI2_VC_MODE_HS_ISP_SEL_VC_3 (8 << 20) + +/* C3 MIPI adapter READER register */ +#define MIPI_ADAPT_DDR_RD0_CNTL0 ADAP_REG_R(0x00) +#define MIPI_ADAPT_DDR_RD0_CNTL0_MODULE_EN_MASK BIT(0) +#define MIPI_ADAPT_DDR_RD0_CNTL0_MODULE_EN BIT(0) +#define MIPI_ADAPT_DDR_RD0_CNTL0_MODULE_DIS (0 << 0) + +#define MIPI_ADAPT_DDR_RD0_CNTL1 ADAP_REG_R(0x04) +#define MIPI_ADAPT_DDR_RD0_CNTL1_PORT_SEL_MASK GENMASK(31, 30) +#define MIPI_ADAPT_DDR_RD0_CNTL1_PORT_SEL_DIRECT_MODE (0 << 30) +#define MIPI_ADAPT_DDR_RD0_CNTL1_PORT_SEL_DDR_MODE BIT(30) + +#define MIPI_ADAPT_PIXEL0_CNTL0 ADAP_REG_R(0x80) +#define MIPI_ADAPT_PIXEL0_CNTL0_WORK_MODE_MASK GENMASK(17, 16) +#define MIPI_ADAPT_PIXEL0_CNTL0_WORK_MODE_RAW_DDR (0 << 16) +#define MIPI_ADAPT_PIXEL0_CNTL0_WORK_MODE_RAW_DIRECT BIT(16) +#define MIPI_ADAPT_PIXEL0_CNTL0_DATA_TYPE_MASK GENMASK(25, 20) +#define MIPI_ADAPT_PIXEL0_CNTL0_DATA_TYPE (x) ((x) << 20) +#define MIPI_ADAPT_PIXEL0_CNTL0_START_EN_MASK BIT(31) +#define MIPI_ADAPT_PIXEL0_CNTL0_START_EN BIT(31) + +#define MIPI_ADAPT_ALIG_CNTL0 ADAP_REG_R(0x100) +#define MIPI_ADAPT_ALIG_CNTL0_H_NUM_MASK GENMASK(15, 0) +#define MIPI_ADAPT_ALIG_CNTL0_H_NUM (x) ((x) << 0) +#define MIPI_ADAPT_ALIG_CNTL0_V_NUM_MASK GENMASK(31, 16) +#define MIPI_ADAPT_ALIG_CNTL0_V_NUM (x) ((x) << 16) + +#define MIPI_ADAPT_ALIG_CNTL1 ADAP_REG_R(0x104) +#define MIPI_ADAPT_ALIG_CNTL1_HPE_NUM_MASK GENMASK(31, 16) +#define MIPI_ADAPT_ALIG_CNTL1_HPE_NUM (x) ((x) << 16) + +#define MIPI_ADAPT_ALIG_CNTL2 ADAP_REG_R(0x108) +#define MIPI_ADAPT_ALIG_CNTL2_VPE_NUM_MASK GENMASK(31, 16) +#define MIPI_ADAPT_ALIG_CNTL2_VPE_NUM (x) ((x) << 16) + +#define MIPI_ADAPT_ALIG_CNTL6 ADAP_REG_R(0x118) +#define MIPI_ADAPT_ALIG_CNTL6_PATH0_EN_MASK BIT(0) +#define MIPI_ADAPT_ALIG_CNTL6_PATH0_EN BIT(0) +#define MIPI_ADAPT_ALIG_CNTL6_PATH0_DIS (0 << 0) +#define MIPI_ADAPT_ALIG_CNTL6_PIX0_DATA_MODE_MASK BIT(4) +#define MIPI_ADAPT_ALIG_CNTL6_PIX0_DATA_MODE_DDR (0 << 4) +#define MIPI_ADAPT_ALIG_CNTL6_PIX0_DATA_MODE_DIRECT BIT(4) +#define MIPI_ADAPT_ALIG_CNTL6_DATA0_EN_MASK BIT(12) +#define MIPI_ADAPT_ALIG_CNTL6_DATA0_EN BIT(12) +#define MIPI_ADAPT_ALIG_CNTL6_DATA0_DIS (0 << 12) + +#define MIPI_ADAPT_ALIG_CNTL8 ADAP_REG_R(0x120) +#define MIPI_ADAPT_ALIG_CNTL8_FRMAE_CONTINUE_MASK BIT(5) +#define MIPI_ADAPT_ALIG_CNTL8_FRMAE_CONTINUE_EN BIT(5) +#define MIPI_ADAPT_ALIG_CNTL8_FRMAE_CONTINUE_DIS (0 << 5) +#define MIPI_ADAPT_ALIG_CNTL8_EXCEED_DIS_MASK BIT(12) +#define MIPI_ADAPT_ALIG_CNTL8_EXCEED_HOLD (0 << 12) +#define MIPI_ADAPT_ALIG_CNTL8_EXCEED_NOT_HOLD BIT(12) +#define MIPI_ADAPT_ALIG_CNTL8_START_EN_MASK BIT(31) +#define MIPI_ADAPT_ALIG_CNTL8_START_EN BIT(31) + +#define MIPI_ADAP_MAX_WIDTH 2888 +#define MIPI_ADAP_MIN_WIDTH 160 +#define MIPI_ADAP_MAX_HEIGHT 2240 +#define MIPI_ADAP_MIN_HEIGHT 120 +#define MIPI_ADAP_DEFAULT_WIDTH 1920 +#define MIPI_ADAP_DEFAULT_HEIGHT 1080 +#define MIPI_ADAP_DEFAULT_FMT MEDIA_BUS_FMT_SRGGB10_1X10 + +/* C3 MIPI adapter pad list */ +enum { +C3_MIPI_ADAP_PAD_SINK , +C3_MIPI_ADAP_PAD_SRC , +C3_MIPI_ADAP_PAD_MAX +}; + +/* +* struct c3_adap_info - mipi adapter information +* +* @clocks: array of mipi adapter clock names +* @clock_num: actual clock number +*/ +struct c3_adap_info { +char *clocks[MIPI_ADAP_CLOCK_NUM_MAX ]; +u32 clock_num; +}; + +/* +* struct c3_adap_device - mipi adapter platform device +* +* @dev: pointer to the struct device +* @top: mipi adapter top register address +* @fd: mipi adapter frontend register address +* @rd: mipi adapter reader register address +* @clks: array of MIPI adapter clocks +* @sd: mipi adapter sub-device +* @pads: mipi adapter sub-device pads +* @notifier: notifier to register on the v4l2-async API +* @src_sd: source sub-device pad +* @info: version-specific MIPI adapter information +*/ +struct c3_adap_device { +struct device *dev; +void __iomem *top; +void __iomem *fd; +void __iomem *rd; +struct clk_bulk_data clks[MIPI_ADAP_CLOCK_NUM_MAX ]; + +struct v4l2_subdev sd; +struct media_pad pads[C3_MIPI_ADAP_PAD_MAX ]; +struct v4l2_async_notifier notifier; +struct media_pad *src_pad; + +const struct c3_adap_info *info; +}; + +/* Format helpers */ + +struct c3_adap_pix_format { +u32 code; +u8 type; +}; + +static const struct c3_adap_pix_format c3_mipi_adap_formats[] = { + {MEDIA_BUS_FMT_SBGGR10_1X10 ,MIPI_CSI2_DT_RAW10 }, + {MEDIA_BUS_FMT_SGBRG10_1X10 ,MIPI_CSI2_DT_RAW10 }, + {MEDIA_BUS_FMT_SGRBG10_1X10 ,MIPI_CSI2_DT_RAW10 }, + {MEDIA_BUS_FMT_SRGGB10_1X10 ,MIPI_CSI2_DT_RAW10 }, + {MEDIA_BUS_FMT_SBGGR12_1X12 ,MIPI_CSI2_DT_RAW12 }, + {MEDIA_BUS_FMT_SGBRG12_1X12 ,MIPI_CSI2_DT_RAW12 }, + {MEDIA_BUS_FMT_SGRBG12_1X12 ,MIPI_CSI2_DT_RAW12 }, + {MEDIA_BUS_FMT_SRGGB12_1X12 ,MIPI_CSI2_DT_RAW12 }, +}; + +static const struct c3_adap_pix_format *c3_mipi_adap_find_format (u32 code) +{ +for (unsigned int i =0 ; i <ARRAY_SIZE (c3_mipi_adap_formats); i++) +if (code == c3_mipi_adap_formats[i].code) +return &c3_mipi_adap_formats[i]; + +return NULL ; +} + +/* Hardware configuration */ + +static void c3_mipi_adap_update_bits (struct c3_adap_device *adap,u32 reg, +u32 mask,u32 val) +{ +void __iomem *addr; +u32 orig, tmp; + +switch (ADAP_SUBMD (reg)) { +case SUBMD_TOP : + addr = adap->top +ADAP_REG_ADDR (reg); +break ; +case SUBMD_FD : + addr = adap->fd +ADAP_REG_ADDR (reg); +break ; +case SUBMD_RD : + addr = adap->rd +ADAP_REG_ADDR (reg); +break ; +default : +dev_err (adap->dev, +"Invalid sub-module: %lu\n" ,ADAP_SUBMD (reg)); +return ; + } + + orig =readl (addr); + tmp = orig & ~mask; + tmp |= val & mask; + +if (tmp != orig) +writel (tmp, addr); +} + +/* Configure adapter top sub module */ +static void c3_mipi_adap_cfg_top (struct c3_adap_device *adap) +{ +/* Reset adapter */ +c3_mipi_adap_update_bits (adap,MIPI_TOP_CTRL0 , +MIPI_TOP_CTRL0_RST_ADAPTER_MASK , +MIPI_TOP_CTRL0_RST_ADAPTER_APPLY ); +c3_mipi_adap_update_bits (adap,MIPI_TOP_CTRL0 , +MIPI_TOP_CTRL0_RST_ADAPTER_MASK , +MIPI_TOP_CTRL0_RST_ADAPTER_EXIT ); + +/* Bypass decompress */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_DE_CTRL0 , +MIPI_ADAPT_DE_CTRL0_RD_BUS_BYPASS_MASK , +MIPI_ADAPT_DE_CTRL0_RD_BUS_BYPASS_EN ); +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_DE_CTRL0 , +MIPI_ADAPT_DE_CTRL0_WR_BUS_BYPASS_MASK , +MIPI_ADAPT_DE_CTRL0_WR_BUS_BYPASS_EN ); +} + +/* Configure adapter frontend sub module */ +static void c3_mipi_adap_cfg_frontend (struct c3_adap_device *adap, +struct v4l2_mbus_framefmt *fmt) +{ +/* Reset frontend module */ +c3_mipi_adap_update_bits (adap,CSI2_CLK_RESET , +CSI2_CLK_RESET_SW_RESET_MASK , +CSI2_CLK_RESET_SW_RESET_APPLY ); +c3_mipi_adap_update_bits (adap,CSI2_CLK_RESET , +CSI2_CLK_RESET_SW_RESET_MASK , +CSI2_CLK_RESET_SW_RESET_RELEASE ); +c3_mipi_adap_update_bits (adap,CSI2_CLK_RESET , +CSI2_CLK_RESET_CLK_ENABLE_MASK , +CSI2_CLK_RESET_CLK_ENABLE_EN ); + +c3_mipi_adap_update_bits (adap,CSI2_X_START_END_ISP , +CSI2_X_START_END_ISP_X_START_MASK , +CSI2_X_START_END_ISP_X_START (0 )); +c3_mipi_adap_update_bits (adap,CSI2_X_START_END_ISP , +CSI2_X_START_END_ISP_X_END_MASK , +CSI2_X_START_END_ISP_X_END (fmt->width)); + +c3_mipi_adap_update_bits (adap,CSI2_Y_START_END_ISP , +CSI2_Y_START_END_ISP_Y_START_MASK , +CSI2_Y_START_END_ISP_Y_START (0 )); +c3_mipi_adap_update_bits (adap,CSI2_Y_START_END_ISP , +CSI2_Y_START_END_ISP_Y_END_MASK , +CSI2_Y_START_END_ISP_Y_END (fmt->height)); + +/* Select VS and HS signal for direct path */ +c3_mipi_adap_update_bits (adap,CSI2_VC_MODE , +CSI2_VC_MODE_VS_ISP_SEL_VC_MASK , +CSI2_VC_MODE_VS_ISP_SEL_VC_0 ); +c3_mipi_adap_update_bits (adap,CSI2_VC_MODE , +CSI2_VC_MODE_HS_ISP_SEL_VC_MASK , +CSI2_VC_MODE_HS_ISP_SEL_VC_0 ); + +/* Enable to receive RAW packet */ +c3_mipi_adap_update_bits (adap,CSI2_GEN_CTRL0 , +CSI2_GEN_CTRL0_ENABLE_PACKETS_MASK , +CSI2_GEN_CTRL0_ENABLE_PACKETS_RAW ); + +/* Enable virtual channel 0 */ +c3_mipi_adap_update_bits (adap,CSI2_GEN_CTRL0 , +CSI2_GEN_CTRL0_VC0_MASK , +CSI2_GEN_CTRL0_VC0_EN ); +} + +static void c3_mipi_adap_cfg_rd0 (struct c3_adap_device *adap) +{ +/* Select direct mode for DDR_RD0 mode */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_DDR_RD0_CNTL1 , +MIPI_ADAPT_DDR_RD0_CNTL1_PORT_SEL_MASK , +MIPI_ADAPT_DDR_RD0_CNTL1_PORT_SEL_DIRECT_MODE ); + +/* Data can't bypass DDR_RD0 in direct mode, so enable DDR_RD0 here */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_DDR_RD0_CNTL0 , +MIPI_ADAPT_DDR_RD0_CNTL0_MODULE_EN_MASK , +MIPI_ADAPT_DDR_RD0_CNTL0_MODULE_EN ); +} + +static void c3_mipi_adap_cfg_pixel0 (struct c3_adap_device *adap, +struct v4l2_mbus_framefmt *fmt) +{ +const struct c3_adap_pix_format *pix; + + pix =c3_mipi_adap_find_format (fmt->code); + +/* Set work mode and data type for PIXEL0 module */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_PIXEL0_CNTL0 , +MIPI_ADAPT_PIXEL0_CNTL0_WORK_MODE_MASK , +MIPI_ADAPT_PIXEL0_CNTL0_WORK_MODE_RAW_DIRECT ); +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_PIXEL0_CNTL0 , +MIPI_ADAPT_PIXEL0_CNTL0_DATA_TYPE_MASK , +MIPI_ADAPT_PIXEL0_CNTL0_DATA_TYPE (pix->type)); + +/* Start PIXEL0 module */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_PIXEL0_CNTL0 , +MIPI_ADAPT_PIXEL0_CNTL0_START_EN_MASK , +MIPI_ADAPT_PIXEL0_CNTL0_START_EN ); +} + +static void c3_mipi_adap_cfg_alig (struct c3_adap_device *adap, +struct v4l2_mbus_framefmt *fmt) +{ +/* +* ISP hardware requires the number of horizonal blanks greater than +* 64 cycles, so adding 64 here. +*/ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_ALIG_CNTL0 , +MIPI_ADAPT_ALIG_CNTL0_H_NUM_MASK , +MIPI_ADAPT_ALIG_CNTL0_H_NUM (fmt->width +64 )); + +/* +* ISP hardware requires the number of vertical blanks greater than +* 40 lines, so adding 40 here. +*/ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_ALIG_CNTL0 , +MIPI_ADAPT_ALIG_CNTL0_V_NUM_MASK , +MIPI_ADAPT_ALIG_CNTL0_V_NUM (fmt->height +40 )); + +/* End pixel in a line */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_ALIG_CNTL1 , +MIPI_ADAPT_ALIG_CNTL1_HPE_NUM_MASK , +MIPI_ADAPT_ALIG_CNTL1_HPE_NUM (fmt->width)); + +/* End line in a frame */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_ALIG_CNTL2 , +MIPI_ADAPT_ALIG_CNTL2_VPE_NUM_MASK , +MIPI_ADAPT_ALIG_CNTL2_VPE_NUM (fmt->height)); + +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_ALIG_CNTL6 , +MIPI_ADAPT_ALIG_CNTL6_PATH0_EN_MASK , +MIPI_ADAPT_ALIG_CNTL6_PATH0_EN ); + +/* Select direct mode for ALIG module */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_ALIG_CNTL6 , +MIPI_ADAPT_ALIG_CNTL6_PIX0_DATA_MODE_MASK , +MIPI_ADAPT_ALIG_CNTL6_PIX0_DATA_MODE_DIRECT ); + +/* Enable to send raw data */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_ALIG_CNTL6 , +MIPI_ADAPT_ALIG_CNTL6_DATA0_EN_MASK , +MIPI_ADAPT_ALIG_CNTL6_DATA0_EN ); + +/* Set continue mode and disable hold counter */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_ALIG_CNTL8 , +MIPI_ADAPT_ALIG_CNTL8_FRMAE_CONTINUE_MASK , +MIPI_ADAPT_ALIG_CNTL8_FRMAE_CONTINUE_EN ); +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_ALIG_CNTL8 , +MIPI_ADAPT_ALIG_CNTL8_EXCEED_DIS_MASK , +MIPI_ADAPT_ALIG_CNTL8_EXCEED_NOT_HOLD ); + +/* Start ALIG module */ +c3_mipi_adap_update_bits (adap,MIPI_ADAPT_ALIG_CNTL8 , +MIPI_ADAPT_ALIG_CNTL8_START_EN_MASK , +MIPI_ADAPT_ALIG_CNTL8_START_EN ); +} + +/* V4L2 subdev operations */ + +static int c3_mipi_adap_enable_streams (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state, +u32 pad,u64 streams_mask) +{ +struct c3_adap_device *adap =v4l2_get_subdevdata (sd); +struct v4l2_mbus_framefmt *fmt; +struct media_pad *sink_pad; +struct v4l2_subdev *src_sd; +int ret; + + sink_pad = &adap->pads[C3_MIPI_ADAP_PAD_SINK ]; + adap->src_pad =media_pad_remote_pad_unique (sink_pad); +if (IS_ERR (adap->src_pad)) { +dev_dbg (adap->dev,"Failed to get source pad for MIPI adap\n" ); +return -EPIPE ; + } + + src_sd =media_entity_to_v4l2_subdev (adap->src_pad->entity); + +pm_runtime_resume_and_get (adap->dev); + + fmt =v4l2_subdev_state_get_format (state,C3_MIPI_ADAP_PAD_SINK ); + +c3_mipi_adap_cfg_top (adap); +c3_mipi_adap_cfg_frontend (adap, fmt); +c3_mipi_adap_cfg_rd0 (adap); +c3_mipi_adap_cfg_pixel0 (adap, fmt); +c3_mipi_adap_cfg_alig (adap, fmt); + + ret =v4l2_subdev_enable_streams (src_sd, adap->src_pad->index,BIT (0 )); +if (ret) { +pm_runtime_put (adap->dev); +return ret; + } + +return 0 ; +} + +static int c3_mipi_adap_disable_streams (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state, +u32 pad,u64 streams_mask) +{ +struct c3_adap_device *adap =v4l2_get_subdevdata (sd); +struct v4l2_subdev *src_sd; + +if (adap->src_pad) { + src_sd =media_entity_to_v4l2_subdev (adap->src_pad->entity); +v4l2_subdev_disable_streams (src_sd, adap->src_pad->index, +BIT (0 )); + } + adap->src_pad =NULL ; + +pm_runtime_put (adap->dev); + +return 0 ; +} + +static int c3_mipi_adap_enum_mbus_code (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state, +struct v4l2_subdev_mbus_code_enum *code) +{ +struct v4l2_mbus_framefmt *fmt; + +switch (code->pad) { +case C3_MIPI_ADAP_PAD_SINK : +if (code->index >=ARRAY_SIZE (c3_mipi_adap_formats)) +return -EINVAL ; + + code->code = c3_mipi_adap_formats[code->index].code; +break ; +case C3_MIPI_ADAP_PAD_SRC : +if (code->index) +return -EINVAL ; + + fmt =v4l2_subdev_state_get_format (state, code->pad); + code->code = fmt->code; +break ; +default : +return -EINVAL ; + } + +return 0 ; +} + +static int c3_mipi_adap_set_fmt (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state, +struct v4l2_subdev_format *format) +{ +struct v4l2_mbus_framefmt *fmt; +const struct c3_adap_pix_format *pix_format; + +if (format->pad !=C3_MIPI_ADAP_PAD_SINK ) +return v4l2_subdev_get_fmt (sd, state, format); + + pix_format =c3_mipi_adap_find_format (format->format.code); +if (!pix_format) + pix_format = &c3_mipi_adap_formats[0 ]; + + fmt =v4l2_subdev_state_get_format (state, format->pad); + fmt->code = pix_format->code; + fmt->width =clamp_t (u32, format->format.width, +MIPI_ADAP_MIN_WIDTH ,MIPI_ADAP_MAX_WIDTH ); + fmt->height =clamp_t (u32, format->format.height, +MIPI_ADAP_MIN_HEIGHT ,MIPI_ADAP_MAX_HEIGHT ); + fmt->colorspace =V4L2_COLORSPACE_RAW ; + fmt->xfer_func =V4L2_XFER_FUNC_NONE ; + fmt->ycbcr_enc =V4L2_YCBCR_ENC_601 ; + fmt->quantization =V4L2_QUANTIZATION_FULL_RANGE ; + + format->format = *fmt; + +/* Synchronize the format to source pad */ + fmt =v4l2_subdev_state_get_format (state,C3_MIPI_ADAP_PAD_SRC ); + *fmt = format->format; + +return 0 ; +} + +static int c3_mipi_adap_init_state (struct v4l2_subdev *sd, +struct v4l2_subdev_state *state) +{ +struct v4l2_mbus_framefmt *sink_fmt; +struct v4l2_mbus_framefmt *src_fmt; + + sink_fmt =v4l2_subdev_state_get_format (state,C3_MIPI_ADAP_PAD_SINK ); + src_fmt =v4l2_subdev_state_get_format (state,C3_MIPI_ADAP_PAD_SRC ); + + sink_fmt->width =MIPI_ADAP_DEFAULT_WIDTH ; + sink_fmt->height =MIPI_ADAP_DEFAULT_HEIGHT ; + sink_fmt->field =V4L2_FIELD_NONE ; + sink_fmt->code =MIPI_ADAP_DEFAULT_FMT ; + sink_fmt->colorspace =V4L2_COLORSPACE_RAW ; + sink_fmt->xfer_func =V4L2_XFER_FUNC_NONE ; + sink_fmt->ycbcr_enc =V4L2_YCBCR_ENC_601 ; + sink_fmt->quantization =V4L2_QUANTIZATION_FULL_RANGE ; + + *src_fmt = *sink_fmt; + +return 0 ; +} + +static const struct v4l2_subdev_pad_ops c3_mipi_adap_pad_ops = { + .enum_mbus_code = c3_mipi_adap_enum_mbus_code, + .get_fmt = v4l2_subdev_get_fmt, + .set_fmt = c3_mipi_adap_set_fmt, + .enable_streams = c3_mipi_adap_enable_streams, + .disable_streams = c3_mipi_adap_disable_streams, +}; + +static const struct v4l2_subdev_ops c3_mipi_adap_subdev_ops = { + .pad = &c3_mipi_adap_pad_ops, +}; + +static const struct v4l2_subdev_internal_ops c3_mipi_adap_internal_ops = { + .init_state = c3_mipi_adap_init_state, +}; + +/* Media entity operations */ +static const struct media_entity_operations c3_mipi_adap_entity_ops = { + .link_validate = v4l2_subdev_link_validate, +}; + +/* PM runtime */ + +static int c3_mipi_adap_runtime_suspend (struct device *dev) +{ +struct c3_adap_device *adap =dev_get_drvdata (dev); + +clk_bulk_disable_unprepare (adap->info->clock_num, adap->clks); + +return 0 ; +} + +static int c3_mipi_adap_runtime_resume (struct device *dev) +{ +struct c3_adap_device *adap =dev_get_drvdata (dev); + +return clk_bulk_prepare_enable (adap->info->clock_num, adap->clks); +} + +static const struct dev_pm_ops c3_mipi_adap_pm_ops = { + SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, + pm_runtime_force_resume) +RUNTIME_PM_OPS (c3_mipi_adap_runtime_suspend, + c3_mipi_adap_runtime_resume,NULL ) +}; + +/* Probe/remove & platform driver */ + +static int c3_mipi_adap_subdev_init (struct c3_adap_device *adap) +{ +struct v4l2_subdev *sd = &adap->sd; +int ret; + +v4l2_subdev_init (sd, &c3_mipi_adap_subdev_ops); + sd->owner =THIS_MODULE ; + sd->flags |=V4L2_SUBDEV_FL_HAS_DEVNODE ;
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c line 645
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c new file +10
-0+ sd->internal_ops = &c3_mipi_adap_internal_ops; +snprintf (sd->name,sizeof (sd->name),"%s" ,MIPI_ADAP_SUBDEV_NAME ); + + sd->entity.function =MEDIA_ENT_F_VID_IF_BRIDGE ; + sd->entity.ops = &c3_mipi_adap_entity_ops; + + sd->dev = adap->dev; +v4l2_set_subdevdata (sd, adap); + + adap->pads[C3_MIPI_ADAP_PAD_SINK ].flags =MEDIA_PAD_FL_SINK ;
Same as for the 2nd patch.
Quoted 117 lines
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c new file +117
-0+ adap->pads[C3_MIPI_ADAP_PAD_SRC ].flags =MEDIA_PAD_FL_SOURCE ; + ret =media_entity_pads_init (&sd->entity,C3_MIPI_ADAP_PAD_MAX , + adap->pads); +if (ret) +return ret; + + ret =v4l2_subdev_init_finalize (sd); +if (ret) { +media_entity_cleanup (&sd->entity); +return ret; + } + +return 0 ; +} + +static void c3_mipi_adap_subdev_deinit (struct c3_adap_device *adap) +{ +v4l2_subdev_cleanup (&adap->sd); +media_entity_cleanup (&adap->sd.entity); +} + +/* Subdev notifier register */ +static int c3_mipi_adap_notify_bound (struct v4l2_async_notifier *notifier, +struct v4l2_subdev *sd, +struct v4l2_async_connection *asc) +{ +struct c3_adap_device *adap =v4l2_get_subdevdata (notifier->sd); +struct media_pad *sink = &adap->sd.entity.pads[C3_MIPI_ADAP_PAD_SINK ]; + +return v4l2_create_fwnode_links_to_pad (sd, sink,MEDIA_LNK_FL_ENABLED | +MEDIA_LNK_FL_IMMUTABLE ); +} + +static const struct v4l2_async_notifier_operations c3_mipi_adap_notify_ops = { + .bound = c3_mipi_adap_notify_bound, +}; + +static int c3_mipi_adap_async_register (struct c3_adap_device *adap) +{ +struct v4l2_async_connection *asc; +struct fwnode_handle *ep; +int ret; + +v4l2_async_subdev_nf_init (&adap->notifier, &adap->sd); + + ep =fwnode_graph_get_endpoint_by_id (dev_fwnode (adap->dev),0 ,0 , +FWNODE_GRAPH_ENDPOINT_NEXT ); +if (!ep) +return -ENOTCONN ; + + asc =v4l2_async_nf_add_fwnode_remote (&adap->notifier, ep, + struct v4l2_async_connection); +if (IS_ERR (asc)) { + ret =PTR_ERR (asc); + goto err_put_handle; + } + + adap->notifier.ops = &c3_mipi_adap_notify_ops; + ret =v4l2_async_nf_register (&adap->notifier); +if (ret) + goto err_cleanup_nf; + + ret =v4l2_async_register_subdev (&adap->sd); +if (ret) + goto err_unregister_nf; + +fwnode_handle_put (ep); + +return 0 ; + +err_unregister_nf: +v4l2_async_nf_unregister (&adap->notifier); +err_cleanup_nf: +v4l2_async_nf_cleanup (&adap->notifier); +err_put_handle: +fwnode_handle_put (ep); +return ret; +} + +static void c3_mipi_adap_async_unregister (struct c3_adap_device *adap) +{ +v4l2_async_unregister_subdev (&adap->sd); +v4l2_async_nf_unregister (&adap->notifier); +v4l2_async_nf_cleanup (&adap->notifier); +} + +static int c3_mipi_adap_ioremap_resource (struct c3_adap_device *adap) +{ +struct device *dev = adap->dev; +struct platform_device *pdev =to_platform_device (dev); + + adap->top =devm_platform_ioremap_resource_byname (pdev,"top" ); +if (IS_ERR (adap->top)) +return PTR_ERR (adap->top); + + adap->fd =devm_platform_ioremap_resource_byname (pdev,"fd" ); +if (IS_ERR (adap->fd)) +return PTR_ERR (adap->fd); + + adap->rd =devm_platform_ioremap_resource_byname (pdev,"rd" ); +if (IS_ERR (adap->rd)) +return PTR_ERR (adap->rd); + +return 0 ; +} + +static int c3_mipi_adap_get_clocks (struct c3_adap_device *adap) +{ +const struct c3_adap_info *info = adap->info; + +for (unsigned int i =0 ; i < info->clock_num; i++) + adap->clks[i].id = info->clocks[i]; + +return devm_clk_bulk_get (adap->dev, info->clock_num, adap->clks); +} + +static int c3_mipi_adap_probe (struct platform_device *pdev)
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c line 772
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c new file +10
-0+{ +struct device *dev = &pdev->dev; +struct c3_adap_device *adap; +int ret; + + adap =devm_kzalloc (dev,sizeof (*adap),GFP_KERNEL ); +if (!adap) +return -ENOMEM ; + + adap->info =of_device_get_match_data (dev);
Same here, too.
Quoted 34 lines
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c new file +34
-0+ adap->dev = dev; + + ret =c3_mipi_adap_ioremap_resource (adap); +if (ret) +return dev_err_probe (dev, ret,"Failed to ioremap resource\n" ); + + ret =c3_mipi_adap_get_clocks (adap); +if (ret) +return dev_err_probe (dev, ret,"Failed to get clocks\n" ); + +platform_set_drvdata (pdev, adap); + +pm_runtime_enable (dev); + + ret =c3_mipi_adap_subdev_init (adap); +if (ret) + goto err_disable_runtime_pm; + + ret =c3_mipi_adap_async_register (adap); +if (ret) + goto err_deinit_subdev; + +return 0 ; + +err_deinit_subdev: +c3_mipi_adap_subdev_deinit (adap); +err_disable_runtime_pm: +pm_runtime_disable (dev); +return ret; +}; + +static void c3_mipi_adap_remove (struct platform_device *pdev) +{ +struct c3_adap_device *adap =platform_get_drvdata (pdev);
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c line 816
Quoted 10 lines
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c new file +10
-0+ +c3_mipi_adap_async_unregister (adap); +c3_mipi_adap_subdev_deinit (adap); + +pm_runtime_disable (&pdev->dev); +}; + +static const struct c3_adap_info c3_mipi_adap_info = { + .clocks = {"vapb" ,"isp0" }, + .clock_num =2
Ditto.
Quoted 27 lines
drivers/media/platform/amlogic/c3/mipi-adapter/c3-mipi-adap.c new file +26
-0+}; + +static const struct of_device_id c3_mipi_adap_of_match[] = { + { + .compatible ="amlogic,c3-mipi-adapter" , + .data = &c3_mipi_adap_info + }, + { }, +}; +MODULE_DEVICE_TABLE (of, c3_mipi_adap_of_match); + +static struct platform_driver c3_mipi_adap_driver = { + .probe = c3_mipi_adap_probe, + .remove = c3_mipi_adap_remove, + .driver = { + .name ="c3-mipi-adapter" , + .of_match_table = c3_mipi_adap_of_match, + .pm =pm_ptr (&c3_mipi_adap_pm_ops), + }, +}; + +module_platform_driver (c3_mipi_adap_driver); + +MODULE_AUTHOR ("Keke Li <[email protected]>" ); +MODULE_DESCRIPTION ("Amlogic C3 MIPI adapter" ); +MODULE_LICENSE ("GPL" );
Signature · 3 lines
Regards, Sakari Ailus
Keke Li
maintainerPATCH v9 5/10 dt-bindings: media: Add amlogic,c3-isp.yaml
In reply to Keke Lic3-isp is used to process raw image.
--- .../devicetree/bindings/media/amlogic,c3-isp.yaml | 88 ++++++++++++++++++++++ MAINTAINERS | 6 ++ 2 files changed, 94 insertions(+)
Documentation/devicetree/bindings/media/amlogic,c3-isp.yaml new file +88 -0
@@ -0,0 +1,88 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/amlogic,c3-isp.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Amlogic C3 Image Signal Processing Unit + +maintainers: + - Keke Li <[email protected]> + +description: + Amlogic ISP is the RAW image processing module + and supports three channels image output. + +properties: + compatible: + enum: + - amlogic,c3-isp + + reg: + maxItems: 1 + + reg-names: + items: + - const: isp + + power-domains: + maxItems: 1 + + clocks: + maxItems: 2 + + clock-names: + items: + - const: vapb + - const: isp0 + + interrupts: + maxItems: 1 + + port: + $ref: /schemas/graph.yaml#/properties/port + description: input port node. + +required: + - compatible + - reg + - reg-names + - power-domains + - clocks + - clock-names + - interrupts + - port + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/arm-gic.h> + #include <dt-bindings/clock/amlogic,c3-peripherals-clkc.h> + #include <dt-bindings/power/amlogic,c3-pwrc.h> + + soc { + #address-cells = <2>; + #size-cells = <2>; + + isp: isp@ff000000 { + compatible = "amlogic,c3-isp"; + reg = <0x0 0xff000000 0x0 0xf000>; + reg-names = "isp"; + power-domains = <&pwrc PWRC_C3_ISP_TOP_ID>; + clocks = <&clkc_periphs CLKID_VAPB>, + <&clkc_periphs CLKID_ISP0>; + clock-names = "vapb", "isp0"; + assigned-clocks = <&clkc_periphs CLKID_VAPB>, + <&clkc_periphs CLKID_ISP0>; + assigned-clock-rates = <0>, <400000000>; + interrupts = <GIC_SPI 145 IRQ_TYPE_EDGE_RISING>; + + port { + c3_isp_in: endpoint { + remote-endpoint = <&c3_adap_out>; + }; + }; + }; + }; +...
MAINTAINERS +6 -0
@@ -1258,6 +1258,12 @@ F: Documentation/devicetree/bindings/perf/amlogic,g12-ddr-pmu.yaml F: drivers/perf/amlogic/ F: include/soc/amlogic/ +AMLOGIC ISP DRIVER +M: Keke Li <[email protected]> +L: [email protected] +S: Maintained +F: Documentation/devicetree/bindings/media/amlogic,c3-isp.yaml + AMLOGIC MIPI ADAPTER DRIVER M: Keke Li <[email protected]> L: [email protected]
Signature · 1 line
2.49.0
Keke Li
maintainerPATCH v9 6/10 media: Add C3ISP_PARAMS and C3ISP_STATS meta formats
In reply to Keke LiC3ISP_PARAMS is the C3 ISP Parameters format. C3ISP_STATS is the C3 ISP Statistics format.
--- drivers/media/v4l2-core/v4l2-ioctl.c | 2 ++ include/uapi/linux/videodev2.h | 4 ++++ 2 files changed, 6 insertions(+)
drivers/media/v4l2-core/v4l2-ioctl.c +2 -0
@@ -1464,6 +1464,8 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)case V4L2_META_FMT_RK_ISP1_PARAMS : descr ="Rockchip ISP1 3A Parameters" ;break ;case V4L2_META_FMT_RK_ISP1_STAT_3A : descr ="Rockchip ISP1 3A Statistics" ;break ;case V4L2_META_FMT_RK_ISP1_EXT_PARAMS : descr ="Rockchip ISP1 Ext 3A Params" ;break ; +case V4L2_META_FMT_C3ISP_PARAMS : descr ="Amlogic C3 ISP Parameters" ;break ; +case V4L2_META_FMT_C3ISP_STATS : descr ="Amlogic C3 ISP Statistics" ;break ;case V4L2_PIX_FMT_NV12_8L128 : descr ="NV12 (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12M_8L128 : descr ="NV12M (8x128 Linear)" ;break ;case V4L2_PIX_FMT_NV12_10BE_8L128 : descr ="10-bit NV12 (8x128 Linear, BE)" ;break ;
include/uapi/linux/videodev2.h +4 -0
@@ -868,6 +868,10 @@ struct v4l2_pix_format {#define V4L2_META_FMT_RK_ISP1_STAT_3A v4l2_fourcc('R', 'K', '1', 'S')/* Rockchip ISP1 3A Statistics */ #define V4L2_META_FMT_RK_ISP1_EXT_PARAMS v4l2_fourcc('R', 'K', '1', 'E')/* Rockchip ISP1 3a Extensible Parameters */ +/* Vendor specific - used for C3_ISP */ +#define V4L2_META_FMT_C3ISP_PARAMS v4l2_fourcc('C', '3', 'P', 'M')/* Amlogic C3 ISP Parameters */ +#define V4L2_META_FMT_C3ISP_STATS v4l2_fourcc('C', '3', 'S', 'T')/* Amlogic C3 ISP Statistics */ +/* Vendor specific - used for RaspberryPi PiSP */ #define V4L2_META_FMT_RPI_BE_CFG v4l2_fourcc('R', 'P', 'B', 'C')/* PiSP BE configuration */ #define V4L2_META_FMT_RPI_FE_CFG v4l2_fourcc('R', 'P', 'F', 'C')/* PiSP FE configuration */
Signature · 1 line
2.49.0
Keke Li
maintainerPATCH v9 7/10 media: uapi: Add stats info and parameters buffer for C3 ISP
In reply to Keke LiAdd a header that describes the 3A statistics buffer and the parameters buffer for C3 ISP
--- MAINTAINERS | 1 + include/uapi/linux/media/amlogic/c3-isp-config.h | 564 +++++++++++++++++++++++ 2 files changed, 565 insertions(+)
MAINTAINERS +1 -0
@@ -1263,6 +1263,7 @@ M: Keke Li <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/media/amlogic,c3-isp.yaml +F: include/uapi/linux/media/amlogic/ AMLOGIC MIPI ADAPTER DRIVER M: Keke Li <[email protected]>
include/uapi/linux/media/amlogic/c3-isp-config.h new file +564 -0
564 lines not on this page · raw message
Signature · 1 line
2.49.0
Keke Li
maintainerPATCH v9 8/10 media: platform: Add C3 ISP driver
In reply to Keke LiThe C3 ISP supports multi-camera and multi-exposure HDR, integrates advanced imaging technologies for optimal quality, and drives the core pipeline to transform raw sensor data into high-fidelity images through demosaicing, color correction, and tone mapping operations.
--- MAINTAINERS | 1 + drivers/media/platform/amlogic/c3/Kconfig | 1 + drivers/media/platform/amlogic/c3/Makefile | 1 + drivers/media/platform/amlogic/c3/isp/Kconfig | 18 + drivers/media/platform/amlogic/c3/isp/Makefile | 10 + .../media/platform/amlogic/c3/isp/c3-isp-capture.c | 806 ++++++++++++++++ .../media/platform/amlogic/c3/isp/c3-isp-common.h | 340 +++++++ .../media/platform/amlogic/c3/isp/c3-isp-core.c | 641 +++++++++++++ drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c | 421 ++++++++ .../media/platform/amlogic/c3/isp/c3-isp-params.c | 1010 ++++++++++++++++++++ .../media/platform/amlogic/c3/isp/c3-isp-regs.h | 618 ++++++++++++ .../media/platform/amlogic/c3/isp/c3-isp-resizer.c | 892 +++++++++++++++++ .../media/platform/amlogic/c3/isp/c3-isp-stats.c | 328 +++++++ 13 files changed, 5087 insertions(+)
MAINTAINERS +1 -0
@@ -1263,6 +1263,7 @@ M: Keke Li <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/media/amlogic,c3-isp.yaml +F: drivers/media/platform/amlogic/c3/isp/ F: include/uapi/linux/media/amlogic/ AMLOGIC MIPI ADAPTER DRIVER
drivers/media/platform/amlogic/c3/Kconfig +1 -0
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only +source "drivers/media/platform/amlogic/c3/isp/Kconfig" source "drivers/media/platform/amlogic/c3/mipi-adapter/Kconfig" source "drivers/media/platform/amlogic/c3/mipi-csi2/Kconfig"
drivers/media/platform/amlogic/c3/Makefile +1 -0
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only +obj-y += isp/ obj-y += mipi-adapter/ obj-y += mipi-csi2/
drivers/media/platform/amlogic/c3/isp/Kconfig new file +18 -0
@@ -0,0 +1,18 @@ +# SPDX-License-Identifier: GPL-2.0-only + +config VIDEO_C3_ISP + tristate "Amlogic C3 Image Signal Processor (ISP) driver" + depends on ARCH_MESON || COMPILE_TEST + depends on VIDEO_DEV + depends on OF + select MEDIA_CONTROLLER + select V4L2_FWNODE + select VIDEO_V4L2_SUBDEV_API + select VIDEOBUF2_DMA_CONTIG + select VIDEOBUF2_VMALLOC + help + Video4Linux2 driver for Amlogic C3 ISP pipeline. + The C3 ISP is used for processing raw images and + outputing results to memory. + + To compile this driver as a module choose m here.
drivers/media/platform/amlogic/c3/isp/Makefile new file +10 -0
@@ -0,0 +1,10 @@ +# SPDX-License-Identifier: GPL-2.0-only + +c3-isp-objs := c3-isp-dev.o \ + c3-isp-params.o \ + c3-isp-stats.o \ + c3-isp-capture.o \ + c3-isp-core.o \ + c3-isp-resizer.o + +obj-$(CONFIG_VIDEO_C3_ISP) += c3-isp.o
drivers/media/platform/amlogic/c3/isp/c3-isp-capture.c new file +806 -0
806 lines not on this page · raw message
drivers/media/platform/amlogic/c3/isp/c3-isp-common.h new file +340 -0
340 lines not on this page · raw message
drivers/media/platform/amlogic/c3/isp/c3-isp-core.c new file +641 -0
641 lines not on this page · raw message
drivers/media/platform/amlogic/c3/isp/c3-isp-dev.c new file +421 -0
421 lines not on this page · raw message
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +1010 -0
747 lines not on this page · raw message
drivers/media/platform/amlogic/c3/isp/c3-isp-regs.h new file +618 -0
618 lines not on this page · raw message
drivers/media/platform/amlogic/c3/isp/c3-isp-resizer.c new file +892 -0
892 lines not on this page · raw message
drivers/media/platform/amlogic/c3/isp/c3-isp-stats.c new file +328 -0
328 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.49.0
Part of the diff is not shown here. View the raw message.
Re: [PATCH v9 08/10] media: platform: Add C3 ISP driver
Hi Keke, Jacopo,
Quoted 5 lines · On Sun, Apr 27, 2025 at 02:27:16PM +0800, Keke Li via B4 Relay wrote:
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +0
-0
...
Quoted 87 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +87
-0+static int c3_isp_params_vb2_buf_prepare (struct vb2_buffer *vb) +{ +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +struct c3_isp_params_buffer *buf =to_c3_isp_params_buffer (vbuf); +struct c3_isp_params *params =vb2_get_drv_priv (vb->vb2_queue); +struct c3_isp_params_cfg *cfg = buf->cfg; +struct c3_isp_params_cfg *usr_cfg =vb2_plane_vaddr (vb,0 ); +size_t payload_size =vb2_get_plane_payload (vb,0 ); +size_t header_size = offsetof(struct c3_isp_params_cfg , data); +size_t block_offset =0 ; +size_t cfg_size; + +/* Payload size can't be greater than the destination buffer size */ +if (payload_size > params->vfmt.fmt.meta.buffersize) { +dev_dbg (params->isp->dev, +"Payload size is too large: %zu\n" , payload_size); +return -EINVAL ; + } + +/* Payload size can't be smaller than the header size */ +if (payload_size < header_size) { +dev_dbg (params->isp->dev, +"Payload size is too small: %zu\n" , payload_size); +return -EINVAL ; + } + +/* +* Use the internal scratch buffer to avoid userspace modifying +* the buffer content while the driver is processing it. +*/ +memcpy (cfg, usr_cfg, payload_size); + +/* Only v0 is supported at the moment */ +if (cfg->version !=C3_ISP_PARAMS_BUFFER_V0 ) { +dev_dbg (params->isp->dev, +"Invalid params buffer version: %u\n" , cfg->version); +return -EINVAL ; + } + +/* Validate the size reported in the parameter buffer header */ + cfg_size = header_size + cfg->data_size; +if (cfg_size != payload_size) { +dev_dbg (params->isp->dev, +"Data size %zu and payload size %zu are different\n" , + cfg_size, payload_size); +return -EINVAL ; + } + +/* Walk the list of parameter blocks and validate them */ + cfg_size = cfg->data_size; +while (cfg_size >=sizeof (struct c3_isp_params_block_header )) { +const struct c3_isp_params_block_header *block; +const struct c3_isp_params_handler *handler; + + block = (struct c3_isp_params_block_header *) + &cfg->data[block_offset]; + +if (block->type >=ARRAY_SIZE (c3_isp_params_handlers)) { +dev_dbg (params->isp->dev, +"Invalid params block type\n" ); +return -EINVAL ; + } + +if (block->size > cfg_size) { +dev_dbg (params->isp->dev, +"Block size is greater than cfg size\n" ); +return -EINVAL ; + } + +if ((block->flags & (C3_ISP_PARAMS_BLOCK_FL_ENABLE | +C3_ISP_PARAMS_BLOCK_FL_DISABLE )) == + (C3_ISP_PARAMS_BLOCK_FL_ENABLE | +C3_ISP_PARAMS_BLOCK_FL_DISABLE )) { +dev_dbg (params->isp->dev, +"Invalid parameters block flags\n" ); +return -EINVAL ; + } + + handler = &c3_isp_params_handlers[block->type]; +if (block->size != handler->size) { +dev_dbg (params->isp->dev, +"Invalid params block size\n" ); +return -EINVAL ; + } + + block_offset += block->size; + cfg_size -= block->size;
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c line 865
Quoted 10 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +10
-0+ } + +if (cfg_size) { +dev_dbg (params->isp->dev, +"Unexpected data after the params buffer end\n" ); +return -EINVAL ; + } + +return 0 ; +}
The above looks very much like rkisp1_params_prepare_ext_params() in the Rockchip ISP driver. Instead of copying all this non-trivial code in verbatim here, could you instead refactor this so both the drivers could use the same implementation?
The types are different so macros will be likely needed.
Signature · 3 lines
Regards, Sakari Ailus
Re: [PATCH v9 08/10] media: platform: Add C3 ISP driver
Hi Sakari
Quoted 102 lines · Sakari Ailus
Hi Keke, Jacopo,
Quoted 5 lines · On Sun, Apr 27, 2025 at 02:27:16PM +0800, Keke Li via B4 Relay wrote:
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +0
-0...
Quoted 91 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +91
-0+static int c3_isp_params_vb2_buf_prepare (struct vb2_buffer *vb) +{ +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +struct c3_isp_params_buffer *buf =to_c3_isp_params_buffer (vbuf); +struct c3_isp_params *params =vb2_get_drv_priv (vb->vb2_queue); +struct c3_isp_params_cfg *cfg = buf->cfg; +struct c3_isp_params_cfg *usr_cfg =vb2_plane_vaddr (vb,0 ); +size_t payload_size =vb2_get_plane_payload (vb,0 ); +size_t header_size = offsetof(struct c3_isp_params_cfg , data); +size_t block_offset =0 ; +size_t cfg_size; + +/* Payload size can't be greater than the destination buffer size */ +if (payload_size > params->vfmt.fmt.meta.buffersize) { +dev_dbg (params->isp->dev, +"Payload size is too large: %zu\n" , payload_size); +return -EINVAL ; + } + +/* Payload size can't be smaller than the header size */ +if (payload_size < header_size) { +dev_dbg (params->isp->dev, +"Payload size is too small: %zu\n" , payload_size); +return -EINVAL ; + } + +/* +* Use the internal scratch buffer to avoid userspace modifying +* the buffer content while the driver is processing it. +*/ +memcpy (cfg, usr_cfg, payload_size); + +/* Only v0 is supported at the moment */ +if (cfg->version !=C3_ISP_PARAMS_BUFFER_V0 ) { +dev_dbg (params->isp->dev, +"Invalid params buffer version: %u\n" , cfg->version); +return -EINVAL ; + } + +/* Validate the size reported in the parameter buffer header */ + cfg_size = header_size + cfg->data_size; +if (cfg_size != payload_size) { +dev_dbg (params->isp->dev, +"Data size %zu and payload size %zu are different\n" , + cfg_size, payload_size); +return -EINVAL ; + } + +/* Walk the list of parameter blocks and validate them */ + cfg_size = cfg->data_size; +while (cfg_size >=sizeof (struct c3_isp_params_block_header )) { +const struct c3_isp_params_block_header *block; +const struct c3_isp_params_handler *handler; + + block = (struct c3_isp_params_block_header *) + &cfg->data[block_offset]; + +if (block->type >=ARRAY_SIZE (c3_isp_params_handlers)) { +dev_dbg (params->isp->dev, +"Invalid params block type\n" ); +return -EINVAL ; + } + +if (block->size > cfg_size) { +dev_dbg (params->isp->dev, +"Block size is greater than cfg size\n" ); +return -EINVAL ; + } + +if ((block->flags & (C3_ISP_PARAMS_BLOCK_FL_ENABLE | +C3_ISP_PARAMS_BLOCK_FL_DISABLE )) == + (C3_ISP_PARAMS_BLOCK_FL_ENABLE | +C3_ISP_PARAMS_BLOCK_FL_DISABLE )) { +dev_dbg (params->isp->dev, +"Invalid parameters block flags\n" ); +return -EINVAL ; + } + + handler = &c3_isp_params_handlers[block->type]; +if (block->size != handler->size) { +dev_dbg (params->isp->dev, +"Invalid params block size\n" ); +return -EINVAL ; + } + + block_offset += block->size; + cfg_size -= block->size; + } + +if (cfg_size) { + dev_dbg(params->isp->dev,
Quoted 8 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c line 865
Quoted 6 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +6
-0+ "Unexpected data after the params buffer end\n"); +return -EINVAL ; + } + +return 0 ; +}The above looks very much like
rkisp1_params_prepare_ext_params()in the
slightly similar, yes :)
Quoted 4 lines
Rockchip ISP driver. Instead of copying all this non-trivial code in verbatim here, could you instead refactor this so both the drivers could use the same implementation?
Yeah, that's the plan.
We have more drivers in the pipeline using extensible parameters and this code (and possibily other parts) will certainly be factored out.
My plan is to add at one more user in and the do move common parts to the framework. Would this work for you ?
Quoted 6 lines
The types are different so macros will be likely needed.
--
Regards,Sakari Ailus
Re: [PATCH v9 08/10] media: platform: Add C3 ISP driver
Hi Jacopo,
Quoted 121 lines · Jacopo Mondi
Hi Sakari
Quoted 102 lines · Sakari Ailus
Hi Keke, Jacopo,
Quoted 5 lines · On Sun, Apr 27, 2025 at 02:27:16PM +0800, Keke Li via B4 Relay wrote:
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +0
-0...
Quoted 91 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +91
-0+static int c3_isp_params_vb2_buf_prepare (struct vb2_buffer *vb) +{ +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +struct c3_isp_params_buffer *buf =to_c3_isp_params_buffer (vbuf); +struct c3_isp_params *params =vb2_get_drv_priv (vb->vb2_queue); +struct c3_isp_params_cfg *cfg = buf->cfg; +struct c3_isp_params_cfg *usr_cfg =vb2_plane_vaddr (vb,0 ); +size_t payload_size =vb2_get_plane_payload (vb,0 ); +size_t header_size = offsetof(struct c3_isp_params_cfg , data); +size_t block_offset =0 ; +size_t cfg_size; + +/* Payload size can't be greater than the destination buffer size */ +if (payload_size > params->vfmt.fmt.meta.buffersize) { +dev_dbg (params->isp->dev, +"Payload size is too large: %zu\n" , payload_size); +return -EINVAL ; + } + +/* Payload size can't be smaller than the header size */ +if (payload_size < header_size) { +dev_dbg (params->isp->dev, +"Payload size is too small: %zu\n" , payload_size); +return -EINVAL ; + } + +/* +* Use the internal scratch buffer to avoid userspace modifying +* the buffer content while the driver is processing it. +*/ +memcpy (cfg, usr_cfg, payload_size); + +/* Only v0 is supported at the moment */ +if (cfg->version !=C3_ISP_PARAMS_BUFFER_V0 ) { +dev_dbg (params->isp->dev, +"Invalid params buffer version: %u\n" , cfg->version); +return -EINVAL ; + } + +/* Validate the size reported in the parameter buffer header */ + cfg_size = header_size + cfg->data_size; +if (cfg_size != payload_size) { +dev_dbg (params->isp->dev, +"Data size %zu and payload size %zu are different\n" , + cfg_size, payload_size); +return -EINVAL ; + } + +/* Walk the list of parameter blocks and validate them */ + cfg_size = cfg->data_size; +while (cfg_size >=sizeof (struct c3_isp_params_block_header )) { +const struct c3_isp_params_block_header *block; +const struct c3_isp_params_handler *handler; + + block = (struct c3_isp_params_block_header *) + &cfg->data[block_offset]; + +if (block->type >=ARRAY_SIZE (c3_isp_params_handlers)) { +dev_dbg (params->isp->dev, +"Invalid params block type\n" ); +return -EINVAL ; + } + +if (block->size > cfg_size) { +dev_dbg (params->isp->dev, +"Block size is greater than cfg size\n" ); +return -EINVAL ; + } + +if ((block->flags & (C3_ISP_PARAMS_BLOCK_FL_ENABLE | +C3_ISP_PARAMS_BLOCK_FL_DISABLE )) == + (C3_ISP_PARAMS_BLOCK_FL_ENABLE | +C3_ISP_PARAMS_BLOCK_FL_DISABLE )) { +dev_dbg (params->isp->dev, +"Invalid parameters block flags\n" ); +return -EINVAL ; + } + + handler = &c3_isp_params_handlers[block->type]; +if (block->size != handler->size) { +dev_dbg (params->isp->dev, +"Invalid params block size\n" ); +return -EINVAL ; + } + + block_offset += block->size; + cfg_size -= block->size; + } + +if (cfg_size) { + dev_dbg(params->isp->dev,Quoted 8 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c line 865
Quoted 6 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +6
-0+ "Unexpected data after the params buffer end\n"); +return -EINVAL ; + } + +return 0 ; +}The above looks very much like
rkisp1_params_prepare_ext_params()in theslightly similar, yes :)
Quoted 4 lines
Rockchip ISP driver. Instead of copying all this non-trivial code in verbatim here, could you instead refactor this so both the drivers could use the same implementation?
Quoted 7 lines
Yeah, that's the plan.
We have more drivers in the pipeline using extensible parameters and this code (and possibily other parts) will certainly be factored out.
My plan is to add at one more user in and the do move common parts to the framework. Would this work for you ?
How about refactoring the two users to use a common framework first and then using it in the third? :-) The more copies there are, the greater the task to unify them.
Signature · 3 lines
Regards, Sakari Ailus
Re: [PATCH v9 08/10] media: platform: Add C3 ISP driver
Hi Sakari
Quoted 129 lines · Sakari Ailus
Hi Jacopo,
Quoted 126 lines · Jacopo Mondi
Hi Sakari
Quoted 102 lines · Sakari Ailus
Hi Keke, Jacopo,
Quoted 5 lines · On Sun, Apr 27, 2025 at 02:27:16PM +0800, Keke Li via B4 Relay wrote:
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +0
-0...
Quoted 91 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +91
-0+static int c3_isp_params_vb2_buf_prepare (struct vb2_buffer *vb) +{ +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +struct c3_isp_params_buffer *buf =to_c3_isp_params_buffer (vbuf); +struct c3_isp_params *params =vb2_get_drv_priv (vb->vb2_queue); +struct c3_isp_params_cfg *cfg = buf->cfg; +struct c3_isp_params_cfg *usr_cfg =vb2_plane_vaddr (vb,0 ); +size_t payload_size =vb2_get_plane_payload (vb,0 ); +size_t header_size = offsetof(struct c3_isp_params_cfg , data); +size_t block_offset =0 ; +size_t cfg_size; + +/* Payload size can't be greater than the destination buffer size */ +if (payload_size > params->vfmt.fmt.meta.buffersize) { +dev_dbg (params->isp->dev, +"Payload size is too large: %zu\n" , payload_size); +return -EINVAL ; + } + +/* Payload size can't be smaller than the header size */ +if (payload_size < header_size) { +dev_dbg (params->isp->dev, +"Payload size is too small: %zu\n" , payload_size); +return -EINVAL ; + } + +/* +* Use the internal scratch buffer to avoid userspace modifying +* the buffer content while the driver is processing it. +*/ +memcpy (cfg, usr_cfg, payload_size); + +/* Only v0 is supported at the moment */ +if (cfg->version !=C3_ISP_PARAMS_BUFFER_V0 ) { +dev_dbg (params->isp->dev, +"Invalid params buffer version: %u\n" , cfg->version); +return -EINVAL ; + } + +/* Validate the size reported in the parameter buffer header */ + cfg_size = header_size + cfg->data_size; +if (cfg_size != payload_size) { +dev_dbg (params->isp->dev, +"Data size %zu and payload size %zu are different\n" , + cfg_size, payload_size); +return -EINVAL ; + } + +/* Walk the list of parameter blocks and validate them */ + cfg_size = cfg->data_size; +while (cfg_size >=sizeof (struct c3_isp_params_block_header )) { +const struct c3_isp_params_block_header *block; +const struct c3_isp_params_handler *handler; + + block = (struct c3_isp_params_block_header *) + &cfg->data[block_offset]; + +if (block->type >=ARRAY_SIZE (c3_isp_params_handlers)) { +dev_dbg (params->isp->dev, +"Invalid params block type\n" ); +return -EINVAL ; + } + +if (block->size > cfg_size) { +dev_dbg (params->isp->dev, +"Block size is greater than cfg size\n" ); +return -EINVAL ; + } + +if ((block->flags & (C3_ISP_PARAMS_BLOCK_FL_ENABLE | +C3_ISP_PARAMS_BLOCK_FL_DISABLE )) == + (C3_ISP_PARAMS_BLOCK_FL_ENABLE | +C3_ISP_PARAMS_BLOCK_FL_DISABLE )) { +dev_dbg (params->isp->dev, +"Invalid parameters block flags\n" ); +return -EINVAL ; + } + + handler = &c3_isp_params_handlers[block->type]; +if (block->size != handler->size) { +dev_dbg (params->isp->dev, +"Invalid params block size\n" ); +return -EINVAL ; + } + + block_offset += block->size; + cfg_size -= block->size; + } + +if (cfg_size) { + dev_dbg(params->isp->dev,Quoted 8 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c line 865
Quoted 6 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +6
-0+ "Unexpected data after the params buffer end\n"); +return -EINVAL ; + } + +return 0 ; +}The above looks very much like
rkisp1_params_prepare_ext_params()in theslightly similar, yes :)
Quoted 4 lines
Rockchip ISP driver. Instead of copying all this non-trivial code in verbatim here, could you instead refactor this so both the drivers could use the same implementation?
Yeah, that's the plan.
We have more drivers in the pipeline using extensible parameters and this code (and possibily other parts) will certainly be factored out.
Quoted 7 lines
Quoted 2 lines
My plan is to add at one more user in and the do move common parts to the framework. Would this work for you ?
How about refactoring the two users to use a common framework first and then using it in the third? :-) The more copies there are, the greater the task to unify them.
Sorry, I probably wasn't clear.
When upstreaming the third user of extensible parameters I will move the common parts to the framework and port these two existing users to use the new helpers.
It's not my intention to upstream a third user and then port all of them to use a common helper later on ;)
Quoted 4 lines
--
Regards,Sakari Ailus
Re: [PATCH v9 08/10] media: platform: Add C3 ISP driver
Hi Jacopo,
Quoted 140 lines · Jacopo Mondi
Hi Sakari
Quoted 129 lines · Sakari Ailus
Hi Jacopo,
Quoted 126 lines · Jacopo Mondi
Hi Sakari
Quoted 102 lines · Sakari Ailus
Hi Keke, Jacopo,
Quoted 5 lines · On Sun, Apr 27, 2025 at 02:27:16PM +0800, Keke Li via B4 Relay wrote:
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +0
-0...
Quoted 91 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +91
-0+static int c3_isp_params_vb2_buf_prepare (struct vb2_buffer *vb) +{ +struct vb2_v4l2_buffer *vbuf =to_vb2_v4l2_buffer (vb); +struct c3_isp_params_buffer *buf =to_c3_isp_params_buffer (vbuf); +struct c3_isp_params *params =vb2_get_drv_priv (vb->vb2_queue); +struct c3_isp_params_cfg *cfg = buf->cfg; +struct c3_isp_params_cfg *usr_cfg =vb2_plane_vaddr (vb,0 ); +size_t payload_size =vb2_get_plane_payload (vb,0 ); +size_t header_size = offsetof(struct c3_isp_params_cfg , data); +size_t block_offset =0 ; +size_t cfg_size; + +/* Payload size can't be greater than the destination buffer size */ +if (payload_size > params->vfmt.fmt.meta.buffersize) { +dev_dbg (params->isp->dev, +"Payload size is too large: %zu\n" , payload_size); +return -EINVAL ; + } + +/* Payload size can't be smaller than the header size */ +if (payload_size < header_size) { +dev_dbg (params->isp->dev, +"Payload size is too small: %zu\n" , payload_size); +return -EINVAL ; + } + +/* +* Use the internal scratch buffer to avoid userspace modifying +* the buffer content while the driver is processing it. +*/ +memcpy (cfg, usr_cfg, payload_size); + +/* Only v0 is supported at the moment */ +if (cfg->version !=C3_ISP_PARAMS_BUFFER_V0 ) { +dev_dbg (params->isp->dev, +"Invalid params buffer version: %u\n" , cfg->version); +return -EINVAL ; + } + +/* Validate the size reported in the parameter buffer header */ + cfg_size = header_size + cfg->data_size; +if (cfg_size != payload_size) { +dev_dbg (params->isp->dev, +"Data size %zu and payload size %zu are different\n" , + cfg_size, payload_size); +return -EINVAL ; + } + +/* Walk the list of parameter blocks and validate them */ + cfg_size = cfg->data_size; +while (cfg_size >=sizeof (struct c3_isp_params_block_header )) { +const struct c3_isp_params_block_header *block; +const struct c3_isp_params_handler *handler; + + block = (struct c3_isp_params_block_header *) + &cfg->data[block_offset]; + +if (block->type >=ARRAY_SIZE (c3_isp_params_handlers)) { +dev_dbg (params->isp->dev, +"Invalid params block type\n" ); +return -EINVAL ; + } + +if (block->size > cfg_size) { +dev_dbg (params->isp->dev, +"Block size is greater than cfg size\n" ); +return -EINVAL ; + } + +if ((block->flags & (C3_ISP_PARAMS_BLOCK_FL_ENABLE | +C3_ISP_PARAMS_BLOCK_FL_DISABLE )) == + (C3_ISP_PARAMS_BLOCK_FL_ENABLE | +C3_ISP_PARAMS_BLOCK_FL_DISABLE )) { +dev_dbg (params->isp->dev, +"Invalid parameters block flags\n" ); +return -EINVAL ; + } + + handler = &c3_isp_params_handlers[block->type]; +if (block->size != handler->size) { +dev_dbg (params->isp->dev, +"Invalid params block size\n" ); +return -EINVAL ; + } + + block_offset += block->size; + cfg_size -= block->size; + } + +if (cfg_size) { + dev_dbg(params->isp->dev,Quoted 8 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c line 865
Quoted 6 lines
drivers/media/platform/amlogic/c3/isp/c3-isp-params.c new file +6
-0+ "Unexpected data after the params buffer end\n"); +return -EINVAL ; + } + +return 0 ; +}The above looks very much like
rkisp1_params_prepare_ext_params()in theslightly similar, yes :)
Quoted 4 lines
Rockchip ISP driver. Instead of copying all this non-trivial code in verbatim here, could you instead refactor this so both the drivers could use the same implementation?
Yeah, that's the plan.
We have more drivers in the pipeline using extensible parameters and this code (and possibily other parts) will certainly be factored out.
Quoted 7 lines
Quoted 2 lines
My plan is to add at one more user in and the do move common parts to the framework. Would this work for you ?
How about refactoring the two users to use a common framework first and then using it in the third? :-) The more copies there are, the greater the task to unify them.
Quoted 8 lines
Sorry, I probably wasn't clear.
When upstreaming the third user of extensible parameters I will move the common parts to the framework and port these two existing users to use the new helpers.
It's not my intention to upstream a third user and then port all of them to use a common helper later on ;)
Ack, thanks for confirming this!
Signature · 3 lines
Regards, Sakari Ailus
Keke Li
maintainerPATCH v9 9/10 Documentation: media: add documentation file metafmt-c3-isp.rst
In reply to Keke LiAdd the file 'metafmt-c3-isp.rst' that documents
the meta format of c3-isp.
--- .../userspace-api/media/v4l/meta-formats.rst | 1 + .../userspace-api/media/v4l/metafmt-c3-isp.rst | 86 ++++++++++++++++++++++ MAINTAINERS | 1 + 3 files changed, 88 insertions(+)
Documentation/userspace-api/media/v4l/meta-formats.rst +1 -0
@@ -12,6 +12,7 @@ These formats are used for the :ref:`metadata` interface only. .. toctree:: :maxdepth: 1 + metafmt-c3-isp metafmt-d4xx metafmt-generic metafmt-intel-ipu3
Documentation/userspace-api/media/v4l/metafmt-c3-isp.rst new file +86 -0
86 lines not on this page · raw message
MAINTAINERS +1 -0
@@ -1263,6 +1263,7 @@ M: Keke Li <[email protected]> L: [email protected] S: Maintained F: Documentation/devicetree/bindings/media/amlogic,c3-isp.yaml +F: Documentation/userspace-api/media/v4l/metafmt-c3-isp.rst F: drivers/media/platform/amlogic/c3/isp/ F: include/uapi/linux/media/amlogic/
Signature · 1 line
2.49.0
Keke Li
maintainerPATCH v9 10/10 Documentation: media: add documentation file c3-isp.rst
In reply to Keke LiAdd the file 'c3-isp.rst' that documents the c3-isp driver.
--- Documentation/admin-guide/media/c3-isp.dot | 26 ++++++ Documentation/admin-guide/media/c3-isp.rst | 101 ++++++++++++++++++++++++ Documentation/admin-guide/media/v4l-drivers.rst | 1 + MAINTAINERS | 2 + 4 files changed, 130 insertions(+)
Documentation/admin-guide/media/c3-isp.dot new file +26 -0
@@ -0,0 +1,26 @@ +digraph board { + rankdir=TB + n00000001 [label="{{<port0> 0 | <port1> 1} | c3-isp-core\n/dev/v4l-subdev0 | {<port2> 2 | <port3> 3 | <port4> 4 | <port5> 5}}", shape=Mrecord, style=filled, fillcolor=green] + n00000001:port3 -> n00000008:port0 + n00000001:port4 -> n0000000b:port0 + n00000001:port5 -> n0000000e:port0 + n00000001:port2 -> n00000027 + n00000008 [label="{{<port0> 0} | c3-isp-resizer0\n/dev/v4l-subdev1 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000008:port1 -> n00000016 [style=bold] + n0000000b [label="{{<port0> 0} | c3-isp-resizer1\n/dev/v4l-subdev2 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n0000000b:port1 -> n0000001a [style=bold] + n0000000e [label="{{<port0> 0} | c3-isp-resizer2\n/dev/v4l-subdev3 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n0000000e:port1 -> n00000023 [style=bold] + n00000011 [label="{{<port0> 0} | c3-mipi-adapter\n/dev/v4l-subdev4 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000011:port1 -> n00000001:port0 [style=bold] + n00000016 [label="c3-isp-cap0\n/dev/video0", shape=box, style=filled, fillcolor=yellow] + n0000001a [label="c3-isp-cap1\n/dev/video1", shape=box, style=filled, fillcolor=yellow] + n0000001e [label="{{<port0> 0} | c3-mipi-csi2\n/dev/v4l-subdev5 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n0000001e:port1 -> n00000011:port0 [style=bold] + n00000023 [label="c3-isp-cap2\n/dev/video2", shape=box, style=filled, fillcolor=yellow] + n00000027 [label="c3-isp-stats\n/dev/video3", shape=box, style=filled, fillcolor=yellow] + n0000002b [label="c3-isp-params\n/dev/video4", shape=box, style=filled, fillcolor=yellow] + n0000002b -> n00000001:port1 + n0000003f [label="{{} | imx290 2-001a\n/dev/v4l-subdev6 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000003f:port0 -> n0000001e:port0 [style=bold] +}
Documentation/admin-guide/media/c3-isp.rst new file +101 -0
101 lines not on this page · raw message
Documentation/admin-guide/media/v4l-drivers.rst +1 -0
@@ -10,6 +10,7 @@ Video4Linux (V4L) driver-specific documentation :maxdepth: 2 bttv + c3-isp cafe_ccic cx88 fimc
MAINTAINERS +2 -0
@@ -1262,6 +1262,8 @@ AMLOGIC ISP DRIVER M: Keke Li <[email protected]> L: [email protected] S: Maintained +F: Documentation/admin-guide/media/c3-isp.dot +F: Documentation/admin-guide/media/c3-isp.rst F: Documentation/devicetree/bindings/media/amlogic,c3-isp.yaml F: Documentation/userspace-api/media/v4l/metafmt-c3-isp.rst F: drivers/media/platform/amlogic/c3/isp/
Signature · 1 line
2.49.0
Re: [PATCH v9 10/10] Documentation: media: add documentation file c3-isp.rst
Hi Keke
Quoted 5 lines · On Sun, Apr 27, 2025 at 02:27:18PM +0800, Keke Li via B4 Relay wrote:
From: Keke Li <[email protected]>
Add the file '
c3-isp.rst' that documents the c3-isp driver.Signed-off-by Keke Li <[email protected]>
Sorry for the delay, the patch matches what was suggested with a few corrections on top, so
The series is ready in my opinion. Let me sync with maintainers on what is the fastest path to collect it.
Thanks for the perseverance!
Quoted 176 lines
--- Documentation/admin-guide/media/c3-isp.dot | 26 ++++++ Documentation/admin-guide/media/c3-isp.rst | 101 ++++++++++++++++++++++++ Documentation/admin-guide/media/v4l-drivers.rst | 1 + MAINTAINERS | 2 + 4 files changed, 130 insertions(+)Documentation/admin-guide/media/c3-isp.dot new file +26
-0@@ -0,0 +1,26 @@ +digraph board { + rankdir=TB + n00000001 [label="{{<port0> 0 | <port1> 1} | c3-isp-core\n/dev/v4l-subdev0 | {<port2> 2 | <port3> 3 | <port4> 4 | <port5> 5}}", shape=Mrecord, style=filled, fillcolor=green] + n00000001:port3 -> n00000008:port0 + n00000001:port4 -> n0000000b:port0 + n00000001:port5 -> n0000000e:port0 + n00000001:port2 -> n00000027 + n00000008 [label="{{<port0> 0} | c3-isp-resizer0\n/dev/v4l-subdev1 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000008:port1 -> n00000016 [style=bold] + n0000000b [label="{{<port0> 0} | c3-isp-resizer1\n/dev/v4l-subdev2 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n0000000b:port1 -> n0000001a [style=bold] + n0000000e [label="{{<port0> 0} | c3-isp-resizer2\n/dev/v4l-subdev3 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n0000000e:port1 -> n00000023 [style=bold] + n00000011 [label="{{<port0> 0} | c3-mipi-adapter\n/dev/v4l-subdev4 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n00000011:port1 -> n00000001:port0 [style=bold] + n00000016 [label="c3-isp-cap0\n/dev/video0", shape=box, style=filled, fillcolor=yellow] + n0000001a [label="c3-isp-cap1\n/dev/video1", shape=box, style=filled, fillcolor=yellow] + n0000001e [label="{{<port0> 0} | c3-mipi-csi2\n/dev/v4l-subdev5 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green] + n0000001e:port1 -> n00000011:port0 [style=bold] + n00000023 [label="c3-isp-cap2\n/dev/video2", shape=box, style=filled, fillcolor=yellow] + n00000027 [label="c3-isp-stats\n/dev/video3", shape=box, style=filled, fillcolor=yellow] + n0000002b [label="c3-isp-params\n/dev/video4", shape=box, style=filled, fillcolor=yellow] + n0000002b -> n00000001:port1 + n0000003f [label="{{} | imx290 2-001a\n/dev/v4l-subdev6 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green] + n0000003f:port0 -> n0000001e:port0 [style=bold] +}Documentation/admin-guide/media/c3-isp.rst new file +101
-0@@ -0,0 +1,101 @@ +.. SPDX-License-Identifier: (GPL-2.0-only OR MIT) + +.. include:: <isonum.txt> + +================================================= +Amlogic C3 Image Signal Processing (C3ISP) driver +================================================= + +Introduction +============ + +This file documents the Amlogic C3ISP driver located under +drivers/media/platform/amlogic/c3/isp. + +The current version of the driver supports the C3ISP found on +Amlogic C308L processor. + +The driver implements V4L2, Media controller and V4L2 subdev interfaces. +Camera sensor using V4L2 subdev interface in the kernel is supported. + +The driver has been tested on AW419-C308L-Socket platform. + +Amlogic C3 ISP +============== + +The Camera hardware found on C308L processors and supported by +the driver consists of: + +- 1 MIPI-CSI-2 module: handles the physical layer of the MIPI CSI-2 receiver and + receives data from the connected camera sensor. +- 1 MIPI-ADAPTER module: organizes MIPI data to meet ISP input requirements and + send MIPI data to ISP. +- 1 ISP (Image Signal Processing) module: contains a pipeline of image processing + hardware blocks. The ISP pipeline contains three resizers at the end each of + them connected to a DMA interface which writes the output data to memory. + +A high-level functional view of the C3 ISP is presented below.:: + + +----------+ +-------+ + | Resizer |--->| WRMIF | + +---------+ +------------+ +--------------+ +-------+ |----------+ +-------+ + | Sensor |--->| MIPI CSI-2 |--->| MIPI ADAPTER |--->| ISP |---|----------+ +-------+ + +---------+ +------------+ +--------------+ +-------+ | Resizer |--->| WRMIF | + +----------+ +-------+ + |----------+ +-------+ + | Resizer |--->| WRMIF | + +----------+ +-------+ + +Driver architecture and design +============================== + +With the goal to model the hardware links between the modules and to expose a +clean, logical and usable interface, the driver registers the following V4L2 +sub-devices: + +- 1 `c3-mipi-csi2` sub-device - the MIPI CSI-2 receiver +- 1 `c3-mipi-adapter` sub-device - the MIPI adapter +- 1 `c3-isp-core` sub-device - the ISP core +- 3 `c3-isp-resizer` sub-devices - the ISP resizers + +The `c3-isp-core` sub-device is linked to 2 video device nodes for statistics +capture and parameters programming: + +- the `c3-isp-stats` capture video device node for statistics capture +- the `c3-isp-params` output video device for parameters programming + +Each `c3-isp-resizer` sub-device is linked to a capture video device node where +frames are captured from: + +- `c3-isp-resizer0` is linked to the `c3-isp-cap0` capture video device +- `c3-isp-resizer1` is linked to the `c3-isp-cap1` capture video device +- `c3-isp-resizer2` is linked to the `c3-isp-cap2` capture video device + +The media controller pipeline graph is as follows (with connected a +IMX290 camera sensor): + +.. _isp_topology_graph: + +.. kernel-figure:: c3-isp.dot + :alt: c3-isp.dot + :align: center + + Media pipeline topology + +Implementation +============== + +Runtime configuration of the ISP hardware is performed on the `c3-isp-params` +video device node using the :ref:`V4L2_META_FMT_C3ISP_PARAMS +<v4l2-meta-fmt-c3isp-params>` as data format. The buffer structure is defined by +:c:type:`c3_isp_params_cfg`. + +Statistics are captured from the `c3-isp-stats` video device node using the +:ref:`V4L2_META_FMT_C3ISP_STATS <v4l2-meta-fmt-c3isp-stats>` data format. + +The final picture size and format is configured using the V4L2 video +capture interface on the `c3-isp-cap[0, 2]` video device nodes. + +The Amlogic C3 ISP is supported by `libcamera <https://libcamera.org>`_ with a +dedicated pipeline handler and algorithms that perform run-time image correction +and enhancement.Documentation/admin-guide/media/v4l-drivers.rst +1
-0@@ -10,6 +10,7 @@ Video4Linux (V4L) driver-specific documentation :maxdepth: 2 bttv + c3-isp cafe_ccic cx88 fimcMAINTAINERS +2
-1@@ -1262,6 +1262,8 @@ AMLOGIC ISP DRIVER M: Keke Li <[email protected]> L: [email protected] S: Maintained +F: Documentation/admin-guide/media/c3-isp.dot +F: Documentation/admin-guide/media/c3-isp.rst F: Documentation/devicetree/bindings/media/amlogic,c3-isp.yaml F: Documentation/userspace-api/media/v4l/metafmt-c3-isp.rst F: drivers/media/platform/amlogic/c3/isp/ --2.49.0
Hi Keke,
Quoted 10 lines · On Sun, Apr 27, 2025 at 02:27:08PM +0800, Keke Li via B4 Relay wrote:
The Amlogic C3 platform integrates an ISP capable of supporting multi-camera, multi-exposure high dynamic range (HDR) imaging with up to 14-bit raw RGB Bayer data.
Capturing images on the C3 involves operating the CSI2 receiver and PHY, an adapter layer that integrates the inline processing from the PHY to the ISP, and the ISP driver itself.
This implementation consists of several distinct module drivers and is expected to support different platforms in the future.
Jacopo has already sent a PR on this and none of my comments address grave issues. Please post further patches on top instead of changing this set.
Signature · 3 lines
Regards, Sakari Ailus
Keke Li
maintainerHi Sakari
Thanks for your reply.
Quoted 11 lines · Sakari Ailus
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
[ EXTERNAL EMAIL ]
Hi Keke,
Quoted 4 lines · On Sun, Apr 27, 2025 at 02:27:08PM +0800, Keke Li via B4 Relay wrote:
The Amlogic C3 platform integrates an ISP capable of supporting multi-camera, multi-exposure high dynamic range (HDR) imaging with up to 14-bit raw RGB Bayer data.
Quoted 8 lines
Quoted 6 lines
Capturing images on the C3 involves operating the CSI2 receiver and PHY, an adapter layer that integrates the inline processing from the PHY to the ISP, and the ISP driver itself.
This implementation consists of several distinct module drivers and is expected to support different platforms in the future.
Jacopo has already sent a PR on this and none of my comments address grave issues. Please post further patches on top instead of changing this set.
[02/10] and [04/10]:
We will address these issues in further patches based on your review feedback.
[08/10]:
We will migrate to the common framework once it becomes available.
Quoted 4 lines
--
Regards,Sakari Ailus