diff options
Diffstat (limited to 'Documentation/DocBook/writing-an-alsa-driver.tmpl')
-rw-r--r-- | Documentation/DocBook/writing-an-alsa-driver.tmpl | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index fb32aead5a0b..bd6fee22c4dd 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -871,9 +871,8 @@ | |||
871 | <para> | 871 | <para> |
872 | This function itself doesn't allocate the data space. The data | 872 | This function itself doesn't allocate the data space. The data |
873 | must be allocated manually beforehand, and its pointer is passed | 873 | must be allocated manually beforehand, and its pointer is passed |
874 | as the argument. This pointer is used as the | 874 | as the argument. This pointer (<parameter>chip</parameter> in the |
875 | (<parameter>chip</parameter> identifier in the above example) | 875 | above example) is used as the identifier for the instance. |
876 | for the instance. | ||
877 | </para> | 876 | </para> |
878 | 877 | ||
879 | <para> | 878 | <para> |
@@ -2304,7 +2303,7 @@ struct _snd_pcm_runtime { | |||
2304 | <constant>SNDRV_PCM_INFO_XXX</constant>. Here, at least, you | 2303 | <constant>SNDRV_PCM_INFO_XXX</constant>. Here, at least, you |
2305 | have to specify whether the mmap is supported and which | 2304 | have to specify whether the mmap is supported and which |
2306 | interleaved format is supported. | 2305 | interleaved format is supported. |
2307 | When the is supported, add the | 2306 | When the hardware supports mmap, add the |
2308 | <constant>SNDRV_PCM_INFO_MMAP</constant> flag here. When the | 2307 | <constant>SNDRV_PCM_INFO_MMAP</constant> flag here. When the |
2309 | hardware supports the interleaved or the non-interleaved | 2308 | hardware supports the interleaved or the non-interleaved |
2310 | formats, <constant>SNDRV_PCM_INFO_INTERLEAVED</constant> or | 2309 | formats, <constant>SNDRV_PCM_INFO_INTERLEAVED</constant> or |
@@ -2898,7 +2897,7 @@ struct _snd_pcm_runtime { | |||
2898 | 2897 | ||
2899 | <para> | 2898 | <para> |
2900 | When the pcm supports the pause operation (given in the info | 2899 | When the pcm supports the pause operation (given in the info |
2901 | field of the hardware table), the <constant>PAUSE_PUSE</constant> | 2900 | field of the hardware table), the <constant>PAUSE_PUSH</constant> |
2902 | and <constant>PAUSE_RELEASE</constant> commands must be | 2901 | and <constant>PAUSE_RELEASE</constant> commands must be |
2903 | handled here, too. The former is the command to pause the pcm, | 2902 | handled here, too. The former is the command to pause the pcm, |
2904 | and the latter to restart the pcm again. | 2903 | and the latter to restart the pcm again. |
@@ -3085,7 +3084,7 @@ struct _snd_pcm_runtime { | |||
3085 | <section id="pcm-interface-interrupt-handler-timer"> | 3084 | <section id="pcm-interface-interrupt-handler-timer"> |
3086 | <title>High frequency timer interrupts</title> | 3085 | <title>High frequency timer interrupts</title> |
3087 | <para> | 3086 | <para> |
3088 | This happense when the hardware doesn't generate interrupts | 3087 | This happens when the hardware doesn't generate interrupts |
3089 | at the period boundary but issues timer interrupts at a fixed | 3088 | at the period boundary but issues timer interrupts at a fixed |
3090 | timer rate (e.g. es1968 or ymfpci drivers). | 3089 | timer rate (e.g. es1968 or ymfpci drivers). |
3091 | In this case, you need to check the current hardware | 3090 | In this case, you need to check the current hardware |
@@ -3251,18 +3250,19 @@ struct _snd_pcm_runtime { | |||
3251 | <title>Example of Hardware Constraints for Channels</title> | 3250 | <title>Example of Hardware Constraints for Channels</title> |
3252 | <programlisting> | 3251 | <programlisting> |
3253 | <![CDATA[ | 3252 | <![CDATA[ |
3254 | static int hw_rule_format_by_channels(struct snd_pcm_hw_params *params, | 3253 | static int hw_rule_channels_by_format(struct snd_pcm_hw_params *params, |
3255 | struct snd_pcm_hw_rule *rule) | 3254 | struct snd_pcm_hw_rule *rule) |
3256 | { | 3255 | { |
3257 | struct snd_interval *c = hw_param_interval(params, | 3256 | struct snd_interval *c = hw_param_interval(params, |
3258 | SNDRV_PCM_HW_PARAM_CHANNELS); | 3257 | SNDRV_PCM_HW_PARAM_CHANNELS); |
3259 | struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); | 3258 | struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); |
3260 | struct snd_mask fmt; | 3259 | struct snd_interval ch; |
3261 | 3260 | ||
3262 | snd_mask_any(&fmt); /* Init the struct */ | 3261 | snd_interval_any(&ch); |
3263 | if (c->min < 2) { | 3262 | if (f->bits[0] == SNDRV_PCM_FMTBIT_S16_LE) { |
3264 | fmt.bits[0] &= SNDRV_PCM_FMTBIT_S16_LE; | 3263 | ch.min = ch.max = 1; |
3265 | return snd_mask_refine(f, &fmt); | 3264 | ch.integer = 1; |
3265 | return snd_interval_refine(c, &ch); | ||
3266 | } | 3266 | } |
3267 | return 0; | 3267 | return 0; |
3268 | } | 3268 | } |
@@ -3278,35 +3278,35 @@ struct _snd_pcm_runtime { | |||
3278 | <programlisting> | 3278 | <programlisting> |
3279 | <![CDATA[ | 3279 | <![CDATA[ |
3280 | snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, | 3280 | snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, |
3281 | hw_rule_channels_by_format, 0, SNDRV_PCM_HW_PARAM_FORMAT, | 3281 | hw_rule_channels_by_format, NULL, |
3282 | -1); | 3282 | SNDRV_PCM_HW_PARAM_FORMAT, -1); |
3283 | ]]> | 3283 | ]]> |
3284 | </programlisting> | 3284 | </programlisting> |
3285 | </informalexample> | 3285 | </informalexample> |
3286 | </para> | 3286 | </para> |
3287 | 3287 | ||
3288 | <para> | 3288 | <para> |
3289 | The rule function is called when an application sets the number of | 3289 | The rule function is called when an application sets the PCM |
3290 | channels. But an application can set the format before the number of | 3290 | format, and it refines the number of channels accordingly. |
3291 | channels. Thus you also need to define the inverse rule: | 3291 | But an application may set the number of channels before |
3292 | setting the format. Thus you also need to define the inverse rule: | ||
3292 | 3293 | ||
3293 | <example> | 3294 | <example> |
3294 | <title>Example of Hardware Constraints for Channels</title> | 3295 | <title>Example of Hardware Constraints for Formats</title> |
3295 | <programlisting> | 3296 | <programlisting> |
3296 | <![CDATA[ | 3297 | <![CDATA[ |
3297 | static int hw_rule_channels_by_format(struct snd_pcm_hw_params *params, | 3298 | static int hw_rule_format_by_channels(struct snd_pcm_hw_params *params, |
3298 | struct snd_pcm_hw_rule *rule) | 3299 | struct snd_pcm_hw_rule *rule) |
3299 | { | 3300 | { |
3300 | struct snd_interval *c = hw_param_interval(params, | 3301 | struct snd_interval *c = hw_param_interval(params, |
3301 | SNDRV_PCM_HW_PARAM_CHANNELS); | 3302 | SNDRV_PCM_HW_PARAM_CHANNELS); |
3302 | struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); | 3303 | struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); |
3303 | struct snd_interval ch; | 3304 | struct snd_mask fmt; |
3304 | 3305 | ||
3305 | snd_interval_any(&ch); | 3306 | snd_mask_any(&fmt); /* Init the struct */ |
3306 | if (f->bits[0] == SNDRV_PCM_FMTBIT_S16_LE) { | 3307 | if (c->min < 2) { |
3307 | ch.min = ch.max = 1; | 3308 | fmt.bits[0] &= SNDRV_PCM_FMTBIT_S16_LE; |
3308 | ch.integer = 1; | 3309 | return snd_mask_refine(f, &fmt); |
3309 | return snd_interval_refine(c, &ch); | ||
3310 | } | 3310 | } |
3311 | return 0; | 3311 | return 0; |
3312 | } | 3312 | } |
@@ -3321,8 +3321,8 @@ struct _snd_pcm_runtime { | |||
3321 | <programlisting> | 3321 | <programlisting> |
3322 | <![CDATA[ | 3322 | <![CDATA[ |
3323 | snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, | 3323 | snd_pcm_hw_rule_add(substream->runtime, 0, SNDRV_PCM_HW_PARAM_FORMAT, |
3324 | hw_rule_format_by_channels, 0, SNDRV_PCM_HW_PARAM_CHANNELS, | 3324 | hw_rule_format_by_channels, NULL, |
3325 | -1); | 3325 | SNDRV_PCM_HW_PARAM_CHANNELS, -1); |
3326 | ]]> | 3326 | ]]> |
3327 | </programlisting> | 3327 | </programlisting> |
3328 | </informalexample> | 3328 | </informalexample> |