Linux-IIO Archive on
 help / color / Atom feed
From: Dan Robertson <>
To: Jonathan Cameron <>
Cc: Hartmut Knaack <>,
	Lars-Peter Clausen <>,
	Peter Meerwald-Stadler <>,
	Linus Walleij <>,
	Andy Shevchenko <>,, Dan Robertson <>
Subject: [PATCH 0/1] iio: accel: bma400: add support for bma400 spi
Date: Fri, 22 May 2020 01:46:33 +0000
Message-ID: <> (raw)

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.


 - 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

             reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-22  1:46 Dan Robertson [this message]
2020-05-22  1:46 ` [PATCH 1/1] " Dan Robertson
2020-05-22  8:50   ` Andy Shevchenko
2020-05-22 12:36     ` Dan Robertson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-IIO Archive on

Archives are clonable:
	git clone --mirror linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ \
	public-inbox-index linux-iio

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone