linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Enric Balletbo i Serra <enric.balletbo@collabora.com>
To: Gwendal Grignou <gwendal@chromium.org>,
	bleung@chromium.org, Jonathan.Cameron@huawei.com
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 00/12] Cros EC sensor hub FIFO support
Date: Mon, 30 Mar 2020 14:56:54 +0200	[thread overview]
Message-ID: <bd18a910-4f1b-661a-53a7-c69e7f3e9222@collabora.com> (raw)
In-Reply-To: <20200327223443.6006-1-gwendal@chromium.org>

Hi Gwendal,

On 27/3/20 23:34, Gwendal Grignou wrote:
> This patchset adds a sensorhub driver for spreading sensor
> events coming from the Embedded controller sensor FIFO:
> 
>        +---------------+ +--------------+ +----
>        | cros_ec_accel | | cros_ec_gyro | | ...
>        +---------------+ +--------------+ +----
>            id:0       \        id:1 |       / id:..
>                  +------------------------------+
>                  |       cros-ec-sensorhub      |
>                  +------------------------------+
>                  |           cros_ec_dev        |
>                  +------------------------------+
>                  | cros_ec_i2c, cros_ec_lpc, .. |
>                  +------------------------------+
>                                  |
>                                  EC
> 
> When new sensors events are present, the EC raises and interrupt,
> sensorhub reads the FIFO and uses the 'id' field to spread the event to
> the proper IIO sensors. This stack is similar to the HID sensor input
> stack.
> 
> The patch set allows the host to receive MEMS sensor sample
> asynchronously from ChromeOS Emebedded Controller (EC).
> 
> Given the EC and the host are not synchronized, the timestamp generated
> by the EC drifts and the AP interrupt latency adds variable delay.
> 
> When events arrive, the driver stores the time of the interrupt and use
> that information to convert the timestamp from the EC time domain to the
> AP time domain. To prevent the errors from the interrupt time variation,
> a median filter smooth the timestamp generation and prevents timestamps
> to go in the past.
> 
> When a batch of sensor events arrives, the sensor hub ring code spreads
> the timestamps.
> 
> The buffer interaface is presentid through the IIO ABI.
> And extra parameter - flush - (presents on HID and ST sensor hub implementation)
> force the EC to send accumulated events in its queue, without waiting
> for buffer hwfifo_timeout to expire.
> 
> To access sensor data, we can use iio_readdev like:
>  iio_readdev -T 10000 -s 4 -b 2 iio:device4
> 
> When FIFO is not supported by the EC, a trigger is present in the
> directory. After registering a trigger, setting sampling_frequency,
> the latest data collected by the sensor will be retrieved by the host
> when the trigger expires.
> 
> When cros_ec_accel_legacy driver is used, no FIFO is supported and the
> sampling frequency for the accelerometers is hard coded at 10Hz.
> 
> Gwendal Grignou (12):
>   platform: chrome: sensorhub: Add the number of sensors in sensorhub
>   platform: chrome: sensorhub: Add FIFO support
>   platform: chrome: sensorhub: Add code to spread timestmap
>   platform: chrome: sensorhub: Add median filter
>   iio: cros_ec: Move function description to .c file
>   iio: expose iio_device_set_clock
>   iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO
>   iio: cros_ec: Remove pm function
>   iio: cros_ec: Expose hwfifo_timeout
>   iio: cros_ec: Report hwfifo_watermark_max
>   iio: cros_ec: Use Hertz as unit for sampling frequency
>   iio: cros_ec: flush as hwfifo attribute
> 
>  drivers/iio/accel/cros_ec_accel_legacy.c      |    8 +-
>  .../cros_ec_sensors/cros_ec_lid_angle.c       |    3 +-
>  .../common/cros_ec_sensors/cros_ec_sensors.c  |   13 +-
>  .../cros_ec_sensors/cros_ec_sensors_core.c    |  403 +++++--
>  drivers/iio/industrialio-core.c               |    8 +-
>  drivers/iio/light/cros_ec_light_prox.c        |   15 +-
>  drivers/iio/pressure/cros_ec_baro.c           |   14 +-
>  drivers/platform/chrome/Makefile              |    4 +-
>  drivers/platform/chrome/cros_ec_sensorhub.c   |  111 +-
>  .../platform/chrome/cros_ec_sensorhub_ring.c  | 1046 +++++++++++++++++
>  .../linux/iio/common/cros_ec_sensors_core.h   |  104 +-
>  include/linux/iio/iio.h                       |    2 +
>  .../linux/platform_data/cros_ec_sensorhub.h   |  163 +++
>  13 files changed, 1655 insertions(+), 239 deletions(-)
>  create mode 100644 drivers/platform/chrome/cros_ec_sensorhub_ring.c
> 

Queued patches from 0 to 11 to for-next. Patch 12 needs some rework.

Thanks,
Enric


      parent reply	other threads:[~2020-03-30 12:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-27 22:34 [PATCH v7 00/12] Cros EC sensor hub FIFO support Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 01/12] platform: chrome: sensorhub: Add the number of sensors in sensorhub Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 02/12] platform: chrome: sensorhub: Add FIFO support Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 03/12] platform: chrome: sensorhub: Add code to spread timestmap Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 04/12] platform: chrome: sensorhub: Add median filter Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 05/12] iio: cros_ec: Move function description to .c file Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 06/12] iio: expose iio_device_set_clock Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 07/12] iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 08/12] iio: cros_ec: Remove pm function Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 09/12] iio: cros_ec: Expose hwfifo_timeout Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 10/12] iio: cros_ec: Report hwfifo_watermark_max Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 11/12] iio: cros_ec: Use Hertz as unit for sampling frequency Gwendal Grignou
2020-03-27 22:34 ` [PATCH v7 12/12] iio: cros_ec: flush as hwfifo attribute Gwendal Grignou
2020-03-28  9:14   ` Enric Balletbo i Serra
2020-03-28 17:24     ` Jonathan Cameron
2020-03-28 17:22   ` Jonathan Cameron
2020-03-29  0:33     ` Gwendal Grignou
2020-03-29  9:31       ` Jonathan Cameron
2020-03-29 11:22   ` Andy Shevchenko
2020-03-30 12:56 ` Enric Balletbo i Serra [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=bd18a910-4f1b-661a-53a7-c69e7f3e9222@collabora.com \
    --to=enric.balletbo@collabora.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bleung@chromium.org \
    --cc=gwendal@chromium.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).