From: Lars-Peter Clausen <lars@metafoo.de>
To: leroy christophe <christophe.leroy@c-s.fr>
Cc: Jonathan Cameron <jic23@cam.ac.uk>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
patrick.vasseur@c-s.fr
Subject: Re: [PATCH] IIO AD7923 iio_consumer support
Date: Sat, 05 Oct 2013 11:35:11 +0200 [thread overview]
Message-ID: <524FDD4F.7080406@metafoo.de> (raw)
In-Reply-To: <524FD976.9060708@c-s.fr>
On 10/05/2013 11:18 AM, leroy christophe wrote:
>
> Le 05/10/2013 10:41, Lars-Peter Clausen a écrit :
>> On 10/05/2013 10:21 AM, Christophe Leroy wrote:
>>> + .consumer_channel = "channel_0",
>>> + .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",
>>> + },
>>> + { }
>>> +};
>> This is a mapping between channel names of the provider between the channel
>> 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");
>>
>>
> Thanks for the explanation.
>
> Can the mapping be retrieved via of_platform ?
>
> Indeed, the only exemple I found was in the lp8788_adc driver, which
> includes iio/machine.h and declares a default mapping, but it is based on
> platform_data, not of_platform.
>
If you are using device tree you can specify the mapping inside the
devicetree. Have a look at
Documentation/devicetree/bindings/iio/iio-bindings.txt
- Lars
next prev parent reply other threads:[~2013-10-05 9:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-05 8:21 [PATCH] IIO AD7923 iio_consumer support Christophe Leroy
2013-10-05 8:41 ` Lars-Peter Clausen
2013-10-05 9:18 ` leroy christophe
2013-10-05 9:35 ` Lars-Peter Clausen [this message]
2013-10-05 9:39 ` leroy christophe
2013-10-05 9:43 ` Lars-Peter Clausen
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=524FDD4F.7080406@metafoo.de \
--to=lars@metafoo.de \
--cc=christophe.leroy@c-s.fr \
--cc=jic23@cam.ac.uk \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=patrick.vasseur@c-s.fr \
/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).