Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1646153

Re: [PATCH 1/4] iio: hi8435: add raw access

From Jonathan Cameron <jic23@kernel.org>
Newsgroups linux.kernel
Subject Re: [PATCH 1/4] iio: hi8435: add raw access
Date 2017-05-20 18:40 +0200
Message-ID <tJfA6-3RZ-13@gated-at.bofh.it> (permalink)
References <tIRo5-3Bo-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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,
> 

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] iio: hi8435: add raw access Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-05-19 16:50 +0200
  [PATCH 4/4] iio: hi8435: cleanup reset gpio Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-05-19 16:50 +0200
    Re: [PATCH 4/4] iio: hi8435: cleanup reset gpio Jonathan Cameron <jic23@kernel.org> - 2017-05-20 18:40 +0200
    Re: [PATCH 4/4] iio: hi8435: cleanup reset gpio Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-05-23 10:20 +0200
      Re: [PATCH 4/4] iio: hi8435: cleanup reset gpio Vladimir Barinov <vladimir.barinov@cogentembedded.com> - 2017-05-24 13:30 +0200
        Re: [PATCH 4/4] iio: hi8435: cleanup reset gpio Jonathan Cameron <jic23@kernel.org> - 2017-05-24 21:40 +0200
  [PATCH 2/4] iio: hi8435: avoid garbage event at first enable Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-05-19 16:50 +0200
    Re: [PATCH 2/4] iio: hi8435: avoid garbage event at first enable Jonathan Cameron <jic23@kernel.org> - 2017-05-20 18:40 +0200
    Re: [PATCH 2/4] iio: hi8435: avoid garbage event at first enable Vladimir Barinov <vladimir.barinov@cogentembedded.com> - 2017-05-22 20:30 +0200
      Re: [PATCH 2/4] iio: hi8435: avoid garbage event at first enable Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-05-23 09:30 +0200
  Re: [PATCH 1/4] iio: hi8435: add raw access Jonathan Cameron <jic23@kernel.org> - 2017-05-20 18:40 +0200
    Re: [PATCH 1/4] iio: hi8435: add raw access Vladimir Barinov <vladimir.barinov@cogentembedded.com> - 2017-05-22 19:30 +0200

csiph-web