Skip to contentSkip to conversation

Allow the configuration register to be

RFC PATCH In review Shubhrajyoti D 3 participants 11 messages Sep 13, 2010 – Sep 14, 2010 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 Allow the configuration register to be

The patch intends to allow the configuration of resolution polarity etc.

---
 drivers/hwmon/lm75.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
drivers/hwmon/lm75.c +35 -0
index 2a5b12a..abf3135 100644
@@ -111,7 +111,41 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
 	mutex_unlock(&data->update_lock);
 	return count;
 }
+static ssize_t set_configuration(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	s32 status;
+	struct i2c_client *client = to_i2c_client(dev);
+	struct lm75_data *data = i2c_get_clientdata(client);
+	unsigned long temp;
+	int error;
+	error = strict_strtol(buf, 10, &temp);
+	if (error)
+		return error;
+
+	data->orig_conf = (u8)temp;
+	/* I2C write to the configuration register */
+	status = lm75_write_value(client, LM75_REG_CONF,
+			data->orig_conf);
+	return count;
+}
+
+static ssize_t show_configuration(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	int status = lm75_read_value(client, LM75_REG_CONF);
+	if (status < 0) {
+		dev_dbg(&client->dev, "Can't read config? %d\n", status);
+		return status;
+	}
+
+	return sprintf(buf, "%u\n", status);
+}
 
+static SENSOR_DEVICE_ATTR(configuration, S_IWUSR | S_IRUGO,
+			show_configuration, set_configuration, 0);
 static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
 			show_temp, set_temp, 1);
 static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO,
@@ -122,6 +156,7 @@ static struct attribute *lm75_attributes[] = {
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	&sensor_dev_attr_temp1_max.dev_attr.attr,
 	&sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
+	&sensor_dev_attr_configuration.dev_attr.attr,
 
 	NULL
 };
Signature · 7 lines
1.7.0.4


_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw
Quoted 55 lines · Shubhrajyoti D

The patch intends to allow the configuration of resolution polarity etc.

---
 drivers/hwmon/lm75.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
drivers/hwmon/lm75.c +34 -0
index 2a5b12a..abf3135 100644
@@ -111,7 +111,41 @@ static ssize_t set_temp(struct device *dev, struct device_attribute *da,
 	mutex_unlock(&data->update_lock);
 	return count;
 }
+static ssize_t set_configuration(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	s32 status;
+	struct i2c_client *client = to_i2c_client(dev);
+	struct lm75_data *data = i2c_get_clientdata(client);
+	unsigned long temp;
+	int error;
+	error = strict_strtol(buf, 10, &temp);
+	if (error)
+		return error;
+
+	data->orig_conf = (u8)temp;
+	/* I2C write to the configuration register */
+	status = lm75_write_value(client, LM75_REG_CONF,
+			data->orig_conf);
+	return count;
+}
+
+static ssize_t show_configuration(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	int status = lm75_read_value(client, LM75_REG_CONF);
+	if (status < 0) {
+		dev_dbg(&client->dev, "Can't read config? %d\n", status);
+		return status;
+	}
+
+	return sprintf(buf, "%u\n", status);
+}
 
+static SENSOR_DEVICE_ATTR(configuration, S_IWUSR | S_IRUGO,
+			show_configuration, set_configuration, 0);
 static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
 			show_temp, set_temp, 1);
 static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO,

drivers/hwmon/lm75.c static struct attribute *lm75_attributes[] = { · line 162

Quoted 7 lines
drivers/hwmon/lm75.c +1 -0
@@ -122,6 +156,7 @@ static struct attribute *lm75_attributes[] = {
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	&sensor_dev_attr_temp1_max.dev_attr.attr,
 	&sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
+	&sensor_dev_attr_configuration.dev_attr.attr,
 
 	NULL
 };

Massive NACK. You are exposing a raw register interface to user-space, in a way which can't be standardized. This goes against the philosophy of our standard sysfs interface.

If you have an LM75-style device in an embedded device, configuration should be provided as platform data. For other cases, either the BIOS/firmware should configure the device properly, or you can do it with i2c-dev + i2cset from user-space.

If any properly really needs to be exposed though sysfs in your opinion, it must be standardized first and stick to the one file, one feature philosophy.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#2 lore raw
In reply to Shubhrajyoti D
Quoted 79 lines

-----Original Message-----
From: Jean Delvare [mailto:[email protected]]
Sent: Monday, September 13, 2010 7:58 PM
To: Datta, Shubhrajyoti
Cc: [email protected]
Subject: Re: [lm-sensors] [RFC PATCH] Allow the configuration register to be written

drivers/hwmon/lm75.c static ssize_t set_temp(struct device *dev, struct

Quoted 13 lines · Shubhrajyoti D

The patch intends to allow the configuration of resolution polarity etc.

---
 drivers/hwmon/lm75.c |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)
drivers/hwmon/lm75.c +0 -0
index 2a5b12a..abf3135 100644
@@ -111,7 +111,41 @@ static ssize_t set_temp(struct device *dev, struct

device_attribute *da,

Quoted 42 lines
drivers/hwmon/lm75.c +34 -0
 	mutex_unlock(&data->update_lock);
 	return count;
 }
+static ssize_t set_configuration(struct device *dev,
+				struct device_attribute *attr,
+				const char *buf, size_t count)
+{
+	s32 status;
+	struct i2c_client *client = to_i2c_client(dev);
+	struct lm75_data *data = i2c_get_clientdata(client);
+	unsigned long temp;
+	int error;
+	error = strict_strtol(buf, 10, &temp);
+	if (error)
+		return error;
+
+	data->orig_conf = (u8)temp;
+	/* I2C write to the configuration register */
+	status = lm75_write_value(client, LM75_REG_CONF,
+			data->orig_conf);
+	return count;
+}
+
+static ssize_t show_configuration(struct device *dev,
+				struct device_attribute *attr, char *buf)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	int status = lm75_read_value(client, LM75_REG_CONF);
+	if (status < 0) {
+		dev_dbg(&client->dev, "Can't read config? %d\n", status);
+		return status;
+	}
+
+	return sprintf(buf, "%u\n", status);
+}
 
+static SENSOR_DEVICE_ATTR(configuration, S_IWUSR | S_IRUGO,
+			show_configuration, set_configuration, 0);
 static SENSOR_DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO,
 			show_temp, set_temp, 1);
 static SENSOR_DEVICE_ATTR(temp1_max_hyst, S_IWUSR | S_IRUGO,

drivers/hwmon/lm75.c static struct attribute *lm75_attributes[] = { · line 162

Quoted 7 lines
drivers/hwmon/lm75.c +1 -0
@@ -122,6 +156,7 @@ static struct attribute *lm75_attributes[] = {
 	&sensor_dev_attr_temp1_input.dev_attr.attr,
 	&sensor_dev_attr_temp1_max.dev_attr.attr,
 	&sensor_dev_attr_temp1_max_hyst.dev_attr.attr,
+	&sensor_dev_attr_configuration.dev_attr.attr,
 
 	NULL
 };

Massive NACK. You are exposing a raw register interface to user-space, in a way which can't be standardized. This goes against the philosophy of our standard sysfs interface.

Quoted 4 lines

If you have an LM75-style device in an embedded device, configuration should be provided as platform data. For other cases, either the BIOS/firmware should configure the device properly, or you can do it with i2c-dev + i2cset from user-space.

Ok makes sense.

Quoted 4 lines

If any properly really needs to be exposed though sysfs in your opinion, it must be standardized first and stick to the one file, one feature philosophy.

I chose it as a sysfs because ideally the resolution/time is a tradeoff applications are better suited and not board dependent. However agree to your "one file, one feature" comment. Was wondering if any other driver has similar interface or sysfs entry(resolution).

Quoted 4 lines

--
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#3 lore raw
In reply to Shubhrajyoti D
Quoted 10 lines · Shubhrajyoti
Quoted 9 lines

From: Jean Delvare [mailto:[email protected]]
Massive NACK. You are exposing a raw register interface to user-space, in a way which can't be standardized. This goes against the philosophy of our standard sysfs interface.

If you have an LM75-style device in an embedded device, configuration should be provided as platform data. For other cases, either the BIOS/firmware should configure the device properly, or you can do it with i2c-dev + i2cset from user-space.

Quoted 6 lines

Ok makes sense.

Quoted 4 lines

If any properly really needs to be exposed though sysfs in your opinion, it must be standardized first and stick to the one file, one feature philosophy.

I chose it as a sysfs because ideally the resolution/time is a tradeoff applications are better suited and not board dependent.

Polarity OTOH is quite board-specific.

Quoted 1 line

However agree to your "one file, one feature" comment. Was wondering if any other driver has similar interface or sysfs entry(resolution).

Not that I know of. At least there's no standard sysfs attribute for that. We have one for update rate, but it's fairly recent. Having one for resolution would certainly make sense for simple temperature sensors.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#4 lore raw
In reply to Shubhrajyoti D
Quoted 18 lines · Jean Delvare
Quoted 10 lines · Shubhrajyoti
Quoted 9 lines

From: Jean Delvare [mailto:[email protected]]
Massive NACK. You are exposing a raw register interface to user-space, in a way which can't be standardized. This goes against the philosophy of our standard sysfs interface.

If you have an LM75-style device in an embedded device, configuration should be provided as platform data. For other cases, either the BIOS/firmware should configure the device properly, or you can do it with i2c-dev + i2cset from user-space.

Quoted 6 lines

Ok makes sense.

Quoted 4 lines

If any properly really needs to be exposed though sysfs in your opinion, it must be standardized first and stick to the one file, one feature philosophy.

I chose it as a sysfs because ideally the resolution/time is a tradeoff applications are better suited and not board dependent.

Quoted 8 lines

Polarity OTOH is quite board-specific.

Quoted 1 line

However agree to your "one file, one feature" comment. Was wondering if any other driver has similar interface or sysfs entry(resolution).

Not that I know of. At least there's no standard sysfs attribute for that. We have one for update rate, but it's fairly recent. Having one for resolution would certainly make sense for simple temperature sensors.

I found the following attributes used for the update inverval.

adt7470.c auto_update_interval
lm95241.c rate
adm1031.c update_rate

Not sure about adt7470.c, ince it reflects an automatic interval, but would it make sense to update lm95241.c to use the standard attribute ?

On a side note, update_rate (or rate) doesn't really reflect its use. A "rate" would be measured in updates/time, not in absolute time. Or, in other words, it reflects a frequency, not an interval. So we are really talking about intervals. Not sure if that is worth bitching about, but since the attribute is quite new it might make sense to think about it.

Resolution would have to be sensor dependent, since each sensor can have its own resolution. Would be nice to have an attribute for that.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#5 lore raw
In reply to Shubhrajyoti D
Quoted 6 lines · Guenter Roeck
Quoted 4 lines · Jean Delvare

Not that I know of. At least there's no standard sysfs attribute for that. We have one for update rate, but it's fairly recent. Having one for resolution would certainly make sense for simple temperature sensors.

Quoted 8 lines

I found the following attributes used for the update inverval.

adt7470.c auto_update_interval
lm95241.c rate
adm1031.c update_rate

Not sure about adt7470.c, ince it reflects an automatic interval, but would it make sense to update lm95241.c to use the standard attribute ?

Yes it would.

Quoted 5 lines

On a side note, update_rate (or rate) doesn't really reflect its use. A "rate" would be measured in updates/time, not in absolute time. Or, in other words, it reflects a frequency, not an interval. So we are really talking about intervals. Not sure if that is worth bitching about, but since the attribute is quite new it might make sense to think about it.

Jonathan Cameron (Cc'd) had a similar concern:
http://lists.lm-sensors.org/pipermail/lm-sensors/2010-May/028596.html

Nobody seemed to care back then. I can't disagree with both of you, but OTOH I don't feel too strongly about it either. So if someone submits a patch making things better, that's fine with me, but I won't spend my own time on it.

Quoted 2 lines

Resolution would have to be sensor dependent, since each sensor can have its own resolution. Would be nice to have an attribute for that.

Not too sure about that. I had the same reaction at first, but do we actually know of devices where the resolution isn't global?

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#6 lore raw
In reply to Shubhrajyoti D
Quoted 24 lines · Jean Delvare
Quoted 6 lines · Guenter Roeck
Quoted 4 lines · Jean Delvare

Not that I know of. At least there's no standard sysfs attribute for that. We have one for update rate, but it's fairly recent. Having one for resolution would certainly make sense for simple temperature sensors.

Quoted 8 lines

I found the following attributes used for the update inverval.

adt7470.c auto_update_interval
lm95241.c rate
adm1031.c update_rate

Not sure about adt7470.c, ince it reflects an automatic interval, but would it make sense to update lm95241.c to use the standard attribute ?

Yes it would.

Quoted 5 lines

On a side note, update_rate (or rate) doesn't really reflect its use. A "rate" would be measured in updates/time, not in absolute time. Or, in other words, it reflects a frequency, not an interval. So we are really talking about intervals. Not sure if that is worth bitching about, but since the attribute is quite new it might make sense to think about it.

Quoted 8 lines

Jonathan Cameron (Cc'd) had a similar concern:
http://lists.lm-sensors.org/pipermail/lm-sensors/2010-May/028596.html

Nobody seemed to care back then. I can't disagree with both of you, but OTOH I don't feel too strongly about it either. So if someone submits a patch making things better, that's fine with me, but I won't spend my own time on it.

I'll submit a set of patches. update_interval ok ? It reflects the time between events, while period tends to reflect a duration.

Quoted 6 lines
Quoted 2 lines

Resolution would have to be sensor dependent, since each sensor can have its own resolution. Would be nice to have an attribute for that.

Not too sure about that. I had the same reaction at first, but do we actually know of devices where the resolution isn't global?

Yes, in the lm90 driver. Only max6657/58/59 and max6646 have extended local temperatures, all other chips have only 8 bit resolution for the local temperature. Remote temperatures are all extended, ie have higher resoution.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#7 lore raw
In reply to Shubhrajyoti D
Quoted 22 lines · Guenter Roeck
Quoted 21 lines · Jean Delvare
Quoted 8 lines · Guenter Roeck

I found the following attributes used for the update inverval.

adt7470.c auto_update_interval
lm95241.c rate
adm1031.c update_rate

Not sure about adt7470.c, ince it reflects an automatic interval, but would it make sense to update lm95241.c to use the standard attribute ?

Yes it would.

Quoted 5 lines

On a side note, update_rate (or rate) doesn't really reflect its use. A "rate" would be measured in updates/time, not in absolute time. Or, in other words, it reflects a frequency, not an interval. So we are really talking about intervals. Not sure if that is worth bitching about, but since the attribute is quite new it might make sense to think about it.

Jonathan Cameron (Cc'd) had a similar concern:
http://lists.lm-sensors.org/pipermail/lm-sensors/2010-May/028596.html

Quoted 7 lines
Quoted 4 lines

Nobody seemed to care back then. I can't disagree with both of you, but OTOH I don't feel too strongly about it either. So if someone submits a patch making things better, that's fine with me, but I won't spend my own time on it.

I'll submit a set of patches. update_interval ok ? It reflects the time between events, while period tends to reflect a duration.

Yes, I would be fine with update_interval. Jonathan, OK with you too?

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

Resolution would have to be sensor dependent, since each sensor can have its own resolution. Would be nice to have an attribute for that.

Not too sure about that. I had the same reaction at first, but do we actually know of devices where the resolution isn't global?

Yes, in the lm90 driver. Only max6657/58/59 and max6646 have extended local temperatures, all other chips have only 8 bit resolution for the local temperature. Remote temperatures are all extended, ie have higher resoution.

But resolution can't be changed on these chips, can it? I think the main purpose of these files is to let the user change the resolution for chips which support this (usually this is an update speed / resolution trade-off). Or do you believe that having read-only attributes exposing fixed resolutions would be valuable?

I'm a little worried because resolution as a bit number isn't too informative and doesn't quite work as a device-independent value. If you really want the information to be exposed to user-space for all devices, then we'd rather use actual sensor units (mV, m°C, whatever) for resolution, and possibly add other attributes for the range. But this means adding a whole lot of attribute files for some devices (if we do it on a per-channel basis), so we first have to determine whether it is really worth it. I don't think it is, but you can try and convince me.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#8 lore raw
In reply to Shubhrajyoti D

Hi Jean,

Quoted 36 lines · Jean Delvare
Quoted 22 lines · Guenter Roeck
Quoted 21 lines · Jean Delvare
Quoted 8 lines · Guenter Roeck

I found the following attributes used for the update inverval.

adt7470.c auto_update_interval
lm95241.c rate
adm1031.c update_rate

Not sure about adt7470.c, ince it reflects an automatic interval, but would it make sense to update lm95241.c to use the standard attribute ?

Yes it would.

Quoted 5 lines

On a side note, update_rate (or rate) doesn't really reflect its use. A "rate" would be measured in updates/time, not in absolute time. Or, in other words, it reflects a frequency, not an interval. So we are really talking about intervals. Not sure if that is worth bitching about, but since the attribute is quite new it might make sense to think about it.

Jonathan Cameron (Cc'd) had a similar concern:
http://lists.lm-sensors.org/pipermail/lm-sensors/2010-May/028596.html

Quoted 7 lines
Quoted 4 lines

Nobody seemed to care back then. I can't disagree with both of you, but OTOH I don't feel too strongly about it either. So if someone submits a patch making things better, that's fine with me, but I won't spend my own time on it.

I'll submit a set of patches. update_interval ok ? It reflects the time between events, while period tends to reflect a duration.

Yes, I would be fine with update_interval. Jonathan, OK with you too?

Quoted 3 lines
Quoted 3 lines
Quoted 2 lines

Resolution would have to be sensor dependent, since each sensor can have its own resolution. Would be nice to have an attribute for that.

Quoted 8 lines
Quoted 6 lines
Quoted 2 lines

Not too sure about that. I had the same reaction at first, but do we actually know of devices where the resolution isn't global?

Yes, in the lm90 driver. Only max6657/58/59 and max6646 have extended local temperatures, all other chips have only 8 bit resolution for the local temperature. Remote temperatures are all extended, ie have higher resoution.

But resolution can't be changed on these chips, can it? I think the

Correct.

Quoted 5 lines

main purpose of these files is to let the user change the resolution for chips which support this (usually this is an update speed / resolution trade-off). Or do you believe that having read-only attributes exposing fixed resolutions would be valuable?

Good point. Probably not really. More like nice to have.

Quoted 5 lines

I'm a little worried because resolution as a bit number isn't too informative and doesn't quite work as a device-independent value. If you really want the information to be exposed to user-space for all devices, then we'd rather use actual sensor units (mV, m°C, whatever) for resolution, and possibly add other attributes for the range. But

I assumed it would be in units. Not sure how to express resolution as bit number in the first place.

Quoted 5 lines

this means adding a whole lot of attribute files for some devices (if we do it on a per-channel basis), so we first have to determine whether it is really worth it. I don't think it is, but you can try and convince me.

Thinking about it, I'd rather keep it in mind in case someone else sees the need to it and convinces both of us...

Another question if both attributes (rate and resolution) would make sense as module parameters instead. Are those attributes expected to vary across multiple instances of the same driver ?

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#9 lore raw
In reply to Shubhrajyoti D
Quoted 23 lines · Guenter Roeck

Hi Jean,

Quoted 10 lines · Jean Delvare
Quoted 7 lines · Guenter Roeck
Quoted 2 lines · Jean Delvare

Not too sure about that. I had the same reaction at first, but do we actually know of devices where the resolution isn't global?

Yes, in the lm90 driver. Only max6657/58/59 and max6646 have extended local temperatures, all other chips have only 8 bit resolution for the local temperature. Remote temperatures are all extended, ie have higher resoution.

But resolution can't be changed on these chips, can it? I think the

Correct.

Quoted 5 lines

main purpose of these files is to let the user change the resolution for chips which support this (usually this is an update speed / resolution trade-off). Or do you believe that having read-only attributes exposing fixed resolutions would be valuable?

Good point. Probably not really. More like nice to have.

Quoted 8 lines
Quoted 5 lines

I'm a little worried because resolution as a bit number isn't too informative and doesn't quite work as a device-independent value. If you really want the information to be exposed to user-space for all devices, then we'd rather use actual sensor units (mV, m°C, whatever) for resolution, and possibly add other attributes for the range. But

I assumed it would be in units. Not sure how to express resolution as bit number in the first place.

This is how datasheets usually refer to the future. The configuration bits let the user select between 9-, 10, 11 and 12-bit resolution ADC (with increasing integration time.)

As most temperature sensors we deal with agree that 9-bit resolution means LSB weight of 0.5°C, it could almost be used as a standard. But of course there could be a device doing things differently someday, which is why we probably don't want to use the ADC bit notation.

Quoted 11 lines
Quoted 4 lines

this means adding a whole lot of attribute files for some devices (if we do it on a per-channel basis), so we first have to determine whether it is really worth it. I don't think it is, but you can try and convince me.

Thinking about it, I'd rather keep it in mind in case someone else sees the need to it and convinces both of us...

Another question if both attributes (rate and resolution) would make sense as module parameters instead. Are those attributes expected to vary across multiple instances of the same driver ?

I see no reason to use module parameters for these. It does make sense to use different settings on different chips in the same family (e.g. one is on the motherboard and the other on the graphics adapter), plus sysfs attribute values are easier to change at run-time (these attributes could even be added to libsensors.)

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#10 lore raw
In reply to Shubhrajyoti D
Quoted 33 lines · Jean Delvare
Quoted 23 lines · Guenter Roeck

Hi Jean,

Quoted 10 lines · Jean Delvare
Quoted 7 lines · Guenter Roeck
Quoted 2 lines · Jean Delvare

Not too sure about that. I had the same reaction at first, but do we actually know of devices where the resolution isn't global?

Yes, in the lm90 driver. Only max6657/58/59 and max6646 have extended local temperatures, all other chips have only 8 bit resolution for the local temperature. Remote temperatures are all extended, ie have higher resoution.

But resolution can't be changed on these chips, can it? I think the

Correct.

Quoted 5 lines

main purpose of these files is to let the user change the resolution for chips which support this (usually this is an update speed / resolution trade-off). Or do you believe that having read-only attributes exposing fixed resolutions would be valuable?

Good point. Probably not really. More like nice to have.

Quoted 8 lines
Quoted 5 lines

I'm a little worried because resolution as a bit number isn't too informative and doesn't quite work as a device-independent value. If you really want the information to be exposed to user-space for all devices, then we'd rather use actual sensor units (mV, m°C, whatever) for resolution, and possibly add other attributes for the range. But

I assumed it would be in units. Not sure how to express resolution as bit number in the first place.

Quoted 9 lines

This is how datasheets usually refer to the future. The configuration bits let the user select between 9-, 10, 11 and 12-bit resolution ADC (with increasing integration time.)

As most temperature sensors we deal with agree that 9-bit resolution means LSB weight of 0.5°C, it could almost be used as a standard. But of course there could be a device doing things differently someday, which is why we probably don't want to use the ADC bit notation.

Agreed.

Quoted 12 lines
Quoted 11 lines
Quoted 4 lines

this means adding a whole lot of attribute files for some devices (if we do it on a per-channel basis), so we first have to determine whether it is really worth it. I don't think it is, but you can try and convince me.

Thinking about it, I'd rather keep it in mind in case someone else sees the need to it and convinces both of us...

Another question if both attributes (rate and resolution) would make sense as module parameters instead. Are those attributes expected to vary across multiple instances of the same driver ?

Quoted 6 lines

I see no reason to use module parameters for these. It does make sense to use different settings on different chips in the same family (e.g. one is on the motherboard and the other on the graphics adapter), plus sysfs attribute values are easier to change at run-time (these attributes could even be added to libsensors.)

Makes sense.

Guenter

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors