Skip to contentSkip to conversation

Add StarFive Camera Subsystem driver

PATCH Superseded Jack Zhu 3 participants 22 messages Oct 8, 2023 – Oct 19, 2023

Subsystems (3)

v10 of 11 Superseded Latest is v11 →

lore
Share & tools
lore

Jack Zhu

author
#0 lore raw

v10 cover Add StarFive Camera Subsystem driver

Hi,

This series is the v10 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

This series is based on top of the master branch of media_stage repository, which is tested with a v4l2-compliance compiled from the git repo
(git://linuxtv.org/v4l-utils.git).

The following are the media graph for the device and the v4l2-compliance output.

===========================================================================
[the media graph]:

digraph board {
	rankdir=TB
	n00000001 [label="{{<port0> 0} | stf_isp\n/dev/v4l-subdev0 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
	n00000001:port1 -> n00000008 [style=dashed]
	n00000004 [label="capture_raw\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
	n00000008 [label="capture_yuv\n/dev/video1", shape=box, style=filled, fillcolor=yellow]
	n0000000e [label="{{<port0> 0} | cdns_csi2rx.19800000.csi-bridge\n | {<port1> 1 | <port2> 2 | <port3> 3 | <port4> 4}}", shape=Mrecord, style=filled, fillcolor=green]
	n0000000e:port1 -> n00000001:port0 [style=dashed]
	n0000000e:port1 -> n00000004 [style=dashed]
	n00000018 [label="{{} | imx219 6-0010\n/dev/v4l-subdev1 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
	n00000018:port0 -> n0000000e:port0 [style=bold]
}

[the device topology]:

Media controller API version 6.6.0

Media device information
------------------------
driver starfive-camss
model Starfive Camera Subsystem
serial

bus info        platform:19840000.camss
hw revision     0x0
driver version  6.6.0

Device topology
- entity 1: stf_isp (2 pads, 2 links, 0 routes)

            type V4L2 subdev subtype Unknown flags 0
            device node name /dev/v4l-subdev0
	pad0: Sink
		[stream:0 fmt:SRGGB10_1X10/1920x1080 field:none colorspace:srgb
		 crop.bounds:(0,0)/1920x1080
		 crop:(0,0)/1920x1080]
		<- "cdns_csi2rx.19800000.csi-bridge":1 []
	pad1: Source
		[stream:0 fmt:YUYV8_1_5X8/1920x1080 field:none colorspace:srgb
		 crop.bounds:(0,0)/1920x1080
		 crop:(0,0)/1920x1080]
		-> "capture_yuv":0 []

- entity 4: capture_raw (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video0
pad0: Sink
<- "cdns_csi2rx.19800000.csi-bridge":1 []

- entity 8: capture_yuv (1 pad, 1 link)
type Node subtype V4L flags 0
device node name /dev/video1
pad0: Sink
<- "stf_isp":1 []

- entity 14: cdns_csi2rx.19800000.csi-bridge (5 pads, 3 links, 0 routes)

             type V4L2 subdev subtype Unknown flags 0
	pad0: Sink
		<- "imx219 6-0010":0 [ENABLED,IMMUTABLE]
	pad1: Source
		-> "stf_isp":0 []
		-> "capture_raw":0 []
	pad2: Source
	pad3: Source
	pad4: Source

- entity 24: imx219 6-0010 (1 pad, 1 link, 0 routes)

             type V4L2 subdev subtype Sensor flags 0
             device node name /dev/v4l-subdev1
	pad0: Source
		[stream:0 fmt:SRGGB10_1X10/3280x2464 field:none colorspace:raw xfer:none ycbcr:601 quantization:full-range
		 crop.bounds:(8,8)/3280x2464
		 crop:(8,8)/3280x2464]
		-> "cdns_csi2rx.19800000.csi-bridge":0 [ENABLED,IMMUTABLE]

===========================================================================
[the v4l2-compliance output]:

------------
Test part 1:

v4l2-compliance 1.25.0, 64 bits, 64-bit time_t

Compliance test for starfive-camss device /dev/video1:

Driver Info:

	Driver name      : starfive-camss
	Card type        : Starfive Camera Subsystem
	Bus info         : platform:19840000.camss
	Driver version   : 6.6.0
	Capabilities     : 0x84200001

Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:

	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.6.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.6.0
Interface Info:
	ID               : 0x0300000a
	Type             : V4L Video
Entity Info:
	ID               : 0x00000008 (8)
	Name             : capture_yuv
	Function         : V4L2 I/O
	Pad 0x01000009   : 0: Sink
	  Link 0x0200000c: from remote pad 0x1000003 of entity 'stf_isp' (Image Signal Processor): Data, Enabled

Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK

Allow for multiple opens:
test second /dev/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 VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)

Test input 0:

Streaming ioctls:
test read/write: OK (Not Supported)
test blocking wait: OK

Video Capture: Frame #000
Video Capture: Frame #001
Video Capture: Frame #002
Video Capture: Frame #003
Video Capture: Frame #004
Video Capture: Frame #005
Video Capture: Frame #006
Video Capture: Frame #007
Video Capture: Frame #008
Video Capture: Frame #009
Video Capture: Frame #010
Video Capture: Frame #011
Video Capture: Frame #012
Video Capture: Frame #013
Video Capture: Frame #014
Video Capture: Frame #015
Video Capture: Frame #016
Video Capture: Frame #017
Video Capture: Frame #018
Video Capture: Frame #019
Video Capture: Frame #020
Video Capture: Frame #021
Video Capture: Frame #022
Video Capture: Frame #023
Video Capture: Frame #024
Video Capture: Frame #025
Video Capture: Frame #026
Video Capture: Frame #027
Video Capture: Frame #028
Video Capture: Frame #029
Video Capture: Frame #030
Video Capture: Frame #031
Video Capture: Frame #032
Video Capture: Frame #033
Video Capture: Frame #034
Video Capture: Frame #035
Video Capture: Frame #036
Video Capture: Frame #037
Video Capture: Frame #038
Video Capture: Frame #039
Video Capture: Frame #040
Video Capture: Frame #041
Video Capture: Frame #042
Video Capture: Frame #043
Video Capture: Frame #044
Video Capture: Frame #045
Video Capture: Frame #046
Video Capture: Frame #047
Video Capture: Frame #048
Video Capture: Frame #049
Video Capture: Frame #050
Video Capture: Frame #051
Video Capture: Frame #052
Video Capture: Frame #053
Video Capture: Frame #054
Video Capture: Frame #055
Video Capture: Frame #056
Video Capture: Frame #057
Video Capture: Frame #058
Video Capture: Frame #059

test MMAP (no poll): OK

Video Capture: Frame #000 (select)
Video Capture: Frame #001 (select)
Video Capture: Frame #002 (select)
Video Capture: Frame #003 (select)
Video Capture: Frame #004 (select)
Video Capture: Frame #005 (select)
Video Capture: Frame #006 (select)
Video Capture: Frame #007 (select)
Video Capture: Frame #008 (select)
Video Capture: Frame #009 (select)
Video Capture: Frame #010 (select)
Video Capture: Frame #011 (select)
Video Capture: Frame #012 (select)
Video Capture: Frame #013 (select)
Video Capture: Frame #014 (select)
Video Capture: Frame #015 (select)
Video Capture: Frame #016 (select)
Video Capture: Frame #017 (select)
Video Capture: Frame #018 (select)
Video Capture: Frame #019 (select)
Video Capture: Frame #020 (select)
Video Capture: Frame #021 (select)
Video Capture: Frame #022 (select)
Video Capture: Frame #023 (select)
Video Capture: Frame #024 (select)
Video Capture: Frame #025 (select)
Video Capture: Frame #026 (select)
Video Capture: Frame #027 (select)
Video Capture: Frame #028 (select)
Video Capture: Frame #029 (select)
Video Capture: Frame #030 (select)
Video Capture: Frame #031 (select)
Video Capture: Frame #032 (select)
Video Capture: Frame #033 (select)
Video Capture: Frame #034 (select)
Video Capture: Frame #035 (select)
Video Capture: Frame #036 (select)
Video Capture: Frame #037 (select)
Video Capture: Frame #038 (select)
Video Capture: Frame #039 (select)
Video Capture: Frame #040 (select)
Video Capture: Frame #041 (select)
Video Capture: Frame #042 (select)
Video Capture: Frame #043 (select)
Video Capture: Frame #044 (select)
Video Capture: Frame #045 (select)
Video Capture: Frame #046 (select)
Video Capture: Frame #047 (select)
Video Capture: Frame #048 (select)
Video Capture: Frame #049 (select)
Video Capture: Frame #050 (select)
Video Capture: Frame #051 (select)
Video Capture: Frame #052 (select)
Video Capture: Frame #053 (select)
Video Capture: Frame #054 (select)
Video Capture: Frame #055 (select)
Video Capture: Frame #056 (select)
Video Capture: Frame #057 (select)
Video Capture: Frame #058 (select)
Video Capture: Frame #059 (select)

test MMAP (select): OK

Video Capture: Frame #000 (epoll)
Video Capture: Frame #001 (epoll)
Video Capture: Frame #002 (epoll)
Video Capture: Frame #003 (epoll)
Video Capture: Frame #004 (epoll)
Video Capture: Frame #005 (epoll)
Video Capture: Frame #006 (epoll)
Video Capture: Frame #007 (epoll)
Video Capture: Frame #008 (epoll)
Video Capture: Frame #009 (epoll)
Video Capture: Frame #010 (epoll)
Video Capture: Frame #011 (epoll)
Video Capture: Frame #012 (epoll)
Video Capture: Frame #013 (epoll)
Video Capture: Frame #014 (epoll)
Video Capture: Frame #015 (epoll)
Video Capture: Frame #016 (epoll)
Video Capture: Frame #017 (epoll)
Video Capture: Frame #018 (epoll)
Video Capture: Frame #019 (epoll)
Video Capture: Frame #020 (epoll)
Video Capture: Frame #021 (epoll)
Video Capture: Frame #022 (epoll)
Video Capture: Frame #023 (epoll)
Video Capture: Frame #024 (epoll)
Video Capture: Frame #025 (epoll)
Video Capture: Frame #026 (epoll)
Video Capture: Frame #027 (epoll)
Video Capture: Frame #028 (epoll)
Video Capture: Frame #029 (epoll)
Video Capture: Frame #030 (epoll)
Video Capture: Frame #031 (epoll)
Video Capture: Frame #032 (epoll)
Video Capture: Frame #033 (epoll)
Video Capture: Frame #034 (epoll)
Video Capture: Frame #035 (epoll)
Video Capture: Frame #036 (epoll)
Video Capture: Frame #037 (epoll)
Video Capture: Frame #038 (epoll)
Video Capture: Frame #039 (epoll)
Video Capture: Frame #040 (epoll)
Video Capture: Frame #041 (epoll)
Video Capture: Frame #042 (epoll)
Video Capture: Frame #043 (epoll)
Video Capture: Frame #044 (epoll)
Video Capture: Frame #045 (epoll)
Video Capture: Frame #046 (epoll)
Video Capture: Frame #047 (epoll)
Video Capture: Frame #048 (epoll)
Video Capture: Frame #049 (epoll)
Video Capture: Frame #050 (epoll)
Video Capture: Frame #051 (epoll)
Video Capture: Frame #052 (epoll)
Video Capture: Frame #053 (epoll)
Video Capture: Frame #054 (epoll)
Video Capture: Frame #055 (epoll)
Video Capture: Frame #056 (epoll)
Video Capture: Frame #057 (epoll)
Video Capture: Frame #058 (epoll)
Video Capture: Frame #059 (epoll)

test MMAP (epoll): OK
test USERPTR (no poll): OK (Not Supported) test USERPTR (select): OK (Not Supported) test DMABUF: Cannot test, specify --expbuf-device

Total for starfive-camss device /dev/video1: 53, Succeeded: 53, Failed: 0, Warnings: 0

------------
Test part 2:

v4l2-compliance 1.25.0, 64 bits, 64-bit time_t

Compliance test for starfive-camss device /dev/media0:

Media Driver Info:

	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.6.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.6.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: 5 Interfaces: 4 Pads: 10 Links: 8 test MEDIA_IOC_ENUM_ENTITIES/LINKS: OK test MEDIA_IOC_SETUP_LINK: OK

Total for starfive-camss device /dev/media0: 8, Succeeded: 8, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for starfive-camss device /dev/video0:

Driver Info:

	Driver name      : starfive-camss
	Card type        : Starfive Camera Subsystem
	Bus info         : platform:19840000.camss
	Driver version   : 6.6.0
	Capabilities     : 0x84200001

Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:

	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.6.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.6.0
Interface Info:
	ID               : 0x03000006
	Type             : V4L Video
Entity Info:
	ID               : 0x00000004 (4)
	Name             : capture_raw
	Function         : V4L2 I/O
	Pad 0x01000005   : 0: Sink
	  Link 0x02000016: from remote pad 0x1000010 of entity 'cdns_csi2rx.19800000.csi-bridge' (Video Interface Bridge): Data

Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK

Allow for multiple opens:
test second /dev/video0 open: OK
test VIDIOC_QUERYCAP: OK
test VIDIOC_G/S_PRIORITY: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_DBG_G/S_REGISTER: OK (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 VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)

Total for starfive-camss device /dev/video0: 46, Succeeded: 46, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for starfive-camss device /dev/video1:

Driver Info:

	Driver name      : starfive-camss
	Card type        : Starfive Camera Subsystem
	Bus info         : platform:19840000.camss
	Driver version   : 6.6.0
	Capabilities     : 0x84200001

Video Capture
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x04200001
Video Capture
Streaming
Extended Pix Format
Media Driver Info:

	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.6.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.6.0
Interface Info:
	ID               : 0x0300000a
	Type             : V4L Video
Entity Info:
	ID               : 0x00000008 (8)
	Name             : capture_yuv
	Function         : V4L2 I/O
	Pad 0x01000009   : 0: Sink
	  Link 0x0200000c: from remote pad 0x1000003 of entity 'stf_isp' (Image Signal Processor): Data, Enabled

Required ioctls:
test MC information (see 'Media Driver Info' above): OK test VIDIOC_QUERYCAP: OK
test invalid ioctls: OK

Allow for multiple opens:
test second /dev/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 VIDIOC_EXPBUF: OK
test Requests: OK (Not Supported)

Total for starfive-camss device /dev/video1: 46, Succeeded: 46, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for starfive-camss device /dev/v4l-subdev0:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000
Media Driver Info:
	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.6.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.6.0
Interface Info:
	ID               : 0x0300001c
	Type             : V4L Sub-Device
Entity Info:
	ID               : 0x00000001 (1)
	Name             : stf_isp
	Function         : Image Signal Processor
	Pad 0x01000002   : 0: Sink
	  Link 0x02000014: from remote pad 0x1000010 of entity 'cdns_csi2rx.19800000.csi-bridge' (Video Interface Bridge): Data, Enabled
	Pad 0x01000003   : 1: Source
	  Link 0x0200000c: to remote pad 0x1000009 of entity 'capture_yuv' (V4L2 I/O): 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
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 VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)

Sub-Device ioctls (Source Pad 1):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Try VIDIOC_SUBDEV_G/S_FMT: OK
test Try VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
Active Stream 0
test Active VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK test Active VIDIOC_SUBDEV_G/S_FMT: OK
test Active VIDIOC_SUBDEV_G/S_SELECTION/CROP: OK
test 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 VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)

Total for starfive-camss device /dev/v4l-subdev0: 58, Succeeded: 58, Failed: 0, Warnings: 0
--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

Required ioctls:
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)

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 20 Private Controls: 0

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported) test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK (Not Supported)
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) test VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)

Total for device /dev/v4l-subdev1: 43, Succeeded: 43, Failed: 0, Warnings: 0

Grand Total for starfive-camss device /dev/media0: 201, Succeeded: 201, Failed: 0, Warnings: 0

===========================================================================
Changes in v10:
- Tested the driver with a v4l2-compliance compiled from the git repo
(git://linuxtv.org/v4l-utils.git).
- Rebased on top of the master branch of media_stage repository.

v9 link: https://lore.kernel.org/all/[email protected]/

Changes in v9:
- Rebased on top of the master branch of media_stage repository.
- Renamed file name.
- Added of_node_put(node) in the error handling path of stfcamss_of_parse_ports().

v8 link: https://lore.kernel.org/all/[email protected]/

Changes in v8:
- Rebased on v6.5-rc7.
- Dropped VIN subdev.
- Created two new video devices: capture_raw and capture_yuv, to replace the previous video devices.
- Dropped VB2_READ io methods.
- Recursively called .s_stream() on subdevs.

v7 link: https://lore.kernel.org/all/[email protected]/

Changes in v7:
- HAS_DMA is used instead of DMA_CMA in Kconfig.
- Dropped some non-essential member variables.
- Used v4l2_async_nf_add_fwnode_remote() to simplify the relevant code.
- Modified some Local variable types in the function.
- Used v4l2_create_fwnode_links_to_pad() to simplify the relevant code.
- Added error handling for clk_prepare_enable().
- Simplified stfcamss_format_info struct and modified the relevant code.
- Dropped enum_input, g_input and s_input.
- Unified v4l2_ioctl_ops struct.
- Used v4l2_fh_open()/vb2_fop_release to replace deprecated APIs.
- Added a camss directory under the starfive directory and modified the patch title.

v6 link: https://lore.kernel.org/all/[email protected]/

Changes in v6:
- Added 'bus-type' in bindings example.
- Corrected spelling errors.
- As reviewed by Bryan, used 'nclks' and 'nrsts' variables.
- Added lccf config for ISP.

v5 link: https://lore.kernel.org/all/[email protected]/

Changes in v5:
- Rebased on v6.4-rc1.
- Added new patch.
- Modified ISP driver.

v4 link: https://lore.kernel.org/all/[email protected]/

Previous cover letter from v4:

This patch series adds support for the StarFive Camera Subsystem found on StarFive JH7110 SoC.

The driver implements V4L2, Media controller and V4L2 subdev interfaces. Camera sensor using V4L2 subdev interface in the kernel is supported.

The driver is tested on VisionFive V2 board with IMX219 camera sensor. GStreamer 1.18.5 with v4l2src plugin is supported.

Previous version link, missing v1 version:

v3: https://lore.kernel.org/all/[email protected]/
v2: https://lore.kernel.org/all/[email protected]/

Jack Zhu (8):
media: dt-bindings: Add JH7110 Camera Subsystem
media: admin-guide: Add starfive_camss.rst for Starfive Camera
Subsystem
media: staging: media: starfive: camss: Add core driver
media: staging: media: starfive: camss: Add video driver
media: staging: media: starfive: camss: Add ISP driver
media: staging: media: starfive: camss: Add capture driver
media: staging: media: starfive: camss: Add interrupt handling
media: staging: media: starfive: camss: Register devices

 .../admin-guide/media/starfive_camss.rst      |  72 +++
 .../media/starfive_camss_graph.dot            |  12 +
 .../admin-guide/media/v4l-drivers.rst         |   1 +
 .../bindings/media/starfive,jh7110-camss.yaml | 180 ++++++
 MAINTAINERS                                   |   9 +
 drivers/staging/media/Kconfig                 |   2 +
 drivers/staging/media/Makefile                |   1 +
 drivers/staging/media/starfive/Kconfig        |   5 +
 drivers/staging/media/starfive/Makefile       |   2 +
 drivers/staging/media/starfive/camss/Kconfig  |  17 +
 drivers/staging/media/starfive/camss/Makefile |  13 +
 .../staging/media/starfive/camss/stf-camss.c  | 436 +++++++++++++
 .../staging/media/starfive/camss/stf-camss.h  | 134 ++++
 .../media/starfive/camss/stf-capture.c        | 603 ++++++++++++++++++
 .../media/starfive/camss/stf-capture.h        |  87 +++
 .../media/starfive/camss/stf-isp-hw-ops.c     | 445 +++++++++++++
 .../staging/media/starfive/camss/stf-isp.c    | 385 +++++++++++
 .../staging/media/starfive/camss/stf-isp.h    | 428 +++++++++++++
 .../staging/media/starfive/camss/stf-video.c  | 572 +++++++++++++++++
 .../staging/media/starfive/camss/stf-video.h  | 100 +++
 20 files changed, 3504 insertions(+)
 create mode 100644 Documentation/admin-guide/media/starfive_camss.rst
 create mode 100644 Documentation/admin-guide/media/starfive_camss_graph.dot
 create mode 100644 Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
 create mode 100644 drivers/staging/media/starfive/Kconfig
 create mode 100644 drivers/staging/media/starfive/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/Kconfig
 create mode 100644 drivers/staging/media/starfive/camss/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/stf-camss.c
 create mode 100644 drivers/staging/media/starfive/camss/stf-camss.h
 create mode 100644 drivers/staging/media/starfive/camss/stf-capture.c
 create mode 100644 drivers/staging/media/starfive/camss/stf-capture.h
 create mode 100644 drivers/staging/media/starfive/camss/stf-isp-hw-ops.c
 create mode 100644 drivers/staging/media/starfive/camss/stf-isp.c
 create mode 100644 drivers/staging/media/starfive/camss/stf-isp.h
 create mode 100644 drivers/staging/media/starfive/camss/stf-video.c
 create mode 100644 drivers/staging/media/starfive/camss/stf-video.h
Signature · 1 line
2.34.1
author
#1 lore raw

PATCH v10 1/8 media: dt-bindings: Add JH7110 Camera Subsystem

Add the bindings documentation for Starfive JH7110 Camera Subsystem which is used for handing image sensor data.

---
 .../bindings/media/starfive,jh7110-camss.yaml | 180 ++++++++++++++++++
 MAINTAINERS                                   |   7 +
 2 files changed, 187 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml new file +180 -0
new file mode 100644
index 000000000000..c66586d90fa2
@@ -0,0 +1,180 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/media/starfive,jh7110-camss.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Starfive SoC CAMSS ISP
+
+maintainers:
+  - Jack Zhu <[email protected]>
+  - Changhuang Liang <[email protected]>
+
+description:
+  The Starfive CAMSS ISP is a Camera interface for Starfive JH7110 SoC. It
+  consists of a VIN controller (Video In Controller, a top-level control unit)
+  and an ISP.
+
+properties:
+  compatible:
+    const: starfive,jh7110-camss
+
+  reg:
+    maxItems: 2
+
+  reg-names:
+    items:
+      - const: syscon
+      - const: isp
+
+  clocks:
+    maxItems: 7
+
+  clock-names:
+    items:
+      - const: apb_func
+      - const: wrapper_clk_c
+      - const: dvp_inv
+      - const: axiwr
+      - const: mipi_rx0_pxl
+      - const: ispcore_2x
+      - const: isp_axi
+
+  resets:
+    maxItems: 6
+
+  reset-names:
+    items:
+      - const: wrapper_p
+      - const: wrapper_c
+      - const: axird
+      - const: axiwr
+      - const: isp_top_n
+      - const: isp_top_axi
+
+  power-domains:
+    items:
+      - description: JH7110 ISP Power Domain Switch Controller.
+
+  interrupts:
+    maxItems: 4
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+
+    properties:
+      port@0:
+        $ref: /schemas/graph.yaml#/$defs/port-base
+        unevaluatedProperties: false
+        description: Input port for receiving DVP data.
+
+        properties:
+          endpoint:
+            $ref: video-interfaces.yaml#
+            unevaluatedProperties: false
+
+            properties:
+              bus-type:
+                enum: [5, 6]
+
+              bus-width:
+                enum: [8, 10, 12]
+
+              data-shift:
+                enum: [0, 2]
+                default: 0
+
+              hsync-active:
+                enum: [0, 1]
+                default: 1
+
+              vsync-active:
+                enum: [0, 1]
+                default: 1
+
+            required:
+              - bus-type
+              - bus-width
+
+      port@1:
+        $ref: /schemas/graph.yaml#/properties/port
+        description: Input port for receiving CSI data.
+
+    required:
+      - port@0
+      - port@1
+
+required:
+  - compatible
+  - reg
+  - reg-names
+  - clocks
+  - clock-names
+  - resets
+  - reset-names
+  - power-domains
+  - interrupts
+  - ports
+
+additionalProperties: false
+
+examples:
+  - |
+    isp@19840000 {
+        compatible = "starfive,jh7110-camss";
+        reg = <0x19840000 0x10000>,
+              <0x19870000 0x30000>;
+        reg-names = "syscon", "isp";
+        clocks = <&ispcrg 0>,
+                 <&ispcrg 13>,
+                 <&ispcrg 2>,
+                 <&ispcrg 12>,
+                 <&ispcrg 1>,
+                 <&syscrg 51>,
+                 <&syscrg 52>;
+        clock-names = "apb_func",
+                      "wrapper_clk_c",
+                      "dvp_inv",
+                      "axiwr",
+                      "mipi_rx0_pxl",
+                      "ispcore_2x",
+                      "isp_axi";
+        resets = <&ispcrg 0>,
+                 <&ispcrg 1>,
+                 <&ispcrg 10>,
+                 <&ispcrg 11>,
+                 <&syscrg 41>,
+                 <&syscrg 42>;
+        reset-names = "wrapper_p",
+                      "wrapper_c",
+                      "axird",
+                      "axiwr",
+                      "isp_top_n",
+                      "isp_top_axi";
+        power-domains = <&pwrc 5>;
+        interrupts = <92>, <87>, <88>, <90>;
+
+        ports {
+            #address-cells = <1>;
+            #size-cells = <0>;
+            port@0 {
+                reg = <0>;
+                vin_from_sc2235: endpoint {
+                    remote-endpoint = <&sc2235_to_vin>;
+                    bus-type = <5>;
+                    bus-width = <8>;
+                    data-shift = <2>;
+                    hsync-active = <1>;
+                    vsync-active = <0>;
+                    pclk-sample = <1>;
+                };
+            };
+
+            port@1 {
+                reg = <1>;
+                vin_from_csi2rx: endpoint {
+                    remote-endpoint = <&csi2rx_to_vin>;
+                };
+            };
+        };
+    };
MAINTAINERS +7 -0
index 75af99eeda6e..774dcb5b70ca 100644
@@ -20448,6 +20448,13 @@ M:	Ion Badulescu <[email protected]>
 S:	Odd Fixes
 F:	drivers/net/ethernet/adaptec/starfire*
 
+STARFIVE CAMERA SUBSYSTEM DRIVER
+M:	Jack Zhu <[email protected]>
+M:	Changhuang Liang <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
+
 STARFIVE CRYPTO DRIVER
 M:	Jia Jie Ho <[email protected]>
 M:	William Qiu <[email protected]>
Signature · 1 line
2.34.1
author
#2 lore raw

PATCH v10 2/8 media: admin-guide: Add starfive_camss.rst for Starfive Camera Subsystem

In reply to Jack Zhu

Add starfive_camss.rst file that documents the Starfive Camera Subsystem driver which is used for handing image sensor data.

---
 .../admin-guide/media/starfive_camss.rst      | 72 +++++++++++++++++++
 .../media/starfive_camss_graph.dot            | 12 ++++
 .../admin-guide/media/v4l-drivers.rst         |  1 +
 MAINTAINERS                                   |  1 +
 4 files changed, 86 insertions(+)
 create mode 100644 Documentation/admin-guide/media/starfive_camss.rst
 create mode 100644 Documentation/admin-guide/media/starfive_camss_graph.dot
Documentation/admin-guide/media/starfive_camss.rst new file +72 -0
new file mode 100644
index 000000000000..ca42e9447c47
@@ -0,0 +1,72 @@
+.. SPDX-License-Identifier: GPL-2.0
+
+.. include:: <isonum.txt>
+
+================================
+Starfive Camera Subsystem driver
+================================
+
+Introduction
+------------
+
+This file documents the driver for the Starfive Camera Subsystem found on
+Starfive JH7110 SoC. The driver is located under drivers/staging/media/starfive/
+camss.
+
+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 successfully used on the Gstreamer 1.18.5 with v4l2src
+plugin.
+
+
+Starfive Camera Subsystem hardware
+----------------------------------
+
+The Starfive Camera Subsystem hardware consists of::
+
+                    |\         +---------------+      +-----------+
+  +----------+      |  \       |               |      |           |
+  |          |      |   |      |               |      |           |
+  |   MIPI   |----->|   |----->|      ISP      |----->|           |
+  |          |      |   |      |               |      |           |
+  +----------+      |   |      |               |      |  Memory   |
+                    |MUX|      +---------------+      | Interface |
+  +----------+      |   |                             |           |
+  |          |      |   |---------------------------->|           |
+  | Parallel |----->|   |                             |           |
+  |          |      |   |                             |           |
+  +----------+      |  /                              |           |
+                    |/                                +-----------+
+
+- MIPI: The MIPI interface, receiving data from a MIPI CSI-2 camera sensor.
+
+- Parallel: The parallel interface,  receiving data from a parallel sensor.
+
+- ISP: The ISP, processing raw Bayer data from an image sensor and producing
+  YUV frames.
+
+
+Topology
+--------
+
+The media controller pipeline graph is as follows:
+
+.. _starfive_camss_graph:
+
+.. kernel-figure:: starfive_camss_graph.dot
+    :alt:   starfive_camss_graph.dot
+    :align: center
+
+The driver has 2 video devices:
+
+- capture_raw: The capture device, capturing image data directly from a sensor.
+- capture_yuv: The capture device, capturing YUV frame data processed by the
+  ISP module
+
+The driver has 3 subdevices:
+
+- stf_isp: is responsible for all the isp operations, outputs YUV frames.
+- cdns_csi2rx: a CSI-2 bridge supporting up to 4 CSI lanes in input, and 4
+  different pixel streams in output.
+- imx219: an image sensor, image data is sent through MIPI CSI-2.
Documentation/admin-guide/media/starfive_camss_graph.dot new file +12 -0
new file mode 100644
index 000000000000..8eff1f161ac7
@@ -0,0 +1,12 @@
+digraph board {
+	rankdir=TB
+	n00000001 [label="{{<port0> 0} | stf_isp\n/dev/v4l-subdev0 | {<port1> 1}}", shape=Mrecord, style=filled, fillcolor=green]
+	n00000001:port1 -> n00000008 [style=dashed]
+	n00000004 [label="capture_raw\n/dev/video0", shape=box, style=filled, fillcolor=yellow]
+	n00000008 [label="capture_yuv\n/dev/video1", shape=box, style=filled, fillcolor=yellow]
+	n0000000e [label="{{<port0> 0} | cdns_csi2rx.19800000.csi-bridge\n | {<port1> 1 | <port2> 2 | <port3> 3 | <port4> 4}}", shape=Mrecord, style=filled, fillcolor=green]
+	n0000000e:port1 -> n00000001:port0 [style=dashed]
+	n0000000e:port1 -> n00000004 [style=dashed]
+	n00000018 [label="{{} | imx219 6-0010\n/dev/v4l-subdev1 | {<port0> 0}}", shape=Mrecord, style=filled, fillcolor=green]
+	n00000018:port0 -> n0000000e:port0 [style=bold]
+}
Documentation/admin-guide/media/v4l-drivers.rst +1 -0
index 61283d67ceef..f4bb2605f07e 100644
@@ -28,6 +28,7 @@ Video4Linux (V4L) driver-specific documentation
 	si470x
 	si4713
 	si476x
+	starfive_camss
 	vimc
 	visl
 	vivid
MAINTAINERS +1 -0
index 774dcb5b70ca..2680f7242a6d 100644
@@ -20453,6 +20453,7 @@ M:	Jack Zhu <[email protected]>
 M:	Changhuang Liang <[email protected]>
 L:	[email protected]
 S:	Maintained
+F:	Documentation/admin-guide/media/starfive_camss.rst
 F:	Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
 
 STARFIVE CRYPTO DRIVER
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH v10 3/8 media: staging: media: starfive: camss: Add core driver

In reply to Jack Zhu

Add core driver for StarFive Camera Subsystem. The code parses the device platform resources and registers related devices.

---
 MAINTAINERS                                   |   1 +
 drivers/staging/media/Kconfig                 |   2 +
 drivers/staging/media/Makefile                |   1 +
 drivers/staging/media/starfive/Kconfig        |   5 +
 drivers/staging/media/starfive/Makefile       |   2 +
 drivers/staging/media/starfive/camss/Kconfig  |  17 +
 drivers/staging/media/starfive/camss/Makefile |   9 +
 .../staging/media/starfive/camss/stf-camss.c  | 320 ++++++++++++++++++
 .../staging/media/starfive/camss/stf-camss.h  | 129 +++++++
 9 files changed, 486 insertions(+)
 create mode 100644 drivers/staging/media/starfive/Kconfig
 create mode 100644 drivers/staging/media/starfive/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/Kconfig
 create mode 100644 drivers/staging/media/starfive/camss/Makefile
 create mode 100644 drivers/staging/media/starfive/camss/stf-camss.c
 create mode 100644 drivers/staging/media/starfive/camss/stf-camss.h
MAINTAINERS +1 -0
index 2680f7242a6d..3350642b5c64 100644
@@ -20455,6 +20455,7 @@ L:	[email protected]
 S:	Maintained
 F:	Documentation/admin-guide/media/starfive_camss.rst
 F:	Documentation/devicetree/bindings/media/starfive,jh7110-camss.yaml
+F:	drivers/staging/media/starfive/camss
 
 STARFIVE CRYPTO DRIVER
 M:	Jia Jie Ho <[email protected]>
drivers/staging/media/Kconfig +2 -0
index bc6c7b248f86..554c2e475ce3 100644
@@ -36,6 +36,8 @@ source "drivers/staging/media/omap4iss/Kconfig"
 
 source "drivers/staging/media/rkvdec/Kconfig"
 
+source "drivers/staging/media/starfive/Kconfig"
+
 source "drivers/staging/media/sunxi/Kconfig"
 
 source "drivers/staging/media/tegra-video/Kconfig"
drivers/staging/media/Makefile +1 -0
index 1a4c3a062e3d..dcaeeca0ee6d 100644
@@ -6,6 +6,7 @@ obj-$(CONFIG_VIDEO_MAX96712)	+= max96712/
 obj-$(CONFIG_VIDEO_MESON_VDEC)	+= meson/vdec/
 obj-$(CONFIG_VIDEO_OMAP4)	+= omap4iss/
 obj-$(CONFIG_VIDEO_ROCKCHIP_VDEC)	+= rkvdec/
+obj-$(CONFIG_VIDEO_STARFIVE_CAMSS)	+= starfive/
 obj-$(CONFIG_VIDEO_SUNXI)	+= sunxi/
 obj-$(CONFIG_VIDEO_TEGRA)	+= tegra-video/
 obj-$(CONFIG_VIDEO_IPU3_IMGU)	+= ipu3/
drivers/staging/media/starfive/Kconfig new file +5 -0
new file mode 100644
index 000000000000..34727cf56072
@@ -0,0 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+comment "StarFive media platform drivers"
+
+source "drivers/staging/media/starfive/camss/Kconfig"
drivers/staging/media/starfive/Makefile new file +2 -0
new file mode 100644
index 000000000000..4639fa1bca32
@@ -0,0 +1,2 @@
+# SPDX-License-Identifier: GPL-2.0-only
+obj-y += camss/
drivers/staging/media/starfive/camss/Kconfig new file +17 -0
new file mode 100644
index 000000000000..bd184f42c98f
@@ -0,0 +1,17 @@
+# SPDX-License-Identifier: GPL-2.0-only
+config VIDEO_STARFIVE_CAMSS
+	tristate "Starfive Camera Subsystem driver"
+	depends on V4L_PLATFORM_DRIVERS
+	depends on VIDEO_DEV && OF
+	depends on HAS_DMA
+	depends on PM
+	select MEDIA_CONTROLLER
+	select VIDEO_V4L2_SUBDEV_API
+	select VIDEOBUF2_DMA_CONTIG
+	select V4L2_FWNODE
+	help
+	   Enable this to support for the Starfive Camera subsystem
+	   found on Starfive JH7110 SoC.
+
+	   To compile this driver as a module, choose M here: the
+	   module will be called starfive-camss.
drivers/staging/media/starfive/camss/Makefile new file +9 -0
new file mode 100644
index 000000000000..78211e30550f
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Makefile for StarFive Camera Subsystem driver
+#
+
+starfive-camss-objs += \
+		stf-camss.o
+
+obj-$(CONFIG_VIDEO_STARFIVE_CAMSS) += starfive-camss.o
drivers/staging/media/starfive/camss/stf-camss.c new file +320 -0

320 lines not on this page · raw message

drivers/staging/media/starfive/camss/stf-camss.h new file +129 -0

129 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#4 lore raw

PATCH v10 4/8 media: staging: media: starfive: camss: Add video driver

In reply to Jack Zhu

Add video driver for StarFive Camera Subsystem.

---
 drivers/staging/media/starfive/camss/Makefile |   3 +-
 .../staging/media/starfive/camss/stf-video.c  | 572 ++++++++++++++++++
 .../staging/media/starfive/camss/stf-video.h  | 100 +++
 3 files changed, 674 insertions(+), 1 deletion(-)
 create mode 100644 drivers/staging/media/starfive/camss/stf-video.c
 create mode 100644 drivers/staging/media/starfive/camss/stf-video.h
drivers/staging/media/starfive/camss/Makefile +2 -1
index 78211e30550f..7d320b9317c8 100644
@@ -4,6 +4,7 @@
 #
 
 starfive-camss-objs += \
-		stf-camss.o
+		stf-camss.o \
+		stf-video.o
 
 obj-$(CONFIG_VIDEO_STARFIVE_CAMSS) += starfive-camss.o
drivers/staging/media/starfive/camss/stf-video.c new file +572 -0

572 lines not on this page · raw message

drivers/staging/media/starfive/camss/stf-video.h new file +100 -0

100 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#5 lore raw

PATCH v10 5/8 media: staging: media: starfive: camss: Add ISP driver

In reply to Jack Zhu

Add ISP driver for StarFive Camera Subsystem.

---
 drivers/staging/media/starfive/camss/Makefile |   2 +
 .../staging/media/starfive/camss/stf-camss.h  |   3 +
 .../media/starfive/camss/stf-isp-hw-ops.c     | 445 ++++++++++++++++++
 .../staging/media/starfive/camss/stf-isp.c    | 385 +++++++++++++++
 .../staging/media/starfive/camss/stf-isp.h    | 428 +++++++++++++++++
 5 files changed, 1263 insertions(+)
 create mode 100644 drivers/staging/media/starfive/camss/stf-isp-hw-ops.c
 create mode 100644 drivers/staging/media/starfive/camss/stf-isp.c
 create mode 100644 drivers/staging/media/starfive/camss/stf-isp.h
drivers/staging/media/starfive/camss/Makefile +2 -0
index 7d320b9317c8..97e1522b21ae 100644
@@ -5,6 +5,8 @@
 
 starfive-camss-objs += \
 		stf-camss.o \
+		stf-isp.o \
+		stf-isp-hw-ops.o \
 		stf-video.o
 
 obj-$(CONFIG_VIDEO_STARFIVE_CAMSS) += starfive-camss.o
drivers/staging/media/starfive/camss/stf-camss.h +3 -0
index 47d715122155..c7b0a34cd29b 100644
@@ -18,6 +18,8 @@
 #include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 
+#include "stf-isp.h"
+
 enum stf_port_num {
 	STF_PORT_DVP = 0,
 	STF_PORT_CSI2RX
@@ -49,6 +51,7 @@ struct stfcamss {
 	struct media_device media_dev;
 	struct media_pipeline pipe;
 	struct device *dev;
+	struct stf_isp_dev isp_dev;
 	struct v4l2_async_notifier notifier;
 	void __iomem *syscon_base;
 	void __iomem *isp_base;
drivers/staging/media/starfive/camss/stf-isp-hw-ops.c new file +445 -0

445 lines not on this page · raw message

drivers/staging/media/starfive/camss/stf-isp.c new file +385 -0

385 lines not on this page · raw message

drivers/staging/media/starfive/camss/stf-isp.h new file +428 -0

428 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#6 lore raw

PATCH v10 6/8 media: staging: media: starfive: camss: Add capture driver

In reply to Jack Zhu

Add capture driver for StarFive Camera Subsystem. It contains two video
devices: capture_yuv and capture_raw.

---
 drivers/staging/media/starfive/camss/Makefile |   1 +
 .../staging/media/starfive/camss/stf-camss.h  |   2 +
 .../media/starfive/camss/stf-capture.c        | 603 ++++++++++++++++++
 .../media/starfive/camss/stf-capture.h        |  87 +++
 4 files changed, 693 insertions(+)
 create mode 100644 drivers/staging/media/starfive/camss/stf-capture.c
 create mode 100644 drivers/staging/media/starfive/camss/stf-capture.h
drivers/staging/media/starfive/camss/Makefile +1 -0
index 97e1522b21ae..005790202e7b 100644
@@ -5,6 +5,7 @@
 
 starfive-camss-objs += \
 		stf-camss.o \
+		stf-capture.o \
 		stf-isp.o \
 		stf-isp-hw-ops.o \
 		stf-video.o
drivers/staging/media/starfive/camss/stf-camss.h +2 -0
index c7b0a34cd29b..e2b0cfb437bd 100644
@@ -19,6 +19,7 @@
 #include <media/v4l2-device.h>
 
 #include "stf-isp.h"
+#include "stf-capture.h"
 
 enum stf_port_num {
 	STF_PORT_DVP = 0,
@@ -52,6 +53,7 @@ struct stfcamss {
 	struct media_pipeline pipe;
 	struct device *dev;
 	struct stf_isp_dev isp_dev;
+	struct stf_capture captures[STF_CAPTURE_NUM];
 	struct v4l2_async_notifier notifier;
 	void __iomem *syscon_base;
 	void __iomem *isp_base;
drivers/staging/media/starfive/camss/stf-capture.c new file +603 -0

603 lines not on this page · raw message

drivers/staging/media/starfive/camss/stf-capture.h new file +87 -0

87 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#7 lore raw

PATCH v10 7/8 media: staging: media: starfive: camss: Add interrupt handling

In reply to Jack Zhu

Parse interrupt resources and register interrupt handlers.

---
 .../staging/media/starfive/camss/stf-camss.c  | 21 +++++++++++++++++++
 1 file changed, 21 insertions(+)
drivers/staging/media/starfive/camss/stf-camss.c +21 -0
index f083bc0e6e97..373467322885 100644
@@ -35,6 +35,12 @@ static const char * const stfcamss_resets[] = {
 	"rst_isp_top_axi",
 };
 
+static const struct stf_isr_data stf_isrs[] = {
+	{"wr_irq", stf_wr_irq_handler},
+	{"isp_irq", stf_isp_irq_handler},
+	{"line_irq", stf_line_irq_handler},
+};
+
 static int stfcamss_get_mem_res(struct stfcamss *stfcamss)
 {
 	struct platform_device *pdev = to_platform_device(stfcamss->dev);
@@ -160,6 +166,21 @@ static int stfcamss_probe(struct platform_device *pdev)
 
 	stfcamss->dev = dev;
 
+	for (i = 0; i < ARRAY_SIZE(stf_isrs); ++i) {
+		int irq;
+
+		irq = platform_get_irq(pdev, i);
+		if (irq < 0)
+			return irq;
+
+		ret = devm_request_irq(stfcamss->dev, irq, stf_isrs[i].isr, 0,
+				       stf_isrs[i].name, stfcamss);
+		if (ret) {
+			dev_err(dev, "request irq failed: %d\n", ret);
+			return ret;
+		}
+	}
+
 	stfcamss->nclks = ARRAY_SIZE(stfcamss->sys_clk);
 	for (i = 0; i < stfcamss->nclks; ++i)
 		stfcamss->sys_clk[i].id = stfcamss_clocks[i];
Signature · 1 line
2.34.1
author
#8 lore raw

PATCH v10 8/8 media: staging: media: starfive: camss: Register devices

In reply to Jack Zhu

Register ISP sub-device and video devices for StarFive Camera Subsystem.

---
 .../staging/media/starfive/camss/stf-camss.c  | 97 ++++++++++++++++++-
 1 file changed, 96 insertions(+), 1 deletion(-)
drivers/staging/media/starfive/camss/stf-camss.c +96 -1
index 373467322885..b2e0f5b3c910 100644
@@ -123,6 +123,85 @@ static int stfcamss_of_parse_ports(struct stfcamss *stfcamss)
 	return ret;
 }
 
+static int stfcamss_register_devs(struct stfcamss *stfcamss)
+{
+	struct stf_capture *cap_yuv = &stfcamss->captures[STF_CAPTURE_YUV];
+	struct stf_isp_dev *isp_dev = &stfcamss->isp_dev;
+	int ret;
+
+	ret = stf_isp_register(isp_dev, &stfcamss->v4l2_dev);
+	if (ret < 0) {
+		dev_err(stfcamss->dev,
+			"failed to register stf isp%d entity: %d\n", 0, ret);
+		return ret;
+	}
+
+	ret = stf_capture_register(stfcamss, &stfcamss->v4l2_dev);
+	if (ret < 0) {
+		dev_err(stfcamss->dev,
+			"failed to register capture: %d\n", ret);
+		goto err_isp_unregister;
+	}
+
+	ret = media_create_pad_link(&isp_dev->subdev.entity, STF_ISP_PAD_SRC,
+				    &cap_yuv->video.vdev.entity, 0, 0);
+	if (ret)
+		goto err_cap_unregister;
+
+	cap_yuv->video.source_subdev = &isp_dev->subdev;
+
+	return ret;
+
+err_cap_unregister:
+	stf_capture_unregister(stfcamss);
+err_isp_unregister:
+	stf_isp_unregister(&stfcamss->isp_dev);
+
+	return ret;
+}
+
+static void stfcamss_unregister_devs(struct stfcamss *stfcamss)
+{
+	stf_isp_unregister(&stfcamss->isp_dev);
+	stf_capture_unregister(stfcamss);
+}
+
+static int stfcamss_subdev_notifier_bound(struct v4l2_async_notifier *async,
+					  struct v4l2_subdev *subdev,
+					  struct v4l2_async_connection *asc)
+{
+	struct stfcamss *stfcamss =
+		container_of(async, struct stfcamss, notifier);
+	struct stfcamss_async_subdev *csd =
+		container_of(asc, struct stfcamss_async_subdev, asd);
+	enum stf_port_num port = csd->port;
+	struct stf_isp_dev *isp_dev = &stfcamss->isp_dev;
+	struct stf_capture *cap_raw = &stfcamss->captures[STF_CAPTURE_RAW];
+	struct media_pad *pad;
+	int ret;
+
+	if (port == STF_PORT_CSI2RX) {
+		pad = &isp_dev->pads[STF_ISP_PAD_SINK];
+	} else {
+		dev_err(stfcamss->dev, "not support port %d\n", port);
+		return -EPERM;
+	}
+
+	ret = v4l2_create_fwnode_links_to_pad(subdev, pad, 0);
+	if (ret)
+		return ret;
+
+	ret = media_create_pad_link(&subdev->entity, 1,
+				    &cap_raw->video.vdev.entity, 0, 0);
+	if (ret)
+		return ret;
+
+	isp_dev->source_subdev = subdev;
+	cap_raw->video.source_subdev = subdev;
+
+	return 0;
+}
+
 static int stfcamss_subdev_notifier_complete(struct v4l2_async_notifier *ntf)
 {
 	struct stfcamss *stfcamss =
@@ -133,6 +212,7 @@ static int stfcamss_subdev_notifier_complete(struct v4l2_async_notifier *ntf)
 
 static const struct v4l2_async_notifier_operations
 stfcamss_subdev_notifier_ops = {
+	.bound = stfcamss_subdev_notifier_bound,
 	.complete = stfcamss_subdev_notifier_complete,
 };
 
@@ -217,6 +297,12 @@ static int stfcamss_probe(struct platform_device *pdev)
 		goto err_cleanup_notifier;
 	}
 
+	ret = stf_isp_init(stfcamss);
+	if (ret < 0) {
+		dev_err(dev, "Failed to init isp: %d\n", ret);
+		goto err_cleanup_notifier;
+	}
+
 	stfcamss_mc_init(pdev, stfcamss);
 
 	ret = v4l2_device_register(stfcamss->dev, &stfcamss->v4l2_dev);
@@ -231,6 +317,12 @@ static int stfcamss_probe(struct platform_device *pdev)
 		goto err_unregister_device;
 	}
 
+	ret = stfcamss_register_devs(stfcamss);
+	if (ret < 0) {
+		dev_err(dev, "Failed to register subdevice: %d\n", ret);
+		goto err_unregister_media_dev;
+	}
+
 	pm_runtime_enable(dev);
 
 	stfcamss->notifier.ops = &stfcamss_subdev_notifier_ops;
@@ -239,11 +331,13 @@ static int stfcamss_probe(struct platform_device *pdev)
 		dev_err(dev, "Failed to register async subdev nodes: %d\n",
 			ret);
 		pm_runtime_disable(dev);
-		goto err_unregister_media_dev;
+		goto err_unregister_subdevs;
 	}
 
 	return 0;
 
+err_unregister_subdevs:
+	stfcamss_unregister_devs(stfcamss);
 err_unregister_media_dev:
 	media_device_unregister(&stfcamss->media_dev);
 err_unregister_device:
@@ -265,6 +359,7 @@ static int stfcamss_remove(struct platform_device *pdev)
 {
 	struct stfcamss *stfcamss = platform_get_drvdata(pdev);
 
+	stfcamss_unregister_devs(stfcamss);
 	v4l2_device_unregister(&stfcamss->v4l2_dev);
 	media_device_cleanup(&stfcamss->media_dev);
 	v4l2_async_nf_cleanup(&stfcamss->notifier);
Signature · 1 line
2.34.1
author
#9 lore raw
In reply to Jack Zhu
Quoted 5 lines · Jack Zhu

Hi,

This series is the v10 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

Hi Hans,

Could you please help to review and give your comments? Thanks a lot!

Signature · 3 lines
Regards,

Jack Zhu
#10 lore raw
In reply to Jack Zhu

Hi Jack,

Quoted 8 lines · Jack Zhu

Hi,

This series is the v10 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

This series is based on top of the master branch of media_stage repository, which is tested with a v4l2-compliance compiled from the git repo
(git://linuxtv.org/v4l-utils.git).

I get one smatch warning:

drivers/staging/media/starfive/camss/stf-isp.c:122 isp_enum_mbus_code() warn: unsigned 'code->index' is never less than zero.

And I also notice that there is no TODO file: staging drivers should have a TODO file explaining what needs to be done to get them out of staging.

I'm curious to know that as well :-)

It looks like there is a lot of additional development that can be done, since most of the ISP parameters appear to be hardcoded.

I also notice something weird in the compliance test output for v4l-subdev0 vs v4l-subdev1:

Quoted 16 lines

Compliance test for starfive-camss device /dev/v4l-subdev0:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000
Media Driver Info:
	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.6.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.6.0
Interface Info:
	ID               : 0x0300001c
	Type             : V4L Sub-Device
Quoted 8 lines

Entity Info:

	ID               : 0x00000001 (1)
	Name             : stf_isp
	Function         : Image Signal Processor
	Pad 0x01000002   : 0: Sink
	  Link 0x02000014: from remote pad 0x1000010 of entity 'cdns_csi2rx.19800000.csi-bridge' (Video Interface Bridge): Data, Enabled
	Pad 0x01000003   : 1: Source
	  Link 0x0200000c: to remote pad 0x1000009 of entity 'capture_yuv' (V4L2 I/O): Data, Enabled

Here it shows the Media Driver Info for v4l-subdev0.

<snip>

Quoted 6 lines

--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

But this does not appear for v4l-subdev1.

I can't really tell why it doesn't show that. Can you debug a little bit? The code is in v4l2-compliance.cpp, line 1086:

ent_id = mi_media_info_for_fd(media_fd, node.g_fd(), &is_invalid, &node.function);

The mi_media_info_for_fd() function calls ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo), and that fails for some reason. It could be that media_fd is invalid (would be weird).

This could well be a v4l2-compliance bug that you hit with this driver.

Regards,

Hans

author
#11 lore raw

Hi Hans,

Thank you for your comments.

Quoted 68 lines · Hans Verkuil

Hi Jack,

Quoted 8 lines · Jack Zhu

Hi,

This series is the v10 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

This series is based on top of the master branch of media_stage repository, which is tested with a v4l2-compliance compiled from the git repo
(git://linuxtv.org/v4l-utils.git).

I get one smatch warning:

drivers/staging/media/starfive/camss/stf-isp.c:122 isp_enum_mbus_code() warn: unsigned 'code->index' is never less than zero.

And I also notice that there is no TODO file: staging drivers should have a TODO file explaining what needs to be done to get them out of staging.

I'm curious to know that as well :-)

It looks like there is a lot of additional development that can be done, since most of the ISP parameters appear to be hardcoded.

I also notice something weird in the compliance test output for v4l-subdev0 vs v4l-subdev1:

Quoted 16 lines

Compliance test for starfive-camss device /dev/v4l-subdev0:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000
Media Driver Info:
	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.6.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.6.0
Interface Info:
	ID               : 0x0300001c
	Type             : V4L Sub-Device
Quoted 8 lines

Entity Info:

	ID               : 0x00000001 (1)
	Name             : stf_isp
	Function         : Image Signal Processor
	Pad 0x01000002   : 0: Sink
	  Link 0x02000014: from remote pad 0x1000010 of entity 'cdns_csi2rx.19800000.csi-bridge' (Video Interface Bridge): Data, Enabled
	Pad 0x01000003   : 1: Source
	  Link 0x0200000c: to remote pad 0x1000009 of entity 'capture_yuv' (V4L2 I/O): Data, Enabled

Here it shows the Media Driver Info for v4l-subdev0.

<snip>

Quoted 6 lines

--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

But this does not appear for v4l-subdev1.

I can't really tell why it doesn't show that. Can you debug a little bit? The code is in v4l2-compliance.cpp, line 1086:

Quoted 7 lines

ent_id = mi_media_info_for_fd(media_fd, node.g_fd(), &is_invalid, &node.function);

The mi_media_info_for_fd() function calls ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo), and that fails for some reason. It could be that media_fd is invalid (would be weird).

This could well be a v4l2-compliance bug that you hit with this driver.

On the test board, /dev/v4l-subdev1 is imx219, and the corresponding directory is /sys/dev/char/81:3/device. Media0 does not exist in this directory. Therefore, the media_fd obtained through mi_get_media_fd(node.g_fd(), node.bus_info) is invalid.

I don't know why media0 does not exist in /sys/dev/char/81:3/device?

Signature · 3 lines
Regards,

Jack Zhu
author
#12 lore raw
Quoted 78 lines · Jack Zhu

Hi Hans,

Thank you for your comments.

Quoted 73 lines · Hans Verkuil

Hi Jack,

Quoted 8 lines · Jack Zhu

Hi,

This series is the v10 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

This series is based on top of the master branch of media_stage repository, which is tested with a v4l2-compliance compiled from the git repo
(git://linuxtv.org/v4l-utils.git).

I get one smatch warning:

drivers/staging/media/starfive/camss/stf-isp.c:122 isp_enum_mbus_code() warn: unsigned 'code->index' is never less than zero.

And I also notice that there is no TODO file: staging drivers should have a TODO file explaining what needs to be done to get them out of staging.

I'm curious to know that as well :-)

It looks like there is a lot of additional development that can be done, since most of the ISP parameters appear to be hardcoded.

I also notice something weird in the compliance test output for v4l-subdev0 vs v4l-subdev1:

Quoted 16 lines

Compliance test for starfive-camss device /dev/v4l-subdev0:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000
Media Driver Info:
	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.6.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.6.0
Interface Info:
	ID               : 0x0300001c
	Type             : V4L Sub-Device
Quoted 8 lines

Entity Info:

	ID               : 0x00000001 (1)
	Name             : stf_isp
	Function         : Image Signal Processor
	Pad 0x01000002   : 0: Sink
	  Link 0x02000014: from remote pad 0x1000010 of entity 'cdns_csi2rx.19800000.csi-bridge' (Video Interface Bridge): Data, Enabled
	Pad 0x01000003   : 1: Source
	  Link 0x0200000c: to remote pad 0x1000009 of entity 'capture_yuv' (V4L2 I/O): Data, Enabled

Here it shows the Media Driver Info for v4l-subdev0.

<snip>

Quoted 6 lines

--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

But this does not appear for v4l-subdev1.

I can't really tell why it doesn't show that. Can you debug a little bit? The code is in v4l2-compliance.cpp, line 1086:

ent_id = mi_media_info_for_fd(media_fd, node.g_fd(), &is_invalid, &node.function);

The mi_media_info_for_fd() function calls ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo), and that fails for some reason. It could be that media_fd is invalid (would be weird).

Quoted 9 lines
Quoted 2 lines

This could well be a v4l2-compliance bug that you hit with this driver.

On the test board, /dev/v4l-subdev1 is imx219, and the corresponding directory is /sys/dev/char/81:3/device. Media0 does not exist in this directory. Therefore, the media_fd obtained through mi_get_media_fd(node.g_fd(), node.bus_info) is invalid.

I don't know why media0 does not exist in /sys/dev/char/81:3/device?

Hi Hans,

Could you please comment on this issue? imx219 directly uses the driver file in the media_stage repository.

Thank you for your time!

Signature · 3 lines
Regards,

Jack Zhu
#13 lore raw
In reply to Jack Zhu

Hi Jack,

On 18/10/2023 04:37, Jack Zhu wrote:

<snip>

Quoted 17 lines
Quoted 17 lines
Quoted 6 lines

--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

But this does not appear for v4l-subdev1.

I can't really tell why it doesn't show that. Can you debug a little bit? The code is in v4l2-compliance.cpp, line 1086:

ent_id = mi_media_info_for_fd(media_fd, node.g_fd(), &is_invalid, &node.function);

The mi_media_info_for_fd() function calls ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo), and that fails for some reason. It could be that media_fd is invalid (would be weird).

Quoted 9 lines
Quoted 2 lines

This could well be a v4l2-compliance bug that you hit with this driver.

On the test board, /dev/v4l-subdev1 is imx219, and the corresponding directory is /sys/dev/char/81:3/device. Media0 does not exist in this directory. Therefore, the media_fd obtained through mi_get_media_fd(node.g_fd(), node.bus_info) is invalid.

I don't know why media0 does not exist in /sys/dev/char/81:3/device?

Can you try again with this v4l2-compliance patch?

I need to dig a bit deeper as to why media0 is missing, but for now try this.

Regards,

Hans

utils/v4l2-compliance/v4l2-compliance.cpp +7 -3
index 7169eefe..29475d6b 100644
@@ -968,7 +968,7 @@ err:
 }
 
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count)
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd)
 {
 	struct node node2;
 	struct v4l2_capability vcap = {};
@@ -997,8 +997,12 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
 		memset(&vcap, 0, sizeof(vcap));
 	}
 
-	if (!node.is_media())
-		media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	if (!node.is_media()) {
+		if (parent_media_fd >= 0)
+			media_fd = parent_media_fd;
+		else
+			media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	}
 
 	int fd = node.is_media() ? node.g_fd() : media_fd;
 	if (fd >= 0) {
utils/v4l2-compliance/v4l2-compliance.h +1 -1
index 7caf254b..c47f25f5 100644
@@ -308,7 +308,7 @@ int check_ustring(const __u8 *s, int len);
 int check_0(const void *p, int len);
 int restoreFormat(struct node *node);
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count);
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd = -1);
 std::string stream_from(const std::string &pixelformat, bool &use_hdr);
 
 // Media Controller ioctl tests
author
#14 lore raw
Quoted 75 lines · Hans Verkuil

Hi Jack,

On 18/10/2023 04:37, Jack Zhu wrote:

<snip>

Quoted 17 lines
Quoted 17 lines
Quoted 6 lines

--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

But this does not appear for v4l-subdev1.

I can't really tell why it doesn't show that. Can you debug a little bit? The code is in v4l2-compliance.cpp, line 1086:

ent_id = mi_media_info_for_fd(media_fd, node.g_fd(), &is_invalid, &node.function);

The mi_media_info_for_fd() function calls ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo), and that fails for some reason. It could be that media_fd is invalid (would be weird).

Quoted 9 lines
Quoted 2 lines

This could well be a v4l2-compliance bug that you hit with this driver.

On the test board, /dev/v4l-subdev1 is imx219, and the corresponding directory is /sys/dev/char/81:3/device. Media0 does not exist in this directory. Therefore, the media_fd obtained through mi_get_media_fd(node.g_fd(), node.bus_info) is invalid.

I don't know why media0 does not exist in /sys/dev/char/81:3/device?

Can you try again with this v4l2-compliance patch?

I need to dig a bit deeper as to why media0 is missing, but for now try this.

Regards,

Hans

utils/v4l2-compliance/v4l2-compliance.cpp +7 -3
index 7169eefe..29475d6b 100644
@@ -968,7 +968,7 @@ err:
 }
 
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count)
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd)
 {
 	struct node node2;
 	struct v4l2_capability vcap = {};
@@ -997,8 +997,12 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
 		memset(&vcap, 0, sizeof(vcap));
 	}
 
-	if (!node.is_media())
-		media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	if (!node.is_media()) {
+		if (parent_media_fd >= 0)
+			media_fd = parent_media_fd;
+		else
+			media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	}
 
 	int fd = node.is_media() ? node.g_fd() : media_fd;
 	if (fd >= 0) {
utils/v4l2-compliance/v4l2-compliance.h +0 -0
index 7caf254b..c47f25f5 100644

utils/v4l2-compliance/v4l2-compliance.h int check_ustring(const __u8 *s, int len); · line 314

Quoted 8 lines
utils/v4l2-compliance/v4l2-compliance.h +1 -1
@@ -308,7 +308,7 @@ int check_ustring(const __u8 *s, int len);
 int check_0(const void *p, int len);
 int restoreFormat(struct node *node);
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count);
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd = -1);
 std::string stream_from(const std::string &pixelformat, bool &use_hdr);
 
 // Media Controller ioctl tests

From the log, there is no change.

test log:
--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

Required ioctls:
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)

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 20 Private Controls: 0

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported) test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK (Not Supported)
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) test VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)

Total for device /dev/v4l-subdev1: 43, Succeeded: 43, Failed: 0, Warnings: 0

Grand Total for starfive-camss device /dev/media0: 201, Succeeded: 201, Failed: 0, Warnings: 0 #

Signature · 3 lines
Regards,

Jack Zhu
#15 lore raw
Quoted 84 lines · Jack Zhu
Quoted 81 lines · Hans Verkuil

Hi Jack,

On 18/10/2023 04:37, Jack Zhu wrote:

<snip>

Quoted 17 lines
Quoted 17 lines
Quoted 6 lines

--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

But this does not appear for v4l-subdev1.

I can't really tell why it doesn't show that. Can you debug a little bit? The code is in v4l2-compliance.cpp, line 1086:

ent_id = mi_media_info_for_fd(media_fd, node.g_fd(), &is_invalid, &node.function);

The mi_media_info_for_fd() function calls ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo), and that fails for some reason. It could be that media_fd is invalid (would be weird).

Quoted 9 lines
Quoted 2 lines

This could well be a v4l2-compliance bug that you hit with this driver.

On the test board, /dev/v4l-subdev1 is imx219, and the corresponding directory is /sys/dev/char/81:3/device. Media0 does not exist in this directory. Therefore, the media_fd obtained through mi_get_media_fd(node.g_fd(), node.bus_info) is invalid.

I don't know why media0 does not exist in /sys/dev/char/81:3/device?

Can you try again with this v4l2-compliance patch?

I need to dig a bit deeper as to why media0 is missing, but for now try this.

Regards,

Hans

utils/v4l2-compliance/v4l2-compliance.cpp +7 -3
index 7169eefe..29475d6b 100644
@@ -968,7 +968,7 @@ err:
 }
 
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count)
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd)
 {
 	struct node node2;
 	struct v4l2_capability vcap = {};
@@ -997,8 +997,12 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
 		memset(&vcap, 0, sizeof(vcap));
 	}
 
-	if (!node.is_media())
-		media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	if (!node.is_media()) {
+		if (parent_media_fd >= 0)
+			media_fd = parent_media_fd;
+		else
+			media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	}
 
 	int fd = node.is_media() ? node.g_fd() : media_fd;
 	if (fd >= 0) {
utils/v4l2-compliance/v4l2-compliance.h +1 -1
index 7caf254b..c47f25f5 100644
@@ -308,7 +308,7 @@ int check_ustring(const __u8 *s, int len);
 int check_0(const void *p, int len);
 int restoreFormat(struct node *node);
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count);
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd = -1);
 std::string stream_from(const std::string &pixelformat, bool &use_hdr);
 
Quoted 4 lines

utils/v4l2-compliance/v4l2-compliance.h int check_ustring(const __u8 *s, int len); · line 314

Quoted 2 lines
utils/v4l2-compliance/v4l2-compliance.h +0 -0
 // Media Controller ioctl tests

From the log, there is no change.

Oops, my mistake. Also apply this change:

utils/v4l2-compliance/v4l2-test-media.cpp +1 -1
index 0195ac58..52ab7fb8 100644
@@ -612,7 +612,7 @@ void walkTopology(struct node &node, struct node &expbuf_node,
 		}
 
 		testNode(test_node, test_node, expbuf_node, type,
-			 frame_count, all_fmt_frame_count);
+			 frame_count, all_fmt_frame_count, node.g_fd());
 		test_node.close();
 	}
 }

Regards,

Hans

author
#16 lore raw
Quoted 98 lines · Hans Verkuil
Quoted 84 lines · Jack Zhu
Quoted 81 lines · Hans Verkuil

Hi Jack,

On 18/10/2023 04:37, Jack Zhu wrote:

<snip>

Quoted 17 lines
Quoted 17 lines
Quoted 6 lines

--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

But this does not appear for v4l-subdev1.

I can't really tell why it doesn't show that. Can you debug a little bit? The code is in v4l2-compliance.cpp, line 1086:

ent_id = mi_media_info_for_fd(media_fd, node.g_fd(), &is_invalid, &node.function);

The mi_media_info_for_fd() function calls ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo), and that fails for some reason. It could be that media_fd is invalid (would be weird).

Quoted 9 lines
Quoted 2 lines

This could well be a v4l2-compliance bug that you hit with this driver.

On the test board, /dev/v4l-subdev1 is imx219, and the corresponding directory is /sys/dev/char/81:3/device. Media0 does not exist in this directory. Therefore, the media_fd obtained through mi_get_media_fd(node.g_fd(), node.bus_info) is invalid.

I don't know why media0 does not exist in /sys/dev/char/81:3/device?

Can you try again with this v4l2-compliance patch?

I need to dig a bit deeper as to why media0 is missing, but for now try this.

Regards,

Hans

utils/v4l2-compliance/v4l2-compliance.cpp +7 -3
index 7169eefe..29475d6b 100644
@@ -968,7 +968,7 @@ err:
 }
 
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count)
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd)
 {
 	struct node node2;
 	struct v4l2_capability vcap = {};
@@ -997,8 +997,12 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
 		memset(&vcap, 0, sizeof(vcap));
 	}
 
-	if (!node.is_media())
-		media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	if (!node.is_media()) {
+		if (parent_media_fd >= 0)
+			media_fd = parent_media_fd;
+		else
+			media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	}
 
 	int fd = node.is_media() ? node.g_fd() : media_fd;
 	if (fd >= 0) {
utils/v4l2-compliance/v4l2-compliance.h +1 -1
index 7caf254b..c47f25f5 100644
@@ -308,7 +308,7 @@ int check_ustring(const __u8 *s, int len);
 int check_0(const void *p, int len);
 int restoreFormat(struct node *node);
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count);
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd = -1);
 std::string stream_from(const std::string &pixelformat, bool &use_hdr);
 
Quoted 4 lines

utils/v4l2-compliance/v4l2-compliance.h int check_ustring(const __u8 *s, int len); · line 314

Quoted 2 lines
utils/v4l2-compliance/v4l2-compliance.h +0 -0
 // Media Controller ioctl tests

From the log, there is no change.

Oops, my mistake. Also apply this change:

utils/v4l2-compliance/v4l2-test-media.cpp +0 -0
index 0195ac58..52ab7fb8 100644

utils/v4l2-compliance/v4l2-test-media.cpp void walkTopology(struct node &node, struct node &expbuf_node, · line 618

Quoted 8 lines
utils/v4l2-compliance/v4l2-test-media.cpp +1 -1
@@ -612,7 +612,7 @@ void walkTopology(struct node &node, struct node &expbuf_node,
 		}
 
 		testNode(test_node, test_node, expbuf_node, type,
-			 frame_count, all_fmt_frame_count);
+			 frame_count, all_fmt_frame_count, node.g_fd());
 		test_node.close();
 	}
 }

Can see relevant Info in the log.

test log:
--------------------------------------------------------------------------------
Compliance test for starfive-camss device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000
Media Driver Info:
	Driver name      : starfive-camss
	Model            : Starfive Camera Subsystem
	Serial           : 
	Bus info         : platform:19840000.camss
	Media version    : 6.6.0
	Hardware revision: 0x00000000 (0)
	Driver version   : 6.6.0
Interface Info:
	ID               : 0x0300001e
	Type             : V4L Sub-Device
Entity Info:
	ID               : 0x00000018 (24)
	Name             : imx219 6-0010
	Function         : Camera Sensor
	Pad 0x01000019   : 0: Source
	  Link 0x0200001a: to remote pad 0x100000f of entity 'cdns_csi2rx.19800000.csi-bridge' (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-subdev1 open: OK
test VIDIOC_SUBDEV_QUERYCAP: OK
test for unlimited opens: OK

Debug ioctls:
test VIDIOC_LOG_STATUS: OK (Not Supported)

Input ioctls:
test VIDIOC_G/S_TUNER/ENUM_FREQ_BANDS: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_S_HW_FREQ_SEEK: OK (Not Supported) test VIDIOC_ENUMAUDIO: OK (Not Supported)
test VIDIOC_G/S/ENUMINPUT: OK (Not Supported) test VIDIOC_G/S_AUDIO: OK (Not Supported)
Inputs: 0 Audio Inputs: 0 Tuners: 0

Output ioctls:
test VIDIOC_G/S_MODULATOR: OK (Not Supported) test VIDIOC_G/S_FREQUENCY: OK (Not Supported) test VIDIOC_ENUMAUDOUT: OK (Not Supported) test VIDIOC_G/S/ENUMOUTPUT: OK (Not Supported) test VIDIOC_G/S_AUDOUT: OK (Not Supported)
Outputs: 0 Audio Outputs: 0 Modulators: 0

Input/Output configuration ioctls:
test VIDIOC_ENUM/G/S/QUERY_STD: OK (Not Supported) test VIDIOC_ENUM/G/S/QUERY_DV_TIMINGS: OK (Not Supported) test VIDIOC_DV_TIMINGS_CAP: OK (Not Supported) test VIDIOC_G/S_EDID: OK (Not Supported)

Sub-Device ioctls (Source Pad 0):
Try Stream 0
test Try VIDIOC_SUBDEV_ENUM_MBUS_CODE/FRAME_SIZE/FRAME_INTERVAL: OK
test Try VIDIOC_SUBDEV_G/S_FMT: OK
warn: ../utils/v4l2-compliance/v4l2-test-subdevs.cpp(541): 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: ../utils/v4l2-compliance/v4l2-test-subdevs.cpp(541): 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 VIDIOC_SUBDEV_G/S_FRAME_INTERVAL: OK (Not Supported)

Control ioctls:
test VIDIOC_QUERY_EXT_CTRL/QUERYMENU: OK test VIDIOC_QUERYCTRL: OK
test VIDIOC_G/S_CTRL: OK
test VIDIOC_G/S/TRY_EXT_CTRLS: OK test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: OK test VIDIOC_G/S_JPEGCOMP: OK (Not Supported) Standard Controls: 20 Private Controls: 0

Format ioctls:
test VIDIOC_ENUM_FMT/FRAMESIZES/FRAMEINTERVALS: OK (Not Supported) test VIDIOC_G/S_PARM: OK (Not Supported)
test VIDIOC_G_FBUF: OK (Not Supported)
test VIDIOC_G_FMT: OK (Not Supported)
test VIDIOC_TRY_FMT: OK (Not Supported)
test VIDIOC_S_FMT: OK (Not Supported)
test VIDIOC_G_SLICED_VBI_CAP: OK (Not Supported)
test Cropping: OK (Not Supported)
test Composing: OK (Not Supported)
test Scaling: OK (Not Supported)

Codec ioctls:
test VIDIOC_(TRY_)ENCODER_CMD: OK (Not Supported) test VIDIOC_G_ENC_INDEX: OK (Not Supported) test VIDIOC_(TRY_)DECODER_CMD: OK (Not Supported)

Buffer ioctls:
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: OK (Not Supported) test VIDIOC_EXPBUF: OK (Not Supported)
test Requests: OK (Not Supported)

Total for starfive-camss device /dev/v4l-subdev1: 51, Succeeded: 51, Failed: 0, Warnings: 2

Grand Total for starfive-camss device /dev/media0: 209, Succeeded: 209, Failed: 0, Warnings: 2 #

Signature · 3 lines
Regards,

Jack Zhu
#17 lore raw
Quoted 102 lines · Jack Zhu
Quoted 99 lines · Hans Verkuil
Quoted 84 lines · Jack Zhu
Quoted 81 lines · Hans Verkuil

Hi Jack,

On 18/10/2023 04:37, Jack Zhu wrote:

<snip>

Quoted 17 lines
Quoted 17 lines
Quoted 6 lines

--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

But this does not appear for v4l-subdev1.

I can't really tell why it doesn't show that. Can you debug a little bit? The code is in v4l2-compliance.cpp, line 1086:

ent_id = mi_media_info_for_fd(media_fd, node.g_fd(), &is_invalid, &node.function);

The mi_media_info_for_fd() function calls ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo), and that fails for some reason. It could be that media_fd is invalid (would be weird).

Quoted 9 lines
Quoted 2 lines

This could well be a v4l2-compliance bug that you hit with this driver.

On the test board, /dev/v4l-subdev1 is imx219, and the corresponding directory is /sys/dev/char/81:3/device. Media0 does not exist in this directory. Therefore, the media_fd obtained through mi_get_media_fd(node.g_fd(), node.bus_info) is invalid.

I don't know why media0 does not exist in /sys/dev/char/81:3/device?

Can you try again with this v4l2-compliance patch?

I need to dig a bit deeper as to why media0 is missing, but for now try this.

Regards,

Hans

utils/v4l2-compliance/v4l2-compliance.cpp +7 -3
index 7169eefe..29475d6b 100644
@@ -968,7 +968,7 @@ err:
 }
 
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count)
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd)
 {
 	struct node node2;
 	struct v4l2_capability vcap = {};
@@ -997,8 +997,12 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
 		memset(&vcap, 0, sizeof(vcap));
 	}
 
-	if (!node.is_media())
-		media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	if (!node.is_media()) {
+		if (parent_media_fd >= 0)
+			media_fd = parent_media_fd;
+		else
+			media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	}
 
 	int fd = node.is_media() ? node.g_fd() : media_fd;
 	if (fd >= 0) {
utils/v4l2-compliance/v4l2-compliance.h +1 -1
index 7caf254b..c47f25f5 100644
@@ -308,7 +308,7 @@ int check_ustring(const __u8 *s, int len);
 int check_0(const void *p, int len);
 int restoreFormat(struct node *node);
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count);
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd = -1);
 std::string stream_from(const std::string &pixelformat, bool &use_hdr);
 
Quoted 4 lines

utils/v4l2-compliance/v4l2-compliance.h int check_ustring(const __u8 *s, int len); · line 314

Quoted 2 lines
utils/v4l2-compliance/v4l2-compliance.h +0 -0
 // Media Controller ioctl tests

From the log, there is no change.

Oops, my mistake. Also apply this change:

utils/v4l2-compliance/v4l2-test-media.cpp +0 -0
index 0195ac58..52ab7fb8 100644
@@ -612,7 +612,7 @@ void walkTopology(struct node &node, struct node &expbuf_node,
 		}
 
Quoted 9 lines

utils/v4l2-compliance/v4l2-test-media.cpp void walkTopology(struct node &node, struct node &expbuf_node, · line 618

Quoted 7 lines
utils/v4l2-compliance/v4l2-test-media.cpp +1 -1
 		testNode(test_node, test_node, expbuf_node, type,
-			 frame_count, all_fmt_frame_count);
+			 frame_count, all_fmt_frame_count, node.g_fd());
 		test_node.close();
 	}
 }

Can see relevant Info in the log.

Great! Can you do one more thing? Please run 'v4l2-compliance -m /dev/media0 --verbose' and mail the output to me. It's pretty big, so just email it to me, without CCs.

I want to take a closer look at the output to see why this patch is needed.

Regards,

Hans

#18 lore raw
Quoted 113 lines · Hans Verkuil
Quoted 102 lines · Jack Zhu
Quoted 99 lines · Hans Verkuil
Quoted 84 lines · Jack Zhu
Quoted 81 lines · Hans Verkuil

Hi Jack,

On 18/10/2023 04:37, Jack Zhu wrote:

<snip>

Quoted 17 lines
Quoted 17 lines
Quoted 6 lines

--------------------------------------------------------------------------------
Compliance test for device /dev/v4l-subdev1:

Driver Info:

	Driver version   : 6.6.0
	Capabilities     : 0x00000000

But this does not appear for v4l-subdev1.

I can't really tell why it doesn't show that. Can you debug a little bit? The code is in v4l2-compliance.cpp, line 1086:

ent_id = mi_media_info_for_fd(media_fd, node.g_fd(), &is_invalid, &node.function);

The mi_media_info_for_fd() function calls ioctl(media_fd, MEDIA_IOC_DEVICE_INFO, &mdinfo), and that fails for some reason. It could be that media_fd is invalid (would be weird).

Quoted 9 lines
Quoted 2 lines

This could well be a v4l2-compliance bug that you hit with this driver.

On the test board, /dev/v4l-subdev1 is imx219, and the corresponding directory is /sys/dev/char/81:3/device. Media0 does not exist in this directory. Therefore, the media_fd obtained through mi_get_media_fd(node.g_fd(), node.bus_info) is invalid.

I don't know why media0 does not exist in /sys/dev/char/81:3/device?

Can you try again with this v4l2-compliance patch?

I need to dig a bit deeper as to why media0 is missing, but for now try this.

Regards,

Hans

utils/v4l2-compliance/v4l2-compliance.cpp +7 -3
index 7169eefe..29475d6b 100644
@@ -968,7 +968,7 @@ err:
 }
 
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count)
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd)
 {
 	struct node node2;
 	struct v4l2_capability vcap = {};
@@ -997,8 +997,12 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
 		memset(&vcap, 0, sizeof(vcap));
 	}
 
-	if (!node.is_media())
-		media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	if (!node.is_media()) {
+		if (parent_media_fd >= 0)
+			media_fd = parent_media_fd;
+		else
+			media_fd = mi_get_media_fd(node.g_fd(), node.bus_info);
+	}
 
 	int fd = node.is_media() ? node.g_fd() : media_fd;
 	if (fd >= 0) {
utils/v4l2-compliance/v4l2-compliance.h +1 -1
index 7caf254b..c47f25f5 100644
@@ -308,7 +308,7 @@ int check_ustring(const __u8 *s, int len);
 int check_0(const void *p, int len);
 int restoreFormat(struct node *node);
 void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_node, media_type type,
-	      unsigned frame_count, unsigned all_fmt_frame_count);
+	      unsigned frame_count, unsigned all_fmt_frame_count, int parent_media_fd = -1);
 std::string stream_from(const std::string &pixelformat, bool &use_hdr);
 
Quoted 4 lines

utils/v4l2-compliance/v4l2-compliance.h int check_ustring(const __u8 *s, int len); · line 314

Quoted 2 lines
utils/v4l2-compliance/v4l2-compliance.h +0 -0
 // Media Controller ioctl tests

From the log, there is no change.

Oops, my mistake. Also apply this change:

utils/v4l2-compliance/v4l2-test-media.cpp +0 -0
index 0195ac58..52ab7fb8 100644
@@ -612,7 +612,7 @@ void walkTopology(struct node &node, struct node &expbuf_node,
 		}
 
Quoted 9 lines

utils/v4l2-compliance/v4l2-test-media.cpp void walkTopology(struct node &node, struct node &expbuf_node, · line 618

Quoted 7 lines
utils/v4l2-compliance/v4l2-test-media.cpp +1 -1
 		testNode(test_node, test_node, expbuf_node, type,
-			 frame_count, all_fmt_frame_count);
+			 frame_count, all_fmt_frame_count, node.g_fd());
 		test_node.close();
 	}
 }

Can see relevant Info in the log.

Quoted 4 lines

Great! Can you do one more thing? Please run 'v4l2-compliance -m /dev/media0 --verbose' and mail the output to me. It's pretty big, so just email it to me, without CCs.

I want to take a closer look at the output to see why this patch is needed.

Thank you for your help. This v4l2-compliance patch is in fact needed, and I have just pushed the fix.

Regards,

Hans

author
#19 lore raw
In reply to Hans Verkuil
Quoted 8 lines · Hans Verkuil

Hi Jack,

Quoted 5 lines · Jack Zhu

Hi,

This series is the v10 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

Quoted 8 lines
Quoted 3 lines

This series is based on top of the master branch of media_stage repository, which is tested with a v4l2-compliance compiled from the git repo
(git://linuxtv.org/v4l-utils.git).

I get one smatch warning:

drivers/staging/media/starfive/camss/stf-isp.c:122 isp_enum_mbus_code() warn: unsigned 'code->index' is never less than zero.

Could you please tell me the code check command? This way I can use it to check my next commit.

Quoted 3 lines

And I also notice that there is no TODO file: staging drivers should have a TODO file explaining what needs to be done to get them out of staging.

OK, I'll add it to my next commit. I previously misunderstood that it was submitted when moving out of staging.

Quoted 5 lines

I'm curious to know that as well :-)

It looks like there is a lot of additional development that can be done, since most of the ISP parameters appear to be hardcoded.

Part is the module initialization configuration. In the next stage, we will use incremental development to implement 3A functions.

Signature · 3 lines
Regards,

Jack Zhu
#20 lore raw
Quoted 15 lines · Jack Zhu
Quoted 12 lines · Hans Verkuil

Hi Jack,

Quoted 8 lines · Jack Zhu

Hi,

This series is the v10 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

This series is based on top of the master branch of media_stage repository, which is tested with a v4l2-compliance compiled from the git repo
(git://linuxtv.org/v4l-utils.git).

Quoted 7 lines
Quoted 4 lines

I get one smatch warning:

drivers/staging/media/starfive/camss/stf-isp.c:122 isp_enum_mbus_code() warn: unsigned 'code->index' is never less than zero.

Could you please tell me the code check command? This way I can use it to check my next commit.

See https://repo.or.cz/smatch.git/blob/HEAD:/Documentation/smatch.txt

FYI: you can use the same build scripts that I use to verify patches. It is described here:

https://lore.kernel.org/linux-media/[email protected]/

See the README for detailed instructions.

Regards,

Hans

Quoted 17 lines
Quoted 4 lines

And I also notice that there is no TODO file: staging drivers should have a TODO file explaining what needs to be done to get them out of staging.

OK, I'll add it to my next commit. I previously misunderstood that it was submitted when moving out of staging.

Quoted 5 lines

I'm curious to know that as well :-)

It looks like there is a lot of additional development that can be done, since most of the ISP parameters appear to be hardcoded.

Part is the module initialization configuration. In the next stage, we will use incremental development to implement 3A functions.

#21 lore raw
In reply to Jack Zhu
Quoted 24 lines · Jack Zhu
Quoted 6 lines · Hans Verkuil
Quoted 5 lines · Jack Zhu

Hi,

This series is the v10 series that attempts to support the Camera Subsystem found on StarFive JH7110 SoC.

Quoted 7 lines
Quoted 3 lines

This series is based on top of the master branch of media_stage repository, which is tested with a v4l2-compliance compiled from the git repo
(git://linuxtv.org/v4l-utils.git).

I get one smatch warning:

drivers/staging/media/starfive/camss/stf-isp.c:122 isp_enum_mbus_code() warn: unsigned 'code->index' is never less than zero.

Could you please tell me the code check command? This way I can use it to check my next commit.

Quoted 2 lines

And I also notice that there is no TODO file: staging drivers should have a TODO file explaining what needs to be done to get them out of staging.

OK, I'll add it to my next commit. I previously misunderstood that it was submitted when moving out of staging.

Quoted 7 lines
Quoted 4 lines

I'm curious to know that as well :-)

It looks like there is a lot of additional development that can be done, since most of the ISP parameters appear to be hardcoded.

Part is the module initialization configuration. In the next stage, we will use incremental development to implement 3A functions.

I'm really looking forward to that part :-)

Signature · 3 lines
Regards,

Laurent Pinchart