Record: Fan control service implementation — 2026-08-23
Outcome
Implemented the C++ fan-control service on the skeleton base.
Modules:
- sources/gpu_interface.{h,cpp}: MI25 discovery by PCI identity, sysfs reads and writes with errno propagation.
- sources/fan_curve.{h,cpp}: stage tables, interpolation, and PWM ramp.
- sources/mi25_fan_control.cpp: startup sequence, control loop, reporting, and failure policy.
- CMakeLists.txt, .clang-format: build and format.
- scripts/install.sh, scripts/amd-mi25-fanctl.service: install and unit.
- tests/02-fan-control.sh: fixture-based test (tool-gated).
Verified behavior against a sysfs fixture:
- Discovery picks the MI25 card (vendor 0x1002, device 0x6860) and rejects other cards.
- –check verifies the interface and fails when pwm1_enable is missing.
- The control loop computes the interpolated target (67 at 47 C) and ramps the fan up by 10 per second.
- Fingerprinting reports kernel release and driver version.
Decisions
- Unit name amd-mi25-fanctl.service.
- Startup writes pwm1_enable=1, manual, COMPUTE profile, minimum PWM.
- Failure policy follows documents/07-failure-behavior.md.
- make build compiles the C++ service; make test runs the fixture test.
Verification
- make build succeeds with -Werror.
- make test passes (00-skeleton, 01-site-build, 02-fan-control).
- ctest passes (smoke_test, fan_control_interface_test).
- clang-format clean.
Commits
- (recorded in git history for this task)