On 2023-09-26 10:06 AM, Cezary Rojewski wrote:
Software shall read SDxFIFOS calculated by the hardware and notify if
invalid value is programmed before continuing the stream preparation.
...
@@ -300,6 +302,12 @@ int snd_hdac_stream_setup(struct hdac_stream *azx_dev)
/* set the interrupt enable bits in the descriptor control register */
snd_hdac_stream_updatel(azx_dev, SD_CTL, 0, SD_INT_MASK);
+ /* Once SDxFMT is set, the controller programs SDxFIFOS to non-zero value. */
+ ret = snd_hdac_stream_readw_poll(azx_dev, SD_FIFOSIZE, reg, reg & AZX_SD_FIFOSIZE_MASK,
+ 3, 300);
+ if (ret)
+ dev_dbg(bus->dev, "polling SD_FIFOSIZE 0x%04x failed: %d\n",
+ AZX_REG_SD_FIFOSIZE, ret);
There is one (negligible?) side effect. AudioDSP firmware is the one who
kicks SDxFIFOS calculation when a stream is decoupled mode. During
firmware bring up procedure, there is no firmware running _and_ the
code-loading stream is always a decoupled one. So, there is none to
trigger the calculation and we end up with debug -110 messages. It looks
like to do this in complete fashion some refactoring is needed in
hdac_stream.c/hdac_ext_stream.c.
Czarek
azx_dev->fifo_size = snd_hdac_stream_readw(azx_dev, SD_FIFOSIZE) + 1;
/* when LPIB delay correction gives a small negative value,