Re: [PATCH v3 2/7] iio: pressure: bmp280: Add support for bmp280 soft reset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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()?

> +	ret = regmap_read(data->regmap, BMP280_REG_STATUS, &reg);
> +	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






[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux