0001 Industrial I/O Subsystem in kernel consumers.
0002
0003 The IIO subsystem can act as a layer under other elements of the kernel
0004 providing a means of obtaining ADC type readings or of driving DAC type
0005 signals. The functionality supported will grow as use cases arise.
0006
0007 Describing the channel mapping (iio/machine.h)
0008
0009 Channel associations are described using:
0010
0011 struct iio_map {
0012 const char *adc_channel_label;
0013 const char *consumer_dev_name;
0014 const char *consumer_channel;
0015 };
0016
0017 adc_channel_label identifies the channel on the IIO device by being
0018 matched against the datasheet_name field of the iio_chan_spec.
0019
0020 consumer_dev_name allows identification of the consumer device.
0021 This are then used to find the channel mapping from the consumer device (see
0022 below).
0023
0024 Finally consumer_channel is a string identifying the channel to the consumer.
0025 (Perhaps 'battery_voltage' or similar).
0026
0027 An array of these structures is then passed to the IIO driver.
0028
0029 Supporting in kernel interfaces in the driver (driver.h)
0030
0031 The driver must provide datasheet_name values for its channels and
0032 must pass the iio_map structures and a pointer to its own iio_dev structure
0033 on to the core via a call to iio_map_array_register. On removal,
0034 iio_map_array_unregister reverses this process.
0035
0036 The result of this is that the IIO core now has all the information needed
0037 to associate a given channel with the consumer requesting it.
0038
0039 Acting as an IIO consumer (consumer.h)
0040
0041 The consumer first has to obtain an iio_channel structure from the core
0042 by calling iio_channel_get(). The correct channel is identified by:
0043
0044 * matching dev or dev_name against consumer_dev and consumer_dev_name
0045 * matching consumer_channel against consumer_channel in the map
0046
0047 There are then a number of functions that can be used to get information
0048 about this channel such as it's current reading.
0049
0050 e.g.
0051 iio_read_channel_raw() - get a reading
0052 iio_get_channel_type() - get the type of channel
0053
0054 There is also provision for retrieving all of the channels associated
0055 with a given consumer. This is useful for generic drivers such as
0056 iio_hwmon where the number and naming of channels is not known by the
0057 consumer driver. To do this, use iio_channel_get_all.
0058