Re: [PATCH v1 13/13] iio: chemical: bme680: Add support for preheat current

From: Jonathan Cameron
Date: Sat Oct 12 2024 - 08:36:45 EST


On Thu, 10 Oct 2024 23:00:30 +0200
vamoirid <vassilisamir@xxxxxxxxx> wrote:

> From: Vasileios Amoiridis <vassilisamir@xxxxxxxxx>
>
> Add functionality to inject a specified amount of current to the heating
> plate before the start of the gas measurement to allow the sensor to reach
> faster to the requested temperature.
>
> Signed-off-by: Vasileios Amoiridis <vassilisamir@xxxxxxxxx>
> ---
> drivers/iio/chemical/bme680.h | 1 +
> drivers/iio/chemical/bme680_core.c | 38 ++++++++++++++++++++++++++++++
> 2 files changed, 39 insertions(+)
>
> diff --git a/drivers/iio/chemical/bme680.h b/drivers/iio/chemical/bme680.h
> index e7eed2962baa..c658cb631b52 100644
> --- a/drivers/iio/chemical/bme680.h
> +++ b/drivers/iio/chemical/bme680.h
> @@ -42,6 +42,7 @@
> #define BME680_RHRANGE_MASK GENMASK(5, 4)
> #define BME680_REG_RES_HEAT_VAL 0x00
> #define BME680_RSERROR_MASK GENMASK(7, 4)
> +#define BME680_REG_IDAC_HEAT_0 0x50
> #define BME680_REG_RES_HEAT_0 0x5A
> #define BME680_REG_GAS_WAIT_0 0x64
> #define BME680_ADC_GAS_RES GENMASK(15, 6)
> diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
> index df6ae4355902..6cdf8b9dbf2b 100644
> --- a/drivers/iio/chemical/bme680_core.c
> +++ b/drivers/iio/chemical/bme680_core.c
> @@ -126,6 +126,7 @@ struct bme680_data {
> u8 oversampling_temp;
> u8 oversampling_press;
> u8 oversampling_humid;
> + u8 preheat_curr;
> u16 heater_dur;
> u16 heater_temp;
>
> @@ -223,6 +224,12 @@ static const struct iio_chan_spec bme680_channels[] = {
> },
> },
> IIO_CHAN_SOFT_TIMESTAMP(4),
> + {
> + .type = IIO_CURRENT,
> + .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),
> + .output = 1,
> + .scan_index = 5,

Set scan index to -1
you don't want to create the buffer related attrs for this one

> + },