All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: "Gradinariu, Ramona" <Ramona.Gradinariu@analog.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"Nuno Sá" <noname.nuno@gmail.com>,
	"Ramona Gradinariu" <ramona.bolboaca13@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"corbet@lwn.net" <corbet@lwn.net>,
	"conor+dt@kernel.org" <conor+dt@kernel.org>,
	"krzysztof.kozlowski+dt@linaro.org"
	<krzysztof.kozlowski+dt@linaro.org>,
	"robh@kernel.org" <robh@kernel.org>,
	"Sa, Nuno" <Nuno.Sa@analog.com>
Subject: Re: [PATCH 4/5] iio: adis16480: add support for adis16545/7 families
Date: Thu, 23 May 2024 17:37:27 +0100	[thread overview]
Message-ID: <20240523173727.000040ea@Huawei.com> (raw)
In-Reply-To: <BL1PR03MB5992653C0A426BAC69D7033197EB2@BL1PR03MB5992.namprd03.prod.outlook.com>

On Wed, 22 May 2024 12:01:21 +0000
"Gradinariu, Ramona" <Ramona.Gradinariu@analog.com> wrote:

> > 
> > If you are using bursts, the data is getting read anyway - which is the main
> > cost here. The real question becomes what are you actually saving by supporting all
> > the combinations of the the two subsets of channels in the pollfunc?
> > Currently you have to pick the channels out and repack them, if pushing them all
> > looks to me like a mempcy and a single value being set (unconditionally).  
> 
> I did not get a chance to look at this again until now. Unfortunately, a
> memcpy will not work.
> The current implementation is as follows:
> /* The lower register data is sequenced first */
> st->data[i++] = buffer[2 * bit + offset + 3];
> st->data[i++] = buffer[2 * bit + offset + 2];

Ah. That's horrible... :(
Thanks for pointing that out!

> 
> The device first sends the 16LSB, then the next 16MSB in big endian
> format.
> 
> So then I wonder, can we keep the same implementation logic? The code
> is implemented in the same manner for adis16475 driver which uses the
> same channels data packing approach.

Not much choice and given the need to handle a mixed endian stream
you might as well do the packing here as well.  So sure, keep the
code as you have it.

> 
> > 
> > Then it's a question of what the overhead of the channel demux in the core is.
> > What you pass out of the driver via iio_push_to_buffers*()
> > is not what ends up in the buffer if you allow the IIO core to do data demuxing
> > for you - that is enabled by providing available_scan_masks.  At buffer
> > start up the demux code computes a fairly optimal set of copies to repack
> > the incoming data to match with what channels the consumer (here probably
> > the kfifo on the way to userspace) is expecting.
> > 
> > That demux adds a small overhead but it should be small as long
> > as the channels wanted aren't pathological (i.e. every other one).
> > 
> > Advantage is the driver ends up simpler and in the common case of turn
> > on all the channels (why else did you buy a device with those measurements
> > if you didn't want them!) the demux is zerocopy so effectively free which
> > is not going to be the case for the bitmap walk and element copy in the
> > driver.
> > 
> > Jonathan
> >   
> 


  reply	other threads:[~2024-05-23 16:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-23  8:42 [PATCH 0/5] Add support for adis16545/47 Ramona Gradinariu
2024-04-23  8:42 ` [PATCH 1/5] iio: adis16480: make the burst_max_speed configurable Ramona Gradinariu
2024-04-23  8:42 ` [PATCH 2/5] iio: imu: adis16480.c: Add delta angle and delta velocity channels Ramona Gradinariu
2024-04-28 15:04   ` Jonathan Cameron
2024-04-28 15:07     ` Jonathan Cameron
2024-04-23  8:42 ` [PATCH 3/5] dt-bindings: iio: imu: Add docs for ADIS16545/47 Ramona Gradinariu
2024-04-23  9:45   ` Krzysztof Kozlowski
2024-04-23  8:42 ` [PATCH 4/5] iio: adis16480: add support for adis16545/7 families Ramona Gradinariu
2024-04-28 15:25   ` Jonathan Cameron
2024-04-29  7:58     ` Nuno Sá
2024-04-29 13:17       ` Gradinariu, Ramona
2024-04-29 19:40         ` Jonathan Cameron
2024-05-02 11:31           ` Nuno Sá
2024-05-02 19:14             ` Jonathan Cameron
2024-05-03  6:09               ` Nuno Sá
2024-05-03  8:42                 ` Jonathan Cameron
2024-05-03  9:07                   ` Nuno Sá
2024-05-22 12:01           ` Gradinariu, Ramona
2024-05-23 16:37             ` Jonathan Cameron [this message]
2024-04-29  8:01     ` Nuno Sá
2024-04-23  8:42 ` [PATCH 5/5] docs: iio: add documentation for adis16480 driver Ramona Gradinariu
2024-04-28 15:33   ` 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=20240523173727.000040ea@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=Nuno.Sa@analog.com \
    --cc=Ramona.Gradinariu@analog.com \
    --cc=conor+dt@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noname.nuno@gmail.com \
    --cc=ramona.bolboaca13@gmail.com \
    --cc=robh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.