Skip to content

Commit

Permalink
dts: sensor: bosch,bmi270: Move interrupt handling to parent binding
Browse files Browse the repository at this point in the history
Moved the interrupt handling code from a bus-specific binding file to
the parent binding file. This modification ensures that interrupt
handling, which is inherently independent of the type of BUS used
(either i2c or spi), is located in the appropriate location within
the code.

Previously, this code was found in a bus-specific file, despite its
functionality being applicable to all buses. This change ensures a
more logical placement and will help to maintain coherence within the
codebase.

This change aligns with the existing implementation where the interrupt
handling code already operates independently of the BUS type.

Tested this on a nrf52840 with a bmi270 on spi bus with the sample from
zephyr/samples/sensor/bmi270 by adding an interrupt handler in main.c
which uses the bmi270_trigger.c implementation and verified this with
breakpoints and log output.

Added the irq-gpios to tests/drivers/build_all/sensor/i2c.dtsi and
tests/drivers/build_all/sensor/spi.dtsi and fixed whitespace formatting.

Fixes: #58843

Signed-off-by: Andreas Wiesinger <[email protected]>
  • Loading branch information
electrocnic authored and carlescufi committed Sep 13, 2023
1 parent 829b91a commit cb76aab
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 0 additions & 6 deletions dts/bindings/sensor/bosch,bmi270-i2c.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,3 @@
compatible: "bosch,bmi270"

include: [i2c-device.yaml, "bosch,bmi270.yaml"]

properties:
irq-gpios:
type: phandle-array
description: |
The INT1 and (optional) INT2 signal connections.
6 changes: 6 additions & 0 deletions dts/bindings/sensor/bosch,bmi270.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ description: |
include: sensor-device.yaml

compatible: "bosch,bmi270"

properties:
irq-gpios:
type: phandle-array
description: |
The INT1 and (optional) INT2 signal connections.
1 change: 1 addition & 0 deletions tests/drivers/build_all/sensor/i2c.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ test_i2c_bmi160: bmi160@52 {
test_i2c_bmi270: bmi270@53 {
compatible = "bosch,bmi270";
reg = <0x53>;
irq-gpios = <&test_gpio 0 0>;
};

test_i2c_fdc2x1x: fdc2x1x@54 {
Expand Down
1 change: 1 addition & 0 deletions tests/drivers/build_all/sensor/spi.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ test_spi_bmi270: bmi270@15 {
compatible = "bosch,bmi270";
reg = <0x15>;
spi-max-frequency = <0>;
irq-gpios = <&test_gpio 0 0>;
};

test_spi_bmp388: bmp388@16 {
Expand Down

0 comments on commit cb76aab

Please sign in to comment.