ASoC: tegra: Does the PCM_TRIGGER_{PAUSE, RESUME} emulation really work?
Hi,
The tegra pcm driver tries to emulate SNDRV_PCM_TRIGGER_PAUSE and SNDRV_PCM_TRIGGER_RESUME. By passing SNDRV_PCM_TRIGGER_START and SNDRV_PCM_TRIGGER_STOP to snd_dmaengine_pcm_trigger. But does this really work? The old non-dmaengine based driver implemented this properly. I'd reset the dma position pointer for SNDRV_PCM_TRIGGER_START, but keep it where it was for SNDRV_PCM_TRIGGER_RESUME. But as far as I can see with the dmaengine based driver the pointer always gets reset to 0 for both SNDRV_PCM_TRIGGER_START and SNDRV_PCM_TRIGGER_RESUME.
- Lars
Quoted 10 lines · Lars-Peter Clausen
Hi,
The tegra pcm driver tries to emulate
SNDRV_PCM_TRIGGER_PAUSEandSNDRV_PCM_TRIGGER_RESUME. By passingSNDRV_PCM_TRIGGER_STARTandSNDRV_PCM_TRIGGER_STOPtosnd_dmaengine_pcm_trigger. But does this really work? The old non-dmaengine based driver implemented this properly. I'd reset the dma position pointer forSNDRV_PCM_TRIGGER_START, but keep it where it was forSNDRV_PCM_TRIGGER_RESUME. But as far as I can see with the dmaengine based driver the pointer always gets reset to 0 for bothSNDRV_PCM_TRIGGER_STARTandSNDRV_PCM_TRIGGER_RESUME.
It's quite possible this hasn't been tested, or tested recently. I don't recall how to test PAUSE/RESUME. Can you enlighten me?
Laxman, can you comment here?
Quoted 12 lines · Stephen Warren
Quoted 10 lines · Lars-Peter Clausen
Hi,
The tegra pcm driver tries to emulate
SNDRV_PCM_TRIGGER_PAUSEandSNDRV_PCM_TRIGGER_RESUME. By passingSNDRV_PCM_TRIGGER_STARTandSNDRV_PCM_TRIGGER_STOPtosnd_dmaengine_pcm_trigger. But does this really work? The old non-dmaengine based driver implemented this properly. I'd reset the dma position pointer forSNDRV_PCM_TRIGGER_START, but keep it where it was forSNDRV_PCM_TRIGGER_RESUME. But as far as I can see with the dmaengine based driver the pointer always gets reset to 0 for bothSNDRV_PCM_TRIGGER_STARTandSNDRV_PCM_TRIGGER_RESUME.
Quoted 2 lines
It's quite possible this hasn't been tested, or tested recently. I don't recall how to test PAUSE/RESUME. Can you enlighten me?
Hm, I don't know of an application that is specificity designed to test pause/resume, but any application using snd_pcm_pause, should be fine.
- Lars
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 12 lines · Laxman Dewangan
Quoted 11 lines · Stephen Warren
Quoted 10 lines · Lars-Peter Clausen
Hi,
The tegra pcm driver tries to emulate
SNDRV_PCM_TRIGGER_PAUSEandSNDRV_PCM_TRIGGER_RESUME. By passingSNDRV_PCM_TRIGGER_STARTandSNDRV_PCM_TRIGGER_STOPtosnd_dmaengine_pcm_trigger. But does this really work? The old non-dmaengine based driver implemented this properly. I'd reset the dma position pointer forSNDRV_PCM_TRIGGER_START, but keep it where it was forSNDRV_PCM_TRIGGER_RESUME. But as far as I can see with the dmaengine based driver the pointer always gets reset to 0 for bothSNDRV_PCM_TRIGGER_STARTandSNDRV_PCM_TRIGGER_RESUME.
Quoted 9 lines
Quoted 4 lines
It's quite possible this hasn't been tested, or tested recently. I don't recall how to test PAUSE/RESUME. Can you enlighten me?
Laxman, can you comment here?
The tegra20/Tegra30 does not support the pause of the channel. It was through global pause. hence the pause and resume is implemented like stop transfer and again restart transfer. hence you are seeing this as the reset pointer as 0.
Yea, but in that case you shouldn't implement pause/resume at all. You've changed the semantics on pause/resume on which applications rely. If pause/resume are not implemented applications usually workaround it.
- Lars
Quoted 9 lines
So pause is stop and resume is the start again.
If it is require to implement the dmaengine_pause/resume() then it can not be done truely, it can be done atelast in resolution of one buffer transfer. We can not stop dma in mid of buffer transfer and start from there. We can do cancel of current buffer transfer and then start from begining of current buffer, not from the point it was paused.
However, tegra114 support this pause and resume truely.
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 28 lines · Laxman Dewangan
Quoted 27 lines · Lars-Peter Clausen
Quoted 13 lines · Laxman Dewangan
Quoted 12 lines · Stephen Warren
Quoted 11 lines · Lars-Peter Clausen
Hi,
The tegra pcm driver tries to emulate
SNDRV_PCM_TRIGGER_PAUSEandSNDRV_PCM_TRIGGER_RESUME. By passingSNDRV_PCM_TRIGGER_STARTandSNDRV_PCM_TRIGGER_STOPtosnd_dmaengine_pcm_trigger. But does this really work? The old non-dmaengine based driver implemented this properly. I'd reset the dma position pointer forSNDRV_PCM_TRIGGER_START, but keep it where it was forSNDRV_PCM_TRIGGER_RESUME. But as far as I can see with the
dmaengine based driver the pointer always gets reset to 0 for bothSNDRV_PCM_TRIGGER_STARTandSNDRV_PCM_TRIGGER_RESUME.Quoted 9 lines
Quoted 4 lines
It's quite possible this hasn't been tested, or tested recently. I don't recall how to test PAUSE/RESUME. Can you enlighten me?
Laxman, can you comment here?
The tegra20/Tegra30 does not support the pause of the channel. It was through global pause. hence the pause and resume is implemented like stop transfer and again restart transfer. hence you are seeing this as the reset pointer as 0.
Yea, but in that case you shouldn't implement pause/resume at all. You've changed the semantics on pause/resume on which applications rely. If pause/resume are not implemented applications usually workaround it.
Quoted 8 lines
Quoted 2 lines
- Lars
So should we return
-EINVALin case of following?case
SNDRV_PCM_TRIGGER_RESUME:
caseSNDRV_PCM_TRIGGER_PAUSE_PUSH:
Don't set the SNDRV_PCM_INFO_PAUSE and SNDRV_PCM_INFO_RESUME bits in the pcm_hardware struct and use snd_dmaengine_pcm_trigger as your trigger callback. The ALSA core will take care of everything else.
- Lars