drivers: sensor: Add pinctrl support for mcux acmp sensor
Add pinctrl support for mcux acmp sensor driver Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
de18fdf2f1
commit
31406c13f2
3 changed files with 13 additions and 1 deletions
|
@ -6,6 +6,7 @@
|
||||||
config MCUX_ACMP
|
config MCUX_ACMP
|
||||||
bool "NXP MCUX Analog Comparator (ACMP)"
|
bool "NXP MCUX Analog Comparator (ACMP)"
|
||||||
depends on HAS_MCUX_ACMP
|
depends on HAS_MCUX_ACMP
|
||||||
|
select PINCTRL
|
||||||
help
|
help
|
||||||
Enable driver for the NXP MCUX Analog Comparator (ACMP).
|
Enable driver for the NXP MCUX Analog Comparator (ACMP).
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <drivers/sensor/mcux_acmp.h>
|
#include <drivers/sensor/mcux_acmp.h>
|
||||||
#include <logging/log.h>
|
#include <logging/log.h>
|
||||||
#include <fsl_acmp.h>
|
#include <fsl_acmp.h>
|
||||||
|
#include <drivers/pinctrl.h>
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(mcux_acmp, CONFIG_SENSOR_LOG_LEVEL);
|
LOG_MODULE_REGISTER(mcux_acmp, CONFIG_SENSOR_LOG_LEVEL);
|
||||||
|
|
||||||
|
@ -58,6 +59,7 @@ BUILD_ASSERT(kACMP_PortInputFromMux == 1);
|
||||||
struct mcux_acmp_config {
|
struct mcux_acmp_config {
|
||||||
CMP_Type *base;
|
CMP_Type *base;
|
||||||
acmp_filter_config_t filter;
|
acmp_filter_config_t filter;
|
||||||
|
const struct pinctrl_dev_config *pincfg;
|
||||||
#ifdef CONFIG_MCUX_ACMP_TRIGGER
|
#ifdef CONFIG_MCUX_ACMP_TRIGGER
|
||||||
void (*irq_config_func)(const struct device *dev);
|
void (*irq_config_func)(const struct device *dev);
|
||||||
#endif /* CONFIG_MCUX_ACMP_TRIGGER */
|
#endif /* CONFIG_MCUX_ACMP_TRIGGER */
|
||||||
|
@ -351,6 +353,12 @@ static int mcux_acmp_init(const struct device *dev)
|
||||||
{
|
{
|
||||||
const struct mcux_acmp_config *config = dev->config;
|
const struct mcux_acmp_config *config = dev->config;
|
||||||
struct mcux_acmp_data *data = dev->data;
|
struct mcux_acmp_data *data = dev->data;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
ACMP_GetDefaultConfig(&data->config);
|
ACMP_GetDefaultConfig(&data->config);
|
||||||
data->config.enableHighSpeed = config->high_speed;
|
data->config.enableHighSpeed = config->high_speed;
|
||||||
|
@ -402,6 +410,7 @@ static const struct mcux_acmp_config mcux_acmp_config_##n = { \
|
||||||
.unfiltered = DT_INST_PROP(n, nxp_use_unfiltered_output), \
|
.unfiltered = DT_INST_PROP(n, nxp_use_unfiltered_output), \
|
||||||
.output = DT_INST_PROP(n, nxp_enable_output_pin), \
|
.output = DT_INST_PROP(n, nxp_enable_output_pin), \
|
||||||
.window = DT_INST_PROP(n, nxp_window_mode), \
|
.window = DT_INST_PROP(n, nxp_window_mode), \
|
||||||
|
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
|
||||||
config_func_init \
|
config_func_init \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,6 +440,8 @@ static const struct mcux_acmp_config mcux_acmp_config_##n = { \
|
||||||
\
|
\
|
||||||
static const struct mcux_acmp_config mcux_acmp_config_##n; \
|
static const struct mcux_acmp_config mcux_acmp_config_##n; \
|
||||||
\
|
\
|
||||||
|
PINCTRL_DT_INST_DEFINE(n); \
|
||||||
|
\
|
||||||
DEVICE_DT_INST_DEFINE(n, &mcux_acmp_init, \
|
DEVICE_DT_INST_DEFINE(n, &mcux_acmp_init, \
|
||||||
NULL, \
|
NULL, \
|
||||||
&mcux_acmp_data_##n, \
|
&mcux_acmp_data_##n, \
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: NXP Kinetis Analog Comparator (ACMP)
|
||||||
|
|
||||||
compatible: "nxp,kinetis-acmp"
|
compatible: "nxp,kinetis-acmp"
|
||||||
|
|
||||||
include: base.yaml
|
include: [base.yaml, pinctrl-device.yaml]
|
||||||
|
|
||||||
properties:
|
properties:
|
||||||
interrupts:
|
interrupts:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue