public inbox for linux-doc@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: "Nuno Sá" <noname.nuno@gmail.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
	"Michael Hennerich" <Michael.Hennerich@analog.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-doc@vger.kernel.org
Subject: Re: [PATCH 1/2] iio: adc: ad4695: implement triggered buffer
Date: Wed, 14 Aug 2024 19:56:04 +0100	[thread overview]
Message-ID: <20240814195604.6a871c6c@jic23-huawei> (raw)
In-Reply-To: <8b32d9819e44436af39c5f32b095c41f8ebd77b1.camel@gmail.com>

On Tue, 13 Aug 2024 09:28:06 +0200
Nuno Sá <noname.nuno@gmail.com> wrote:

> On Mon, 2024-08-12 at 12:03 -0500, David Lechner wrote:
> > On 8/10/24 4:35 AM, Jonathan Cameron wrote:  
> > > On Wed,  7 Aug 2024 15:02:10 -0500
> > > David Lechner <dlechner@baylibre.com> wrote:
> > >   
> > > > This implements buffered reads for the ad4695 driver using the typical
> > > > triggered buffer implementation, including adding a soft timestamp
> > > > channel.
> > > > 
> > > > The chip has 4 different modes for doing conversions. The driver is
> > > > using the advanced sequencer mode since that is the only mode that
> > > > allows individual configuration of all aspects each channel (e.g.
> > > > bipolar config currently and oversampling to be added in the future).
> > > > 
> > > > Signed-off-by: David Lechner <dlechner@baylibre.com>  
> > > 
> > > Main thing in here is I think you can use available_scan_masks
> > > to avoid the need for the error path on just the temperature channel
> > > being enabled.
> > >   
> > I had not thought about doing it that way, but now that I am
> > thinking about it, it seems like we would need to have a scan
> > mask in the list for every possible combination of channels.
> > This would be 10s of thousands of possible scan masks for 16
> > channel chips so that doesn't seem like the best way to go.

Indeed not my best suggestion.

> > 
> > But adding some special handling to make the temperature
> > channel just work should be easy enough to add.
> >   
> 
> Not sure if the following is meaningful to this usecase but I used to think like you
> but then realized that iio_scan_mask_match() will do bitmap_subset(). So you only
> need to enable a subset of the available scan mask for things to work (and with that
> you should no longer need an insane number of combinations). The core will then take
> care of demuxing the actual enabled channels. AFAIR, strict scan matching is only
> used for HW buffering.

Hmm. The validate_scan_mask callback also doesn't work as that's really about
restricting cases where we are onehot or similar (so restricting number of channels
or that sort of thing).

So, I think this is a driver problem to hide it.

Just have some logic in the driver that enables a dummy channel if only the
temperature is enabled and throw it away (probably fine to put it in the
data passed to iio_push_to_buffers() and rely on the it either being
treated as garbage, or dropped depending on whether it is in a hole, or
on the end of the scan.  That should give the intuitive interface
we expect (no restrictions to bite us that don't have to be there - see onehot
case where we have no choice) without adding too much complexity.

Jonathan

> 
> - Nuno Sá


  reply	other threads:[~2024-08-14 18:56 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-07 20:02 [PATCH 0/2] iio: adc: ad4695: implement triggered buffer David Lechner
2024-08-07 20:02 ` [PATCH 1/2] " David Lechner
2024-08-08  8:52   ` kernel test robot
2024-08-10  9:20     ` Jonathan Cameron
2024-08-09 14:24   ` Nuno Sá
2024-08-09 16:01     ` David Lechner
2024-08-10  9:35   ` Jonathan Cameron
2024-08-12 17:03     ` David Lechner
2024-08-13  7:28       ` Nuno Sá
2024-08-14 18:56         ` Jonathan Cameron [this message]
2024-08-07 20:02 ` [PATCH 2/2] doc: iio: ad4695: document buffered read David Lechner
2024-08-10  9:36   ` 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=20240814195604.6a871c6c@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=corbet@lwn.net \
    --cc=dlechner@baylibre.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=noname.nuno@gmail.com \
    --cc=nuno.sa@analog.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