Skip to content

Commit 9bd3e92

Browse files
committed
general: icm4268x: Refactor ICM42688 driver to ICM4268X
As a first step to enable the similar variants (e.g: ICM42686), refactor common functionality into icm4268x files. As a result, applications using the icm42688 will need to have both compatible properties: "invensense,icm42688" and "invensense,icm4268x" defined. In-tree boards have been modified to comply with this pattern. This patch does not contain functional changes. The driver should work the same as before. Signed-off-by: Luis Ubieda <luisf@croxel.com>
1 parent ae3fb6e commit 9bd3e92

35 files changed

+853
-757
lines changed

boards/nxp/vmu_rt1170/vmu_rt1170_mimxrt1176_cm7.dts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@
250250
cs-gpios =<&gpio2 11 GPIO_ACTIVE_LOW>;
251251

252252
icm42688_0: icm42688p0@0 {
253-
compatible = "invensense,icm42688";
253+
compatible = "invensense,icm42688", "invensense,icm4268x";
254254
reg = <0>;
255255
int-gpios = <&gpio3 19 GPIO_ACTIVE_HIGH>;
256256
spi-max-frequency = <24000000>;
@@ -272,7 +272,7 @@
272272
cs-gpios =<&gpio3 24 GPIO_ACTIVE_LOW>;
273273

274274
icm42688_1: icm42688p1@0 {
275-
compatible = "invensense,icm42688";
275+
compatible = "invensense,icm42688", "invensense,icm4268x";
276276
reg = <0>;
277277
int-gpios = <&gpio2 7 GPIO_ACTIVE_HIGH>;
278278
spi-max-frequency = <24000000>;

boards/tdk/robokit1/robokit1-common.dtsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
status = "okay";
102102

103103
icm42688: icm42688p@0 {
104-
compatible = "invensense,icm42688";
104+
compatible = "invensense,icm42688", "invensense,icm4268x";
105105
reg = <0>;
106106
int-gpios = <&pioc 5 GPIO_ACTIVE_HIGH>;
107107
spi-max-frequency = <24000000>;

doc/hardware/peripherals/sensor/device_tree.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ then be used in a boards devicetree to configure a sensor to its initial state.
1515
/* SPI bus options here, not shown */
1616
1717
accel_gyro0: icm42688p@0 {
18-
compatible = "invensense,icm42688";
18+
compatible = "invensense,icm42688", "invensense,icm4268x";
1919
reg = <0>;
2020
int-gpios = <&pioc 6 GPIO_ACTIVE_HIGH>; /* SoC specific pin to select for interrupt line */
2121
spi-max-frequency = <DT_FREQ_M(24)>; /* Maximum SPI bus frequency */

doc/releases/migration-guide-4.2.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,9 @@ Sensors
312312

313313
* Renamed ``CONFIG_NPM1300_CHARGER`` to :kconfig:option:`CONFIG_NPM13XX_CHARGER`
314314

315+
* Nodes with compatible property :dtcompatible:`invensense,icm42688` now additionally need to also
316+
include :dtcompatible:`invensense,icm4268x` in order to work.
317+
315318
Serial
316319
=======
317320

drivers/sensor/tdk/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# zephyr-keep-sorted-start
55
add_subdirectory_ifdef(CONFIG_ICM40627 icm40627)
66
add_subdirectory_ifdef(CONFIG_ICM42605 icm42605)
7-
add_subdirectory_ifdef(CONFIG_ICM42688 icm42688)
7+
add_subdirectory_ifdef(CONFIG_ICM4268X icm4268x)
88
add_subdirectory_ifdef(CONFIG_ICM42X70 icm42x70)
99
add_subdirectory_ifdef(CONFIG_ICM45686 icm45686)
1010
add_subdirectory_ifdef(CONFIG_ICP101XX icp101xx)

drivers/sensor/tdk/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# zephyr-keep-sorted-start
55
source "drivers/sensor/tdk/icm40627/Kconfig"
66
source "drivers/sensor/tdk/icm42605/Kconfig"
7-
source "drivers/sensor/tdk/icm42688/Kconfig"
7+
source "drivers/sensor/tdk/icm4268x/Kconfig"
88
source "drivers/sensor/tdk/icm42x70/Kconfig"
99
source "drivers/sensor/tdk/icm45686/Kconfig"
1010
source "drivers/sensor/tdk/icp101xx/Kconfig"

drivers/sensor/tdk/icm42688/CMakeLists.txt

Lines changed: 0 additions & 16 deletions
This file was deleted.

drivers/sensor/tdk/icm42688/icm42688_rtio.h

Lines changed: 0 additions & 19 deletions
This file was deleted.

drivers/sensor/tdk/icm42688/icm42688_trigger.h

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
zephyr_library()
4+
5+
zephyr_library_sources(
6+
icm4268x.c
7+
icm4268x_common.c
8+
icm4268x_spi.c
9+
)
10+
11+
zephyr_library_sources_ifdef(CONFIG_SENSOR_ASYNC_API icm4268x_rtio.c)
12+
zephyr_library_sources_ifdef(CONFIG_ICM4268X_DECODER icm4268x_decoder.c)
13+
zephyr_library_sources_ifdef(CONFIG_ICM4268X_STREAM icm4268x_rtio_stream.c)
14+
zephyr_library_sources_ifdef(CONFIG_ICM4268X_TRIGGER icm4268x_trigger.c)
15+
zephyr_library_sources_ifdef(CONFIG_EMUL_ICM4268X icm4268x_emul.c)
16+
zephyr_include_directories_ifdef(CONFIG_EMUL_ICM4268X .)

0 commit comments

Comments
 (0)