Skip to content
Open
Show file tree
Hide file tree
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
6 changes: 1 addition & 5 deletions sound/soc/sof/intel/cnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,12 +266,8 @@ int cnl_ipc4_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg)
struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata;
struct sof_ipc4_msg *msg_data = msg->msg_data;

if (hda_ipc4_tx_is_busy(sdev)) {
hdev->delayed_ipc_tx_msg = msg;
if (!hda_ipc4_proceed_sending(sdev, msg))
return 0;
}

hdev->delayed_ipc_tx_msg = NULL;

/* send the message via mailbox */
if (msg_data->data_size)
Expand Down
40 changes: 33 additions & 7 deletions sound/soc/sof/intel/hda-ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,8 @@ int hda_dsp_ipc4_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg)
struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata;
struct sof_ipc4_msg *msg_data = msg->msg_data;

if (hda_ipc4_tx_is_busy(sdev)) {
hdev->delayed_ipc_tx_msg = msg;
if (!hda_ipc4_proceed_sending(sdev, msg))
return 0;
}

hdev->delayed_ipc_tx_msg = NULL;

/* send the message via mailbox */
if (msg_data->data_size)
Expand Down Expand Up @@ -543,7 +539,7 @@ void hda_ipc4_dump(struct snd_sof_dev *sdev)
}
EXPORT_SYMBOL_NS(hda_ipc4_dump, "SND_SOC_SOF_INTEL_HDA_COMMON");

bool hda_ipc4_tx_is_busy(struct snd_sof_dev *sdev)
static bool hda_ipc4_tx_is_busy(struct snd_sof_dev *sdev)
{
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
const struct sof_intel_dsp_desc *chip = hda->desc;
Expand All @@ -553,4 +549,34 @@ bool hda_ipc4_tx_is_busy(struct snd_sof_dev *sdev)

return !!(val & chip->ipc_req_mask);
}
EXPORT_SYMBOL_NS(hda_ipc4_tx_is_busy, "SND_SOC_SOF_INTEL_HDA_COMMON");

bool hda_ipc4_proceed_sending(struct snd_sof_dev *sdev,
struct snd_sof_ipc_msg *msg)
{
struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata;

if (hda_ipc4_tx_is_busy(sdev)) {
struct sof_ipc4_msg *msg_data = msg->msg_data;

dev_dbg(sdev->dev, "Delaying message: %#x|%#x",
msg_data->primary, msg_data->extension);
hdev->delayed_ipc_tx_msg = msg;
return false;
} else if (hdev->delayed_ipc_tx_msg == msg) {
struct sof_ipc4_msg *msg_data = msg->msg_data;

dev_dbg(sdev->dev, "Sending delayed massage: %#x|%#x",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure if delayed "massage" is healthy?

msg_data->primary, msg_data->extension);
} else if (unlikely(hdev->delayed_ipc_tx_msg)) {
struct sof_ipc4_msg *msg_data = msg->msg_data;

dev_dbg(sdev->dev,
"Stale delayed message dropped, sending %#x|%#x",
msg_data->primary, msg_data->extension);
}

hdev->delayed_ipc_tx_msg = NULL;

return true;
}
EXPORT_SYMBOL_NS(hda_ipc4_proceed_sending, "SND_SOC_SOF_INTEL_HDA_COMMON");
3 changes: 2 additions & 1 deletion sound/soc/sof/intel/hda.h
Original file line number Diff line number Diff line change
Expand Up @@ -984,7 +984,8 @@ int hda_dsp_core_stall_reset(struct snd_sof_dev *sdev, unsigned int core_mask);
irqreturn_t cnl_ipc4_irq_thread(int irq, void *context);
int cnl_ipc4_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg);
irqreturn_t hda_dsp_ipc4_irq_thread(int irq, void *context);
bool hda_ipc4_tx_is_busy(struct snd_sof_dev *sdev);
bool hda_ipc4_proceed_sending(struct snd_sof_dev *sdev,
struct snd_sof_ipc_msg *msg);
void hda_dsp_ipc4_schedule_d0i3_work(struct sof_intel_hda_dev *hdev,
struct snd_sof_ipc_msg *msg);
int hda_dsp_ipc4_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *msg);
Expand Down
6 changes: 1 addition & 5 deletions sound/soc/sof/intel/mtl.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,8 @@ static int mtl_ipc_send_msg(struct snd_sof_dev *sdev, struct snd_sof_ipc_msg *ms
struct sof_intel_hda_dev *hdev = sdev->pdata->hw_pdata;
struct sof_ipc4_msg *msg_data = msg->msg_data;

if (hda_ipc4_tx_is_busy(sdev)) {
hdev->delayed_ipc_tx_msg = msg;
if (!hda_ipc4_proceed_sending(sdev, msg))
return 0;
}

hdev->delayed_ipc_tx_msg = NULL;

/* send the message via mailbox */
if (msg_data->data_size)
Expand Down
Loading