From: Jonathan Cameron <jic23@kernel.org>
To: Roan van Dijk <roan@protonic.nl>
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
david@protonic.nl, Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH] iio: chemical: scd4x: Add a scale for the co2 concentration reading
Date: Thu, 21 Oct 2021 20:53:57 +0100 [thread overview]
Message-ID: <20211021205357.688947c5@jic23-huawei> (raw)
In-Reply-To: <20211021140018.3051213-1-roan@protonic.nl>
On Thu, 21 Oct 2021 16:00:18 +0200
Roan van Dijk <roan@protonic.nl> wrote:
> This patch adds a scale for the co2 concentration reading. The reading is
> expressed in percent after applying the scale to the raw value.
>
> Signed-off-by: Roan van Dijk <roan@protonic.nl>
Thanks,
Applied to the togreg branch of iio.git and for once pushed out directly
as I want to get this into linux-next tomorrow and a pull request out if
no problems show up.
Thanks,
Jonathan
> ---
> drivers/iio/chemical/scd4x.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/chemical/scd4x.c b/drivers/iio/chemical/scd4x.c
> index 09b34201c42b..b063b378c7d5 100644
> --- a/drivers/iio/chemical/scd4x.c
> +++ b/drivers/iio/chemical/scd4x.c
> @@ -352,7 +352,11 @@ static int scd4x_read_raw(struct iio_dev *indio_dev,
> *val = ret;
> return IIO_VAL_INT;
> case IIO_CHAN_INFO_SCALE:
> - if (chan->type == IIO_TEMP) {
> + if (chan->type == IIO_CONCENTRATION) {
> + *val = 0;
> + *val2 = 100;
> + return IIO_VAL_INT_PLUS_MICRO;
> + } else if (chan->type == IIO_TEMP) {
> *val = 175000;
> *val2 = 65536;
> return IIO_VAL_FRACTIONAL;
> @@ -501,7 +505,8 @@ static const struct iio_chan_spec scd4x_channels[] = {
> .type = IIO_CONCENTRATION,
> .channel2 = IIO_MOD_CO2,
> .modified = 1,
> - .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> + BIT(IIO_CHAN_INFO_SCALE),
> .address = SCD4X_CO2,
> .scan_index = SCD4X_CO2,
> .scan_type = {
prev parent reply other threads:[~2021-10-21 19:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-21 14:00 Roan van Dijk
2021-10-21 19:53 ` 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=20211021205357.688947c5@jic23-huawei \
--to=jic23@kernel.org \
--cc=david@protonic.nl \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roan@protonic.nl \
/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
all inboxes | Powered by JetHome®