Loading Documentation/hwmon/nct7904 +2 −2 Original line number Diff line number Diff line Loading @@ -35,11 +35,11 @@ temp1_input Local temperature (1/1000 degree, temp[2-9]_input CPU temperatures (1/1000 degree, 0.125 degree resolution) fan[1-4]_mode R/W, 0/1 for manual or SmartFan mode pwm[1-4]_enable R/W, 1/2 for manual or SmartFan mode Setting SmartFan mode is supported only if it has been previously configured by BIOS (or configuration EEPROM) fan[1-4]_pwm R/O in SmartFan mode, R/W in manual control mode pwm[1-4] R/O in SmartFan mode, R/W in manual control mode The driver checks sensor control registers and does not export the sensors that are not enabled. Anyway, a sensor that is enabled may actually be not Loading drivers/hwmon/nct7904.c +29 −28 Original line number Diff line number Diff line Loading @@ -412,7 +412,8 @@ static ssize_t show_pwm(struct device *dev, return sprintf(buf, "%d\n", val); } static ssize_t store_mode(struct device *dev, struct device_attribute *devattr, static ssize_t store_enable(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) { int index = to_sensor_dev_attr(devattr)->index; Loading @@ -422,17 +423,17 @@ static ssize_t store_mode(struct device *dev, struct device_attribute *devattr, if (kstrtoul(buf, 10, &val) < 0) return -EINVAL; if (val > 1 || (val && !data->fan_mode[index])) if (val < 1 || val > 2 || (val == 2 && !data->fan_mode[index])) return -EINVAL; ret = nct7904_write_reg(data, BANK_3, FANCTL1_FMR_REG + index, val ? data->fan_mode[index] : 0); val == 2 ? data->fan_mode[index] : 0); return ret ? ret : count; } /* Return 0 for manual mode or 1 for SmartFan mode */ static ssize_t show_mode(struct device *dev, /* Return 1 for manual mode or 2 for SmartFan mode */ static ssize_t show_enable(struct device *dev, struct device_attribute *devattr, char *buf) { int index = to_sensor_dev_attr(devattr)->index; Loading @@ -443,36 +444,36 @@ static ssize_t show_mode(struct device *dev, if (val < 0) return val; return sprintf(buf, "%d\n", val ? 1 : 0); return sprintf(buf, "%d\n", val ? 2 : 1); } /* 2 attributes per channel: pwm and mode */ static SENSOR_DEVICE_ATTR(fan1_pwm, S_IRUGO | S_IWUSR, static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, store_pwm, 0); static SENSOR_DEVICE_ATTR(fan1_mode, S_IRUGO | S_IWUSR, show_mode, store_mode, 0); static SENSOR_DEVICE_ATTR(fan2_pwm, S_IRUGO | S_IWUSR, static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, show_enable, store_enable, 0); static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, show_pwm, store_pwm, 1); static SENSOR_DEVICE_ATTR(fan2_mode, S_IRUGO | S_IWUSR, show_mode, store_mode, 1); static SENSOR_DEVICE_ATTR(fan3_pwm, S_IRUGO | S_IWUSR, static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO | S_IWUSR, show_enable, store_enable, 1); static SENSOR_DEVICE_ATTR(pwm3, S_IRUGO | S_IWUSR, show_pwm, store_pwm, 2); static SENSOR_DEVICE_ATTR(fan3_mode, S_IRUGO | S_IWUSR, show_mode, store_mode, 2); static SENSOR_DEVICE_ATTR(fan4_pwm, S_IRUGO | S_IWUSR, static SENSOR_DEVICE_ATTR(pwm3_enable, S_IRUGO | S_IWUSR, show_enable, store_enable, 2); static SENSOR_DEVICE_ATTR(pwm4, S_IRUGO | S_IWUSR, show_pwm, store_pwm, 3); static SENSOR_DEVICE_ATTR(fan4_mode, S_IRUGO | S_IWUSR, show_mode, store_mode, 3); static SENSOR_DEVICE_ATTR(pwm4_enable, S_IRUGO | S_IWUSR, show_enable, store_enable, 3); static struct attribute *nct7904_fanctl_attrs[] = { &sensor_dev_attr_fan1_pwm.dev_attr.attr, &sensor_dev_attr_fan1_mode.dev_attr.attr, &sensor_dev_attr_fan2_pwm.dev_attr.attr, &sensor_dev_attr_fan2_mode.dev_attr.attr, &sensor_dev_attr_fan3_pwm.dev_attr.attr, &sensor_dev_attr_fan3_mode.dev_attr.attr, &sensor_dev_attr_fan4_pwm.dev_attr.attr, &sensor_dev_attr_fan4_mode.dev_attr.attr, &sensor_dev_attr_pwm1.dev_attr.attr, &sensor_dev_attr_pwm1_enable.dev_attr.attr, &sensor_dev_attr_pwm2.dev_attr.attr, &sensor_dev_attr_pwm2_enable.dev_attr.attr, &sensor_dev_attr_pwm3.dev_attr.attr, &sensor_dev_attr_pwm3_enable.dev_attr.attr, &sensor_dev_attr_pwm4.dev_attr.attr, &sensor_dev_attr_pwm4_enable.dev_attr.attr, NULL }; Loading Loading
Documentation/hwmon/nct7904 +2 −2 Original line number Diff line number Diff line Loading @@ -35,11 +35,11 @@ temp1_input Local temperature (1/1000 degree, temp[2-9]_input CPU temperatures (1/1000 degree, 0.125 degree resolution) fan[1-4]_mode R/W, 0/1 for manual or SmartFan mode pwm[1-4]_enable R/W, 1/2 for manual or SmartFan mode Setting SmartFan mode is supported only if it has been previously configured by BIOS (or configuration EEPROM) fan[1-4]_pwm R/O in SmartFan mode, R/W in manual control mode pwm[1-4] R/O in SmartFan mode, R/W in manual control mode The driver checks sensor control registers and does not export the sensors that are not enabled. Anyway, a sensor that is enabled may actually be not Loading
drivers/hwmon/nct7904.c +29 −28 Original line number Diff line number Diff line Loading @@ -412,7 +412,8 @@ static ssize_t show_pwm(struct device *dev, return sprintf(buf, "%d\n", val); } static ssize_t store_mode(struct device *dev, struct device_attribute *devattr, static ssize_t store_enable(struct device *dev, struct device_attribute *devattr, const char *buf, size_t count) { int index = to_sensor_dev_attr(devattr)->index; Loading @@ -422,17 +423,17 @@ static ssize_t store_mode(struct device *dev, struct device_attribute *devattr, if (kstrtoul(buf, 10, &val) < 0) return -EINVAL; if (val > 1 || (val && !data->fan_mode[index])) if (val < 1 || val > 2 || (val == 2 && !data->fan_mode[index])) return -EINVAL; ret = nct7904_write_reg(data, BANK_3, FANCTL1_FMR_REG + index, val ? data->fan_mode[index] : 0); val == 2 ? data->fan_mode[index] : 0); return ret ? ret : count; } /* Return 0 for manual mode or 1 for SmartFan mode */ static ssize_t show_mode(struct device *dev, /* Return 1 for manual mode or 2 for SmartFan mode */ static ssize_t show_enable(struct device *dev, struct device_attribute *devattr, char *buf) { int index = to_sensor_dev_attr(devattr)->index; Loading @@ -443,36 +444,36 @@ static ssize_t show_mode(struct device *dev, if (val < 0) return val; return sprintf(buf, "%d\n", val ? 1 : 0); return sprintf(buf, "%d\n", val ? 2 : 1); } /* 2 attributes per channel: pwm and mode */ static SENSOR_DEVICE_ATTR(fan1_pwm, S_IRUGO | S_IWUSR, static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_pwm, store_pwm, 0); static SENSOR_DEVICE_ATTR(fan1_mode, S_IRUGO | S_IWUSR, show_mode, store_mode, 0); static SENSOR_DEVICE_ATTR(fan2_pwm, S_IRUGO | S_IWUSR, static SENSOR_DEVICE_ATTR(pwm1_enable, S_IRUGO | S_IWUSR, show_enable, store_enable, 0); static SENSOR_DEVICE_ATTR(pwm2, S_IRUGO | S_IWUSR, show_pwm, store_pwm, 1); static SENSOR_DEVICE_ATTR(fan2_mode, S_IRUGO | S_IWUSR, show_mode, store_mode, 1); static SENSOR_DEVICE_ATTR(fan3_pwm, S_IRUGO | S_IWUSR, static SENSOR_DEVICE_ATTR(pwm2_enable, S_IRUGO | S_IWUSR, show_enable, store_enable, 1); static SENSOR_DEVICE_ATTR(pwm3, S_IRUGO | S_IWUSR, show_pwm, store_pwm, 2); static SENSOR_DEVICE_ATTR(fan3_mode, S_IRUGO | S_IWUSR, show_mode, store_mode, 2); static SENSOR_DEVICE_ATTR(fan4_pwm, S_IRUGO | S_IWUSR, static SENSOR_DEVICE_ATTR(pwm3_enable, S_IRUGO | S_IWUSR, show_enable, store_enable, 2); static SENSOR_DEVICE_ATTR(pwm4, S_IRUGO | S_IWUSR, show_pwm, store_pwm, 3); static SENSOR_DEVICE_ATTR(fan4_mode, S_IRUGO | S_IWUSR, show_mode, store_mode, 3); static SENSOR_DEVICE_ATTR(pwm4_enable, S_IRUGO | S_IWUSR, show_enable, store_enable, 3); static struct attribute *nct7904_fanctl_attrs[] = { &sensor_dev_attr_fan1_pwm.dev_attr.attr, &sensor_dev_attr_fan1_mode.dev_attr.attr, &sensor_dev_attr_fan2_pwm.dev_attr.attr, &sensor_dev_attr_fan2_mode.dev_attr.attr, &sensor_dev_attr_fan3_pwm.dev_attr.attr, &sensor_dev_attr_fan3_mode.dev_attr.attr, &sensor_dev_attr_fan4_pwm.dev_attr.attr, &sensor_dev_attr_fan4_mode.dev_attr.attr, &sensor_dev_attr_pwm1.dev_attr.attr, &sensor_dev_attr_pwm1_enable.dev_attr.attr, &sensor_dev_attr_pwm2.dev_attr.attr, &sensor_dev_attr_pwm2_enable.dev_attr.attr, &sensor_dev_attr_pwm3.dev_attr.attr, &sensor_dev_attr_pwm3_enable.dev_attr.attr, &sensor_dev_attr_pwm4.dev_attr.attr, &sensor_dev_attr_pwm4_enable.dev_attr.attr, NULL }; Loading