From: Lars-Peter Clausen <lars@metafoo.de>
To: Denis Ciocca <denis.ciocca@gmail.com>
Cc: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>,
Pavel Machek <pavel@denx.de>, Denis CIOCCA <denis.ciocca@st.com>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
Jonathan Cameron <jic23@kernel.org>,
"burman.yan@gmail.com" <burman.yan@gmail.com>
Subject: Re: STMicroelectronics accelerometers driver.
Date: Sun, 14 Oct 2012 21:08:53 +0200 [thread overview]
Message-ID: <507B0DC5.5050807@metafoo.de> (raw)
In-Reply-To: <CAEE_umojW5OyB3yGgE54wH7_k__dBu9=Yew_0tCCf5--=C2g5g@mail.gmail.com>
On 10/14/2012 05:05 PM, Denis Ciocca wrote:
> Hi guys,
>
> according to your requests I have modified my driver. Only one things
> about this function:
>
> static int acc_get_buffer_element(struct iio_dev *indio_dev, u8 *buf)
>
> You tell to me:
>
>> In buffered mode the samples should not be postprocessed. Userspace expects the
>> samples in the format as described by the scan_type. The buffer demuxing should
>> be handled by the IIO core. If you set up available_scan_masks correctly it
>> will automatically do the right thing.
>
> I agree with you for the postprocessed samples part, but I don't understand very
> well the second one.
> I saw the other drivers, if I check only the available_scan_masks variable
> I don't know which channels are actives and which not.
> I will read every time all data channels, but I choose which channel
> put in the buffer.
You can tell the IIO core that you can only handle certain combinations of
channels which can be sampled at the same time. E.g. in you case there is only
one possible combination, which is that all channels are always sampled. If in
userspace only a subset of that list is selected the IIO core will take of only
passing those samples on to userspace which it actually requested.
Right now you do this by hand in your driver. But if you setup
scan_masks_available for you IIO device with only one scan mask which has all
channels set you can skip that step and just pass the buffer containing all
samples on to the IIO core and it will take care of picking those out which are
actually needed. There are a few examples of this, grep for
available_scan_masks to find them.
I now there are also some examples of IIO drivers which do what you did in your
driver, but these are older drivers which were written when the demuxing
infrastructure in the core was not in place. But the plan is to switch this
over as we continue to improve the existing drivers.
Will try take a look at the new patch tomorrow.
- Lars
next prev parent reply other threads:[~2012-10-14 19:08 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-08 15:39 STMicroelectronics accelerometers driver Denis CIOCCA
2012-10-08 19:14 ` Lars-Peter Clausen
2012-10-08 19:50 ` Pavel Machek
2012-10-08 20:33 ` Lars-Peter Clausen
2012-10-08 20:37 ` Jonathan Cameron
2012-10-14 15:05 ` Denis Ciocca
2012-10-14 19:08 ` Lars-Peter Clausen [this message]
2012-10-16 17:51 ` Lars-Peter Clausen
2012-10-22 9:31 ` Denis CIOCCA
2012-10-22 18:07 ` Jonathan Cameron
2012-10-22 19:37 ` Denis Ciocca
2012-10-24 12:44 ` Denis CIOCCA
2012-10-26 12:10 ` Lars-Peter Clausen
2012-10-29 8:55 ` Denis CIOCCA
2012-10-29 9:13 ` Lars-Peter Clausen
2012-10-29 10:24 ` Denis CIOCCA
2012-10-29 10:30 ` Lars-Peter Clausen
2012-10-29 10:38 ` Denis CIOCCA
2012-10-31 14:27 ` Denis CIOCCA
2012-10-31 16:40 ` Lars-Peter Clausen
2012-10-31 20:33 ` Jonathan Cameron
2012-11-04 10:09 ` Denis Ciocca
2012-11-05 21:28 ` Jonathan Cameron
2012-11-06 11:11 ` Denis CIOCCA
2012-11-12 17:10 ` Denis CIOCCA
2012-11-12 18:48 ` Jonathan Cameron
2012-11-13 15:38 ` Denis CIOCCA
2012-11-18 13:20 ` Jonathan Cameron
2012-11-23 16:10 ` Denis CIOCCA
2012-11-24 16:23 ` Jonathan Cameron
2012-11-26 16:57 ` Denis CIOCCA
2012-11-27 11:52 ` Denis CIOCCA
2012-11-29 9:46 ` Lars-Peter Clausen
2012-11-27 15:36 ` STMicroelectronics gyroscopes driver Denis CIOCCA
2012-11-29 9:51 ` Lars-Peter Clausen
2012-11-30 9:13 ` Denis CIOCCA
2012-11-30 10:36 ` Lars-Peter Clausen
2012-11-30 13:06 ` Jonathan Cameron
2012-12-03 16:40 ` STMicroelectronics driver Denis CIOCCA
2012-12-03 19:01 ` Lars-Peter Clausen
2012-11-19 13:00 ` STMicroelectronics accelerometers driver Lars-Peter Clausen
2012-11-06 11:14 ` Denis CIOCCA
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=507B0DC5.5050807@metafoo.de \
--to=lars@metafoo.de \
--cc=burman.yan@gmail.com \
--cc=denis.ciocca@gmail.com \
--cc=denis.ciocca@st.com \
--cc=jic23@jic23.retrosnub.co.uk \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=pavel@denx.de \
/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).