From: Jonathan Cameron <jic23@kernel.org>
To: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: linux-iio@vger.kernel.org
Subject: Re: [RFC] Spectral ID sensor + floating point questions
Date: Sun, 20 May 2018 17:11:16 +0100 [thread overview]
Message-ID: <20180520171116.1fc57939@archlinux> (raw)
In-Reply-To: <CAJCx=g=9XoXygjdQ9r410jerbtDxOvUtN0a+KAdnj2OAb_1WGg@mail.gmail.com>
On Sun, 20 May 2018 22:21:03 +0800
Matt Ranostay <matt.ranostay@konsulko.com> wrote:
> Jonathan et all,
>
> Currently looking at ams AS7262 Spectral ID sensor, and thinking about
> adding support to enable a project I'm working on.
>
> But I noticed it is a bit odd in that outputs data for the 6 color
> channels in either a) raw 16-bit ADC values b) or calibration adjusted
> values (factory calibration) but are presented as 32-bit single
> precision floats.
>
> Clearly the latter data is much more useful but of course it is a
> floating point which isn't exactly the ideal in the kernel and there
> isn't a precedent in iio (that I know of) for such values.
>
> Datasheet: https://www.mouser.com/ds/2/588/AS7262_DS000486_2-00-1082195.pdf
>
> Any thoughts, or suggestions?
Hmm. Will need to think about this a little, but from a very high
level look at the datasheet and you description, there is nothing technically
stopping us supporting devices that do standards compliant floating point.
The only similar case we have run into in the past was the mess of the HID
sensor spec which could in theory change range over time and report it
via the event path. Thankfully I don't think we have ever seen a part
that actually does this. That was tricky because it wasn't in a standard
format and so pretty much required in kernel reformatting.
As this is real floating point, we probably just want to pass it straight
through to userspace using the buffered interface and a suitable
description of the type.
What we can't sensibly do is any in kernel consumers (as they'd have
to do fp maths) or anything involving maths in kernel on these.
We could do read_raw support with a suitable float to str function if
it is potentially useful...
So I'm not totally against the idea.
However, we do need better description of light channels as giving
them colors is only going to get us so far as these devices expand
their number of channels and bring in the frequency range for each.
Go for generality when you work this one out.
Fun looking part. I hope you go ahead with this one.
Jonathan
>
> Thanks,
>
> Matt
next prev parent reply other threads:[~2018-05-20 16:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-20 14:21 [RFC] Spectral ID sensor + floating point questions Matt Ranostay
2018-05-20 16:11 ` Jonathan Cameron [this message]
2018-05-21 5:56 ` Matt Ranostay
2018-05-22 17:12 ` Jonathan Cameron
2018-05-24 5:31 ` Matt Ranostay
2018-05-25 15:16 ` 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=20180520171116.1fc57939@archlinux \
--to=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=matt.ranostay@konsulko.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;
as well as URLs for NNTP newsgroup(s).