All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Tomasz Duszynski <tomasz.duszynski@octakon.com>
Cc: Jonathan Cameron <jic23@kernel.org>, <linux-iio@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<robh+dt@kernel.org>, <andy.shevchenko@gmail.com>,
	<pmeerw@pmeerw.net>
Subject: Re: [PATCH v2 1/4] iio: chemical: scd30: add core driver
Date: Mon, 1 Jun 2020 14:35:02 +0100	[thread overview]
Message-ID: <20200601143502.00005030@Huawei.com> (raw)
In-Reply-To: <20200601121026.GB28560@arch>

...
> > > > +static const struct iio_chan_spec scd30_channels[] = {
> > > > +	{
> > > > +		.type = IIO_PRESSURE,
> > > > +		.info_mask_separate = BIT(IIO_CHAN_INFO_CALIBSCALE),
> > > > +		.info_mask_separate_available = BIT(IIO_CHAN_INFO_CALIBSCALE),
> > > > +		.scan_index = -1,
> > > > +	},
> > > > +	{
> > > > +		.type = IIO_CONCENTRATION,
> > > > +		.channel2 = IIO_MOD_CO2,
> > > > +		.address = SCD30_CONC,
> > > > +		.scan_index = SCD30_CONC,
> > > > +		.info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
> > > > +				      BIT(IIO_CHAN_INFO_SCALE),
> > > > +		.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ),
> > > > +		.modified = 1,
> > > > +
> > > > +		SCD30_CHAN_SCAN_TYPE('u', 16),
> > > > +	},
> > > > +	{
> > > > +		.type = IIO_TEMP,
> > > > +		.address = SCD30_TEMP,
> > > > +		.scan_index = SCD30_TEMP,
> > > > +		.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
> > > > +				      BIT(IIO_CHAN_INFO_CALIBBIAS) |
> > > > +				      BIT(IIO_CHAN_INFO_SCALE),  
> > >
> > > Combination of processed and scale is unusual.  Normally scale provides
> > > a conversion factor or a _RAW reading.  
> >
> > Right that's pointless. Scales were for raw measurements inside buffer.
> > Somehow I failed to realize that only co2 concentration is raw.
> >  
> 
> One more thing occurred to me here. I just looked at CONCENTRATION_RAW
> description and is states that this should return *percentage* reading.
> Then after scaling what we should be left with?

It should say after application of scale and offset.  Patches welcome :)

> 
> Or perhaps scale should return just 1.0 for completeness if we want to
> live with percentages.
> 
> Though in case where percentage reading is fractional then passing
> through buffers will not work. Or am I missing something?
> 
> On the other hand if abi said nothing about percentages one would just
> push whatever raw reading sensor outputs and provide scaling info to
> userspace.
> 

> > >  



  reply	other threads:[~2020-06-01 13:35 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-30 21:36 [PATCH v2 0/4] Add support for SCD30 sensor Tomasz Duszynski
2020-05-30 21:36 ` [PATCH v2 1/4] iio: chemical: scd30: add core driver Tomasz Duszynski
2020-05-31  9:58   ` Jonathan Cameron
2020-05-31 10:16     ` Jonathan Cameron
2020-05-31 19:21     ` Tomasz Duszynski
2020-06-01 10:36       ` Jonathan Cameron
2020-06-01 11:30         ` Tomasz Duszynski
2020-06-01 13:41           ` Jonathan Cameron
2020-06-02  7:13             ` Tomasz Duszynski
2020-06-01 12:10       ` Tomasz Duszynski
2020-06-01 13:35         ` Jonathan Cameron [this message]
2020-05-30 21:36 ` [PATCH v2 2/4] iio: chemical: scd30: add I2C interface driver Tomasz Duszynski
2020-05-31 10:02   ` Jonathan Cameron
2020-05-30 21:36 ` [PATCH v2 3/4] iio: chemical: scd30: add serial " Tomasz Duszynski
2020-05-31 10:15   ` Jonathan Cameron
2020-05-31 15:50     ` Tomasz Duszynski
2020-05-30 21:36 ` [PATCH v2 4/4] dt-bindings: iio: scd30: add device binding file Tomasz Duszynski
2020-05-31 10:19   ` Jonathan Cameron
2020-05-31 15:44     ` Tomasz Duszynski

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=20200601143502.00005030@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    --cc=tomasz.duszynski@octakon.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 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.