3636#include <ipc4/header.h>
3737#include <ipc4/module.h>
3838#include <ipc4/notification.h>
39+ #include <sof/audio/kpb.h>
40+ #include <sof/lib/notifier.h>
3941
4042#include "speech.h"
4143
@@ -50,8 +52,28 @@ struct tflm_comp_data {
5052 struct comp_data_blob_handler * model_handler ;
5153 struct tf_classify tfc ;
5254 struct ipc_msg * msg ;
55+ struct kpb_event_data event_data ;
56+ struct kpb_client client_data ;
5357};
5458
59+ static void tflm_notify_kpb (struct processing_module * mod )
60+ {
61+ struct tflm_comp_data * cd = module_get_private_data (mod );
62+ struct comp_dev * dev = mod -> dev ;
63+
64+ comp_info (dev , "TFLM keyword trigger -> notifying KPB to begin draining" );
65+
66+ cd -> client_data .r_ptr = NULL ;
67+ cd -> client_data .sink = NULL ;
68+ cd -> client_data .id = 0 ;
69+ cd -> event_data .event_id = KPB_EVENT_BEGIN_DRAINING ;
70+ cd -> event_data .client_data = & cd -> client_data ;
71+
72+ notifier_event (dev , NOTIFIER_ID_KPB_CLIENT_EVT ,
73+ NOTIFIER_TARGET_CORE_ALL_MASK , & cd -> event_data ,
74+ sizeof (cd -> event_data ));
75+ }
76+
5577static int tflm_ipc_notification_init (struct processing_module * mod )
5678{
5779 struct tflm_comp_data * cd = module_get_private_data (mod );
@@ -298,6 +320,7 @@ static int tflm_process(struct processing_module *mod,
298320 comp_info (dev , "TFLM keyword detected: %s (confidence %1.3f)" ,
299321 prediction [max_idx ], (double )max_score );
300322 tflm_send_keyword_notification (mod , max_idx );
323+ tflm_notify_kpb (mod );
301324 }
302325
303326 /* advance by one 20ms stride (40 int8_t features) */
0 commit comments