drivers: i2s: nrfx: drop -pin support

Driver will now use pinctrl.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2023-02-21 13:31:20 +01:00 committed by Marti Bolivar
commit a8efe38c43
2 changed files with 19 additions and 82 deletions

View file

@ -41,9 +41,7 @@ struct i2s_nrfx_drv_data {
struct i2s_nrfx_drv_cfg {
nrfx_i2s_data_handler_t data_handler;
nrfx_i2s_config_t nrfx_def_cfg;
#ifdef CONFIG_PINCTRL
const struct pinctrl_dev_config *pcfg;
#endif
enum clock_source {
PCLK32M,
PCLK32M_HFXO,
@ -879,13 +877,10 @@ static const struct i2s_driver_api i2s_nrf_drv_api = {
};
#define I2S(idx) DT_NODELABEL(i2s##idx)
#define I2S_PIN(idx, name) DT_PROP_OR(I2S(idx), name##_pin, \
NRFX_I2S_PIN_NOT_USED)
#define I2S_CLK_SRC(idx) DT_STRING_TOKEN(I2S(idx), clock_source)
#define I2S_NRFX_DEVICE(idx) \
NRF_DT_CHECK_PIN_ASSIGNMENTS(I2S(idx), 0, sck_pin, lrck_pin, \
mck_pin, sdout_pin, sdin_pin); \
NRF_DT_CHECK_PIN_ASSIGNMENTS(I2S(idx), 0); \
static void *tx_msgs##idx[CONFIG_I2S_NRFX_TX_BLOCK_COUNT]; \
static void *rx_msgs##idx[CONFIG_I2S_NRFX_RX_BLOCK_COUNT]; \
static struct i2s_nrfx_drv_data i2s_nrfx_data##idx = { \
@ -895,14 +890,12 @@ static const struct i2s_driver_api i2s_nrf_drv_api = {
{ \
IRQ_CONNECT(DT_IRQN(I2S(idx)), DT_IRQ(I2S(idx), priority), \
nrfx_isr, nrfx_i2s_irq_handler, 0); \
IF_ENABLED(CONFIG_PINCTRL, ( \
const struct i2s_nrfx_drv_cfg *drv_cfg = dev->config;\
int err = pinctrl_apply_state(drv_cfg->pcfg, \
PINCTRL_STATE_DEFAULT);\
if (err < 0) { \
return err; \
} \
)) \
const struct i2s_nrfx_drv_cfg *drv_cfg = dev->config; \
int err = pinctrl_apply_state(drv_cfg->pcfg, \
PINCTRL_STATE_DEFAULT); \
if (err < 0) { \
return err; \
} \
k_msgq_init(&i2s_nrfx_data##idx.tx_queue, \
(char *)tx_msgs##idx, sizeof(void *), \
ARRAY_SIZE(tx_msgs##idx)); \
@ -917,18 +910,18 @@ static const struct i2s_driver_api i2s_nrf_drv_api = {
{ \
data_handler(DEVICE_DT_GET(I2S(idx)), p_released, status); \
} \
IF_ENABLED(CONFIG_PINCTRL, (PINCTRL_DT_DEFINE(I2S(idx)))); \
PINCTRL_DT_DEFINE(I2S(idx)); \
static const struct i2s_nrfx_drv_cfg i2s_nrfx_cfg##idx = { \
.data_handler = data_handler##idx, \
.nrfx_def_cfg = NRFX_I2S_DEFAULT_CONFIG(I2S_PIN(idx, sck), \
I2S_PIN(idx, lrck), \
I2S_PIN(idx, mck), \
I2S_PIN(idx, sdout), \
I2S_PIN(idx, sdin)), \
IF_ENABLED(CONFIG_PINCTRL, \
(.nrfx_def_cfg.skip_gpio_cfg = true, \
.nrfx_def_cfg.skip_psel_cfg = true, \
.pcfg = PINCTRL_DT_DEV_CONFIG_GET(I2S(idx)),)) \
.nrfx_def_cfg = NRFX_I2S_DEFAULT_CONFIG( \
NRFX_I2S_PIN_NOT_USED, \
NRFX_I2S_PIN_NOT_USED, \
NRFX_I2S_PIN_NOT_USED, \
NRFX_I2S_PIN_NOT_USED, \
NRFX_I2S_PIN_NOT_USED), \
.nrfx_def_cfg.skip_gpio_cfg = true, \
.nrfx_def_cfg.skip_psel_cfg = true, \
.pcfg = PINCTRL_DT_DEV_CONFIG_GET(I2S(idx)), \
.clk_src = I2S_CLK_SRC(idx), \
}; \
BUILD_ASSERT(I2S_CLK_SRC(idx) != ACLK || NRF_I2S_HAS_CLKCONFIG, \

View file

@ -14,64 +14,8 @@ properties:
interrupts:
required: true
sck-pin:
type: int
deprecated: true
description: |
IMPORTANT: This option will only be used if the new pin control driver
is not enabled.
The SCK pin to use.
For pins P0.0 through P0.31, use the pin number. For example,
to use P0.16 for SCK, set:
sck-pin = <16>;
For pins P1.0 through P1.31, add 32 to the pin number. For
example, to use P1.2 for SCK, set:
sck-pin = <34>; /* 32 + 2 */
lrck-pin:
type: int
deprecated: true
description: |
IMPORTANT: This option will only be used if the new pin control driver
is not enabled.
The LRCK pin to use. The pin numbering scheme is the same as
the sck-pin property's.
sdout-pin:
type: int
deprecated: true
description: |
IMPORTANT: This option will only be used if the new pin control driver
is not enabled.
The SDOUT pin to use. The pin numbering scheme is the same as
the sck-pin property's.
sdin-pin:
type: int
deprecated: true
description: |
IMPORTANT: This option will only be used if the new pin control driver
is not enabled.
The SDIN pin to use. The pin numbering scheme is the same as
the sck-pin property's.
mck-pin:
type: int
deprecated: true
description: |
IMPORTANT: This option will only be used if the new pin control driver
is not enabled.
The MCK pin to use. The pin numbering scheme is the same as
the sck-pin property's.
pinctrl-0:
required: true
clock-source:
type: string