Add support for the EMC6D102 extra resolution bits. The chip offers

4 extra resolution bits per voltage and temperature channel, but I
chose to use only 2 bits per channel because that's what the ADM1027
has so it made the changes smaller. The EMC6D102 has a 10-bit ADC
anyway, the 2 remaining bits are obtained from averaging so they are
not so important.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4574 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Jean Delvare committed 2007-07-07 08:09:38 +00:00
1 parent ae007f5831
commit 5fa737e5e1
3 files changed
+37 -9

No files matched your search

+2
View File
@@ -16,6 +16,7 @@ SVN HEAD
Man page sensors.conf.5: Update the chip statement section
Module i2c-nforce2: Add nForce MCP61, MCP65 support (2.6 backport)
Module lm85: Fix setting the fan speed min limit to 0
Add support for the EMC6D102 extra resolution bits
Module thmc50: Fix the i2c address range
Module w83627ehf: New (2.6 backport)
Programs i2cdump, i2cget, i2cset: Do not force the slave address by default
@@ -43,6 +44,7 @@ SVN HEAD
Add support for the w83627ehf VID function
Add support for the w83627ehf thermal sensor types
Add support for it87 fan4 and fan5
Display the extra resolution bits of the emc6d102
Program sensors-detect: Stop Super-I/O probe after first family success
Fix SMSC DME1737 detection
Add /usr/sbin to the PATH (#2199)
+25
View File
@@ -165,6 +165,11 @@ SENSORS_INSMOD_6(lm85b, lm85c, adm1027, adt7463, emc6d100, emc6d102);
#define EMC6D100_REG_IN_MIN(nr) (0x73 + ((nr)-5) * 2)
#define EMC6D100_REG_IN_MAX(nr) (0x74 + ((nr)-5) * 2)
#define EMC6D102_REG_EXTEND_ADC1 0x85
#define EMC6D102_REG_EXTEND_ADC2 0x86
#define EMC6D102_REG_EXTEND_ADC3 0x87
#define EMC6D102_REG_EXTEND_ADC4 0x88
/* Conversions. Rounding and limit checking is only done on the TO_REG
variants. Note that you should be a bit careful with which arguments
these macros are called: arguments may be evaluated more than once.
@@ -1162,6 +1167,26 @@ static void lm85_update_client(struct i2c_client *client)
lm85_read_value(client, EMC6D100_REG_ALARM3) << 16;
break ;
case emc6d102 :
/* Have to read LSB bits after the MSB ones because
the reading of the MSB bits has frozen the
LSBs (backward from the ADM1027).
We use only two extra bits per channel, and encode
them in the same format the ADM1027 uses, to keep the
rest of the code unchanged.
*/
i = lm85_read_value(client, EMC6D102_REG_EXTEND_ADC1);
data->extend_adc = (i & 0xcc) << 8; /* temp3, temp1 */
i = lm85_read_value(client, EMC6D102_REG_EXTEND_ADC2);
data->extend_adc |= (i & 0x0c) << 10; /* temp2 */
data->extend_adc |= (i & 0xc0) << 2; /* in4 */
i = lm85_read_value(client, EMC6D102_REG_EXTEND_ADC3);
data->extend_adc |= (i & 0x0c) >> 2; /* in0 */
data->extend_adc |= i & 0xc0; /* in3 */
i = lm85_read_value(client, EMC6D102_REG_EXTEND_ADC4);
data->extend_adc |= i & 0x0c; /* in1 */
data->extend_adc |= (i & 0xc0) >> 2; /* in2 */
break;
default : break ; /* no warnings */
}
+10 -9
View File
@@ -1558,12 +1558,13 @@ void print_lm85(const sensors_chip_name *name)
char *label;
double cur, min, max;
int alarms, alarm_mask = 0, valid;
int is1027, is7463, is6d100;
int is1027, is7463, is6d100, xadc;
is1027 = !strcmp(name->prefix,"adm1027")
|| !strcmp(name->prefix,"adt7463") ;
is7463 = !strcmp(name->prefix, "adt7463");
is6d100 = !strcmp(name->prefix,"emc6d100") ;
xadc = is1027 || !strcmp(name->prefix, "emc6d102");
if (!sensors_get_feature(*name,SENSORS_LM85_ALARMS,&cur))
alarms = cur + 0.5;
@@ -1584,7 +1585,7 @@ void print_lm85(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s",
(is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN0?"ALARM":"");
(xadc?3:2),cur,min,max,alarms&LM85_ALARM_IN0?"ALARM":"");
if (is1027) { printf(alarm_mask&LM85_ALARM_IN0?" MASKED":""); }
putchar( '\n' );
}
@@ -1598,7 +1599,7 @@ void print_lm85(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s",
(is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN1?"ALARM":"");
(xadc?3:2),cur,min,max,alarms&LM85_ALARM_IN1?"ALARM":"");
if (is1027) { printf(alarm_mask&LM85_ALARM_IN1?" MASKED":""); }
putchar( '\n' );
}
@@ -1612,7 +1613,7 @@ void print_lm85(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s",
(is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN2?"ALARM":"");
(xadc?3:2),cur,min,max,alarms&LM85_ALARM_IN2?"ALARM":"");
if (is1027) { printf(alarm_mask&LM85_ALARM_IN2?" MASKED":""); }
putchar( '\n' );
}
@@ -1626,7 +1627,7 @@ void print_lm85(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s",
(is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN3?"ALARM":"");
(xadc?3:2),cur,min,max,alarms&LM85_ALARM_IN3?"ALARM":"");
if (is1027) { printf(alarm_mask&LM85_ALARM_IN3?" MASKED":""); }
putchar( '\n' );
}
@@ -1640,7 +1641,7 @@ void print_lm85(const sensors_chip_name *name)
if (valid) {
print_label(label,10);
printf("%+7.*f V (min = %+6.2f V, max = %+6.2f V) %s",
(is1027?3:2),cur,min,max,alarms&LM85_ALARM_IN4?"ALARM":"");
(xadc?3:2),cur,min,max,alarms&LM85_ALARM_IN4?"ALARM":"");
if (is1027) { printf(alarm_mask&LM85_ALARM_IN4?" MASKED":""); }
putchar( '\n' );
}
@@ -1746,7 +1747,7 @@ void print_lm85(const sensors_chip_name *name)
!sensors_get_feature(*name,SENSORS_LM85_TEMP1_MAX,&max)) {
if (valid) {
print_label(label,10);
print_temp_info( cur, max, min, MINMAX, (is1027 ? 2 : 0), 0);
print_temp_info( cur, max, min, MINMAX, (xadc ? 2 : 0), 0);
printf( " %s %s %s\n",
alarms&LM85_ALARM_TEMP1?"ALARM":"",
alarms&LM85_ALARM_TEMP1_FAULT?"FAULT":"",
@@ -1762,7 +1763,7 @@ void print_lm85(const sensors_chip_name *name)
!sensors_get_feature(*name,SENSORS_LM85_TEMP2_MAX,&max)) {
if (valid) {
print_label(label,10);
print_temp_info( cur, max, min, MINMAX, (is1027 ? 2 : 0), 0);
print_temp_info( cur, max, min, MINMAX, (xadc ? 2 : 0), 0);
printf( " %s %s\n",
alarms&LM85_ALARM_TEMP2?"ALARM":"",
is1027&&(alarm_mask&LM85_ALARM_TEMP2)?"MASKED":""
@@ -1777,7 +1778,7 @@ void print_lm85(const sensors_chip_name *name)
!sensors_get_feature(*name,SENSORS_LM85_TEMP3_MAX,&max)) {
if (valid) {
print_label(label,10);
print_temp_info( cur, max, min, MINMAX, (is1027 ? 2 : 0), 0);
print_temp_info( cur, max, min, MINMAX, (xadc ? 2 : 0), 0);
printf( " %s %s %s\n",
alarms&LM85_ALARM_TEMP3?"ALARM":"",
alarms&LM85_ALARM_TEMP3_FAULT?"FAULT":"",