From: Jonathan Bakker <xc-racer2@live.ca>
To: jic23@kernel.org, knaack.h@gmx.de, lars@metafoo.de,
pmeerw@pmeerw.net, robh+dt@kernel.org, linus.walleij@linaro.org,
kstewart@linuxfoundation.org, tglx@linutronix.de,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: Jonathan Bakker <xc-racer2@live.ca>
Subject: [PATCH v2 1/7] iio: accel: bma180: Prepare for different reset values
Date: Thu, 14 May 2020 13:48:55 -0700 [thread overview]
Message-ID: <BN6PR04MB06606D8A597C031FC8A1AAE2A3BC0@BN6PR04MB0660.namprd04.prod.outlook.com> (raw)
In-Reply-To: <20200514204901.3199-1-xc-racer2@live.ca>
Some variants of the bma180 (eg bma023) have different reset
values. In preparation for adding support for them, factor
out the reset value into the chip specific data.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Bakker <xc-racer2@live.ca>
---
Changes from v1
- Added R-b tag
---
drivers/iio/accel/bma180.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index fcd91d5f05fd..75440dd83ec4 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -57,7 +57,7 @@ struct bma180_part_info {
u8 power_reg, power_mask, lowpower_val;
u8 int_enable_reg, int_enable_mask;
u8 int_map_reg, int_enable_dataready_int1_mask;
- u8 softreset_reg;
+ u8 softreset_reg, softreset_val;
int (*chip_config)(struct bma180_data *data);
void (*chip_disable)(struct bma180_data *data);
@@ -319,7 +319,8 @@ static int bma180_set_pmode(struct bma180_data *data, bool mode)
static int bma180_soft_reset(struct bma180_data *data)
{
int ret = i2c_smbus_write_byte_data(data->client,
- data->part_info->softreset_reg, BMA180_RESET_VAL);
+ data->part_info->softreset_reg,
+ data->part_info->softreset_val);
if (ret)
dev_err(&data->client->dev, "failed to reset the chip\n");
@@ -693,6 +694,7 @@ static const struct bma180_part_info bma180_part_info[] = {
.int_enable_reg = BMA180_CTRL_REG3,
.int_enable_mask = BMA180_NEW_DATA_INT,
.softreset_reg = BMA180_RESET,
+ .softreset_val = BMA180_RESET_VAL,
.chip_config = bma180_chip_config,
.chip_disable = bma180_chip_disable,
},
@@ -721,6 +723,7 @@ static const struct bma180_part_info bma180_part_info[] = {
.int_map_reg = BMA250_INT_MAP_REG,
.int_enable_dataready_int1_mask = BMA250_INT1_DATA_MASK,
.softreset_reg = BMA250_RESET_REG,
+ .softreset_val = BMA180_RESET_VAL,
.chip_config = bma25x_chip_config,
.chip_disable = bma25x_chip_disable,
},
@@ -749,6 +752,7 @@ static const struct bma180_part_info bma180_part_info[] = {
.int_map_reg = BMA254_INT_MAP_REG,
.int_enable_dataready_int1_mask = BMA254_INT1_DATA_MASK,
.softreset_reg = BMA254_RESET_REG,
+ .softreset_val = BMA180_RESET_VAL,
.chip_config = bma25x_chip_config,
.chip_disable = bma25x_chip_disable,
},
--
2.20.1
next parent reply other threads:[~2020-05-14 20:49 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200514204901.3199-1-xc-racer2@live.ca>
2020-05-14 20:48 ` Jonathan Bakker [this message]
2020-05-14 20:48 ` [PATCH v2 2/7] iio: accel: Make bma180 conflict with input's bma150 Jonathan Bakker
2020-05-15 11:46 ` Linus Walleij
2020-05-14 20:48 ` [PATCH v2 3/7] dt-bindings: iio: accel: Add bma150 family compatibles to bma180 Jonathan Bakker
2020-05-14 20:48 ` [PATCH v2 4/7] dt-bindings: iio: accel: Add required regulators " Jonathan Bakker
2020-05-16 15:03 ` Jonathan Cameron
2020-05-14 20:48 ` [PATCH v2 5/7] iio: accel: bma180: Add support for bma023 Jonathan Bakker
2020-05-14 20:49 ` [PATCH v2 6/7] iio: accel: bma180: Rename center_temp to temp_offset Jonathan Bakker
2020-05-15 11:47 ` Linus Walleij
2020-05-14 20:49 ` [PATCH v2 7/7] iio: accel: Add bma150/smb380 support to bma180 Jonathan Bakker
2020-05-15 11:48 ` Linus Walleij
2020-05-15 11:49 ` Linus Walleij
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=BN6PR04MB06606D8A597C031FC8A1AAE2A3BC0@BN6PR04MB0660.namprd04.prod.outlook.com \
--to=xc-racer2@live.ca \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=knaack.h@gmx.de \
--cc=kstewart@linuxfoundation.org \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmeerw@pmeerw.net \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
/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).