diff --git a/CHANGES b/CHANGES index 2dcf2c48..718d5213 100644 --- a/CHANGES +++ b/CHANGES @@ -10,6 +10,7 @@ SVN HEAD Add applesmc support Add w83627ehf support (for Linux 2.4) Add support for the w83627ehf VID function + Add support for the w83627ehf thermal sensor types Man page sensors.conf.5: Update the chip statement section Module i2c-nforce2: Add nForce MCP61, MCP65 support (2.6 backport) Module w83627ehf: New (2.6 backport) @@ -36,6 +37,7 @@ SVN HEAD Fix alignment of alarm for one-limit temperatures Add w83627ehf support (for Linux 2.4) Add support for the w83627ehf VID function + Add support for the w83627ehf thermal sensor types Program sensors-detect: Stop Super-I/O probe after first family success Fix SMSC DME1737 detection Add /usr/sbin to the PATH (#2199) diff --git a/kernel/chips/w83627ehf.c b/kernel/chips/w83627ehf.c index a724a47f..a04bdab3 100644 --- a/kernel/chips/w83627ehf.c +++ b/kernel/chips/w83627ehf.c @@ -209,6 +209,7 @@ struct w83627ehf_data { u8 fan_min[5]; u8 fan_div[5]; u8 has_fan; /* some fan inputs can be disabled */ + u8 sensor[3]; u16 temp[3]; u16 temp_max[3]; u16 temp_hyst[3]; @@ -242,6 +243,9 @@ struct w83627ehf_data { #define W83627EHF_SYSCTL_TEMP1 1201 /* Degrees Celsius * 10 */ #define W83627EHF_SYSCTL_TEMP2 1202 #define W83627EHF_SYSCTL_TEMP3 1203 +#define W83627EHF_SYSCTL_SENSOR1 1211 +#define W83627EHF_SYSCTL_SENSOR2 1212 +#define W83627EHF_SYSCTL_SENSOR3 1213 #define W83627EHF_SYSCTL_VID 1300 /* Volts * 1000 */ #define W83627EHF_SYSCTL_VRM 1301 #define W83627EHF_SYSCTL_PWM1 1401 @@ -805,6 +809,21 @@ static void w83627ehf_vrm(struct i2c_client *client, int operation, } } +static void w83627ehf_sensor(struct i2c_client *client, int operation, + int ctl_name, int *nrels_mag, long *results) +{ + struct w83627ehf_data *data = client->data; + int nr = ctl_name - W83627EHF_SYSCTL_SENSOR1; + + if (operation == SENSORS_PROC_REAL_INFO) + *nrels_mag = 0; + else if (operation == SENSORS_PROC_REAL_READ) { + w83627ehf_update_client(client); + results[0] = data->sensor[nr]; + *nrels_mag = 1; + } +} + static ctl_table w83627ehf_dir_table_template[] = { {W83627EHF_SYSCTL_IN0, "in0", NULL, 0, 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &w83627ehf_in}, @@ -864,6 +883,13 @@ static ctl_table w83627ehf_dir_table_template[] = { &i2c_sysctl_real, NULL, &w83627ehf_vid}, {W83627EHF_SYSCTL_VRM, "vrm", NULL, 0, 0644, NULL, &i2c_proc_real, &i2c_sysctl_real, NULL, &w83627ehf_vrm}, + + {W83627EHF_SYSCTL_SENSOR1, "sensor1", NULL, 0, 0444, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &w83627ehf_sensor}, + {W83627EHF_SYSCTL_SENSOR2, "sensor2", NULL, 0, 0444, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &w83627ehf_sensor}, + {W83627EHF_SYSCTL_SENSOR3, "sensor3", NULL, 0, 0444, NULL, &i2c_proc_real, + &i2c_sysctl_real, NULL, &w83627ehf_sensor}, {0} }; @@ -875,8 +901,9 @@ static struct i2c_driver w83627ehf_driver; static void w83627ehf_init_client(struct i2c_client *client) { + struct w83627ehf_data *data = client->data; int i; - u8 tmp; + u8 tmp, diode; /* Start monitoring if needed */ tmp = w83627ehf_read_value(client, W83627EHF_REG_CONFIG); @@ -900,6 +927,15 @@ static void w83627ehf_init_client(struct i2c_client *client) printk(KERN_INFO "w83627ehf: Enabling VBAT monitoring\n"); w83627ehf_write_value(client, W83627EHF_REG_VBAT, tmp | 0x01); } + + /* Get thermal sensor types */ + diode = w83627ehf_read_value(client, W83627EHF_REG_DIODE); + for (i = 0; i < 3; i++) { + if ((tmp & (0x02 << i))) + data->sensor[i] = (diode & (0x10 << i)) ? 1 : 2; + else + data->sensor[i] = 4; /* thermistor */ + } } static int w83627ehf_detect(struct i2c_adapter *adapter, int address, diff --git a/lib/chips.c b/lib/chips.c index 47474ab4..e38e29f8 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -2147,6 +2147,15 @@ static sensors_chip_feature w83627ehf_features[] = { { SENSORS_W83627EHF_TEMP3_HYST, "temp3_hyst", SENSORS_W83627EHF_TEMP3, SENSORS_W83627EHF_TEMP3, RW }, W83627EHF_SYSCTL_TEMP3, VALUE(2), 1 }, + { { SENSORS_W83627EHF_TEMP1_TYPE, "sensor1", SENSORS_W83627EHF_TEMP1, + NOMAP, R }, + W83627EHF_SYSCTL_SENSOR1, VALUE(1), 0 }, + { { SENSORS_W83627EHF_TEMP2_TYPE, "sensor2", SENSORS_W83627EHF_TEMP2, + NOMAP, R }, + W83627EHF_SYSCTL_SENSOR2, VALUE(1), 0 }, + { { SENSORS_W83627EHF_TEMP3_TYPE, "sensor3", SENSORS_W83627EHF_TEMP3, + NOMAP, R }, + W83627EHF_SYSCTL_SENSOR3, VALUE(1), 0 }, { { SENSORS_W83627EHF_VID, "vid", NOMAP, NOMAP, R }, W83627EHF_SYSCTL_VID, VALUE(1), 3 }, { { SENSORS_W83627EHF_VRM, "vrm", NOMAP, NOMAP, RW }, diff --git a/lib/chips.h b/lib/chips.h index db9a1fd4..c1fb3baf 100644 --- a/lib/chips.h +++ b/lib/chips.h @@ -971,6 +971,9 @@ #define SENSORS_W83627EHF_TEMP1_HYST 81 /* RW */ #define SENSORS_W83627EHF_TEMP2_HYST 82 /* RW */ #define SENSORS_W83627EHF_TEMP3_HYST 83 /* RW */ +#define SENSORS_W83627EHF_TEMP1_TYPE 91 /* R */ +#define SENSORS_W83627EHF_TEMP2_TYPE 92 /* R */ +#define SENSORS_W83627EHF_TEMP3_TYPE 93 /* R */ #define SENSORS_W83627EHF_VID 245 /* R */ #define SENSORS_W83627EHF_VRM 249 /* R */ #define SENSORS_W83627EHF_ALARMS 250 /* R */ diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 74209285..bc84e2b2 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -2998,6 +2998,11 @@ void print_w83627ehf(const sensors_chip_name *name) if (valid) { print_label(label,10); print_temp_info(cur, over, hyst, HYST, i ? 1 : 0, i ? 1 : 0); + if (!sensors_get_feature(*name, SENSORS_W83627EHF_TEMP1_TYPE+i, &cur)) { + int sensor = cur + 0.5; + printf("[%-10s]", sensor == 1 ? "CPU diode" : + sensor == 2 ? "transistor" : "thermistor"); + } if (sensors_get_feature(*name, SENSORS_W83627EHF_TEMP1_ALARM+i, &alarm)) alarm = temp_alarms & (1 << i); if (alarm)