From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Eric Andersson <eric.andersson@unixphere.com>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
zhengguang.guo@bosch-sensortec.com, stefan.nilsson@unixphere.com,
Albert Zhang <xu.zhang@bosch-sensortec.com>
Subject: Re: [PATCH v2 1/1] input: add driver for Bosch Sensortec's BMA150 accelerometer
Date: Thu, 23 Jun 2011 13:55:33 -0700 [thread overview]
Message-ID: <20110623205532.GE14950@core.coreip.homeip.net> (raw)
In-Reply-To: <20110623163631.2c43671e@lxorguk.ukuu.org.uk>
On Thu, Jun 23, 2011 at 04:36:31PM +0100, Alan Cox wrote:
> > +
> > +
> > +What: /sys/bus/i2c/devices/<busnum>-<devaddr>/value
> > +Date: May 2011
> > +Contact: Eric Andersson <eric.andersson@unixphere.com>
> > +Description: This is used to get the current acceleration values for each
> > + axis. The values are represented as (x,y,z), where each axis can
> > + hold a value between -512 and 511.
> > +
> > + Reading: returns the current acceleration values.
>
> This was nacked in the bma023 driver by the IIO folks - and Dmitry
> pointed out you can do this without a sysfs hack. The trick is to do an
> initial poll in input_open at which point the ioctl query for the
> position will have data that is current and open/ioctl/close works and
> providing we go nail that into other drivers that need that kind of use
> the API is generic and input event based.
>
Right, I think the patch below will do what is needed for all polled
devices.
Thanks.
--
Dmitry
Input: polldev - immediately poll device upon opening
To allow open/ioctl(EVIOCGABS)/close use pattern for polled devices read
the device in context of open() call instead of offloading the first read
to a workqueue. This will ensure that once call to open() returns device
would have cached reasonably recent axis values that can be retrieved via
appropriate ioctl.
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
---
drivers/input/input-polldev.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/input/input-polldev.c b/drivers/input/input-polldev.c
index b1aabde..b253973 100644
--- a/drivers/input/input-polldev.c
+++ b/drivers/input/input-polldev.c
@@ -49,8 +49,10 @@ static int input_open_polled_device(struct input_dev *input)
dev->open(dev);
/* Only start polling if polling is enabled */
- if (dev->poll_interval > 0)
- queue_delayed_work(system_freezable_wq, &dev->work, 0);
+ if (dev->poll_interval > 0) {
+ dev->poll(dev);
+ input_polldev_queue_work(dev);
+ }
return 0;
}
next prev parent reply other threads:[~2011-06-23 20:55 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-23 14:40 [PATCH v2 0/1] input: add driver for Bosch Sensortec's BMA150 accelerometer Eric Andersson
2011-06-23 14:40 ` [PATCH v2 1/1] " Eric Andersson
2011-06-23 15:36 ` Alan Cox
2011-06-23 20:55 ` Dmitry Torokhov [this message]
2011-06-27 20:24 ` Eric Andersson
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=20110623205532.GE14950@core.coreip.homeip.net \
--to=dmitry.torokhov@gmail.com \
--cc=alan@lxorguk.ukuu.org.uk \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).