Skip to contentSkip to conversation

iio: accel: bmc150: Add support for BMA253/BMA254

PATCH Superseded Stephan Gerhold 3 participants 13 messages Jun 10, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover iio: accel: bmc150: Add support for BMA253/BMA254

The Bosch BMA253 accelerometer is very similar to both BMA254 and BMA255. The current situation is very confusing: BMA254 is supported by the bma180 driver, but BMA255 is supported by the bmc150-accel driver.

It turns out the bma180 and bmc150-accel drivers have quite some overlap, and BMA253/BMA254 would be a bit better supported in bmc150 (which has support for the motion trigger/interrupt).

This series adds BMA253 support to bmc150-accel and also moves BMA254 over to bmc150, removing some unnecessary code from the bma180 driver.

I asked Linus Walleij to test these patches on BMA254 a while ago and he suggested that I already add his Reviewed-by.

Stephan Gerhold (6):
iio: accel: bmc150: Drop misleading/duplicate chip identifiers
dt-bindings: iio: accel: bma255: Document bosch,bma253
iio: accel: bmc150: Add device IDs for BMA253
dt-bindings: iio: bma255: Allow multiple interrupts
dt-bindings: iio: accel: bma180/bma255: Move bma254 to bma255 schema
iio: accel: bma180/bmc150: Move BMA254 to bmc150-accel driver

 .../bindings/iio/accel/bosch,bma180.yaml      |  3 +-
 .../bindings/iio/accel/bosch,bma255.yaml      |  9 +-
 drivers/iio/accel/Kconfig                     |  6 +-
 drivers/iio/accel/bma180.c                    | 91 +++----------------
 drivers/iio/accel/bmc150-accel-core.c         | 36 ++------
 drivers/iio/accel/bmc150-accel-i2c.c          | 34 ++++---
 drivers/iio/accel/bmc150-accel-spi.c          | 31 ++++---
 drivers/iio/accel/bmc150-accel.h              | 10 --
 8 files changed, 67 insertions(+), 153 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/6 iio: accel: bmc150: Drop misleading/duplicate chip identifiers

Commit 0ad4bf370176 ("iio:accel:bmc150-accel: Use the chip ID to detect sensor variant") stopped using the I2C/ACPI match data to look up the bmc150_accel_chip_info. However, the bmc150_accel_chip_info_tbl remained as-is, with multiple entries with the same chip_id (e.g. 0xFA for BMC150/BMI055/BMA255). This is redundant now because actually the driver will always select the first entry with a matching chip_id.

So even if a device probes e.g. with BMA0255 it will end up using the chip_info for BMC150. And in general that's fine for now, the entries for BMC150/BMI055/BMA255 were exactly the same anyway (except for the name, which is replaced with the more accurate one later).

But in this case it's misleading because it suggests that one should add even more entries with the same chip_id when adding support for new variants. Let's make that more clear by removing the enum with the chip identifiers entirely and instead have only one entry per chip_id.

Note that we may need to bring back some mechanism to differentiate between different chips with the same chip_id in the future. For example, BMA250 (currently supported by the bma180 driver) has the same chip_id = 0x03 as BMA222 even though they have different channel sizes (8 bits vs 10 bits). But in any case, that mechanism would need to look quite different from what we have right now.

---
 drivers/iio/accel/bmc150-accel-core.c | 34 ++++++---------------------
 drivers/iio/accel/bmc150-accel-i2c.c  | 30 +++++++++++------------
 drivers/iio/accel/bmc150-accel-spi.c  | 30 +++++++++++------------
 drivers/iio/accel/bmc150-accel.h      | 10 --------
 4 files changed, 37 insertions(+), 67 deletions(-)
drivers/iio/accel/bmc150-accel-core.c +7 -27
index a3d08d713362..d4349f749485 100644
@@ -1097,28 +1097,8 @@ static const struct iio_chan_spec bma280_accel_channels[] =
 	BMC150_ACCEL_CHANNELS(14);
 
 static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = {
-	[bmc150] = {
-		.name = "BMC150A",
-		.chip_id = 0xFA,
-		.channels = bmc150_accel_channels,
-		.num_channels = ARRAY_SIZE(bmc150_accel_channels),
-		.scale_table = { {9610, BMC150_ACCEL_DEF_RANGE_2G},
-				 {19122, BMC150_ACCEL_DEF_RANGE_4G},
-				 {38344, BMC150_ACCEL_DEF_RANGE_8G},
-				 {76590, BMC150_ACCEL_DEF_RANGE_16G} },
-	},
-	[bmi055] = {
-		.name = "BMI055A",
-		.chip_id = 0xFA,
-		.channels = bmc150_accel_channels,
-		.num_channels = ARRAY_SIZE(bmc150_accel_channels),
-		.scale_table = { {9610, BMC150_ACCEL_DEF_RANGE_2G},
-				 {19122, BMC150_ACCEL_DEF_RANGE_4G},
-				 {38344, BMC150_ACCEL_DEF_RANGE_8G},
-				 {76590, BMC150_ACCEL_DEF_RANGE_16G} },
-	},
-	[bma255] = {
-		.name = "BMA0255",
+	{
+		.name = "BMC150/BMI055/BMA255",
 		.chip_id = 0xFA,
 		.channels = bmc150_accel_channels,
 		.num_channels = ARRAY_SIZE(bmc150_accel_channels),
@@ -1127,7 +1107,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = {
 				 {38344, BMC150_ACCEL_DEF_RANGE_8G},
 				 {76590, BMC150_ACCEL_DEF_RANGE_16G} },
 	},
-	[bma250e] = {
+	{
 		.name = "BMA250E",
 		.chip_id = 0xF9,
 		.channels = bma250e_accel_channels,
@@ -1137,7 +1117,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = {
 				 {153277, BMC150_ACCEL_DEF_RANGE_8G},
 				 {306457, BMC150_ACCEL_DEF_RANGE_16G} },
 	},
-	[bma222] = {
+	{
 		.name = "BMA222",
 		.chip_id = 0x03,
 		.channels = bma222e_accel_channels,
@@ -1151,7 +1131,7 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = {
 				 {625000, BMC150_ACCEL_DEF_RANGE_8G},
 				 {1250000, BMC150_ACCEL_DEF_RANGE_16G} },
 	},
-	[bma222e] = {
+	{
 		.name = "BMA222E",
 		.chip_id = 0xF8,
 		.channels = bma222e_accel_channels,
@@ -1161,8 +1141,8 @@ static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = {
 				 {612915, BMC150_ACCEL_DEF_RANGE_8G},
 				 {1225831, BMC150_ACCEL_DEF_RANGE_16G} },
 	},
-	[bma280] = {
-		.name = "BMA0280",
+	{
+		.name = "BMA280",
 		.chip_id = 0xFB,
 		.channels = bma280_accel_channels,
 		.num_channels = ARRAY_SIZE(bma280_accel_channels),
drivers/iio/accel/bmc150-accel-i2c.c +15 -15
index d34dddb850d9..b8bda0dfb495 100644
@@ -221,14 +221,14 @@ static int bmc150_accel_remove(struct i2c_client *client)
 }
 
 static const struct acpi_device_id bmc150_accel_acpi_match[] = {
-	{"BSBA0150",	bmc150},
-	{"BMC150A",	bmc150},
-	{"BMI055A",	bmi055},
-	{"BMA0255",	bma255},
-	{"BMA250E",	bma250e},
-	{"BMA222",	bma222},
-	{"BMA222E",	bma222e},
-	{"BMA0280",	bma280},
+	{"BSBA0150"},
+	{"BMC150A"},
+	{"BMI055A"},
+	{"BMA0255"},
+	{"BMA250E"},
+	{"BMA222"},
+	{"BMA222E"},
+	{"BMA0280"},
 	{"BOSC0200"},
 	{"DUAL250E"},
 	{ },
@@ -236,13 +236,13 @@ static const struct acpi_device_id bmc150_accel_acpi_match[] = {
 MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match);
 
 static const struct i2c_device_id bmc150_accel_id[] = {
-	{"bmc150_accel",	bmc150},
-	{"bmi055_accel",	bmi055},
-	{"bma255",		bma255},
-	{"bma250e",		bma250e},
-	{"bma222",		bma222},
-	{"bma222e",		bma222e},
-	{"bma280",		bma280},
+	{"bmc150_accel"},
+	{"bmi055_accel"},
+	{"bma255"},
+	{"bma250e"},
+	{"bma222"},
+	{"bma222e"},
+	{"bma280"},
 	{}
 };
 
drivers/iio/accel/bmc150-accel-spi.c +15 -15
index 74a8aee4f612..01b42fa6a015 100644
@@ -34,26 +34,26 @@ static int bmc150_accel_remove(struct spi_device *spi)
 }
 
 static const struct acpi_device_id bmc150_accel_acpi_match[] = {
-	{"BSBA0150",	bmc150},
-	{"BMC150A",	bmc150},
-	{"BMI055A",	bmi055},
-	{"BMA0255",	bma255},
-	{"BMA250E",	bma250e},
-	{"BMA222",	bma222},
-	{"BMA222E",	bma222e},
-	{"BMA0280",	bma280},
+	{"BSBA0150"},
+	{"BMC150A"},
+	{"BMI055A"},
+	{"BMA0255"},
+	{"BMA250E"},
+	{"BMA222"},
+	{"BMA222E"},
+	{"BMA0280"},
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match);
 
 static const struct spi_device_id bmc150_accel_id[] = {
-	{"bmc150_accel",	bmc150},
-	{"bmi055_accel",	bmi055},
-	{"bma255",		bma255},
-	{"bma250e",		bma250e},
-	{"bma222",		bma222},
-	{"bma222e",		bma222e},
-	{"bma280",		bma280},
+	{"bmc150_accel"},
+	{"bmi055_accel"},
+	{"bma255"},
+	{"bma250e"},
+	{"bma222"},
+	{"bma222e"},
+	{"bma280"},
 	{}
 };
 MODULE_DEVICE_TABLE(spi, bmc150_accel_id);
drivers/iio/accel/bmc150-accel.h +0 -10
index d67d6ed6ae77..47121f070fe9 100644
@@ -68,16 +68,6 @@ struct bmc150_accel_data {
 	struct iio_mount_matrix orientation;
 };
 
-enum {
-	bmc150,
-	bmi055,
-	bma255,
-	bma250e,
-	bma222,
-	bma222e,
-	bma280,
-};
-
 int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
 			    const char *name, bool block_supported);
 int bmc150_accel_core_remove(struct device *dev);
Signature · 1 line
2.31.1
#2 lore raw

Re: [PATCH 1/6] iio: accel: bmc150: Drop misleading/duplicate chip identifiers

Quoted 25 lines · Stephan Gerhold

Commit 0ad4bf370176 ("iio:accel:bmc150-accel: Use the chip ID to detect sensor variant") stopped using the I2C/ACPI match data to look up the bmc150_accel_chip_info. However, the bmc150_accel_chip_info_tbl remained as-is, with multiple entries with the same chip_id (e.g. 0xFA for BMC150/BMI055/BMA255). This is redundant now because actually the driver will always select the first entry with a matching chip_id.

So even if a device probes e.g. with BMA0255 it will end up using the chip_info for BMC150. And in general that's fine for now, the entries for BMC150/BMI055/BMA255 were exactly the same anyway (except for the name, which is replaced with the more accurate one later).

But in this case it's misleading because it suggests that one should add even more entries with the same chip_id when adding support for new variants. Let's make that more clear by removing the enum with the chip identifiers entirely and instead have only one entry per chip_id.

Note that we may need to bring back some mechanism to differentiate between different chips with the same chip_id in the future. For example, BMA250 (currently supported by the bma180 driver) has the same chip_id = 0x03 as BMA222 even though they have different channel sizes (8 bits vs 10 bits). But in any case, that mechanism would need to look quite different from what we have right now.

...

Quoted 1 line

static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = {

Perhaps sort this by chip_id value?

...

Quoted 9 lines

static const struct acpi_device_id bmc150_accel_acpi_match[] = {

drivers/iio/accel/bmc150-accel-i2c.c +0 -8
-       {"BSBA0150",    bmc150},
-       {"BMC150A",     bmc150},
-       {"BMI055A",     bmi055},
-       {"BMA0255",     bma255},
-       {"BMA250E",     bma250e},
-       {"BMA222",      bma222},
-       {"BMA222E",     bma222e},
-       {"BMA0280",     bma280},

drivers/iio/accel/bmc150-accel-i2c.c static int bmc150_accel_remove(struct i2c_client *client) · line 233

Quoted 10 lines
drivers/iio/accel/bmc150-accel-i2c.c +8 -0
+       {"BSBA0150"},
+       {"BMC150A"},
+       {"BMI055A"},
+       {"BMA0255"},
+       {"BMA250E"},
+       {"BMA222"},
+       {"BMA222E"},
+       {"BMA0280"},
        {"BOSC0200"},
        {"DUAL250E"},

I have noticed during review patch 3 that the arrays are unsorted, can we at the same time sort them by ID, please?

...

Quoted 1 line

static const struct i2c_device_id bmc150_accel_id[] = {

Ditto.

Quoted 2 lines
        {}

};

...

Quoted 1 line

static const struct acpi_device_id bmc150_accel_acpi_match[] = {

Ditto.

Quoted 2 lines
        { },

};

...

Quoted 1 line

static const struct spi_device_id bmc150_accel_id[] = {

Ditto.

Quoted 2 lines
        {}

};

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#3 lore raw

PATCH 2/6 dt-bindings: iio: accel: bma255: Document bosch,bma253

In reply to Stephan Gerhold

BMA253 is mostly like BMA255 that is already supported by the bmc150-accel driver. Document an extra bosch,bma253 compatible for it.

---
 Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml | 1 +
 1 file changed, 1 insertion(+)
Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml +1 -0
index c2efbb813ca2..8afb0fe8ef5c 100644
@@ -18,6 +18,7 @@ properties:
     enum:
       - bosch,bmc150_accel
       - bosch,bmi055_accel
+      - bosch,bma253
       - bosch,bma255
       - bosch,bma250e
       - bosch,bma222
Signature · 1 line
2.31.1
#4 lore raw

PATCH 3/6 iio: accel: bmc150: Add device IDs for BMA253

In reply to Stephan Gerhold

BMA253 is mostly like BMA255 and has exactly the same register layout as used by the bmc150-accel driver as far I can tell. Making it work is as simple as adding new device IDs for it since it has the same chip_id = 0xFA (250) as BMA255 and others.

---
 drivers/iio/accel/Kconfig             | 2 +-
 drivers/iio/accel/bmc150-accel-core.c | 4 ++--
 drivers/iio/accel/bmc150-accel-i2c.c  | 2 ++
 drivers/iio/accel/bmc150-accel-spi.c  | 1 +
 4 files changed, 6 insertions(+), 3 deletions(-)
drivers/iio/accel/Kconfig +1 -1
index 17f6bdcf1db3..f68c14f02d6b 100644
@@ -143,7 +143,7 @@ config BMC150_ACCEL
 	select BMC150_ACCEL_SPI if SPI
 	help
 	  Say yes here to build support for the following Bosch accelerometers:
-	  BMC150, BMI055, BMA250E, BMA222E, BMA255, BMA280.
+	  BMC150, BMI055, BMA250E, BMA222E, BMA253, BMA255, BMA280.
 
 	  This is a combo module with both accelerometer and magnetometer.
 	  This driver is only implementing accelerometer part, which has
drivers/iio/accel/bmc150-accel-core.c +2 -2
index d4349f749485..21abc8d166e6 100644
@@ -3,7 +3,7 @@
  * 3-axis accelerometer driver supporting following Bosch-Sensortec chips:
  *  - BMC150
  *  - BMI055
- *  - BMA255
+ *  - BMA253/BMA255
  *  - BMA250E
  *  - BMA222
  *  - BMA222E
@@ -1098,7 +1098,7 @@ static const struct iio_chan_spec bma280_accel_channels[] =
 
 static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = {
 	{
-		.name = "BMC150/BMI055/BMA255",
+		.name = "BMC150/BMI055/BMA253/BMA255",
 		.chip_id = 0xFA,
 		.channels = bmc150_accel_channels,
 		.num_channels = ARRAY_SIZE(bmc150_accel_channels),
drivers/iio/accel/bmc150-accel-i2c.c +2 -0
index b8bda0dfb495..a87306f03a4c 100644
@@ -238,6 +238,7 @@ MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match);
 static const struct i2c_device_id bmc150_accel_id[] = {
 	{"bmc150_accel"},
 	{"bmi055_accel"},
+	{"bma253"},
 	{"bma255"},
 	{"bma250e"},
 	{"bma222"},
@@ -251,6 +252,7 @@ MODULE_DEVICE_TABLE(i2c, bmc150_accel_id);
 static const struct of_device_id bmc150_accel_of_match[] = {
 	{ .compatible = "bosch,bmc150_accel" },
 	{ .compatible = "bosch,bmi055_accel" },
+	{ .compatible = "bosch,bma253" },
 	{ .compatible = "bosch,bma255" },
 	{ .compatible = "bosch,bma250e" },
 	{ .compatible = "bosch,bma222" },
drivers/iio/accel/bmc150-accel-spi.c +1 -0
index 01b42fa6a015..dec7dd252658 100644
@@ -49,6 +49,7 @@ MODULE_DEVICE_TABLE(acpi, bmc150_accel_acpi_match);
 static const struct spi_device_id bmc150_accel_id[] = {
 	{"bmc150_accel"},
 	{"bmi055_accel"},
+	{"bma253"},
 	{"bma255"},
 	{"bma250e"},
 	{"bma222"},
Signature · 1 line
2.31.1
#5 lore raw

PATCH 4/6 dt-bindings: iio: bma255: Allow multiple interrupts

In reply to Stephan Gerhold

BMA253 has two interrupt pins (INT1 and INT2) that can be configured independently. At the moment the bmc150-accel driver does not make use of them but it might be able to in the future, so it's useful to already specify all available interrupts in the device tree.

Set maxItems: 2 for interrupts to allow specifying a second one. This is necessary as preparation to move the bosch,bma254 compatible from bosch,bma180.yaml to bosch,bma255.yaml since bma180 allows two interrupts, but BMA254 is better supported by the bmc150-accel driver.

---
 .../devicetree/bindings/iio/accel/bosch,bma255.yaml        | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml +6 -1
index 8afb0fe8ef5c..65b299a5619b 100644
@@ -32,7 +32,12 @@ properties:
   vddio-supply: true
 
   interrupts:
-    maxItems: 1
+    minItems: 1
+    maxItems: 2
+    description: |
+      The first interrupt listed must be the one connected to the INT1 pin,
+      the second (optional) interrupt listed must be the one connected to the
+      INT2 pin (if available).
 
   mount-matrix:
     description: an optional 3x3 mounting rotation matrix.
Signature · 1 line
2.31.1
#6 lore raw

PATCH 5/6 dt-bindings: iio: accel: bma180/bma255: Move bma254 to bma255 schema

In reply to Stephan Gerhold

BMA254 is very similar to BMA253/BMA255 which are both supported by the bmc150-accel driver. In general, there is quite some overlap between the bma180 and bmc150-accel driver, but the bmc150-accel driver has a few more features (e.g. motion trigger/interrupt).

Let's move bma254 over to the bma255 schema (bmc150-accel driver).

---
 Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml | 3 +--
 Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml | 1 +
 2 files changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml +1 -2
index 45b3abde298f..a7e84089cc3d 100644
@@ -4,7 +4,7 @@
 $id: http://devicetree.org/schemas/iio/accel/bosch,bma180.yaml#
 $schema: http://devicetree.org/meta-schemas/core.yaml#
 
-title: Bosch BMA023 / BMA150/ BMA180 / BMA25x / SMB380 triaxial accelerometers
+title: Bosch BMA023 / BMA150/ BMA180 / BMA250 / SMB380 triaxial accelerometers
 
 maintainers:
   - Jonathan Cameron <[email protected]>
@@ -21,7 +21,6 @@ properties:
       - bosch,bma150
       - bosch,bma180
       - bosch,bma250
-      - bosch,bma254
       - bosch,smb380
 
   reg:
Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml +1 -0
index 65b299a5619b..e830d5295b92 100644
@@ -19,6 +19,7 @@ properties:
       - bosch,bmc150_accel
       - bosch,bmi055_accel
       - bosch,bma253
+      - bosch,bma254
       - bosch,bma255
       - bosch,bma250e
       - bosch,bma222
Signature · 1 line
2.31.1
#7 lore raw

PATCH 6/6 iio: accel: bma180/bmc150: Move BMA254 to bmc150-accel driver

In reply to Stephan Gerhold

Commit c1d1c4a62db5 ("iio: accel: bma180: BMA254 support") added BMA254 support to the bma180 driver and changed some naming to BMA25x to make it easier to add support for BMA253 and BMA255.

Unfortunately, there is quite some overlap between the bma180 driver and the bmc150-accel driver. Back when the commit was made, the bmc150-accel driver actually already had support for BMA255, and adding support for BMA254 would have been as simple as adding a new compatible to bmc150-accel.

The bmc150-accel driver is a bit better for BMA254 since it also supports the motion trigger/interrupt functionality. Fortunately, moving BMA254 support over to bmc150-accel is fairly simple because the drivers have compatible device tree bindings.

Revert most of the changes for BMA254 support in bma180 and move BMA254 over to bmc150-accel. This has the following advantages:

- Support for motion trigger/interrupt
- Fix incorrect scale values (BMA254 currently uses the same as BMA250 but actually they're different because of 10 vs 12 bits data size)
- Less code than before :)

BMA250 could be potentially also moved but it's more complicated because its chip_id conflicts with the one for BMA222 in bmc150-accel. Perhaps there are also other register differences, I did not investigate further yet (and I have no way to test it).

---
Note that the similarity between bma180 and bmc150-accel has already caused a lot of confusion in the past. See e.g. [1] where Hans accidentally added BMA250E support to bma180 even though that was already supported in bmc150-accel.

Having BMA250 in bma180 and BMA250E in bmc150-accel was also discussed before in [2] but for some reason back then the conclusion was that they are different enough to justify that.

Also note that this patch only applies cleanly on top of the "iio: accel: bma180: Fix BMA25x bandwidth register values" patch [3] that I sent earlier, which is not present in togreg/testing at the moment (only in fixes-togreg).

[1]: https://lore.kernel.org/linux-iio/[email protected]/
[2]: https://lore.kernel.org/linux-iio/[email protected]/
[3]: https://lore.kernel.org/linux-iio/[email protected]/

---
 drivers/iio/accel/Kconfig             |  6 +-
 drivers/iio/accel/bma180.c            | 91 ++++-----------------------
 drivers/iio/accel/bmc150-accel-core.c |  4 +-
 drivers/iio/accel/bmc150-accel-i2c.c  |  2 +
 4 files changed, 19 insertions(+), 84 deletions(-)
drivers/iio/accel/Kconfig +3 -3
index f68c14f02d6b..b00c228b9bdc 100644
@@ -89,13 +89,13 @@ config ADXL372_I2C
 	  module will be called adxl372_i2c.
 
 config BMA180
-	tristate "Bosch BMA023/BMA1x0/BMA25x 3-Axis Accelerometer Driver"
+	tristate "Bosch BMA023/BMA1x0/BMA250 3-Axis Accelerometer Driver"
 	depends on I2C && INPUT_BMA150=n
 	select IIO_BUFFER
 	select IIO_TRIGGERED_BUFFER
 	help
 	  Say Y here if you want to build a driver for the Bosch BMA023, BMA150
-	  BMA180, SMB380, or BMA25x triaxial acceleration sensor.
+	  BMA180, SMB380, or BMA250 triaxial acceleration sensor.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called bma180.
@@ -143,7 +143,7 @@ config BMC150_ACCEL
 	select BMC150_ACCEL_SPI if SPI
 	help
 	  Say yes here to build support for the following Bosch accelerometers:
-	  BMC150, BMI055, BMA250E, BMA222E, BMA253, BMA255, BMA280.
+	  BMC150, BMI055, BMA250E, BMA222E, BMA253, BMA254, BMA255, BMA280.
 
 	  This is a combo module with both accelerometer and magnetometer.
 	  This driver is only implementing accelerometer part, which has
drivers/iio/accel/bma180.c +12 -79

175 lines not on this page · raw message

drivers/iio/accel/bmc150-accel-core.c +2 -2
index 21abc8d166e6..979da58fdb60 100644
@@ -3,7 +3,7 @@
  * 3-axis accelerometer driver supporting following Bosch-Sensortec chips:
  *  - BMC150
  *  - BMI055
- *  - BMA253/BMA255
+ *  - BMA253/BMA254/BMA255
  *  - BMA250E
  *  - BMA222
  *  - BMA222E
@@ -1098,7 +1098,7 @@ static const struct iio_chan_spec bma280_accel_channels[] =
 
 static const struct bmc150_accel_chip_info bmc150_accel_chip_info_tbl[] = {
 	{
-		.name = "BMC150/BMI055/BMA253/BMA255",
+		.name = "BMC150/BMI055/BMA253/BMA254/BMA255",
 		.chip_id = 0xFA,
 		.channels = bmc150_accel_channels,
 		.num_channels = ARRAY_SIZE(bmc150_accel_channels),
drivers/iio/accel/bmc150-accel-i2c.c +2 -0
index a87306f03a4c..8f0dfe03c919 100644
@@ -239,6 +239,7 @@ static const struct i2c_device_id bmc150_accel_id[] = {
 	{"bmc150_accel"},
 	{"bmi055_accel"},
 	{"bma253"},
+	{"bma254"},
 	{"bma255"},
 	{"bma250e"},
 	{"bma222"},
@@ -253,6 +254,7 @@ static const struct of_device_id bmc150_accel_of_match[] = {
 	{ .compatible = "bosch,bmc150_accel" },
 	{ .compatible = "bosch,bmi055_accel" },
 	{ .compatible = "bosch,bma253" },
+	{ .compatible = "bosch,bma254" },
 	{ .compatible = "bosch,bma255" },
 	{ .compatible = "bosch,bma250e" },
 	{ .compatible = "bosch,bma222" },
Signature · 1 line
2.31.1
Reviewed-by on the v1 series
#8 lore raw
In reply to Stephan Gerhold

Hi,

Quoted 14 lines · Stephan Gerhold

The Bosch BMA253 accelerometer is very similar to both BMA254 and BMA255. The current situation is very confusing: BMA254 is supported by the bma180 driver, but BMA255 is supported by the bmc150-accel driver.

It turns out the bma180 and bmc150-accel drivers have quite some overlap, and BMA253/BMA254 would be a bit better supported in bmc150 (which has support for the motion trigger/interrupt).

This series adds BMA253 support to bmc150-accel and also moves BMA254 over to bmc150, removing some unnecessary code from the bma180 driver.

I asked Linus Walleij to test these patches on BMA254 a while ago and he suggested that I already add his Reviewed-by.

Quoted 7 lines

Stephan Gerhold (6):
iio: accel: bmc150: Drop misleading/duplicate chip identifiers
dt-bindings: iio: accel: bma255: Document bosch,bma253
iio: accel: bmc150: Add device IDs for BMA253
dt-bindings: iio: bma255: Allow multiple interrupts
dt-bindings: iio: accel: bma180/bma255: Move bma254 to bma255 schema
iio: accel: bma180/bmc150: Move BMA254 to bmc150-accel driver

Thanks, the entire series looks good to me:

for the series.

Regards,

Hans

Quoted 11 lines
 .../bindings/iio/accel/bosch,bma180.yaml      |  3 +-
 .../bindings/iio/accel/bosch,bma255.yaml      |  9 +-
 drivers/iio/accel/Kconfig                     |  6 +-
 drivers/iio/accel/bma180.c                    | 91 +++----------------
 drivers/iio/accel/bmc150-accel-core.c         | 36 ++------
 drivers/iio/accel/bmc150-accel-i2c.c          | 34 ++++---
 drivers/iio/accel/bmc150-accel-spi.c          | 31 ++++---
 drivers/iio/accel/bmc150-accel.h              | 10 --
 8 files changed, 67 insertions(+), 153 deletions(-)
Reviewed-by on the v1 series
#9 lore raw
In reply to Stephan Gerhold
Quoted 9 lines · Stephan Gerhold

The Bosch BMA253 accelerometer is very similar to both BMA254 and BMA255. The current situation is very confusing: BMA254 is supported by the bma180 driver, but BMA255 is supported by the bmc150-accel driver.

It turns out the bma180 and bmc150-accel drivers have quite some overlap, and BMA253/BMA254 would be a bit better supported in bmc150 (which has support for the motion trigger/interrupt).

Quoted 5 lines

This series adds BMA253 support to bmc150-accel and also moves BMA254 over to bmc150, removing some unnecessary code from the bma180 driver.

I asked Linus Walleij to test these patches on BMA254 a while ago and he suggested that I already add his Reviewed-by.

I add

After addressing comments per patch 1, feel free to add my

to the series.

And I guess you can drop Laurentiu Palcu email because most of those sensor drivers were done by an Intel team that is not at the company anymore for a few years.

Quoted 21 lines

Stephan Gerhold (6):
iio: accel: bmc150: Drop misleading/duplicate chip identifiers
dt-bindings: iio: accel: bma255: Document bosch,bma253
iio: accel: bmc150: Add device IDs for BMA253
dt-bindings: iio: bma255: Allow multiple interrupts
dt-bindings: iio: accel: bma180/bma255: Move bma254 to bma255 schema
iio: accel: bma180/bmc150: Move BMA254 to bmc150-accel driver

 .../bindings/iio/accel/bosch,bma180.yaml      |  3 +-
 .../bindings/iio/accel/bosch,bma255.yaml      |  9 +-
 drivers/iio/accel/Kconfig                     |  6 +-
 drivers/iio/accel/bma180.c                    | 91 +++----------------
 drivers/iio/accel/bmc150-accel-core.c         | 36 ++------
 drivers/iio/accel/bmc150-accel-i2c.c          | 34 ++++---
 drivers/iio/accel/bmc150-accel-spi.c          | 31 ++++---
 drivers/iio/accel/bmc150-accel.h              | 10 --
 8 files changed, 67 insertions(+), 153 deletions(-)

--
2.31.1

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#10 lore raw
Quoted 16 lines · Andy Shevchenko
Quoted 9 lines · Stephan Gerhold

The Bosch BMA253 accelerometer is very similar to both BMA254 and BMA255. The current situation is very confusing: BMA254 is supported by the bma180 driver, but BMA255 is supported by the bmc150-accel driver.

It turns out the bma180 and bmc150-accel drivers have quite some overlap, and BMA253/BMA254 would be a bit better supported in bmc150 (which has support for the motion trigger/interrupt).

Quoted 5 lines

This series adds BMA253 support to bmc150-accel and also moves BMA254 over to bmc150, removing some unnecessary code from the bma180 driver.

I asked Linus Walleij to test these patches on BMA254 a while ago and he suggested that I already add his Reviewed-by.

Quoted 7 lines

I add

After addressing comments per patch 1, feel free to add my

to the series.

Thanks for the review!

I think the re-ordering should be a separate commit to make the diff not too confusing. Is it fine for you if I send that as a follow-up patch? I already have two more patches that would conflict with the reordering, so it would be easier to include that in the next series.

But I can also re-send the entire series with the extra patch if you prefer that, just let me know. :)

Quoted 4 lines

And I guess you can drop Laurentiu Palcu email because most of those sensor drivers were done by an Intel team that is not at the company anymore for a few years.

Oh yeah, got a lot of mails that it couldn't be delivered to Laurentiu. Oh well.

Thanks,
Stephan

#11 lore raw
Quoted 27 lines · Stephan Gerhold
Quoted 16 lines · Andy Shevchenko
Quoted 9 lines · Stephan Gerhold

The Bosch BMA253 accelerometer is very similar to both BMA254 and BMA255. The current situation is very confusing: BMA254 is supported by the bma180 driver, but BMA255 is supported by the bmc150-accel driver.

It turns out the bma180 and bmc150-accel drivers have quite some overlap, and BMA253/BMA254 would be a bit better supported in bmc150 (which has support for the motion trigger/interrupt).

Quoted 5 lines

This series adds BMA253 support to bmc150-accel and also moves BMA254 over to bmc150, removing some unnecessary code from the bma180 driver.

I asked Linus Walleij to test these patches on BMA254 a while ago and he suggested that I already add his Reviewed-by.

Quoted 7 lines

I add

After addressing comments per patch 1, feel free to add my

to the series.

Thanks for the review!

Quoted 7 lines

I think the re-ordering should be a separate commit to make the diff not too confusing. Is it fine for you if I send that as a follow-up patch? I already have two more patches that would conflict with the reordering, so it would be easier to include that in the next series.

But I can also re-send the entire series with the extra patch if you prefer that, just let me know. :)

I think that doing the reordering first (if there are no fixes so far) is a good idea.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#12 lore raw
Quoted 33 lines · Andy Shevchenko
Quoted 32 lines · Stephan Gerhold
Quoted 16 lines · Andy Shevchenko
Quoted 9 lines · Stephan Gerhold

The Bosch BMA253 accelerometer is very similar to both BMA254 and BMA255. The current situation is very confusing: BMA254 is supported by the bma180 driver, but BMA255 is supported by the bmc150-accel driver.

It turns out the bma180 and bmc150-accel drivers have quite some overlap, and BMA253/BMA254 would be a bit better supported in bmc150 (which has support for the motion trigger/interrupt).

Quoted 5 lines

This series adds BMA253 support to bmc150-accel and also moves BMA254 over to bmc150, removing some unnecessary code from the bma180 driver.

I asked Linus Walleij to test these patches on BMA254 a while ago and he suggested that I already add his Reviewed-by.

Quoted 7 lines

I add

After addressing comments per patch 1, feel free to add my

to the series.

Thanks for the review!

I think the re-ordering should be a separate commit to make the diff not too confusing. Is it fine for you if I send that as a follow-up patch? I already have two more patches that would conflict with the reordering, so it would be easier to include that in the next series.

Quoted 6 lines
Quoted 2 lines

But I can also re-send the entire series with the extra patch if you prefer that, just let me know. :)

I think that doing the reordering first (if there are no fixes so far) is a good idea.

OK, I will try to do that somehow. I will probably prepend one of my additional patches to this series since it has a Fixes: tag that would just cause the stable people headaches later when backporting.

Thanks,
Stephan