Skip to contentSkip to conversation

dt-bindings: iio: accel: Add bmi088 accelerometer bindings

PATCH Superseded Mike Looijmans 3 participants 6 messages Jan 21, 2021 – Jan 25, 2021 1 message not in the archive

Subsystems (2)

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

PATCH v7 1/2 dt-bindings: iio: accel: Add bmi088 accelerometer bindings

This adds the device-tree bindings for the Bosch Sensortec BMI088 IMU, the accelerometer part.

---

Changes in v7:
Add additionalProperties
Change bmi088_accel to bmi088-accel
Add interrupt-names and adjust description

Changes in v6:
I't been almost a year since the last commit, sorry... Fixed the yaml errors
Add interrupt, vdd and vddio properties

Changes in v5:
submit together with driver code as patch series

Changes in v2:
convert to yaml format

 .../bindings/iio/accel/bosch,bmi088.yaml      | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml
Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml new file +66 -0
new file mode 100644
index 000000000000..db5dbaf80fa2
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/accel/bosch,bmi088.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bosch BMI088 IMU accelerometer part
+
+maintainers:
+  - Mike Looijmans <[email protected]>
+
+description: |
+  Acceleration part of the IMU sensor with an SPI interface
+  Specifications about the sensor can be found at:
+    https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmi088-ds001.pdf
+
+properties:
+  compatible:
+    enum:
+      - bosch,bmi088-accel
+
+  reg:
+    maxItems: 1
+
+  vdd-supply: true
+
+  vddio-supply: true
+
+  interrupts:
+    minItems: 1
+    maxItems: 2
+    description: |
+      Type should be either IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_LEVEL_LOW.
+      Two configurable interrupt lines exist.
+
+  interrupt-names:
+    description: Specify which interrupt line is in use.
+    items:
+      enum:
+        - INT1
+        - INT2
+    minItems: 1
+    maxItems: 2
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      bmi088-accel@1 {
+        compatible = "bosch,bmi088-accel";
+        reg = <1>;
+        spi-max-frequency = <10000000>;
+        interrupt-parent = <&gpio6>;
+        interrupts = <19 IRQ_TYPE_LEVEL_LOW>;
+        interrupt-names = "INT2";
+      };
+    };
+...
Signature · 1 line
2.17.1
#1 lore raw

PATCH v7 2/2 iio: accel: Add support for the Bosch-Sensortec BMI088

The BMI088 is a combined module with both accelerometer and gyroscope. This adds the accelerometer driver support for the SPI interface. The gyroscope part is already supported by the BMG160 driver.

---

Changes in v7:
Change bmi088_accel to bmi088-accel
Order includes alphabetically
Suspend and disable on remove
Make bmi088_regmap_spi_{read|write} static

Changes in v6:
Hope you have good memory - v5 was almost a year ago now Remove superfluous *val=0
Make sample_frequency selection into read_avail list

Changes in v5:
Add includes and forward defines in header
BIT(7) instead of 0x80
Reset already sets defaults, do not set them again Remove now unused bmi088_accel_set_bw
Remove unused AXIS_MAX
Use MASK define for ODR setting
Explain buffer use and alignment
Split bmi088_accel_set_power_state into "on" and "off" parts Cosmetic changes to improve readability

Changes in v4:
Remove unused #include directives
Remove unused #defines for event and irq Replace (ret < 0) with (ret) for all regmap calls Consistent checking of IO errors in probe and init Removed #ifdef CONFIG_PM guard
Use bitops for set_frequency instead of loop with shift s/__s16/s16/g
Remove excess blank lines
Don't return -EAGAIN in pm_runtime

Changes in v3:
Processed comments from Jonathan Cameron and Lars-Peter Clausen implement runtime PM (tested by code tracing) and sleep fix scale and offset factors for accel and temperature and return raw values instead of pre-scaled ones
Use iio_device_{claim,release}_direct_mode
Remove unused code and structs
Use a cache-aligned buffer for bulk read
Configure and enable caching register values

Changes in v2:
Remove unused typedefs and variables
Fix error return when iio_device_register fails

 drivers/iio/accel/Kconfig             |  18 +
 drivers/iio/accel/Makefile            |   2 +
 drivers/iio/accel/bmi088-accel-core.c | 632 ++++++++++++++++++++++++++
 drivers/iio/accel/bmi088-accel-spi.c  |  83 ++++
 drivers/iio/accel/bmi088-accel.h      |  18 +
 5 files changed, 753 insertions(+)
 create mode 100644 drivers/iio/accel/bmi088-accel-core.c
 create mode 100644 drivers/iio/accel/bmi088-accel-spi.c
 create mode 100644 drivers/iio/accel/bmi088-accel.h
drivers/iio/accel/Kconfig +18 -0
index 2e0c62c39155..cceda3cecbcf 100644
@@ -157,6 +157,24 @@ config BMC150_ACCEL_SPI
 	tristate
 	select REGMAP_SPI
 
+config BMI088_ACCEL
+	tristate "Bosch BMI088 Accelerometer Driver"
+	depends on SPI
+	select IIO_BUFFER
+	select IIO_TRIGGERED_BUFFER
+	select REGMAP
+	select BMI088_ACCEL_SPI
+	help
+	  Say yes here to build support for the Bosch BMI088 accelerometer.
+
+	  This is a combo module with both accelerometer and gyroscope. This
+	  driver only implements the accelerometer part, which has its own
+	  address and register map. BMG160 provides the gyroscope driver.
+
+config BMI088_ACCEL_SPI
+	tristate
+	select REGMAP_SPI
+
 config DA280
 	tristate "MiraMEMS DA280 3-axis 14-bit digital accelerometer driver"
 	depends on I2C
drivers/iio/accel/Makefile +2 -0
index 4f6c1ebe13b0..32cd1342a31a 100644
@@ -20,6 +20,8 @@ obj-$(CONFIG_BMA400_SPI) += bma400_spi.o
 obj-$(CONFIG_BMC150_ACCEL) += bmc150-accel-core.o
 obj-$(CONFIG_BMC150_ACCEL_I2C) += bmc150-accel-i2c.o
 obj-$(CONFIG_BMC150_ACCEL_SPI) += bmc150-accel-spi.o
+obj-$(CONFIG_BMI088_ACCEL) += bmi088-accel-core.o
+obj-$(CONFIG_BMI088_ACCEL_SPI) += bmi088-accel-spi.o
 obj-$(CONFIG_DA280)	+= da280.o
 obj-$(CONFIG_DA311)	+= da311.o
 obj-$(CONFIG_DMARD06)	+= dmard06.o
drivers/iio/accel/bmi088-accel-core.c new file +632 -0

632 lines not on this page · raw message

drivers/iio/accel/bmi088-accel-spi.c new file +83 -0

83 lines not on this page · raw message

drivers/iio/accel/bmi088-accel.h new file +18 -0
new file mode 100644
index 000000000000..5c25f16b672c
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef BMI088_ACCEL_H
+#define BMI088_ACCEL_H
+
+#include <linux/pm.h>
+#include <linux/regmap.h>
+#include <linux/types.h>
+
+struct device;
+
+extern const struct regmap_config bmi088_regmap_conf;
+extern const struct dev_pm_ops bmi088_accel_pm_ops;
+
+int bmi088_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
+			    const char *name, bool block_supported);
+int bmi088_accel_core_remove(struct device *dev);
+
+#endif /* BMI088_ACCEL_H */
Signature · 1 line
2.17.1
maintainer
#3 lore raw
In reply to Mike Looijmans
Quoted 20 lines · Mike Looijmans

This adds the device-tree bindings for the Bosch Sensortec BMI088 IMU, the accelerometer part.

---

Changes in v7:
Add additionalProperties
Change bmi088_accel to bmi088-accel
Add interrupt-names and adjust description

Changes in v6:
I't been almost a year since the last commit, sorry... Fixed the yaml errors
Add interrupt, vdd and vddio properties

Changes in v5:
submit together with driver code as patch series

Quoted 7 lines

Changes in v2:
convert to yaml format

 .../bindings/iio/accel/bosch,bmi088.yaml      | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
/builds/robherring/linux-dt-review/Documentation/devicetree/bindings/iio/accel/bosch,bmi088.example.dt.yaml: bmi088-accel@1: 'spi-max-frequency' does not match any of the regexes: 'pinctrl-[0-9]+'
From schema: /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml

See https://patchwork.ozlabs.org/patch/1429940

This check can fail if there are any dependencies. The base for a patch series is generally the most recent rc1.

If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date:

pip3 install dtschema --upgrade

Please check and re-submit.

maintainer
#4 lore raw
In reply to Mike Looijmans
Quoted 4 lines · On Thu, 21 Jan 2021 16:56:58 +0100 Mike Looijmans <[email protected]>…

This adds the device-tree bindings for the Bosch Sensortec BMI088 IMU, the accelerometer part.

Just the issue the build bot found. Otherwise looks good to me.

Jonathan

Quoted 62 lines

---

Changes in v7:
Add additionalProperties
Change bmi088_accel to bmi088-accel
Add interrupt-names and adjust description

Changes in v6:
I't been almost a year since the last commit, sorry... Fixed the yaml errors
Add interrupt, vdd and vddio properties

Changes in v5:
submit together with driver code as patch series

Changes in v2:
convert to yaml format

 .../bindings/iio/accel/bosch,bmi088.yaml      | 66 +++++++++++++++++++
 1 file changed, 66 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml
Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml new file +33 -0
new file mode 100644
index 000000000000..db5dbaf80fa2
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/accel/bosch,bmi088.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bosch BMI088 IMU accelerometer part
+
+maintainers:
+  - Mike Looijmans <[email protected]>
+
+description: |
+  Acceleration part of the IMU sensor with an SPI interface
+  Specifications about the sensor can be found at:
+    https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmi088-ds001.pdf
+
+properties:
+  compatible:
+    enum:
+      - bosch,bmi088-accel
+
+  reg:
+    maxItems: 1
+
+  vdd-supply: true
+
+  vddio-supply: true
+
+  interrupts:
+    minItems: 1
+    maxItems: 2
+    description: |
+      Type should be either IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_LEVEL_LOW.

Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml line 43

Quoted 10 lines
Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml new file +10 -0
+      Two configurable interrupt lines exist.
+
+  interrupt-names:
+    description: Specify which interrupt line is in use.
+    items:
+      enum:
+        - INT1
+        - INT2
+    minItems: 1
+    maxItems: 2

As per Rob's build bot you need.

spi-max-frequency: true

If that's all that comes up and Rob is happy with this I can fix that up whilst applying. Please try to run the checks suggested in Rob's build bot message before submitting binding patches though.

Quoted 23 lines
Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml new file +23 -0
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      bmi088-accel@1 {
+        compatible = "bosch,bmi088-accel";
+        reg = <1>;
+        spi-max-frequency = <10000000>;
+        interrupt-parent = <&gpio6>;
+        interrupts = <19 IRQ_TYPE_LEVEL_LOW>;
+        interrupt-names = "INT2";
+      };
+    };
+...
maintainer
#2 lore raw

Re: [PATCH v7 2/2] iio: accel: Add support for the Bosch-Sensortec BMI088

In reply to Mike Looijmans
Quoted 6 lines · On Thu, 21 Jan 2021 16:56:59 +0100 Mike Looijmans <[email protected]>…

The BMI088 is a combined module with both accelerometer and gyroscope. This adds the accelerometer driver support for the SPI interface. The gyroscope part is already supported by the BMG160 driver.

..

Quoted 6 lines
drivers/iio/accel/bmi088-accel-core.c new file +0 -0
new file mode 100644
index 000000000000..d7dc6f3e2fa6

drivers/iio/accel/bmi088-accel-core.c line 9

Quoted 9 lines
drivers/iio/accel/bmi088-accel-core.c new file +9 -0
@@ -0,0 +1,632 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * 3-axis accelerometer driver supporting following Bosch-Sensortec chips:
+ *  - BMI088
+ *
+ * Copyright (c) 2018-2021, Topic Embedded Products
+ */
+
+#include <asm/unaligned.h>

Ah. I forgot to highlight this one. Oddly convention is to do alphabetical order, but in groups. Generic first (e.g. linux/*.h) and then specific (asm/*) and finally as you have it, local headers.

Mind you it's not universal in the kernel, but I think this is one of the more common patterns and it's definitely preferred in IIO.

Quoted 13 lines
drivers/iio/accel/bmi088-accel-core.c new file +13 -0
+#include <linux/acpi.h>
+#include <linux/delay.h>
+#include <linux/iio/iio.h>
+#include <linux/iio/sysfs.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/pm.h>
+#include <linux/pm_runtime.h>
+#include <linux/regmap.h>
+#include <linux/slab.h>
+
+#include "bmi088-accel.h"
+

...

Quoted 1 line

+static int bmi088_accel_set_power_state_on(struct bmi088_accel_data *data)

Linus Walleij's query in v6 needs addressing (it crossed with you posting v7 I think)

Quoted 62 lines
drivers/iio/accel/bmi088-accel-core.c new file +62 -0
+{
+	struct device *dev = regmap_get_device(data->regmap);
+	int ret;
+
+	ret = pm_runtime_get_sync(dev);
+	if (ret < 0) {
+		pm_runtime_put_noidle(dev);
+		return ret;
+	}
+
+	return 0;
+}
+
+static int bmi088_accel_set_power_state_off(struct bmi088_accel_data *data)
+{
+	struct device *dev = regmap_get_device(data->regmap);
+	int ret;
+
+	pm_runtime_mark_last_busy(dev);
+	ret = pm_runtime_put_autosuspend(dev);
+
+	return ret < 0 ? ret : 0;
+}
+
+/*
+ * The register ACC_PWR_CTRL enables and disables the accelerometer and the
+ * temperature sensor.
+ */
+static int bmi088_accel_enable(struct bmi088_accel_data *data, bool on_off)
+{
+	struct device *dev = regmap_get_device(data->regmap);
+	unsigned int val = on_off ? 0x4 : 0x0;
+	int ret;
+
+	ret = regmap_write(data->regmap, BMI088_ACCEL_REG_PWR_CTRL, val);
+	if (ret) {
+		dev_err(dev, "Error writing ACC_PWR_CTRL reg\n");
+		return ret;
+	}
+	/* Datasheet recommends to wait at least 5ms before communication */
+	usleep_range(5000, 6000);
+
+	return 0;
+}
+
+/* In suspend mode, only the accelerometer is powered down. */
+static int bmi088_accel_set_mode(struct bmi088_accel_data *data,
+				enum bmi088_power_modes mode)
+{
+	struct device *dev = regmap_get_device(data->regmap);
+	unsigned int val = mode == BMI088_ACCEL_MODE_SUSPEND ? 0x3 : 0x0;
+	int ret;
+
+	ret = regmap_write(data->regmap, BMI088_ACCEL_REG_PWR_CONF, val);
+	if (ret) {
+		dev_err(dev, "Error writing ACCEL_PWR_CONF reg\n");
+		return ret;
+	}
+
+	return 0;
+}
+

...

Quoted 55 lines
drivers/iio/accel/bmi088-accel-core.c new file +55 -0
+int bmi088_accel_core_probe(struct device *dev, struct regmap *regmap,
+	int irq, const char *name, bool block_supported)
+{
+	struct bmi088_accel_data *data;
+	struct iio_dev *indio_dev;
+	int ret;
+
+	indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
+	if (!indio_dev)
+		return -ENOMEM;
+
+	data = iio_priv(indio_dev);
+	dev_set_drvdata(dev, indio_dev);
+
+	data->regmap = regmap;
+
+	ret = bmi088_accel_chip_init(data);
+	if (ret)
+		return ret;
+
+	mutex_init(&data->mutex);
+
+	indio_dev->dev.parent = dev;
+	indio_dev->channels = data->chip_info->channels;
+	indio_dev->num_channels = data->chip_info->num_channels;
+	indio_dev->name = name ? name : data->chip_info->name;
+	indio_dev->available_scan_masks = bmi088_accel_scan_masks;
+	indio_dev->modes = INDIO_DIRECT_MODE;
+	indio_dev->info = &bmi088_accel_info;
+
+	ret = pm_runtime_set_active(dev);
+	if (ret)
+		return ret;
+
+	pm_runtime_enable(dev);
+	pm_runtime_set_autosuspend_delay(dev, BMI088_AUTO_SUSPEND_DELAY_MS);
+	pm_runtime_use_autosuspend(dev);
+
+	ret = iio_device_register(indio_dev);
+	if (ret)
+		dev_err(dev, "Unable to register iio device\n");
+
+	return ret;
+}
+EXPORT_SYMBOL_GPL(bmi088_accel_core_probe);
+
+static void bmi088_accel_suspend_impl(struct bmi088_accel_data *data)
+{
+	mutex_lock(&data->mutex);
+	bmi088_accel_set_mode(data, BMI088_ACCEL_MODE_SUSPEND);
+	bmi088_accel_enable(data, false);
+	mutex_unlock(&data->mutex);
+}accel_supsn
+
+int bmi088_accel_core_remove(struct device *dev)

drivers/iio/accel/bmi088-accel-core.c line 568

Quoted 10 lines
drivers/iio/accel/bmi088-accel-core.c new file +10 -0
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct bmi088_accel_data *data = iio_priv(indio_dev);
+
+	iio_device_unregister(indio_dev);
+
+	pm_runtime_disable(dev);
+	pm_runtime_set_suspended(dev);
+	pm_runtime_put_noidle(dev);
+	bmi088_accel_suspend_impl(data);

Sorry, did read your response to v6 review quick enough or I'd have commented on it there.

Whilst it seems convenient I would rather you didn't use this shared function. It obscures what is going on a little so it's not obvious which elements of probe this is undoing.

the accel_enable is buried in *chip_init() so I'd ideally like to see an *chip_uninit() that undoes only what was done in chip_init() (next to it so it's easy to check!)

The set_mode() bit is harder to identify in probe and actually makes me a bit suspicious. If we probe the driver and immediately read I suspect the device may not actually be turned on?

Quoted 64 lines
drivers/iio/accel/bmi088-accel-core.c new file +64 -0
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(bmi088_accel_core_remove);
+
+/* When going into system sleep, put the chip in power down */
+static int __maybe_unused bmi088_accel_suspend(struct device *dev)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct bmi088_accel_data *data = iio_priv(indio_dev);
+
+	bmi088_accel_suspend_impl(data);
+
+	return 0;
+}
+
+static int __maybe_unused bmi088_accel_resume(struct device *dev)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct bmi088_accel_data *data = iio_priv(indio_dev);
+
+	mutex_lock(&data->mutex);
+	bmi088_accel_enable(data, true);
+	bmi088_accel_set_mode(data, BMI088_ACCEL_MODE_ACTIVE);
+	mutex_unlock(&data->mutex);
+
+	return 0;
+}
+
+/* For runtime PM put the chip in suspend mode */
+static int __maybe_unused bmi088_accel_runtime_suspend(struct device *dev)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct bmi088_accel_data *data = iio_priv(indio_dev);
+
+	return bmi088_accel_set_mode(data, BMI088_ACCEL_MODE_SUSPEND);
+}
+
+static int __maybe_unused bmi088_accel_runtime_resume(struct device *dev)
+{
+	struct iio_dev *indio_dev = dev_get_drvdata(dev);
+	struct bmi088_accel_data *data = iio_priv(indio_dev);
+	int ret;
+
+	ret = bmi088_accel_set_mode(data, BMI088_ACCEL_MODE_ACTIVE);
+	if (ret)
+		return ret;
+
+	usleep_range(BMI088_ACCEL_MAX_STARTUP_TIME_US,
+		     BMI088_ACCEL_MAX_STARTUP_TIME_US * 2);
+
+	return 0;
+}
+
+const struct dev_pm_ops bmi088_accel_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(bmi088_accel_suspend, bmi088_accel_resume)
+	SET_RUNTIME_PM_OPS(bmi088_accel_runtime_suspend,
+			   bmi088_accel_runtime_resume, NULL)
+};
+EXPORT_SYMBOL_GPL(bmi088_accel_pm_ops);
+
+MODULE_AUTHOR("Niek van Agt <[email protected]>");
+MODULE_LICENSE("GPL v2");
+MODULE_DESCRIPTION("BMI088 accelerometer driver (core)");

...

#5 lore raw
In reply to Jonathan Cameron

See below

Met vriendelijke groet / kind regards,

Mike Looijmans
System Expert

TOPIC Embedded Products B.V.
Materiaalweg 4, 5681 RJ Best
The Netherlands

T: +31 (0) 499 33 69 69
E: [email protected]
W: www.topicproducts.com

Please consider the environment before printing this e-mail

Quoted 84 lines · Jonathan Cameron
Quoted 4 lines · On Thu, 21 Jan 2021 16:56:58 +0100 Mike Looijmans <[email protected]>…

This adds the device-tree bindings for the Bosch Sensortec BMI088 IMU, the accelerometer part.

Just the issue the build bot found. Otherwise looks good to me.

Jonathan

Quoted 61 lines

---

Changes in v7:
Add additionalProperties
Change bmi088_accel to bmi088-accel
Add interrupt-names and adjust description

Changes in v6:
I't been almost a year since the last commit, sorry... Fixed the yaml errors
Add interrupt, vdd and vddio properties

Changes in v5:
submit together with driver code as patch series

Changes in v2:
convert to yaml format

  .../bindings/iio/accel/bosch,bmi088.yaml      | 66 +++++++++++++++++++
  1 file changed, 66 insertions(+)

create mode 100644 Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml

Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml new file +33 -0
new file mode 100644
index 000000000000..db5dbaf80fa2
@@ -0,0 +1,66 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/accel/bosch,bmi088.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Bosch BMI088 IMU accelerometer part
+
+maintainers:
+  - Mike Looijmans <[email protected]>
+
+description: |
+  Acceleration part of the IMU sensor with an SPI interface
+  Specifications about the sensor can be found at:
+    https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bmi088-ds001.pdf
+
+properties:
+  compatible:
+    enum:
+      - bosch,bmi088-accel
+
+  reg:
+    maxItems: 1
+
+  vdd-supply: true
+
+  vddio-supply: true
+
+  interrupts:
+    minItems: 1
+    maxItems: 2
+    description: |
+      Type should be either IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_LEVEL_LOW.

Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml line 43

Quoted 10 lines
Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml new file +10 -0
+      Two configurable interrupt lines exist.
+
+  interrupt-names:
+    description: Specify which interrupt line is in use.
+    items:
+      enum:
+        - INT1
+        - INT2
+    minItems: 1
+    maxItems: 2

As per Rob's build bot you need.

Quoted 5 lines

spi-max-frequency: true

If that's all that comes up and Rob is happy with this I can fix that up whilst applying. Please try to run the checks suggested in Rob's build bot message before submitting binding patches though.

There'll be a v8 it seems, so I've already added it. Seems that I need to upgrade those definition files every day...

Quoted 23 lines
Quoted 23 lines
Documentation/devicetree/bindings/iio/accel/bosch,bmi088.yaml new file +23 -0
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/interrupt-controller/irq.h>
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+      bmi088-accel@1 {
+        compatible = "bosch,bmi088-accel";
+        reg = <1>;
+        spi-max-frequency = <10000000>;
+        interrupt-parent = <&gpio6>;
+        interrupts = <19 IRQ_TYPE_LEVEL_LOW>;
+        interrupt-names = "INT2";
+      };
+    };
+...
Signature · 1 line
Mike Looijmans