ALSA: doc: Update the description about PCM suspend procedure

The PCM suspend procedure was changed for drivers, so that they don't
have to call snd_pcm_suspend*() in each callback any longer.  Update
the documentation to adapt the changes.

Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2019-01-15 10:49:47 +01:00
parent ede63a8d45
commit 910e7e1923
1 changed files with 8 additions and 17 deletions

View File

@ -3924,15 +3924,12 @@ The scheme of the real suspend job is as follows.
2. Call :c:func:`snd_power_change_state()` with
``SNDRV_CTL_POWER_D3hot`` to change the power status.
3. Call :c:func:`snd_pcm_suspend_all()` to suspend the running
PCM streams.
4. If AC97 codecs are used, call :c:func:`snd_ac97_suspend()` for
3. If AC97 codecs are used, call :c:func:`snd_ac97_suspend()` for
each codec.
5. Save the register values if necessary.
4. Save the register values if necessary.
6. Stop the hardware if necessary.
5. Stop the hardware if necessary.
A typical code would be like:
@ -3946,12 +3943,10 @@ A typical code would be like:
/* (2) */
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
/* (3) */
snd_pcm_suspend_all(chip->pcm);
/* (4) */
snd_ac97_suspend(chip->ac97);
/* (5) */
/* (4) */
snd_mychip_save_registers(chip);
/* (6) */
/* (5) */
snd_mychip_stop_hardware(chip);
return 0;
}
@ -3994,13 +3989,9 @@ A typical code would be like:
return 0;
}
As shown in the above, it's better to save registers after suspending
the PCM operations via :c:func:`snd_pcm_suspend_all()` or
:c:func:`snd_pcm_suspend()`. It means that the PCM streams are
already stopped when the register snapshot is taken. But, remember that
you don't have to restart the PCM stream in the resume callback. It'll
be restarted via trigger call with ``SNDRV_PCM_TRIGGER_RESUME`` when
necessary.
Note that, at the time this callback gets called, the PCM stream has
been already suspended via its own PM ops calling
:c:func:`snd_pcm_suspend_all()` internally.
OK, we have all callbacks now. Let's set them up. In the initialization
of the card, make sure that you can get the chip data from the card