Repository navigation
iio: aop: Fix lid angle report decoding and scale - #665
Merged
Merged
Conversation
The LAS service already uses the same EPIC fake-HID receive path as ALS, but the decoder treats byte 1 of every report as an angle. Report 1 has a 9-bit little-endian angle; for example, 256 degrees becomes zero with the old decoder. Other report IDs can also overwrite the cached angle. Accept only complete report-1 samples in the 0..360 range and ignore the padding bits. Keep the raw count in degrees and expose pi/180 through in_angl_scale so IIO consumers can convert it to radians. A fixed scale does not need to wait for the first reading. Processed ALS channels keep their existing interface through the default no-scale implementation. Add host tests of the production decoder and IIO callback, document the existing J616s DT/config wiring and a hardware test plan, and register the new documentation and test under the existing AOP maintainer entry. Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The existing AOP LAS driver reads byte 1 of every fake-HID report as an angle. That drops bit 8 (256 degrees becomes 0) and lets property reports overwrite the cached angle. It also exposes degree counts without the scale required by IIO's radian angle ABI.
Decode only complete report-1 samples as a 9-bit little-endian value in the 0 to 360 range, preserve the last valid sample on other reports, and expose
in_angl_scale = 0.017453293. The shared IIO callback returns the fixed scale before the first sample; ALS retains its processed-lux interface. Host tests compile the production decoder and callback with mocks, andDocumentation/iio/aop-sensors.rstdocuments the interface and hardware test plan.J616s already has the
laschild (apple,t6041-aop-las,apple,aop-las) under its enabled AOP, andasahi.configenablesIIO_AOP_SENSOR_LAS=m. The compiled DTB confirms that wiring, so no DT changes are needed. The existinglasannouncement handling and EPIC subtype 0xc4 dispatch remain the single transport shared with ALS. Erik's J713 AOP series concerns handoff and microphones; it does not supply another LAS decoder.Validation:
rust/kernel.o, AOP core, LAS and ALS objects, andapple/t6040-j616s.dtbbuild withKCFLAGS=-Werror KRUSTFLAGS=-Dwarningsusing Clang 22.1.6 and Rust 1.97.1.defconfig + asahi.confighits a bindgen 0.73.2 layout error for empty, alignedsched_statisticsbefore driver compilation. Validation usedCONFIG_SCHEDSTATS=y, the only configuration difference; no configuration workaround is included in this PR.No hardware test was performed. J616s unsolicited report delivery, changing hinge readings, resume and an older AOP platform still need the documented checks. Reading a HID feature report does not establish that Linux receives unsolicited input reports. No feature polling or speculative firmware setup command is added.