From: Jonathan Cameron <jic23@kernel.org>
To: Sebastian Reichel <sre@debian.org>,
Sebastian Reichel <sre@ring0.de>,
Marek Belisko <marek@goldelico.com>
Cc: Lee Jones <lee.jones@linaro.org>,
Samuel Ortiz <sameo@linux.intel.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh+dt@kernel.org>, Pawel Moll <pawel.moll@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Ian Campbell <ijc+devicetree@hellion.org.uk>,
Kumar Gala <galak@codeaurora.org>,
Grant Likely <grant.likely@linaro.org>,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-iio@vger.kernel.org
Subject: Re: [PATCHv3 9/9] iio: inkern: add iio_read_channel_average_raw
Date: Sat, 15 Mar 2014 15:42:25 +0000 [thread overview]
Message-ID: <532474E1.1090904@kernel.org> (raw)
In-Reply-To: <1394472329-15485-10-git-send-email-sre@debian.org>
On 10/03/14 17:25, Sebastian Reichel wrote:
> Add iio_read_channel_average_raw to support reading
> averaged raw values in consumer drivers.
>
> Signed-off-by: Sebastian Reichel <sre@debian.org>
As this one also stands fine on it's own and isn't actually used
by the rest of the patch set - applied to the togreg branch of iio.git
This will get pushed out initially as 'testing' for the autobuilders
to play.
Jonathan
> ---
> drivers/iio/inkern.c | 18 ++++++++++++++++++
> include/linux/iio/consumer.h | 13 +++++++++++++
> 2 files changed, 31 insertions(+)
>
> diff --git a/drivers/iio/inkern.c b/drivers/iio/inkern.c
> index 0cf5f8e..adeba5a 100644
> --- a/drivers/iio/inkern.c
> +++ b/drivers/iio/inkern.c
> @@ -443,6 +443,24 @@ err_unlock:
> }
> EXPORT_SYMBOL_GPL(iio_read_channel_raw);
>
> +int iio_read_channel_average_raw(struct iio_channel *chan, int *val)
> +{
> + int ret;
> +
> + mutex_lock(&chan->indio_dev->info_exist_lock);
> + if (chan->indio_dev->info == NULL) {
> + ret = -ENODEV;
> + goto err_unlock;
> + }
> +
> + ret = iio_channel_read(chan, val, NULL, IIO_CHAN_INFO_AVERAGE_RAW);
> +err_unlock:
> + mutex_unlock(&chan->indio_dev->info_exist_lock);
> +
> + return ret;
> +}
> +EXPORT_SYMBOL_GPL(iio_read_channel_average_raw);
> +
> static int iio_convert_raw_to_processed_unlocked(struct iio_channel *chan,
> int raw, int *processed, unsigned int scale)
> {
> diff --git a/include/linux/iio/consumer.h b/include/linux/iio/consumer.h
> index 2752b1f..651f9a0 100644
> --- a/include/linux/iio/consumer.h
> +++ b/include/linux/iio/consumer.h
> @@ -123,6 +123,19 @@ int iio_read_channel_raw(struct iio_channel *chan,
> int *val);
>
> /**
> + * iio_read_channel_average_raw() - read from a given channel
> + * @chan: The channel being queried.
> + * @val: Value read back.
> + *
> + * Note raw reads from iio channels are in adc counts and hence
> + * scale will need to be applied if standard units required.
> + *
> + * In opposit to the normal iio_read_channel_raw this function
> + * returns the average of multiple reads.
> + */
> +int iio_read_channel_average_raw(struct iio_channel *chan, int *val);
> +
> +/**
> * iio_read_channel_processed() - read processed value from a given channel
> * @chan: The channel being queried.
> * @val: Value read back.
>
prev parent reply other threads:[~2014-03-15 15:41 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 17:25 [PATCHv3 0/9] Convert twl4030-madc to IIO API and add DT support Sebastian Reichel
2014-03-10 17:25 ` [PATCHv3 1/9] mfd: twl4030-madc: Use managed resources Sebastian Reichel
2014-03-10 17:25 ` Sebastian Reichel
2014-03-15 15:36 ` Jonathan Cameron
2014-03-15 15:36 ` Jonathan Cameron
2014-03-10 17:25 ` [PATCHv3 2/9] mfd: twl4030-madc: Add DT support and convert to IIO framework Sebastian Reichel
2014-03-11 6:56 ` Lee Jones
2014-03-11 6:56 ` Lee Jones
2014-03-15 15:38 ` Jonathan Cameron
2014-03-15 15:38 ` Jonathan Cameron
2014-03-10 17:25 ` [PATCHv3 3/9] mfd: twl4030-madc: Cleanup driver Sebastian Reichel
2014-03-15 15:39 ` Jonathan Cameron
2014-03-15 15:39 ` Jonathan Cameron
2014-03-10 17:25 ` [PATCHv3 4/9] mfd: twl-core: Add twl_i2c_read/write_u16 Sebastian Reichel
2014-03-10 17:25 ` Sebastian Reichel
2014-03-10 17:25 ` [PATCHv3 5/9] mfd: twl4030-madc: Use twl_i2c_read/write_u16 for 16 bit registers Sebastian Reichel
2014-03-10 17:25 ` [PATCHv3 6/9] Documentation: DT: Document twl4030-madc binding Sebastian Reichel
2014-03-10 17:25 ` [PATCHv3 7/9] mfd: twl4030-madc: Move driver to drivers/iio/adc Sebastian Reichel
2014-03-10 17:25 ` [PATCHv3 8/9] iio: documentation: Add ABI documentation for *_mean_raw Sebastian Reichel
2014-03-15 15:40 ` Jonathan Cameron
2014-03-15 15:40 ` Jonathan Cameron
2014-03-10 17:25 ` [PATCHv3 9/9] iio: inkern: add iio_read_channel_average_raw Sebastian Reichel
2014-03-15 15:42 ` Jonathan Cameron [this message]
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=532474E1.1090904@kernel.org \
--to=jic23@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=galak@codeaurora.org \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=lars@metafoo.de \
--cc=lee.jones@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marek@goldelico.com \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=robh+dt@kernel.org \
--cc=sameo@linux.intel.com \
--cc=sre@debian.org \
--cc=sre@ring0.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.