linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sean Nyekjaer <sean@geanix.com>
To: Lorenzo Bianconi <lorenzo@kernel.org>,
	Jonathan Cameron <jic23@kernel.org>
Cc: 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 14:54:08 +0200	[thread overview]
Message-ID: <a8dc4bcc-b004-b287-2126-7c3b082dd3ba@geanix.com> (raw)
In-Reply-To: <20190511123054.GA14837@localhost.localdomain>



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?

>  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.

> - 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...
> 
> Regards,
> Lorenzo
> 

BR
/Sean

  reply	other threads:[~2019-05-11 12:54 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 [this message]
2019-05-11 17:00         ` Lorenzo Bianconi
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=a8dc4bcc-b004-b287-2126-7c3b082dd3ba@geanix.com \
    --to=sean@geanix.com \
    --cc=denis.ciocca@st.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=lorenzo.bianconi83@gmail.com \
    --cc=lorenzo@kernel.org \
    --cc=martin@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;
as well as URLs for NNTP newsgroup(s).