You are not logged in.

#1 2022-10-18 17:44:58

acegallagher
Member
Registered: 2016-07-29
Posts: 12

Intel IPU6/MIPI camera functionality

There is currently a very popular forum post about getting the Intel IPU6 camera working in a Dell XPS 13 but it's specific to that hardware and I don't want to derail the  discussion there.

I recently purchased a new X1 Nano Gen2 with an OV2740 sensor and Intel's Alder Lake IPU chip. Arch works extremely well on the hardware, nearly perfectly, except the webcam. Which is currently a poorly documented mess of projects. There are many PKGBUILDS available in the AUR to try to solve this but they aren't up to date, and you can find better PKGBUILDs  at the end of the Dell thread posted by a user there some few days ago. I'm starting this thread to discuss more broadly since I've built the Intel packages and I'm still unable to load the modules. Currently, if you would like to attempt getting a Tiger/Alder Lake MIPI/IPU6 camera working in Arch you need to  take the following steps:

1) install intel-ivsc-firmware from the AUR
2) install intel-ipu6(ep)-camera-bin from the AUR
3) build/install "intel-ipu6-dkms-git" PKGBUILD from the Dell thread.  (ivsc-driver has been merged with the IPU6 driver and will conflict)
4) build/install "intel-ipu6(ep)-camera-hal" from thread^^^. Although I manually copied the UDEV rules as they're necessary.
5) build/install "v4l2-looback" kernel module and userspace tools, patched v4l2-looback, available in above thread
6) Run some magic-sauce version of:

 sudo -E gst-launch-1.0 icamerasrc buffer-count=7 ! video/x-raw,format=YUY2,width=1280,height=720 ! v4l2sink device=/dev/video1 

If you would like to have this provided via the /dev/video* API then you also need to install v4l2-relayd and enable the service.

There is something weird with the icamerasrc package. Sometimes it needs to be rebuilt, sometimes when rebuilding it doesn't pick up the HAL libraries from the hal package. Sometimes if you reboot v4l2 can no longer pick up the library. It's a hot mess.

If we come to a reasonable practice here, I'll synthesize the information and create an Arch wiki page. Hopefully organizing bleeding edge users in this way will make getting these cameras functional a little more rapid. According to this saucy exchange with Intel hardware engineers and Greg KH on LKML  Intel plans to clean up the open source packaging by the end of the year. Based on current progress and historical data, I don't believe them.

This will be my first and last foray into buying new hardware. Currently on the Nano Gen2, modprobe intel-ipu6-isys hangs after modprobe intel-ipu6. modprobe ov2740 works but the full suite of modules necessary from ipu6-dkms for this hardware won't load on kernels 6.0.1/5.19.13/5.15.72. I'm working on a bug report for the git repo. Tangent: does anyone know how to find the correct "device-name" for the gstreamer command to open the camera stream? For the Dell hardware it's "device-name=ov01a10-uf".

BTW, this very detailed and clearly written LWN article summarizes the situation quite nicely

Last edited by acegallagher (2022-10-19 21:44:47)

Offline

#2 2022-10-19 15:46:52

acegallagher
Member
Registered: 2016-07-29
Posts: 12

Re: Intel IPU6/MIPI camera functionality

With the DKMS version of the ipu6 drivers, the kernel patches that enable certain interops are not applied and therefore the DKMS version isn't suitable for any hardware that needs those. I've created an AUR package that applies these patches, inserts the IPU6 driver code for the modules, and builds the kernel. This package is based on the linux-ck package to save some time and because the build process for linux-ck is fairly simple and streamlined.

Anyone interested in building the kernel and trying it out for their webcam, this package is available here:

https://gitlab.com/ace.gallagher/linux-ck-ipu6


Don't use this, I never finished it because it just makes more sense to patch the kernel and then build the DKMS modules.

Last edited by acegallagher (2022-10-26 23:30:58)

Offline

#3 2022-10-26 22:57:03

bjesus
Member
Registered: 2007-04-06
Posts: 49

Re: Intel IPU6/MIPI camera functionality

Hey @acegallagher - thanks for putting the above together. I'm trying out your kernel but can you please elaborate on what more is needed except the kernel? Do I still need  icamerasrc? and the patched v4l2-loopback dkms module? or is it all included in the kernel? I'm quite confused about what parts of this setup are userland and what aren't... I'm on an X1 Yoga, so hopefully it's similar to the Nano.

Again, thank you very much!

Offline

#4 2022-10-26 23:29:25

acegallagher
Member
Registered: 2016-07-29
Posts: 12

Re: Intel IPU6/MIPI camera functionality

@bjesus...

See these two github issues that are specifically about your camera and sensor that are seeing the same behavior. The first one is mine but the second one is particularly useful.

https://github.com/intel/ipu6-drivers/issues/55
https://github.com/intel/ipu6-drivers/issues/48

Right now the method forward seems to be a self-compiled kernel with the ipu6-drivers patches and then compiling the DKMS modules/drivers using the bug fixes from the developer in those threads. Even then though, no one has the ov2740 working that I've seen. For the self compiled kernel, I modified the PKGBUILD from the linux-ck AUR package to git pull the patches from intel-ipu6 just because it seemed easy.

You need the following packages that can be grabbed straight from the AUR:

 icamerasrc-git  intel-ipu6ep-camera-hal-git  ipu6ep-camera-bin ivsc-firmware

And then the following package builds must be compiled with branches (the two driver ones are modified by me, the other is from the Dell thread):

intel-ivsc-driver-dkms-git (as patched by jwrdegoede)

# Maintainer: Karim Vergnes <me@thesola.io>

pkgname=intel-ivsc-driver-dkms-git
_pkgname=ivsc-driver
pkgver=r31.c5aa0b6
pkgrel=1
pkgdesc="Intel Vision Sensing Controller driver (DKMS)"
arch=('any')
url="https://github.com/jwrdegoede/ivsc-driver/"
license=('unknown')
depends=('dkms' 'intel-ivsc-firmware')
makedepends=('git')
source=("git+${url}")
sha256sums=('SKIP')

pkgver() {
    cd $_pkgname
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    cd "$srcdir/$_pkgname"
    git checkout -b ivsc-usb-and-probe-order-fix 
    sed -i "s/^PACKAGE_VERSION=\".*\"$/PACKAGE_VERSION=\"$pkgver\"/g" ./dkms.conf
}

package() {
    cd "$srcdir"

    install -dm755 "$pkgdir/usr/src"
    cp -rT "$_pkgname" "$pkgdir/usr/src/$_pkgname-$pkgver"
}

intel-ipu6-dkms-git (as patched by jwrdegoede)

pkgname=intel-ipu6-dkms-git
_pkgname=ipu6-drivers
pkgver=r67.9bb33df
pkgrel=1
pkgdesc="Intel IPU6 camera drivers (DKMS)"
arch=('any')
url="https://github.com/jwrdegoede/ipu6-drivers"
license=('unknown')
depends=('dkms')
makedepends=('git')
source=("git+${url}.git")
sha256sums=('SKIP')

pkgver() {
    cd $_pkgname
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    cd "$srcdir/$_pkgname"
    git checkout -b ipu6-ordering-fixes
    git clone https://github.com/jwrdegoede/ivsc-driver.git
    `cd ivsc-driver; git checkout -b ivsc-usb-and-probe-order-fix`
    cp -r ivsc-driver/backport-include ivsc-driver/drivers ivsc-driver/include .
    sed -i "s/^PACKAGE_VERSION=\".*\"$/PACKAGE_VERSION=\"$pkgver\"/g" ./dkms.conf
}

package() {
    cd "$srcdir"
    install -dm755 "$pkgdir/usr/src"
    cp -rT "$_pkgname" "$pkgdir/usr/src/$_pkgname-$pkgver"
}

v4l2-loopback from Dell thread user

_pkgbase=v4l2loopback
pkgname=${_pkgbase}-dkms-git
pkgver=r10.b37d72d
pkgrel=1
pkgdesc="v4l2-loopback device"
url="https://github.com/umlaeute/v4l2loopback"
arch=('any')
license=('GPL2')
depends=('dkms')
makedepends=('git' 'help2man')
conflicts=("${_pkgbase}-dkms")
provides=("${_pkgbase}-dkms")
source=("git://git.launchpad.net/ubuntu/+source/v4l2loopback#branch=ubuntu/devel")
md5sums=('SKIP')

pkgver() {
    cd "$srcdir/${_pkgbase}"
    (
        set -o pipefail
        printf "r%s.%s" "10" "$(git rev-parse --short HEAD)"
    )
}

prepare() {
    cd "${srcdir}/${_pkgbase}"
    for patch in debian/patches/*.patch; do
        patch -p1 -i "$patch"
    done;
}

package() {
    cd "${srcdir}/${_pkgbase}"
    mkdir -p "${pkgdir}/usr/share/licenses/${_pkgbase}"
    cp -vf COPYING "${pkgdir}/usr/share/licenses/${_pkgbase}"
    make DESTDIR="${pkgdir}" PREFIX="/usr" install-utils install-man
    mkdir -p "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
    cp -ar * "${pkgdir}/usr/src/${_pkgbase}-${pkgver}"
}

I'm always happy to help other people to poke at this stuff, Intel should know this is obnoxious.  FYI I'm having all sorts of issues with icamerasrc like the one in the AUR comment. When I reboot, certain libraries just disappear... which seems insane, but I haven't had time to troubleshoot.

Last edited by acegallagher (2022-10-26 23:32:56)

Offline

#5 2022-10-27 23:45:44

bjesus
Member
Registered: 2007-04-06
Posts: 49

Re: Intel IPU6/MIPI camera functionality

I can't seem to get the kernel package to compile...

ERROR: modpost: "vsc_acquire_camera_sensor" [drivers/media/i2c/hi556.ko] undefined!
ERROR: modpost: "vsc_release_camera_sensor" [drivers/media/i2c/hi556.ko] undefined!
make[1]: *** [scripts/Makefile.modpost:128: modules-only.symvers] Error 1

does it work for you?

Offline

#6 2022-10-27 23:57:41

acegallagher
Member
Registered: 2016-07-29
Posts: 12

Re: Intel IPU6/MIPI camera functionality

@bjesus.. my package? Don't use that. I did manage to get the camera working just an hour ago and I'll make a full write up sometime. For now, if you want to check the two github issues enough information should be there.

Offline

Board footer

Powered by FluxBB