Skip to content

Commit 00a3be9

Browse files
ubiedanashif
authored andcommitted
sensor: icm42688: Use RTIO workq on icm42688_submit
To make its execution path non-blocking from the caller's perspective. Signed-off-by: Luis Ubieda <[email protected]>
1 parent 8d0c2f1 commit 00a3be9

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

drivers/sensor/tdk/icm42688/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# ICM42688-P Six-Axis Motion Tracking device configuration options
22
#
33
# Copyright (c) 2022 Intel Corporation
4+
# Copyright (c) 2024 Croxel Inc.
45
#
56
# SPDX-License-Identifier: Apache-2.0
67

@@ -9,6 +10,7 @@ menuconfig ICM42688
910
default y
1011
depends on DT_HAS_INVENSENSE_ICM42688_ENABLED
1112
select SPI
13+
select RTIO_WORKQ if SENSOR_ASYNC_API
1214
help
1315
Enable driver for ICM42688 SPI-based six-axis motion tracking device.
1416

drivers/sensor/tdk/icm42688/icm42688_rtio.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
/*
22
* Copyright (c) 2023 Google LLC
3+
* Copyright (c) 2024 Croxel Inc.
34
*
45
* SPDX-License-Identifier: Apache-2.0
56
*/
67

78
#include <zephyr/drivers/sensor.h>
9+
#include <zephyr/rtio/work.h>
810
#include "icm42688.h"
911
#include "icm42688_decoder.h"
1012
#include "icm42688_reg.h"
@@ -77,9 +79,10 @@ static void icm42688_submit_one_shot(const struct device *dev, struct rtio_iodev
7779
rtio_iodev_sqe_ok(iodev_sqe, 0);
7880
}
7981

80-
void icm42688_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe)
82+
void icm42688_submit_sync(struct rtio_iodev_sqe *iodev_sqe)
8183
{
8284
const struct sensor_read_config *cfg = iodev_sqe->sqe.iodev->data;
85+
const struct device *dev = cfg->sensor;
8386

8487
if (!cfg->is_streaming) {
8588
icm42688_submit_one_shot(dev, iodev_sqe);
@@ -90,4 +93,13 @@ void icm42688_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe)
9093
}
9194
}
9295

96+
void icm42688_submit(const struct device *dev, struct rtio_iodev_sqe *iodev_sqe)
97+
{
98+
struct rtio_work_req *req = rtio_work_req_alloc();
99+
100+
__ASSERT_NO_MSG(req);
101+
102+
rtio_work_req_submit(req, iodev_sqe, icm42688_submit_sync);
103+
}
104+
93105
BUILD_ASSERT(sizeof(struct icm42688_decoder_header) == 9);

0 commit comments

Comments
 (0)