[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240824111614.GB9644@vamoiridPC>
Date: Sat, 24 Aug 2024 13:16:14 +0200
From: Vasileios Amoiridis <vassilisamir@...il.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc: Vasileios Amoiridis <vassilisamir@...il.com>, jic23@...nel.org,
lars@...afoo.de, robh@...nel.org, krzk+dt@...nel.org,
conor+dt@...nel.org, ang.iglesiasg@...il.com,
linus.walleij@...aro.org, biju.das.jz@...renesas.com,
javier.carrasco.cruz@...il.com, semen.protsenko@...aro.org,
579lpy@...il.com, ak@...klinger.de, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3 2/7] iio: pressure: bmp280: Add support for bmp280
soft reset
On Fri, Aug 23, 2024 at 10:13:57PM +0300, Andy Shevchenko wrote:
> On Fri, Aug 23, 2024 at 08:17:09PM +0200, Vasileios Amoiridis wrote:
> > The BM(P/E)28x devices have an option for soft reset which is also
> > recommended by the Bosch Sensortech BME2 Sensor API to be used before the
> > initial configuration of the device.
>
> ...
>
> > +static int bmp280_preinit(struct bmp280_data *data)
> > +{
> > + unsigned int reg;
> > + int ret;
> > +
> > + ret = regmap_write(data->regmap, BMP280_REG_RESET, BMP280_RST_SOFT_CMD);
> > + if (ret)
> > + return dev_err_probe(data->dev, ret,
> > + "Failed to reset device.\n");
>
> > + usleep_range(data->start_up_time, data->start_up_time + 500);
>
> Seems long enough to warrant the comment. Also, why not fsleep()?
Hi Andy,
The datasheet of the sensor, and the published API from Bosch [1]
require the startup_time for this procedure, it's not something that
came up from my mind. That's why I didn't add any comment.
I was not aware of fsleep(), I think that it could be fine to use it.
Cheers,
Vasilis
[1]: https://github.com/boschsensortec/BME280_SensorAPI/blob/master/bme280.c#L677
>
> > + ret = regmap_read(data->regmap, BMP280_REG_STATUS, ®);
> > + if (ret)
> > + return dev_err_probe(data->dev, ret,
> > + "Failed to read status register.\n");
> > +
> > + if (reg & BMP280_REG_STATUS_IM_UPDATE)
> > + return dev_err_probe(data->dev, ret,
> > + "Failed to copy NVM contents.\n");
> > +
> > + return 0;
> > +}
>
>
> --
> With Best Regards,
> Andy Shevchenko
>
>
Powered by blists - more mailing lists