hwmon: (lm90) use programmed update rate
Subsystems (2)
PATCH 1/1 hwmon: (lm90) use programmed update rate
The lm90 driver programs the sensor chip to update its readings at 2 Hz (500 ms between readings). However, the driver only does reads from the chip at intervals of 2 * HZ (2000 ms between readings). Change the driver update rate to the programmed update rate.
---
I think this was probably just a simple mistake made by the original author of the driver, with the intention being that the driver update the cached values every 500 ms. The change is confirmed against the adm1032 datasheet. The chip is updating every 500 ms.
drivers/hwmon/lm90.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/hwmon/lm90.c +1 -1
@@ -960,7 +960,7 @@ static struct lm90_data *lm90_update_device(struct device *dev)mutex_lock (&data->update_lock); -if (time_after (jiffies, data->last_updated +HZ *2 ) || !data->valid) { +if (time_after (jiffies, data->last_updated +HZ /2 ) || !data->valid) {u8 h, l;dev_dbg (&client->dev,"Updating lm90 data.\n" );
Signature · 7 lines
1.5.4.3 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 5 lines · Ira W. Snyder
The lm90 driver programs the sensor chip to update its readings at 2 Hz (500 ms between readings). However, the driver only does reads from the chip at intervals of 2 * HZ (2000 ms between readings). Change the driver update rate to the programmed update rate.
Quoted 8 lines
Signed-off-by Ira W. Snyder <[email protected]>---
I think this was probably just a simple mistake made by the original author of the driver, with the intention being that the driver update the cached values every 500 ms. The change is confirmed against the adm1032 datasheet. The chip is updating every 500 ms.
Any comments on this patch? It has almost been lost off my radar.
Jean, I think this should be pretty uncontroversial. Can you pick it up?
Thanks,
Ira
Quoted 24 lines
drivers/hwmon/lm90.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/hwmon/lm90.c +1
-1@@ -960,7 +960,7 @@ static struct lm90_data *lm90_update_device(struct device *dev)mutex_lock (&data->update_lock); -if (time_after (jiffies, data->last_updated +HZ *2 ) || !data->valid) { +if (time_after (jiffies, data->last_updated +HZ /2 ) || !data->valid) {u8 h, l;dev_dbg (&client->dev,"Updating lm90 data.\n" );Signature · 7 lines
1.5.4.3 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Ira,
Quoted 15 lines · Ira W. Snyder
Quoted 5 lines · Ira W. Snyder
The lm90 driver programs the sensor chip to update its readings at 2 Hz (500 ms between readings). However, the driver only does reads from the chip at intervals of 2 * HZ (2000 ms between readings). Change the driver update rate to the programmed update rate.
Quoted 8 lines
Signed-off-by Ira W. Snyder <[email protected]>---
I think this was probably just a simple mistake made by the original author of the driver, with the intention being that the driver update the cached values every 500 ms. The change is confirmed against the adm1032 datasheet. The chip is updating every 500 ms.
Quoted 3 lines
Any comments on this patch? It has almost been lost off my radar.
Jean, I think this should be pretty uncontroversial. Can you pick it up?
There is a small problem with your patch. Yes I think I made a mistake originally, probably just copied the cache lifetime from another driver and did not realize it didn't match the refresh rate. However, it is also important for at least some I2C/SMBus devices to not be interrupted (by serial bus access) when they sample the data, otherwise the sampling is lost. For this reason, we try to make the cache lifetime always slightly longer than the polling period.
So, having a cache lifetime of HZ / 2 is too tight IMHO. I would be happy with HZ / 2 + HZ / 10. Would that work for you?
Quoted 16 lines
Quoted 16 lines
drivers/hwmon/lm90.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/hwmon/lm90.c +1
-1@@ -960,7 +960,7 @@ static struct lm90_data *lm90_update_device(struct device *dev)mutex_lock (&data->update_lock); -if (time_after (jiffies, data->last_updated +HZ *2 ) || !data->valid) { +if (time_after (jiffies, data->last_updated +HZ /2 ) || !data->valid) {u8 h, l;dev_dbg (&client->dev,"Updating lm90 data.\n" );
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 30 lines · Jean Delvare
Hi Ira,
Quoted 15 lines · Ira W. Snyder
Quoted 5 lines · Ira W. Snyder
The lm90 driver programs the sensor chip to update its readings at 2 Hz (500 ms between readings). However, the driver only does reads from the chip at intervals of 2 * HZ (2000 ms between readings). Change the driver update rate to the programmed update rate.
Quoted 8 lines
Signed-off-by Ira W. Snyder <[email protected]>---
I think this was probably just a simple mistake made by the original author of the driver, with the intention being that the driver update the cached values every 500 ms. The change is confirmed against the adm1032 datasheet. The chip is updating every 500 ms.
Quoted 3 lines
Any comments on this patch? It has almost been lost off my radar.
Jean, I think this should be pretty uncontroversial. Can you pick it up?
There is a small problem with your patch. Yes I think I made a mistake originally, probably just copied the cache lifetime from another driver and did not realize it didn't match the refresh rate. However, it is also important for at least some I2C/SMBus devices to not be interrupted (by serial bus access) when they sample the data, otherwise the sampling is lost. For this reason, we try to make the cache lifetime always slightly longer than the polling period.
Quoted 3 lines
So, having a cache lifetime of HZ / 2 is too tight IMHO. I would be happy with HZ / 2 + HZ / 10. Would that work for you?
That should be fine. I never knew that some sensors have a problem with being read while sampling.
For what it is worth, I haven't seen a problem polling the adm1032 sensor at 500ms intervals. In my application, I take readings from all chips on my board every 500ms.
Would you like me to submit a new patch, or do you just want to edit the patch before you apply it? I'm happy with either one.
Thanks,
Ira
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
drivers/hwmon/lm90.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)drivers/hwmon/lm90.c +0
-0@@ -960,7 +960,7 @@ static struct lm90_data *lm90_update_device(struct device *dev)
Quoted 11 lines
Quoted 7 lines
Quoted 7 lines
drivers/hwmon/lm90.c +1
-1mutex_lock (&data->update_lock); -if (time_after (jiffies, data->last_updated +HZ *2 ) || !data->valid) { +if (time_after (jiffies, data->last_updated +HZ /2 ) || !data->valid) {u8 h, l;dev_dbg (&client->dev,"Updating lm90 data.\n" );Signature · 1 line
Jean Delvare
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Ira,
Quoted 13 lines · Ira W. Snyder
Quoted 11 lines · Jean Delvare
There is a small problem with your patch. Yes I think I made a mistake originally, probably just copied the cache lifetime from another driver and did not realize it didn't match the refresh rate. However, it is also important for at least some I2C/SMBus devices to not be interrupted (by serial bus access) when they sample the data, otherwise the sampling is lost. For this reason, we try to make the cache lifetime always slightly longer than the polling period.
So, having a cache lifetime of HZ / 2 is too tight IMHO. I would be happy with HZ / 2 + HZ / 10. Would that work for you?
Quoted 6 lines
That should be fine. I never knew that some sensors have a problem with being read while sampling.
For what it is worth, I haven't seen a problem polling the adm1032 sensor at 500ms intervals. In my application, I take readings from all chips on my board every 500ms.
I know that the ADM1032 chip isn't affected, I have one. But the driver supports many other chips, which I do not have, so we can't assume they all behave exactly the same.
Quoted 2 lines
Would you like me to submit a new patch, or do you just want to edit the patch before you apply it? I'm happy with either one.
I've modified the patch myself, consider it applied. And sorry for the delay...
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors