diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/DocBook/writing-an-alsa-driver.tmpl | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index 6f639d9530b5..784793df81ed 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -2742,7 +2742,9 @@ struct _snd_pcm_runtime { | |||
2742 | 2742 | ||
2743 | <para> | 2743 | <para> |
2744 | Another note is that this callback is non-atomic | 2744 | Another note is that this callback is non-atomic |
2745 | (schedulable). This is important, because the | 2745 | (schedulable) as default, i.e. when no |
2746 | <structfield>nonatomic</structfield> flag set. | ||
2747 | This is important, because the | ||
2746 | <structfield>trigger</structfield> callback | 2748 | <structfield>trigger</structfield> callback |
2747 | is atomic (non-schedulable). That is, mutexes or any | 2749 | is atomic (non-schedulable). That is, mutexes or any |
2748 | schedule-related functions are not available in | 2750 | schedule-related functions are not available in |
@@ -2900,8 +2902,9 @@ struct _snd_pcm_runtime { | |||
2900 | </para> | 2902 | </para> |
2901 | 2903 | ||
2902 | <para> | 2904 | <para> |
2903 | As mentioned, this callback is atomic. You cannot call | 2905 | As mentioned, this callback is atomic as default unless |
2904 | functions which may sleep. | 2906 | <structfield>nonatomic</structfield> flag set, and |
2907 | you cannot call functions which may sleep. | ||
2905 | The trigger callback should be as minimal as possible, | 2908 | The trigger callback should be as minimal as possible, |
2906 | just really triggering the DMA. The other stuff should be | 2909 | just really triggering the DMA. The other stuff should be |
2907 | initialized hw_params and prepare callbacks properly | 2910 | initialized hw_params and prepare callbacks properly |
@@ -2936,7 +2939,7 @@ struct _snd_pcm_runtime { | |||
2936 | </para> | 2939 | </para> |
2937 | 2940 | ||
2938 | <para> | 2941 | <para> |
2939 | This callback is also atomic. | 2942 | This callback is also atomic as default. |
2940 | </para> | 2943 | </para> |
2941 | </section> | 2944 | </section> |
2942 | 2945 | ||
@@ -2972,7 +2975,7 @@ struct _snd_pcm_runtime { | |||
2972 | is useful only for such a purpose. | 2975 | is useful only for such a purpose. |
2973 | </para> | 2976 | </para> |
2974 | <para> | 2977 | <para> |
2975 | This callback is atomic. | 2978 | This callback is atomic as default. |
2976 | </para> | 2979 | </para> |
2977 | </section> | 2980 | </section> |
2978 | 2981 | ||
@@ -3175,6 +3178,21 @@ struct _snd_pcm_runtime { | |||
3175 | called with local interrupts disabled. | 3178 | called with local interrupts disabled. |
3176 | </para> | 3179 | </para> |
3177 | 3180 | ||
3181 | <para> | ||
3182 | The recent changes in PCM core code, however, allow all PCM | ||
3183 | operations to be non-atomic. This assumes that the all caller | ||
3184 | sides are in non-atomic contexts. For example, the function | ||
3185 | <function>snd_pcm_period_elapsed()</function> is called | ||
3186 | typically from the interrupt handler. But, if you set up the | ||
3187 | driver to use a threaded interrupt handler, this call can be in | ||
3188 | non-atomic context, too. In such a case, you can set | ||
3189 | <structfield>nonatomic</structfield> filed of | ||
3190 | <structname>snd_pcm</structname> object after creating it. | ||
3191 | When this flag is set, mutex and rwsem are used internally in | ||
3192 | the PCM core instead of spin and rwlocks, so that you can call | ||
3193 | all PCM functions safely in a non-atomic context. | ||
3194 | </para> | ||
3195 | |||
3178 | </section> | 3196 | </section> |
3179 | <section id="pcm-interface-constraints"> | 3197 | <section id="pcm-interface-constraints"> |
3180 | <title>Constraints</title> | 3198 | <title>Constraints</title> |