On 09/21/15 12:37, Russell King - ARM Linux wrote:
On Fri, Sep 18, 2015 at 02:06:39PM +0300, Jyri Sarha wrote:
Add IEC958 channel status helper that gets the audio properties from snd_pcm_hw_params instead of snd_pcm_runtime. This is needed to produce the channel status bits already in audio stream configuration phase.
What is the reason for doing this early?
After some thinking, there is no good reason. It makes the codec bit more complicated, but that is not a good reason. I'll change that and use the prepare callback.
This patch can be dropped.
ALSA documentation (which may be out of date) says that the hw_params callback can be called multiple times during stream setup. Do we want to be repeatedly programming the HDMI infoframe with different settings, potentially confusing the attached device, or would it be better to do it slightly later (in the prepare callback) after the parameters have been fully negotiated?
If it is possible that hw_params() can be called multiple times, at least it does not happen very often. I wonder if it would ever happen again after a successful hw_params() call. But there is no downside in using prepare callback. I was just too much following the way ASoC codecs usually do the thing by writing everything to iron as the callbacks come in.
Best regards, Jyri