[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZtBlLqLgpi2h6kMl@smile.fi.intel.com>
Date: Thu, 29 Aug 2024 15:10:22 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Vasileios Amoiridis <vassilisamir@...il.com>
Cc: 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,
christophe.jaillet@...adoo.fr
Subject: Re: [PATCH v4 2/7] iio: pressure: bmp280: Add support for bmp280
soft reset
On Wed, Aug 28, 2024 at 10:51:22PM +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)
> +{
With
struct device *dev = data->dev;
it will look better?
> + 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");
return dev_err_probe(dev, ret, "Failed to reset device.\n");
> + /*
> + * According to the datasheet in Chapter 1: Specification, Table 2,
> + * after resetting, the device uses the complete power-on sequence so
> + * it needs to wait for the defined start-up time.
> + */
> + fsleep(data->start_up_time);
> +
> + ret = regmap_read(data->regmap, BMP280_REG_STATUS, ®);
> + if (ret)
> + return dev_err_probe(data->dev, ret,
> + "Failed to read status register.\n");
return dev_err_probe(dev, ret, "Failed to read status register.\n");
> + if (reg & BMP280_REG_STATUS_IM_UPDATE)
> + return dev_err_probe(data->dev, -EIO,
> + "Failed to copy NVM contents.\n");
return dev_err_probe(dev, -EIO, "Failed to copy NVM contents.\n");
> + return 0;
> +}
Yes, it's up to 84 characters long, but I think it improves readability.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists