linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@cam.ac.uk>
To: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>
Subject: RFC: Does separate types for differential signals make sense?
Date: Thu, 18 Aug 2011 11:18:14 +0100	[thread overview]
Message-ID: <4E4CE6E6.2010308@cam.ac.uk> (raw)

Hi All,

Whilst working on some of the capacitance adc drivers yesterday I added a second
differential type.   Whilst we only had IIO_VOlTAGE_DIFF, it seemed easier to
handle it as a special case - now we have IIO_CAPACITANCE_DIFF, I'm not so sure.

The alternative is to add another flag to struct iio_chan_spec and build the
differential names automatically (easy enough I think).  Nastier is how to handle
the related event codes.  As we haven't pushed out the new 64 bit codes, this
is a perfect time to slip in a change there (rather than two changes back to back.)

Current macro to generate codes is:

define IIO_EVENT_CODE(chan_type, modifier, direction,			\
		       type, chan, chan1, chan2)			\
	(((u64)type << 56) | ((u64)direction << 48) | ((u64)modifier << 40) | \
	 ((u64)chan_type << 32) | (chan2 << 16) | chan1 | chan)

So if we were to steal a bit to mark channels as differential, where would we do it?
Obvious choice is in type - reducing max number of types to 128 - can't see that being
a problem any time soon.  Could pinch the top bit off direction instead - that one
has way more values than I can think of uses for...

This is going to be an annoyingly invasive patch to do. I'll probably scrap the
use of the IIO_CHAN macro for all differential channels rather than adding another
parameter to it. Plan was to scrap that macro entirely eventually, so not such a
bad thing.

Jonathan


             reply	other threads:[~2011-08-18 10:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-18 10:18 Jonathan Cameron [this message]
2011-08-18 12:09 ` RFC: Does separate types for differential signals make sense? Michael Hennerich
2011-08-18 12:29   ` [PATCH] IIO: Scrap the _DIFF types in favour of a flag in chan spec Jonathan Cameron
2011-08-18 12:29   ` [PATCH] staging:iio: Differential channel handling - use explicit flag rather than types 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=4E4CE6E6.2010308@cam.ac.uk \
    --to=jic23@cam.ac.uk \
    --cc=Michael.Hennerich@analog.com \
    --cc=linux-iio@vger.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).