drivers/i2s: stm32: use new pinctrl API
Use the new pinctrl API to configure pins. Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
parent
895e1ddb69
commit
79943f647f
3 changed files with 7 additions and 21 deletions
|
@ -15,7 +15,7 @@
|
||||||
#include <stm32_ll_spi.h>
|
#include <stm32_ll_spi.h>
|
||||||
#include <drivers/clock_control/stm32_clock_control.h>
|
#include <drivers/clock_control/stm32_clock_control.h>
|
||||||
#include <drivers/clock_control.h>
|
#include <drivers/clock_control.h>
|
||||||
#include <pinmux/pinmux_stm32.h>
|
#include <drivers/pinctrl.h>
|
||||||
|
|
||||||
#include "i2s_ll_stm32.h"
|
#include "i2s_ll_stm32.h"
|
||||||
#include <logging/log.h>
|
#include <logging/log.h>
|
||||||
|
@ -669,9 +669,7 @@ static int i2s_stm32_initialize(const struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Configure dt provided device signals when available */
|
/* Configure dt provided device signals when available */
|
||||||
ret = stm32_dt_pinctrl_configure(cfg->pinctrl_list,
|
ret = pinctrl_apply_state(cfg->pcfg, PINCTRL_STATE_DEFAULT);
|
||||||
cfg->pinctrl_list_size,
|
|
||||||
(uint32_t)cfg->i2s);
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOG_ERR("I2S pinctrl setup failed (%d)", ret);
|
LOG_ERR("I2S pinctrl setup failed (%d)", ret);
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -893,11 +891,11 @@ static const struct device *get_dev_from_tx_dma_channel(uint32_t dma_channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define I2S_INIT(index, clk_sel) \
|
#define I2S_INIT(index, clk_sel) \
|
||||||
static const struct soc_gpio_pinctrl i2s_pins_##index[] = \
|
|
||||||
ST_STM32_DT_PINCTRL(i2s##index, 0);\
|
|
||||||
\
|
\
|
||||||
static void i2s_stm32_irq_config_func_##index(const struct device *dev);\
|
static void i2s_stm32_irq_config_func_##index(const struct device *dev);\
|
||||||
\
|
\
|
||||||
|
PINCTRL_DT_DEFINE(DT_NODELABEL(i2s##index)) \
|
||||||
|
\
|
||||||
static const struct i2s_stm32_cfg i2s_stm32_config_##index = { \
|
static const struct i2s_stm32_cfg i2s_stm32_config_##index = { \
|
||||||
.i2s = (SPI_TypeDef *) DT_REG_ADDR(DT_NODELABEL(i2s##index)), \
|
.i2s = (SPI_TypeDef *) DT_REG_ADDR(DT_NODELABEL(i2s##index)), \
|
||||||
.pclken = { \
|
.pclken = { \
|
||||||
|
@ -905,8 +903,7 @@ static const struct i2s_stm32_cfg i2s_stm32_config_##index = { \
|
||||||
.bus = DT_CLOCKS_CELL(DT_NODELABEL(i2s##index), bus), \
|
.bus = DT_CLOCKS_CELL(DT_NODELABEL(i2s##index), bus), \
|
||||||
}, \
|
}, \
|
||||||
.i2s_clk_sel = CLK_SEL_##clk_sel, \
|
.i2s_clk_sel = CLK_SEL_##clk_sel, \
|
||||||
.pinctrl_list = i2s_pins_##index, \
|
.pcfg = PINCTRL_DT_DEV_CONFIG_GET(DT_NODELABEL(i2s##index)), \
|
||||||
.pinctrl_list_size = ARRAY_SIZE(i2s_pins_##index), \
|
|
||||||
.irq_config = i2s_stm32_irq_config_func_##index, \
|
.irq_config = i2s_stm32_irq_config_func_##index, \
|
||||||
}; \
|
}; \
|
||||||
\
|
\
|
||||||
|
|
|
@ -72,8 +72,7 @@ struct i2s_stm32_cfg {
|
||||||
SPI_TypeDef *i2s;
|
SPI_TypeDef *i2s;
|
||||||
struct stm32_pclken pclken;
|
struct stm32_pclken pclken;
|
||||||
uint32_t i2s_clk_sel;
|
uint32_t i2s_clk_sel;
|
||||||
const struct soc_gpio_pinctrl *pinctrl_list;
|
const struct pinctrl_dev_config *pcfg;
|
||||||
size_t pinctrl_list_size;
|
|
||||||
void (*irq_config)(const struct device *dev);
|
void (*irq_config)(const struct device *dev);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ description: STM32 I2S controller
|
||||||
|
|
||||||
compatible: "st,stm32-i2s"
|
compatible: "st,stm32-i2s"
|
||||||
|
|
||||||
include: [i2s-controller.yaml]
|
include: [i2s-controller.yaml, pinctrl-device.yaml]
|
||||||
|
|
||||||
properties:
|
properties:
|
||||||
reg:
|
reg:
|
||||||
|
@ -19,13 +19,3 @@ properties:
|
||||||
|
|
||||||
dma-names:
|
dma-names:
|
||||||
required: true
|
required: true
|
||||||
|
|
||||||
pinctrl-0:
|
|
||||||
type: phandles
|
|
||||||
required: false
|
|
||||||
description: |
|
|
||||||
Pin configuration for I2S signals.
|
|
||||||
We expect that the phandles will reference pinctrl nodes.
|
|
||||||
|
|
||||||
For example the I2S1 would be:
|
|
||||||
pinctrl-0 = <&i2s1_ck_pa5 &i2s1_sd_pa7>;
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue