devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: nunojsa <noname.nuno@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>, "Sa, Nuno" <Nuno.Sa@analog.com>
Cc: "lars@metafoo.de" <lars@metafoo.de>,
	"Ardelean, Alexandru" <alexandru.Ardelean@analog.com>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
	"knaack.h@gmx.de" <knaack.h@gmx.de>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>
Subject: Re: [PATCH 5/5] dt-bindings: iio: Add adis16475 documentation
Date: Sat, 7 Mar 2020 21:47:56 +0100	[thread overview]
Message-ID: <292029f7-e30d-b510-95b0-e6037182a63b@gmail.com> (raw)
In-Reply-To: <20200307113349.27e4484a@archlinux>

On 07.03.20 12:33, Jonathan Cameron wrote:
> On Thu, 5 Mar 2020 13:04:27 +0000
> "Sa, Nuno" <Nuno.Sa@analog.com> wrote:
> 
>> On Thu, 2020-03-05 at 13:43 +0100, Lars-Peter Clausen wrote:
>>> On 3/5/20 1:27 PM, Sa, Nuno wrote:  
>>>>> In my opinion there is should not be a difference in the
>>>>> userspace
>>>>> interface for chips that do support 32-bit burst and those that
>>>>> don't.
>>>>> For devices that don't support 32-bit burst it should be emulated
>>>>> by
>>>>> reading the LSB bits registers manually.  
>>>> Hmm. In terms of interface I think there is no difference. We
>>>> always
>>>> report 32bits channels (for accel and gyro). However, what we do
>>>> right
>>>> know is just to set the LSB to 0 if burst32 is not supported. So,
>>>> we
>>>> can be just ignoring the LSB bits if they are being used...  
>>>
>>> What I meant was that somebody might still want to get the full 32-
>>> bit 
>>> values in buffered mode, even if the device does not support burst32.  
>>
>> They are. Just that the LSB part is always set to 0 :). And that, in my
>> opinion, is wrong. As you say, we should do the manual readings if
>> there are any bits on the LSB registers...
>>
>> - Nuno Sá
>>> In 
>>> that case you can first do a 16-bit burst read to get the MSBs and
>>> then 
>>> do manual reads of all the LSB registers and then put both into the
>>> buffer.
>>> - Lars
>>>   
>>
> Thanks Lars and Nuno, I'd not grasped exactly what this was.
> 
> Hmm.  Not allowing for variable bit widths has bitten us a few times in the
> past.  Howwever, it's a really nasty thing to try and add to the core now
> unfortunately.
> 
> In some cases we've just padded the smaller bitwidth buffer but that
> is costly to actually do.  You get fast reads from the hardware then loose
> at least some of the benefit respacing the data.
> 
> Still it is definitely a policy decision so not DT.  It's ugly but if
> we want to support it and can't do it at runtime, perhaps a module parameter
> is the best option?
>

So, we can decide this at runtime. As Lars pointed out, the LSB bits are not
used by default (decimation and FIR filters disabled). However, applications can
change this by changing the sampling frequency (affects the decimation filter)
and the low_pass_filter_3db_freq (affects the FIR filter). If one of these filters
is used, then the LSB bits are meaningful and makes sense to use burst32. For parts
that do not support burst32, we should manually read the data.

I started to prepare the version 2 of this series and Im starting to have mixed
feelings. For now, I can see 3 ways of handling this:

1) If we assume that changing from burst32 to burst mode can occur at any
time, we need some special handling. We need to realloc the buffer used
on the spi transfer and readjust the spi xfer length. I'm not a big fan of the
realloc part...

2) Alternatively, we could introduce a `burst_max_len` in the library that could be
used in devices with different burst modes with different sizes. Max len would just
hold the maximum burst len (as the name implies) and would be used to allocate
the buffer to use on the spi tranfer. On the spi xfer we would then use the real
burst length. With this we would not need to care about reallocs...

3) More conservative, we would not allow changing burst modes if buffering is
ongoing... Changing a filter setting that would lead to burst mode change when
buffering would return -EPERM...

Either way, I will probably just send the v2 patch with 1) and then everyone can have
a better look on how it looks and we can discuss improvements/other mechanism in the
v2 thread.

- Nuno Sá
> Thanks,
> 
> Jonathan
> 
> 


      reply	other threads:[~2020-03-07 20:48 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 12:41 [PATCH 0/5] Support ADIS16475 and similar IMUs Nuno Sá
2020-02-25 12:41 ` [PATCH 1/5] iio: imu: adis: Add Managed device functions Nuno Sá
2020-03-03 20:38   ` Jonathan Cameron
2020-03-04 17:28     ` Sa, Nuno
2020-02-25 12:41 ` [PATCH 2/5] iio: imu: adis: Add irq mask variable Nuno Sá
2020-03-03 20:40   ` Jonathan Cameron
2020-03-04 17:29     ` Sa, Nuno
2020-02-25 12:41 ` [PATCH 3/5] iio: adis: Add adis_update_bits() APIs Nuno Sá
2020-03-03 20:48   ` Jonathan Cameron
2020-03-04 17:32     ` Sa, Nuno
2020-02-25 12:41 ` [PATCH 4/5] iio: imu: Add support for adis16475 Nuno Sá
2020-03-03 21:08   ` Jonathan Cameron
2020-03-04 17:59     ` Sa, Nuno
2020-03-05  9:58       ` Sa, Nuno
2020-03-05 10:39         ` Lars-Peter Clausen
2020-03-07 11:25           ` Jonathan Cameron
2020-03-07 11:27         ` Jonathan Cameron
2020-02-25 12:41 ` [PATCH 5/5] dt-bindings: iio: Add adis16475 documentation Nuno Sá
2020-03-02 22:22   ` Rob Herring
2020-03-03  9:43     ` Sa, Nuno
2020-03-03  9:59       ` Sa, Nuno
2020-03-03 16:34         ` Rob Herring
2020-03-04 17:25           ` Sa, Nuno
2020-03-03 21:10   ` Jonathan Cameron
2020-03-04 18:00     ` Sa, Nuno
2020-03-05 10:34       ` Lars-Peter Clausen
2020-03-05 12:27         ` Sa, Nuno
2020-03-05 12:43           ` Lars-Peter Clausen
2020-03-05 13:04             ` Sa, Nuno
2020-03-07 11:33               ` Jonathan Cameron
2020-03-07 20:47                 ` nunojsa [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=292029f7-e30d-b510-95b0-e6037182a63b@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=Nuno.Sa@analog.com \
    --cc=alexandru.Ardelean@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@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).