linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Gwendal Grignou <gwendal@chromium.org>
Cc: Brian Norris <briannorris@chromium.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Lee Jones <lee.jones@linaro.org>,
	Benson Leung <bleung@chromium.org>,
	Enric Balletbo i Serra <enric.balletbo@collabora.com>,
	Doug Anderson <dianders@chromium.org>,
	Guenter Roeck <groeck@chromium.org>,
	Fabien Lahoudere <fabien.lahoudere@collabora.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-iio <linux-iio@vger.kernel.org>
Subject: Re: [PATCH v2 10/18] platform: chrome: sensorhub: Add FIFO support
Date: Tue, 22 Oct 2019 11:42:43 +0100	[thread overview]
Message-ID: <20191022114243.1eaf19c1@archlinux> (raw)
In-Reply-To: <CAPUE2uuaFQYXKhn+b6tW6tXWQECeix3pt3+KnMbyXgvx-Qoa1Q@mail.gmail.com>

...
> > > + * @sensor_hub : Sensor Hub object
> > > + */
> > > +int cros_ec_sensorhub_ring_add(struct cros_ec_sensorhub *sensorhub)
> > > +{
> > > +     struct cros_ec_dev *ec = sensorhub->ec;
> > > +     int ret;
> > > +
> > > +     /* Retrieve FIFO information */
> > > +     sensorhub->msg->version = 2;
> > > +     sensorhub->params->cmd = MOTIONSENSE_CMD_FIFO_INFO;
> > > +     sensorhub->msg->outsize = 1;
> > > +     sensorhub->msg->insize =
> > > +             sizeof(struct ec_response_motion_sense_fifo_info) +
> > > +             sizeof(u16) * CROS_EC_SENSOR_MAX;
> > > +
> > > +     ret = cros_ec_cmd_xfer_status(ec->ec_dev, sensorhub->msg);
> > > +     if (ret < 0)
> > > +             return ret;
> > > +
> > > +     /*
> > > +      * Allocate the full fifo.
> > > +      * We need to copy the whole FIFO to set timestamps properly *
> > > +      */
> > > +     sensorhub->fifo_size = sensorhub->resp->fifo_info.size;
> > > +     sensorhub->ring = devm_kcalloc(sensorhub->dev, sensorhub->fifo_size,
> > > +                     sizeof(*sensorhub->ring), GFP_KERNEL);
> > > +     if (!sensorhub->ring)
> > > +             return -ENOMEM;
> > > +
> > > +     sensorhub->fifo_timestamp[CROS_EC_SENSOR_LAST_TS] =
> > > +             cros_ec_get_time_ns();  
> >
> > Hmm. Is the IIO standard timestamp selection attribute being exposed?
> > If so this is going to be confusing as we aren't obeying the selection
> > of clock from that..  
> 
> You're right, I did not find an elegant solution.
> cros_ec_get_time_ns() is an inline version of ktime_get_boottime_ns
> aka iio_get_time_ns( with indio_dev->clock_id set to  CLOCK_BOOTTIME).
> But I can not call iio_get_time_ns() here, as I don't have a
> indio_dev. Besides, sensors could have a different
> current_timestamp_clock attribute. I will convert in the callback
> routine (cros_ec_sensors_push_data() by adding an offset
> (iio_get_time_ns(indio_dev) - cros_ec_get_time_ns())
> >  

If you can special case that (perhaps adding some functionality to IIO)
to not do anything if both are CLOCK_BOOTTIME that would be great.

Thanks,

Jonathan


  reply	other threads:[~2019-10-22 10:42 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-21  5:53 [PATCH v2 00/18] cros_ec: Add sensorhub driver and FIFO processing*** SUBJECT HERE Gwendal Grignou
2019-10-21  5:53 ` [PATCH v2 01/18] platform: chrome: Put docs with the code Gwendal Grignou
2019-10-21 15:31   ` Jonathan Cameron
2019-10-24 17:03     ` Enric Balletbo i Serra
2019-10-21  5:53 ` [PATCH v2 02/18] mfd: cros_ec: Add sensor_count and make check_features public Gwendal Grignou
2019-10-21 15:12   ` Enric Balletbo i Serra
2019-10-21 15:49   ` Jonathan Cameron
2019-11-01  9:00   ` Lee Jones
2019-10-21  5:53 ` [PATCH v2 03/18] platform: cros_ec: Add cros_ec_sensor_hub driver Gwendal Grignou
2019-10-21 15:59   ` Jonathan Cameron
2019-10-22  8:32     ` Enric Balletbo i Serra
2019-10-21  5:53 ` [PATCH v2 04/18] platform/mfd:iio: cros_ec: Register sensor through sensorhub Gwendal Grignou
2019-10-21 16:00   ` Jonathan Cameron
2019-10-22  9:39     ` Enric Balletbo i Serra
2019-10-21  5:53 ` [PATCH v2 05/18] platform: chrome: cros-ec: record event timestamp in the hard irq Gwendal Grignou
2019-10-22 10:03   ` Enric Balletbo i Serra
2019-10-21  5:53 ` [PATCH v2 06/18] platform: chrome: cros_ec: Do not attempt to register a non-positive IRQ number Gwendal Grignou
2019-10-22 10:05   ` Enric Balletbo i Serra
2019-10-21  5:53 ` [PATCH v2 07/18] platform: chrome: cros_ec: handle MKBP more events flag Gwendal Grignou
2019-10-21 16:07   ` Jonathan Cameron
2019-10-21  5:53 ` [PATCH v2 08/18] Revert "Input: cros_ec_keyb - add back missing mask for event_type" Gwendal Grignou
2019-10-21  5:53 ` [PATCH v2 09/18] Revert "Input: cros_ec_keyb: mask out extra flags in event_type" Gwendal Grignou
2019-10-21  5:53 ` [PATCH v2 10/18] platform: chrome: sensorhub: Add FIFO support Gwendal Grignou
2019-10-21 16:27   ` Jonathan Cameron
2019-10-21 22:09     ` Gwendal Grignou
2019-10-22 10:42       ` Jonathan Cameron [this message]
2019-10-21  5:53 ` [PATCH v2 11/18] platform: chrome: sensorhub: Add code to spread timestmap Gwendal Grignou
2019-10-21  5:53 ` [PATCH v2 12/18] platform: chrome: sensorhub: Add median filter Gwendal Grignou
2019-10-21  5:53 ` [PATCH v2 13/18] iio: cros_ec: Move function description to .c file Gwendal Grignou
2019-10-21 16:33   ` Jonathan Cameron
2019-10-21  5:53 ` [PATCH v2 14/18] iio: cros_ec: Register to cros_ec_sensorhub when EC supports FIFO Gwendal Grignou
2019-10-21 16:38   ` Jonathan Cameron
2019-10-21  5:54 ` [PATCH v2 15/18] iio: cros_ec: Remove pm function Gwendal Grignou
2019-10-21 16:39   ` Jonathan Cameron
2019-10-21  5:54 ` [PATCH v2 16/18] iio: cros_ec: Expose hwfifo_timeout Gwendal Grignou
2019-10-21 16:42   ` Jonathan Cameron
2019-10-21  5:54 ` [PATCH v2 17/18] iio: cros_ec: Report hwfifo_watermark_max Gwendal Grignou
2019-10-21 16:42   ` Jonathan Cameron
2019-10-21  5:54 ` [PATCH v2 18/18] iio: cros_ec: Use Hertz as unit for sampling frequency Gwendal Grignou
2019-10-21 16:45   ` Jonathan Cameron
2019-10-22 19:11     ` Gwendal Grignou
2019-10-21 15:29 ` [PATCH v2 00/18] cros_ec: Add sensorhub driver and FIFO processing*** SUBJECT HERE Jonathan Cameron

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=20191022114243.1eaf19c1@archlinux \
    --to=jic23@kernel.org \
    --cc=bleung@chromium.org \
    --cc=briannorris@chromium.org \
    --cc=dianders@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=fabien.lahoudere@collabora.com \
    --cc=groeck@chromium.org \
    --cc=gwendal@chromium.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=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 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).