From: Jonathan Cameron <jic23@kernel.org>
To: Nikita Yushchenko <nikita.yoush@cogentembedded.com>,
Hartmut Knaack <knaack.h@gmx.de>,
Lars-Peter Clausen <lars@metafoo.de>,
Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
Matt Ranostay <mranostay@gmail.com>,
Gregor Boirie <gregor.boirie@parrot.com>,
Sanchayan Maity <maitysanchayan@gmail.com>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Jeff White <Jeff.White@zii.aero>,
Chris Healy <Chris.Healy@zii.aero>,
Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Subject: Re: [PATCH 1/4] iio: hi8435: add raw access
Date: Sat, 20 May 2017 17:33:40 +0100 [thread overview]
Message-ID: <67afb274-c93b-f35b-64c1-0ab8ccb21557@kernel.org> (raw)
In-Reply-To: <20170519144802.14427-1-nikita.yoush@cogentembedded.com>
On 19/05/17 15:47, Nikita Yushchenko wrote:
> With current event-only driver, it is not possible for user space
> application to know current senses if they don't change since
> application starts.
>
> Address that by adding raw access to channels.
>
> Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Ideally I'd like Vladimir's ack on these, but I am going to guess
that he is fine with this and rely on him shouting if not ;)
Applied to the togreg branch of iio.git and pushed out as testing.
Thanks,
Jonathan
> ---
> drivers/iio/adc/hi8435.c | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/drivers/iio/adc/hi8435.c b/drivers/iio/adc/hi8435.c
> index 678e8c7ea763..cb8e6342eddf 100644
> --- a/drivers/iio/adc/hi8435.c
> +++ b/drivers/iio/adc/hi8435.c
> @@ -105,6 +105,26 @@ static int hi8435_writew(struct hi8435_priv *priv, u8 reg, u16 val)
> return spi_write(priv->spi, priv->reg_buffer, 3);
> }
>
> +static int hi8435_read_raw(struct iio_dev *idev,
> + const struct iio_chan_spec *chan,
> + int *val, int *val2, long mask)
> +{
> + struct hi8435_priv *priv = iio_priv(idev);
> + u32 tmp;
> + int ret;
> +
> + switch (mask) {
> + case IIO_CHAN_INFO_RAW:
> + ret = hi8435_readl(priv, HI8435_SO31_0_REG, &tmp);
> + if (ret < 0)
> + return ret;
> + *val = !!(tmp & BIT(chan->channel));
> + return IIO_VAL_INT;
> + default:
> + return -EINVAL;
> + }
> +}
> +
> static int hi8435_read_event_config(struct iio_dev *idev,
> const struct iio_chan_spec *chan,
> enum iio_event_type type,
> @@ -333,6 +353,7 @@ static const struct iio_chan_spec_ext_info hi8435_ext_info[] = {
> .type = IIO_VOLTAGE, \
> .indexed = 1, \
> .channel = num, \
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
> .event_spec = hi8435_events, \
> .num_event_specs = ARRAY_SIZE(hi8435_events), \
> .ext_info = hi8435_ext_info, \
> @@ -376,6 +397,7 @@ static const struct iio_chan_spec hi8435_channels[] = {
>
> static const struct iio_info hi8435_info = {
> .driver_module = THIS_MODULE,
> + .read_raw = hi8435_read_raw,
> .read_event_config = &hi8435_read_event_config,
> .write_event_config = hi8435_write_event_config,
> .read_event_value = &hi8435_read_event_value,
>
next prev parent reply other threads:[~2017-05-20 16:33 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-19 14:47 [PATCH 1/4] iio: hi8435: add raw access Nikita Yushchenko
2017-05-19 14:48 ` [PATCH 2/4] iio: hi8435: avoid garbage event at first enable Nikita Yushchenko
2017-05-20 16:34 ` Jonathan Cameron
2017-05-22 18:20 ` Vladimir Barinov
2017-05-23 7:21 ` Nikita Yushchenko
2017-05-19 14:48 ` [PATCH 3/4] iio: hi8435: make in_voltage_sensing_mode_available visible Nikita Yushchenko
2017-05-20 16:35 ` Jonathan Cameron
2017-05-22 18:21 ` Vladimir Barinov
2017-05-19 14:48 ` [PATCH 4/4] iio: hi8435: cleanup reset gpio Nikita Yushchenko
2017-05-20 16:37 ` Jonathan Cameron
2017-05-22 18:27 ` Vladimir Barinov
2017-05-23 8:18 ` Nikita Yushchenko
2017-05-24 11:27 ` Vladimir Barinov
2017-05-24 19:38 ` Jonathan Cameron
2017-05-25 6:27 ` Nikita Yushchenko
2017-05-28 15:42 ` Jonathan Cameron
2017-05-29 7:57 ` Nikita Yushchenko
2017-05-29 17:08 ` Linus Walleij
2017-05-20 16:33 ` Jonathan Cameron [this message]
2017-05-22 17:27 ` [PATCH 1/4] iio: hi8435: add raw access Vladimir Barinov
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=67afb274-c93b-f35b-64c1-0ab8ccb21557@kernel.org \
--to=jic23@kernel.org \
--cc=Chris.Healy@zii.aero \
--cc=Jeff.White@zii.aero \
--cc=gregor.boirie@parrot.com \
--cc=knaack.h@gmx.de \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maitysanchayan@gmail.com \
--cc=mranostay@gmail.com \
--cc=nikita.yoush@cogentembedded.com \
--cc=pmeerw@pmeerw.net \
--cc=vladimir.barinov@cogentembedded.com \
/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).