All of lore.kernel.org
 help / color / mirror / Atom feed
* question about iio_dev.active_scan_mask
@ 2018-09-19 22:03 David Frey
  2018-09-20  8:33 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: David Frey @ 2018-09-19 22:03 UTC (permalink / raw)
  To: linux-iio

Hi,

I am looking at struct iio_dev in include/linux/iio/iio.h and the
active_scan_mask member is documented as:

@active_scan_mask:   [INTERN] union of all scan masks requested by buffers

I believe that this is a bitmap where if bit X is set, that means the
channel with scan_index == X is enabled for buffering.

I believe that "[INTERN]" means that this member should not be accessed
by a device driver, but I see many device drivers iterating over the
bits of this field.  Is my understanding incorrect?  Perhaps "[INTERN]"
means that the field can be read from the driver, but should not be written.

Please help me clear up my understanding.

Thanks,
David

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: question about iio_dev.active_scan_mask
  2018-09-19 22:03 question about iio_dev.active_scan_mask David Frey
@ 2018-09-20  8:33 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2018-09-20  8:33 UTC (permalink / raw)
  To: David Frey; +Cc: linux-iio

On Wed, 19 Sep 2018 15:03:11 -0700
David Frey <dpfrey@gmail.com> wrote:

> Hi,
Hi David,

> 
> I am looking at struct iio_dev in include/linux/iio/iio.h and the
> active_scan_mask member is documented as:
> 
> @active_scan_mask:   [INTERN] union of all scan masks requested by buffers
> 
> I believe that this is a bitmap where if bit X is set, that means the
> channel with scan_index == X is enabled for buffering.

Correct. It represents the channels the device should be sampling,
which are not always the same as the ones that the driver's userspace interface
has configured as the channel demux may well be in use.

> 
> I believe that "[INTERN]" means that this member should not be accessed
> by a device driver, but I see many device drivers iterating over the
> bits of this field.  Is my understanding incorrect?  Perhaps "[INTERN]"
> means that the field can be read from the driver, but should not be written.

Yeah, this was a bit of historical mess we have slowly been cleaning out.
(or at least intending to clear out - as you've noted we haven't gotten
very far with it)

The upshot is they shouldn't access it directly, but only via the value
passed to the update_scan_mode callback. Now arguably we should reconsider
this given there are drivers in which the only thing that callback would
do is to take a copy of this field.  One that needs some more thought and
analysis of whether this is because there is actually a common case where
there are no optimizations that can be 'pre baked' in this callback, or
because they simply haven't been done yet for many of these parts.

This is one of those ugly corners I'd completely forgotten we still had
so glad you reminded us!

Jonathan

> 
> Please help me clear up my understanding.
> 
> Thanks,
> David

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-20 14:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-19 22:03 question about iio_dev.active_scan_mask David Frey
2018-09-20  8:33 ` Jonathan Cameron

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.