linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Robertson <dan@dlrobertson.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Linus Walleij <linus.walleij@linaro.org>,
	Andy Shevchenko <andy.shevchenko@gmail.com>,
	linux-iio@vger.kernel.org, Dan Robertson <dan@dlrobertson.com>
Subject: [PATCH 0/1] iio: accel: bma400: add support for bma400 spi
Date: Fri, 22 May 2020 01:46:33 +0000	[thread overview]
Message-ID: <20200522014634.28505-1-dan@dlrobertson.com> (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.

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



             reply	other threads:[~2020-05-25 17:33 UTC|newest]

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] iio: accel: bma400: add support for bma400 spi 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:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

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

  git send-email \
    --in-reply-to=20200522014634.28505-1-dan@dlrobertson.com \
    --to=dan@dlrobertson.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).