Skip to content
Merged
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
16 changes: 15 additions & 1 deletion src/audio/copier/copier.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <rtos/interrupt.h>
#include <sof/ipc/msg.h>
#include <sof/ipc/topology.h>
#include <sof/schedule/ll_schedule_domain.h>
#include <rtos/interrupt.h>
Comment on lines 13 to 17

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Not part of this PR.

#include <rtos/timer.h>
#include <rtos/cache.h>
Expand Down Expand Up @@ -838,7 +839,9 @@ __cold static int set_chmap(struct comp_dev *dev, const void *data, size_t data_
pcm_converter_func process;
pcm_converter_func converters[IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT];
int i;
#ifndef CONFIG_SOF_USERSPACE_LL
uint32_t irq_flags;
#endif

assert_can_be_cold();

Expand Down Expand Up @@ -892,15 +895,26 @@ __cold static int set_chmap(struct comp_dev *dev, const void *data, size_t data_
}
}

/* Atomically update chmap, process and converters */
/* Atomically update chmap, process and converters.
* In user-space builds irq_local_disable() is privileged,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

irq_local_disable() is privileged in all builds ;-)

* use the LL scheduler lock instead.
*/
#ifdef CONFIG_SOF_USERSPACE_LL
user_ll_lock_sched(dev->pipeline->core);
#else
irq_local_disable(irq_flags);
#endif

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

does it actually make sense to change the copier channel map while it's already processing data? If not, if this function should only run when there's no active streaming taking place, maybe we could just put a status check in the beginning of this function and avoid locking entirely?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

That channel-map functionality was added to support the posture feature. During playback, a user can rotate the tablet by 180 degrees, and the driver sends an IPC message with an updated channel map to switch the channels. This function is called from the IPC thread and can be preempted by an LL thread; hence, the lock.


cd->dd[0]->chmap = chmap_cfg->channel_map;
cd->dd[0]->process = process;
for (i = 0; i < IPC4_COPIER_MODULE_OUTPUT_PINS_COUNT; i++)
cd->converter[i] = converters[i];

#ifdef CONFIG_SOF_USERSPACE_LL
user_ll_unlock_sched(dev->pipeline->core);
#else
irq_local_enable(irq_flags);
#endif

return 0;
}
Expand Down
Loading