Re: [PATCH v6 2/2] iio: (bma400) add driver for the BMA400
From: Linus Walleij
Date: Thu Dec 12 2019 - 05:27:29 EST
Hi Dan,
thanks for your patch!
Inspired by my recent work to revive the BMA180/BMA250 driver
for BMA254 I have some comments:
On Wed, Dec 11, 2019 at 2:20 AM Dan Robertson <dan@xxxxxxxxxxxxxxx> wrote:
> Add a IIO driver for the Bosch BMA400 3-axes ultra-low power accelerometer.
> The driver supports reading from the acceleration and temperature
> registers. The driver also supports reading and configuring the output data
> rate, oversampling ratio, and scale.
>
> Signed-off-by: Dan Robertson <dan@xxxxxxxxxxxxxxx>
(...)
> +#include <linux/bitops.h>
> +#include <linux/device.h>
> +#include <linux/iio/iio.h>
> +#include <linux/iio/sysfs.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/mutex.h>
> +#include <linux/regmap.h>
#include <linux/regulator/consumer.h>
> +int bma400_probe(struct device *dev, struct regmap *regmap, const char *name)
Even if the component is always powered on in your design
please add regulator handling already from start so that we
don't have to go in and add it later. I've added regulator support
to sooo many IIO drivers by now.
You can pretty much just copy/paste my code for BMA180/BMA250:
https://lore.kernel.org/linux-iio/20191211213819.14024-2-linus.walleij@xxxxxxxxxx/T/#u
Yours,
Linus Walleij