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: 2022-11-28 02:06 UTC (History)
16 users (show)

See Also:
Kernel Version: 5.19-rc6
Tree: Mainline
Regression: No


Attachments

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 ?

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