From 6a3526ec6881f5d56f484fe5a55a16fa68acd257 Mon Sep 17 00:00:00 2001 From: Marcin Rajwa Date: Tue, 9 Apr 2019 13:22:19 +0200 Subject: [PATCH] KPB: update kpb reset function Signed-off-by: Marcin Rajwa --- src/audio/kpb.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/src/audio/kpb.c b/src/audio/kpb.c index a63f7f19d..2db85accd 100644 --- a/src/audio/kpb.c +++ b/src/audio/kpb.c @@ -398,10 +398,24 @@ static void kpb_cache(struct comp_dev *dev, int cmd) /* TODO: writeback history buffer */ } +/** + * \brief Resets KPB component. + * \param[in,out] dev KPB base component device. + * \return Error code. + */ static int kpb_reset(struct comp_dev *dev) { - /* TODO: what data of KPB should we reset here? */ - return 0; + struct comp_data *kpb = comp_get_drvdata(dev); + + trace_kpb("kpb_reset()"); + + /* Reset history buffer */ + kpb->is_internal_buffer_full = false; + kpb_clear_history_buffer(kpb->history_buffer); + /* Reset amount of buffered data */ + kpb->buffered_data = 0; + + return comp_set_state(dev, COMP_TRIGGER_RESET); } /**