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 > >