Bug 212615 - amd-sfh doesn't provide valid sensor data in Linux on HP x360 Envy systems
Summary: amd-sfh doesn't provide valid sensor data in Linux on HP x360 Envy systems
Status: ASSIGNED
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: AMD Linux
: P1 normal
Assignee: drivers_input-devices
URL:
Keywords:
: 207431 (view as bug list)
Depends on:
Blocks:
 
Reported: 2021-04-08 20:48 UTC by Stuart Morgan
Modified: 2023-11-07 06:37 UTC (History)
22 users (show)

See Also:
Kernel Version: 5.19-rc6
Subsystem:
Regression: No
Bisected commit-id:


Attachments
sensors missing from udevadm info --export-db after b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b (3.70 KB, text/plain)
2023-11-02 16:56 UTC, Mauricio Collares
Details
amd_s2idle.py report on stock 6.6 (108.85 KB, text/plain)
2023-11-03 08:00 UTC, Mauricio Collares
Details
outputs of various commands describing the problem (44.63 KB, text/plain)
2023-11-05 10:53 UTC, Laurence Bonat
Details

Description Stuart Morgan 2021-04-08 20:48:10 UTC
The amd-sfh driver loads correct and detects the hardware, but the output is all zeros no matter the device orientation.

This bug was originally raised downstream against iio_sensor_proxy where the determination was made that the problem originates at the driver level. The issue was reported against multiple laptop models using Ryzen mobile processors.

https://gitlab.freedesktop.org/hadess/iio-sensor-proxy/-/issues/315


# iio_generic_buffer --device-num 0 -A -c 100
iio device number being used is 0
iio trigger number being used is 0
Enabling all channels
Enabling: in_accel_x_en
Enabling: in_accel_z_en
Enabling: in_timestamp_en
Enabling: in_accel_y_en
/sys/bus/iio/devices/iio:device0 accel_3d-dev0
514284.375000 816214.562500 816227.125000 1617913283256446331 
514284.375000 816214.562500 816227.125000 1617913283256478807 
0.000000 0.000000 0.000000 1617913283271095729 
0.000000 0.000000 0.000000 1617913283479099805 
0.000000 0.000000 0.000000 1617913283687318920 
0.000000 0.000000 0.000000 1617913283895314405 
0.000000 0.000000 0.000000 1617913284103289845 
0.000000 0.000000 0.000000 1617913284311314384 
0.000000 0.000000 0.000000 1617913284519359526 
0.000000 0.000000 0.000000 1617913284727312478
Comment 1 Daniel Parks 2021-04-14 20:15:43 UTC
On my system, the accelerometer is not always device #0. I get the exact same results as Stuart Morgan with the accelerometer, and similar results from the magnetometer and gyroscope:

# ./iio_generic_buffer --device-num 0 -a -c 5
iio device number being used is 0
iio trigger number being used is 0
Enabling all channels
Enabling: in_magn_z_en
Enabling: in_magn_y_en
Enabling: in_magn_x_en
/sys/bus/iio/devices/iio:device0 magn_3d-dev0
5.244241 8.323072 8.388735
5.244241 8.323072 8.388735
0.000000 0.000000 0.000000
0.000000 0.000000 0.000000
0.000000 0.000000 0.000000
0.000000 0.000000 0.000000
Disabling: in_magn_z_en
Disabling: in_magn_y_en
Disabling: in_magn_x_en

# ./iio_generic_buffer --device-num 1 -a -c 5
iio device number being used is 1
iio trigger number being used is 2
Enabling all channels
Enabling: in_anglvel_z_en
Enabling: in_anglvel_y_en
Enabling: in_anglvel_x_en
/sys/bus/iio/devices/iio:device1 gyro_3d-dev1
915.287903 1452.642456 1452.664795
915.287903 1452.642456 1452.664795
0.000000 0.000000 0.000000
0.000000 0.000000 0.000000
0.000000 0.000000 0.000000
0.000000 0.000000 0.000000
Disabling: in_anglvel_z_en
Disabling: in_anglvel_y_en
Disabling: in_anglvel_x_en

While I was testing this, I unloaded and reloaded amd_sfh, and shortly afterwards, my system experienced a kernel panic. I don't have the logs, unfortunately, because all outputs froze (even the caps lock key didn't blink) and it didn't sync.

The last command in the audit log before the panic was:

./iio_generic_buffer --device-num 2 -a -c 5
Comment 2 Stuart Morgan 2021-04-20 16:39:02 UTC
I see some device quirks being added to the 5.12 branch, RC8, for HP Envy line model ag0* 

I'm using the HP Envy AY0009NA which isn't covered by those quirks.
Comment 3 Dylan MacKenzie 2021-06-22 01:57:09 UTC
I have an HP Envy x360 13-ay0xxx, which has a Ryzen 4700U (Renoir) processor. I am experiencing the same issue: 2 sensors are detected but `./iio_generic_buffer` shows the same nonsense value followed by all zeroes. Multiple other Linux users with Renoir chipsets are having the [same issue](https://bbs.archlinux.org/viewtopic.php?pid=1947124#p1947124).

I took a look at the Windows driver (amdsfhkmdf.sys), and found many similarities with the Linux driver. However, the Windows driver checks the lower four bits of [`activecontrolstatus`](
https://github.com/torvalds/linux/blob/a96bfed64c8986d6404e553f18203cae1f5ac7e6/drivers/hid/amd-sfh-hid/amd_sfh_pcie.c#L112) for the magic value 2. If found, it uses very different set of MMIO writes to pass commands to the SFH. For example, here's pseudocode that mimics the Windows driver's method of enabling a given sensor:

```c
  c2p_cmd_idx_and_interval = sensor_idx | (uint)interval << 8;

  if (data->activecontrolstatus_lo4 == 2) {
    c2p_cmd_part = (param_4 & 1 | c2p_cmd_idx_and_interval << 0xc) << 4;
    c2p_cmd = c2p_cmd_part | 0x1001;

    // MMIO writes
    data->c2p_msg[2] = /* sensor addr hi */;
    data->c2p_msg[1] = /* sensor addr lo */;
    *data->c2p_msg = c2p_cmd;
  } else {
    c2p_cmd = c2p_cmd_idx_and_interval << 8 | AMD_SFH_CMD_ENABLE_SENSOR;

    // MMIO writes
    data->c2p_msg[3] = /* sensor addr hi */;
    data->c2p_msg[2] = /* sensor addr lo */;

                    /* amd_sfh_param {
                        .layout = 1,
                        .len = 0x20,
                       } */
    data->c2p_msg[1] = 0x41;
    *data->c2p_msg = c2p_cmd;
  }
```

The code in the `else` block is basically the same as `amd_start_sensor` in the Linux driver, but the code in the `if` block uses a different layout for the command register, has extra bit flags, and uses different address registers.

Sure enough, the lower bits of `activecontrolstatus` on my system are 2. I'm guessing that this is not the case on older architectures (Matisse, Starship, etc.), and those bits indicate a later revision of the SFH hardware with a different interface. I have not confirmed this, however.

cc nehal-bakulchandra.shah@amd.com
Comment 4 Dylan MacKenzie 2021-06-22 03:26:15 UTC
Ah, I just found a patch for the new architecture that was filed a couple days ago. Seems like this will be fixed soon.

https://patchwork.kernel.org/project/linux-input/patch/20210618081838.4156571-4-Basavaraj.Natikar@amd.com/
Comment 5 Maxwell Beck 2021-08-07 02:17:22 UTC
Unfortunately screen rotation still does not work for me on kernel 5.14-rc4, which should have all of the patches for Renoir/Cezanne support merged in. I get the same exact behavior as the others here. I also have the HP Envy x360 13-ay000 but with a 4500U, and it is updated to the latest available BIOS (F.18).
Comment 6 Nehal Shah 2021-08-07 03:36:35 UTC
Hi Maxwell

Can you please share your laptop model number
And also the ubuntu version?

Hi @Dylan, is it working fine in your laptop( presuming you have Renior based laptop)

Regards
Nehal
Comment 7 Stuart Morgan 2021-08-07 10:00:01 UTC
5.14-rc4 is also not working for me with the HP Envy x360 model AY0009NA. I see exactly the same behaviour as with earlier kernels and as shared in my initial bug report.
Comment 8 Stuart Morgan 2021-08-07 11:45:34 UTC
(In reply to Stuart Morgan from comment #7)
> 5.14-rc4 is also not working for me with the HP Envy x360 model AY0009NA. I
> see exactly the same behaviour as with earlier kernels and as shared in my
> initial bug report.

This is with Fedora 34.
Comment 9 Maxwell Beck 2021-08-09 20:13:21 UTC
The most exact model number I can get on my laptop is 13z-ay000 as it was a customized order. I have been testing with NixOS 21.05.
Comment 10 Swar Shah 2021-08-12 03:41:55 UTC
I just tried the 5.14-rc5 on my IdeaPad Flex 5 14ARE05 running on Ubuntu 20.04.2 and it still seems to be broken, at least in my case. It appears to detect the rotation but as soon as it detects it, the screen goes static like the old television static screen and only way to get screen working again is a hard reboot.
Comment 11 Nehal Shah 2021-08-12 05:15:51 UTC
Hi Swar and All,

We are setting up the same environment and looking into the issue as we are not getting the issue on available reference platform.

Thanks
Nehal Shah
Comment 12 Stormy 2021-08-16 15:31:11 UTC
Hello everyone,

I have the same issue with the following laptop...


Make/Model: HP ENVY x360 2-in-1 Convertible 15z-ee100

CPU/GPU: AMD Ryzen 5700U with Radeon Graphics


I hope this will help find a fix.
Comment 13 Mark Lee 2021-08-20 02:17:02 UTC
Hi Stormy,

May I know the BIOS version on the laptop?
Comment 14 Mark Lee 2021-08-20 02:41:18 UTC
Hi Swar,

May I know the BIOS version (Flex 5) you are using?
Comment 15 Stormy 2021-08-20 12:49:25 UTC
(In reply to Mark Lee from comment #13)
> Hi Stormy,
> 
> May I know the BIOS version on the laptop?

Hello Mark,

Is this what you are looking for? See attached images:
https://cdn.discordapp.com/attachments/365979535642066957/878256612740050974/20210820_083334.jpg
https://cdn.discordapp.com/attachments/365979535642066957/878257538762698802/20210820_084133.jpg


Images not working? Possible information:
BIOS Vendor: Insyde
BIOS Revision: F.03
Comment 16 Swar Shah 2021-08-20 17:51:27 UTC
(In reply to Mark Lee from comment #14)
> Hi Swar,
> 
> May I know the BIOS version (Flex 5) you are using?

BIOS Version: EECN30WW
Comment 17 Stuart Morgan 2021-09-29 21:45:09 UTC
As an update, this issue is still present with 5.15 rc1
Comment 18 Mek101 2021-10-06 12:03:56 UTC
I would like to confirm that this issue is also affecting the Lenovo Ideapad 14ALC05 with the Ryzen 3 5300U cpu, kernel 5.14.7


$ sudo ./iio_generic_buffer --device-num 0
iio device number being used is 0
iio trigger number being used is 0
/sys/bus/iio/devices/iio:device0 accel_3d-dev0
514284.375000 816214.562500 816227.125000 1633520534367737352 
514284.375000 816214.562500 816227.125000 1633520534367756348 
0.000000 0.000000 0.882599 1633520534567971505 
0.000000 0.000000 0.882599 1633520534771316637
Comment 19 Swar Shah 2021-10-19 01:07:45 UTC
I just tried the 5.15.0-rc6 and it seems to have resolved the issue for me. No more static screen on rotation or waking the display up from suspend. Thanks!
Comment 20 Mek101 2021-11-01 15:34:01 UTC
Apart for 1 more column of non-zero output, the bug is still present on the Lenovo 14ALC05 with Kernel 5.15.0 (Ryzen 3 5300U)

$ sudo ./iio_generic_buffer -a --device-num 0
iio device number being used is 0
iio trigger number being used is 0
Auto-channels selected but some channels are already activated in sysfs
Proceeding without activating any channels
/sys/bus/iio/devices/iio:device0 accel_3d-dev0
514284.375000 816214.562500 816227.125000 1635780653841921687 
514284.375000 816214.562500 816227.125000 1635780653841948835 
0.000000 -0.882599 -0.294199 1635780653951177401 
0.000000 -0.882599 -0.294199 1635780654154205185
Comment 21 Luka 2022-03-12 17:51:49 UTC
Can confirm issue on 5.16. Device is HP ENVY x360 Convertible 13-ay0xxx. Distro is Manjaro.
Comment 22 Mario Limonciello (AMD) 2022-07-09 13:56:45 UTC
*** Bug 207431 has been marked as a duplicate of this bug. ***
Comment 23 Mario Limonciello (AMD) 2022-07-09 13:58:09 UTC
Is this still an issue on 5.19-rc1 or later?  There is a patch that has gone in that might help.

https://github.com/torvalds/linux/commit/b5d7f43e97dabfa04a4be5ff027ce7da119332be
Comment 24 Laurence Bonat 2022-07-16 15:20:02 UTC
(In reply to Mario Limonciello (AMD) from comment #23)
> Is this still an issue on 5.19-rc1 or later?  There is a patch that has gone
> in that might help.
> 
> https://github.com/torvalds/linux/commit/
> b5d7f43e97dabfa04a4be5ff027ce7da119332be

Hi, 
I tried again with kernel 5.19-rc6 on kubuntu 22.04 and now I cannot even detect the sensor with monitor-sensor. The output is now:
monitor-sensor
    Waiting for iio-sensor-proxy to appear

I'm on a HP x360 Envy 13-ay0285ng With AMD ryzen 7 4700u and 16GB of Ram. Bios revision F.21 Rev.A. It still doesn't work.
I really don't know what to do. It appears that the sensor is still not recognized. 
Here is dmesg output for amd logged entries: 
sudo dmesg | grep amd
[    0.710440] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4 counters/bank).
[    1.803167] pcie_mp2_amd 0000:04:00.7: enabling device (0000 -> 0002)
[    2.978607] [drm] amdgpu kernel modesetting enabled.
[    2.979229] amdgpu: Virtual CRAT table created for CPU
[    2.979238] amdgpu: Topology: Add CPU node
[    2.979426] amdgpu 0000:04:00.0: vgaarb: deactivate vga console
[    2.979461] amdgpu 0000:04:00.0: enabling device (0006 -> 0007)
[    2.980929] amdgpu 0000:04:00.0: amdgpu: Fetched VBIOS from VFCT
[    2.980931] amdgpu: ATOM BIOS: 113-RENOIR-036
[    2.980966] amdgpu 0000:04:00.0: amdgpu: Trusted Memory Zone (TMZ) feature enabled
[    2.980968] amdgpu 0000:04:00.0: amdgpu: PCIE atomic ops is not supported
[    2.980973] amdgpu 0000:04:00.0: amdgpu: MODE2 reset
[    2.981069] amdgpu 0000:04:00.0: amdgpu: VRAM: 512M 0x000000F400000000 - 0x000000F41FFFFFFF (512M used)
[    2.981071] amdgpu 0000:04:00.0: amdgpu: GART: 1024M 0x0000000000000000 - 0x000000003FFFFFFF
[    2.981073] amdgpu 0000:04:00.0: amdgpu: AGP: 267419648M 0x000000F800000000 - 0x0000FFFFFFFFFFFF
[    2.981121] [drm] amdgpu: 512M of VRAM memory ready
[    2.981122] [drm] amdgpu: 7693M of GTT memory ready.
[    2.981442] amdgpu 0000:04:00.0: amdgpu: PSP runtime database doesn't exist
[    2.981444] amdgpu 0000:04:00.0: amdgpu: PSP runtime database doesn't exist
[    2.982362] amdgpu 0000:04:00.0: amdgpu: Will use PSP to load VCN firmware
[    3.768778] amdgpu 0000:04:00.0: amdgpu: RAS: optional ras ta ucode is not available
[    3.779882] amdgpu 0000:04:00.0: amdgpu: RAP: optional rap ta ucode is not available
[    3.779885] amdgpu 0000:04:00.0: amdgpu: SECUREDISPLAY: securedisplay ta ucode is not available
[    3.780695] amdgpu 0000:04:00.0: amdgpu: SMU is initialized successfully!
[    3.967644] kfd kfd: amdgpu: Allocated 3969056 bytes on gart
[    3.967732] amdgpu: sdma_bitmap: 3
[    4.003411] amdgpu: HMM registered 512MB device memory
[    4.003454] amdgpu: SRAT table not found
[    4.003455] amdgpu: Virtual CRAT table created for GPU
[    4.004178] amdgpu: Topology: Add dGPU node [0x1636:0x1002]
[    4.004185] kfd kfd: amdgpu: added device 1002:1636
[    4.004274] amdgpu 0000:04:00.0: amdgpu: SE 1, SH per SE 1, CU per SH 8, active_cu_number 7
[    4.004412] amdgpu 0000:04:00.0: amdgpu: ring gfx uses VM inv eng 0 on hub 0
[    4.004416] amdgpu 0000:04:00.0: amdgpu: ring comp_1.0.0 uses VM inv eng 1 on hub 0
[    4.004419] amdgpu 0000:04:00.0: amdgpu: ring comp_1.1.0 uses VM inv eng 4 on hub 0
[    4.004422] amdgpu 0000:04:00.0: amdgpu: ring comp_1.2.0 uses VM inv eng 5 on hub 0
[    4.004424] amdgpu 0000:04:00.0: amdgpu: ring comp_1.3.0 uses VM inv eng 6 on hub 0
[    4.004426] amdgpu 0000:04:00.0: amdgpu: ring comp_1.0.1 uses VM inv eng 7 on hub 0
[    4.004428] amdgpu 0000:04:00.0: amdgpu: ring comp_1.1.1 uses VM inv eng 8 on hub 0
[    4.004431] amdgpu 0000:04:00.0: amdgpu: ring comp_1.2.1 uses VM inv eng 9 on hub 0
[    4.004433] amdgpu 0000:04:00.0: amdgpu: ring comp_1.3.1 uses VM inv eng 10 on hub 0
[    4.004436] amdgpu 0000:04:00.0: amdgpu: ring kiq_2.1.0 uses VM inv eng 11 on hub 0
[    4.004438] amdgpu 0000:04:00.0: amdgpu: ring sdma0 uses VM inv eng 0 on hub 1
[    4.004441] amdgpu 0000:04:00.0: amdgpu: ring vcn_dec uses VM inv eng 1 on hub 1
[    4.004443] amdgpu 0000:04:00.0: amdgpu: ring vcn_enc0 uses VM inv eng 4 on hub 1
[    4.004446] amdgpu 0000:04:00.0: amdgpu: ring vcn_enc1 uses VM inv eng 5 on hub 1
[    4.004448] amdgpu 0000:04:00.0: amdgpu: ring jpeg_dec uses VM inv eng 6 on hub 1
[    4.006515] [drm] Initialized amdgpu 3.47.0 20150101 for 0000:04:00.0 on minor 0
[    4.012027] fbcon: amdgpudrmfb (fb0) is primary device
[    4.715658] amdgpu 0000:04:00.0: [drm] fb0: amdgpudrmfb frame buffer device
[    7.624518] snd_hda_intel 0000:04:00.1: bound 0000:04:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu])

lspci -knn output: 
lspci -knn
00:00.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne Root Complex [1022:1630]
        Subsystem: Hewlett-Packard Company Renoir/Cezanne Root Complex [103c:876e]
00:00.2 IOMMU [0806]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne IOMMU [1022:1631]
        Subsystem: Hewlett-Packard Company Renoir/Cezanne IOMMU [103c:876e]
00:01.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
00:01.3 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne PCIe GPP Bridge [1022:1634]
        Kernel driver in use: pcieport
00:02.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
00:02.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne PCIe GPP Bridge [1022:1634]
        Kernel driver in use: pcieport
00:02.3 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne PCIe GPP Bridge [1022:1634]
        Kernel driver in use: pcieport
00:08.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir PCIe Dummy Host Bridge [1022:1632]
00:08.1 PCI bridge [0604]: Advanced Micro Devices, Inc. [AMD] Renoir Internal PCIe GPP Bridge to Bus [1022:1635]
        Kernel driver in use: pcieport
00:14.0 SMBus [0c05]: Advanced Micro Devices, Inc. [AMD] FCH SMBus Controller [1022:790b] (rev 51)
        Subsystem: Hewlett-Packard Company FCH SMBus Controller [103c:876e]
        Kernel driver in use: piix4_smbus
        Kernel modules: i2c_piix4, sp5100_tco
00:14.3 ISA bridge [0601]: Advanced Micro Devices, Inc. [AMD] FCH LPC Bridge [1022:790e] (rev 51)
        Subsystem: Hewlett-Packard Company FCH LPC Bridge [103c:876e]
00:18.0 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 0 [1022:1448]
00:18.1 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 1 [1022:1449]
00:18.2 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 2 [1022:144a]
00:18.3 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 3 [1022:144b]
        Kernel driver in use: k10temp
        Kernel modules: k10temp
00:18.4 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 4 [1022:144c]
00:18.5 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 5 [1022:144d]
00:18.6 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 6 [1022:144e]
00:18.7 Host bridge [0600]: Advanced Micro Devices, Inc. [AMD] Renoir Device 24: Function 7 [1022:144f]
01:00.0 Network controller [0280]: Realtek Semiconductor Co., Ltd. RTL8822CE 802.11ac PCIe Wireless Network Adapter [10ec:c822]
        DeviceName: WLAN
        Subsystem: Hewlett-Packard Company RTL8822CE 802.11ac PCIe Wireless Network Adapter [103c:85f7]
        Kernel driver in use: rtw_8822ce
        Kernel modules: rtw88_8822ce
02:00.0 Unassigned class [ff00]: Realtek Semiconductor Co., Ltd. RTS522A PCI Express Card Reader [10ec:522a] (rev 01)
        DeviceName: Realtek PCIe CardReader
        Subsystem: Hewlett-Packard Company RTS522A PCI Express Card Reader [103c:876e]
        Kernel driver in use: rtsx_pci
        Kernel modules: rtsx_pci
03:00.0 Non-Volatile memory controller [0108]: Sandisk Corp WD Blue SN500 / PC SN520 NVMe SSD [15b7:5003] (rev 01)
        DeviceName: Realtek RTL8111E Ethernet LOM
        Subsystem: Sandisk Corp WD Blue SN500 / PC SN520 NVMe SSD [15b7:5003]
        Kernel driver in use: nvme
        Kernel modules: nvme
04:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Renoir [1002:1636] (rev c2)
        DeviceName: AMD Radeon(TM) Graphics
        Subsystem: Hewlett-Packard Company Renoir [103c:876e]
        Kernel driver in use: amdgpu
        Kernel modules: amdgpu
04:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Renoir Radeon High Definition Audio Controller [1002:1637]
        Subsystem: Hewlett-Packard Company Renoir Radeon High Definition Audio Controller [103c:876e]
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd_hda_intel
04:00.2 Encryption controller [1080]: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) Platform Security Processor [1022:15df]
        Subsystem: Hewlett-Packard Company Family 17h (Models 10h-1fh) Platform Security Processor [103c:876e]
        Kernel driver in use: ccp
        Kernel modules: ccp
04:00.3 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 [1022:1639]
        Subsystem: Hewlett-Packard Company Renoir/Cezanne USB 3.1 [103c:876e]
        Kernel driver in use: xhci_hcd
        Kernel modules: xhci_pci
04:00.4 USB controller [0c03]: Advanced Micro Devices, Inc. [AMD] Renoir/Cezanne USB 3.1 [1022:1639]
        Subsystem: Hewlett-Packard Company Renoir/Cezanne USB 3.1 [103c:876e]
        Kernel driver in use: xhci_hcd
        Kernel modules: xhci_pci
04:00.5 Multimedia controller [0480]: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/FireFlight/Renoir Audio Processor [1022:15e2] (rev 01)
        Subsystem: Hewlett-Packard Company Raven/Raven2/FireFlight/Renoir Audio Processor [103c:876e]
        Kernel driver in use: snd_rn_pci_acp3x
        Kernel modules: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x
04:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller [1022:15e3]
        Subsystem: Hewlett-Packard Company Family 17h (Models 10h-1fh) HD Audio Controller [103c:876e]
        Kernel driver in use: snd_hda_intel
        Kernel modules: snd_hda_intel
04:00.7 Signal processing controller [1180]: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/Renoir Sensor Fusion Hub [1022:15e4]
        Subsystem: Hewlett-Packard Company Raven/Raven2/Renoir Sensor Fusion Hub [103c:876e]
        Kernel driver in use: pcie_mp2_amd
        Kernel modules: amd_sfh


Hope this helps
Laurence
Comment 25 Mario Limonciello (AMD) 2022-07-16 16:36:55 UTC
That's actually exactly the outcome I was expecting. I think you really don't have a sensor connected but the SFH firmware was advertising one.

By the driver checking the discovery data it will now only advertise when it really is there.
Comment 26 Laurence Bonat 2022-07-16 17:01:16 UTC
(In reply to Mario Limonciello (AMD) from comment #25)
> That's actually exactly the outcome I was expecting. I think you really
> don't have a sensor connected but the SFH firmware was advertising one.
> 
> By the driver checking the discovery data it will now only advertise when it
> really is there.

Oh, I didn't expect this. 
But it doesn't actually make any sense. On windows I can rotate the screen and all of those things related to the accelerometer. 
Am I missing a piece of something? 
Let me know if you need to do some testing on my laptop, I will happily do them because I would really like to use this laptop with ubuntu, but the screen rotation is a must.

Thanks for the reply,
Laurence
Comment 27 Mario Limonciello (AMD) 2022-07-16 18:31:35 UTC
In Windows do you know if rotation data is actually coming from SFH? Maybe it's another source. 

Could you disable SFH device in Windows device manager and check whether rotation still works?
Comment 28 Laurence Bonat 2022-07-16 19:31:18 UTC
(In reply to Mario Limonciello (AMD) from comment #27)
> In Windows do you know if rotation data is actually coming from SFH? Maybe
> it's another source. 
> 
> Could you disable SFH device in Windows device manager and check whether
> rotation still works?

So I tried disabling "AMD Sensor Fusion Hub" in Windows and the rotation stops working. So I think that it's the SFH responsible for the rotation.

I found out that there is another sensor marked on device manager, called "AMD UMDF Sensor", and if I remove the driver of this device, the rotation stops working too. 

This UMDF sensor is dependent on the "AMD Sensor Fusion Hub", and when I disable AMD SFH, the "AMD UMDF Sensor" throws this error: "This Device Is Currently Waiting on Another Device (Code 51)"

So I think there is definetly the SFH in my laptop and it should be working even on Ubuntu. It's 2 years that I have this laptop and still there isn't a proper solution... 
Anyway let me know anything that may help resolve this issue

Cheers, 
Laurence
Comment 29 Mario Limonciello (AMD) 2022-07-18 15:50:33 UTC
Yeah that does confirm it is SFH doing the rotation.  From your above points:
* Bad data before discovery register checking added
* No sensors exported when checking discovery
* Windows only works with SFH driver(s) available

To me it sounds like some initialization is missing in the SFH driver for your particular combination.  This also agrees with comment #3 above.
Comment 30 Laurence Bonat 2022-07-18 16:26:03 UTC
(In reply to Mario Limonciello (AMD) from comment #29)
> Yeah that does confirm it is SFH doing the rotation.  From your above points:
> * Bad data before discovery register checking added
> * No sensors exported when checking discovery
> * Windows only works with SFH driver(s) available
> 
> To me it sounds like some initialization is missing in the SFH driver for
> your particular combination.  This also agrees with comment #3 above.

Let me know if you need any test or other things to help you resolve the bug. 

Cheers,
Laurence
Comment 31 Mehmet 2022-11-28 02:06:10 UTC
Was there any improvement on this issue since ?
Comment 32 Luís Zilhão 2023-03-09 21:20:14 UTC
Hello,

I can confirm I have the same issue. The accelerometer data was always at 0, after the update to Ubuntu 22.10 with kernel verion 5.19 the sensor no longer shows up, same behavior as Laurence. I am now on version 6.2.1, still the same. 
My laptop is an HP Envy x360 13-ay0010np, AMD Ryzen 5 4500U

Anything I can do to help?
Comment 33 Mario Limonciello (AMD) 2023-03-10 01:01:33 UTC
https://github.com/torvalds/linux/commit/b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b

This is the commit that changed the behavior to make the sensors not show up if they don't work.  There was a regression from that and so this commit went in to help that regression.

https://github.com/torvalds/linux/commit/7bcfdab3f0c6672ca52be3cb65a0550d8b99554b
Comment 34 Joe 2023-04-17 14:25:53 UTC
I can confirm the bug of rotation not working as well on an HP ENVY x360 Convertible 13-ay0xxxxx. Is there anything one can provide to further support fixing this issue?
If I read the comments correctly, the issue wasn't resolved yet as the sensor doesn't work in all cases. If it doesn't, it simply gets ignored. This seems like a temporary fix to me. Is there any more progress regarding this issue?
Comment 35 Firnin 2023-04-21 10:24:02 UTC
I can confirm this bug on HP Envy x360 15-eu0xxx
Comment 36 Firnin 2023-04-21 10:26:04 UTC
I can confirm this bug on HP Envy x360 15-eu0xxx
Comment 37 zymphad 2023-07-16 19:34:59 UTC
Is there a fix for this incoming?  HP HP Envy x360 2-in-1 Laptop 15-fh0xxx
Comment 38 gregory.clemenceau 2023-10-08 15:10:00 UTC
Hi,
I confirm this bug on HP Envy x360 15-ey0xxx with kernel "Linux arch 6.5.5-arch1-1" (last bios).
No sensor.

In the meantime, I made a shortcut :
gsettings set org.gnome.mutter.keybindings rotate-monitor "['XF86RotateWindows', '<Control>F12']"
But it's unfortunate to have a convertible screen and not be able to use it normally.
Best regards,
Comment 39 gregory.clemenceau 2023-10-08 15:23:52 UTC
For bios information:
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009efff] usable
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x000000000009f000-0x00000000000bffff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x0000000000100000-0x0000000009beffff] usable
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x0000000009bf0000-0x0000000009dfffff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x0000000009e00000-0x0000000009efffff] usable
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x0000000009f00000-0x0000000009f0efff] ACPI NVS
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x0000000009f0f000-0x00000000c5f7efff] usable
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000c5f7f000-0x00000000caf7efff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000caf7f000-0x00000000cdf7efff] ACPI NVS
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000cdf7f000-0x00000000cdffefff] ACPI data
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000cdfff000-0x00000000cdffffff] usable
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000ce000000-0x00000000cfffffff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000f8000000-0x00000000fbffffff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000fde00000-0x00000000fdefffff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000fe000000-0x00000000fe0fffff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec01fff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000fec10000-0x00000000fec10fff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000fec20000-0x00000000fec20fff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000fed80000-0x00000000fed81fff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x00000000ff000000-0x00000000ffffffff] reserved
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x0000000100000000-0x000000040e2fffff] usable
oct. 08 14:24:33 arch kernel: BIOS-e820: [mem 0x000000040e300000-0x000000042fffffff] reserved
oct. 08 14:24:33 arch kernel: efi: ACPI=0xcdffe000 ACPI 2.0=0xcdffe014 ESRT=0xb1ce8b18 TPMFinalLog=0xcdf40000 SMBIOS=0xc961a000 SMBIOS 3.0=0xc9618000 MEMATTR=0xb2ab1018 INITRD=0xb257eb18 RNG=0xcdfdd018 TPMEventLog=0xb2577018 
oct. 08 14:24:33 arch kernel: SMBIOS 3.3.0 present.
oct. 08 14:24:33 arch kernel: DMI: HP HP ENVY x360 2-in-1 Laptop 15-ey0xxx/8A31, BIOS F.14 07/05/2023
oct. 08 14:24:33 arch kernel: acpi PNP0A08:00: FADT indicates ASPM is unsupported, using BIOS configuration
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: Fetched VBIOS from VFCT
oct. 08 14:24:33 arch kernel: amdgpu: ATOM BIOS: 113-BARCELO-004
oct. 08 14:24:34 arch kernel: ccp 0000:04:00.2: ccp: unable to access the device: you might be running a broken BIOS
Comment 40 gregory.clemenceau 2023-10-08 15:26:16 UTC
For amd information:
oct. 08 14:24:33 arch kernel: RAMDISK: [mem 0xaed71000-0xb1027fff]
oct. 08 14:24:33 arch kernel: AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR0, rdevid:160
oct. 08 14:24:33 arch kernel: AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR1, rdevid:160
oct. 08 14:24:33 arch kernel: AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR2, rdevid:160
oct. 08 14:24:33 arch kernel: AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR3, rdevid:160
oct. 08 14:24:33 arch kernel: AMD-Vi: Using global IVHD EFR:0x206d73ef22254ade, EFR2:0x0
oct. 08 14:24:33 arch kernel: smpboot: CPU0: AMD Ryzen 7 5825U with Radeon Graphics (family: 0x19, model: 0x50, stepping: 0x0)
oct. 08 14:24:33 arch kernel: Performance Events: Fam17h+ core perfctr, AMD PMU driver.
oct. 08 14:24:33 arch kernel: pci 0000:00:00.2: AMD-Vi: IOMMU performance counters supported
oct. 08 14:24:33 arch kernel: pci 0000:00:00.2: AMD-Vi: Found IOMMU cap 0x40
oct. 08 14:24:33 arch kernel: AMD-Vi: Extended features (0x206d73ef22254ade, 0x0): PPR X2APIC NX GT IA GA PC GA_vAPIC
oct. 08 14:24:33 arch kernel: AMD-Vi: Interrupt remapping enabled
oct. 08 14:24:33 arch kernel: AMD-Vi: X2APIC enabled
oct. 08 14:24:33 arch kernel: AMD-Vi: Virtual APIC enabled
oct. 08 14:24:33 arch kernel: perf: AMD IBS detected (0x000003ff)
oct. 08 14:24:33 arch kernel: perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4 counters/bank).
oct. 08 14:24:33 arch kernel: AMD-Vi: AMD IOMMUv2 loaded and initialized
oct. 08 14:24:33 arch kernel: [drm] amdgpu kernel modesetting enabled.
oct. 08 14:24:33 arch kernel: amdgpu: CRAT table disabled by module option
oct. 08 14:24:33 arch kernel: amdgpu: Virtual CRAT table created for CPU
oct. 08 14:24:33 arch kernel: amdgpu: Topology: Add CPU node
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: enabling device (0006 -> 0007)
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: Fetched VBIOS from VFCT
oct. 08 14:24:33 arch kernel: amdgpu: ATOM BIOS: 113-BARCELO-004
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: vgaarb: deactivate vga console
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: Trusted Memory Zone (TMZ) feature enabled
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: MODE2 reset
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: VRAM: 512M 0x000000F400000000 - 0x000000F41FFFFFFF (512M used)
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: GART: 1024M 0x0000000000000000 - 0x000000003FFFFFFF
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: AGP: 267419648M 0x000000F800000000 - 0x0000FFFFFFFFFFFF
oct. 08 14:24:33 arch kernel: [drm] amdgpu: 512M of VRAM memory ready
oct. 08 14:24:33 arch kernel: [drm] amdgpu: 7649M of GTT memory ready.
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: Will use PSP to load VCN firmware
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: RAS: optional ras ta ucode is not available
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: RAP: optional rap ta ucode is not available
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: SECUREDISPLAY: securedisplay ta ucode is not available
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: SMU is initialized successfully!
oct. 08 14:24:33 arch kernel: amdgpu: HMM registered 512MB device memory
oct. 08 14:24:33 arch kernel: kfd kfd: amdgpu: Allocated 3969056 bytes on gart
oct. 08 14:24:33 arch kernel: kfd kfd: amdgpu: Total number of KFD nodes to be created: 1
oct. 08 14:24:33 arch kernel: amdgpu: Virtual CRAT table created for GPU
oct. 08 14:24:33 arch kernel: amdgpu: Topology: Add dGPU node [0x15e7:0x1002]
oct. 08 14:24:33 arch kernel: kfd kfd: amdgpu: added device 1002:15e7
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: SE 1, SH per SE 1, CU per SH 8, active_cu_number 8
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring gfx uses VM inv eng 0 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring gfx_low uses VM inv eng 1 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring gfx_high uses VM inv eng 4 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring comp_1.0.0 uses VM inv eng 5 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring comp_1.1.0 uses VM inv eng 6 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring comp_1.2.0 uses VM inv eng 7 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring comp_1.3.0 uses VM inv eng 8 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring comp_1.0.1 uses VM inv eng 9 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring comp_1.1.1 uses VM inv eng 10 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring comp_1.2.1 uses VM inv eng 11 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring comp_1.3.1 uses VM inv eng 12 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring kiq_0.2.1.0 uses VM inv eng 13 on hub 0
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring sdma0 uses VM inv eng 0 on hub 8
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring vcn_dec uses VM inv eng 1 on hub 8
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring vcn_enc0 uses VM inv eng 4 on hub 8
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring vcn_enc1 uses VM inv eng 5 on hub 8
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: amdgpu: ring jpeg_dec uses VM inv eng 6 on hub 8
oct. 08 14:24:33 arch kernel: [drm] Initialized amdgpu 3.54.0 20150101 for 0000:04:00.0 on minor 1
oct. 08 14:24:33 arch kernel: fbcon: amdgpudrmfb (fb0) is primary device
oct. 08 14:24:33 arch kernel: amdgpu 0000:04:00.0: [drm] fb0: amdgpudrmfb frame buffer device
oct. 08 14:24:34 arch kernel: pcie_mp2_amd 0000:04:00.7: enabling device (0000 -> 0002)
oct. 08 14:24:34 arch kernel: input: ELAN2513:00 04F3:2F96 Touchscreen as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input7
oct. 08 14:24:34 arch kernel: input: ELAN2513:00 04F3:2F96 as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input8
oct. 08 14:24:34 arch kernel: input: ELAN2513:00 04F3:2F96 as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input9
oct. 08 14:24:34 arch kernel: input: ELAN2513:00 04F3:2F96 Stylus as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input10
oct. 08 14:24:34 arch kernel: input: ELAN2513:00 04F3:2F96 Keyboard as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input11
oct. 08 14:24:34 arch kernel: input: ELAN2513:00 04F3:2F96 Mouse as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input12
oct. 08 14:24:34 arch kernel: input: ELAN2513:00 04F3:2F96 as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input14
oct. 08 14:24:34 arch kernel: input: ELAN2513:00 04F3:2F96 as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input15
oct. 08 14:24:34 arch kernel: input: ELAN2513:00 04F3:2F96 as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input16
oct. 08 14:24:34 arch systemd[1]: Starting Load/Save Screen Backlight Brightness of backlight:amdgpu_bl1...
oct. 08 14:24:34 arch kernel: input: SYNA32CB:00 06CB:CE7D Mouse as /devices/platform/AMDI0010:03/i2c-2/i2c-SYNA32CB:00/0018:06CB:CE7D.0003/input/input18
oct. 08 14:24:34 arch kernel: input: SYNA32CB:00 06CB:CE7D Touchpad as /devices/platform/AMDI0010:03/i2c-2/i2c-SYNA32CB:00/0018:06CB:CE7D.0003/input/input19
oct. 08 14:24:34 arch systemd[1]: Finished Load/Save Screen Backlight Brightness of backlight:amdgpu_bl1.
oct. 08 14:24:35 arch kernel: snd_hda_intel 0000:04:00.1: bound 0000:04:00.0 (ops amdgpu_dm_audio_component_bind_ops [amdgpu])
oct. 08 14:24:35 arch kernel: kvm_amd: TSC scaling supported
oct. 08 14:24:35 arch kernel: kvm_amd: Nested Virtualization enabled
oct. 08 14:24:35 arch kernel: kvm_amd: Nested Paging enabled
oct. 08 14:24:35 arch kernel: kvm_amd: Virtual VMLOAD VMSAVE supported
oct. 08 14:24:35 arch kernel: kvm_amd: Virtual GIF supported
oct. 08 14:24:35 arch kernel: kvm_amd: LBR virtualization supported
oct. 08 14:24:35 arch kernel: input: ELAN2513:00 04F3:2F96 as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input26
oct. 08 14:24:35 arch kernel: input: ELAN2513:00 04F3:2F96 UNKNOWN as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input27
oct. 08 14:24:35 arch kernel: input: ELAN2513:00 04F3:2F96 UNKNOWN as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input28
oct. 08 14:24:35 arch kernel: input: ELAN2513:00 04F3:2F96 Stylus as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input29
oct. 08 14:24:35 arch kernel: input: ELAN2513:00 04F3:2F96 Keyboard as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input30
oct. 08 14:24:35 arch kernel: input: ELAN2513:00 04F3:2F96 Mouse as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input31
oct. 08 14:24:35 arch kernel: input: ELAN2513:00 04F3:2F96 UNKNOWN as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input33
oct. 08 14:24:35 arch kernel: input: ELAN2513:00 04F3:2F96 UNKNOWN as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input34
oct. 08 14:24:35 arch kernel: input: ELAN2513:00 04F3:2F96 UNKNOWN as /devices/platform/AMDI0010:03/i2c-2/i2c-ELAN2513:00/0018:04F3:2F96.0002/input/input35
oct. 08 14:24:35 arch kernel: input: SYNA32CB:00 06CB:CE7D Mouse as /devices/platform/AMDI0010:03/i2c-2/i2c-SYNA32CB:00/0018:06CB:CE7D.0003/input/input37
oct. 08 14:24:35 arch kernel: input: SYNA32CB:00 06CB:CE7D Touchpad as /devices/platform/AMDI0010:03/i2c-2/i2c-SYNA32CB:00/0018:06CB:CE7D.0003/input/input38
oct. 08 14:24:36 arch gnome-shell[775]: Added device '/dev/dri/card1' (amdgpu) using atomic mode setting.
oct. 08 14:24:39 arch kernel: pcie_mp2_amd 0000:04:00.7: Failed to discover, sensors not enabled is 0
oct. 08 14:24:39 arch kernel: pcie_mp2_amd: probe of 0000:04:00.7 failed with error -95
oct. 08 14:24:41 arch gnome-shell[1297]: Added device '/dev/dri/card1' (amdgpu) using atomic mode setting
Comment 41 Mek101 2023-10-29 10:37:14 UTC
The bug seems to be solved on the Lenovo 14ALC05 with Kernel 6.5.5 (Ryzen 3 5300U)
Comment 42 Mauricio Collares 2023-11-02 16:56:18 UTC
Created attachment 305349 [details]
sensors missing from udevadm info --export-db after b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b

(In reply to Mario Limonciello (AMD) from comment #33)
> https://github.com/torvalds/linux/commit/
> b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b
> 
> This is the commit that changed the behavior to make the sensors not show up
> if they don't work.  There was a regression from that and so this commit
> went in to help that regression.
> 
> https://github.com/torvalds/linux/commit/
> 7bcfdab3f0c6672ca52be3cb65a0550d8b99554b

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.

I'd be happy to provide any information that might be useful.
Comment 43 Mauricio Collares 2023-11-02 17:54:05 UTC
Forgot to mention the most important piece of context: Screen autorotation continues not to work as of 6.6.0-rc7, exhibiting the same behavior as b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b.
Comment 44 Mario Limonciello (AMD) 2023-11-02 20:55:05 UTC
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.
Comment 45 Laurence Bonat 2023-11-02 21:53:15 UTC
I tried again with kernel v6.5.7 and still had no success. Will try to apply a patch to revert that commit and see what will do on my ryzen 4700u. I still think that the problem is not resolved for these hp envy x360 models.
Comment 46 Mauricio Collares 2023-11-03 08:00:20 UTC
Created attachment 305352 [details]
amd_s2idle.py report on stock 6.6

(In reply to Mario Limonciello (AMD) from comment #44)
> 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.

Thanks for the reply! Reverting the commit on top of 6.6 makes screen autorotation work again. 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. Also, the content of /sys/power/mem_sleep is "s2idle [deep]". I have 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 47 Laurence Bonat 2023-11-05 10:53:49 UTC
Created attachment 305367 [details]
outputs of various commands describing the problem
Comment 48 Laurence Bonat 2023-11-05 11:08:18 UTC
(In reply to Mauricio Collares from comment #43)
> Forgot to mention the most important piece of context: Screen autorotation
> continues not to work as of 6.6.0-rc7, exhibiting the same behavior as
> b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b.

Hi, I tried seeing if there where any improvements on my x360 ay0xxx convertible. 
On kernel 6.5.7 I had the same regression problem that Mauricio reported. 
So I tried to patch up kernel 6.6 with the revert of commit b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b, and monitor-sensor gives me this output: 
* Waiting for iio-sensor-proxy to appear
* +++ iio-sensor-proxy appeared
* === Has accelerometer (orientation: undefined)
* === No ambient light sensor
* === No proximity sensor

The problem I find is that the accelerometer cannot understand in which orientation is. I produced some more outputs using iio-sensor-proxy, that I have attached with the text file in comment #47. 

Notice that iio_generic_buffer gives in output always zeros:
* iio device number being used is 0
* iio trigger number being used is 0
* Enabling all channels
* Enabling: in_accel_x_en
* Enabling: in_accel_z_en
* Enabling: in_timestamp_en
* Enabling: in_accel_y_en
* /sys/bus/iio/devices/iio:device0 accel_3d-dev0
* 0.000000 0.000000 0.000000 1699106706297920691
* 0.000000 0.000000 0.000000 1699106706502232745
* 0.000000 0.000000 0.000000 1699106706705918733

I suppose that the matrix of the accelerometer is not initialized correctly, or even the sensor-mask. 

I attached the output of iio-sensor-proxy, and even that has some errors: 
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.755: Found associated trigger at /sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/trigger0
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.755: Found IIO buffer accelerometer at /sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/iio:device0
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.755: No auto-detected location, falling back to display location
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.755: Found device /sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/iio:device0 of type accelerometer at IIO Buffer accelerometer
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.764: Found associated trigger at /sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/trigger0
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.764: Already enabled sensor /sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/scan_elements/in_accel_x_en
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.764: Already enabled sensor /sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/scan_elements/in_accel_z_en
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.764: Already enabled sensor /sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/scan_elements/in_timestamp_en
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.765: Already enabled sensor /sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/scan_elements/in_accel_y_en
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.765: Trying to read 'in_accel_x_scale' (name) from dir '/sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/iio:device0'
** (iio-sensor-proxy:2949): DEBUG: 14:53:08.765: Failed to read float from /sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_accel_x_scale: Failed to open file “/sys/devices/0020:1022:0001.0001/HID-SENSOR-200073.1.auto/iio:device0/in_accel_x_scale”: No such file or directory

The problem I encounter I think is related to how the sensor-mask is loaded, and I don't understand how to fix it. 
As already discussed, in windows the drivers correctly rotates the screen. 
If any other information is needed please contact me, I really want the rotation to work on my pc.

Thanks, 
Laurence
Comment 49 Mauricio Collares 2023-11-05 12:13:23 UTC
Thanks to Laurence's previous comment, I now realize I should have filed a new bug instead, because my issue has different symptoms: after reverting b300667b33b2b5a2c8e5f8f22826befb3d7f4f2b `monitor-sensor` reports "=== Has accelerometer (orientation: normal)" and `iio_generic_buffer --device-num 2 -A -c 100` reports good accelerometer values. 

I have filed bug #218104 to track my issue. Apologies if you were inadvertently CC'd into it by the "Clone bug" feature.

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