[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250907134659.19ad1cc7@jic23-huawei>
Date: Sun, 7 Sep 2025 13:46:59 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Petre Rodan <petre.rodan@...dimension.ro>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org, David Lechner
<dlechner@...libre.com>, Nuno Sá <nuno.sa@...log.com>, Andy
Shevchenko <andy@...nel.org>
Subject: Re: [PATCH 04/10] iio: accel: BMA220 add i2c module
On Mon, 1 Sep 2025 22:47:30 +0300
Petre Rodan <petre.rodan@...dimension.ro> wrote:
> Add i2c module.
> Note that the kernel module transparently shifts all register addresses
> 1 bit to the left, so all functions will operate based on the SPI memory
> map.
>
> Signed-off-by: Petre Rodan <petre.rodan@...dimension.ro>
Trivial comments inline
> diff --git a/drivers/iio/accel/bma220_i2c.c b/drivers/iio/accel/bma220_i2c.c
> new file mode 100644
> index 000000000000..8a1644aac287
> --- /dev/null
> +++ b/drivers/iio/accel/bma220_i2c.c
> @@ -0,0 +1,62 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Bosch triaxial acceleration sensor
> + *
> + * Copyright (c) 2025 Petre Rodan <petre.rodan@...dimension.ro>
> + *
> + * Datasheet: https://media.digikey.com/pdf/Data%20Sheets/Bosch/BMA220.pdf
> + * I2C address is either 0x0b or 0x0a depending on CSB (pin 10)
> + */
> +
> +#include <linux/device.h>
> +#include <linux/errno.h>
> +#include <linux/i2c.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/module.h>
> +#include <linux/regmap.h>
> +#include <linux/types.h>
> +
> +#include <linux/iio/iio.h>
> +
> +#include "bma220.h"
> +
> +static int bma220_i2c_probe(struct i2c_client *client)
> +{
> + struct regmap *regmap;
> +
> + regmap = devm_regmap_init_i2c(client, &bma220_i2c_regmap_config);
> + if (IS_ERR(regmap)) {
> + dev_err(&client->dev, "failed to create regmap\n");
> + return PTR_ERR(regmap);
return dev_err_probe()
> + }
> +
> + return bma220_common_probe(&client->dev, regmap, client->irq);
> +}
>
Powered by blists - more mailing lists