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
2426struct mcux_dac32_data {
@@ -89,7 +91,9 @@ static int mcux_dac32_write_value(const struct device *dev, uint8_t channel,
8991
9092static 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
9599static 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, \
0 commit comments