Linux IIO development
 help / color / mirror / Atom feed
From: Marten Svanfeldt <marten@intuitiveaerial.com>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: linux-iio@vger.kernel.org, michael.hennerich@analog.com
Subject: Re: [PATCH] IIO: trigger: New hrtimer based trigger driver
Date: Thu, 10 Mar 2011 10:19:03 +0800	[thread overview]
Message-ID: <4D783517.1000605@intuitiveaerial.com> (raw)
In-Reply-To: <4D77D590.9090301@cam.ac.uk>

On 2011-03-10 03:31, Jonathan Cameron wrote:
> Obviously run checkpatch over it at some point.
Will be done.

> Otherwise, nice clean little trigger driver.  After cleanup and
> testing I would be happy to see this in IIO.  Never realised it
> would be this simple :)
Looking over your comments I realized I forgot to pull over one part (or 
rather, thought I didn't need it but I do), which makes it a little bit 
more complex..

hrtimer callbacks are sent in hardirq context, which was OK in my 
driver, but as some IIO things involve SPI/I2C communications etc it 
needs to be moved over to a softirq setup. I will look into getting this 
fixed for a v2 patch.

>> +static enum hrtimer_restart iio_trig_hrtimer_trig(struct hrtimer *timer)
>> +{
>> +	struct iio_hrtimer_trig_info *trig_info = container_of(timer, struct iio_hrtimer_trig_info, timer);
>> +
>> +	iio_trigger_poll(trig_info->trigger, 0);
> Out of curiosity, how suceptible to drift is this?  I guess the timer doesn't take
> into account the amout of time this function takes, e.g how late are we by the time
> the timer is restarted?
This function is missing one line that updates the expiry time of the 
timer.. and the new expiry time is calculated based on the old time 
which means it should not drift at all. It can however "miss ticks" if 
the trigger poll takes longer than the interval.

>> +
>> +	trig_info->frequency = val;
> Only applied on trigger being stopped and restarted I think?
> Maybe return -EBUSY if the trigger is running to make this
> obvious to userspace.
Yes, I was unsure how to handle this properly.. I think I can make it 
update it properly if it is running though.

I'll have a v2 patch out in a couple of days, still untested as seems to 
be a few weeks before I get the second spin of our board on which I can 
run it.

Regards
Marten Svanfeldt

      reply	other threads:[~2011-03-10  2:19 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-04  7:26 High frequency software trigger Marten Svanfeldt
2011-03-04  9:19 ` Hennerich, Michael
2011-03-04 10:32   ` Marten Svanfeldt
2011-03-04 11:10     ` Jonathan Cameron
2011-03-07  5:49       ` Marten Svanfeldt
2011-03-09 14:00       ` [RFC] IIO: trigger: New hrtimer based trigger driver Marten Svanfeldt
2011-03-09 14:00       ` [PATCH] " Marten Svanfeldt
2011-03-09 19:31         ` Jonathan Cameron
2011-03-10  2:19           ` Marten Svanfeldt [this message]

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=4D783517.1000605@intuitiveaerial.com \
    --to=marten@intuitiveaerial.com \
    --cc=jic23@cam.ac.uk \
    --cc=linux-iio@vger.kernel.org \
    --cc=michael.hennerich@analog.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox