From: Lorenzo Bianconi <lorenzo@kernel.org>
To: Sean Nyekjaer <sean@geanix.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
linux-iio@vger.kernel.org, martin@geanix.com,
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com>,
Denis CIOCCA <denis.ciocca@st.com>
Subject: Re: [PATCH 2/2] iio: imu: st_lsm6dsx: add iio trigger and buffer support
Date: Sat, 11 May 2019 19:00:41 +0200 [thread overview]
Message-ID: <20190511170039.GA4547@localhost.localdomain> (raw)
In-Reply-To: <a8dc4bcc-b004-b287-2126-7c3b082dd3ba@geanix.com>
[-- Attachment #1: Type: text/plain, Size: 2736 bytes --]
> On 11/05/2019 14.30, Lorenzo Bianconi wrote:
> > > On Tue, 7 May 2019 10:02:25 +0200
> > > Sean Nyekjaer <sean@geanix.com> wrote:
> > >
> > > > This adds support for using iio triggers, this is needed because
> > > > our hardware guys forgot to connect the irq pins from imu device
> > > > to the SoC.
> > > >
> > > > Signed-off-by: Sean Nyekjaer <sean@geanix.com>
> > > Hi Sean
> > >
> > > A small question on the size of the buffer needed inline. Otherwise looks
> > > good to me.
> >
> > Hi Sean,
> >
> > this patch does not make sense to me since running st_lsm6dsx_read_oneshot
> > you need to wait to power up the device (and you will power it down at the
> > end). I guess you will not be able to read at a given ODR (e.g. 416Hz).
> > Moreover you can't read from the hw fifo without the irq line since
> > you need to read a full pattern from it in order to maintain the alignment.
> We are not using the hw fifo if the hw irq isn't present...
> So if I understand correctly we could speed things up a bit, with leaving
> the sensor powered by implementing a new reading function and
> calling st_lsm6dsx_sensor_set_enable when we enable the trigger?
I do not think so since in this way you will not know when the hw has updated
the output registers
>
> > From my point of view you have 2 possibility:
> > - poll the output registers from userspace (this is what you are actually
> > doing from inside the kernel, what is the advantage of doing so?)
> Yes this is exactly what I'm trying to accomplish here.
> It would be nice for us to have the same hrtimer/trigger to sample this and
> our adc.
Since we need to wait the data to be ready there is no difference between reading
them polling the output registers in the sysfs and doing so
>
> > - fix the hw bug
> Not possible on +20K devices. ;-)
>
> >
> > Moreover if I read the patch correctly it has a NULL pointer dereference bug
> > since hw->iio_devs[i] can be NULL (e.g. if sensor hub is disabled)
> Right above, there is:
> if (!hw->iio_devs[i])
> return -ENOMEM;
>
> Should be enough...
Do you mean when we alloc hw->iio_devs[]? If so the for loop stops at
ST_LSM6DSX_ID_EXT0 while you are going through the complete list here
(ST_LSM6DSX_ID_MAX)...
> >
> > Regards,
> > Lorenzo
> >
What I think can be doable is to read data trough the hw fifo but use
the iio hr timer as trigger. We need to set the hr timer timeout according to
the pattern len and read the complete pattern. I am not 100% sure it will work
since read accesses and data generation are asynchronous (so there will be a
drift).
@Jonathan, Denis: can it work?
Regards,
Lorenzo
>
> BR
> /Sean
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
next prev parent reply other threads:[~2019-05-11 17:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-07 8:02 [PATCH 1/2] iio: imu: st_lsm6dsx: only set available_scan_masks if using device fifo Sean Nyekjaer
2019-05-07 8:02 ` [PATCH 2/2] iio: imu: st_lsm6dsx: add iio trigger and buffer support Sean Nyekjaer
2019-05-11 11:37 ` Jonathan Cameron
2019-05-11 12:30 ` Lorenzo Bianconi
2019-05-11 12:54 ` Sean Nyekjaer
2019-05-11 17:00 ` Lorenzo Bianconi [this message]
2019-05-16 11:46 ` Sean Nyekjaer
2019-05-18 8:38 ` Jonathan Cameron
2019-05-11 12:38 ` Sean Nyekjaer
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=20190511170039.GA4547@localhost.localdomain \
--to=lorenzo@kernel.org \
--cc=denis.ciocca@st.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=lorenzo.bianconi83@gmail.com \
--cc=martin@geanix.com \
--cc=sean@geanix.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