ALSA: hda: Transfer firmware in two chunks
authorCezary Rojewski <cezary.rojewski@intel.com>
Tue, 14 Jan 2025 18:42:39 +0000 (19:42 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 15 Jan 2025 07:57:18 +0000 (08:57 +0100)
commitd80c400f888fd14533c5ecda45340b0179f894d5
treecbbd00838763df18c82fc4db3778efaac39466d0
parent384669921779806105c56751abff41fa0127f93a
ALSA: hda: Transfer firmware in two chunks

As per specification, SDxLVI shall be at least 1 i.e.: two chunks to
perform a valid transfer. This is true for the PCM transfer code but
not firmware-transfer one.

Technical background:
- the LVI > 0 rule shall be obeyed in PCM transfer
- HW permits LVI == 0 when transfer is SW-controlled (SPIB)
- FW download is not a PCM transfer and is SW-controlled (SPIB)

The above is the fundament which AudioDSP firmware loading functions
have been built upon and worked since 2016. The presented changes are to
align the loading flows and avoid rising more questions in the future.

Achieve the goal by splitting snd_hdac_stream_setup_periods() into
substream-dependent and -independent part. Let snd_hdac_dsp_prepare()
utilize the latter so that both DSP-loading and PCM flows utilize same
BLDE setup loop which already takes care of cutting the buffer based on
azx_dev->period_bytes.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
Link: https://patch.msgid.link/20250114184239.120002-1-cezary.rojewski@intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/hda/hdac_stream.c