.\" $NetBSD: dbcool.4,v 1.11 2016/06/09 22:05:38 abhinav Exp $
.\"
.\" Copyright (c) 2008 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
.\" by Paul Goyette.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd June 10, 2016
.Dt DBCOOL 4
.Os
.Sh NAME
.Nm dbcool ,
.Nm adm1027 ,
.Nm adm1030 ,
.Nm adm1031 ,
.Nm adt7463 ,
.Nm adt7466 ,
.Nm adt7467 ,
.Nm adt7468 ,
.Nm adt7473 ,
.Nm adt7475 ,
.Nm adt7476 ,
.Nm adt7490 ,
.Nm emc6d103s
.Nd dbCool(tm) family of environmental monitors and fan controllers
.Sh SYNOPSIS
.Cd "dbcool* at ki2c?"
.Cd "dbcool* at iic? addr 0x2e"
.Sh DESCRIPTION
The
.Nm
driver provides support for the
.Tn Analog Devices
dbCool and the
.Tn SMSC
EMC6D103S environmental monitor chips to be used with the
.Xr envsys 4
API.
.Pp
These chips support up to fifteen sensors.
Not all of the following sensors are supported on all chips.
.Bl -column "Sensor" "Units" "Typical" -offset indent
.It Sy "Sensor" Ta Sy "Units" Ta Sy "Typical Use"
.It Li "l_temp" Ta "uK" Ta "local chip temperature"
.It Li "r1_temp" Ta "uK" Ta "CPU temperature"
.It Li "r2_temp" Ta "uK" Ta "GPU temperature"
.It Li "Vccp" Ta "uV DC" Ta "CPU Vcore"
.It Li "Vcc" Ta "uV DC" Ta "Chip's supply voltage"
.It Li "2.5V" Ta "uV DC" Ta "2.5V supply"
.It Li "5V" Ta "uV DC" Ta "5V supply"
.It Li "12V" Ta "uV DC" Ta "12V supply"
.It Li "Vtt" Ta "uV DC" Ta "PECI ref. voltage (2.25V ref, ADT7490 only)"
.It Li "Imon" Ta "uV DC" Ta "Current monitor (2.25V ref, ADT7490 only)"
.It Li "AIN1" Ta "uV DC" Ta "Analog In (2.25V ref, ADT7466 only)"
.It Li "AIN2" Ta "uV DC" Ta "Analog In (2.25V ref, ADT7466 only)"
.It Li "fan1" Ta "RPM" Ta "Chassis Fan"
.It Li "fan2" Ta "RPM" Ta "Chassis Fan"
.It Li "fan3" Ta "RPM" Ta "Chassis Fan"
.It Li "fan4" Ta "RPM" Ta "Chassis Fan"
.It Li "VID" Ta "(none)" Ta "CPU VID code (selected chips only)"
.El
.Pp
Each temperature and voltage sensor has programmable hardware
high- and low-limits; fan sensors have only a low-limit.
These limits can be set using the
.Xr envstat 8
utility.
Due to hardware limitations, the minimum permissible value for the fan
speed low-limits is 83 RPM.
.Pp
Temperature sensors also have
.Em Tmin ,
.Em Trange ,
.Em Thyst ,
and
.Em Ttherm
.Xr sysctl 8
variables; these values are used by the fan speed controllers.
Their values are in units of degC, since this is the unit which is
programmed into the device registers.
.Pp
All members of the dbCool family support Pulse-Width Modulated (PWM)
fan speed control based on temperature thresholds - the fan will spin up
when its associated thermal sensor(s) exceeds its configured
.Em Tmin
value.
The fan will go faster as the temperature rises, and will slow down
as the temperature falls.
If the temperature exceeds the sensor's
.Em Ttherm
value, the THERM signal will be asserted, and if enabled the fan will
run at full speed.
The fan will be turned off when the sensor(s) that triggered it
reports a temperature which is at least
.Em Thyst
degrees below its
.Em Tmin
threshold.
.Pp
Each fan controller is programmable using the following
.Xr sysctl 8
variables.
.Bd -literal -offset indent
hw.dbcool0.fan_ctl_0.behavior
hw.dbcool0.fan_ctl_0.min_duty
hw.dbcool0.fan_ctl_0.max_duty
hw.dbcool0.fan_ctl_0.cur_duty
.Ed
.Pp
The
.Em behavior
variable controls the selection of temperature sensors associated with
the fan controller.
When the associated temperature sensor reaches its
.Em Tmin
value, the fan controller starts the fan at its minimum duty cycle;
when the associated temperature sensor reaches its
.Em Ttherm
value and asserts the THERM signal (or if an external THERM signal is
asserted), the fan controller sets the fan speed to a 100% duty cycle.
Between these two settings, each temperature sensor is used to calculate
a duty cycle linearly based on the slope defined by the temperature sensor's
.Em range
variable.
When the associated temperature falls at least
.Em Thyst
degrees below its
.Em Tmin
value, the fan controller will turn off the fan.
(On the ADM1030, the
value for
.Em Thyst
is fixed at 5 degC.)
.Pp
Valid values for the
.Em behavior
variable are:
.Bd -literal -offset indent
local (not available on ADM1030)
remote1
remote2 (not available on ADM1030)
local+remote2 (not available on ADM1030)
all-temps
full-speed (not available on ADM1030)
manual
disabled
.Ed
.Pp
When the
.Em behavior
variable is set to
.Dq manual ,
the
.Em cur-duty
variable becomes user-writable and can be set to any value between 0 and
100 inclusive to control the fan's duty cycle manually.
In all other
.Em behavior
modes, the
.Em cur-duty
variable is read-only and updates are ignored.
.Pp
The
.Em min-duty
and
.Em max-duty
variables define the range over which the fan controller will manage the
fan's duty cycle.
On the ADM1030, these values are not separately controllable.
The
.Em max-duty
is fixed at 100%, and the
.Em cur-duty
variable is used to specify the minimum duty cycle when the fan
controller is running in automatic mode.
.Pp
Note that the duty-cycle value does not directly correspond to the fan's
speed.
That is, a 33% duty cycle does not mean that the fan runs at 33%
of its maximum speed; in actuality, a 33% duty cycle drives the
fan at a speed close to 50% of its maximum.
Fan speed correlates approximately to the square root of the duty
cycle.
.Sh EXAMPLES
The
.Xr envstat 8
utility can be used to determine the sensors supported:
.Bd -literal -offset indent
Current CritMax WarnMax WarnMin CritMin Unit
l_temp: 44.250 degC
r1_temp: 41.250 degC
r2_temp: N/A
Vccp: 0.002 V
Vcc: 3.351 V
fan1: N/A
fan2: N/A
fan3: N/A
fan4: N/A
.Ed
.Pp
Using this information, the following commands in
.Pa /etc/envsys.conf
will set appropriate limits for CPU temperature and chip supply
voltage, and powerd will be notified if the limits are exceeded:
.Bd -literal -offset indent
dbcool0 {
sensor1 {
warning-max = 60C;
critical-max = 65C;
}
sensor4 {
critical-min = 3.1;
warning-min = 3.2;
critical-max = 3.5;
}
}
.Ed
.Sh SEE ALSO
.Xr envsys 4 ,
.Xr iic 4 ,
.Xr envstat 8 ,
.Xr powerd 8 ,
.Xr sysctl 8
.Sh HISTORY
The
.Nm
device appeared in
.Nx 5.0 .
.Sh BUGS
Although the sensor limit registers can be programmed, there is currently
no use of the dbCool chips' ability to generate an SMBus interrupt when the
limits are exceeded.
Limit checking and event generation are done in software, and are performed
only when the sensor values are polled and refreshed.
.Pp
The ADT7466 chip, although officially a member of the dbCool family, is
programmed quite differently.
The fan controllers on this chip are not currently implemented.
.Pp
The PECI (Processor Environment Control Interface) temperature sensors
and the associated PWM behavior modes on the ADT7490 are not currently
supported.