[RFC] iodevice support
Sascha Hauer
s.hauer at pengutronix.de
Thu Dec 10 02:25:20 PST 2015
On Wed, Dec 09, 2015 at 10:24:37PM -0800, Andrey Smirnov wrote:
> On Tue, Dec 8, 2015 at 1:05 AM, Sascha Hauer <s.hauer at pengutronix.de> wrote:
> > The following is something like a mixture of Linux IIO and hwmon support
> > for the poor. I called it iodevice, but better names are appreciated.
> > A iodevice has multiple channels, each providing a value like for
> > example a temperature or a voltage. For each iodevice we provide device
> > parameters to access the values from the commandline. The C API for a
> > consumer consists of iochannel_get() to get a iochannel, and
> > iochannel_get_value() to actually read a value.
> > As drivers we currently have a LM75 temperature driver and a MCP342x ADC
> > driver. Also there is a PT100 driver which itself is a consumer of
> > another iodevice, a MCP342x in my case. This is more meant as an example
> > since the voltage to temperature conversion function is board specific.
>
>
> One feature that I would like to suggest/request in this API is
> ability to give custom names to individual channels via DT. AFAIU, as
> of right now, that the names are hard coded and assigned automatically
> by the subsystem.
>
> The reason why I am asking is because a fair number of use-cases for
> Barebox that I see is as a board verification tool and as such it is
> often used by people who may not be as familiar (if at all) with
> Barebox, it's code and how "in_value%d_%s" relates to the actual
> parameter reading they are trying to verify.
Note the device name is already configurable in device tree using
aliases, Adding an foo_temperature = &lm75 will result in the device
being named foo_temperature, so echo $foo_temperature.in_value0_mC will
give you the temperature. Ok, that alone doesn't solve the problem. We
still can only name devices and not individual channels.
I'm just thinking about registering a single device named 'sensors' or
similar and register all parameters under that device instead of their
individual devices.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
More information about the barebox
mailing list