All of lore.kernel.org
 help / color / mirror / Atom feed
* Questions: IIO type for absorbance and float values in channels?
@ 2022-06-21 12:18 Stefan Lengfeld
  2022-06-21 12:29 ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Stefan Lengfeld @ 2022-06-21 12:18 UTC (permalink / raw)
  To: linux-iio

Hi all,

I'm currently working on a linux kernel driver for a new sensor design. It's a
special kind of light sensor that measures the reflection of emitted light.

I'm trying to fit this type of sensor into the IIO subsystem but I hit some
issues.


Question 1:

The sensor measures the absorbance[1] of a material. It's the negative
logarithmic quotient of the received and emitted light. It's a unit-less value.

As far as I can see there is currently no predefined IIO type in the kernel for
this.  I have search the list [2], but nothing matches.

Do I overlook something or what channel type should I use for this sensor
measurement value?


Question 2:

The sensor effectively returns a float value of the measurement. I grepped trough
the existing IIO drivers, but there seems only one driver that deals with float
values.  The sps30 driver[3] gets a float from the device, but converts it to a
integer value before passing it to the IIO subsystem.

I know that it's possible to provide a 'scale' attribute per channel to
userspace[4], which can be a float point number. So effectively the result of a
measurement can be a float-point value after it's computed in userspace.

Are floats really not supported as channel values? What is the recommend
approach to deal with these measurement values?


Question 3:

Is there another kernel subsystem/UAPI that fits this type of sensor
better?  (My guess would be: No, IIO is the correct subsystem.)


Thanks a lot for answering my question.


Kind regards,
Stefan

[1]: https://en.wikipedia.org/wiki/Absorbance
[2]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/iio/types.h#n14
[3]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/chemical/sps30.c#n39
[4]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/iio/dummy/iio_simple_dummy.c#n122

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

end of thread, other threads:[~2022-06-25 13:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-21 12:18 Questions: IIO type for absorbance and float values in channels? Stefan Lengfeld
2022-06-21 12:29 ` Jonathan Cameron
2022-06-21 14:13   ` Andy Shevchenko
2022-06-21 19:26     ` Jonathan Cameron
2022-06-22 15:42   ` Stefan Lengfeld
2022-06-25 13:21     ` 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.