You are not logged in.

#1 2020-02-20 12:35:29

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 701
Website

Linux Kernel with AMD Sensor Fusion Hub (SFH) driver

I uploaded a modified version of the stable kernel package with added experimental drivers for the AMD Sensor Fusion Hub (SFH) to the AUR.
Currently, on my convertible (HP ENVY x360 13-ag0005ng), it does not yet detect any sensors. However, the kernel patches are still under development by AMD and have not yet been merged into the mainline kernel.
Hence the AUR package for anybody interested in testing the new drivers.

Update 2020-02-27
Package has been updated to Linux 5.5.6-arch1 with 4th revision of AMD's patch.

Update 2020-03-03
Package has been updated to Linux 5.5.7-arch1.

Update 2020-03-25
I wrote a patch to make the new drivers work on HP ENVY x360 13-ag000x series convertibles.
You can manually add it to the PKGBUILD, if necessary.
A patch to enable all sensors iff none are marked as enabled is now included per default.

Last edited by schard (2020-03-27 12:15:09)

Offline

#2 2020-02-28 08:10:55

Cloud_Ninja
Member
Registered: 2019-03-09
Posts: 10

Re: Linux Kernel with AMD Sensor Fusion Hub (SFH) driver

Having used the patched kernel package, also on an HP ENVY x360 13m-ag0xxx, i can also confirm it not working. Not sure if i'm doing something wrong, but i can't figure out how to get sensor info from it.

Offline

#3 2020-03-14 10:15:22

levat
Member
From: Novi Travnik , BA
Registered: 2013-11-28
Posts: 8
Website

Re: Linux Kernel with AMD Sensor Fusion Hub (SFH) driver

For the first time I have some anwers from sensor but its not working and i get this message from monitor-sensor.

[peni@PeniLap ~]$ monitor-sensor
    Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: undefined)
=== No ambient light sensor

Offline

#4 2020-03-24 10:14:57

levat
Member
From: Novi Travnik , BA
Registered: 2013-11-28
Posts: 8
Website

Re: Linux Kernel with AMD Sensor Fusion Hub (SFH) driver

Its working now.

Using linux-sfh from aur and adding amd_iommu=off to kernel line got rotation working.

HP Envy 13-ar000nn / Ryzen 5 3500u.

Offline

#5 2020-03-24 12:22:22

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 701
Website

Re: Linux Kernel with AMD Sensor Fusion Hub (SFH) driver

@levat
Glad to hear that.
If you find the time, I would be very thankful, if you could provide the output of

cat /proc/cmdline

and

dmesg

in this thread: https://bbs.archlinux.org/viewtopic.php?id=252815

It may help me and others narrow down, why it's not yet working for us.
Thank you.

Offline

#6 2020-03-24 13:09:56

levat
Member
From: Novi Travnik , BA
Registered: 2013-11-28
Posts: 8
Website

Re: Linux Kernel with AMD Sensor Fusion Hub (SFH) driver

schard wrote:

@levat
Glad to hear that.
If you find the time, I would be very thankful, if you could provide the output of

cat /proc/cmdline

and

dmesg

in this thread: https://bbs.archlinux.org/viewtopic.php?id=252815

It may help me and others narrow down, why it's not yet working for us.
Thank you.

Did as you asked.

Offline

#7 2020-03-27 12:15:18

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 701
Website

Re: Linux Kernel with AMD Sensor Fusion Hub (SFH) driver

Update 2020-03-27 linux-sfh-5.5.13.arch1-2
I updated the custom patch to use a kernel parameter to forcibly enable all HID devices rather than force-enabling them if none are marked active.
If you previously did not get any HID devices with the vanilla patch, but with the custom patch enabled, create the file /etc/modprobe.d/amd-sfh.conf with the following content:

options amd_mp2_pcie assume_all_active=1

Update 2020-03-27 linux-sfh-5.5.13.arch1-3
I updated the kernel parameters:

parm:           activestatus_override:Override the activestatus value reported by PCI device. (int)
parm:           force_accel:Force enabling of accelerometer. (bool)
parm:           force_gyro:Force enabling of gyroscope. (bool)
parm:           force_magno:Force enabling of magnetometer. (bool)
parm:           force_als:Force enabling of ambient light sensor. (bool)

So you may need to replace

options amd_mp2_pcie assume_all_active=1

with

options amd_mp2_pcie force_accel=1

Last edited by schard (2020-03-27 14:45:40)

Offline

#8 2020-03-27 13:28:12

progandy
Member
Registered: 2012-05-17
Posts: 3,722

Re: Linux Kernel with AMD Sensor Fusion Hub (SFH) driver

For those who hesitate to compile the complete kernel, it might be possible to compile only the new module for the currently running kernel like this. This is only possible because the patches contain the complete code of the amd-sfh-hid modules.

$ mkcd /tmp/sfh
$ curl -o v4-2-4.patch https://patchwork.kernel.org/patch/11407747/raw/
$ curl -o v4-3-4.patch https://patchwork.kernel.org/patch/11407749/raw/
$ curl -o v4-4-4.patch https://patchwork.kernel.org/patch/11407753/raw/
$ curl -o sfh-fix.patch "https://gist.githubusercontent.com/conqp/e8a0793406fbe7c9714f01f3078ea33a/raw/0f11de9caa936428921e887b6ff3cba1e22ca499/amd-sfh.patch"
$ git apply --exclude drivers/hid/Kconfig --exclude drivers/hid/Makefile v4-2-4.patch v4-3-4.patch v4-4-4.patch sfh-fix.patch
$ cd drivers/hid/amd-sfh-hid
$ ln -sf ../amd_mp2_pcie.h hid_descriptor/
$ make -C /lib/modules/`uname -r`/build M=$PWD CONFIG_AMD_SFH_HID=m
$ sudo make -C /lib/modules/`uname -r`/build M=$PWD CONFIG_AMD_SFH_HID=m INSTALL_MOD_DIR=extramodules modules_install

| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#9 2020-03-27 14:47:22

schard
Member
From: Hannover
Registered: 2016-05-06
Posts: 701
Website

Re: Linux Kernel with AMD Sensor Fusion Hub (SFH) driver

@progandy
Thanks for the hint. Based on it, I just attempted to create a dkms package to replace the kernel package.
But the shipped Makefile does not support dkms now and writing my own seems to be a lot of extra work.

Offline

Board footer

Powered by FluxBB