Sensor Fusion Hub Driver For AMD Laptops With Gyroscopes Is Coming To Linux 5.11
It's been a long and hard road to acceptance for AMD's Sensor Fusion Hub Linux driver. The first revision was submitted to the Linux kernel Mailing List in January 2020. It took eight revisions and a lot of effort before Jiří Kosina finally accepted it into the
hid.git#for-5.11 tree, almost guaranteeing that it will become a part of Linux 5.11.
written by 林慧 (Wai Lin). published 2020-10-23 - last edited 2020-10-24
Freelance graphic designer Luya Tshimbalanga from Coolest Storm Design posted this simple request on January third, 2019:
"Some touchscreen laptops, notably from HP, have an accelerometer based on AMD Sensor Fusion Hub which does not have a driver for Linux kernel needed for auto rotation of screen.
Would you mind providing a functional driver for AMD Sensor Fusion Hub or at least the information of that device for AMD users running on your hardware?"
Sandeep Singh, Senior Software Development Engineer at AMD Bengaluru in India, submitted a patch-set titled "SFH: Add Support for AMD Sensor Fusion Hub to the Linux Kernel Mailing List on January 9th, 2020 - slightly more than a year after Luya Tshimbalanga's request.
The initial attempt at getting a driver for the AMD fusion hub hardware used for gyroscopes and other sensors on modern laptops was flat out ignored by the kernel community. Sandeep Singh tried again a second revision. That revision was also flat out ignored.
The third revision did get a response from RedHat's Benjamin Tissoires who rejected it on the grounds that:
"It's adding a kernel API for no gain, and we should already have the debug API available in the various subsystems involved."
Sandeep Singh didn't give up. He submitted a fourth revision with fingers crossed on February 12th, 2020. Intel's Linux driver engineer Andy Shevchenko rejected it on the grounds that it had long list of issues and concluded that it would need "a bit of work".
The seventh revision was rejected by Randy Dunlap on the grounds that the documentation wasn't formatted correctly, Intel's Andy Shevchenko had even more objections and Marco Felsch from Pengutronix objected to a broad variety of code including amd_start_sensor() and amd_stop_sensor() having completely different APIs, problems with indentation and missing whitespaces and non-native data types:
> +void amd_stop_sensor(struct amd_mp2_dev *privdata, u16 sensor_idx) Why has amd_stop_sensor() a complete different API than amd_start_sensor(). IMHO I would keep it in sync. Also u16 sensor_idx is to large. Just use the struct amd_mp2_sensor_info.
Sandeep Singh sent revision eight, just in time for the Linux 5.10 merge window, on October 10th. It didn't make it into Linux 5.10, but it did get approved for Linux 5.11 by HID-maintainer Jiří Kosina from SUSE Labs on October 22nd. That does not guarantee that it will make it into Linux 5.11, but it's extremely likely. Code in the
hid.git branch is merged to mainline as a matter of routine.
It looks like graphic designer Luya Tshimbalanga will finally have automatic screen rotation working on his HP laptop slightly more than two years after he complained that it didn't work in a post on the AMD Community website. Linux 5.10 will be released early December this year and Linux 5.11 will arrive until the end of January 2021.