Repository navigation
AOP: make the T6040 accelerometer and gyroscope report - #745
Merged
Merged
Conversation
The AOP core writes nCal 0 into the firmware's boot arguments on every SoC whose arguments it patches. The T6040 firmware's own default for it, in the boot argument table it ships with, is 1. With 0, its accelerometer and gyroscope services accept the calibration and the report interval, and the sensor starts sampling, but no report ever reaches the application processor, so both IIO devices read ENODATA. Make nCal part of the per-SoC data and write the firmware's default, 1, on the T6040. The other SoCs keep 0. The T6040 comment claimed macOS writes the same arguments as on the T6020; that is not established for nCal, so drop it. Note the symptom in the AOP sensor documentation. On J616s (7.3.0-aurora-tt3), both devices report with this change. The accelerometer at rest reads |a| = 9.64 m/s^2 (291 samples, 9.62 to 9.65), and the gyroscope shows a static bias of about 0.4 deg/s. ALS, lid angle, the three DCPs and the audio cards are unchanged, and the boot logs no errors. Fixes: e82a608 ("soc: apple: aop: Add T6040 support") Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
The T6040 firmware takes a service's calibration once per AOP boot. When it is sent again, after a rebind or on resume, the firmware answers the range-intrinsic and nominal-extrinsic writes with kIOReturnUnsupported (0xe00002c7), accepts the range-extrinsic one and keeps the calibration it holds. The driver treated that status as a failure. A rebind then failed with EIO, and after resume the reports were not restarted. Treat that status on a calibration write as "already held", log how many packets were kept, and go on to the report interval. Any other non-zero status still stops the start. Cover the status decision in the host selftest. This has been measured on the T6040 only. On J616s, rebinding the stock driver fails with "property 75 refused: status 0xe00002c7" on both devices. With this change both devices bind again and report fresh samples. Fixes: d2da58e ("iio: aop: Add the accelerometer and gyroscope driver") Assisted-by: LLM Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Contributor
Author
|
Motion test result: Ryan ran it on J616s at 11:09, on battery and Wi-Fi with the machine on his lap. 401 samples at about 10 Hz were logged on the machine with this series' aop.ko and aop_motion.ko.
🤖 Generated with Claude Code |
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.
This series makes the M4 Pro (J616s, T6040) accelerometer and gyroscope report on Linux.
Root cause
drivers/soc/apple/aop.rspatches the AOP firmware's boot arguments withnCal 0on every SoC. The T6040 firmware (aopfw-mac16jaop, macOS 27.0 26A428) ships a boot argument table in its_rtk_patchbaysection, and its own value there isnCal 1, a 1-byte field. With 0, theaccelandgyroservices:So
aop-sensors-accelandaop-sensors-gyrobind and read ENODATA forever. Eryk's working J713 dirty-room driver setsncal: 1for T8132 and nothing else that differs.Changes
soc: apple: aop:nCalbecomes per-SoC data. T6040 writes the firmware's default, 1; T8103/T8112/T6000/T6020 keep 0, and T8140 doesn't patch boot arguments. The docs get a troubleshooting note.iio: aop: motion: on a second start in the same AOP boot (rebind, or resume through the PM notifier), the firmware answers props 75/76 with kIOReturnUnsupported (0xe00002c7), accepts 77, and keeps its calibration.aop-motion.py.Hardware (J616s, 7.3.0-aurora-tt3 with the patched
aop.koandaop_motion.ko)property 75 refused: status 0xe00002c7, probe -5 on both devices.journalctl -b -p 3is empty.Tests
tools/testing/selftests/drivers/apple/aop-motion.py: 5/5 pass, including the newcalibration_status.rustfmt --checkis clean.aop-las.pyalready fails on aurora-wip 5caa4ea (ValueError: substring not foundin its source extraction). That is unrelated to this series and left alone.🤖 Generated with Claude Code