All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: Eric Andersson <eric.andersson@unixphere.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org,
	linux-kernel@vger.kernel.org, zhengguang.guo@bosch-sensortec.com,
	stefan.nilsson@unixphere.com, alan@lxorguk.ukuu.org.uk,
	Albert Zhang <xu.zhang@bosch-sensortec.com>
Subject: Re: [PATCH v4 1/1] input: add driver for Bosch Sensortec's BMA150 accelerometer
Date: Fri, 22 Jul 2011 16:58:42 +0100	[thread overview]
Message-ID: <4E299E32.10806@cam.ac.uk> (raw)
In-Reply-To: <20110722132410.GA958@scully.xfiles.lan>

On 07/22/11 14:24, Eric Andersson wrote:
>> Mostly looks fine.  Couple of nitpicks and one query about the interrupt
>> handling (more general than this driver).
>>
>> Can I confirm I've understood this correctly. When one receives any of the
>> interrupts, the driver just kicks out a reading?  Given there is a delay
>> before this read, imagine both high and low thresholds are set.  It's entirely
>> possible for both to occur before the thread gets there and the value that is
>> read to be somewhere in between... We'll get one interrupt and have no idea
>> what happened...
>>
>> Is there any way of working out what has occured and pushing that out?
> In our case we are enabling three conditional interrupts where each
> one of them have the chance of asserting the interrupt pin when
> their particular interrupt criterias are fulfilled. This means that
> one interrupt, for instance any motion, can assert the irq pin and
> then at the same time have a high- and/or low-g interrupt consecutively
> activated as well (but pin asserted by any motion already) where the
> pin will be kept asserted until all the criterias for each asserted
> interrupt are exited (i.e. not fullfilled anymore). So even if there
> is a delay from the pin assertion and the irq thread read-out it
> doesn't really matter if consecutive interrupts are activated in
> between. At least one of the criterias will be met and there will be a motion
> detection to read out. Of course, the interrupt types could be masked
> out from the status register (addr. 0x09 bits 0 & 1 for low-/high-g
> int), but I really don't see the purpose of this.
Perhaps tap type events?  High acceleration followed by not much. If unlucky
will register as stationary...  Lots of use cases out of input where you have
very little idea what is going on, but I guess what you have here might
work well for input.
> 
> A comment regarding latched vs. non-latched irqs - we are intentionally not
> using latched interrupts with the current setup since we currently don't
> see the need for it. A latched setup would typically be needed in a high
> inflow interrupt feature, such as new data interrupt, where the interrupt
> buffer can be flooded due to high event frequency.
> An alternative could be to activate the latched interrupt feature and
> explicitly clear the interrupts from the driver, but this would just fire
> off a new event directly until any of the interrupt criterias are fullfilled.
> If you have any preferences or requirements when it comes to this, please share
> your thoughts and we'll act upon this for the next version.
> 
>>> +	if (bma150->client->irq > 0) {
>>> +		ret = input_register_device(idev);
>>> +		if (ret < 0) {
>>> +			input_free_device(idev);
>>> +			return ret;
>>> +		}
>>> +		ret = request_threaded_irq(bma150->client->irq, NULL, bma150_irq_thread,
>>> +			IRQF_TRIGGER_RISING, BMA150_DRIVER, bma150);
>> Does this want to be oneshot? I don't think you have the latch enabled, so strobing
>> across a threshold could result in an interrupt storm.
> Sure, it could be worth having it sequential to the read-outs from the thread
> instead of buffering events while reading. I'll fix.
> 
> As for your nitpicks, I will fix them for the next version.
> 
> Thanks for reviewing!
> 


      reply	other threads:[~2011-07-22 15:58 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-20 23:09 [PATCH v4 0/1] input: add driver for Bosch Sensortec's BMA150 accelerometer Eric Andersson
2011-07-20 23:09 ` [PATCH v4 1/1] " Eric Andersson
2011-07-21  9:56   ` Alan Cox
2011-07-22  8:34   ` Jonathan Cameron
2011-07-22 13:24     ` Eric Andersson
2011-07-22 15:58       ` Jonathan Cameron [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=4E299E32.10806@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=dmitry.torokhov@gmail.com \
    --cc=eric.andersson@unixphere.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stefan.nilsson@unixphere.com \
    --cc=xu.zhang@bosch-sensortec.com \
    --cc=zhengguang.guo@bosch-sensortec.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 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.