opnsense-src/sys/dev/asmc
Abdelkader Boudih a11b4f757e asmc: add per-fan manual mode control via sysctl
Add per-fan manual mode control via dev.asmc.0.fan.N.manual sysctl.

Apple SMCs support manual fan control via the FS! SMC key,
a 16-bit bitmask where each bit controls one fan (0=auto, 1=manual).

This change adds a new sysctl per fan:
    dev.asmc.0.fan.N.manual (0=auto, 1=manual)

When set to manual mode (1), the fan runs at the speed set via
dev.asmc.0.fan.N.targetspeed instead of automatic thermal control.  When
set to auto mode (0), the SMC controls fan speed automatically.

The FS! key was already defined in asmcvar.h but not accessible.
This exposes it for debugging, testing, and advanced fan control.

Implementation uses read-modify-write to allow independent control of
each fan without affecting others.

Reviewed by:	adrian, markj
MFC after:	2 weeks
Differential Revision:	https://reviews.freebsd.org/D54437

(cherry picked from commit 1ecac45cfc5f0886907c34ec0da2c1b32618665d)
2026-01-26 00:51:44 +00:00
..
asmc.c asmc: add per-fan manual mode control via sysctl 2026-01-26 00:51:44 +00:00
asmcvar.h asmc: Add support for macmini 6,1 and 6,2 (late 2012) models 2025-04-24 22:35:56 -07:00