chip "vt1211-*" "vt8231-*"
#
# temp1 and in6 are not implemented in vt1211 / vt8231
#
#							1 for temp, 0 for volt.
#	Sensor		Voltage Mode	Temp Mode	config bit
#	--------	------------	---------	--------------
#	Reading 1			temp3
#	UCH1/Reading2	in0		temp2		0x04 (4)
#	UCH2		in1		temp4		0x08 (8)
#	UCH3		in2		temp5		0x10 (16)
#	UCH4		in3		temp6		0x20 (32)
#	UCH5		in4		temp7		0x40 (64)
#	3.3V		in5
#
# set uch1-2 to temp mode, uch3-5 to voltage mode
#

#
# this file is for an EPIA M 10000-N
# i am not sure if the conversions are correct,
# but for me they look ok ;)
#
# WARNING: i can not guarantee that these values/formulas are ok
#          if you ruin your board or burn your house down
#          because your pc gets to hot it is your problem ;)
#
# Simon (epia_AT_auctionant.de)
#
# NEWS:
# 02.10.04 - added formulas for temp2 and temp4 (also activated temp4)
#            changed the tempX max/hyst values to epia specs
#            WARNING: temp2+temp4 formulas might be completely wrong
#



# i need this in order to start sensord. otherwise it says it could not open .../config
    ignore config
#   set config 12
    ignore in6
    ignore in0
    ignore in1
#   ignore temp4 #epia M 10kN has a temp4 sensor!
    ignore temp5
    ignore temp6
    ignore temp7

# IMPORTANT: If you get "ERROR: Can't get TEMPX data!" from "sensors",
# where X is 2, 4, 5, 6 or 7, although you have this UCH set to
# temperature, this generally means that this UCH isn't (physically)
# used for temperature, so you should add an ignore statement for tempX
# and change the "config" value to reflect the fact that this UCH is
# probably used for voltage.

#   label in0 "unused"
#   label in1 "unused"
    label in2 "VCore1"
    label in3 "+5V"
    label in4 "+12V"
    label in5 "+3.3V"

    label temp2 "MB1 Temp"
    label temp3 "CPU Temp"
    label temp4 "MB2 Temp"
#
#   All voltage calculations have the form
#       ((@ * 100) - 3) / (K * 95.8), (@ * K * 0.958) + .03
#   where K = R2 / (R1 + R2).
#   Use the following K values based on input voltage.
#   This of course assumes the mobo has the resistors
#   recommended by Via in the datasheet.
#	Voltage			K
#	VCore			1.0
#	2.5			0.8333
#	3.3 (in5 internal)	0.6296
#	3.5 (3.3V ext.)		0.5952
#	5.0			0.4167 		#for my epiaM 10k-N this is 0.38, 
						#i measured +5V and adjusted this 
						#value until it fits to the value
						#i got on my multimeter
#	12.0			0.1754
 
#   compute in0 ((@ * 100) - 3) / (0.5952 * 95.8), (@ * 0.5952 * .958) + .03
#   compute in1 ((@ * 100) - 3) / (0.8333 * 95.8), (@ * 0.8333 * .958) + .03
    compute in2 ((@ * 100) - 3) / (1 * 95.8), (@ * 1 * .958) + .03
    compute in3 ((@ * 100) - 3) / (0.38 * 95.8), (@ * 0.38 * .958) + .03
    compute in4 ((@ * 100) - 3) / (0.1754 * 95.8), (@ * 0.1754 * .958) + .03
    compute in5 ((@ * 100) - 3) / (0.6296 * 95.8), (@ * 0.6296 * .958) + .03

    set vrm 9.1
#   set in0_min 2.5 * 0.95
#   set in0_max 2.5 * 1.05
    
    #VCore is 1.35V for Nehemiah 10kN, not 1.85 as vid shows?!
    set in2_min 1.35 * 0.97  #vid * 0.97
    set in2_max 1.35 * 1.03  #vid * 1.03
    
    set in3_min 5.0 * 0.95
    set in3_max 5.0 * 1.05
    set in4_min 12.0 * 0.90
    set in4_max 12.0 * 1.10
    set in5_min 3.3 * 0.95
    set in5_max 3.3 * 1.05

# this formula does not work for my epia M 10k N...
# compute temp3  (@/10 - 65) / 0.9686,  (@/10 * 0.9686) + 65

## i use a linear approximation of the via hw tool value->temp mapping table:
## temp = (71.0/73.0)*x-72.41
compute temp3 (@*71)/73-72.41, (@+72.41)*73/71

# thermistor calculations.
# 3435 is the thermistor beta.
# '^' is the e**x operator; '`' is the ln(x) operator
# (valid in library version 1.4.0 / lm_sensors 2.7.1 or higher)
# This assumes that the thermistor forms a resistor divider with a resistor
# equal to its nominal value @ 25C. If not, the math gets even harder.
#

# i have not found out how to convert the mb temp ...
# i always got stupid values ...
# the temp2 formula is equal to the via hw mon mapping
# of temp2->temp
#
# i replaced @ by (@+85) which seems to produce a 
# value that looks better. i got it by try'n'error
# so it might be completely wrong!!!
#
compute temp2  (1 / (((1 / 3435) * (`((253 - (@+85)) / ((@+85) - 43)))) + (1 / 298.15)))  - 273.15,  (253-85) - (210 / (1 + (1 / (^ (((3435 * (25 - @)) / ((@ + 273.15) * 298.15)))))))
compute temp4  (1 / (((1 / 3435) * (`((253 - (@+85)) / ((@+85) - 43)))) + (1 / 298.15)))  - 273.15,  (253-85) - (210 / (1 + (1 / (^ (((3435 * (25 - @)) / ((@ + 273.15) * 298.15)))))))

#    compute temp5  (1 / (((1 / 3435) * (` ((253 - @) / (@ - 43)))) + (1 / 298.15)))  - 273.15,  253 - (210 / (1 + (1 / (^ (((3435 * (25 - @)) / ((@ + 273.15) * 298.15)))))))
#    compute temp6  (1 / (((1 / 3435) * (` ((253 - @) / (@ - 43)))) + (1 / 298.15)))  - 273.15,  253 - (210 / (1 + (1 / (^ (((3435 * (25 - @)) / ((@ + 273.15) * 298.15)))))))
#    compute temp7  (1 / (((1 / 3435) * (` ((253 - @) / (@ - 43)))) + (1 / 298.15)))  - 273.15,  253 - (210 / (1 + (1 / (^ (((3435 * (25 - @)) / ((@ + 273.15) * 298.15)))))))

    set temp2_hyst 40
    set temp2_over 45
    set temp3_hyst 75 
    set temp3_over 80 
    set temp4_hyst 40
    set temp4_over 45

    set fan1_min 3000
    set fan2_min 3000

