predefined temperature range. If the temperature goes out of range, fan
is driven slower/faster to reach the predefined range again.
-The mode works for fan1-fan5. Mapping of temperatures to pwm outputs is as
-follows:
+The mode works for fan1-fan5.
-temp11 -> pwm1
-temp12 -> pwm2
-temp13 -> pwm3
-temp14 -> pwm4 (NCT6779D only)
-temp15 -> pwm5 (NCT6779D only)
-
-The temperature source used to control pwm1..pwm5 (temp11..temp15) can be
-configured with pwm[1..5]_temp_sel.
+The temperature source used to control pwm1..pwm5 can be configured with
+pwm[1..5]_temp_sel and pwm[1..5]_weight_temp_sel. The value reported and
+configured with those attributes is the temperature sensor attribute index.
+For example, to map the source of temp1_input to pwm1_temp_sel, write 1
+into the pwm1_temp_sel attribute.
/sys files
----------
Usage Notes
-----------
-On some motherboards with NCT6776F, temperature readings for CPUTIN and AUXTIN
-are not correct. In addition, the reported CPUTIN may be _lower_ if the CPU load
+On various ASUS boards, it appears that CPUTIN is not really connected to
+anything and floats, or that it is connected to some non-standard temperature
+measurement device. As a result, the temperature reported on CPUTIN will not
+reflect a usable value. It often reports unreasonablyy high temperatures, and in
+some cases the reported temperature declines if the actual temperature
increases.
-
-On an ASUS P8H67V board, the observed relationship between measured and real
-temperatures was approximately
- T(cpu,real) = 80 - (T(cpu,measured) / 2)
- T(aux,real) = T(aux,measured) - 30000
-if the thermal sensor type was set to "thermistor(4)".
-
-The reported value for CPUTIN sometimes jumps significantly, up to 10 degrees C
-between measurements. Changing the sensor types on that board to diode(1) or
-thermal diode (3) did not help.
-
-The problem with AUXTIN can possibly be addressed by setting temp3_offset to
--30000. It is currently unknown, however, if the AUXTIN sensor is actually
-connected to anything. The CPUTIN sensor is obviously connected to something,
-but how the reported temperature relates to the real world is unknown.
+CPUTIN should therefore be be ignored on ASUS boards. The CPU temperature
+on ASUS boards is reported from PECI 0.
Implementation Details
0x408, 0 };
static const u16 NCT6775_REG_TEMP_CRIT[ARRAY_SIZE(nct6775_temp_label) - 1]
- = { 0, 0, 0, 0, 0xa00, 0xa01, 0xa02, 0xa03, 0xa04, 0xa05, 0xa06, 0xa07 };
+ = { 0, 0, 0, 0, 0xa00, 0xa01, 0xa02, 0xa03, 0xa04, 0xa05, 0xa06,
+ 0xa07 };
static const u16 NCT6776_REG_TEMP_CRIT[ARRAY_SIZE(nct6776_temp_label) - 1]
= { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x709, 0x70a };
return count;
}
-static ssize_t
-show_pwm_temp(struct device *dev, struct device_attribute *attr, char *buf)
-{
- struct nct6775_data *data = nct6775_update_device(dev);
- struct sensor_device_attribute *sattr = to_sensor_dev_attr(attr);
- int nr = sattr->index;
-
- return sprintf(buf, "%d\n", LM75_TEMP_FROM_REG(data->pwm_temp[nr]));
-}
-
static ssize_t
show_pwm_temp_sel(struct device *dev, struct device_attribute *attr, char *buf)
{
struct nct6775_data *data = nct6775_update_device(dev);
struct sensor_device_attribute_2 *sattr = to_sensor_dev_attr_2(attr);
+ int i, src, sel = 0;
- return sprintf(buf, "%d\n",
- data->pwm_temp_sel[sattr->index][sattr->nr]);
+ src = data->pwm_temp_sel[sattr->index][sattr->nr];
+
+ for (i = 0; i < NUM_TEMP; i++) {
+ if (!(data->have_temp & (1 << i)))
+ continue;
+ if (src == data->temp_src[i]) {
+ sel = i + 1;
+ break;
+ }
+ }
+
+ return sprintf(buf, "%d\n", sel);
}
static ssize_t
int nr = sattr->nr;
int index = sattr->index;
unsigned long val;
- int err;
- int reg;
+ int err, reg, src;
err = kstrtoul(buf, 10, &val);
if (err < 0)
return err;
- if (val == 0 || val > 0x1f)
+ if (val == 0 || val > NUM_TEMP)
return -EINVAL;
-
- val = SENSORS_LIMIT(val, 1, data->temp_label_num - 1);
-
- if (!strlen(data->temp_label[val]))
+ if (!(data->have_temp & (1 << (val - 1))) || !data->temp_src[val - 1])
return -EINVAL;
mutex_lock(&data->update_lock);
- data->pwm_temp_sel[index][nr] = val;
+ src = data->temp_src[val - 1];
+ data->pwm_temp_sel[index][nr] = src;
reg = nct6775_read_value(data, data->REG_TEMP_SEL[index][nr]);
reg &= 0xe0;
- reg |= val;
+ reg |= src;
nct6775_write_value(data, data->REG_TEMP_SEL[index][nr], reg);
mutex_unlock(&data->update_lock);
static SENSOR_DEVICE_ATTR(pwm5_target, S_IWUSR | S_IRUGO, show_target_temp,
store_target_temp, 4);
-/* Monitored pwm temperatures */
-static SENSOR_DEVICE_ATTR(temp11_input, S_IRUGO, show_pwm_temp, NULL, 0);
-static SENSOR_DEVICE_ATTR(temp12_input, S_IRUGO, show_pwm_temp, NULL, 1);
-static SENSOR_DEVICE_ATTR(temp13_input, S_IRUGO, show_pwm_temp, NULL, 2);
-static SENSOR_DEVICE_ATTR(temp14_input, S_IRUGO, show_pwm_temp, NULL, 3);
-static SENSOR_DEVICE_ATTR(temp15_input, S_IRUGO, show_pwm_temp, NULL, 4);
-
/* Smart Fan registers */
static ssize_t
4, 4),
};
-static struct attribute *nct6775_attributes_pwm[5][20] = {
+static struct attribute *nct6775_attributes_pwm[5][19] = {
{
- &sensor_dev_attr_temp11_input.dev_attr.attr,
&sensor_dev_attr_pwm1.dev_attr.attr,
&sensor_dev_attr_pwm1_mode.dev_attr.attr,
&sensor_dev_attr_pwm1_enable.dev_attr.attr,
NULL
},
{
- &sensor_dev_attr_temp12_input.dev_attr.attr,
&sensor_dev_attr_pwm2.dev_attr.attr,
&sensor_dev_attr_pwm2_mode.dev_attr.attr,
&sensor_dev_attr_pwm2_enable.dev_attr.attr,
NULL
},
{
- &sensor_dev_attr_temp13_input.dev_attr.attr,
&sensor_dev_attr_pwm3.dev_attr.attr,
&sensor_dev_attr_pwm3_mode.dev_attr.attr,
&sensor_dev_attr_pwm3_enable.dev_attr.attr,
NULL
},
{
- &sensor_dev_attr_temp14_input.dev_attr.attr,
&sensor_dev_attr_pwm4.dev_attr.attr,
&sensor_dev_attr_pwm4_mode.dev_attr.attr,
&sensor_dev_attr_pwm4_enable.dev_attr.attr,
NULL
},
{
- &sensor_dev_attr_temp15_input.dev_attr.attr,
&sensor_dev_attr_pwm5.dev_attr.attr,
&sensor_dev_attr_pwm5_mode.dev_attr.attr,
&sensor_dev_attr_pwm5_enable.dev_attr.attr,