Commit graph

22 commits

Author SHA1 Message Date
Tom Burdick 4180d70439 dma: Fix error_callback enable/disable confusion
Previously the logic was inverted for error_callback_en where 0 was
enablement and 1 was disable. This was likely done so that the default,
sensibly so, was to enable the error callback if possible. A variety of
in tree users had confused the enable/disable value.

Change the name of the flag to error_callback_dis where the default
remains 0 (do not disable the callback!) and correct in tree uses of the
flag where it seemed incorrect.

Signed-off-by: Tom Burdick <thomas.burdick@intel.com>
2024-04-11 17:08:10 -04:00
Daniel DeGrasse 5808018b05 drivers: i2s: i2s_mcux_flexcomm: Guard use of I2S_EnableSecondaryChannel
Guard use of I2S_EnableSecondaryChannel behind the SDK feature macro
that determines if this support is available, since when this macro is
not defined the SDK function is not implemented.

Fixes #68136

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-01-26 19:41:03 +01:00
Daniel DeGrasse c8dfdda027 drivers: i2s: i2s_mcux_flexcomm: support additional channels and formats
Add support for more than 2 I2S channels to the I2S Flexcomm driver.
Additionally, remove comment stating I2S PCM and Left justified formats
are not supported, as these formats are now validated to function
correctly.

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2024-01-25 16:01:14 +00:00
Mahesh Mahadevan 7d12d654db drivers: i2s: Set DMA complete_callback flag
The MCUX LPC DMA driver now recognizes the compelete_callback
flag. Set this flag so we receive an interrupt after completion
of every block.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-12-14 09:28:38 +01:00
Mike J. Chen 1200fce75c drivers: i2s: mcux_flexcomm: Change LOG_INF to LOG_DBG in init
Reduce log verboseness during init.

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-11-14 20:59:35 -06:00
Carles Cufi 8c748fd005 kernel: Modify the signature of k_mem_slab_free()
Modify the signature of the k_mem_slab_free() function with a new one,
replacing the old void **mem with void *mem as a parameter.

The following function:
void k_mem_slab_free(struct k_mem_slab *slab, void **mem);

has the wrong signature. mem is only used as a regular pointer, so there
is no need to use a double-pointer. The correct signature should be:
void k_mem_slab_free(struct k_mem_slab *slab, void *mem);

The issue with the current signature, although functional, is that it is
extremely confusing. I myself, a veteran Zephyr developer, was confused
by this parameter when looking at it recently.

All in-tree uses of the function have been adapted.

Fixes #61888.

Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
2023-09-03 18:20:59 -04:00
Mike J. Chen f882d31ea7 drivers: i2s: mcux_flexcomm: fix multiple bugs
Fix for bugs described in:
https://github.com/zephyrproject-rtos/zephyr/issues/59803

1. the size argument passed to i2s_write() was being ignored.
   change the code so that the size is queued with the
   tx mem_block and the dma transfer is configured with this
   size.

2. change how CONFIG_I2S_MCUX_FLEXCOMM_RX_BLOCK_COUNT and
   CONFIG_I2S_MCUX_FLEXCOMM_TX_BLOCK_COUNT are used so that
   the queue buffers are allocated correctly when the two
   config values are not the same

3. set source_data_size and dest_data_size to be the same
   since the DMA controller can only set one size per
   DMA transfer. the driver was already computing a dest_data_size
   but always passing 1 for the source_data_size.
   For I2S RX case, I think source_data_size should be
   set to the expected FIFO read size instead of dest_data_size.

Also some smaller improvements like:
* don't allocate two dma_blocks for tx in the static dev_mem
  when it only needs one
* memset both rx_dma_blocks together instead of separtely
* set dma_cfg block_count for tx and rx statically instead
  of at runtime

Signed-off-by: Mike J. Chen <mjchen@google.com>
2023-07-19 10:36:23 -05:00
Mahesh Mahadevan 0260d6daa4 drivers: mcux_i2s: Use the DMA reload flag
Use the DMA reload flag to indicate we wish to use
a circular chain of DMA descriptors to reload DMA
receive buffers.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2023-05-26 10:05:24 -04:00
Declan Snyder 0dafeed054 drivers: i2s_mcux_flexcomm: Fix instance macro
Driver init should be using instance based macros,
not nodelabels numbering, there is no guarantee
about which nodes will be assigned which instance numbers.

Signed-off-by: Declan Snyder <declan.snyder@nxp.com>
2023-05-12 06:21:13 -05:00
Cyril Fougeray 1be72d9888 dma: callback with 2 status codes for successful transfers
Make use of positive status values in the DMA callback to pass
info to the DMA client after a successful DMA operation.
A completed DMA transfer uses the status 0 while a reached
water mark uses the status 1.

Signed-off-by: Cyril Fougeray <cyril.fougeray@worldcoin.org>
2023-05-08 09:57:32 +02:00
Gerard Marull-Paretas 989d103d53 drivers: all: mcux: remove conditional support for pinctrl
The MCUX platform always uses pinctrl, there's no need to keep extra
macrology around pinctrl. Also updated driver's Kconfig options to
`select PINCTRL` (note that some already did).

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 13:34:22 +02:00
Gerard Marull-Paretas 178bdc4afc include: add missing zephyr/irq.h include
Change automated searching for files using "IRQ_CONNECT()" API not
including <zephyr/irq.h>.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-17 22:57:39 +09:00
Henrik Brix Andersen 2e1f25f355 drivers: i2s: check if clock device is ready before accessing
Add check for device_is_ready() before accessing clock control devices.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2022-08-09 17:16:16 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Daniel DeGrasse e4becf1c7b 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>
2022-04-06 20:57:22 -07:00
Tomasz Bursztyka 16062c2e5a drivers: constify all device instances
Run cocci script to constify device instances.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-16 12:33:12 +01:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Maureen Helm c3ae364467 drivers: i2s: Refactor drivers to use shared init priority
Refactors the remaining I2S drivers to use the shared driver class
initialization priority configuration, CONFIG_I2S_INIT_PRIORITY, to
allow configuring I2S drivers separately from other devices. This is
similar to other driver classes.

The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEVICE to be
consistent with other driver classes.

Signed-off-by: Maureen Helm <maureen.helm@intel.com>
2022-03-14 10:37:28 -04:00
Andrzej Głąbek 7fcf78073b drivers: i2s: Add missing const qualifiers
The i2s_config structure passed to the i2s_configure() function is
not supposed to be modified by the driver. Similarly, the structure
returned by the i2s_config_get() function is not supposed to be
modified outside the driver.
Decorate the pointers to those structures with the const qualifier
and correct one driver that actually modified the structure passed
to i2s_configure().

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2021-05-03 19:57:49 -04:00
Andrzej Głąbek e4c7f4d62a 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>
2021-05-03 19:57:49 -04:00
Mahesh Mahadevan 478822f74c drivers: i2s: Do not support 8-bit word size in LPC I2S driver
The memory block passed by the user to the i2s_write function is
tightly packed next to each other.
However for 8-bit word_size the I2S hardware expects the data
to be in 2bytes which does not match what is passed by the user.
This will be addressed in a separate PR once the zephyr API committee
finalizes on an I2S API for the user to probe hardware variations.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-04-30 12:02:55 -05:00
Mahesh Mahadevan 712317c2e3 drivers: i2s: Add support for I2S driver for LPC devices
This uses the API's provided by the SDK I2S driver.

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2021-04-30 12:02:55 -05:00