Skip to content

Commit 39df3dc

Browse files
committed
drivers: i2s: esp32: fix redundant pin configuration
Moves the pinctrl_apply_state() call to avoid calling it twice Signed-off-by: Marcio Ribeiro <[email protected]>
1 parent f6858b6 commit 39df3dc

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/i2s/i2s_esp32.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,6 @@ static int i2s_esp32_initialize(const struct device *dev)
769769
#if !SOC_GDMA_SUPPORTED
770770
const i2s_hal_context_t *hal = &(dev_cfg->hal);
771771
#endif /* !SOC_GDMA_SUPPORTED */
772-
773772
if (!device_is_ready(clk_dev)) {
774773
LOG_ERR("clock control device not ready");
775774
return -ENODEV;
@@ -849,6 +848,12 @@ static int i2s_esp32_initialize(const struct device *dev)
849848
i2s_ll_clear_intr_status(hal->dev, I2S_INTR_MAX);
850849
#endif /* !SOC_GDMA_SUPPORTED */
851850

851+
err = pinctrl_apply_state(dev_cfg->pcfg, PINCTRL_STATE_DEFAULT);
852+
if (err < 0) {
853+
LOG_ERR("Pins setup failed: %d", err);
854+
return -EIO;
855+
}
856+
852857
LOG_DBG("%s initialized", dev->name);
853858

854859
return 0;
@@ -1044,11 +1049,6 @@ static int i2s_esp32_configure_dir(const struct device *dev, enum i2s_dir dir,
10441049
#endif /* I2S_ESP32_IS_DIR_EN(rx) */
10451050
}
10461051

1047-
err = pinctrl_apply_state(dev_cfg->pcfg, PINCTRL_STATE_DEFAULT);
1048-
if (err < 0) {
1049-
LOG_ERR("Pins setup failed: %d", err);
1050-
return -EIO;
1051-
}
10521052

10531053
memcpy(&stream->data->i2s_cfg, i2s_cfg, sizeof(struct i2s_config));
10541054

0 commit comments

Comments
 (0)