Skip to contentSkip to conversation

hp_accel: probe of HPQ6007:00 failed with error -22 (HP Envy x360)

Bug 199715 [email protected] 2 participants 43 messages Jan 16, 2021 – Mar 17 1 message not in the archive x86 platform drivers

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]/

#1 lore raw

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #24 from Luya Tshimbalanga ([email protected]) --- Testing the latest kernel 5.11.0-0.rc3.20210114git65f0d2414b70 snapshot with amd_sfh module enabled:

lspci -knn
03:00.7 Non-VGA unclassified device [0000]: Advanced Micro Devices, Inc. [AMD] Raven/Raven2/Renoir Sensor Fusion Hub [1022:15e4]
Subsystem: Hewlett-Packard Company Device [103c:8497] Kernel driver in use: pcie_mp2_amd
Kernel modules: amd_sfh

lsmod | grep amd

edac_mce_amd           90112  0
kvm_amd               380928  0
kvm                  2207744  1 kvm_amd
amdgpu              19922944  16
drm_ttm_helper         16384  1 amdgpu
ttm                   188416  2 amdgpu,drm_ttm_helper
iommu_v2               36864  1 amdgpu
gpu_sched              86016  1 amdgpu
i2c_algo_bit           28672  1 amdgpu
drm_kms_helper        638976  1 amdgpu
drm                  1359872  19
gpu_sched,drm_kms_helper,amdgpu,drm_ttm_helper,ttm
ccp                   274432  1 kvm_amd
amd_sfh                36864  0
pinctrl_amd            73728  1

modinfo amd_sfh
filename:
/lib/modules/5.11.0-0.rc3.20210114git65f0d2414b70.125.amdsfh.fc33.x86_64/kernel/drivers/hid/amd-sfh-hid/amd_sfh.ko.xz

author:         Sandeep Singh <[email protected]>
author:         Shyam Sundar S K <[email protected]>
license:        Dual BSD/GPL
description:    AMD(R) PCIe MP2 Communication Driver
rhelversion:    8.99
alias:          pci:v00001022d000015E4sv*sd*bc*sc*i*
depends:        
retpoline:      Y
intree:         Y
name:           amd_sfh
vermagic:       5.11.0-0.rc3.20210114git65f0d2414b70.125.amdsfh.fc33.x86_64 SMP

mod_unload

monitor-sensors failed to detect sensor fusion

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#2 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #25 from Richard Neumann ([email protected]) --- @Luya This is due to the fact that you, like me, use a laptop (HP Enxy x360 13-ag00xxx) which ships with an AMD SFH that has no sensor mask written to its P2C registers. I discussed this on the mailing lists and proposed and provided a solution by introducing a kernel module parameter [1]. However this was not adopted in the upstream version for kernel 5.11. So I submitted my refactored version, which I am using for nearly a year now, which incorporates such a parameter [2]. I have not yet received any feedback on this one or the first submission, which I sent two weeks ago and which seemingly directly went into /dev/null. Anybody interested to review and possibly use my refactored version, can obtain it from my github repo [3].

[1]
https://patchwork.kernel.org/project/linux-iio/patch/[email protected]/#23253155
[2]https://patchwork.kernel.org/project/linux-iio/patch/efa4524cd07abe0a7773b24d33b64f09e0bf1f82.camel@richard-neumann.de/
[3] https://github.com/conqp/linux/tree/amd-sfh-hid/drivers/hid/amd-sfh-hid

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#3 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

Hans de Goede ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

                 CC|                            |[email protected]
                   |                            |g

--- Comment #26 from Hans de Goede ([email protected]) --- Hi Richard,

Thank you for your work on this.

I took a look at your patch-series from 2:
https://patchwork.kernel.org/project/linux-iio/patch/efa4524cd07abe0a7773b24d33b64f09e0bf1f82.camel@richard-neumann.de/

And there are several big issues with it:

1) It seems to have only been send to the linux-iio mailing-list, while it mostly touches files under drivers/hid. So the HID maintainers did not see it and the iio maintainers are likely ignore it because it is not an IIO patch

2) You seem to have build an top of an older version of the amd-sfh driver and instead of porting your changes to the new version, your series seems to completely replace the currently upstream version with your version. A patch series like this will never be accepted upstream. You need to submit a patch upstream with a small incremental change on top of the upstream version of the driver. E.g. submit a patch just adding the module parameter.

I've prepared a patch-set which adds a module parameter for the sensor-mask on top of the current upstream version of the amd-sfh code, without making any further changes. I'll attach that here, please test.

2 questions:

1. may I ask what sensor_mask_override value you are using? That will be useful for Luya to test this on his device, as well as for adding a DMI quirk to automatically do the right thing in the future.

2. Can you please run (as normal user):

grep . /sys/class/dmi/id/* 2> /dev/null

and copy and paste the output here? We will need to come up with some way to make this "just work" for end-users without needing to set the module-parameter and it is likely that this will be based on a DMI quirk table, so it would be good to have the DMI strings for your model.

Luya, I will build a Fedora kernel for you with the patches added. I will post a link to that in the Fedora bug you filed for this; and Luya, can you also provide the output of 'grep . /sys/class/dmi/id/* 2> /dev/null' please?

Regards,

Hans

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#4 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #27 from Hans de Goede ([email protected]) --- Created attachment 294691
--> https://bugzilla.kernel.org/attachment.cgi?id=294691&action=edit
[PATCH 1/2] AMD_SFH: Removed unused activecontrolstatus member from the amd_mp2_dev struct

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#5 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #28 from Hans de Goede ([email protected]) --- Created attachment 294693
--> https://bugzilla.kernel.org/attachment.cgi?id=294693&action=edit
[PATCH 2/2] AMD_SFH: Add sensor_mask module parameter

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#6 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #29 from Luya Tshimbalanga ([email protected]) --- (In reply to Hans de Goede from comment #26)
...

Quoted 4 lines

Luya, I will build a Fedora kernel for you with the patches added. I will post a link to that in the Fedora bug you filed for this; and Luya, can you also provide the output of 'grep . /sys/class/dmi/id/* 2> /dev/null' please?

Certainly. Here is the requested output:

grep . /sys/class/dmi/id/* 2> /dev/null

/sys/class/dmi/id/bios_date:07/03/2020
/sys/class/dmi/id/bios_release:15.47
/sys/class/dmi/id/bios_vendor:AMI
/sys/class/dmi/id/bios_version:F.47
/sys/class/dmi/id/board_asset_tag:Base Board Asset Tag
/sys/class/dmi/id/board_name:8497
/sys/class/dmi/id/board_vendor:HP
/sys/class/dmi/id/board_version:92.48
/sys/class/dmi/id/chassis_type:31
/sys/class/dmi/id/chassis_vendor:HP
/sys/class/dmi/id/chassis_version:Chassis Version
/sys/class/dmi/id/ec_firmware_release:92.48 /sys/class/dmi/id/modalias:dmi:bvnAMI:bvrF.47:bd07/03/2020:br15.47:efr92.48:svnHP:pnHPENVYx360Convertible15-cp0xxx:pvr:rvnHP:rn8497:rvr92.48:cvnHP:ct31:cvrChassisVersion:
/sys/class/dmi/id/product_family:103C_5335KV HP Envy
/sys/class/dmi/id/product_name:HP ENVY x360 Convertible 15-cp0xxx
/sys/class/dmi/id/product_sku:4BQ00UA#ABL
/sys/class/dmi/id/sys_vendor:HP /sys/class/dmi/id/uevent:MODALIAS=dmi:bvnAMI:bvrF.47:bd07/03/2020:br15.47:efr92.48:svnHP:pnHPENVYx360Convertible15-cp0xxx:pvr:rvnHP:rn8497:rvr92.48:cvnHP:ct31:cvrChassisVersion:

Thank you for addressing the bug report, Hans!

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#7 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #30 from Richard Neumann ([email protected]) --- @Hans Thank you for your input.

First, here is the requested output:

$ cat /etc/modprobe.d/amd_sfh.conf 
options amd_sfh_hid sensor_mask=524295
$ grep . /sys/class/dmi/id/* 2> /dev/null
/sys/class/dmi/id/bios_date:11/15/2019
/sys/class/dmi/id/bios_release:15.46
/sys/class/dmi/id/bios_vendor:AMI
/sys/class/dmi/id/bios_version:F.46
/sys/class/dmi/id/board_asset_tag:Base Board Asset Tag
/sys/class/dmi/id/board_name:8496
/sys/class/dmi/id/board_vendor:HP
/sys/class/dmi/id/board_version:92.48
/sys/class/dmi/id/chassis_type:31
/sys/class/dmi/id/chassis_vendor:HP
/sys/class/dmi/id/chassis_version:Chassis Version
/sys/class/dmi/id/ec_firmware_release:92.48
/sys/class/dmi/id/modalias:dmi:bvnAMI:bvrF.46:bd11/15/2019:br15.46:efr92.48:svnHP:pnHPENVYx360Convertible13-ag0xxx:pvr:rvnHP:rn8496:rvr92.48:cvnHP:ct31:cvrChassisVersion:
/sys/class/dmi/id/product_family:103C_5335KV HP Envy
/sys/class/dmi/id/product_name:HP ENVY x360 Convertible 13-ag0xxx
/sys/class/dmi/id/product_sku:4JS64EA#ABD
/sys/class/dmi/id/sys_vendor:HP
/sys/class/dmi/id/uevent:MODALIAS=dmi:bvnAMI:bvrF.46:bd11/15/2019:br15.46:efr92.48:svnHP:pnHPENVYx360Convertible13-ag0xxx:pvr:rvnHP:rn8496:rvr92.48:cvnHP:ct31:cvrChassisVersion:

Regarding the driver. Yes, it is completely refactored version that is close to a re-write. I posted it to the IIO mailing list, since this is where the original driver was also posted and discussed.
I realize that I made a lot of changes, but I am confident, that my code base has a cleaner approach, since it utilizes the respective start, stop, open and close functions of the HID LL API and contains less (if even any) unused code and data structures. It is up to the maintainers whether they accept it, request changes or whatnot. I've done my part and am happy using my clean and stable implementation, that btw. is also used by other Arch Linux users with my DKMS package in the AUR. I unsuccessfully tried to make changes to the upstream driver during its development, which were ignored by both the devs and the maintainers. Refactoring the driver to clean it up, make it integrate seamlessly with the kernel APIs and providing the params to make it configurable on devices where the manufacturers screwed up was challenging, interesting and mostly a fun experience. Getting my work upstream, frankly, not so much.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#8 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #31 from Hans de Goede ([email protected]) --- (In reply to Richard Neumann from comment #30)

Quoted 2 lines
$ cat /etc/modprobe.d/amd_sfh.conf 
options amd_sfh_hid sensor_mask=524295

Ok, so that translates to:

options amd_sfh_hid sensor_mask=0x80007

So you are enabling all 4 sensors:

#define ACEL_EN         BIT(0)
#define GYRO_EN         BIT(1)
#define MAGNO_EN        BIT(2)
#define ALS_EN          BIT(19)

I assume that you have verified that all 4 work?

Note that you can actually use hex-values (prefixed with 0x) when setting integer module parameters, that typically make things easier to parse in cases where the integer is a bitmask like this case.

Quoted 4 lines

Refactoring the driver to clean it up, make it integrate seamlessly with the kernel APIs and providing the params to make it configurable on devices where the manufacturers screwed up was challenging, interesting and mostly a fun experience. Getting my work upstream, frankly, not so much.

May I ask you to at least consider re-posting the series as is with the email going to the right people:

[hans@x1 linux]$ scripts/get_maintainer.pl -f drivers/hid/amd-sfh-hid/amd_sfh_pcie.c
Nehal Shah <[email protected]> (maintainer:AMD SENSOR FUSION HUB DRIVER)
Sandeep Singh <[email protected]> (maintainer:AMD SENSOR FUSION HUB DRIVER) Jiri Kosina <[email protected]> (maintainer:HID CORE LAYER) Benjamin Tissoires <[email protected]> (maintainer:HID CORE LAYER) [email protected] (open list:AMD SENSOR FUSION HUB DRIVER)

With a cover letter why you believe that your version is better / cleaner ?

Note you will very probably still be asked to refactor your work so that it will consist of incremental patches which slowly moves the existing driver to your version. But this way at least the maintainers will be aware that there is room for improvement, because I'm pretty sure that they will not have seen the posting to the linux-iio list.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#10 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #33 from Richard Neumann ([email protected]) --- @Hans "work" is a relative term here. They are all recognized and started. Going into details would go beyond the scope of this thread, I think. dmesg excerpt:

[   10.855774] amd-sfh-pci 0000:04:00.7: Sensor mask: 0x80007
[   10.856054] hid-generic 0018:03FE:0001.0002: hidraw1: I2C HID v0.01 Device
[accelerometer] on AMD Sensor Fusion Hub (PCIe)
[   10.856325] hid-generic 0018:03FE:0001.0003: hidraw2: I2C HID v0.01 Device
[gyroscope] on AMD Sensor Fusion Hub (PCIe)
[   10.856614] hid-generic 0018:03FE:0001.0004: hidraw3: I2C HID v0.01 Device
[magnetometer] on AMD Sensor Fusion Hub (PCIe)
[   10.856893] hid-generic 0018:03FE:0001.0005: hidraw4: I2C HID v0.01 Device

[ambient light sensor] on AMD Sensor Fusion Hub (PCIe)

I am only *using* the accelerometer, so a mask of "1" or "0x1" respectively would suffice.

Testing the other sensors is non-trivial. I branched my refactored version of the driver to extend it with an API to allow for reverse-engineering the PCI device to detect other sensors. But again, this maybe something to discuss in another place (or write a paper about :p).

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#11 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #34 from Hans de Goede ([email protected]) --- (In reply to Richard Neumann from comment #33)

Quoted 1 line

They are all recognized

That does not mean anything since the HID descriptors are provided by the amd_fsh driver itself, so of course they describe a valid gyroscope and magnetometer.

Quoted 1 line

Testing the other sensors is non-trivial.

Testing the ALS sensor actually should be easy, I assume that you have iio-sensor-proxy installed (that is what is typically used to do accelerometer based auto-display-rotation) ? Then you can just run monitor-sensor and it will print the ALS readings and then moving the laptop from a dark environment (say inside in a room with the blinds closed) to a light environment (say outside) should lead to significant different readings, with the outside readings being significantly higher.

As you indicate there are not really any userspace consumers of the gyroscope and
magnetometer so testing those might be harder, although I think that monitor-sensor probably also prints magnetometer readings. And that should behave as a compass so if you stand upright, holding the laptop and then spin around the axis from your head to your feet, then those should change.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#12 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #35 from Richard Neumann ([email protected]) --- Okay, given this context, I can say, that the ALS does *not* work, as it always returns 0.0 on my machine. That is with my refactored version and all driver versions up until v8 from the upstream version. Maybe Luya can confirm that. The magnetometer and gyroscope produce varying input data with my debug version, but as you correctly stated, there is nothing in the userspace that I am aware of, that can make use of this data.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#13 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #36 from Dimitris ([email protected]) --- I've just tested Richard's Arch Linux DKMS package on my Envy x360 13-ag0xxx, with the module options in comment #31 and monitor-sensor displays only accelerometer data correctly. It states that the ALS is recognized but reports 0 lux ambience in a sun-lit room, and that value doesn't change when I change rooms.

I'm available to test sensors and modules on my laptop.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#14 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #37 from Richard Neumann ([email protected]) --- @Dimitris, @Luya can you test the ALS with the latest upstream version stages for kernel 5.11, so we can rule out that this is a bug in my refactored version? I currently have no time to build and test the upstream driver.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#15 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #39 from Richard Neumann ([email protected]) --- I just tried to test the latest staged upstream version, but it does not even build:

make: Entering directory '/usr/lib/modules/5.10.7-zen1-1-zen/build'

  CC [M]  /var/lib/dkms/amd-sfh-hid/1.0.3/build/amd_sfh_hid.o
  CC [M]  /var/lib/dkms/amd-sfh-hid/1.0.3/build/amd_sfh_client.o
  CC [M]  /var/lib/dkms/amd-sfh-hid/1.0.3/build/amd_sfh_pcie.o

CC [M]
/var/lib/dkms/amd-sfh-hid/1.0.3/build/hid_descriptor/amd_sfh_hid_desc.o /var/lib/dkms/amd-sfh-hid/1.0.3/build/hid_descriptor/amd_sfh_hid_desc.c:12:10:
fatal error: amd_sfh_pcie.h: No such file or directory
12 | #include "amd_sfh_pcie.h"

      |          ^~~~~~~~~~~~~~~~

compilation terminated.
make[1]: *** [scripts/Makefile.build:279:
/var/lib/dkms/amd-sfh-hid/1.0.3/build/hid_descriptor/amd_sfh_hid_desc.o] Error 1
make: *** [Makefile:1805: /var/lib/dkms/amd-sfh-hid/1.0.3/build] Error 2
make: Leaving directory '/usr/lib/modules/5.10.7-zen1-1-zen/build'

I never understood why they put the hid descriptors in a subdir anyway. I already spent far too much time on this driver. I have my working refactored version. I'll leave the rest for somebody else.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#16 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #43 from Richard Neumann ([email protected]) --- @Luya: That would suggest that this is either a problem with the upstream code, or that our models simply do not have an ALS on the hub. @Dimitris: Sorry about that. I refactored the package yesterday and introduced a bug. I migrated the sensor_mask to an usigned int and thought that a short would suffice, which it didn't. v. 2.8.7 should have this fixed.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#17 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #45 from Hans de Goede ([email protected]) --- I believe that your models simply do not have an ALS sensor.

Luya did also test the magnetometer and gyro bits and reported his results in the Fedora bug about this:
https://bugzilla.redhat.com/show_bug.cgi?id=1651886

"""
Gyroscope
---------
ls /sys/bus/iio/devices/iio\:device0/

buffer/                        in_anglvel_z_raw
dev                            name
in_anglvel_hysteresis          power/
in_anglvel_offset              scan_elements/
in_anglvel_sampling_frequency  subsystem/
in_anglvel_scale               trigger/
in_anglvel_x_raw               uevent

in_anglvel_y_raw

cat /sys/bus/iio/devices/iio\:device0/name
gyro_3d

cat /sys/bus/iio/devices/trigger0/name
gyro_3d-dev0

Gyroscope value returned 0.0.0 (x.y.z)

Magnetometer
------------
ls /sys/bus/iio/devices/iio\:device3/

buffer              in_magn_sampling_frequency  in_magn_z_raw  subsystem
dev                 in_magn_scale               name           trigger
in_magn_hysteresis  in_magn_x_raw               power          uevent
in_magn_offset      in_magn_y_raw               scan_elements

cat /sys/bus/iio/devices/iio\:device3/name
magn_3d

cat /sys/bus/iio/devices/trigger2/name
magn_3d-dev3

Test with cat /sys/bus/iio/devices/iio:device3/in_magn_x_raw successful. Test with cat /sys/bus/iio/devices/iio:device3/in_magn_y_raw successful. Test with cat /sys/bus/iio/devices/iio:device3/in_magn_z_raw successful. """

Where I assume successful for the magn device means that the values changed when doing the following: "For the magneto values (compass) you expect the x and y values to change if you sit the laptop on the desk and then rotate it while keeping it sitting on the desk, while the values should stat more or less the same when you do not move the laptop."

@Richard, can you confirm that your model behaves the same, so working accelerometer and magnetometer, with the gyro and als always reading all 0 ?

I would like to know, so that I can use the right sensor_mask for the DMI quirk for the upstream driver for this.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#18 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #46 from Dimitris ([email protected]) --- @Hans I get 0 on the gyro, the magneto functions correctly (tested with Luya method in comment #45) and the accelerometer also. I have no ALS detected.

My laptop model is Envy x360 13-ag0011nv (P/N: 5VZ54EA).

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#19 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #44 from Dimitris ([email protected]) --- @Richard I just upgraded to v2.8.7, corrected the module's options and now the accelerometer functions correctly, like before.

Today I noticed that monitor-sensors stated that no ambient light sensor was present. If I understand correctly a bitmask of 0x80007 activates all sensors on the hub. So that means that the light sensor would be active too. That would suggest the ag0xxx doesn't have an ALS. I couldn't find any information about whether that line has an ALS on HP support or PartSurfer.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#20 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #47 from Hans de Goede ([email protected]) --- (In reply to Dimitris from comment #46)

Quoted 4 lines

@Hans I get 0 on the gyro, the magneto functions correctly (tested with Luya method in comment #45) and the accelerometer also. I have no ALS detected.

My laptop model is Envy x360 13-ag0011nv (P/N: 5VZ54EA).

Thanks, so that would be a "HP ENVY x360 Convertible 13-ag0xxx" like the one from Richard. Can you confirm that:

cat /sys/class/dmi/id/product_name

Outputs "HP ENVY x360 Convertible 13-ag0xxx" ?

@Richard, no need for you to also test this then.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#21 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #48 from Richard Neumann ([email protected]) ---

$ cat /sys/class/dmi/id/product_name
HP ENVY x360 Convertible 13-ag0xxx
$ for file in /sys/bus/iio/devices/iio\:device0/in_anglvel_*; do echo
"$(basename "${file}"): $(cat "${file}")"; done
in_anglvel_hysteresis: 1.270000
in_anglvel_offset: 0
in_anglvel_sampling_frequency: 12.500000
in_anglvel_scale: 0.000174532
in_anglvel_x_raw: 0
in_anglvel_y_raw: 0
in_anglvel_z_raw: 0
$ for file in /sys/bus/iio/devices/iio\:device1/in_magn_*; do echo "$(basename
"${file}"): $(cat "${file}")"; done
in_magn_hysteresis: 1.270000
in_magn_offset: 0
in_magn_sampling_frequency: 12.500000
in_magn_scale: 0.000001000
in_magn_x_raw: 40
in_magn_y_raw: -14
in_magn_z_raw: -16
$ for file in /sys/bus/iio/devices/iio\:device2/in_accel_*; do echo "$(basename
"${file}"): $(cat "${file}")"; done
in_accel_hysteresis: 1.270000
in_accel_offset: 0
in_accel_sampling_frequency: 12.500000
in_accel_scale: 0.098066500
in_accel_x_raw: 0
in_accel_y_raw: -9
in_accel_z_raw: -5
$ for file in /sys/bus/iio/devices/iio\:device3/in_i*; do echo "$(basename
"${file}"): $(cat "${file}")"; done
cat: '/sys/bus/iio/devices/iio:device3/in_illuminance_hysteresis': Invalid
argument
in_illuminance_hysteresis: 
in_illuminance_offset: 0
in_illuminance_raw: 0
in_illuminance_sampling_frequency: 12.500000
in_illuminance_scale: 0.100000000
in_intensity_both_raw: 0
cat: '/sys/bus/iio/devices/iio:device3/in_intensity_hysteresis': Invalid
argument
in_intensity_hysteresis: 
in_intensity_offset: 0
in_intensity_sampling_frequency: 12.500000
in_intensity_scale: 0.100000000
Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#22 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #42 from Dimitris ([email protected]) --- After updating to kernel v5.10.8.arch1-1 (on Archlinux), and building the latest module from AUR, I got an error during module loading on startup that the bitmask was out of bounds. So I set the bitmask to 0x8007 instead of 0x80007 as in comment #31.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#23 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #49 from Bastien Nocera ([email protected]) --- You might want to use "iio_generic_buffer -A -N 0" for testing instead.

This makes sure that all the triggers are enabled, so that there's hopefully some data coming out of the devices. Substitute the "0" with the IIO device number, the command live in kernel-tools in Fedora.

If you get all zeroes out of the light sensor, it might also be the same problem I've recently reported to the IIO list, which would point to a problem in the common IIO code, rather than a problem with the light sensor in the hid-sensor-hub code.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#26 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

Andy Shevchenko ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #52 from Andy Shevchenko ([email protected]) --- (In reply to Richard Neumann from comment #48)

Quoted 2 lines
$ for file in /sys/bus/iio/devices/iio\:device0/in_anglvel_*; do echo
"$(basename "${file}"): $(cat "${file}")"; done

Just a side note: The above can be much simplified, compare:

grep -H . /sys/bus/iio/devices/iio\:device0/in_anglvel_*

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#27 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #53 from Richard Neumann ([email protected]) --- @Dimitris: The latest version (2.9.0-1) should have this resolved. I tested it successfully on my laptop and all workds as expected. I submitted my refactored version upstream - this time using the correct process:
https://patchwork.kernel.org/project/linux-input/list/?series=420493
Thanks you Any for the hints about the correct submission process.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#28 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #54 from Dimitris ([email protected]) --- (In reply to Richard Neumann from comment #53)

So if I understand correctly, and excuse me but I'm not very familiar with the submission/acceptance of patches from upstream, if your patches get accepted and integrated into the kernel tree, we will be able to get the amd_sfh_hid module on downstream distributions of the kernel? What I mean is, as an end-user, will we be able to just modprobe that module to our running kernel as-is (without rebuilding the kernel) p.ex. in Archlinux, or will we need to recompile the kernel with the relevant driver selected in menuconfig to be built into the kernel?

I think the handling of the issue in the last question lies with the distributions.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#29 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #55 from Richard Neumann ([email protected]) --- @Dimitris. The submitted v8 Version of AMD is already merged into the mainline kernel for v5.11, afaik. So we will definitely get a driver with kernel 5.11. The only problem is, that it does not include an option to override the sensor mask if the manufacturer of the system did not write it into the P2C register as is the case on our HP Envy 13-ag0xxx models.
So the upstream driver is pretty useless to us.

My refactored patch series is a side-project I developed after the initial driver version of AMD was submitted upstream. I repeatedly asked for adding a kernel parameter to be able to override the sensor mask, which was confirmed as a good idea, but was never implemented. So I took a look at the code myself and added it. While I was at it, I encountered some more problems regarding the code structure and DMA handling, that I also reported upstream [1]. I also saw some unused code. So, to challenge myself to improve the driver, I read into the Linux kernel API documentation for the HID subsystem, PCI drivers and platform drivers and re-wrote the patch to what eventually became the patch series that I now submitted upstream.

I understand Hans' concern about the rewrite, but I think that it would benefit the Kernel to share my work on the driver. If the maintainers are reluctant to replace the driver with my changes, that's okay. They can still cherry pick what they regard as improvements on the code.

[1] https://lkml.org/lkml/2020/3/30/157

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#30 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #56 from Richard Neumann ([email protected]) --- @Dimitris, @Luya
I have added DMI-based model detection to my driver [1] (v. 2.9.8 in the AUR). I successfully tested it on my system.
Please make sure that you disable i.e. comment out any sensor override if you want to test whether it works on your systems. The quirk should enable only the accelerometer and magnetometer for the devices that Luya and I posted above.

[1] https://github.com/conqp/amd-sfh-hid-dkms/blob/master/amd-sfh-quirks.c

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#31 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #57 from Dimitris ([email protected]) --- (In reply to Richard Neumann from comment #56)

Quoted 3 lines

@Dimitris, @Luya
I have added DMI-based model detection to my driver [1] (v. 2.9.8 in the AUR).

@Richard works beautifully (I removed the bitmask override)!

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#32 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #58 from Luya Tshimbalanga ([email protected]) --- (In reply to Richard Neumann from comment #56)

Quoted 10 lines

@Dimitris, @Luya
I have added DMI-based model detection to my driver [1] (v. 2.9.8 in the AUR).
I successfully tested it on my system.
Please make sure that you disable i.e. comment out any sensor override if you want to test whether it works on your systems. The quirk should enable only the accelerometer and magnetometer for the devices that Luya and I posted above.

[1] https://github.com/conqp/amd-sfh-hid-dkms/blob/master/amd-sfh-quirks.c

Thanks, I will try it on my Fedora system.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#33 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

Marco ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #60 from Marco ([email protected]) --- (In reply to kernelbugzilla from comment #59)

Quoted 9 lines

FYI, I unsuccessfully tested both the upstream driver and Richard's version on a Renoir device (Ryzen 3 4300U on a Asus Vivobook Flip 14 TM420IA). An accelerometer device is detected, but it returns no data.

Apparently, both drivers are missing a report descriptor for the newer Renoir hardware.

Reference: https://github.com/conqp/amd-sfh-hid-dkms/issues/1 (thanks Richard for the prompt reply there)

On the exact same device, but with a 4500U as of 5.14.11, I do get accelerometer data.

The issues with sensors however is that I do not have an event for the lid flip on this device in order to disable automatically keyboard and trackpad in tablet mode and no way to use an apparently present ALS for automatic brightness (I'm not sure even if this device has one, but I've seen quite a lot of reference to a Capella Micro cm32181 in the DSDT under i2c, and the kernel even load the mentioned driver. No iio data anywhere, though).

If the position of the hinges are derived from two accelerometers (one in the base, the other in the display) I would like to write an implementation around that, but the sensor reports only the one in the display panel and nothing else, so that's really not useful anyway.

However at least I can use display rotation with that.

I really hope that AMD will provide documentation around that or at least will properly support his sensor hub to Ryzen 4/5 devices themselves.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#34 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

Stuart Morgan ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #61 from Stuart Morgan ([email protected]) --- @Richard - it's been nearly a year since any updates to this ticket and zero activity on your github repo since Feb. Are you still fighting to get your fixes upstream, or is this effectively a dead effort?

Even with AMD's own official updates to 5.14 mid-year, the official SFH driver still doesn't work with the AMD 4000 series HP x360 laptops. I'm currently on 5.15.

I personally have an AY007NA (note AY not AG). I'm assuming this to be similar if not identical in behaviour to the AGxxx models and would therefore benefit from the same fixes.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#35 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

Andy Shevchenko ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #62 from Andy Shevchenko ([email protected]) --- Add Mario. Mario, can you pull the strings to unstale this efforts?

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#36 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #63 from Richard Neumann ([email protected]) --- @Stuart
I am no longer interested in getting my refactored version upstream. I tried to follow the upstream development of the driver by AMD to my best abilities, but I've not yet seen further development on "interesting" parts, such as the accelerometer support for the newest-generation sensor hubs or a lid switch driver. So yes, this is basically a dead effort.
If I should have overlooked upstream commits regarding above features, please let me know. I'm still interested in incorporating those into my refactored driver version.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#37 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

Nikos Fytilis ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #64 from Nikos Fytilis ([email protected]) --- Hi, i stumbled across this report through the dkms sfh github issues.

I have a flex 5 with a 4500U and have not installed the dkms module. I am getting in_accel_[xyz]_raw in the sysfs directory of the iio device and they work (i can move the laptop and they change consistantly)

however the buffer0/* files do not change at all. is this the same issue with all of you?

if so, a userland solution could be very easy - basically a edited iio proxy capable of using the raw values.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#38 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #65 from Marco ([email protected]) --- (In reply to Richard Neumann from comment #63)

Quoted 9 lines

@Stuart
I am no longer interested in getting my refactored version upstream. I tried to follow the upstream development of the driver by AMD to my best abilities, but I've not yet seen further development on "interesting" parts, such as the accelerometer support for the newest-generation sensor hubs or a lid switch driver. So yes, this is basically a dead effort.
If I should have overlooked upstream commits regarding above features, please let me know. I'm still interested in incorporating those into my refactored driver version.

When I saw recently that you added lid switch support and I've got my hopes up in believing that at least that piece was fixed. Then I remembered that it unfortunately doesn't work under Ryzen 4000+ devices. I thought that the issue was on asus_nb_wmi driver, but there is no data for the lid sensor, I've just recently confirmed when I had a copy of Windows and removed the AMD UMDF Sensor driver. The automatic keyboard disabler was gone.

Essentially with the upstream kernel driver I have accelerometer data, but no lid switch. With yours unfortunately I haven't both.

I don't really get why they can't release documentation on this device if they do not want to support in Linux properly, frankly.

Hope that someone will be able to fix it,

Marco.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#39 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #66 from Alex Deucher ([email protected]) --- Several fixes to the SFH driver from the last month:

https://lore.kernel.org/linux-input/[email protected]/T/#mfbe03bd36befb510c347417aab9fecb911dec946

https://lore.kernel.org/linux-input/[email protected]/

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#40 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #67 from Alex Deucher ([email protected]) --- Support for newer platforms was added last year:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0aad9c95eb9a2b086322e28ae2e58ad25598604e

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#41 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

--- Comment #68 from Marco ([email protected]) --- (In reply to Alex Deucher from comment #67)

Quoted 3 lines

Support for newer platforms was added last year:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/
?id=0aad9c95eb9a2b086322e28ae2e58ad25598604e

As said above, this is correct. The issue is that the LID sensor coming from the SFH (the way that Windows tell if the system has switched into tablet mode, verified by myself after disabling the driver and losing that functionality) is still missing, and the older driver forked above had added support recently. Unfortunately that driver doesn't support Ryzen APU platforms after 3000 series.

Both options for me aren't unfortunately usable, and I still hope that someone from AMD will fix this issue.

Marco.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#42 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

Andy Shevchenko ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------
CC| |[email protected]

--- Comment #69 from Andy Shevchenko ([email protected]) --- What's the status of this? Should it be closed or...?

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.
#43 lore raw
In reply to a message not in the archive

https://bugzilla.kernel.org/show_bug.cgi?id=199715

Andy Shevchenko ([email protected]) changed:

What |Removed |Added
----------------------------------------------------------------------------

           Assignee|drivers_platform_x86@kernel |[email protected]
                   |-bugs.osdl.org              |

--- Comment #70 from Andy Shevchenko ([email protected]) --- Reassign to AMD people.

Signature · 4 lines
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.