Skip to content

module: cadence: rework module to use sink/source api#10792

Open
softwarecki wants to merge 1 commit into
thesofproject:mainfrom
softwarecki:p20-cadence
Open

module: cadence: rework module to use sink/source api#10792
softwarecki wants to merge 1 commit into
thesofproject:mainfrom
softwarecki:p20-cadence

Conversation

@softwarecki
Copy link
Copy Markdown
Collaborator

Rework the cadence ipc3 module variant to only use the sink/source api to prepare sof for the full transition to pipeline 2.0.

Make cadence_copy_data_from_buffer() shared across both ipc3 and ipc4 variants. Add a common cadence_copy_data_to_buffer() function. Remove the unnecessary const modifier from sink_buffer_start and eliminate redundant type casts.

Rework the cadence ipc3 module variant to only use the sink/source api to
prepare sof for the full transition to pipeline 2.0.

Make cadence_copy_data_from_buffer() shared across both ipc3 and ipc4
variants. Add a common cadence_copy_data_to_buffer() function. Remove the
unnecessary const modifier from sink_buffer_start and eliminate redundant
type casts.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reworks the Cadence codec module (IPC3 variant) to use the sink/source APIs (aligning with the pipeline 2.0 transition), and consolidates ring-buffer wrap copy logic into shared helpers used by both IPC3 and IPC4 variants.

Changes:

  • Added shared ring-buffer copy helpers cadence_copy_data_from_buffer() and cadence_copy_data_to_buffer() to remove duplicated wrap-handling logic.
  • Converted IPC3 Cadence processing to the sink/source .process interface (instead of the deprecated .process_raw_data interface).
  • Simplified IPC4 output copy path to use the new shared helper and adjusted sink_buffer_start mutability.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/include/sof/audio/module_adapter/module/cadence.h Declares new shared ring-buffer copy helper APIs.
src/audio/module_adapter/module/cadence.c Implements the shared ring-buffer copy helper functions.
src/audio/module_adapter/module/cadence_ipc4.c Removes local copy helper and uses the shared helper for sink writes.
src/audio/module_adapter/module/cadence_ipc3.c Switches to sink/source .process API and updates data movement to use shared helpers.

Comment on lines +243 to 257
ret = source_get_data(sources[0], codec->mpd.in_buff_size, &src_ptr,
(const void **)&source_buffer_start, &src_bytes);
if (ret) {
comp_err(dev, "cannot get data from source buffer");
return ret;
}

cadence_copy_data_from_buffer(codec->mpd.in_buff, src_ptr,
codec->mpd.in_buff_size, src_bytes,
source_buffer_start);
codec->mpd.avail = codec->mpd.in_buff_size;

ret = cadence_codec_init_process(mod);
if (ret)
return ret;
Comment on lines +293 to +294
ret = sink_get_buffer(sinks[0], codec->mpd.produced, &sink_ptr, &sink_buffer_start,
&sink_bytes);
Comment on lines 492 to +497
void *sink_ptr;
size_t sink_bytes;
uint8_t const *sink_buffer_start;
uint8_t *sink_buffer_start;

ret = sink_get_buffer(sinks[0], codec->mpd.produced, &sink_ptr,
(void **)&sink_buffer_start, &sink_bytes);
ret = sink_get_buffer(sinks[0], codec->mpd.produced, &sink_ptr, &sink_buffer_start,
&sink_bytes);
Comment on lines +111 to +113
size_t buffer_size, uint8_t const *buffer_start);
void cadence_copy_data_to_buffer(void *buffer_ptr, size_t bytes_to_copy,
size_t buffer_size, uint8_t *buffer_start,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants