On 10/05/2013 10:21 AM, Christophe Leroy wrote:Thanks for the explanation.+ .consumer_channel = "channel_0",This is a mapping between channel names of the provider between the channel
+ .adc_channel_label = "0",
+ },
+ {
+ .consumer_dev_name = AD7923_NAME,
+ .consumer_channel = "channel_1",
+ .adc_channel_label = "1",
+ },
+ {
+ .consumer_dev_name = AD7923_NAME,
+ .consumer_channel = "channel_2",
+ .adc_channel_label = "2",
+ },
+ {
+ .consumer_dev_name = AD7923_NAME,
+ .consumer_channel = "channel_3",
+ .adc_channel_label = "3",
+ },
+ { }
+};
names of the consumer. So it is specific to a certain combination of
consumer and provider and usually depend on how things are physically wired
on your board. As such there can be no generic mapping and this needs to go
into your machine/board driver. The mapping is usually passed to the IIO
driver via its platform data.
So e.g. imagine you have a provider like this driver and you have a consumer
that has a "voltage" channel. And on your board channel 3 of the ADC is what
you want to route to that consumer. Then your mapping would look like this:
{
.consumer_dev_name = "your_consumer_device.1",
.consumer_channel = "voltage",
.adc_channel_label = "AIN3",
}
And in your consumer driver you'd do:
channel = iio_channel_get(dev, "voltage");