Skip to content

Commit de3b598

Browse files
LaurentiuM1234kartben
authored andcommitted
drivers: dai: esai: support applying default pin configuration
Add support for applying the default pin configuration. Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
1 parent 1f483b3 commit de3b598

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

drivers/dai/nxp/esai/Kconfig.esai

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# Copyright 2024 NXP
1+
# Copyright 2024-2025 NXP
22
# SPDX-License-Identifier: Apache-2.0
33

44
config DAI_NXP_ESAI
55
bool "NXP Enhanced Serial Audio Interface (ESAI) driver"
66
default y
77
depends on DT_HAS_NXP_DAI_ESAI_ENABLED
8+
select PINCTRL
89
help
910
Select this to enable NXP ESAI driver.

drivers/dai/nxp/esai/esai.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,12 @@ static int esai_init(const struct device *dev)
740740
}
741741
#endif /* CONFIG_PM_DEVICE_RUNTIME */
742742

743+
/* note: optional operation so -ENOENT is allowed */
744+
ret = pinctrl_apply_state(cfg->pincfg, PINCTRL_STATE_DEFAULT);
745+
if (ret < 0 && ret != -ENOENT) {
746+
return ret;
747+
}
748+
743749
ret = esai_parse_pinmodes(cfg, data);
744750
if (ret < 0) {
745751
return ret;
@@ -750,6 +756,8 @@ static int esai_init(const struct device *dev)
750756

751757
#define ESAI_INIT(inst) \
752758
\
759+
PINCTRL_DT_INST_DEFINE(inst); \
760+
\
753761
BUILD_ASSERT(ESAI_TX_FIFO_WATERMARK(inst) >= 1 && \
754762
ESAI_TX_FIFO_WATERMARK(inst) <= _ESAI_FIFO_DEPTH(inst), \
755763
"invalid TX watermark value"); \
@@ -806,6 +814,7 @@ static struct esai_config esai_config_##inst = { \
806814
.clock_cfg = clock_cfg_##inst, \
807815
.clock_cfg_size = ARRAY_SIZE(clock_cfg_##inst), \
808816
.clk_data = ESAI_CLOCK_DATA_DECLARE(inst), \
817+
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(inst), \
809818
}; \
810819
\
811820
static struct esai_data esai_data_##inst = { \

drivers/dai/nxp/esai/esai.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <zephyr/device.h>
1313
#include <zephyr/dt-bindings/dai/esai.h>
1414
#include <zephyr/drivers/clock_control.h>
15+
#include <zephyr/drivers/pinctrl.h>
1516

1617
#include <fsl_esai.h>
1718

@@ -218,6 +219,7 @@ struct esai_config {
218219
uint32_t *clock_cfg;
219220
uint32_t clock_cfg_size;
220221
struct esai_clock_data clk_data;
222+
const struct pinctrl_dev_config *pincfg;
221223
};
222224

223225
/* this needs to perfectly match SOF's struct sof_ipc_dai_esai_params */

0 commit comments

Comments
 (0)