audio: dai-zephyr: rework calls to DMA driver, remove channel pointer#10767
audio: dai-zephyr: rework calls to DMA driver, remove channel pointer#10767kv2019i wants to merge 4 commits into
Conversation
|
Similar to previously done change for host-zephyr.c in #10721 |
There was a problem hiding this comment.
Pull request overview
This PR simplifies dai-zephyr DMA channel handling by removing the stored DMA channel pointer and keeping only the DMA channel index, then updating DMA driver calls to use that index.
Changes:
- Replaced
struct dai_data::chanwithchan_indexand updated call sites accordingly. - Updated DAI DMA stop/release and position/status queries to use
chan_index. - Removed per-channel
dev_datahandling associated with the removed channel pointer.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
src/ipc/ipc4/dai.c |
Switches IPC4 DAI DMA release/config/position code paths to use chan_index instead of a channel pointer. |
src/include/sof/lib/dai-zephyr.h |
Replaces struct dai_data *chan with int chan_index. |
src/audio/dai-zephyr.c |
Updates DMA config/prepare/trigger/copy/status paths to use chan_index and dd->dma directly. |
|
In my opinion we should treat any negative value as "no channel". This simplifies the code compared to checking against a specific constant, makes it safer for future changes and more consistent. The channel id value comes from |
Ack - and I think historically 0 is also a valid channel number used in the HW DMA specs so negative better. |
|
@softwarecki wrote:
Ack, this was actually @abonislawski 's idea to use Zephyr DMA API error values directly. But makes sense to continue and check for a negative value, will change in V2. |
97983d0 to
b271352
Compare
|
V2 pushed:
|
|
@kv2019i btw, some build errors: |
|
Back to draft, this needs more work to fix IPC3 builds (dai-zephyr.c is shared and needs to work with both IPC3 and IPC4 dai code). |
b271352 to
e6bc02b
Compare
|
V3 pushed:
|
e6bc02b to
39e334e
Compare
When SOF is built in library mode, the IPC dai integration can be left out. It's not currently needed by any library build users (like testbench), and building the code requires either Zephyr DAI driver, or old XTOS DAI driver definitions. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Remove old code to support IPC4 use with non-Zephyr DAI and DMA drivers. This code was used to transition to Zephyr, but now all active users of IPC4 have moved to native Zephyr drivers, so there are no users for this code left. Add a Kconfig dependency to native driver support. Alternatively IPC4 can be built with CONFIG_LIBRARY. In this case the IPC DAI integration is not part of the library build. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
For historical reasons, dai-zephyr has somewhat complicated code to manage the DMA channel instance information. When a DMA channel is allocated, a pointer to the system DMA channel table is acquired and some additional information is stored per channel. This is however redundant as the only piece of information actually needed is the channel index. Simplify the code by not storing the channel pointer anymore, but rather just store the channel index and use that in all calls to the DMA driver. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Align host-zephyr.c with dai-zephry.c and consider any negative value as an invalid DMA channel. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
39e334e to
315508f
Compare
|
V4 and V5 pushed:
|
For historical reasons, dai-zephyr has somewhat complicated code to manage the DMA channel instance information. When a DMA channel is allocated, a pointer to the system DMA channel table is acquired and some additional information is stored per channel. This is however redundant as the only piece of information actually needed is the channel index.
Simplify the code by not storing the channel pointer anymore, but rather just store the channel index and use that in all calls to the DMA driver.