On 10/20/22 02:56, Cezary Rojewski wrote: > On 2022-10-19 8:02 PM, Pierre-Louis Bossart wrote: > > ... > >> This is clearly going to conflict with my own rename/move changes in >> "ALSA/ASoC: hda: move SPIB/DRMS functionality from ext layer" >> >> The SPIB and DRMS handling are not DSP-specific and should be handled in >> the 'generic' sound/hda layer. In theory the HDaudio legacy driver >> should have used those capabilities. >> >> It should be a simple rebase though for this patch. > > No problem with waiting for the series you mention to be merged first. > Will rebase once it's done. > > Also, that's a good point in regard to DRSM. This could indeed be added > into common sound/hda lib. Something like below perhaps? Between SPIB and DRSM, I would pick SPIB as the most interesting for the legacy HDaudio driver. This prevents the DMA hardware from playing stale data and would allow for xruns to be detected in cleaner ways. The programming sequences are relatively straightforward when the .ack is used. I must admit my ignorance of how DRSM works exactly. We haven't used it in the SOF driver where INFO_RESUME is disabled, and with a DSP I am not too sure how to restart precisely from the same location with all the intermediate buffering and processing that may happen. > int snd_hdac_stream_resume(struct hdac_stream *azx_dev) > { > struct hdac_bus *bus = azx_dev->bus; > u32 mask, reg; > int ret; > > mask = 1 << azx_dev->index; > > ret = readb_poll_timeout(bus->drsmcap + AZX_REG_DRSM_CTL, reg, > !(reg & mask), 250, 2000); > if (ret) > dev_dbg(bus->dev, "polling RSM 0x%08x failed: %d\n", > mask, ret); > return ret; > } > EXPORT_SYMBOL_GPL(snd_hdac_stream_resume);