Re: [PATCH] staging:iio:proof of concept in kernel interface.

From: Jonathan Cameron
Date: Mon Oct 17 2011 - 06:32:04 EST


On 10/17/11 11:19, Mark Brown wrote:
> On Mon, Oct 17, 2011 at 10:43:53AM +0100, Jonathan Cameron wrote:
>
>> For the adc channel I'm not particularly keen on insisting every device
>> have a unique name for every channel. That breaks the effort we went to
>> in IIO to enforce consistent naming (for userspace interfaces) in the first
>> place. To my mind it should never be anything other than a number.
>
> I think you want something similar to what we do with platform devices -
> have both a name and a number. For devices that are just a bunch of
> symmetric channels (which seems to be the main case you're thinking of)
> the name would always be the same and the number would vary but if the
> device has a bunch of different functions then they'd be named. That
> way you don't have to remember that the channels of a given type start
> at offset X.
>
> For example, on a PMIC you'll often have ADC channels wired up to
> specific supplies plus some extras which are left for board use. The
> fixed channels might get named after the supplies and the extras all
> have the same name distinguished by number.
>
We effectively have the equivalent already - I can add it to the query
interface. It allows channels to have a supplementary name typically
if they are measuring something not of general purpose (such as the
sensor supply voltage).

I'd also allow for name to be NULL - it provides no information at all
for a lot of devices.

Note, if we are talking functions such 'acceleration' then I'd much
rather have explicit enums for type, direction etc in there. This
means that we are mapping onto the full channel spec rather than the
channel index. Really don't want strings on the adc side (except for
special cases as described above) as I just spent rather a long time
ripping them out precisely to enforce a consistent interface where
there was previously too much flexibility.

We have a system that allows describing of more or less everything we
have ever encountered in a rigorous consistent fashion (I say almost
as there is a slight wrinkle with some dds channels as currently defined).

Initially I'd be tempted to only support numbered channels (on adc side).
Later we can add the named option - iff it has real use cases.

Jonathan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/