linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Royer <nroyer@invensense.com>
To: Jonathan Cameron <jic23@cam.ac.uk>
Cc: Alan Cox <alan@linux.intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Jiri Kosina <jkosina@suse.cz>, Jean Delvare <khali@linux-fr.org>,
	linux-kernel@vger.kernel.org, linux-input@vger.kernel.org,
	Chris Hudson <chudson@kionix.com>,
	eric.andersson@unixphere.com, eric.miao@linaro.org, "Hennerich,
	Michael" <Michael.Hennerich@analog.com>,
	Manuel Stahl <manuel.stahl@iis.fraunhofer.de>,
	linux-iio@vger.kernel.org
Subject: RE: [PATCH 01/11] misc: inv_mpu primary header file and README file.
Date: Wed, 6 Jul 2011 13:25:43 -0700	[thread overview]
Message-ID: <7c63d523bcbec36ba226968f20249823@mail.gmail.com> (raw)
In-Reply-To: <4E1425E0.2070408@cam.ac.uk>

> It is only intended for those rare
> cases where someone really wants to use a 1000 dolar IMU as a mouse.
> Not relevant here though.

We have a mouse application that is significantly less expensive than
$1000, so it might actually be relevant, in the future.

> > If the DMP is
> err, DMP?

Digital Motion Processor.  It is what we call the built in micro
controller on the mpu3050 that does sensor fusion.

> > used, a buffer for the FIFO data would be created, and user space
> would be
> > responsible to push the sensor data back to iio after sensor fusion
> and
> > calibration.  Without the DMP, each sensor driver would act
> independently
> > providing their own raw data.
>
> Strangely enough, your need to push data back is not dissimilar to what
> we have
> discussed in the past for DACs. Right now we only have a slow and
> simple interface
> for DACs, mainly because doing anything clever requires some fairly
> nasty additions
> to the host bus drivers and no one has had the time.  Michael has
> almost
> certainly thought more on this than I ever have!

A slow interface might be ok.  Highest traffic is usually in the low 10's
of bytes at 30hz.

> > We still need a way to read and write registers and DMP memory during
> > runtime from user space.
> I guess the DMP is the on device processor? So what you write varies a
> lot
> with what firmware is loaded?

Yes that is correct.

> So let me just check I understand the data flow here.
>
> Example
>
> Magnetometer -> kernel -> userspace interface -> hideously complex
> algorithm ->
> kernel -> mpu -> mpu fusion algorithm in relevant firmware -> userspace
> ?

Hideously complex algorithm or HCA for short :)

Your data path is more relevant for the mpu6050.  I'll explain what it
currently looks like on each chip 2 chips.  For the 3050 it looks like
this:
=======================
Accel -> mpu3050 -> DMP (6 Axis fusion) -> FIFO
         (gyro)                   ^
                                  |
                               Kernel
                                  |
FIFO -> Kernel -> user space -> 9 Axis fusion + HCA's-> application
                                  ^
                                  |
Compass -> kernel -> user space --/

For the mpu6050:
================
Compass -> mpu6050   -> DMP (9 Axis Fusion) -> Kernel -> User Space HCA's
-> Apps
          (gyro + accel)     ^                               |
                             |                               |
                             \---------------- Kernel <------/


As you might have seen we don't have an input or an iio interface for user
space to retrieve data.  Currently applications have to link in our MPL,
either standalone, or as a daemon, or something similar like the Android
sensor HAL.  What I'm trying to figure out is once data is ready to be
provided to applications, where should it come from, input, IIO, or a
daemon, before I start that part of development.  It seems like IIO was
built more for raw data, but that input has a facility to handle processed
data.

> So how do we know the mpu wants data?  Obvious options that might be
> the case
> a) on chip fifo with flow control.
> b) interrupt to request data?
> c) Always feed latest value and it runs unsynchronized.

The MPL (Motion Processing Library user space library that includes HCA's)
makes the decision when to feed data down, and does it in an
unsynchronized way.  It will do it shortly after processing a FIFO data
packet, but the timing does not need to be precise.

> Do we actually have that hideously complex algorithm in userspace
> element
> or did I invent that part?  If not, we might want to use some in kernel
> hooks to pass the data back bypassing userspace entirely.

Yes the HCA's exists.  They include 9 axis fusion, compass calibration
algorithms, and a number of other proprietary algorithms.  We've tried to
design the MPL so that they can be removed and still provide basic
functionality.  This basic functionality is available to be pushed into
the kernel if necessary, but we will still need a way to support the
HCA's.

  reply	other threads:[~2011-07-06 20:25 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-01  2:18 [PATCH 01/11] misc: inv_mpu primary header file and README file Nathan Royer
2011-07-01  2:18 ` [PATCH 02/11] misc: mpu3050 Register definition and Private data Nathan Royer
2011-07-01  2:18 ` [PATCH 03/11] misc: mpu3050 /dev/mpu implementation Nathan Royer
2011-07-01  2:18 ` [PATCH 04/11] misc: IRQ handling for MPU3050 and slave devices Nathan Royer
2011-07-01  2:18 ` [PATCH 05/11] misc: MPU3050 and slave device configuration Nathan Royer
2011-07-01 17:55   ` Nathan Royer
2011-07-01  2:18 ` [PATCH 06/11] misc: inv_mpu logging and debugging support Nathan Royer
2011-07-01  2:18 ` [PATCH 07/11] misc: I2C communication with the MPU3050 and slave devices Nathan Royer
2011-07-01  2:18 ` [PATCH 08/11] misc: Kconfig and Makefile changes for inv_mpu driver Nathan Royer
2011-07-01 17:10   ` Randy Dunlap
2011-07-01  2:18 ` [PATCH 09/11] misc: Add slave driver for kxtf9 accelerometer Nathan Royer
2011-07-01  2:18 ` [PATCH 10/11] misc: Add slave driver for ak8975 compass driver Nathan Royer
2011-07-01  2:18 ` [PATCH 11/11] misc: Add slave driver for bma085 pressure sensor Nathan Royer
2011-07-01  7:56   ` Alan Cox
2011-07-01  8:47     ` Jean Delvare
2011-07-01 14:28     ` Chris Wolfe
2011-07-01 14:41       ` Alan Cox
2011-07-01 15:52         ` Chris Wolfe
2011-07-01 17:00           ` Alan Cox
2011-07-01 17:56             ` Nathan Royer
2011-07-01 16:09         ` Jean Delvare
2011-07-01  9:05   ` Jonathan Cameron
2011-07-01 10:35     ` Manuel Stahl
2011-07-01  3:09 ` [PATCH 01/11] misc: inv_mpu primary header file and README file Greg KH
2011-07-01  7:29   ` Alan Cox
2011-07-01  9:00   ` Jonathan Cameron
2011-07-01  3:59 ` Chris Wolfe
2011-07-05 18:08   ` Nathan Royer
2011-07-01  7:53 ` Alan Cox
2011-07-01  9:08 ` Jonathan Cameron
2011-07-01 16:39   ` Nathan Royer
2011-07-03 11:29     ` Jonathan Cameron
2011-07-04  8:16       ` Alan Cox
2011-07-06  1:49         ` Nathan Royer
     [not found]           ` <c2189246a279a0e5a1b8599edc94a79a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-07-06  9:07             ` Jonathan Cameron
2011-07-06 20:25               ` Nathan Royer [this message]
2011-07-06 10:54           ` Alan Cox
2011-07-06 21:27             ` Nathan Royer
2011-07-07  7:40               ` Alan Cox
2011-07-08  1:25                 ` Nathan Royer
2011-07-08 11:21                   ` Jonathan Cameron
2011-07-08 16:24                     ` Nathan Royer
2011-07-04 20:06       ` Eric Andersson
2011-07-01 21:04 ` Arnd Bergmann

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=7c63d523bcbec36ba226968f20249823@mail.gmail.com \
    --to=nroyer@invensense.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=akpm@linux-foundation.org \
    --cc=alan@linux.intel.com \
    --cc=chudson@kionix.com \
    --cc=eric.andersson@unixphere.com \
    --cc=eric.miao@linaro.org \
    --cc=gregkh@suse.de \
    --cc=jic23@cam.ac.uk \
    --cc=jkosina@suse.cz \
    --cc=khali@linux-fr.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=manuel.stahl@iis.fraunhofer.de \
    /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).