linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] iio: accel: bma400: add support for bma400 spi
@ 2020-05-22  1:46 Dan Robertson
  2020-05-22  1:46 ` [PATCH 1/1] " Dan Robertson
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Robertson @ 2020-05-22  1:46 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Andy Shevchenko, linux-iio, Dan Robertson

The Bosch Sensortec BMA400 3-axes ultra-low power supports a 4 wire
SPI ditital interface. This patch adds support for the device when
configured for SPI instead of I2C.

I was originally hoping to avoid using a regmap_bus definition, but the
register reads from the device are padded by a byte while register
writes are not padded. As a result, a regmap_config like the following
does not work.

const struct regmap_config bma400_regmap_spi_config = {
    reg_bits = 8,
    pad_bits = 8,
    val_bits = 8,
    read_flag_mask = BIT(7),
    max_register = BMA400_CMD_REG,
};

I used a regmap_bus structure with read and write implementations to
work around this, but would appreciate feedback on this approach and
my implementation.

Cheers,

 - Dan

Dan Robertson (1):
  iio: accel: bma400: add support for bma400 spi

 drivers/iio/accel/Kconfig      |   8 ++-
 drivers/iio/accel/Makefile     |   1 +
 drivers/iio/accel/bma400_spi.c | 126 +++++++++++++++++++++++++++++++++
 3 files changed, 134 insertions(+), 1 deletion(-)
 create mode 100644 drivers/iio/accel/bma400_spi.c



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-05-25 17:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22  1:46 [PATCH 0/1] iio: accel: bma400: add support for bma400 spi Dan Robertson
2020-05-22  1:46 ` [PATCH 1/1] " Dan Robertson
2020-05-22  8:50   ` Andy Shevchenko
2020-05-22 12:36     ` Dan Robertson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).