diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-01-15 04:49:47 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-01-15 11:48:17 -0500 |
commit | 910e7e1923d52a74183d3aedd45f7fa4c3585400 (patch) | |
tree | 202667b2ebe9513dd7e8caf7d1187d3dfa56c93e /Documentation/sound | |
parent | ede63a8d45555d42c0e9564874568bbe9df3f8d5 (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.rst | 25 |
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. | |||
3924 | 2. Call :c:func:`snd_power_change_state()` with | 3924 | 2. 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 | ||
3927 | 3. Call :c:func:`snd_pcm_suspend_all()` to suspend the running | 3927 | 3. If AC97 codecs are used, call :c:func:`snd_ac97_suspend()` for |
3928 | PCM streams. | ||
3929 | |||
3930 | 4. If AC97 codecs are used, call :c:func:`snd_ac97_suspend()` for | ||
3931 | each codec. | 3928 | each codec. |
3932 | 3929 | ||
3933 | 5. Save the register values if necessary. | 3930 | 4. Save the register values if necessary. |
3934 | 3931 | ||
3935 | 6. Stop the hardware if necessary. | 3932 | 5. Stop the hardware if necessary. |
3936 | 3933 | ||
3937 | A typical code would be like: | 3934 | A 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 | ||
3997 | As shown in the above, it's better to save registers after suspending | 3992 | Note that, at the time this callback gets called, the PCM stream has |
3998 | the PCM operations via :c:func:`snd_pcm_suspend_all()` or | 3993 | been 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. |
4000 | already stopped when the register snapshot is taken. But, remember that | ||
4001 | you don't have to restart the PCM stream in the resume callback. It'll | ||
4002 | be restarted via trigger call with ``SNDRV_PCM_TRIGGER_RESUME`` when | ||
4003 | necessary. | ||
4004 | 3995 | ||
4005 | OK, we have all callbacks now. Let's set them up. In the initialization | 3996 | OK, we have all callbacks now. Let's set them up. In the initialization |
4006 | of the card, make sure that you can get the chip data from the card | 3997 | of the card, make sure that you can get the chip data from the card |