Bug 218104

Summary: [amd-sfh] Interrupt disabling (b300667b) disables working HP ProBook x360 435 G7 accelerometer
Product: Drivers Reporter: Mauricio Collares (mauricio)
Component: Input DevicesAssignee: drivers_input-devices
Status: NEW ---    
Severity: normal CC: 7ec0436c-7844-4c81-b72c-b80ee3084b19, akshata.mukundshetty, basunatikar, cadet_germless945, danielrparks, drivers_input-devices, ecstaticmorse, gregory.clemenceau, jrpilat, kernel, laurence.bonat, lukapanio, lzilhao+bugzilla, mario.limonciello, martin.svanda, mauricio, max, mehmet_kilicaslan, mek101-dev.inv, nehal-bakulchandra.shah, promethean.lee, shyam-sundar.s-k, stormyiceleopard, stuart, swar12894, teppot, zymphad
Priority: P3    
Hardware: AMD   
OS: Linux   
Kernel Version: Subsystem:
Regression: Yes Bisected commit-id: b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b
Attachments: sensors missing from udevadm info --export-db after b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b
dmesg output (stock 6.6.2, accelerometer does not work)
dmesg output (6.6.2 with b300667b reverted, accelerometer works)

Description Mauricio Collares 2023-11-05 12:11:35 UTC
Created attachment 305368 [details]
sensors missing from udevadm info --export-db after b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b

+++ This bug was initially created as a clone of Bug #212615 +++

I have a HP ProBook x360 435 G7 (Ryzen 4700U). On GNOME Wayland with
the Screen Autorotate extension
(https://extensions.gnome.org/extension/4191/screen-autorotate/), I
confirmed by bisection that b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b
caused autorotation to stop working.

More specifically, before this commit (on aa0b724a2bf041036e56cbb3b4b3afde7c5e7c9e):

* `sudo iio-sensor-proxy -v -r` stays running (doesn't exit immediately) and prints nothing
* `monitor-sensor` starts up by saying "=== Has accelerometer (orientation: normal)" and prints "    Accelerometer orientation changed: bottom-up" when I physically rotate the screen.
* `udevadm info --export-db` contains the accelerometer/gyroscope sensor info I've pasted in the attachment.

After b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b:

* `sudo iio-sensor-proxy -v -r` exits immediately.
* `monitor-sensor` prints "    Waiting for iio-sensor-proxy to appear" on startup and does nothing when I rotate the screen.
* The sensors in the attachment are no longer listed in `udevadm info --export-db`.
* The `hid_sensor_gyro_3d` and `hid_sensor_accel_3d` kernel modules are no longer loaded automatically, and loading them does nothing.

Reverting b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b on top of 6.6 also makes screen autorotation work again. Whenever screen autorotation works, `iio_generic_buffer --device-num 2 -A -c 100` reports good accelerometer values.

(The following is essentially the contents of bug #212625 comment #46)

> If you revert that commit on top of 6.6 does it start working?  Also; can
> you still get into the deepest s2idle sleep state in 6.6 with it reverted? 
> You can check with /sys/power/suspend_stats/last_hw_sleep.

I don't have a /sys/power/suspend_stats/last_hw_sleep file (tested on stock 6.6, as well as on 6.6 + revert of b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b), but if I leave my computer idle for a while it enters standby and I see

Nov 03 08:47:29 hp kernel: PM: suspend entry (deep)

in journalctl, and the computer enters deep sleep (need to press power button to wake it up). Also, the content of /sys/power/mem_sleep is "s2idle [deep]". In bug ug #212615 I also attached the report produced by amd_s2idle.py run on stock 6.6 in case it is relevant (I can also attach it for 6.6 + revert if desired).
Comment 1 akshata.mukundshetty 2023-11-14 05:45:24 UTC
Hi @Mauricio Collares,

Can you please share the dmesg log for both the scenarios mentioned in the description?
Comment 2 Mauricio Collares 2023-11-29 15:11:28 UTC
Created attachment 305510 [details]
dmesg output (stock 6.6.2, accelerometer does not work)
Comment 3 Mauricio Collares 2023-11-29 15:12:45 UTC
Created attachment 305511 [details]
dmesg output (6.6.2 with b300667b reverted, accelerometer works)