iio: add driver for Bosch BMA400 accelerometer
Dan Robertson
maintainerv3 cover iio: add driver for Bosch BMA400 accelerometer
This patchset adds a IIO driver for the Bosch BMA400 3-axes ultra low-power accelerometer. The initial implementation of the driver adds read support for the acceleration and temperature data registers. The driver also has support for reading and writing to the output data rate, oversampling ratio, and scale configuration registers.
Version 3 implements the feedback from reviewers of the v2 patchset.
Cheers,
- Dan
Changes in v3:
* Use yaml format for DT bindings
* Remove strict dependency on OF
* Tidy Kconfig dependencies
* Stylistic changes
* Do not soft-reset device on remove
Changes in v2:
* Implemented iio_info -> read_avail
* Stylistic changes
* Implemented devicetree bindings
Dan Robertson (2):
dt-bindings: iio: accel: bma400: add bindings
iio: (bma400) add driver for the BMA400
.../devicetree/bindings/iio/accel/bma400.yaml | 39 + drivers/iio/accel/Kconfig | 18 + drivers/iio/accel/Makefile | 2 + drivers/iio/accel/bma400.h | 80 ++ drivers/iio/accel/bma400_core.c | 788 ++++++++++++++++++ drivers/iio/accel/bma400_i2c.c | 60 ++ 6 files changed, 987 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/accel/bma400.yaml create mode 100644 drivers/iio/accel/bma400.h create mode 100644 drivers/iio/accel/bma400_core.c create mode 100644 drivers/iio/accel/bma400_i2c.c
Signature · 1 line
2.23.0
Dan Robertson
maintainerPATCH v3 1/2 dt-bindings: iio: accel: bma400: add bindings
Add devicetree binding for the Bosch BMA400 3-axes ultra-low power accelerometer sensor.
--- .../devicetree/bindings/iio/accel/bma400.yaml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/accel/bma400.yaml
Documentation/devicetree/bindings/iio/accel/bma400.yaml new file +39 -0
@@ -0,0 +1,39 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/accel/bma400.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Bosch BMA400 triaxial acceleration sensor + +maintainers: + - Dan Robertson <[email protected]> + +description: | + Acceleration and temerature iio sensors with an i2c interface + + Specifications about the sensor can be found at: + https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMA400-DS000.pdf + +properties: + compatible: + enum: + - bosch,bma400 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <1>; + bma400@14 { + compatible = "bosch,bma400"; + reg = <0x14>; + }; + };
Signature · 1 line
2.23.0
Rob Herring
maintainerRe: [PATCH v3 1/2] dt-bindings: iio: accel: bma400: add bindings
Quoted 8 lines · Dan Robertson
Add devicetree binding for the Bosch BMA400 3-axes ultra-low power accelerometer sensor.
Signed-off-by Dan Robertson <[email protected]>--- .../devicetree/bindings/iio/accel/bma400.yaml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/accel/bma400.yaml
Fails 'make dt_binding_check':
Documentation/devicetree/bindings/iio/accel/bma400.example.dts:22.13-26:
Warning (reg_format): /example-0/i2c0/bma400@14:reg: property has
invalid length (4 bytes) (#address-cells == 1, #size-cells == 1) Documentation/devicetree/bindings/iio/accel/bma400.example.dt.yaml:
Warning (pci_device_bus_num): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/iio/accel/bma400.example.dt.yaml:
Warning (i2c_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/iio/accel/bma400.example.dt.yaml:
Warning (spi_bus_reg): Failed prerequisite 'reg_format' /builds/robherring/linux-dt-review/Documentation/devicetree/bindings/iio/accel/bma400.example.dt.yaml:
i2c0: #size-cells:0:0: 0 was expected
Quoted 51 lines
Documentation/devicetree/bindings/iio/accel/bma400.yaml new file +39
-0@@ -0,0 +1,39 @@ +# SPDX-License-Identifier: GPL-2.0 +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/accel/bma400.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Bosch BMA400 triaxial acceleration sensor + +maintainers: + - Dan Robertson <[email protected]> + +description: | + Acceleration and temerature iio sensors with an i2c interface + + Specifications about the sensor can be found at: + https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BMA400-DS000.pdf + +properties: + compatible: + enum: + - bosch,bma400 + + reg: + maxItems: 1 + +required: + - compatible + - reg + +examples: + - | + i2c0 { + #address-cells = <1>; + #size-cells = <1>; + bma400@14 { + compatible = "bosch,bma400"; + reg = <0x14>; + }; + };Signature · 1 line
2.23.0
Dan Robertson
maintainerRe: [PATCH v3 1/2] dt-bindings: iio: accel: bma400: add bindings
Quoted 1 line
Fails 'make
dt_binding_check':
Thanks for the note. Should running make dt_binding_check be added to Documentation/devicetree/bindings/submitting-patches.rst?
Cheers,
- Dan
Dan Robertson
maintainerRe: [PATCH v3 1/2] dt-bindings: iio: accel: bma400: add bindings
Quoted 2 lines
Thanks for the note. Should running
make dt_binding_checkbe added toDocumentation/devicetree/bindings/submitting-patches.rst?
Sorry, I missed the writing-schema.rst documentation.
Cheers,
- Dan
Dan Robertson
maintainerPATCH v3 2/2 iio: (bma400) add driver for the BMA400
In reply to Dan RobertsonAdd a IIO driver for the Bosch BMA400 3-axes ultra-low power accelerometer. The driver supports reading from the acceleration and temperature registers. The driver also supports reading and configuring the output data rate, oversampling ratio, and scale.
--- drivers/iio/accel/Kconfig | 18 + drivers/iio/accel/Makefile | 2 + drivers/iio/accel/bma400.h | 80 ++++ drivers/iio/accel/bma400_core.c | 788 ++++++++++++++++++++++++++++++++ drivers/iio/accel/bma400_i2c.c | 60 +++ 5 files changed, 948 insertions(+) create mode 100644 drivers/iio/accel/bma400.h create mode 100644 drivers/iio/accel/bma400_core.c create mode 100644 drivers/iio/accel/bma400_i2c.c
drivers/iio/accel/Kconfig +18 -0
@@ -112,6 +112,24 @@ config BMA220 To compile this driver as a module, choose M here: the module will be called bma220_spi. +config BMA400 + tristate "Bosch BMA400 3-Axis Accelerometer Driver" + depends on I2C + select REGMAP + select BMA400_I2C if (I2C) + help + Say Y here if you want to build a driver for the Bosch BMA400 + triaxial acceleration sensor. + + To compile this driver as a module, choose M here: the + module will be called bma400_core and you will also get + bma400_i2c for I2C. + +config BMA400_I2C + tristate + depends on BMA400 + select REGMAP_I2C + config BMC150_ACCEL tristate "Bosch BMC150 Accelerometer Driver" select IIO_BUFFER
drivers/iio/accel/Makefile +2 -0
@@ -14,6 +14,8 @@ obj-$(CONFIG_ADXL372_I2C) += adxl372_i2c.o obj-$(CONFIG_ADXL372_SPI) += adxl372_spi.o obj-$(CONFIG_BMA180) += bma180.o obj-$(CONFIG_BMA220) += bma220_spi.o +obj-$(CONFIG_BMA400) += bma400_core.o +obj-$(CONFIG_BMA400_I2C) += bma400_i2c.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
drivers/iio/accel/bma400.h new file +80 -0
80 lines not on this page · raw message
drivers/iio/accel/bma400_core.c new file +788 -0
788 lines not on this page · raw message
drivers/iio/accel/bma400_i2c.c new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.23.0
Re: [PATCH v3 2/2] iio: (bma400) add driver for the BMA400
Quoted 6 lines · Dan Robertson
Add a IIO driver for the Bosch BMA400 3-axes ultra-low power accelerometer. The driver supports reading from the acceleration and temperature registers. The driver also supports reading and configuring the output data rate, oversampling ratio, and scale.
Signed-off-by Dan Robertson <[email protected]>
Quoted 10 lines
--- drivers/iio/accel/Kconfig | 18 + drivers/iio/accel/Makefile | 2 + drivers/iio/accel/bma400.h | 80 ++++ drivers/iio/accel/bma400_core.c | 788 ++++++++++++++++++++++++++++++++ drivers/iio/accel/bma400_i2c.c | 60 +++ 5 files changed, 948 insertions(+) create mode 100644 drivers/iio/accel/bma400.h create mode 100644 drivers/iio/accel/bma400_core.c create mode 100644 drivers/iio/accel/bma400_i2c.c
No comment other than thank you for ignoring my previous comments. :(
Signature · 1 line
~Randy
Dan Robertson
maintainerRe: [PATCH v3 2/2] iio: (bma400) add driver for the BMA400
Quoted 3 lines
No comment other than thank you for ignoring my previous comments. :(
Oh, no! Sorry, it looks like I missed you in the To and CC list in my reply :/
Cheers,
- Dan