|
11 | 11 | #include <drivers/sensor/mcux_acmp.h> |
12 | 12 | #include <logging/log.h> |
13 | 13 | #include <fsl_acmp.h> |
| 14 | +#include <drivers/pinctrl.h> |
14 | 15 |
|
15 | 16 | LOG_MODULE_REGISTER(mcux_acmp, CONFIG_SENSOR_LOG_LEVEL); |
16 | 17 |
|
@@ -58,6 +59,7 @@ BUILD_ASSERT(kACMP_PortInputFromMux == 1); |
58 | 59 | struct mcux_acmp_config { |
59 | 60 | CMP_Type *base; |
60 | 61 | acmp_filter_config_t filter; |
| 62 | + const struct pinctrl_dev_config *pincfg; |
61 | 63 | #ifdef CONFIG_MCUX_ACMP_TRIGGER |
62 | 64 | void (*irq_config_func)(const struct device *dev); |
63 | 65 | #endif /* CONFIG_MCUX_ACMP_TRIGGER */ |
@@ -351,6 +353,12 @@ static int mcux_acmp_init(const struct device *dev) |
351 | 353 | { |
352 | 354 | const struct mcux_acmp_config *config = dev->config; |
353 | 355 | struct mcux_acmp_data *data = dev->data; |
| 356 | + int err; |
| 357 | + |
| 358 | + err = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT); |
| 359 | + if (err) { |
| 360 | + return err; |
| 361 | + } |
354 | 362 |
|
355 | 363 | ACMP_GetDefaultConfig(&data->config); |
356 | 364 | data->config.enableHighSpeed = config->high_speed; |
@@ -402,6 +410,7 @@ static const struct mcux_acmp_config mcux_acmp_config_##n = { \ |
402 | 410 | .unfiltered = DT_INST_PROP(n, nxp_use_unfiltered_output), \ |
403 | 411 | .output = DT_INST_PROP(n, nxp_enable_output_pin), \ |
404 | 412 | .window = DT_INST_PROP(n, nxp_window_mode), \ |
| 413 | + .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ |
405 | 414 | config_func_init \ |
406 | 415 | } |
407 | 416 |
|
@@ -431,6 +440,8 @@ static const struct mcux_acmp_config mcux_acmp_config_##n = { \ |
431 | 440 | \ |
432 | 441 | static const struct mcux_acmp_config mcux_acmp_config_##n; \ |
433 | 442 | \ |
| 443 | + PINCTRL_DT_INST_DEFINE(n); \ |
| 444 | + \ |
434 | 445 | DEVICE_DT_INST_DEFINE(n, &mcux_acmp_init, \ |
435 | 446 | NULL, \ |
436 | 447 | &mcux_acmp_data_##n, \ |
|
0 commit comments