Hi ALSA team,
We are using the standard ALSA driver framework for capture and playback in our Linux platform. In our platform arecord and aplay work as expected using I2S-CODEC, In one of our applications we have to do Suspend to RAM (S2R) operation.
When Suspend to RAM triggers while playing audio through I2S-CODEC, The playback fails to resume-back once the system is resumed.
We have thoroughly verified the drivers of the I2S controller and CODEC, But have not observed any issues, We are suspecting that the issue might be in the ASOC layer.
Following are the details:
* kernel version: 5.10.41 * Platform: RisCV64
We are playing audio in one terminal using " aplay (using standard alsa-utils package)" command and running S2R command " echo mem > /sys/power/state " in other terminals to suspend and resume the system.
We are facing input/error once the system resumed back as mentioned below, --------------------------------------------------------------------------------------------- root@XX-SOC-BSP-31JAN23-REL12-v1:~# aplay -Dhw:2,0 3.wav Playing WAVE '3.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo aplay: pcm_write:2061: write error: Input/output error ----------------------------------------------------------------------------------------------
And we found that in " pcm_lib.c " the tout time is 2.5 seconds, once we do Suspend to resume we observe the tout is zero.
if (runtime->no_period_wakeup) wait_time = MAX_SCHEDULE_TIMEOUT; else { /* use wait time from substream if available */ if (substream->wait_time) { wait_time = substream->wait_time; } else { wait_time = 10;
if (runtime->rate) { long t = runtime->period_size * 2 / runtime->rate; wait_time = max(t, wait_time); } wait_time = msecs_to_jiffies(wait_time * 1000); printk("******sound/core/pcm_lib.c ::: tout = %ld ****",wait_time); } } .......
tout = schedule_timeout(wait_time);
Thanks & regards Rizwan Chikodi