-.\" $OpenBSD: sysctl.2,v 1.56 2023/10/12 12:56:26 schwarze Exp $
+.\" $OpenBSD: sysctl.2,v 1.57 2023/10/14 19:02:16 kettenis Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.Dd $Mdocdate: October 12 2023 $
+.Dd $Mdocdate: October 14 2023 $
.Dt SYSCTL 2
.Os
.Sh NAME
.Bl -column "Second level name" "integer" "Changeable" -offset indent
.It Sy "Second level name" Ta Sy "Type" Ta Sy "Changeable"
.It Dv HW_ALLOWPOWERDOWN Ta "integer" Ta "yes"
+.It Dv HW_BATTERY Ta "node" Ta "not applicable"
.It Dv HW_BYTEORDER Ta "integer" Ta "no"
.It Dv HW_CPUSPEED Ta "integer" Ta "no"
.It Dv HW_DISKCOUNT Ta "integer" Ta "no"
.Xr securelevel 7
greater than 0,
this variable may not be changed.
+.It Dv HW_BATTERY Pq Va hw.battery
+Control battery charging.
+These are only available on hardware that supports battery charging control.
+There are three subnodes:
+.Bl -column "HW_BATTERY_CHARGESTART" "integer" "Changeable" -offset indent
+.It Sy "Third level name" Ta Sy "Type" Ta Sy "Changeable"
+.It Dv HW_BATTERY_CHARGEMODE Ta "integer" Ta "yes"
+.It Dv HW_BATTERY_CHARGESTART Ta "integer" Ta "maybe"
+.It Dv HW_BATTERY_CHARGESTOP Ta "integer" Ta "yes"
+.El
+.Pp
+Their meanings are as follows:
+.Bl -tag -width "123456"
+.It Dv HW_BATTERY_CHARGEMODE Pq Va hw.battery.chargemode
+Control if the battery is charged or discharged.
+A value of -1 means to (forcibly) discharge the battery.
+A value of 0 means to inhibit charging the battery.
+A value of 1 means to charge the battery, subject to the configured limits.
+.It Dv HW_BATTERY_CHARGESTART Pq Va hw.battery.chargestart
+The percentage below which the battery will start charging.
+Not all hardware allows setting this value.
+On hardware that does not allow setting this value the battery will typically
+start charging at a fixed percentage point below the value configured through
+.Dv HW_BATTERY_CHARGESTOP .
+.It Dv HW_BATTERY_CHARGESTOP Pq Va hw.battery.chargestop
+The percentage above which the battery will stop charging.
+Setting the value to 100 will fully charge the battery.
+.El
+.Pp
+By setting
+.Dv HW_BATTERY_CHARGEMODE
+to 1, and setting both
+.Dv HW_BATTERY_CHARGESTART
+and
+.Dv HW_BATTERY_CHARGESTOP ,
+the battery will be kept charged at a percentage between the configured limits.
.It Dv HW_BYTEORDER Pq Va hw.byteorder
The byteorder (4321 or 1234).
.It Dv HW_CPUSPEED Pq Va hw.cpuspeed