diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index ea0db5ba..9aef8a69 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -3,6 +3,10 @@ # This configuration file will be used by all applications linked to # libsensors. +# This config file consists of two parts: the heavily commented LM78 +# example, and the real parts. Search for '####' if you want to skip +# to the real stuff. + # Hash marks introduce comments, which continue until the end of a line # # Identifiers consisting of only digits and letters can be used @@ -21,7 +25,7 @@ # "That" is used for LM78 chips on the ISA bus, and "This" for LM78 # chips on a non-ISA bus. -chip "lm78-*" "lm78-j-*" "lm79-*" +#chip "lm78-*" "lm78-j-*" "lm79-*" # A label line describes what a certain feature stands for on your # mainboard. Programs can retrieve these names and display them. @@ -33,15 +37,15 @@ chip "lm78-*" "lm78-j-*" "lm79-*" # of these logical groups. # These are as advised in the LM78 and LM79 data sheets, and used on almost -# any # mainboard we have seen. +# any mainboard we have seen. - label in0 "VCore 1" - label in1 "VCore 2" - label in2 "+3.3V" - label in3 "+5V" - label in4 "+12V" - label in5 "-12V" - label in6 "-5V" +# label in0 "VCore 1" +# label in1 "VCore 2" +# label in2 "+3.3V" +# label in3 "+5V" +# label in4 "+12V" +# label in5 "-12V" +# label in6 "-5V" # A compute line describes how to scale a certain feature. There are # two expressions in it: the first describes how the /proc value must @@ -84,10 +88,10 @@ chip "lm78-*" "lm78-j-*" "lm79-*" # in6 -5.0 90.9 60.4 +3.00 # These leads to these declarations: - compute in3 ((6.8/10)+1)*@ , @/((6.8/10)+1) - compute in4 ((28/10)+1)*@ , @/((28/10)+1) - compute in5 -(210/60.4)*@ , -@/(210/60.4) - compute in6 -(90.9/60.4)*@ , -@/(90.9/60.4) +# compute in3 ((6.8/10)+1)*@ , @/((6.8/10)+1) +# compute in4 ((28/10)+1)*@ , @/((28/10)+1) +# compute in5 -(210/60.4)*@ , -@/(210/60.4) +# compute in6 -(90.9/60.4)*@ , -@/(90.9/60.4) # Set statements set things like limits. Complete expressions can be # used. Not everything can sensibly be set: setting 'in0', for example, @@ -105,7 +109,7 @@ chip "lm78-*" "lm78-j-*" "lm79-*" # There is one other feature: the 'bus' statement. An example is below. -bus "i2c-0" "SMBus PIIX4 adapter at e800" "Non-I2C SMBus adapter" +#bus "i2c-0" "SMBus PIIX4 adapter at e800" "Non-I2C SMBus adapter" # If we refer from now on to 'i2c-0' in 'chip' lines, this will run-time # be matched to this bus. So even if the PIIX4 is called 'i2c-5' at that @@ -114,16 +118,112 @@ bus "i2c-0" "SMBus PIIX4 adapter at e800" "Non-I2C SMBus adapter" # config file, this feature is not needed; but the next lines would # only affect the LM75 chips on the PIIX4 adapter: -chip "lm75-i2c-0-*" +#chip "lm75-i2c-0-*" # You should really use the output of /proc/bus/chips to generate bus lines, # because one mistyped characted will inhibit the match. Wildcards are not # yet supported; spaces at the end are ignored, though. + + + +#### Here begins the real configuration file + +chip "lm78-*" "lm78-j-*" "lm79-*" + +# These are as advised in the LM78 and LM79 data sheets, and used on almost +# any mainboard we have seen. + + label in0 "VCore 1" + label in1 "VCore 2" + label in2 "+3.3V" + label in3 "+5V" + label in4 "+12V" + label in5 "-12V" + label in6 "-5V" + +# For positive voltages (in0..in4), two resistors are used, with the following +# formula (R1,R2: resistor values, Vs: read voltage, Vin: pin voltage) +# R1 = R2 * (Vs/Vin - 1) +# For negative voltages (in5, in6) two resistors are used, with the following +# formula (Rin,Rf: resistor values, Vs: read voltage, Vin: pin voltage) +# Rin = (Vs * Rf) / Vin + +# Here are the official LM78 and LM79 data sheet values. +# Vs R1,Rin R2,Rf Vin +# in3 +5.0 6.8 10 +2.98 +# in4 +12.0 30 10 +3.00 +# in5 -12.0 240 60 +3.00 +# in6 -5.0 100 60 +3.00 + +# These would lead to these declarations: +# compute in3 ((6.8/10)+1)*@ , @/((6.8/10)+1) +# compute in4 ((30/10)+1)*@ , @/((30/10)+1) +# compute in5 -(240/60)*@ , -@/(240/60) +# compute in6 -(100/60)*@ , -@/(100/60) + +# On almost any mainboard we have seen, the Winbond compute values lead to +# much better results, though. + +# Vs R1,Rin R2,Rf Vin +# in4 +12.0 28 10 +3.00 +# in5 -12.0 210 60.4 +3.00 +# in6 -5.0 90.9 60.4 +3.00 + +# These leads to these declarations: + + compute in3 ((6.8/10)+1)*@ , @/((6.8/10)+1) + compute in4 ((28/10)+1)*@ , @/((28/10)+1) + compute in5 -(210/60.4)*@ , -@/(210/60.4) + compute in6 -(90.9/60.4)*@ , -@/(90.9/60.4) + + chip "gl518sm-r00-*" "gl518sm-r80-*" # The below declaration is from the data sheet. We have no idea how these # chips are typically used. Please contact us if you own one. label vdd "+5V" compute vdd @ * 2.5, @ / 2.5 + + + +chip "lm80-*" + +# The values below should be correct if you own a qdi BX (brilliant1) +# mainboard. If not, please contact us, so we can figure out better readings. + +# For positive voltages (in0..in4), two resistors are used, with the following +# formula (R1,R2: resistor values, Vs: read voltage, Vin: pin voltage) +# R1 = R2 * (Vs/Vin - 1) +# For negative voltages (in5, in6) two resistors are used, with the following +# formula (R3,R4: resistor values, Vs: read voltage, Vin: pin voltage, +# V5: +5V) +# R3 = R4 * (Vs - Vin) / (Vin - V5) + +# Here are the official LM78 and LM79 data sheet values. +# Vs R1,R3 R2,R4 Vin +# +2.5V 23.7 75 +1.9 +# +3.3V 22.1 30 +1.9 +# +5.0 24 14.7 +1.9 +# +12.0 160 30.1 +1.9 +# -12.0 160 35.7 +1.9 +# -5.0 36 16.2 +1.9 + +# Now curiously enough, VCore is connected with (unknown) resistors, which +# translate a +2.8V to +1.9V. So we use that in the computations below. + + label in0 "+5V" + label in1 "VTT" + label in2 "+3.3V" + label in3 "+Vcore" + label in4 "+12V" + label in5 "-12V" + label in6 "-5V" + + compute in0 (24/14.7 + 1) * @ , @ / (24/14.7 + 1) + compute in2 (22.1/30 + 1) * @ , @ / (22.1/30 + 1) + compute in3 (2.8/1.9) * @, @ * 1.9/2.8 + compute in4 (160/35.7 + 1) * @ @ / (160/35.7 + 1) + compute in5 (160/35.7)*(@ - in0) + @, (@ + in0 * 160/25.7)/ (1 + 160/25.7) + compute in6 (36/16.2)*(@ - in0) + @, (@ + in0 * 36/16.2) / (1 + 36/16.2) diff --git a/i2c/MODIFICATIONS b/i2c/MODIFICATIONS index bd4a7429..654d4c57 100644 --- a/i2c/MODIFICATIONS +++ b/i2c/MODIFICATIONS @@ -20,8 +20,8 @@ Here come the changes: changes will probably be included in the next i2c version. * algo-bit.c, i2c-core.c: Debugging level turned down - The default debugging level was 1, which created a lot of noise in - the kernel message logs (dmesg) + The transfer functions are now on debug level 2, to keep the noise within + acceptable limits. * New file: Module.mk The Makefile fragment we use to compile the files in this directory. diff --git a/i2c/i2c-core.c b/i2c/i2c-core.c index 888af4d9..68e6397b 100644 --- a/i2c/i2c-core.c +++ b/i2c/i2c-core.c @@ -57,7 +57,7 @@ struct i2c_driver *drivers[I2C_DRIVER_MAX]; int driver_count; /**** debug level */ -int i2c_debug=0; +int i2c_debug=1; /* --------------------------------------------------- * registering functions @@ -336,7 +336,7 @@ int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg msgs[],int num) { int ret; - DEB(printk("master_xfer: %s with %d msgs.\n",adap->name,num)); + DEB2(printk("master_xfer: %s with %d msgs.\n",adap->name,num)); I2C_LOCK(adap); ret = adap->algo->master_xfer(adap,msgs,num); @@ -355,7 +355,7 @@ int i2c_master_send(struct i2c_client *client,const char *buf ,int count) msg.len = count; (const char *)msg.buf = buf; - DEB(printk("master_send: writing %d bytes on %s.\n", + DEB2(printk("master_send: writing %d bytes on %s.\n", count,client->adapter->name)); I2C_LOCK(adap); @@ -379,7 +379,7 @@ int i2c_master_recv(struct i2c_client *client, char *buf ,int count) msg.len = count; msg.buf = buf; - DEB(printk("master_recv: reading %d bytes on %s.\n", + DEB2(printk("master_recv: reading %d bytes on %s.\n", count,client->adapter->name)); I2C_LOCK(adap); diff --git a/kernel/chips/lm78.c b/kernel/chips/lm78.c index a9cb5c06..0ed5289a 100644 --- a/kernel/chips/lm78.c +++ b/kernel/chips/lm78.c @@ -720,7 +720,7 @@ void lm78_update_client(struct i2c_client *client) data->fan_div[0] = (i >> 4) & 0x03; data->fan_div[1] = i >> 6; data->alarms = lm78_read_value(client,LM78_REG_ALARM1) + - (lm78_read_value(client,LM78_REG_ALARM2) >> 8); + (lm78_read_value(client,LM78_REG_ALARM2) << 8); data->last_updated = jiffies; data->valid = 1; } diff --git a/kernel/chips/lm80.c b/kernel/chips/lm80.c index cae71d7e..1d3c8067 100644 --- a/kernel/chips/lm80.c +++ b/kernel/chips/lm80.c @@ -37,19 +37,12 @@ /* Many LM80 constants specified below */ -/* Length of ISA address segment */ -#define LM80_EXTENT 8 - -/* Where are the ISA address/data registers relative to the base address */ -#define LM80_ADDR_REG_OFFSET 5 -#define LM80_DATA_REG_OFFSET 6 - /* The LM80 registers */ -#define LM80_REG_IN_MAX(nr) (0x2b + (nr) * 2) -#define LM80_REG_IN_MIN(nr) (0x2c + (nr) * 2) +#define LM80_REG_IN_MAX(nr) (0x2a + (nr) * 2) +#define LM80_REG_IN_MIN(nr) (0x2b + (nr) * 2) #define LM80_REG_IN(nr) (0x20 + (nr)) -#define LM80_REG_FAN_MIN(nr) (0x3a + (nr)) +#define LM80_REG_FAN_MIN(nr) (0x3b + (nr)) #define LM80_REG_FAN(nr) (0x27 + (nr)) #define LM80_REG_TEMP 0x27 @@ -66,8 +59,6 @@ /* Conversions. Rounding is only done on the TO_REG variants. */ -static int lm80_in_conv[7] = {10000, 10000, 10000, 16892, 38000, - -34768, -15050 }; #define IN_TO_REG(val,nr) (((((val) * 100000 / lm80_in_conv[nr]) + 8) / 16) \ & 0xff) #define IN_FROM_REG(val,nr) (((val) * 16 * lm80_in_conv[nr]) / 100000) diff --git a/src/lm78.c b/src/lm78.c index a9cb5c06..0ed5289a 100644 --- a/src/lm78.c +++ b/src/lm78.c @@ -720,7 +720,7 @@ void lm78_update_client(struct i2c_client *client) data->fan_div[0] = (i >> 4) & 0x03; data->fan_div[1] = i >> 6; data->alarms = lm78_read_value(client,LM78_REG_ALARM1) + - (lm78_read_value(client,LM78_REG_ALARM2) >> 8); + (lm78_read_value(client,LM78_REG_ALARM2) << 8); data->last_updated = jiffies; data->valid = 1; } diff --git a/src/lm80.c b/src/lm80.c index cae71d7e..1d3c8067 100644 --- a/src/lm80.c +++ b/src/lm80.c @@ -37,19 +37,12 @@ /* Many LM80 constants specified below */ -/* Length of ISA address segment */ -#define LM80_EXTENT 8 - -/* Where are the ISA address/data registers relative to the base address */ -#define LM80_ADDR_REG_OFFSET 5 -#define LM80_DATA_REG_OFFSET 6 - /* The LM80 registers */ -#define LM80_REG_IN_MAX(nr) (0x2b + (nr) * 2) -#define LM80_REG_IN_MIN(nr) (0x2c + (nr) * 2) +#define LM80_REG_IN_MAX(nr) (0x2a + (nr) * 2) +#define LM80_REG_IN_MIN(nr) (0x2b + (nr) * 2) #define LM80_REG_IN(nr) (0x20 + (nr)) -#define LM80_REG_FAN_MIN(nr) (0x3a + (nr)) +#define LM80_REG_FAN_MIN(nr) (0x3b + (nr)) #define LM80_REG_FAN(nr) (0x27 + (nr)) #define LM80_REG_TEMP 0x27 @@ -66,8 +59,6 @@ /* Conversions. Rounding is only done on the TO_REG variants. */ -static int lm80_in_conv[7] = {10000, 10000, 10000, 16892, 38000, - -34768, -15050 }; #define IN_TO_REG(val,nr) (((((val) * 100000 / lm80_in_conv[nr]) + 8) / 16) \ & 0xff) #define IN_FROM_REG(val,nr) (((val) * 16 * lm80_in_conv[nr]) / 100000)