Kernel driver 'lm93.o'
======================

Status: In progress

Supported chips:
  * National Semiconductor LM93
    Prefix 'lm93'
    Addresses scanned: I2C 0x2c-0x2e

Author:
	Mark M. Hoffman <mhoffman@lightlink.com>


Module Parameters
-----------------

(specific to LM93)
* init: integer
  Set to zero to disable some initializations (default is 1)
* disable_block: integer
  Set to non-zero to disable SMBus block data transactions (default is 0)
* vccp_limit_type: integer array (2)
  Configures in7 and in8 limit type, where 0 means absolute and non-zero
  means relative.  "Relative" here refers to "Dynamic Vccp Monitoring using
  VID" from the datasheet.  It greatly simplifies the interface to allow
  only one set of limits (absolute or relative) to be in operation at a
  time (even though the hardware is capable of enabling both).  There's
  not a compelling use case for enabling both at once, anyway.  The default
  is "0,0".

(common among sensor drivers)
* force: short array (min = 1, max = 48)
  List of adapter,address pairs to assume to be present.  Autodetection
  of the target device will still be attempted.  Use one of the more
  specific force directives below if this doesn't detect the device.
* force_lm93: short array (min = 1, max = 48)
  List of adapter,address pairs which are unquestionably assumed to contain
  a 'lm93' chip
* ignore: short array (min = 1, max = 48)
  List of adapter,address pairs not to scan
* ignore_range: short array (min = 1, max = 48)
  List of adapter,start-addr,end-addr triples not to scan
* probe: short array (min = 1, max = 48)
  List of adapter,address pairs to scan additionally
* probe_range: short array (min = 1, max = 48)
  List of adapter,start-addr,end-addr triples to scan additionally


Hardware Description
--------------------

(from the datasheet)

The LM93, hardware monitor, has a two wire digital interface compatible with
SMBus 2.0. Using an 8-bit ADC, the LM93 measures the temperature of two remote
diode connected transistors as well as its own die and 16 power supply
voltages. To set fan speed, the LM93 has two PWM outputs that are each
controlled by up to four temperature zones. The fancontrol algorithm is lookup
table based. The LM93 includes a digital filter that can be invoked to smooth
temperature readings for better control of fan speed. The LM93 has four
tachometer inputs to measure fan speed. Limit and status registers for all
measured values are included. The LM93 builds upon the functionality of
previous motherboard management ASICs and uses some of the LM85 s features
(i.e. smart tachometer mode). It also adds measurement and control support
for dynamic Vccp monitoring and PROCHOT. It is designed to monitor a dual
processor Xeon class motherboard with a minimum of external components.


Driver Description
------------------

This driver implements support for the National Semiconductor LM93.


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
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).
Note that this third value is calculated by the chip itself.  All values
range from 0-255 where 0 indicates no throttling, and 255 indicates > 99.6%.

It is possible to configure the LM93 to logically short the two #PROCHOT
signals.  I.e. when #P1_PROCHOT is asserted, the LM93 will automatically
assert #P2_PROCHOT, and vice-versa.  This mode is enabled by writing a 
non-zero integer to the /proc file prochot_short.


Smart Tach Mode:

(from the datasheet)

	If a fan is driven using a low-side drive PWM, the tachometer
	output of the fan is corrupted. The LM93 includes smart tachometer
	circuitry that allows an accurate tachometer reading to be
	achieved despite the signal corruption.  In smart tach mode all
	four signals are measured within 4 seconds.

Smart tach mode is enabled by the driver by writing 1 or 2 (associating the
the fan tachometer with a pwm) to the /proc file fan<n>_smart_tach.  A zero
will disable the function for that fan.

LM93 Unique /proc Files
-----------------------

	file			description
	-------------------------------------------------------------

	prochot<n>		limit, current, and moving average #PROCHOT %

	prochot_short		enable or disable logical #PROCHOT pin short

	fan<n>_smart_tach	enable or disable smart tach mode


Sample Configuration File
-------------------------

Here is a sample LM93 chip config for sensors.conf:

---------- cut here ----------
chip "lm93-*"

# VOLTAGE INPUTS

	# labels and scaling based on datasheet recommendations
	label in1	"+12V1"
	compute in1	@ * 12.945, @ / 12.945
	set in1_min	12 * 0.90
	set in1_max	12 * 1.10

	label in2	"+12V2"
	compute in2	@ * 12.945, @ / 12.945
	set in2_min	12 * 0.90
	set in2_max	12 * 1.10

	label in3	"+12V3"
	compute in3	@ * 12.945, @ / 12.945
	set in3_min	12 * 0.90
	set in3_max	12 * 1.10

	label in4	"FSB_Vtt"

	label in5	"3GIO"

	label in6	"ICH_Core"

	label in7	"Vccp1"

	label in8	"Vccp2"

	label in9	"+3.3V"
	set in9_min	3.3 * 0.90
	set in9_max	3.3 * 1.10

	label in10	"+5V"
	set in10_min	5.0 * 0.90
	set in10_max	5.0 * 1.10

	label in11	"SCSI_Core"

	label in12	"Mem_Core"

	label in13	"Mem_Vtt"

	label in14	"Gbit_Core"

	# Assuming R1/R2 = 4.1143, and 3.3V reference
	# -12V = (4.1143 + 1) * (@ - 3.3) + 3.3
	label in15	"-12V"
	compute in15 @ * 5.1143 - 13.57719, (@ + 13.57719) / 5.1143
	set in15_min	-12 * 0.90
	set in15_max	-12 * 1.10

	label in16	"+3.3VSB"
	set in16_min	3.3 * 0.90
	set in16_max	3.3 * 1.10

# TEMPERATURE INPUTS

	label temp1	"CPU1"
	label temp2	"CPU2"
	label temp3	"LM93"

# TACHOMETER INPUTS

	label fan1	"Fan1"
	set fan1_min	3000
	label fan2	"Fan2"
	set fan2_min	3000
	label fan3	"Fan3"
	set fan3_min	3000
	label fan4	"Fan4"
	set fan4_min	3000

# PWM OUTPUTS

	label pwm1	"CPU1"
	label pwm2	"CPU2"

