From: Hans de Goede <j.w.r.degoede@hhs.nl>
To: lm-sensors@vger.kernel.org
Subject: Re: [lm-sensors] [PATCH] v3 of a adt7470 driver\
Date: Tue, 17 Jul 2007 05:13:52 +0000 [thread overview]
Message-ID: <469C5010.7080908@hhs.nl> (raw)
In-Reply-To: <20070713002836.GR3435@tree.beaverton.ibm.com>
Darrick J. Wong wrote:
> On Sat, Jul 14, 2007 at 07:22:41PM +0200, Hans de Goede wrote:
>> Hmm,
>>
>> I see it refresh the readings every 2 seconds, since reading things takes 1
>> sec minimum, I think it would be a good idea to make this somewhat bigger.
>> Darrick, can you post a new version and or an incremental patch with a
>> slower read frequency, say once every 5 or 10 seconds?
>
> Will do. The data sheet says you have to wait 200ms *
> number_of_temperature_sensor_chips. Unfortunately, there's no way to find
> out how many sensor chips there are before you read them, but 1s seemed to
> work ok for all my systems. I suppose I could modify the init function
> to do the read once with the long delay, then lower it to 200ms *
> however many temperature sensors read a "sane" value.
>
I think this will be rather tricky, its esp tricky to define what is a sane value.
How about the following instead:
-convert TEMP_COLLECTION_TIME to jiffies
-add a started_reading member to data
-driver initializes
-sets start reading temp sensors bit
-set started_reading to jiffies
-in update_device:
if (time_before(jiffies, data->last_updated + REFRESH_INTERVAL)
&& data->valid)
goto out;
/* cache jiffies to make sure it doesn't change, possible causing an unwanted
overflow in the substraction when calculating how long to sleep */
unsigned long current_jiffies = jiffies;
if (time_before(current_jiffies, data->started_reading +
TEMP_COLLECTION_TIME))
msleep(jiffies_to_msecs((data->started_reading + TEMP_COLLECTION_TIME) -
current_jiffies));
/* done reading temperature sensors */
...
/* read registers */
...
/* start reading temperature sensors */
...
data->started_reading = jiffies;
...
"exit update_device"
-Notice that the msleep, now will only be triggered if update_device gets
called within TEMP_COLLECTION_TIME of driver loading, assuming that
REFRESH_INTERVAL > TEMP_COLLECTION_TIME. I did it this way hoping that the
startup scripts of the PC will have enough time between insmod and the first
read, thus not delaying PC startup.
---
In a releated note, depending on where the 0ther 0.7 seconds are, you could try
todo less reading, for example each time you start / stop the temp reading you
first read the cfg register, why not just use a cached value, is there a reason
to assumee it will change? Esp when stopping I would be using the value already
read when starting (in the current code).
Also you read the limits and other non sensor reading registers each update,
why not just read these once at driver initialisation, is there a reason to
assume they will change?
Regards,
Hans
p.s.
I saw your longer read intervals and make temps signed patches, since the
driver hasn't been merged yet, maybe its a good idea todo a v4 ?
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
next prev parent reply other threads:[~2007-07-17 5:13 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-13 0:28 [lm-sensors] [PATCH] v3 of a adt7470 driver\ Darrick J. Wong
2007-07-13 12:49 ` Hans de Goede
2007-07-14 15:00 ` Vadim Zeitlin
2007-07-14 17:22 ` Hans de Goede
2007-07-14 20:00 ` Jean Delvare
2007-07-16 20:07 ` Darrick J. Wong
2007-07-16 20:09 ` Darrick J. Wong
2007-07-17 5:13 ` Hans de Goede [this message]
2007-07-24 18:19 ` Darrick J. Wong
2007-07-24 18:56 ` Hans de Goede
2007-07-26 0:57 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=469C5010.7080908@hhs.nl \
--to=j.w.r.degoede@hhs.nl \
--cc=lm-sensors@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.