Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions src/audio/volume/volume.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <sof/common.h>
#include <rtos/panic.h>
#include <sof/ipc/msg.h>
#include <rtos/alloc.h>
#include <rtos/init.h>
#include <sof/lib/cpu.h>
#include <sof/lib/uuid.h>
Expand Down Expand Up @@ -776,9 +775,9 @@ static int volume_free(struct processing_module *mod)

comp_dbg(mod->dev, "volume_free()");

volume_peak_free(cd);
rfree(cd->vol);
rfree(cd);
volume_peak_free(mod);
mod_free(mod, cd->vol);
mod_free(mod, cd);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/audio/volume/volume.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ void sys_comp_module_volume_interface_init(void);
/* source_or_sink, true means source, false means sink */
void set_volume_process(struct vol_data *cd, struct comp_dev *dev, bool source_or_sink);

void volume_peak_free(struct vol_data *cd);
void volume_peak_free(struct processing_module *mod);

int volume_peak_prepare(struct vol_data *cd, struct processing_module *mod);

Expand Down
13 changes: 6 additions & 7 deletions src/audio/volume/volume_ipc3.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <sof/common.h>
#include <rtos/panic.h>
#include <sof/ipc/msg.h>
#include <rtos/alloc.h>
#include <rtos/init.h>
#include <sof/lib/cpu.h>
#include <sof/lib/uuid.h>
Expand Down Expand Up @@ -81,17 +80,17 @@ int volume_init(struct processing_module *mod)
return -EINVAL;
}

cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(struct vol_data));
cd = mod_zalloc(mod, sizeof(struct vol_data));
if (!cd)
return -ENOMEM;

/*
* malloc memory to store current volume 4 times to ensure the address
* is 8-byte aligned for multi-way xtensa intrinsic operations.
*/
cd->vol = rmalloc(SOF_MEM_FLAG_USER, vol_size);
cd->vol = mod_alloc(mod, vol_size);
if (!cd->vol) {
rfree(cd);
mod_free(mod, cd);
comp_err(dev, "Failed to allocate %zu", vol_size);
return -ENOMEM;
}
Expand Down Expand Up @@ -158,8 +157,8 @@ int volume_init(struct processing_module *mod)
break;
default:
comp_err(dev, "invalid ramp type %d", vol->ramp);
rfree(cd);
rfree(cd->vol);
mod_free(mod, cd);
mod_free(mod, cd->vol);
return -EINVAL;
}

Expand All @@ -168,7 +167,7 @@ int volume_init(struct processing_module *mod)
return 0;
}

void volume_peak_free(struct vol_data *cd)
void volume_peak_free(struct processing_module *mod)
{
}

Expand Down
18 changes: 9 additions & 9 deletions src/audio/volume/volume_ipc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <sof/common.h>
#include <rtos/panic.h>
#include <sof/ipc/msg.h>
#include <rtos/alloc.h>
#include <rtos/init.h>
#include <sof/lib/cpu.h>
#include <sof/lib/uuid.h>
Expand Down Expand Up @@ -128,28 +127,28 @@ int volume_init(struct processing_module *mod)
return -EINVAL;
}

cd = rzalloc(SOF_MEM_FLAG_USER, sizeof(struct vol_data));
cd = mod_zalloc(mod, sizeof(struct vol_data));
if (!cd)
return -ENOMEM;

/*
* malloc memory to store current volume 4 times to ensure the address
* is 8-byte aligned for multi-way xtensa intrinsic operations.
*/
cd->vol = rmalloc(SOF_MEM_FLAG_USER, vol_size);
cd->vol = mod_alloc(mod, vol_size);
if (!cd->vol) {
rfree(cd);
mod_free(mod, cd);
comp_err(dev, "Failed to allocate %d", vol_size);
return -ENOMEM;
}

/* malloc memory to store temp peak volume 4 times to ensure the address
* is 8-byte aligned for multi-way xtensa intrinsic operations.
*/
cd->peak_vol = rzalloc(SOF_MEM_FLAG_USER, vol_size);
cd->peak_vol = mod_zalloc(mod, vol_size);
if (!cd->peak_vol) {
rfree(cd->vol);
rfree(cd);
mod_free(mod, cd->vol);
mod_free(mod, cd);
comp_err(dev, "Failed to allocate %d for peak_vol", vol_size);
return -ENOMEM;
}
Expand Down Expand Up @@ -189,14 +188,15 @@ int volume_init(struct processing_module *mod)
return 0;
}

void volume_peak_free(struct vol_data *cd)
void volume_peak_free(struct processing_module *mod)
{
struct vol_data *cd = module_get_private_data(mod);
struct ipc4_peak_volume_regs regs;

/* clear mailbox */
memset_s(&regs, sizeof(regs), 0, sizeof(regs));
mailbox_sw_regs_write(cd->mailbox_offset, &regs, sizeof(regs));
rfree(cd->peak_vol);
mod_free(mod, cd->peak_vol);
}

static int volume_set_volume(struct processing_module *mod, const uint8_t *data, int data_size)
Expand Down
Loading