Re: [PATCH v2 07/14] iio: accel: bma220: reset registers during init stage

Krzysztof Kozlowski
2025-09-11T07:35:57Z

On 10/09/2025 09:57, Petre Rodan wrote:
> Bring all configuration registers to default values during device probe().
>
> Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
> ---
> drivers/iio/accel/bma220_core.c | 71 ++++++++++++++++++++++++++++-------------
> 1 file changed, 49 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/iio/accel/bma220_core.c b/drivers/iio/accel/bma220_core.c
> index b6f1374a9cca52966c1055113710061a7284cf5a..322df516c90a7c645eeca579cae9803eb31caad1 100644
> --- a/drivers/iio/accel/bma220_core.c
> +++ b/drivers/iio/accel/bma220_core.c
> @@ -29,12 +29,15 @@
> #define BMA220_REG_ACCEL_Z 0x04
> #define BMA220_REG_RANGE 0x11
> #define BMA220_REG_SUSPEND 0x18
> +#define BMA220_REG_SOFTRESET 0x19
>
> #define BMA220_CHIP_ID 0xDD
> #define BMA220_READ_MASK BIT(7)
> #define BMA220_RANGE_MASK GENMASK(1, 0)
> #define BMA220_SUSPEND_SLEEP 0xFF
> #define BMA220_SUSPEND_WAKE 0x00
> +#define BMA220_RESET_MODE 0xFF
> +#define BMA220_NONRESET_MODE 0x00
>
> #define BMA220_DEVICE_NAME "bma220"
>
> @@ -203,31 +206,28 @@ static const struct iio_info bma220_info = {
> .read_avail = bma220_read_avail,
> };
>
> -static int bma220_init(struct spi_device *spi)
> +static int bma220_reset(struct spi_device *spi, bool up)
> {
> - int ret;
> - static const char * const regulator_names[] = { "vddd", "vddio", "vdda" };
> + int i, ret;
>
> - ret = devm_regulator_bulk_get_enable(&spi->dev,

You just added this code in patch 6. Don't add code which immediately
you remove. I understand you re-add this later, so basically it is a
move, but such patch diff is still confusing.

Best regards,
Krzysztof