From: Jonathan Cameron <jic23@kernel.org>
To: Vasileios Amoiridis <vassilisamir@gmail.com>
Cc: dpfrey@gmail.com, himanshujha199640@gmail.com, lars@metafoo.de,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
mike.looijmans@topic.nl
Subject: Re: [PATCH v2 15/19] iio: chemical: bme680: Modify startup procedure
Date: Sun, 9 Jun 2024 12:07:56 +0100 [thread overview]
Message-ID: <20240609120756.14c1eda1@jic23-huawei> (raw)
In-Reply-To: <20240606212313.207550-18-vassilisamir@gmail.com>
On Thu, 6 Jun 2024 23:23:09 +0200
Vasileios Amoiridis <vassilisamir@gmail.com> wrote:
> Modify the startup procedure to reflect the procedure of
> the Bosch BME68x Sensor API. The initial readings and
> configuration of the sensor need to happen in the
> following order:
>
> 1) Read calibration data [1,2]
> 2) Chip general configuration [3]
> 3) Gas configuration [4]
>
> After the chip configuration it is necessary to ensure that
> the sensor is in sleeping mode, in order to apply the gas
> configuration settings [5].
>
Trivial but oddly short line wrapping. Target 75ish chars for commit messages
> Also, after the soft reset, it is advised to wait for 5ms [6].
>
> [1]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L162
> [2]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/examples/forced_mode/forced_mode.c#L44
> [3]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/examples/forced_mode/forced_mode.c#L53
> [4]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/examples/forced_mode/forced_mode.c#L60
> [5]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L640
> [6]: https://github.com/boschsensortec/BME68x_SensorAPI/blob/v4.4.8/bme68x.c#L294
Either make these Link tags or add a blank line here.
I'd prefer link tags with # [1] etc after them for the cross references.
> Signed-off-by: Vasileios Amoiridis <vassilisamir@gmail.com>
> ---
> drivers/iio/chemical/bme680.h | 2 ++
> drivers/iio/chemical/bme680_core.c | 21 ++++++++++++++-------
> 2 files changed, 16 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/chemical/bme680.h b/drivers/iio/chemical/bme680.h
> index 7d0ff294725a..b2c547ac8d34 100644
> --- a/drivers/iio/chemical/bme680.h
> +++ b/drivers/iio/chemical/bme680.h
> @@ -63,6 +63,8 @@
>
> #define BME680_MEAS_TRIM_MASK GENMASK(24, 4)
>
> +#define BME680_STARTUP_TIME_US 5000
> +
> /* Calibration Parameters */
> #define BME680_T2_LSB_REG 0x8A
> #define BME680_H2_MSB_REG 0xE1
> diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
> index 25d128e1ddcf..e354eaa34d59 100644
> --- a/drivers/iio/chemical/bme680_core.c
> +++ b/drivers/iio/chemical/bme680_core.c
> @@ -531,6 +531,11 @@ static int bme680_gas_config(struct bme680_data *data)
> int ret;
> u8 heatr_res, heatr_dur;
>
> + /* Go to sleep */
> + ret = bme680_set_mode(data, false);
> + if (ret < 0)
> + return ret;
> +
> heatr_res = bme680_calc_heater_res(data, data->heater_temp);
>
> /* set target heater temperature */
> @@ -866,6 +871,8 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap,
> return ret;
> }
>
> + usleep_range(BME680_STARTUP_TIME_US, BME680_STARTUP_TIME_US + 1000);
> +
> ret = regmap_read(regmap, BME680_REG_CHIP_ID, &data->check);
> if (ret < 0) {
> dev_err(dev, "Error reading chip ID\n");
> @@ -878,22 +885,22 @@ int bme680_core_probe(struct device *dev, struct regmap *regmap,
> return -ENODEV;
> }
>
> - ret = bme680_chip_config(data);
> + ret = bme680_read_calib(data, &data->bme680);
> if (ret < 0) {
> - dev_err(dev, "failed to set chip_config data\n");
> + dev_err(dev,
> + "failed to read calibration coefficients at probe\n");
> return ret;
> }
>
> - ret = bme680_gas_config(data);
> + ret = bme680_chip_config(data);
> if (ret < 0) {
> - dev_err(dev, "failed to set gas config data\n");
> + dev_err(dev, "failed to set chip_config data\n");
> return ret;
> }
>
> - ret = bme680_read_calib(data, &data->bme680);
> + ret = bme680_gas_config(data);
> if (ret < 0) {
> - dev_err(dev,
> - "failed to read calibration coefficients at probe\n");
> + dev_err(dev, "failed to set gas config data\n");
> return ret;
> }
>
next prev parent reply other threads:[~2024-06-09 11:08 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 21:22 [PATCH v2 00/19] iio: chemical: bme680: Driver fixes and cleanup Vasileios Amoiridis
2024-06-06 21:22 ` [PATCH v2 01/19] iio: chemical: bme680: Fix pressure value output Vasileios Amoiridis
2024-06-09 11:00 ` Jonathan Cameron
2024-06-06 21:22 ` [PATCH v2 02/19] iio: chemical: bme680: Fix calibration data variable Vasileios Amoiridis
2024-06-09 11:00 ` Jonathan Cameron
2024-06-06 21:22 ` [PATCH v2 03/19] iio: chemical: bme680: Fix overflows in compensate() functions Vasileios Amoiridis
2024-06-09 11:01 ` Jonathan Cameron
2024-06-06 21:22 ` [PATCH v2 04/19] iio: chemical: bme680: Fix sensor data read operation Vasileios Amoiridis
2024-06-09 11:03 ` Jonathan Cameron
2024-06-06 21:22 ` [PATCH v2 05/19] iio: chemical: bme680: Fix typo in define Vasileios Amoiridis
2024-06-06 21:22 ` [PATCH v2 06/19] iio: chemical: bme680: Fix read/write ops to device by adding mutexes Vasileios Amoiridis
2024-06-09 10:56 ` Jonathan Cameron
2024-06-06 21:22 ` [PATCH v2 07/19] iio: chemical: bme680: Drop unnecessary casts and correct adc data types Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 08/19] iio: chemical: bme680: Remove remaining ACPI-only stuff Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 09/19] iio: chemical: bme680: Sort headers alphabetically Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 10/19] iio: chemical: bme680: Remove duplicate register read Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 11/19] iio: chemical: bme680: Use bulk reads for calibration data Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 12/19] iio: chemical: bme680: Allocate IIO device before chip initialization Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 13/19] iio: chemical: bme680: Add read buffers in DMA safe region Vasileios Amoiridis
2024-06-07 16:11 ` Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 13/19] iio: chemical: bme680: Add read buffers in read/write buffer union Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 13/19] iio: chemical: bme680: Add read buffers in union Vasileios Amoiridis
2024-06-07 16:12 ` Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 14/19] iio: chemical: bme680: Make error checks consistent Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 15/19] iio: chemical: bme680: Modify startup procedure Vasileios Amoiridis
2024-06-09 11:07 ` Jonathan Cameron [this message]
2024-06-06 21:23 ` [PATCH v2 16/19] iio: chemical: bme680: Move probe errors to dev_err_probe() Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 17/19] iio: chemical: bme680: Remove redundant gas configuration Vasileios Amoiridis
2024-06-09 11:08 ` Jonathan Cameron
2024-06-06 21:23 ` [PATCH v2 18/19] iio: chemical: bme680: Move forced mode setup in ->read_raw() Vasileios Amoiridis
2024-06-06 21:23 ` [PATCH v2 19/19] iio: chemical: bme680: Refactorize reading functions Vasileios Amoiridis
2024-06-09 11:12 ` Jonathan Cameron
2024-06-09 23:02 ` Vasileios Amoiridis
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=20240609120756.14c1eda1@jic23-huawei \
--to=jic23@kernel.org \
--cc=dpfrey@gmail.com \
--cc=himanshujha199640@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mike.looijmans@topic.nl \
--cc=vassilisamir@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox