[Sound-open-firmware] [PATCH 2/7] ASoc: SOF: Refine memory window for APL
Xiuli Pan
xiuli.pan at linux.intel.com
Wed Mar 7 07:02:51 CET 2018
From: Pan Xiuli <xiuli.pan at linux.intel.com>
Refine window handler for APL: add some error handler, add stream
region hanlder.
Signed-off-by: Pan Xiuli <xiuli.pan at linux.intel.com>
---
Test with:
Mininow max rt5651 and GP-MRB nocodec
SOF master: 77ed88aa4a26c3ff6f479bf0894a13c87119ffdc
SOF-Tool master: 3105de2481b5b5511b2fa844fe859f023f434b4c
https://github.com/plbossart/sound/tree/topic/sof-v4.14:
d919ea06b7f79c95ab4eb68baf05e9faf3a894c1
---
sound/soc/sof/hw-apl.c | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/sound/soc/sof/hw-apl.c b/sound/soc/sof/hw-apl.c
index bfbdd915..09ebaa9 100644
--- a/sound/soc/sof/hw-apl.c
+++ b/sound/soc/sof/hw-apl.c
@@ -1089,12 +1089,18 @@ static int apl_prepare(struct snd_sof_dev *sdev, unsigned int format,
static void apl_get_windows(struct snd_sof_dev *sdev)
{
struct sof_ipc_window_elem *elem;
+ u32 outbox_offset = 0;
+ u32 stream_offset = 0;
+ u32 inbox_offset = 0;
+ u32 outbox_size = 0;
+ u32 stream_size = 0;
+ u32 inbox_size = 0;
int i;
- u32 inbox_offset = 0, outbox_offset = 0;
- u32 inbox_size = 0, outbox_size = 0;
- if (!sdev->info_window)
+ if (!sdev->info_window) {
+ dev_err(sdev->dev, "error: have no window info\n");
return;
+ }
for (i = 0; i < sdev->info_window->num_windows; i++) {
elem = &sdev->info_window->window[i];
@@ -1135,6 +1141,9 @@ static void apl_get_windows(struct snd_sof_dev *sdev)
elem->size, "debug");
break;
case SOF_IPC_REGION_STREAM:
+ stream_offset =
+ elem->offset + SRAM_WINDOW_OFFSET(elem->id);
+ stream_size = elem->size;
snd_sof_debugfs_create_item(sdev,
sdev->bar[APL_DSP_BAR] +
elem->offset +
@@ -1151,17 +1160,27 @@ static void apl_get_windows(struct snd_sof_dev *sdev)
elem->size, "regs");
break;
default:
- break;
+ dev_err(sdev->dev, "error: get illegal window info\n");
+ return;
}
}
+ if (outbox_size == 0 || inbox_size == 0) {
+ dev_err(sdev->dev, "error: get illegal mailbox window\n");
+ return;
+ }
+
snd_sof_dsp_mailbox_init(sdev, inbox_offset, inbox_size,
outbox_offset, outbox_size);
+ sdev->stream_box.offset = stream_offset;
+ sdev->stream_box.size = stream_size;
dev_dbg(sdev->dev, " mailbox upstream 0x%x - size 0x%x\n",
inbox_offset, inbox_size);
dev_dbg(sdev->dev, " mailbox downstream 0x%x - size 0x%x\n",
outbox_offset, outbox_size);
+ dev_dbg(sdev->dev, " stream region 0x%x - size 0x%x\n",
+ stream_offset, stream_size);
}
static int apl_fw_ready(struct snd_sof_dev *sdev, u32 msg_id)
--
2.7.4
More information about the Sound-open-firmware
mailing list