Skip to content

Commit e0363f2

Browse files
bjarki-andreasennashif
authored andcommitted
sensor: mcux_acmp: namespace driver and kconfigs
The mcux_acmp will get support by the comparator subsystem. To avoid namespace clashes, namespace the driver, kconfigs and use the MCUX_ACMP config solely to select the MCUX SDK driver. Signed-off-by: Bjarki Arge Andreasen <[email protected]>
1 parent a4fce33 commit e0363f2

File tree

6 files changed

+22
-20
lines changed

6 files changed

+22
-20
lines changed

drivers/sensor/nxp/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
add_subdirectory_ifdef(CONFIG_FXAS21002 fxas21002)
66
add_subdirectory_ifdef(CONFIG_FXLS8974 fxls8974)
77
add_subdirectory_ifdef(CONFIG_FXOS8700 fxos8700)
8-
add_subdirectory_ifdef(CONFIG_MCUX_ACMP mcux_acmp)
98
add_subdirectory_ifdef(CONFIG_MCUX_LPCMP mcux_lpcmp)
109
add_subdirectory_ifdef(CONFIG_NXP_TEMPMON nxp_tempmon)
1110
add_subdirectory_ifdef(CONFIG_QDEC_MCUX qdec_mcux)
1211
add_subdirectory_ifdef(CONFIG_QDEC_NXP_S32 qdec_nxp_s32)
12+
add_subdirectory_ifdef(CONFIG_SENSOR_MCUX_ACMP mcux_acmp)
1313
add_subdirectory_ifdef(CONFIG_TEMP_KINETIS nxp_kinetis_temp)
1414
# zephyr-keep-sorted-stop

drivers/sensor/nxp/mcux_acmp/Kconfig

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@
44
# Copyright 2024 NXP
55
# SPDX-License-Identifier: Apache-2.0
66

7-
config MCUX_ACMP
7+
config SENSOR_MCUX_ACMP
88
bool "NXP MCUX Analog Comparator (ACMP)"
99
default y
1010
depends on DT_HAS_NXP_KINETIS_ACMP_ENABLED
1111
select PINCTRL
12+
select MCUX_ACMP
1213
help
1314
Enable driver for the NXP MCUX Analog Comparator (ACMP).
1415

15-
config MCUX_ACMP_TRIGGER
16+
config SENSOR_MCUX_ACMP_TRIGGER
1617
bool "Trigger support"
17-
depends on MCUX_ACMP
18+
depends on SENSOR_MCUX_ACMP
1819
help
1920
Enable trigger support for the NXP MCUX Analog Comparator
2021
(ACMP).

drivers/sensor/nxp/mcux_acmp/mcux_acmp.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ struct mcux_acmp_config {
4545
CMP_Type *base;
4646
acmp_filter_config_t filter;
4747
const struct pinctrl_dev_config *pincfg;
48-
#ifdef CONFIG_MCUX_ACMP_TRIGGER
48+
#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER
4949
void (*irq_config_func)(const struct device *dev);
50-
#endif /* CONFIG_MCUX_ACMP_TRIGGER */
50+
#endif /* CONFIG_SENSOR_MCUX_ACMP_TRIGGER */
5151
bool high_speed : 1;
5252
bool unfiltered : 1;
5353
bool output : 1;
@@ -61,15 +61,15 @@ struct mcux_acmp_data {
6161
#if MCUX_ACMP_HAS_DISCRETE_MODE
6262
acmp_discrete_mode_config_t discrete_config;
6363
#endif
64-
#ifdef CONFIG_MCUX_ACMP_TRIGGER
64+
#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER
6565
const struct device *dev;
6666
sensor_trigger_handler_t rising_handler;
6767
const struct sensor_trigger *rising_trigger;
6868
sensor_trigger_handler_t falling_handler;
6969
const struct sensor_trigger *falling_trigger;
7070
struct k_work work;
7171
volatile uint32_t status;
72-
#endif /* CONFIG_MCUX_ACMP_TRIGGER */
72+
#endif /* CONFIG_SENSOR_MCUX_ACMP_TRIGGER */
7373
bool cout;
7474
};
7575

@@ -370,7 +370,7 @@ static int mcux_acmp_channel_get(const struct device *dev,
370370
return 0;
371371
}
372372

373-
#ifdef CONFIG_MCUX_ACMP_TRIGGER
373+
#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER
374374
static int mcux_acmp_trigger_set(const struct device *dev,
375375
const struct sensor_trigger *trig,
376376
sensor_trigger_handler_t handler)
@@ -431,7 +431,7 @@ static void mcux_acmp_isr(const struct device *dev)
431431

432432
k_work_submit(&data->work);
433433
}
434-
#endif /* CONFIG_MCUX_ACMP_TRIGGER */
434+
#endif /* CONFIG_SENSOR_MCUX_ACMP_TRIGGER */
435435

436436
static int mcux_acmp_init(const struct device *dev)
437437
{
@@ -462,15 +462,15 @@ static int mcux_acmp_init(const struct device *dev)
462462
/* Disable DAC */
463463
ACMP_SetDACConfig(config->base, NULL);
464464

465-
#ifdef CONFIG_MCUX_ACMP_TRIGGER
465+
#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER
466466
data->dev = dev;
467467
k_work_init(&data->work, mcux_acmp_trigger_work_handler);
468468

469469
config->irq_config_func(dev);
470470
ACMP_EnableInterrupts(config->base,
471471
kACMP_OutputRisingInterruptEnable |
472472
kACMP_OutputFallingInterruptEnable);
473-
#endif /* CONFIG_MCUX_ACMP_TRIGGER */
473+
#endif /* CONFIG_SENSOR_MCUX_ACMP_TRIGGER */
474474

475475
ACMP_Enable(config->base, true);
476476

@@ -480,9 +480,9 @@ static int mcux_acmp_init(const struct device *dev)
480480
static const struct sensor_driver_api mcux_acmp_driver_api = {
481481
.attr_set = mcux_acmp_attr_set,
482482
.attr_get = mcux_acmp_attr_get,
483-
#ifdef CONFIG_MCUX_ACMP_TRIGGER
483+
#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER
484484
.trigger_set = mcux_acmp_trigger_set,
485-
#endif /* CONFIG_MCUX_ACMP_TRIGGER */
485+
#endif /* CONFIG_SENSOR_MCUX_ACMP_TRIGGER */
486486
.sample_fetch = mcux_acmp_sample_fetch,
487487
.channel_get = mcux_acmp_channel_get,
488488
};
@@ -503,7 +503,7 @@ static const struct mcux_acmp_config mcux_acmp_config_##n = { \
503503
config_func_init \
504504
}
505505

506-
#ifdef CONFIG_MCUX_ACMP_TRIGGER
506+
#ifdef CONFIG_SENSOR_MCUX_ACMP_TRIGGER
507507
#define MCUX_ACMP_CONFIG_FUNC(n) \
508508
static void mcux_acmp_config_func_##n(const struct device *dev) \
509509
{ \
@@ -517,12 +517,12 @@ static const struct mcux_acmp_config mcux_acmp_config_##n = { \
517517
.irq_config_func = mcux_acmp_config_func_##n
518518
#define MCUX_ACMP_INIT_CONFIG(n) \
519519
MCUX_ACMP_DECLARE_CONFIG(n, MCUX_ACMP_CONFIG_FUNC_INIT(n))
520-
#else /* !CONFIG_MCUX_ACMP_TRIGGER */
520+
#else /* !CONFIG_SENSOR_MCUX_ACMP_TRIGGER */
521521
#define MCUX_ACMP_CONFIG_FUNC(n)
522522
#define MCUX_ACMP_CONFIG_FUNC_INIT
523523
#define MCUX_ACMP_INIT_CONFIG(n) \
524524
MCUX_ACMP_DECLARE_CONFIG(n, MCUX_ACMP_CONFIG_FUNC_INIT)
525-
#endif /* !CONFIG_MCUX_ACMP_TRIGGER */
525+
#endif /* !CONFIG_SENSOR_MCUX_ACMP_TRIGGER */
526526

527527
#define MCUX_ACMP_INIT(n) \
528528
static struct mcux_acmp_data mcux_acmp_data_##n; \

modules/hal_nxp/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
# SPDX-License-Identifier: Apache-2.0
55
#
66

7-
# file is empty and kept as a place holder if/when Kconfig is needed
7+
config MCUX_ACMP
8+
bool "Include ACMP driver from MCUX SDK"

samples/sensor/mcux_acmp/prj.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
CONFIG_SENSOR=y
2-
CONFIG_MCUX_ACMP_TRIGGER=y
2+
CONFIG_SENSOR_MCUX_ACMP_TRIGGER=y

samples/sensor/mcux_acmp/sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,4 @@ tests:
2727
sample.sensor.mcux_acmp.no_trigger:
2828
build_only: true
2929
extra_configs:
30-
- CONFIG_MCUX_ACMP_TRIGGER=n
30+
- CONFIG_SENSOR_MCUX_ACMP_TRIGGER=n

0 commit comments

Comments
 (0)