xref: /freebsd/share/man/man4/asmc.4 (revision dece5b05f577fc4c6b89af7ad48dfbdf7cc4945c)
1.\"
2.\" Copyright (c) 2007, 2008, 2009 Rui Paulo <rpaulo@FreeBSD.org>
3.\" Copyright (c) 2026 Enji Cooper <ngie@FreeBSD.org>
4.\"
5.\" SPDX-License-Identifier: BSD-2-Clause
6.\"
7.Dd September 6, 2026
8.Dt ASMC 4
9.Os
10.Sh NAME
11.Nm asmc
12.Nd Apple System Management Controller driver
13.Sh SYNOPSIS
14To compile this driver into the kernel, place the following line in your
15kernel configuration file:
16.Bd -ragged -offset indent
17.Cd device asmc
18.Sh DESCRIPTION
19The
20.Nm
21driver controls the Apple System Management Controller (SMC for short)
22found on Intel Apple systems.
23.Pp
24With this driver, you can configure your keyboard backlight
25brightness, check temperatures of several sensors, check the speed of
26the internal fans and check the status of the Sudden Motion Sensor.
27.Pp
28Variables related to the SMC control and inspection are exported via
29.Xr sysctl 3
30under the device tree
31.Va dev.asmc .
32.Sh KEYBOARD BACKLIGHT
33The keyboard brightness on all laptop models, e.g., MacBook Pro, can be
34controlled by writing a value to the
35.Va dev.asmc.%d.light.control
36sysctl MIB or with
37.Xr backlight 8
38utility.
39.Pp
40The following sysctl MIBs contains the raw value returned by the left
41and right light sensors:
42.Va dev.asmc.%d.light.left
43or
44.Va dev.asmc.%d.light.right .
45.Sh TEMPERATURES
46The number of temperature sensors and their description varies among
47systems.
48You can inspect the temperature sensors on your system by traversing
49the
50.Va dev.asmc.temp
51sysctl MIB.
52.Pp
53All values are in degrees celsius.
54.Sh SYSTEM FANS
55The
56.Va dev.asmc.fan.%d
57sysctl tree contains the leaf nodes
58.Va speed ,
59.Va safespeed ,
60.Va minspeed ,
61.Va maxspeed
62and
63.Va targetspeed .
64Each of these leaf nodes represent the current fan speed, the safest
65minimum fan speed, the minimum speed and the maximum speed
66respectively.
67.Pp
68All values are in RPM.
69.Sh POWER MANAGEMENT
70The
71.Va dev.asmc.%d.auto_poweron
72sysctl controls whether the machine automatically powers on when AC power
73is restored after an unclean power loss
74.Pq SMC key Dq AUPO .
75A value of 1 enables automatic power-on; 0 disables it.
76.Sh RAW SMC KEY ACCESS
77When the kernel is compiled with the
78.Dv ASMC_DEBUG
79option, a set of sysctl nodes is provided under
80.Va dev.asmc.%d.raw
81for reading and writing arbitrary SMC keys by name.
82.Pp
83.Bl -tag -width "dev.asmc.%d.raw.value" -compact
84.It Va dev.asmc.%d.raw.key
85Set the 4-character SMC key name to access (e.g.,\&
86.Dq AUPO ) .
87Setting this automatically queries the key's length and type.
88.It Va dev.asmc.%d.raw.value
89Read or write the key's value as a hex string.
90.It Va dev.asmc.%d.raw.len
91The auto-detected value length in bytes (read-only).
92.It Va dev.asmc.%d.raw.type
93The 4-character SMC type string (e.g.,\&
94.Dq ui8 ,
95.Dq flt )
96(read-only).
97.El
98.Pp
99Example usage:
100.Bd -literal -offset indent
101sysctl dev.asmc.0.raw.key=AUPO
102sysctl dev.asmc.0.raw.value
103sysctl dev.asmc.0.raw.value=01
104.Ed
105.Sh SUDDEN MOTION SENSOR
106The Sudden Motion Sensor (SMS for short) is a device that detects
107laptop movement and notifies the operating system via an interrupt.
108The sysctl MIBs present under
109.Va dev.asmc.sms
110all relate to the SMS.
111.Pp
112The most interesting usage of this device is to park the disk heads
113when the laptop is moved harshly.
114Configure
115.Xr devd 8
116the following way to automatically park your hard drives using
117.Xr camcontrol 8 :
118.Bd -literal -offset indent
119notify 0 {
120	match "system"		"ACPI";
121	match "subsystem"	"asmc";
122	action			"/sbin/camcontrol idle X";
123};
124.Ed
125.Pp
126Do not forget to change
127.Ar X
128in the command example to match the target hard drive, e.g.,
129.Pa ada0 .
130.Pp
131Also, please note that parking the disk heads too many times can
132dramatically reduce your hard drive's life span.
133Do not rely solely on the SMS to protect your hard drive: good care and
134common sense can increase your hard drive's life.
135.Sh HARDWARE
136The
137.Nm
138driver supports the Apple SMC on the following systems:
139.Pp
140.Bl -bullet -offset indent -compact
141.It
142iMac
143.It
144MacBook
145.It
146MacBook Air
147.It
148MacBook Pro
149.It
150Mac Mini
151.It
152Mac Pro
153.El
154.Sh FILES
155.Bl -tag -width "/dev/backlight/asmc0" -compact
156.It Pa /dev/backlight/asmc0
157Keyboard
158.Xr backlight 8
159device node.
160.Sh SEE ALSO
161.Xr apple_bce 4 ,
162.Xr backlight 8 ,
163.Xr camcontrol 8 ,
164.Xr devd 8 ,
165.Xr sysctl 8
166.Sh HISTORY
167The
168.Nm
169driver first appeared in
170.Fx 8.0 .
171The driver was heavily modified in
172.Fx 15.1
173to support additional Apple SMC functionality and platforms.
174.Sh AUTHORS
175.An Rui Paulo Aq Mt rpaulo@FreeBSD.org
176wrote
177.Nm
178as a 2007 Google Summer of Code project.
179.Sh BUGS
180This driver also supports ARM64 Mac models (in theory), but this has not
181been tested yet.
182