Skip to content

Commit 475163d

Browse files
committed
ASoC: SOF: ipc4: Handle compressed drain done notification from firmware
The decoder module sends a drain done notification when the last chunk of the stream after the EOS from host has been decoded. The notification is a module notification with 0xc0c0 as magic number in event_id upper 16 bit. Call sof_ipc4_compr_drain_done() when the notification arrives to handle it. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
1 parent 91bbaae commit 475163d

2 files changed

Lines changed: 15 additions & 6 deletions

File tree

include/sound/sof/ipc4/header.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,9 +622,10 @@ struct sof_ipc4_notify_module_data {
622622
* The event_data contains the struct sof_ipc4_control_msg_payload of the control
623623
* which sent the notification.
624624
*/
625-
#define SOF_IPC4_NOTIFY_MODULE_EVENTID_ALSA_MAGIC_MASK GENMASK(31, 16)
625+
#define SOF_IPC4_NOTIFY_MODULE_EVENTID_SOF_MAGIC_MASK GENMASK(31, 16)
626626
#define SOF_IPC4_NOTIFY_MODULE_EVENTID_ALSA_MAGIC_VAL 0xA15A0000
627627
#define SOF_IPC4_NOTIFY_MODULE_EVENTID_ALSA_PARAMID_MASK GENMASK(15, 0)
628+
#define SOF_IPC4_NOTIFY_MODULE_EVENTID_COMPR_MAGIC_VAL 0xC0C00000
628629

629630
/*
630631
* Macros for creating struct sof_ipc4_module_init_ext_init payload

sound/soc/sof/ipc4.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -699,12 +699,20 @@ static void sof_ipc4_module_notification_handler(struct snd_sof_dev *sdev,
699699
}
700700

701701
/* Handle ALSA kcontrol notification */
702-
if ((data->event_id & SOF_IPC4_NOTIFY_MODULE_EVENTID_ALSA_MAGIC_MASK) ==
703-
SOF_IPC4_NOTIFY_MODULE_EVENTID_ALSA_MAGIC_VAL) {
704-
const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
702+
switch (data->event_id & SOF_IPC4_NOTIFY_MODULE_EVENTID_SOF_MAGIC_MASK) {
703+
case SOF_IPC4_NOTIFY_MODULE_EVENTID_ALSA_MAGIC_VAL:
704+
{
705+
const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
705706

706-
if (tplg_ops->control->update)
707-
tplg_ops->control->update(sdev, ipc4_msg);
707+
if (tplg_ops->control->update)
708+
tplg_ops->control->update(sdev, ipc4_msg);
709+
}
710+
break;
711+
case SOF_IPC4_NOTIFY_MODULE_EVENTID_COMPR_MAGIC_VAL:
712+
sof_ipc4_compr_drain_done(sdev, ipc4_msg);
713+
break;
714+
default:
715+
break;
708716
}
709717
}
710718

0 commit comments

Comments
 (0)