After resuming from suspend, the ALS stops working: cat /sys/bus/iio/devices/iio:device0/in_illuminance_raw
just returns 0. There also is no delay in reading this file (whereas there is a significant read delay when the ALS actually works.)
The issue almost always happens after a resume.
When the ALS is borked, suspending & resuming again will sometimes “fix” it, but this is very unreliable.
I’m not seeing anything relevant in dmesg.
Is anyone else experiencing this? I’m not sure how to go about debugging this, so any suggestion would be welcome.
Turns out that was the key difference! If I disable the light-adjusting-thingy (wluma in my case), then the ALS starts working again.
Somehow the ALS doesn’t seem to enjoy being hammered by requests from wluma just after resuming. I think it queries it at quite a high rate (10/s maybe?), I’ll look into that.
You could try reading the ALS from the EC memmap directly using sudo xxd -seek 0xE80 -l 2 /dev/port (it’s little endian and hex but 0 should be obvious), and that should narrow it down as a kernel issue or EC issue.
Something I didn’t think about, is the kernel gets it’s data from ACPI (I think). So it could still be an EC or maybe BIOS issue, but at least we know the EC is reading the ALS successfully!
Based on my FW13 7840U, I think it might actually read the ALS via the AMD sensor fusion hub (amd_afh), I’m not too sure how any of that works though. Open an issue on the issue tracker and hopefully someone from Framework can look into it.
Anyway the ALS is physically connected to the EC, and we can read it directly from that, so as a workaround I’ve added ALS support to my als branch of Dustin’s framework-laptop-kmod driver. You will probably have to blacklist hid_sensor_als, if you can’t get your software to pick the right sensor.
Same here, and thanks for the tip! Stopping illuminanced (in my case) for a moment and then restarting it gets the ALS working after sleep. A more permanent solution would certainly be nice, though.