drivers: i2s: i2s_mcux_flexcomm: add pinctrl support to lpc i2s driver
Add pinctrl support to i2s flexcomm driver for lpc. Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
415b2bdac0
commit
e4becf1c7b
1 changed files with 25 additions and 0 deletions
|
@ -14,6 +14,9 @@
|
||||||
#include <fsl_i2s.h>
|
#include <fsl_i2s.h>
|
||||||
#include <fsl_dma.h>
|
#include <fsl_dma.h>
|
||||||
#include <logging/log.h>
|
#include <logging/log.h>
|
||||||
|
#ifdef CONFIG_PINCTRL
|
||||||
|
#include <drivers/pinctrl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
LOG_MODULE_REGISTER(i2s_mcux_flexcomm);
|
LOG_MODULE_REGISTER(i2s_mcux_flexcomm);
|
||||||
|
|
||||||
|
@ -25,6 +28,9 @@ struct i2s_mcux_config {
|
||||||
const struct device *clock_dev;
|
const struct device *clock_dev;
|
||||||
clock_control_subsys_t clock_subsys;
|
clock_control_subsys_t clock_subsys;
|
||||||
void (*irq_config)(const struct device *dev);
|
void (*irq_config)(const struct device *dev);
|
||||||
|
#ifdef CONFIG_PINCTRL
|
||||||
|
const struct pinctrl_dev_config *pincfg;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct stream {
|
struct stream {
|
||||||
|
@ -824,6 +830,14 @@ static int i2s_mcux_init(const struct device *dev)
|
||||||
{
|
{
|
||||||
const struct i2s_mcux_config *cfg = dev->config;
|
const struct i2s_mcux_config *cfg = dev->config;
|
||||||
struct i2s_mcux_data *const data = dev->data;
|
struct i2s_mcux_data *const data = dev->data;
|
||||||
|
#ifdef CONFIG_PINCTRL
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = pinctrl_apply_state(cfg->pincfg, PINCTRL_STATE_DEFAULT);
|
||||||
|
if (err) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
cfg->irq_config(dev);
|
cfg->irq_config(dev);
|
||||||
|
|
||||||
|
@ -859,6 +873,15 @@ static int i2s_mcux_init(const struct device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CONFIG_PINCTRL
|
||||||
|
#define I2S_MCUX_FLEXCOMM_PINCTRL_DEFINE(id) PINCTRL_DT_INST_DEFINE(id);
|
||||||
|
#define I2S_MCUX_FLEXCOMM_PINCTRL_INIT(id) .pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(id),
|
||||||
|
#else
|
||||||
|
#define I2S_MCUX_FLEXCOMM_PINCTRL_DEFINE(id)
|
||||||
|
#define I2S_MCUX_FLEXCOMM_PINCTRL_INIT(id)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define I2S_DMA_CHANNELS(id) \
|
#define I2S_DMA_CHANNELS(id) \
|
||||||
.tx = { \
|
.tx = { \
|
||||||
.dev_dma = UTIL_AND( \
|
.dev_dma = UTIL_AND( \
|
||||||
|
@ -890,6 +913,7 @@ static int i2s_mcux_init(const struct device *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
#define I2S_MCUX_FLEXCOMM_DEVICE(id) \
|
#define I2S_MCUX_FLEXCOMM_DEVICE(id) \
|
||||||
|
I2S_MCUX_FLEXCOMM_PINCTRL_DEFINE(id) \
|
||||||
static void i2s_mcux_config_func_##id(const struct device *dev); \
|
static void i2s_mcux_config_func_##id(const struct device *dev); \
|
||||||
static const struct i2s_mcux_config i2s_mcux_config_##id = { \
|
static const struct i2s_mcux_config i2s_mcux_config_##id = { \
|
||||||
.base = \
|
.base = \
|
||||||
|
@ -898,6 +922,7 @@ static int i2s_mcux_init(const struct device *dev)
|
||||||
.clock_subsys = \
|
.clock_subsys = \
|
||||||
(clock_control_subsys_t)DT_INST_CLOCKS_CELL(id, name),\
|
(clock_control_subsys_t)DT_INST_CLOCKS_CELL(id, name),\
|
||||||
.irq_config = i2s_mcux_config_func_##id, \
|
.irq_config = i2s_mcux_config_func_##id, \
|
||||||
|
I2S_MCUX_FLEXCOMM_PINCTRL_INIT(id) \
|
||||||
}; \
|
}; \
|
||||||
static struct i2s_mcux_data i2s_mcux_data_##id = { \
|
static struct i2s_mcux_data i2s_mcux_data_##id = { \
|
||||||
I2S_DMA_CHANNELS(id) \
|
I2S_DMA_CHANNELS(id) \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue