Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR5136 + ASOC: SOF: Intel: hda-stream: report DMA position if FW load fail #5141

Draft
wants to merge 3 commits into
base: topic/sof-dev
Choose a base branch
from
Draft
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
23 changes: 4 additions & 19 deletions sound/soc/sof/intel/hda-loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,14 +294,9 @@ int hda_cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *hext_stream
{
struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
const struct sof_intel_dsp_desc *chip = hda->desc;
struct sof_intel_hda_stream *hda_stream;
unsigned long time_left;
unsigned int reg;
int ret, status;

hda_stream = container_of(hext_stream, struct sof_intel_hda_stream,
hext_stream);

dev_dbg(sdev->dev, "Code loader DMA starting\n");

ret = hda_cl_trigger(sdev->dev, hext_stream, SNDRV_PCM_TRIGGER_START);
Expand All @@ -310,18 +305,6 @@ int hda_cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *hext_stream
return ret;
}

if (sdev->pdata->ipc_type == SOF_IPC_TYPE_4) {
/* Wait for completion of transfer */
time_left = wait_for_completion_timeout(&hda_stream->ioc,
msecs_to_jiffies(HDA_CL_DMA_IOC_TIMEOUT_MS));

if (!time_left) {
dev_err(sdev->dev, "Code loader DMA did not complete\n");
return -ETIMEDOUT;
}
dev_dbg(sdev->dev, "Code loader DMA done\n");
}

dev_dbg(sdev->dev, "waiting for FW_ENTERED status\n");

status = snd_sof_dsp_read_poll_timeout(sdev, HDA_DSP_BAR,
Expand All @@ -336,9 +319,11 @@ int hda_cl_copy_fw(struct snd_sof_dev *sdev, struct hdac_ext_stream *hext_stream
*/

if (status < 0) {
struct hdac_stream *hstream = &hext_stream->hstream;
snd_pcm_uframes_t pos = hda_dsp_stream_get_position(hstream, SNDRV_PCM_STREAM_PLAYBACK, 0);
dev_err(sdev->dev,
"%s: timeout with rom_status_reg (%#x) read\n",
__func__, chip->rom_status_reg);
"%s: timeout with rom_status_reg (%#x) read, DMA pos %lu/%lu\n",
__func__, chip->rom_status_reg, pos, hstream->bufsize);
} else {
dev_dbg(sdev->dev, "Code loader FW_ENTERED status\n");
}
Expand Down
2 changes: 1 addition & 1 deletion sound/soc/sof/intel/hda-stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ snd_pcm_uframes_t hda_dsp_stream_get_position(struct hdac_stream *hstream,
break;
}

if (pos >= hstream->bufsize)
if (pos > hstream->bufsize)
pos = 0;

return pos;
Expand Down
Loading