示例#1
0
文件: lm92.c 项目: GDGroup/linux
static ssize_t show_temp_min_hyst(struct device *dev,
				  struct device_attribute *attr, char *buf)
{
	struct lm92_data *data = lm92_update_device(dev);
	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[t_min])
		       + TEMP_FROM_REG(data->temp[t_hyst]));
}
示例#2
0
文件: max1619.c 项目: OPSF/uClinux
static void max1619_remote_crit(struct i2c_client *client, int operation,
	int ctl_name, int *nrels_mag, long *results)
{
	struct max1619_data *data = client->data;

	if (operation == SENSORS_PROC_REAL_INFO)
		*nrels_mag = 0; /* magnitude */
	else if (operation == SENSORS_PROC_REAL_READ) {
		max1619_update_client(client);
		results[0] = TEMP_FROM_REG(data->remote_max);
		results[1] = TEMP_FROM_REG(data->remote_hyst);
		*nrels_mag = 2;
	} else if (operation == SENSORS_PROC_REAL_WRITE) {
		if (*nrels_mag >= 1) {
			data->remote_max = TEMP_TO_REG(results[0]);
			i2c_smbus_write_byte_data(client,
				MAX1619_REG_W_REMOTE_TMAX, data->remote_max);
		}
		if (*nrels_mag >= 2) {
			data->remote_hyst = TEMP_TO_REG(results[1]);
			i2c_smbus_write_byte_data(client,
				MAX1619_REG_W_REMOTE_THYST, data->remote_hyst);
		}
	}
}
示例#3
0
/* Return 0 for temp and disallow writes if pin used for in4 */
void sis5595_temp(struct i2c_client *client, int operation, int ctl_name,
		  int *nrels_mag, long *results)
{
	struct sis5595_data *data = client->data;
	if (operation == SENSORS_PROC_REAL_INFO)
		*nrels_mag = 1;
	else if (operation == SENSORS_PROC_REAL_READ) {
		if(data->maxins == 3) {
			sis5595_update_client(client);
			results[0] = TEMP_FROM_REG(data->temp_over);
			results[1] = TEMP_FROM_REG(data->temp_hyst);
			results[2] = TEMP_FROM_REG(data->temp);
		} else {
			results[0] = 0;
			results[1] = 0;
			results[2] = 0;
		}
		*nrels_mag = 3;
	} else if (operation == SENSORS_PROC_REAL_WRITE) {
		if(data->maxins == 3) {
			if (*nrels_mag >= 1) {
				data->temp_over = TEMP_TO_REG(results[0]);
				sis5595_write_value(client,
				    SIS5595_REG_TEMP_OVER, data->temp_over);
			}
			if (*nrels_mag >= 2) {
				data->temp_hyst = TEMP_TO_REG(results[1]);
				sis5595_write_value(client,
				    SIS5595_REG_TEMP_HYST, data->temp_hyst);
			}
		}
	}
}
示例#4
0
void maxi_temp(struct i2c_client *client, int operation, int ctl_name,
	       int *nrels_mag, long *results)
{
	struct maxi_data *data = client->data;
	int nr;

	if (data->type == nba) {
		maxi99_temp(client, operation, ctl_name, nrels_mag,
			    results);
		return;
	}

	nr = ctl_name - MAXI_SYSCTL_TEMP1 + 1;

	if (operation == SENSORS_PROC_REAL_INFO)
		*nrels_mag = 1;
	else if (operation == SENSORS_PROC_REAL_READ) {
		maxi_update_client(client);
		results[0] = TEMP_FROM_REG(data->temp_max[nr - 1]);
		results[1] = TEMP_FROM_REG(data->temp_hyst[nr - 1]);
		results[2] = TEMP_FROM_REG(data->temp[nr - 1]);
		*nrels_mag = 3;
	} else if (operation == SENSORS_PROC_REAL_WRITE) {
		/* temperature range can not be changed */
	}
}
示例#5
0
文件: lm92.c 项目: GDGroup/linux
static ssize_t show_temp_hyst(struct device *dev,
			      struct device_attribute *devattr, char *buf)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct lm92_data *data = lm92_update_device(dev);
	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp[attr->index])
		       - TEMP_FROM_REG(data->temp[t_hyst]));
}
示例#6
0
文件: adm1025.c 项目: MohdVara/linux
static ssize_t
show_temp_max(struct device *dev, struct device_attribute *attr, char *buf)
{
	int index = to_sensor_dev_attr(attr)->index;
	struct adm1025_data *data = adm1025_update_device(dev);
	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max[index]));
}
示例#7
0
void adm1025_rm_temp(struct i2c_client *client, int operation, int ctl_name,
		  int *nrels_mag, long *results)
{
	struct adm1025_data *data = client->data;
	if (operation == SENSORS_PROC_REAL_INFO)
		*nrels_mag = 1;
	else if (operation == SENSORS_PROC_REAL_READ) {
		adm1025_update_client(client);
		results[0] = TEMP_LIMIT_FROM_REG(data->rtemp_max);
		results[1] = TEMP_LIMIT_FROM_REG(data->rtemp_min);
		results[2] = TEMP_FROM_REG(data->rtemp);
		*nrels_mag = 3;
	} else if (operation == SENSORS_PROC_REAL_WRITE) {
		if (*nrels_mag >= 1) {
			data->rtemp_max = TEMP_LIMIT_TO_REG(results[0]);
			adm1025_write_value(client, ADM1025_REG_RTEMP_HIGH,
					    data->rtemp_max);
		}
		if (*nrels_mag >= 2) {
			data->rtemp_min = TEMP_LIMIT_TO_REG(results[1]);
			adm1025_write_value(client, ADM1025_REG_RTEMP_LOW,
					    data->rtemp_min);
		}
	}
}
示例#8
0
static ssize_t get_temp_max_hyst(struct device *dev, struct device_attribute
				 *attr, char *buf)
{
	int n = to_sensor_dev_attr(attr)->index;
	struct gl520_data *data = gl520_update_device(dev);

	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_max_hyst[n]));
}
示例#9
0
static ssize_t show_temp_offset(struct device *dev, struct device_attribute
		*attr, char *buf)
{
	struct sensor_device_attribute *sensor_attr = to_sensor_dev_attr(attr);
	int nr = sensor_attr->index;
	struct smsc47m192_data *data = smsc47m192_update_device(dev);
	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_offset[nr]));
}
示例#10
0
文件: max1619.c 项目: OPSF/uClinux
static void max1619_local_temp(struct i2c_client *client, int operation,
	int ctl_name, int *nrels_mag, long *results)
{
	struct max1619_data *data = client->data;

	if (operation == SENSORS_PROC_REAL_INFO)
		*nrels_mag = 0; /* magnitude */
	else if (operation == SENSORS_PROC_REAL_READ) {
		max1619_update_client(client);
		results[0] = TEMP_FROM_REG(data->local_temp);
		*nrels_mag = 1;
	}

}
示例#11
0
static ssize_t set_temp1_crit_hyst(struct device *dev, struct device_attribute *attr, const char *buf,
	size_t count)
{
	struct i2c_client *client = to_i2c_client(dev);
	struct lm92_data *data = i2c_get_clientdata(client);
	long val = simple_strtol(buf, NULL, 10);

	mutex_lock(&data->update_lock);
	data->temp1_hyst = TEMP_FROM_REG(data->temp1_crit) - val;
	i2c_smbus_write_word_data(client, LM92_REG_TEMP_HYST,
				  swab16(TEMP_TO_REG(data->temp1_hyst)));
	mutex_unlock(&data->update_lock);
	return count;
}
示例#12
0
static ssize_t set_temp1_crit_hyst(struct device *dev,
				   struct device_attribute *attr,
				   const char *buf, size_t count)
{
	struct i2c_client *client = to_i2c_client(dev);
	struct lm92_data *data = i2c_get_clientdata(client);
	long val;
	int err;

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

	mutex_lock(&data->update_lock);
	data->temp1_hyst = TEMP_FROM_REG(data->temp1_crit) - val;
	i2c_smbus_write_word_swapped(client, LM92_REG_TEMP_HYST,
				     TEMP_TO_REG(data->temp1_hyst));
	mutex_unlock(&data->update_lock);
	return count;
}
示例#13
0
文件: lm92.c 项目: GDGroup/linux
static ssize_t set_temp_hyst(struct device *dev,
			     struct device_attribute *devattr,
			     const char *buf, size_t count)
{
	struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
	struct lm92_data *data = dev_get_drvdata(dev);
	struct i2c_client *client = data->client;
	long val;
	int err;

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

	mutex_lock(&data->update_lock);
	data->temp[t_hyst] = TEMP_FROM_REG(data->temp[attr->index]) - val;
	i2c_smbus_write_word_swapped(client, LM92_REG_TEMP_HYST,
				     TEMP_TO_REG(data->temp[t_hyst]));
	mutex_unlock(&data->update_lock);
	return count;
}
示例#14
0
static ssize_t show_temp_hyst(struct device *dev, struct device_attribute *da,
			      char *buf)
{
	struct lm78_data *data = lm78_update_device(dev);
	return sprintf(buf, "%d\n", TEMP_FROM_REG(data->temp_hyst));
}