mirror of https://github.com/thesofproject/sof.git
kpb: Introduce force_copy_type
Some platforms need to force dma copy_type for reasons
mentioned in
commit 9ba1814d1d
("kpb: change draining copy type to normal")
Some platform's DMA controllers (like dummy-dma on IMX does not support
normal copy type).
So, this patch forces the copy type to normal only when
CONFIG_KPB_FORCE_COPY_TYPE_NORMAL is set, otherwise it keeps the existing dma
copy-type.
Also, add Kconfig entry for KPB_FORCE_COPY_TYPE_NORMAL and set it default to y
to keep bisectability up!
Signed-off-by: Daniel Baluta <daniel.baluta@nxp.com>
This commit is contained in:
parent
d93fbbc279
commit
7e46996c96
|
@ -119,6 +119,16 @@ config COMP_KPB
|
|||
default y
|
||||
help
|
||||
Select for KPB component
|
||||
if COMP_KPB
|
||||
|
||||
config KPB_FORCE_COPY_TYPE_NORMAL
|
||||
bool "KPB force copy type normal"
|
||||
default y
|
||||
help
|
||||
Select this to force the kpb draining copy type to normal.
|
||||
Unselecting this will keep the kpb sink copy type unchanged.
|
||||
|
||||
endif # COMP_KPB
|
||||
|
||||
config COMP_SEL
|
||||
bool "Channel selector component"
|
||||
|
|
|
@ -77,6 +77,7 @@ struct comp_data {
|
|||
bool sync_draining_mode; /**< should we synchronize draining with
|
||||
* host?
|
||||
*/
|
||||
enum comp_copy_type force_copy_type; /**< should we force copy_type on kpb sink? */
|
||||
};
|
||||
|
||||
/*! KPB private functions */
|
||||
|
@ -186,6 +187,12 @@ static struct comp_dev *kpb_new(const struct comp_driver *drv,
|
|||
kpb->kpb_no_of_clients = 0;
|
||||
kpb->state_log = 0;
|
||||
|
||||
#ifdef CONFIG_KPB_FORCE_COPY_TYPE_NORMAL
|
||||
kpb->force_copy_type = COMP_COPY_NORMAL;
|
||||
#else
|
||||
kpb->force_copy_type = -1; /* do not change kpb sink copy type */
|
||||
#endif
|
||||
|
||||
/* Kpb has been created successfully */
|
||||
dev->state = COMP_STATE_READY;
|
||||
kpb_change_state(kpb, KPB_STATE_CREATED);
|
||||
|
@ -1007,7 +1014,6 @@ static void kpb_init_draining(struct comp_dev *dev, struct kpb_client *cli)
|
|||
struct history_buffer *first_buff = buff;
|
||||
size_t buffered = 0;
|
||||
size_t local_buffered;
|
||||
enum comp_copy_type copy_type = COMP_COPY_NORMAL;
|
||||
size_t drain_interval;
|
||||
size_t host_period_size = kpb->host_period_size;
|
||||
size_t ticks_per_ms = clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1);
|
||||
|
@ -1130,9 +1136,13 @@ static void kpb_init_draining(struct comp_dev *dev, struct kpb_client *cli)
|
|||
kpb->draining_task_data.dev = dev;
|
||||
kpb->draining_task_data.sync_mode_on = kpb->sync_draining_mode;
|
||||
|
||||
/* Set host-sink copy mode to blocking */
|
||||
comp_set_attribute(kpb->host_sink->sink, COMP_ATTR_COPY_TYPE,
|
||||
©_type);
|
||||
/* save current sink copy type */
|
||||
comp_get_attribute(kpb->host_sink->sink, COMP_ATTR_COPY_TYPE,
|
||||
&kpb->draining_task_data.copy_type);
|
||||
|
||||
if (kpb->force_copy_type >= 0)
|
||||
comp_set_attribute(kpb->host_sink->sink, COMP_ATTR_COPY_TYPE,
|
||||
&kpb->force_copy_type);
|
||||
|
||||
/* Pause selector copy. */
|
||||
kpb->sel_sink->sink->state = COMP_STATE_PAUSED;
|
||||
|
@ -1164,7 +1174,6 @@ static enum task_state kpb_draining_task(void *arg)
|
|||
uint64_t draining_time_start;
|
||||
uint64_t draining_time_end;
|
||||
uint64_t draining_time_ms;
|
||||
enum comp_copy_type copy_type = COMP_COPY_NORMAL;
|
||||
uint64_t drain_interval = draining_data->drain_interval;
|
||||
uint64_t next_copy_time = 0;
|
||||
uint64_t current_time;
|
||||
|
@ -1286,8 +1295,9 @@ static enum task_state kpb_draining_task(void *arg)
|
|||
out:
|
||||
draining_time_end = platform_timer_get(timer);
|
||||
|
||||
/* Reset host-sink copy mode back to unblocking */
|
||||
comp_set_attribute(sink->sink, COMP_ATTR_COPY_TYPE, ©_type);
|
||||
/* Reset host-sink copy mode back to its pre-draining value */
|
||||
comp_set_attribute(kpb->host_sink->sink, COMP_ATTR_COPY_TYPE,
|
||||
&kpb->draining_task_data.copy_type);
|
||||
|
||||
draining_time_ms = (draining_time_end - draining_time_start)
|
||||
/ clock_ms_to_ticks(PLATFORM_DEFAULT_CLOCK, 1);
|
||||
|
|
|
@ -129,6 +129,7 @@ struct draining_data {
|
|||
size_t pb_limit; /**< Period bytes limit */
|
||||
struct comp_dev *dev;
|
||||
bool sync_mode_on;
|
||||
enum comp_copy_type copy_type;
|
||||
};
|
||||
|
||||
struct history_data {
|
||||
|
|
Loading…
Reference in New Issue