Re: [PATCH 4/5] iio: adis16480: add support for adis16545/7 families

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 22 May 2024 12:01:21 +0000
"Gradinariu, Ramona" <Ramona.Gradinariu@xxxxxxxxxx> 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
> >   
> 





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux