Re: [PATCH v2] ASoC: loongson: Fix invalid position error in ls_pcm_pointer
From: lijun
Date: Tue Jun 02 2026 - 21:09:11 EST
Is it handled like this?
desc = dma_desc_save(prtd);
addr = ((u64)desc->saddr_hi << 32) | desc->saddr;
if (addr < runtime->dma_addr || addr > runtime->dma_addr + runtime->dma_bytes) {
dev_warn(dev, "WARNING! dma_addr:0x%x\n", addr);
snd_pcm_stop_xrun(substream);
x = 0;
} else {
x = bytes_to_frames(runtime, addr - runtime->dma_addr);
if (x == runtime->buffer_size)
x = 0;
}
在 2026/6/2 21:13, Mark Brown 写道:
On Tue, Jun 02, 2026 at 08:49:29AM +0800, lijun wrote:
Please don't top post, reply in line with needed context. This allows
readers to readily follow the flow of conversation and understand what
you are talking about and also helps ensure that everything in the
discussion is being addressed.
for example,the DMA controller is abnormal in hardwareRight, the question is if this happens in normal operation somehow or if
the addr = 0,
addr = ((u64)desc->saddr_hi << 32) | desc->saddr;
x = bytes_to_frames(runtime, addr - runtime->dma_addr);
addr = 0 dma_addr=4195352576 x=-1048838144 i think the value of pos should
not be a negative,return 0, maybe better.
this is an error condition. If this is an error should we be reporting
it as such, for example with snd_pcm_stop_xrun().