All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gwendal Grignou <gwendal@chromium.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	linux-iio@vger.kernel.org, Olof Johansson <olof@lixom.net>,
	Lee Jones <lee.jones@linaro.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Guenter Roeck <groeck@chromium.org>,
	Gwendal Grignou <gwendal@chromium.org>
Subject: Re: [PATCH 08/10] iio: cros_ec_sensors_ring: add ChromeOS EC Sensors Ring
Date: Tue, 26 Jul 2016 16:29:56 -0700	[thread overview]
Message-ID: <CAMHSBOXzodLRfuaXvNKDyM08XC7MLvNOKE1zRGyCxA5hQGZnMg@mail.gmail.com> (raw)
In-Reply-To: <df2f8e6f-3b69-819e-5aef-5fc1165aa1e8@kernel.org>

On Mon, Jul 18, 2016 at 9:27 AM, Jonathan Cameron <jic23@kernel.org> wrote:
> On 18/07/16 08:02, Enric Balletbo i Serra wrote:
>> Add support for handling sensor events FIFO produced by the sensor
>> hub. A single device with a buffer will collect all samples produced
>> by the sensors managed by the CrosEC sensor hub.
> So you are defining a different device to support the buffer?
> That's 'unusual'...


>>
>> Signed-off-by: Guenter Roeck <groeck@chromium.org>
>> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
>> ---
>> +     CHANNEL_SENSOR_FLAG,
> Ah, I'm beginning to understand.
>
> I think you really need to demux these into the appropriate devices individual
> buffers... If these are coming in fairly randomly (guessing so?) then you'll
> want a top level mfd pushing data to each of the child devices (representing
> the different possible sensors).

Yes, indeed. I did not find a good solution to demux the hardware FIFO
into each sensor. As you said, I should have written a MFD driver
between the sensor device driver and the cros ec device driver.
But at the same time, that MFD driver, while not being an IIO driver,
would have to know the iio_dev of each sensor and call them with
iio_push_to_buffers(). Is it acceptable to call iio function from
outside the IIO subsystem?

>
> Simply pushing it into a buffer with metadata doesn't fit with the IIO ABI
> at all.
>
> Note that there is no obligation to have any triggers involved at all. Here I'd
> suggest you don't as it'll just make life difficult for little gain.
>

The way chrome OS works today is one process (chrome) is gathering
accelerometer sensor data on a time basis (using sysfs trigger), while
another "process" (android) is listening to all sensors events as they
come. I see that IIO has support for serveral buffer per iio_dev, but
I did not see this feature used. Do you suggest to creating virtual
sensors - not tied to physical hardware - to be able to set different
trigger, or calll iio_update_buffers() directly with new buffers?

>> +
>> +static s64 cros_ec_get_time_ns(void)
>> +{
>> +     struct timespec ts;
>> +
>> +     get_monotonic_boottime(&ts);
>> +     return timespec_to_ns(&ts);
> Use the core IIO timestamp helper? (now supports all the different clocks...)

>> +}
> See comments earlier.  There is no need to have metadata here that userspace
> will have to unwind, just demux the data appropriately and push to the
> correct iio devices (one per 'scan' - set of samples acquired at approximately
> the same time - every time)
>> +
>> +#define CROS_EC_RING_AXIS(_axis)             \
>> +{                                            \
>> +     .type = IIO_ACCEL,                      \
>> +     .modified = 1,                          \
>> +     .channel2 = IIO_MOD_##_axis,            \
>> +     .scan_index = CHANNEL_##_axis,          \
>> +     .scan_type = {                          \
>> +             .sign = 's',                    \
>> +             .realbits = 16,                 \
>> +             .storagebits = 16,              \
>> +     },                                      \
>> +     .extend_name = "ring",                  \
> For obvious reasons given earlier comments I don't like this!
I got your point. We will defer upstreaming this driver until we have
a better solution for sensors behind a muxed FIFO.

Gwendal.

>> +}

  reply	other threads:[~2016-07-26 23:30 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-18  7:02 [PATCH 00/10] Add support for cros-ec-sensors Enric Balletbo i Serra
2016-07-18  7:02 ` [PATCH 01/10] mfd: cros_ec: add ChromeOS EC sensor platform information Enric Balletbo i Serra
2016-07-18 13:43   ` Jonathan Cameron
2016-07-18  7:02 ` [PATCH 02/10] mfd: cros_ec: update MOTIONSENSE definitions and commands Enric Balletbo i Serra
2016-07-18 13:49   ` Jonathan Cameron
2016-07-19 18:00     ` Enric Balletbo Serra
2016-07-21  6:18       ` Jonathan Cameron
2016-07-18  7:02 ` [PATCH 03/10] iio: core: Add double tap as possible gesture Enric Balletbo i Serra
2016-07-18 13:54   ` Jonathan Cameron
2016-07-18  7:02 ` [PATCH 04/10] iio: cros_ec: Add common functions for cros_ec sensors Enric Balletbo i Serra
2016-07-18  7:29   ` Peter Meerwald-Stadler
2016-07-18 15:51     ` Jonathan Cameron
2016-07-20  7:57       ` Enric Balletbo Serra
2016-07-20  8:18         ` Peter Meerwald-Stadler
2016-07-18  7:02 ` [PATCH 05/10] iio: cros_ec_sensors: add ChromeOS EC Contiguous Sensors driver Enric Balletbo i Serra
2016-07-18 16:09   ` Jonathan Cameron
2016-07-18  7:02 ` [PATCH 06/10] iio: cros_ec_light_prox: add ChromeOS EC Light and Proximity Sensors Enric Balletbo i Serra
2016-07-18 16:11   ` Jonathan Cameron
2016-07-18  7:02 ` [PATCH 07/10] iio: cros_ec_activity: add ChromeOS EC Activity Sensors Enric Balletbo i Serra
2016-07-18 16:16   ` Jonathan Cameron
2016-07-18  7:02 ` [PATCH 08/10] iio: cros_ec_sensors_ring: add ChromeOS EC Sensors Ring Enric Balletbo i Serra
2016-07-18 16:27   ` Jonathan Cameron
2016-07-26 23:29     ` Gwendal Grignou [this message]
2016-07-27  0:17   ` Guenter Roeck
2016-07-18  7:02 ` [PATCH 09/10] platform/chrome: Introduce a new function to check EC features Enric Balletbo i Serra
2016-07-18  7:02 ` [PATCH 10/10] platform/chrome: cros_ec_dev - Register cros-ec sensors Enric Balletbo i Serra

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=CAMHSBOXzodLRfuaXvNKDyM08XC7MLvNOKE1zRGyCxA5hQGZnMg@mail.gmail.com \
    --to=gwendal@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=groeck@chromium.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    --cc=pmeerw@pmeerw.net \
    /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.