@@ -32,11 +32,6 @@ LOG_MODULE_REGISTER(tdm_nrf, CONFIG_I2S_LOG_LEVEL);
3232 */
3333#define NRFX_TDM_STATUS_TRANSFER_STOPPED BIT(1)
3434
35- /* Due to hardware limitations, the TDM peripheral requires the rx/tx size
36- * to be greater than 8 bytes.
37- */
38- #define NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED 8
39-
4035/* Maximum clock divider value. Corresponds to CKDIV2. */
4136#define NRFX_TDM_MAX_SCK_DIV_VALUE TDM_CONFIG_SCK_DIV_SCKDIV_Max
4237#define NRFX_TDM_MAX_MCK_DIV_VALUE TDM_CONFIG_MCK_DIV_DIV_Max
@@ -480,11 +475,9 @@ static int tdm_nrf_configure(const struct device *dev, enum i2s_dir dir,
480475
481476 __ASSERT_NO_MSG (tdm_cfg -> mem_slab != NULL && tdm_cfg -> block_size != 0 );
482477
483- if ((tdm_cfg -> block_size % sizeof (uint32_t )) != 0 ||
484- tdm_cfg -> block_size <= NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED ) {
485- LOG_ERR ("This device can only transmit full 32-bit words greater than %u bytes." ,
486- NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED );
487- return - EIO ;
478+ if ((tdm_cfg -> block_size % sizeof (uint32_t )) != 0 ) {
479+ LOG_ERR ("This device can transfer only full 32-bit words" );
480+ return - EINVAL ;
488481 }
489482
490483 switch (tdm_cfg -> word_size ) {
@@ -680,18 +673,11 @@ static int tdm_nrf_write(const struct device *dev, void *mem_block, size_t size)
680673 return - EIO ;
681674 }
682675
683- if (size > drv_data -> tx .cfg .block_size ) {
676+ if (size > drv_data -> tx .cfg .block_size || size < sizeof ( uint32_t ) ) {
684677 LOG_ERR ("This device can only write blocks up to %u bytes" ,
685678 drv_data -> tx .cfg .block_size );
686679 return - EIO ;
687680 }
688-
689- if ((size % sizeof (uint32_t )) != 0 || size <= NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED ) {
690- LOG_ERR ("This device can only write full 32-bit words greater than %u bytes." ,
691- NRFX_TDM_MIN_TRANSFER_SIZE_ALLOWED );
692- return - EIO ;
693- }
694-
695681 ret = dmm_buffer_out_prepare (drv_cfg -> mem_reg , buf .mem_block , buf .size ,
696682 (void * * )& buf .dmm_buf );
697683 ret = k_msgq_put (& drv_data -> tx_queue , & buf , SYS_TIMEOUT_MS (drv_data -> tx .cfg .timeout ));
0 commit comments