Commit 910e7e19 authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent ede63a8d
...@@ -3924,15 +3924,12 @@ The scheme of the real suspend job is as follows. ...@@ -3924,15 +3924,12 @@ The scheme of the real suspend job is as follows.
2. Call :c:func:`snd_power_change_state()` with 2. Call :c:func:`snd_power_change_state()` with
``SNDRV_CTL_POWER_D3hot`` to change the power status. ``SNDRV_CTL_POWER_D3hot`` to change the power status.
3. Call :c:func:`snd_pcm_suspend_all()` to suspend the running 3. If AC97 codecs are used, call :c:func:`snd_ac97_suspend()` for
PCM streams.
4. If AC97 codecs are used, call :c:func:`snd_ac97_suspend()` for
each codec. 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: A typical code would be like:
...@@ -3946,12 +3943,10 @@ A typical code would be like: ...@@ -3946,12 +3943,10 @@ A typical code would be like:
/* (2) */ /* (2) */
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
/* (3) */ /* (3) */
snd_pcm_suspend_all(chip->pcm);
/* (4) */
snd_ac97_suspend(chip->ac97); snd_ac97_suspend(chip->ac97);
/* (5) */ /* (4) */
snd_mychip_save_registers(chip); snd_mychip_save_registers(chip);
/* (6) */ /* (5) */
snd_mychip_stop_hardware(chip); snd_mychip_stop_hardware(chip);
return 0; return 0;
} }
...@@ -3994,13 +3989,9 @@ A typical code would be like: ...@@ -3994,13 +3989,9 @@ A typical code would be like:
return 0; return 0;
} }
As shown in the above, it's better to save registers after suspending Note that, at the time this callback gets called, the PCM stream has
the PCM operations via :c:func:`snd_pcm_suspend_all()` or been already suspended via its own PM ops calling
:c:func:`snd_pcm_suspend()`. It means that the PCM streams are :c:func:`snd_pcm_suspend_all()` internally.
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.
OK, we have all callbacks now. Let's set them up. In the initialization 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 of the card, make sure that you can get the chip data from the card
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment