summaryrefslogtreecommitdiffstats
path: root/Documentation/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2019-01-15 04:49:47 -0500
committerTakashi Iwai <tiwai@suse.de>2019-01-15 11:48:17 -0500
commit910e7e1923d52a74183d3aedd45f7fa4c3585400 (patch)
tree202667b2ebe9513dd7e8caf7d1187d3dfa56c93e /Documentation/sound
parentede63a8d45555d42c0e9564874568bbe9df3f8d5 (diff)
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>
Diffstat (limited to 'Documentation/sound')
-rw-r--r--Documentation/sound/kernel-api/writing-an-alsa-driver.rst25
1 files changed, 8 insertions, 17 deletions
diff --git a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
index b37234afdfa1..7c2f2032d30a 100644
--- a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
+++ b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst
@@ -3924,15 +3924,12 @@ The scheme of the real suspend job is as follows.
39242. Call :c:func:`snd_power_change_state()` with 39242. Call :c:func:`snd_power_change_state()` with
3925 ``SNDRV_CTL_POWER_D3hot`` to change the power status. 3925 ``SNDRV_CTL_POWER_D3hot`` to change the power status.
3926 3926
39273. Call :c:func:`snd_pcm_suspend_all()` to suspend the running 39273. If AC97 codecs are used, call :c:func:`snd_ac97_suspend()` for
3928 PCM streams.
3929
39304. If AC97 codecs are used, call :c:func:`snd_ac97_suspend()` for
3931 each codec. 3928 each codec.
3932 3929
39335. Save the register values if necessary. 39304. Save the register values if necessary.
3934 3931
39356. Stop the hardware if necessary. 39325. Stop the hardware if necessary.
3936 3933
3937A typical code would be like: 3934A typical code would be like:
3938 3935
@@ -3946,12 +3943,10 @@ A typical code would be like:
3946 /* (2) */ 3943 /* (2) */
3947 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 3944 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
3948 /* (3) */ 3945 /* (3) */
3949 snd_pcm_suspend_all(chip->pcm);
3950 /* (4) */
3951 snd_ac97_suspend(chip->ac97); 3946 snd_ac97_suspend(chip->ac97);
3952 /* (5) */ 3947 /* (4) */
3953 snd_mychip_save_registers(chip); 3948 snd_mychip_save_registers(chip);
3954 /* (6) */ 3949 /* (5) */
3955 snd_mychip_stop_hardware(chip); 3950 snd_mychip_stop_hardware(chip);
3956 return 0; 3951 return 0;
3957 } 3952 }
@@ -3994,13 +3989,9 @@ A typical code would be like:
3994 return 0; 3989 return 0;
3995 } 3990 }
3996 3991
3997As shown in the above, it's better to save registers after suspending 3992Note that, at the time this callback gets called, the PCM stream has
3998the PCM operations via :c:func:`snd_pcm_suspend_all()` or 3993been already suspended via its own PM ops calling
3999:c:func:`snd_pcm_suspend()`. It means that the PCM streams are 3994:c:func:`snd_pcm_suspend_all()` internally.
4000already stopped when the register snapshot is taken. But, remember that
4001you don't have to restart the PCM stream in the resume callback. It'll
4002be restarted via trigger call with ``SNDRV_PCM_TRIGGER_RESUME`` when
4003necessary.
4004 3995
4005OK, we have all callbacks now. Let's set them up. In the initialization 3996OK, we have all callbacks now. Let's set them up. In the initialization
4006of the card, make sure that you can get the chip data from the card 3997of the card, make sure that you can get the chip data from the card