Bug 1918255 - Auto-rotation failed on GNOME Shell with AMD Sensor Fusion Hub
Summary: Auto-rotation failed on GNOME Shell with AMD Sensor Fusion Hub
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: kernel
Version: rawhide
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Kernel Maintainer List
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: 1651886
TreeView+ depends on / blocked
 
Reported: 2021-01-20 10:48 UTC by Luya Tshimbalanga
Modified: 2022-03-15 06:51 UTC (History)
19 users (show)

Fixed In Version: kernel-5.10.17-200.fc33
Clone Of:
Environment:
Last Closed: 2021-02-22 11:55:57 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
dmesg output from 5.11.0-0.rc3 with amd_sfh enabled (189.72 KB, text/plain)
2021-01-20 10:48 UTC, Luya Tshimbalanga
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1651886 0 unspecified CLOSED Missing AMD Sensor Fusion Hub driver for Linux kernel 2021-05-08 09:09:00 UTC

Description Luya Tshimbalanga 2021-01-20 10:48:48 UTC
Created attachment 1749047 [details]
dmesg output from 5.11.0-0.rc3 with amd_sfh enabled

1. Please describe the problem:

On a AMD powered 2-in-1 laptop like HP Envy x360, auto-rotation failed on GNOME Shell with AMD Sensor Fusion HUB enabled when in tablet mode. Both accelerometer and magnetometers are detected and activated.

2. What is the Version-Release number of the kernel:

5.11.0-0.rc3.20210114git65f0d2414b70.125

3. Did it work previously in Fedora?

First time AMD Sensor Fusion is enabled on kernel 5.11.0.rc3 series snapshot

4. Can you reproduce this issue? If so, please provide the steps to reproduce
   the issue below:
With newer kernel 5.11.0.rc3 with amd_sfh module enabled triggering available sensors

5. Does this problem occur with the latest Rawhide kernel? 

Yes.

6. Are you running any modules that not shipped with directly Fedora's kernel?:
No.

7. Please attach the kernel logs.

Comment 1 Luya Tshimbalanga 2021-01-20 10:52:51 UTC
Resulting test showing SW_TABLET_MODE never reported 1 when 2-in-1 laptop switched to tablet mode.


sudo evemu-record 
Available devices:
/dev/input/event0:	Power Button
/dev/input/event1:	Lid Switch
/dev/input/event2:	Power Button
/dev/input/event3:	AT Translated Set 2 keyboard
/dev/input/event4:	SynPS/2 Synaptics TouchPad
/dev/input/event5:	Video Bus
/dev/input/event6:	ELAN0732:00 04F3:264C
/dev/input/event7:	ELAN0732:00 04F3:264C UNKNOWN
/dev/input/event8:	ELAN0732:00 04F3:264C UNKNOWN
/dev/input/event9:	ELAN0732:00 04F3:264C
/dev/input/event10:	HP Wireless hotkeys
/dev/input/event11:	HP WMI hotkeys
/dev/input/event12:	HP Wide Vision FHD Camera: HP W
/dev/input/event13:	HP Wide Vision FHD Camera: HP I
/dev/input/event14:	HD-Audio Generic HDMI/DP,pcm=3
/dev/input/event15:	HD-Audio Generic Mic
/dev/input/event16:	HD-Audio Generic Headphone
Select the device event number [0-16]: 11
# EVEMU 1.3
# Kernel: 5.11.0-0.rc3.20210114git65f0d2414b70.125.bz1651886_2.fc34.x86_64
# DMI: dmi:bvnAMI:bvrF.47:bd07/03/2020:br15.47:efr92.48:svnHP:pnHPENVYx360Convertible15-cp0xxx:pvr:rvnHP:rn8497:rvr92.48:cvnHP:ct31:cvrChassisVersion:
# Input device name: "HP WMI hotkeys"
# Input device ID: bus 0x19 vendor 0000 product 0000 version 0000
# Supported events:
#   Event type 0 (EV_SYN)
#     Event code 0 (SYN_REPORT)
#     Event code 1 (SYN_CONFIG)
#     Event code 2 (SYN_MT_REPORT)
#     Event code 3 (SYN_DROPPED)
#     Event code 4 ((null))
#     Event code 5 ((null))
#     Event code 6 ((null))
#     Event code 7 ((null))
#     Event code 8 ((null))
#     Event code 9 ((null))
#     Event code 10 ((null))
#     Event code 11 ((null))
#     Event code 12 ((null))
#     Event code 13 ((null))
#     Event code 14 ((null))
#     Event code 15 (SYN_MAX)
#   Event type 1 (EV_KEY)
#     Event code 138 (KEY_HELP)
#     Event code 141 (KEY_SETUP)
#     Event code 148 (KEY_PROG1)
#     Event code 153 (KEY_ROTATE_DISPLAY)
#     Event code 224 (KEY_BRIGHTNESSDOWN)
#     Event code 225 (KEY_BRIGHTNESSUP)
#     Event code 226 (KEY_MEDIA)
#     Event code 240 (KEY_UNKNOWN)
#     Event code 358 (KEY_INFO)
#   Event type 4 (EV_MSC)
#     Event code 4 (MSC_SCAN)
#   Event type 5 (EV_SW)
#     Event code 1 (SW_TABLET_MODE)
#        State 0
#     Event code 5 (SW_DOCK)
#        State 0
# Properties:
N: HP WMI hotkeys
I: 0019 0000 0000 0000
P: 00 00 00 00 00 00 00 00
B: 00 0b 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 24 10 02 00 00 00 00
B: 01 00 00 00 00 07 00 01 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 40 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 02 00 00 00 00 00 00 00 00
B: 03 00 00 00 00 00 00 00 00
B: 04 10 00 00 00 00 00 00 00
B: 05 22 00 00 00 00 00 00 00
B: 11 00 00 00 00 00 00 00 00
B: 12 00 00 00 00 00 00 00 00
B: 14 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
################################
#      Waiting for events      #
################################

Comment 2 Hans de Goede 2021-01-26 12:37:54 UTC
Copy and pasting my comment from bug 1651886 here since the test-kernel which I build should also help with this bug:

Here is a new build sratch-build of the latest 5.11-rc5 kernel with my amd_sfh patches and a patch to fix the SW_TABLET_MODE issue from bug 1918255 :
https://koji.fedoraproject.org/koji/taskinfo?taskID=60556548

Note this is still building atm.

This time the amd_sfh patches include a patch to automatically set the sensor_mask based on a DMI match, so when testing
please make sure that you do NOT have "amd_sfh.sensor_mask=0x80007" on your kernel commandline (see "cat /proc/cmdline" output to verify).

Please let me know how things go with this build.

If for some reason you do not get any sensors in monitor-sensor again with this build, then there likely is something wrong with
the DMI matching, in that case please retry with "amd_sfh.sensor_mask=5" added to your kernel commandline.

Comment 3 Luya Tshimbalanga 2021-01-28 02:47:23 UTC
Follo-up on the second day using the scratch build kernel:

cat /proc/cmdline 
BOOT_IMAGE=(hd0,gpt4)/boot/vmlinuz-5.11.0-0.rc5.134.bz1651886_3.fc34.x86_64 root=UUID=76d5edeb-8ecb-4289-8fb1-8c481fbb405b ro rootflags=subvol=root rhgb quiet

monitor-sensor
    Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: left-up)
=== No ambient light sensor
=== No proximity sensor
    Accelerometer orientation changed: bottom-up
    Accelerometer orientation changed: left-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: bottom-up
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: bottom-up
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: bottom-up
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: bottom-up
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: left-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal


As mentioned on bug bz1651886, screen rotation is working with some caveats:
- Blackout screen before switching to a new position either portrait or landscape instead of a smoother transition.
- SW_TABLET_MODE (which possibly disables keyboard on tablet mode to prevent accidental press) is not listed anymore.

sudo evemu-record 
[sudo] password for luya: 
Available devices:
/dev/input/event0:	Power Button
/dev/input/event1:	Lid Switch
/dev/input/event2:	Power Button
/dev/input/event3:	AT Translated Set 2 keyboard
/dev/input/event4:	SynPS/2 Synaptics TouchPad
/dev/input/event5:	Video Bus
/dev/input/event6:	ELAN0732:00 04F3:264C
/dev/input/event7:	ELAN0732:00 04F3:264C UNKNOWN
/dev/input/event8:	ELAN0732:00 04F3:264C UNKNOWN
/dev/input/event9:	ELAN0732:00 04F3:264C
/dev/input/event10:	HP Wireless hotkeys
/dev/input/event11:	HP WMI hotkeys
/dev/input/event12:	HP Wide Vision FHD Camera: HP W
/dev/input/event13:	HP Wide Vision FHD Camera: HP I
/dev/input/event14:	HD-Audio Generic HDMI/DP,pcm=3
/dev/input/event15:	HD-Audio Generic Mic
/dev/input/event16:	HD-Audio Generic Headphone
Select the device event number [0-16]: 11
# EVEMU 1.3
# Kernel: 5.11.0-0.rc5.134.bz1651886_3.fc34.x86_64
# DMI: dmi:bvnAMI:bvrF.47:bd07/03/2020:br15.47:efr92.48:svnHP:pnHPENVYx360Convertible15-cp0xxx:pvr:rvnHP:rn8497:rvr92.48:cvnHP:ct31:cvrChassisVersion:
# Input device name: "HP WMI hotkeys"
# Input device ID: bus 0x19 vendor 0000 product 0000 version 0000
# Supported events:
#   Event type 0 (EV_SYN)
#     Event code 0 (SYN_REPORT)
#     Event code 1 (SYN_CONFIG)
#     Event code 2 (SYN_MT_REPORT)
#     Event code 3 (SYN_DROPPED)
#     Event code 4 ((null))
#     Event code 5 ((null))
#     Event code 6 ((null))
#     Event code 7 ((null))
#     Event code 8 ((null))
#     Event code 9 ((null))
#     Event code 10 ((null))
#     Event code 11 ((null))
#     Event code 12 ((null))
#     Event code 13 ((null))
#     Event code 14 ((null))
#     Event code 15 (SYN_MAX)
#   Event type 1 (EV_KEY)
#     Event code 138 (KEY_HELP)
#     Event code 141 (KEY_SETUP)
#     Event code 148 (KEY_PROG1)
#     Event code 153 (KEY_ROTATE_DISPLAY)
#     Event code 224 (KEY_BRIGHTNESSDOWN)
#     Event code 225 (KEY_BRIGHTNESSUP)
#     Event code 226 (KEY_MEDIA)
#     Event code 240 (KEY_UNKNOWN)
#     Event code 358 (KEY_INFO)
#   Event type 4 (EV_MSC)
#     Event code 4 (MSC_SCAN)
#   Event type 5 (EV_SW)
#     Event code 5 (SW_DOCK)
#        State 0
# Properties:
N: HP WMI hotkeys
I: 0019 0000 0000 0000
P: 00 00 00 00 00 00 00 00
B: 00 0b 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 24 10 02 00 00 00 00
B: 01 00 00 00 00 07 00 01 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 40 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 02 00 00 00 00 00 00 00 00
B: 03 00 00 00 00 00 00 00 00
B: 04 10 00 00 00 00 00 00 00
B: 05 20 00 00 00 00 00 00 00
B: 11 00 00 00 00 00 00 00 00
B: 12 00 00 00 00 00 00 00 00
B: 14 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
################################
#      Waiting for events      #
################################


It seems the random crashes causing screen rotation to stop working no longer occurs. 
The system submenu now shows the "Screen Rotation" button but not on Settings->Display. Keyboard shortcut Super+O still works.
Overall, the issue is nearly resolved due to a poor screen transition to a different position.

Comment 4 Luya Tshimbalanga 2021-01-31 20:26:37 UTC
Follow-up on the third day of testing.

cat /proc/cmdline 
BOOT_IMAGE=(hd0,gpt4)/boot/vmlinuz-5.11.0-0.rc5.134.bz1651886_3.fc34.x86_64 root=UUID=76d5edeb-8ecb-4289-8fb1-8c481fbb405b ro rootflags=subvol=root rhgb quiet

Screen rotation stopped working after resuming from a suspended convertible laptop. Monitor-sensor showed the sensor still function but GNOME Shell stopped rotating as the button went missing again.
Reboot restored the screen rotation functionality on log in and desktop session. Testing the redesigned GNOME Shell from https://copr.fedorainfracloud.org/coprs/haeckerfelix/gnome-shell-40/ has a bug related on screen rotation, granted it is still in development.

Flipping the convertible laptop into tent mode made the screen rotation transiting smoother than in tablet mode where the screen blackens at first. That part will need improvement.
SW_TABLET_MODE is still missing meaning the keyboard is active on tablet mode.

Comment 5 Luya Tshimbalanga 2021-02-13 00:36:55 UTC
I upgraded from Fedora 33 to 34 and noticed the improvement of screen rotation. After resetting the configuration of GNOME Shell via gsettings reset, some issues reported on comment #2 went away.

cat /proc/cmdline 
BOOT_IMAGE=(hd0,gpt7)/vmlinuz-5.11.0-0.rc5.134.bz1651886_3.fc34.x86_64 root=UUID=76d5edeb-8ecb-4289-8fb1-8c481fbb405b ro rootflags=subvol=root rhgb quiet

monitor-sensor 
    Waiting for iio-sensor-proxy to appear
+++ iio-sensor-proxy appeared
=== Has accelerometer (orientation: normal)
=== No ambient light sensor
=== No proximity sensor
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: left-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: bottom-up
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: left-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: left-up
    Accelerometer orientation changed: normal
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: bottom-up
    Accelerometer orientation changed: right-up
    Accelerometer orientation changed: normal

The black screen before screen rotation is gone. Slight flickering occurred on some applications like Firefox when in rotation, otherwise the rotation is fairly smooth.

evemu-record is missing as the package needs a rebuild for Fedora 34. In tablet mode, the keyboard is active when it shouldn't. Hopefully, the patch will improvement will reach mainline.

Comment 6 Luya Tshimbalanga 2021-02-13 22:03:54 UTC
Screen rotation seems stable on daily use. evemu-record showed SW_TABLET_MODE is missing

sudo evemu-record 
Available devices:
/dev/input/event0:	Power Button
/dev/input/event1:	Lid Switch
/dev/input/event2:	Power Button
/dev/input/event3:	AT Translated Set 2 keyboard
/dev/input/event4:	SynPS/2 Synaptics TouchPad
/dev/input/event5:	Video Bus
/dev/input/event6:	ELAN0732:00 04F3:264C
/dev/input/event7:	ELAN0732:00 04F3:264C UNKNOWN
/dev/input/event8:	ELAN0732:00 04F3:264C UNKNOWN
/dev/input/event9:	ELAN0732:00 04F3:264C
/dev/input/event10:	HP Wireless hotkeys
/dev/input/event11:	HP WMI hotkeys
/dev/input/event12:	HP Wide Vision FHD Camera: HP W
/dev/input/event13:	HP Wide Vision FHD Camera: HP I
/dev/input/event14:	HD-Audio Generic HDMI/DP,pcm=3
/dev/input/event15:	HD-Audio Generic Mic
/dev/input/event16:	HD-Audio Generic Headphone
Select the device event number [0-16]: 11
# EVEMU 1.3
# Kernel: 5.11.0-0.rc5.134.bz1651886_3.fc34.x86_64
# DMI: dmi:bvnAMI:bvrF.48:bd11/26/2020:br15.48:efr92.48:svnHP:pnHPENVYx360Convertible15-cp0xxx:pvr:rvnHP:rn8497:rvr92.48:cvnHP:ct31:cvrChassisVersion:
# Input device name: "HP WMI hotkeys"
# Input device ID: bus 0x19 vendor 0000 product 0000 version 0000
# Supported events:
#   Event type 0 (EV_SYN)
#     Event code 0 (SYN_REPORT)
#     Event code 1 (SYN_CONFIG)
#     Event code 2 (SYN_MT_REPORT)
#     Event code 3 (SYN_DROPPED)
#     Event code 4 ((null))
#     Event code 5 ((null))
#     Event code 6 ((null))
#     Event code 7 ((null))
#     Event code 8 ((null))
#     Event code 9 ((null))
#     Event code 10 ((null))
#     Event code 11 ((null))
#     Event code 12 ((null))
#     Event code 13 ((null))
#     Event code 14 ((null))
#     Event code 15 (SYN_MAX)
#   Event type 1 (EV_KEY)
#     Event code 138 (KEY_HELP)
#     Event code 141 (KEY_SETUP)
#     Event code 148 (KEY_PROG1)
#     Event code 153 (KEY_ROTATE_DISPLAY)
#     Event code 224 (KEY_BRIGHTNESSDOWN)
#     Event code 225 (KEY_BRIGHTNESSUP)
#     Event code 226 (KEY_MEDIA)
#     Event code 240 (KEY_UNKNOWN)
#     Event code 358 (KEY_INFO)
#   Event type 4 (EV_MSC)
#     Event code 4 (MSC_SCAN)
#   Event type 5 (EV_SW)
#     Event code 5 (SW_DOCK)
#        State 0
# Properties:
N: HP WMI hotkeys
I: 0019 0000 0000 0000
P: 00 00 00 00 00 00 00 00
B: 00 0b 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 24 10 02 00 00 00 00
B: 01 00 00 00 00 07 00 01 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 40 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 01 00 00 00 00 00 00 00 00
B: 02 00 00 00 00 00 00 00 00
B: 03 00 00 00 00 00 00 00 00
B: 04 10 00 00 00 00 00 00 00
B: 05 20 00 00 00 00 00 00 00
B: 11 00 00 00 00 00 00 00 00
B: 12 00 00 00 00 00 00 00 00
B: 14 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
B: 15 00 00 00 00 00 00 00 00
################################
#      Waiting for events      #
################################


Will it be possible to update the kernel with the patch to test the changes? Thanks

Comment 7 Hans de Goede 2021-02-14 17:21:14 UTC
(In reply to Luya Tshimbalanga from comment #6)
> Screen rotation seems stable on daily use.

Does that mean that it also keeps working after a suspend/resume cycle, or is that still a problem ?

> evemu-record showed SW_TABLET_MODE is missing

That is expected. We don't know how to figure out if the device in in table-mode or not on these devices. So I've written a patch which removes the broken SW_TABLET_MODE reporting.

Adding working SW_TABLET_MODE reporting will require someone to figure out how to reliably get that info from the firmware/hw on these devices.

Comment 8 Luya Tshimbalanga 2021-02-14 19:22:06 UTC
(In reply to Hans de Goede from comment #7)
> (In reply to Luya Tshimbalanga from comment #6)
> > Screen rotation seems stable on daily use.
> 
> Does that mean that it also keeps working after a suspend/resume cycle, or
> is that still a problem ?
> 

Yes, the screen rotation keeps working after a suspend/resume cycle. It seems a driver update fixed it.

 
> That is expected. We don't know how to figure out if the device in in
> table-mode or not on these devices. So I've written a patch which removes
> the broken SW_TABLET_MODE reporting.
> 
> Adding working SW_TABLET_MODE reporting will require someone to figure out
> how to reliably get that info from the firmware/hw on these devices.

Which means open a separate bug report at Linux kernel possibly for i2c in a meanwhile.
https://bugzilla.kernel.org/show_bug.cgi?id=211741

We can close this report as the main goal has been reached and once the fix reaches mainline.

Thank you Hans.

Comment 9 Hans de Goede 2021-02-22 11:55:57 UTC
The fix for the broken SW_TABLET_MODE reporting has landed in kernel-5.10.17-200.fc33, closing.

Comment 10 Hans de Goede 2022-03-14 11:35:35 UTC
Good news, we have someone from HP contributing to the hp-wmi driver now and I have just merged a patch-series (intended for 5.18) which should make SW_TABLET_MODE reporting work on new HP x360 models, see:

https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans

And specifically:

https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/commit/?h=review-hans&id=be30fdc7d5e89d257b1b81418a35b8367fc580a9

Comment 11 Luya Tshimbalanga 2022-03-15 06:51:26 UTC
Glad to read a HP contributor finally stepped up to address SW_TABLET_MODE issue. Thank you both.


Note You need to log in before you can comment on or make changes to this bug.