drivers: i2s: Introduce the I2S_DIR_BOTH enumeration value
Introduce a new enumeration value that allows setting configuration and triggering commands for both I2S streams simultaneously. Such possibility is especially important on hardware where the streams can be only enabled/disabled (but not started/stopped) independently, like it is in nRF SoCs. Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
parent
a687610b80
commit
e4c7f4d62a
6 changed files with 31 additions and 2 deletions
|
@ -642,6 +642,10 @@ static int i2s_cavs_trigger(const struct device *dev, enum i2s_dir dir,
|
|||
unsigned int key;
|
||||
int ret = 0;
|
||||
|
||||
if (dir == I2S_DIR_BOTH) {
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
strm = (dir == I2S_DIR_TX) ? &dev_data->tx : &dev_data->rx;
|
||||
|
||||
key = irq_lock();
|
||||
|
|
|
@ -351,6 +351,8 @@ static int i2s_litex_configure(const struct device *dev, enum i2s_dir dir,
|
|||
stream = &dev_data->tx;
|
||||
channels_concatenated = litex_read8(I2S_TX_STATUS_REG) &
|
||||
I2S_TX_STAT_CHANNEL_CONCATENATED_MASK;
|
||||
} else if (dir == I2S_DIR_BOTH) {
|
||||
return -ENOSYS;
|
||||
} else {
|
||||
LOG_ERR("either RX or TX direction must be selected");
|
||||
return -EINVAL;
|
||||
|
@ -498,6 +500,8 @@ static int i2s_litex_trigger(const struct device *dev, enum i2s_dir dir,
|
|||
stream = &dev_data->rx;
|
||||
} else if (dir == I2S_DIR_TX) {
|
||||
stream = &dev_data->tx;
|
||||
} else if (dir == I2S_DIR_BOTH) {
|
||||
return -ENOSYS;
|
||||
} else {
|
||||
LOG_ERR("either RX or TX direction must be selected");
|
||||
return -EINVAL;
|
||||
|
|
|
@ -193,6 +193,8 @@ static int i2s_stm32_configure(const struct device *dev, enum i2s_dir dir,
|
|||
stream = &dev_data->rx;
|
||||
} else if (dir == I2S_DIR_TX) {
|
||||
stream = &dev_data->tx;
|
||||
} else if (dir == I2S_DIR_BOTH) {
|
||||
return -ENOSYS;
|
||||
} else {
|
||||
LOG_ERR("Either RX or TX direction must be selected");
|
||||
return -EINVAL;
|
||||
|
@ -296,6 +298,8 @@ static int i2s_stm32_trigger(const struct device *dev, enum i2s_dir dir,
|
|||
stream = &dev_data->rx;
|
||||
} else if (dir == I2S_DIR_TX) {
|
||||
stream = &dev_data->tx;
|
||||
} else if (dir == I2S_DIR_BOTH) {
|
||||
return -ENOSYS;
|
||||
} else {
|
||||
LOG_ERR("Either RX or TX direction must be selected");
|
||||
return -EINVAL;
|
||||
|
|
|
@ -185,6 +185,8 @@ static int i2s_mcux_configure(const struct device *dev, enum i2s_dir dir,
|
|||
stream = &dev_data->rx;
|
||||
} else if (dir == I2S_DIR_TX) {
|
||||
stream = &dev_data->tx;
|
||||
} else if (dir == I2S_DIR_BOTH) {
|
||||
return -ENOSYS;
|
||||
} else {
|
||||
LOG_ERR("Either RX or TX direction must be selected");
|
||||
return -EINVAL;
|
||||
|
@ -643,6 +645,8 @@ static int i2s_mcux_trigger(const struct device *dev, enum i2s_dir dir,
|
|||
stream = &dev_data->rx;
|
||||
} else if (dir == I2S_DIR_TX) {
|
||||
stream = &dev_data->tx;
|
||||
} else if (dir == I2S_DIR_BOTH) {
|
||||
return -ENOSYS;
|
||||
} else {
|
||||
LOG_ERR("Either RX or TX direction must be selected");
|
||||
return -EINVAL;
|
||||
|
|
|
@ -551,6 +551,8 @@ static int i2s_sam_configure(const struct device *dev, enum i2s_dir dir,
|
|||
stream = &dev_data->rx;
|
||||
} else if (dir == I2S_DIR_TX) {
|
||||
stream = &dev_data->tx;
|
||||
} else if (dir == I2S_DIR_BOTH) {
|
||||
return -ENOSYS;
|
||||
} else {
|
||||
LOG_ERR("Either RX or TX direction must be selected");
|
||||
return -EINVAL;
|
||||
|
@ -763,6 +765,8 @@ static int i2s_sam_trigger(const struct device *dev, enum i2s_dir dir,
|
|||
stream = &dev_data->rx;
|
||||
} else if (dir == I2S_DIR_TX) {
|
||||
stream = &dev_data->tx;
|
||||
} else if (dir == I2S_DIR_BOTH) {
|
||||
return -ENOSYS;
|
||||
} else {
|
||||
LOG_ERR("Either RX or TX direction must be selected");
|
||||
return -EINVAL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue