Re: [PATCH v2 04/14] iio: accel: bma220: split original driver

David Lechner
2025-09-11T19:01:20Z

On 9/10/25 2:57 AM, Petre Rodan wrote:
> In preparation for the i2c module, move the original code into multiple
> source files without any other functional change.
>
> Create the additional bma220_core module.
> Fix checkpatch warning about GPL v2 license in bma220_spi.c.
>
> Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
> ---
> Changes:
> - split out open firmware table modification into separate patch
> - bma220_write_raw() exits without dev_err() based on similar feedback
> from David
> - change includes in bma220.h
> - include bma220.h in bma220_core.c
> - add mutex.h and pm.h includes to bma220_core.c
> - cleanup struct spacing in bma220_spi.c
> ---
> drivers/iio/accel/Kconfig | 9 +-
> drivers/iio/accel/Makefile | 3 +-
> drivers/iio/accel/bma220.h | 19 +++
> drivers/iio/accel/bma220_core.c | 313 ++++++++++++++++++++++++++++++++++++++++
> drivers/iio/accel/bma220_spi.c | 307 ++-------------------------------------
> 5 files changed, 354 insertions(+), 297 deletions(-)
>
> diff --git a/drivers/iio/accel/Kconfig b/drivers/iio/accel/Kconfig
> index 8c3f7cf55d5fa432a4d4662b184a46cd59c3ebca..2cc3075e26883df60b5068c73b0551e1dd02c32e 100644
> --- a/drivers/iio/accel/Kconfig
> +++ b/drivers/iio/accel/Kconfig
> @@ -218,15 +218,20 @@ config BMA180
>
> config BMA220
> tristate "Bosch BMA220 3-Axis Accelerometer Driver"
> - depends on SPI

I think we still want to keep `depends on SPI`. (And later add `|| I2C`)

There isn't much point in allowing this on systems that it can't
communicate with.

> select IIO_BUFFER
> select IIO_TRIGGERED_BUFFER
> + select BMA220_SPI if SPI
> help
> Say yes here to add support for the Bosch BMA220 triaxial
> acceleration sensor.
>
> To compile this driver as a module, choose M here: the
> - module will be called bma220_spi.
> + module will be called bma220_core and you will also get
> + bma220_spi if SPI is enabled.
> +
> +config BMA220_SPI
> + tristate
> + depends on BMA220
>
> config BMA400
> tristate "Bosch BMA400 3-Axis Accelerometer Driver"