Skip to content

Commit 9e12d23

Browse files
danieldegrassecarlescufi
authored andcommitted
drivers: dac: add pinctrl support to dac_mcux_dac32 driver
add pinctrl support to dac_mcux_dac32 driver Signed-off-by: Daniel DeGrasse <[email protected]>
1 parent f1b3f00 commit 9e12d23

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

drivers/dac/Kconfig.mcux

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ config DAC_MCUX_DAC
1313
config DAC_MCUX_DAC32
1414
bool "NXP Kinetis MCUX DAC32 driver"
1515
depends on HAS_MCUX_DAC32
16+
select PINCTRL
1617
help
1718
Enable the driver for the NXP Kinetis MCUX DAC32.
1819

drivers/dac/dac_mcux_dac32.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <zephyr.h>
1010
#include <drivers/dac.h>
1111
#include <logging/log.h>
12+
#include <drivers/pinctrl.h>
1213

1314
#include <fsl_dac32.h>
1415

@@ -19,6 +20,7 @@ struct mcux_dac32_config {
1920
dac32_reference_voltage_source_t reference;
2021
bool buffered;
2122
bool low_power;
23+
const struct pinctrl_dev_config *pincfg;
2224
};
2325

2426
struct mcux_dac32_data {
@@ -89,7 +91,9 @@ static int mcux_dac32_write_value(const struct device *dev, uint8_t channel,
8991

9092
static int mcux_dac32_init(const struct device *dev)
9193
{
92-
return 0;
94+
const struct mcux_dac32_config *config = dev->config;
95+
96+
return pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT);
9397
}
9498

9599
static const struct dac_driver_api mcux_dac32_driver_api = {
@@ -103,12 +107,15 @@ static const struct dac_driver_api mcux_dac32_driver_api = {
103107
#define MCUX_DAC32_INIT(n) \
104108
static struct mcux_dac32_data mcux_dac32_data_##n; \
105109
\
110+
PINCTRL_DT_INST_DEFINE(n); \
111+
\
106112
static const struct mcux_dac32_config mcux_dac32_config_##n = { \
107113
.base = (DAC_Type *)DT_INST_REG_ADDR(n), \
108114
.reference = \
109115
TO_DAC32_VREF_SRC(DT_INST_PROP(n, voltage_reference)), \
110116
.buffered = DT_INST_PROP(n, buffered), \
111117
.low_power = DT_INST_PROP(n, low_power_mode), \
118+
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \
112119
}; \
113120
\
114121
DEVICE_DT_INST_DEFINE(n, mcux_dac32_init, NULL, \

dts/bindings/dac/nxp,kinetis-dac32.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: NXP Kinetis MCUX DAC32
55

66
compatible: "nxp,kinetis-dac32"
77

8-
include: dac-controller.yaml
8+
include: [dac-controller.yaml, pinctrl-device.yaml]
99

1010
properties:
1111
reg:

0 commit comments

Comments
 (0)