Added support and documentation for auto/PWM:

* temp/pwm channel bindings
 * temp channel base/offsets temperatures
 * temp channel boost/hysteresis limits
 * temp channel minimum PWM
 * temp channel hysteresis for PWM
 * pwm output spin-up minimum and spin-up duration
 * pwm output #PROCHOT and #VRDHOT ramp times

Also...
 * bugfix: #PROCHOT interval handling was broken
 * bugfix: small documentation typo re: prochotN
 * removed some TODO comments resolved by testing
 * moved h/w register #defines into separate header


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2671 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Mark M. Hoffman committed 2004-08-23 20:29:15 +00:00
1 parent 0ca078c43a
commit fafcbe79d7
3 files changed
+936 -108

No files matched your search

+117 -1
View File
@@ -80,7 +80,7 @@ User Interface
#PROCHOT:
The LM93 can monitor two #PROCHOT signals. The results are found in the
/proc files prochot1 and prochot2. There are two values per file: the first
/proc files prochot1 and prochot2. There are three values per file: the first
value is the user limit. The second value is the current reading for the
most recent complete time interval. The third value is something like a
2 period exponential moving average (but not quite - check the datasheet).
@@ -155,6 +155,102 @@ that this parameter has implications for the Smart Tach Mode (see above).
PWM Output Frequencies: 12, 36, 48, 60, 72, 84, 96, 22500 (h/w default)
Automatic PWM:
The LM93 is capable of complex automatic fan control, with many different
points of configuration. To start, each PWM output can be bound to any
combination of eight control sources. The final PWM is the largest of all
individual control sources to which the PWM output is bound.
The eight control sources are: temp1-temp4 (aka "zones" in the datasheet),
#PROCHOT 1 & 2, and #VRDHOT 1 & 2. The bindings are expressed as a bitmask
in the /proc files pwm<n>_auto_channels, where a "1" enables the binding, and
a "0" disables it. The h/w default is 0x0f (all temperatures bound).
0x01 - Temp 1
0x02 - Temp 2
0x04 - Temp 3
0x08 - Temp 4
0x10 - #PROCHOT 1
0x20 - #PROCHOT 2
0x40 - #VRDHOT 1
0x80 - #VRDHOT 2
The function y = f(x) takes a source temperature x to a PWM output y. This
function of the LM93 is derived from a base temperature and a table of 12
temperature offsets. The base temperature is expressed in degrees C in the
/proc files temp<n>_auto_base. The offsets are expressed in cumulative
degrees C, with all 12 values in the files temp<n>_auto_offsets. E.g. if the
base temperature is 40C:
offset # temp<n>_auto_offsets range pwm
1 0 - 25.00%
2 0 - 28.57%
3 1 40C - 41C 32.14%
4 1 41C - 42C 35.71%
5 2 42C - 44C 39.29%
6 2 44C - 46C 42.86%
7 2 48C - 50C 46.43%
8 2 50C - 52C 50.00%
9 2 52C - 54C 53.57%
10 2 54C - 56C 57.14%
11 2 56C - 58C 71.43%
12 2 58C - 60C 85.71%
> 60C 100.00%
Valid offsets are in the range 0C <= x <= 7.5C in 0.5C increments.
There is an independent base temperature for each temperature channel. Note,
however, there are only two tables of offsets: one each for temp[12] and
temp[34]. Therefore, any change to e.g. temp1_auto_offsets will also affect
temp2_auto_offsets.
The LM93 can also apply hysteresis to the offset table, to prevent unwanted
oscillation between two steps in the offsets table. These values are found in
the /proc files temp<n>_auto_offset_hyst. There is just one value; it has the
same representation as in temp<n>_auto_offsets.
If a temperature reading falls below the base value for that channel, the LM93
will use the minimum PWM value. These values are found in the /proc files
temp<n>_auto_pwm_min. Note, there are only two minimums: one each for temp[12]
and temp[34]. Therefore, any change to e.g. temp1_auto_pwm_min will also
affect temp2_auto_pwm_min.
PWM Spin-Up Cycle:
A spin-up cycle occurs when a PWM output is commanded from 0% duty cycle to
some value > 0%. The LM93 supports a minimum duty cycle during spin-up. These
values are found in the /proc files pwm<n>_auto_spinup_min. There is one value
per file; it has the same representation as other PWM duty cycle values. The
duration of the spin-up cycle is also configurable. These values are found in
the /proc files pwm<n>_auto_spinup_time. There is one value per file; it is
the spin-up time in seconds. The available spin-up times are constrained by
the hardware. Selecting a value which is not available will cause the driver
to use the next largest value.
Spin-up Durations: 0 (disabled, h/w default), 0.1, 0.25, 0.4, 0.7, 1.0, 2.0, 4.0
#PROCHOT and #VRDHOT PWM Ramping:
If the #PROCHOT or #VRDHOT signals are asserted while bound to a PWM output
channel, the LM93 will ramp the PWM output up to 100% duty cycle in discrete
steps. The duration of each step is configurable. There are two files, with
one value each in seconds: pwm_auto_prochot_ramp and pwm_auto_vrdhot_ramp.
The available ramp times are constrained by the hardware. Selecting a value
which is not available will cause the driver to use the next largest value.
Ramp Times: 0 (disabled, h/w default) to 0.75 in 0.05 second intervals
Fan Boost:
For each temperature channel, there is a boost temperature: if the channel
exceeds this limit, the LM93 will immediately drive both PWM outputs to 100%.
This limit is expressed in degrees C in the /proc files temp<n>_auto_boost.
There is also a hysteresis temperature for this function: after the boost
limit is reached, the temperature channel must drop below this value before
the boost function is disabled. This temperature is also expressed in degrees
C in the /proc files temp<n>_auto_boost_hyst.
GPIO Pins:
The LM93 can monitor the logic level of four dedicated GPIO pins as well as the
@@ -162,6 +258,7 @@ four tach input pins. GPIO0-GPIO3 correspond to (fan) tach 1-4, respectively.
All eight GPIOs are read by reading the bitmask in the /proc file gpio. The
LSB is GPIO0, and the MSB is GPIO7.
LM93 Unique /proc Files
-----------------------
@@ -180,6 +277,25 @@ LM93 Unique /proc Files
fan<n>_smart_tach enable or disable smart tach mode
pwm<n>_auto_spinup_min minimum duty cycle during spin-up
pwm<n>_auto_spinup_time duration of spin-up
pwm_auto_prochot_ramp ramp time per step when #PROCHOT asserted
pwm_auto_vrdhot_ramp ramp time per step when #VRDHOT asserted
temp<n>_auto_base temperature channel base
temp<n>_auto_offsets temperature channel offsets
temp<n>_auto_offset_hyst
temperature channel offset hysteresis
temp<n>_auto_boost temperature channel boost (PWMs to 100%) limit
temp<n>_auto_boost_hyst temperature channel boost hysteresis
gpio input state of 8 GPIO pins; read-only
+711 -107
View File
File diff suppressed because it is too large. Load diff
+108
View File
@@ -0,0 +1,108 @@
/*
lm93.h - Part of lm_sensors, Linux kernel modules for hardware monitoring
Author/Maintainer: Mark M. Hoffman <mhoffman@lightlink.com>
Copyright (c) 2004 Utilitek Systems, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef LM93_H
#define LM93_H
/* LM93 REGISTER ADDRESSES */
/* miscellaneous */
#define LM93_REG_MFR_ID 0x3e
#define LM93_REG_VER 0x3f
#define LM93_REG_STATUS_CONTROL 0xe2
#define LM93_REG_CONFIG 0xe3
#define LM93_REG_SLEEP_CONTROL 0xe4
/* alarm values start here */
#define LM93_REG_HOST_ERROR_1 0x48
/* voltage inputs: in1-in16 (nr => 0-15) */
#define LM93_REG_IN(nr) (0x56 + (nr))
#define LM93_REG_IN_MIN(nr) (0x90 + (nr) * 2)
#define LM93_REG_IN_MAX(nr) (0x91 + (nr) * 2)
/* temperature inputs: temp1-temp4 (nr => 0-3) */
#define LM93_REG_TEMP(nr) (0x50 + (nr))
#define LM93_REG_TEMP_MIN(nr) (0x78 + (nr) * 2)
#define LM93_REG_TEMP_MAX(nr) (0x79 + (nr) * 2)
/* temp[1-4]_auto_boost (nr => 0-3) */
#define LM93_REG_BOOST(nr) (0x80 + (nr))
/* #PROCHOT inputs: prochot1-prochot2 (nr => 0-1) */
#define LM93_REG_PROCHOT_CUR(nr) (0x67 + (nr) * 2)
#define LM93_REG_PROCHOT_AVG(nr) (0x68 + (nr) * 2)
#define LM93_REG_PROCHOT_MAX(nr) (0xb0 + (nr))
/* fan tach inputs: fan1-fan4 (nr => 0-3) */
#define LM93_REG_FAN(nr) (0x6e + (nr) * 2)
#define LM93_REG_FAN_MIN(nr) (0xb4 + (nr) * 2)
/* pwm outputs: pwm1-pwm2 (nr => 0-1, reg => 0-3) */
#define LM93_REG_PWM_CTL(nr,reg) (0xc8 + (reg) + (nr) * 4)
#define LM93_PWM_CTL1 0
#define LM93_PWM_CTL2 1
#define LM93_PWM_CTL3 2
#define LM93_PWM_CTL4 3
/* GPIO input state */
#define LM93_REG_GPI 0x6b
/* vid inputs: vid1-vid2 (nr => 0-1) */
#define LM93_REG_VID(nr) (0x6c + (nr))
/* vccp1 & vccp2: VID relative inputs (nr => 0-1) */
#define LM93_REG_VCCP_LIMIT_OFF(nr) (0xb2 + (nr))
/* temp[1-4]_auto_boost_hyst */
#define LM93_REG_BOOST_HYST_12 0xc0
#define LM93_REG_BOOST_HYST_34 0xc1
#define LM93_REG_BOOST_HYST(nr) (0xc0 + (nr)/2)
/* temp[1-4]_auto_pwm_[min|hyst] */
#define LM93_REG_PWM_MIN_HYST_12 0xc3
#define LM93_REG_PWM_MIN_HYST_34 0xc4
#define LM93_REG_PWM_MIN_HYST(nr) (0xc3 + (nr)/2)
/* prochot_override & prochot_interval */
#define LM93_REG_PROCHOT_OVERRIDE 0xc6
#define LM93_REG_PROCHOT_INTERVAL 0xc7
/* temp[1-4]_auto_base (nr => 0-3) */
#define LM93_REG_TEMP_BASE(nr) (0xd0 + (nr))
/* temp[1-4]_auto_offsets (step => 0-11) */
#define LM93_REG_TEMP_OFFSET(step) (0xd4 + (step))
/* #PROCHOT & #VRDHOT PWM ramp control */
#define LM93_REG_PWM_RAMP_CTL 0xbf
/* miscellaneous */
#define LM93_REG_SFC1 0xbc
#define LM93_REG_SFC2 0xbd
#define LM93_REG_SF_TACH_TO_PWM 0xe0
/* LM93 REGISTER VALUES */
#define LM93_MFR_ID 0x73
#define LM93_MFR_ID_PROTOTYPE 0x72
#endif /* !defined LM93_H */