[alsa-devel] Question about hw_param with Ctrl-Z + fg

Takashi Sakamoto o-takashi at sakamocchi.jp
Tue Apr 4 08:14:55 CEST 2017


On Apr 4 2017 14:57, Kuninori Morimoto wrote:
>>> Ctrl-Z case
>>> 	- aplay xxx.wav
>>> =>	- hw_param
>>> 	- SNDRV_PCM_TRIGGER_START
>>> 	- Ctrl-Z
>>> 	- SNDRV_PCM_TRIGGER_STOP
>>> 	- fg
>>> =>	- ## no hw_param here
>>> 	- SNDRV_PCM_TRIGGER_START
>>> 	- Ctrl-C (stop)
>>> 	- SNDRV_PCM_TRIGGER_STOP
>>
>> No issues.
>>
>> I think it better to implement what you want in any .prepare
>> callbacks, instead of the .be_hw_params_fixup callback, because in
>> this case, PCM substream lapses into XRUN state in call graph from
>> your hw IRQ handler. Typical applications recover from this state by
>> calling ioctl(PREPARE), without any call of ioctl(HW_PARAMS).
>>
>> Actually, you can see applications call ioctl(PREPARE), before you see
>> call of 'struct snd_pcm_ops.trigger(START)'.
>
> Hmm...
> Above .be_hw_params_fixup is used to convert sampling rate or channel
> number or some other related things between SoC / Codec as DPCM feature.
> Thus, I can't switch to .be_hw_params_fixup to .prepare I guess.
> But Mark, am I misunderstanding ?

In 'struct snd_pcm_ops.prepare' callback, configured parameters of PCM 
substream are available via members of 'struct snd_pcm_runtime'. The 
runtime is a member of 'struct snd_pcm_substream'. It's available in any 
of .prepare callbacks in ALSA SoC part.


Regards

Takashi Sakamoto


More information about the Alsa-devel mailing list