Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • L linux
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 128
    • Issues 128
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 23
    • Merge requests 23
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Librem5
  • linux
  • Merge requests
  • !430

Closed
Created Aug 02, 2021 by Martin Kepplinger@martin.kepplingerOwner
  • Report abuse
Report abuse

Draft: Use mainline camera drivers

  • Overview 11
  • Commits 18
  • Pipelines 17
  • Changes 26

Fixes #289 (closed) Fixes https://source.puri.sm/Librem5/linux-next/-/issues/339

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

#!/bin/bash
WIDTH=1632
HEIGHT=1224
SKIP=10

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
./debayer10.py $WIDTH.raw $WIDTH $HEIGHT $WIDTH.png

rear cam

#!/bin/bash
WIDTH=1052
HEIGHT=780
SKIP=10

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:

#!/bin/bash
WIDTH=640
HEIGHT=480
SKIP=10

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 https://source.puri.sm/Librem5/linux-next/-/issues/35

we want to have a patch for megapixels so that it works with these drivers, see https://source.puri.sm/Librem5/megapixels/-/issues/13 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 Oct 27, 2021 by Martin Kepplinger
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: imx7_updates_20210802_mr