linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@jic23.retrosnub.co.uk>
To: David Frey <dpfrey@gmail.com>
Cc: linux-iio <linux-iio@vger.kernel.org>
Subject: Re: bme680 gas sensor channel attributes
Date: Wed, 20 Feb 2019 12:07:49 +0000	[thread overview]
Message-ID: <20190220120749.04c69120@archlinux> (raw)
In-Reply-To: <c8ffa8de-ecc2-e9e4-0043-67fc54ca4740@gmail.com>

On Tue, 12 Feb 2019 08:53:46 -0800
David Frey <dpfrey@gmail.com> wrote:

> Hi,

Hi David,

Always fun to expand ABI :)
> 
> I would like to enhance the gas sensor support in the bme680 driver, but
> I'm not sure how to fit the enhancement into IIO.
> 
> The bme680 has the following registers:
> idac_heat_0 to 9 at 0x50..0x59 - initial current applied to heater
> res_heat_0 to 9 at 0x5A..0x63 - target temperature of heater
> gas_wait_0 to 9 at 0x64..0x6D - heater on duration
> 
> The ctrl_gas_1 register has an nb_conv<3:0> field which selects which of
> the settings (0 to 9) to use for the gas sensor.
> 
> Currently, the driver just hard codes some values into res_heat_0 and
> gas_wait_0.  idac_heat_0 is not written, but the datasheet says this is
> optional.  I think it would be good if the user could configure these
> parameters.  At a minimum it would be nice to expose one set of the
> three values, but if I'm going to expose one, it seems like I might as
> well expose all 10 and also allow the user to select which setting group
> is active.
> 
> The current version of the driver has this for the gas channel definition:
> {
> 	.type = IIO_RESISTANCE,
> 	.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED),
> },
> 
> Other channels of the device (such as temperature) support an
> oversampling ratio, and are defined like this:
> 
> {
> 	.type = IIO_TEMP,
> 	.info_mask_separate = BIT(IIO_CHAN_INFO_PROCESSED) |
> 			      BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO),
> },
> 
> I checked enum iio_chan_info_enum and there is no IIO_CHAN_INFO_
> definition which seems applicable to "initial current", "target
> temperature" or "heater duration".  How can I add these configuration
> parameters in an idiomatic way?
I'll be honest, these are pretty device specific, and unlikely to
be of interest to any in kernel users.  As such use the
extended attribute infrastructure to define some custom attributes
for them.  First step though is probably to document the ABI so
we can discuss how it first into the wider ABI (should still be
consistent as we can make it).

We have previously dealt with heaters via explicit output channels
(they are common in humidity sensors) but that probably only gives you
a base to work from given they still won't have the right attributes.

Jonathan

> 
> Thanks,
> David


      reply	other threads:[~2019-02-20 12:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-12 16:53 bme680 gas sensor channel attributes David Frey
2019-02-20 12:07 ` 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=20190220120749.04c69120@archlinux \
    --to=jic23@jic23.retrosnub.co.uk \
    --cc=dpfrey@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    /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).