Skip to content

Draft: Use mainline camera drivers

Fixes #289 (closed) Fixes

this switches our whole camera driver stack to use as much mainline drivers as possible.

this MR will be part of all pureos/5.15* releases automatically too

how to test:

selfie cam


media-ctl -d "platform:30a90000.csi" --set-v4l2 "'csi':0 [fmt:SGBRG10/${WIDTH}x${HEIGHT} colorspace:raw]"
media-ctl -d "platform:30a90000.csi" --set-v4l2 "'imx8mq-mipi-csi2 30a70000.csi':0 [fmt:SGBRG10/${WIDTH}x${HEIGHT} colorspace:raw]"
media-ctl -d "platform:30a90000.csi" --set-v4l2 "'hi846 2-0020':0 [fmt:SGBRG10/${WIDTH}x${HEIGHT} colorspace:raw]"
media-ctl -d "platform:30a90000.csi" -l "'hi846 2-0020':0 -> 'imx8mq-mipi-csi2 30a70000.csi':0 [1]"
v4l2-ctl -d "/dev/v4l/by-path/platform-30a90000.csi-video-index0" --set-fmt-video=width=${WIDTH},height=${HEIGHT},pixelformat=GB16 --stream-mmap --stream-to=$WIDTH.raw --stream-skip=$SKIP --stream-count=1

rear cam


media-ctl -d "platform:30b80000.csi" --set-v4l2 "'csi':0 [fmt:SGRBG8/${WIDTH}x${HEIGHT} colorspace:raw]"
media-ctl -d "platform:30b80000.csi" --set-v4l2 "'imx8mq-mipi-csi2 30b60000.csi':0 [fmt:SGRBG8/${WIDTH}x${HEIGHT} colorspace:raw]"
media-ctl -d "platform:30b80000.csi" --set-v4l2 "'s5k3l6xx 3-002d':0 [fmt:SGRBG8/${WIDTH}x${HEIGHT} colorspace:raw]"
media-ctl -d "platform:30b80000.csi" -l "'s5k3l6xx 3-002d':0 -> 'imx8mq-mipi-csi2 30b60000.csi':0 [1]"
v4l2-ctl -d "/dev/v4l/by-path/platform-30b80000.csi-video-index0" --set-fmt-video=width=${WIDTH},height=${HEIGHT},pixelformat=GRBG --stream-mmap --stream-to=$WIDTH.raw --stream-skip=$SKIP --stream-count=1

for the devkit (this MR configures a different sensor driver for it) I haven't tested much, but this can be a starting point:


media-ctl -d "platform:30a90000.csi" --set-v4l2 "'csi':0 [fmt:UYVY8_2X8/${WIDTH}x${HEIGHT} colorspace:srgb]"
media-ctl -d "platform:30a90000.csi" --set-v4l2 "'imx8mq-mipi-csi2 30a70000.csi':0 [fmt:UYVY8_2X8/${WIDTH}x${HEIGHT} colorspace:srgb]"
media-ctl -d "platform:30a90000.csi" --set-v4l2 "'ov5640 2-003c':0 [fmt:UYVY8_2X8/${WIDTH}x${HEIGHT} colorspace:srgb]"
# setup by drivers
#media-ctl -d "platform:30a90000.csi" -l "'hi846 2-0020':0 -> 'imx8mq-mipi-csi2 30a70000.csi':0 [1]"
v4l2-ctl -d "/dev/v4l/by-path/platform-30a90000.csi-video-index0" --set-fmt-video=width=${WIDTH},height=${HEIGHT},pixelformat=UYVY --stream-mmap --stream-to=$WIDTH.raw --stream-skip=$SKIP --stream-count=1
  • doesn't start streaming yet and before and after it's stopped, it shows:
[  505.078647] v4l2_get_link_freq: Link frequency estimated using pixel rate: result might be inaccurate
[  505.078664] v4l2_get_link_freq: Consider implementing support for V4L2_CID_LINK_FREQ in the transmitter driver
[  505.078673] imx8mq-mipi-csi2 30a70000.csi: esc clk rate: 66666667
[  505.078686] imx8mq-mipi-csi2 30a70000.csi: lane rate 491443200 Ths_settle 128 hs_settle 8

for the devkit camera, we have

we want to have a patch for megapixels so that it works with these drivers, see and this MR should help developing that. (A megapixels .ini file that only includes the seflie cam would be OK for first tests).

but for merging this, we need

  • a working (streaming) big-cam with this (and the currect old CSI stack too) -> almost there.
  • know how controls are used and a working megapixels patchset that works with this
  • a working devkit cam with the new drivers(nice to have at least) or create an issue for that
Edited by Martin Kepplinger

Merge request reports