Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • 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 140
    • Issues 140
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 24
    • Merge requests 24
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • 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
  • !418

Draft: use upstream camera drivers

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Martin Kepplinger requested to merge martin.kepplinger/linux-next:imx7_updates_20210615_mr into pureos/byzantium Jun 16, 2021
  • Overview 3
  • Commits 402
  • Pipelines 7
  • Changes 194

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

the mipi driver is WIP but currently being publically reviewed for upstream. please test it, see below.

the devkit is completely untested and most likely doesn't yet work with this. I'll look at it later.

how to test on the L5:

by now the kernel creates 3+ /dev/media devices, so first of all you probably want to decide which of the 2 sensors you want to test this stack with and find out which /dev/media device it got assigned. that number can always change after rebooting.

#!/bin/bash
echo "media dev 0"
media-ctl -p -d 0 | grep -C 1 -i sensor
echo "media dev 1"
media-ctl -p -d 1 | grep -C 1 -i sensor
echo "media dev 2"
media-ctl -p -d 2 | grep -C 1 -i sensor

with that number: DEV(0..2) you can use a script like this to set formats and stream frames from the selfie cam:

#!/bin/bash
DEV=$1
WIDTH=$2
HEIGHT=$3
SKIP=$4

media-ctl -d $DEV --set-v4l2 "'csi':0 [fmt:SGBRG10/${WIDTH}x${HEIGHT} colorspace:raw]"
media-ctl -d $DEV --set-v4l2 "'imx8mq-mipi-csi2 30a70000.csi':0 [fmt:SGBRG10/${WIDTH}x${HEIGHT} colorspace:raw]"
media-ctl -d $DEV --set-v4l2 "'hi846 2-0020':0 [fmt:SGBRG10/${WIDTH}x${HEIGHT} colorspace:raw]"
media-ctl -d $DEV -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

for the big cam try the following with 4208x3120:

#!/bin/bash
DEV=$1
WIDTH=$2
HEIGHT=$3
SKIP=$4

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

but for the big cam we still have a pixelformat issue I'll look into soon:

imx7-csi 30a90000.csi: capture format not valid

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 first)
  • 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)
Edited Jul 14, 2021 by Martin Kepplinger
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: imx7_updates_20210615_mr