On Wed, 6 May 2020, Pierre-Louis Bossart wrote:
In certain system-on-chip systems, with separate ADCs and DACs for instance, the ADC could generate clocks for the DAC, where it not for the fact that ALSA shuts down whatever device is not being used in order to conserve power. Is it possible to instruct ALSA not to do this, i.e. once a codec has been configured to operate at a given sample rate, it will continue to do so, even after all streams have stopped. ...
It's a valid request, some platforms want to avoid any glitches due to clocks and require that they remain active, even if it means writing-off power optimizations.
Yes, if one looks at how standalone audio devices normally work, the codec is set up at power on time, and just keeps running until the device is switched off. Of course in that case, there is usually also some form of application that is also running all the time.
If your codec exposes a clock object then you could have e.g. a board or machine driver configure the clock (clk_get/clk_set_rate/clk_prepare_enable) and leave it on regardless of the streaming usages. You would still need to make sure that the clock rates are compatible with the hw_params when streaming does happen. that's what e.g. was done for Intel to make sure the MCLK, BCLK and FSYNC could be enabled even when the DSP was idle.
Which driver is that?
/Ricard