Linux-IIO Archive on lore.kernel.org
 help / color / 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, back to index

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

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 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/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org
	public-inbox-index linux-iio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git