예제 #1
0
파일: f71805f.c 프로젝트: rcplay/snake-os
static ssize_t set_fan_min(struct device *dev, struct device_attribute
                           *devattr, const char *buf, size_t count)
{
    struct f71805f_data *data = dev_get_drvdata(dev);
    struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
    int nr = attr->index;
    long val = simple_strtol(buf, NULL, 10);

    down(&data->update_lock);
    data->fan_low[nr] = fan_to_reg(val);
    f71805f_write16(data, F71805F_REG_FAN_LOW(nr), data->fan_low[nr]);
    up(&data->update_lock);

    return count;
}
예제 #2
0
static ssize_t set_pwm_auto_point_fan(struct device *dev,
				      struct device_attribute *devattr,
				      const char* buf, size_t count)
{
	struct f71805f_data *data = dev_get_drvdata(dev);
	struct sensor_device_attribute_2 *attr = to_sensor_dev_attr_2(devattr);
	int pwmnr = attr->nr;
	int apnr = attr->index;
	unsigned long val = simple_strtoul(buf, NULL, 10);

	mutex_lock(&data->update_lock);
	data->auto_points[pwmnr].fan[apnr] = fan_to_reg(val);
	f71805f_write16(data, F71805F_REG_PWM_AUTO_POINT_FAN(pwmnr, apnr),
		        data->auto_points[pwmnr].fan[apnr]);
	mutex_unlock(&data->update_lock);

	return count;
}
예제 #3
0
파일: f71805f.c 프로젝트: 020gzh/linux
static ssize_t set_fan_min(struct device *dev, struct device_attribute
			   *devattr, const char *buf, size_t count)
{
	struct f71805f_data *data = dev_get_drvdata(dev);
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	int nr = attr->index;
	long val;
	int err;

	err = kstrtol(buf, 10, &val);
	if (err)
		return err;

	mutex_lock(&data->update_lock);
	data->fan_low[nr] = fan_to_reg(val);
	f71805f_write16(data, F71805F_REG_FAN_LOW(nr), data->fan_low[nr]);
	mutex_unlock(&data->update_lock);

	return count;
}