diff options
Diffstat (limited to 'Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl')
-rw-r--r-- | Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl index 1faf76383bab..69866d5997a4 100644 --- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl +++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl | |||
@@ -1149,7 +1149,7 @@ | |||
1149 | } | 1149 | } |
1150 | chip->port = pci_resource_start(pci, 0); | 1150 | chip->port = pci_resource_start(pci, 0); |
1151 | if (request_irq(pci->irq, snd_mychip_interrupt, | 1151 | if (request_irq(pci->irq, snd_mychip_interrupt, |
1152 | SA_INTERRUPT|SA_SHIRQ, "My Chip", chip)) { | 1152 | IRQF_DISABLED|IRQF_SHARED, "My Chip", chip)) { |
1153 | printk(KERN_ERR "cannot grab irq %d\n", pci->irq); | 1153 | printk(KERN_ERR "cannot grab irq %d\n", pci->irq); |
1154 | snd_mychip_free(chip); | 1154 | snd_mychip_free(chip); |
1155 | return -EBUSY; | 1155 | return -EBUSY; |
@@ -1323,7 +1323,7 @@ | |||
1323 | <programlisting> | 1323 | <programlisting> |
1324 | <![CDATA[ | 1324 | <![CDATA[ |
1325 | if (request_irq(pci->irq, snd_mychip_interrupt, | 1325 | if (request_irq(pci->irq, snd_mychip_interrupt, |
1326 | SA_INTERRUPT|SA_SHIRQ, "My Chip", chip)) { | 1326 | IRQF_DISABLED|IRQF_SHARED, "My Chip", chip)) { |
1327 | printk(KERN_ERR "cannot grab irq %d\n", pci->irq); | 1327 | printk(KERN_ERR "cannot grab irq %d\n", pci->irq); |
1328 | snd_mychip_free(chip); | 1328 | snd_mychip_free(chip); |
1329 | return -EBUSY; | 1329 | return -EBUSY; |
@@ -1342,7 +1342,7 @@ | |||
1342 | 1342 | ||
1343 | <para> | 1343 | <para> |
1344 | On the PCI bus, the interrupts can be shared. Thus, | 1344 | On the PCI bus, the interrupts can be shared. Thus, |
1345 | <constant>SA_SHIRQ</constant> is given as the interrupt flag of | 1345 | <constant>IRQF_SHARED</constant> is given as the interrupt flag of |
1346 | <function>request_irq()</function>. | 1346 | <function>request_irq()</function>. |
1347 | </para> | 1347 | </para> |
1348 | 1348 | ||
@@ -3048,7 +3048,7 @@ struct _snd_pcm_runtime { | |||
3048 | </para> | 3048 | </para> |
3049 | 3049 | ||
3050 | <para> | 3050 | <para> |
3051 | If you aquire a spinlock in the interrupt handler, and the | 3051 | If you acquire a spinlock in the interrupt handler, and the |
3052 | lock is used in other pcm callbacks, too, then you have to | 3052 | lock is used in other pcm callbacks, too, then you have to |
3053 | release the lock before calling | 3053 | release the lock before calling |
3054 | <function>snd_pcm_period_elapsed()</function>, because | 3054 | <function>snd_pcm_period_elapsed()</function>, because |
@@ -4215,7 +4215,7 @@ struct _snd_pcm_runtime { | |||
4215 | <programlisting> | 4215 | <programlisting> |
4216 | <![CDATA[ | 4216 | <![CDATA[ |
4217 | struct snd_rawmidi *rmidi; | 4217 | struct snd_rawmidi *rmidi; |
4218 | snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port, integrated, | 4218 | snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port, info_flags, |
4219 | irq, irq_flags, &rmidi); | 4219 | irq, irq_flags, &rmidi); |
4220 | ]]> | 4220 | ]]> |
4221 | </programlisting> | 4221 | </programlisting> |
@@ -4242,15 +4242,36 @@ struct _snd_pcm_runtime { | |||
4242 | </para> | 4242 | </para> |
4243 | 4243 | ||
4244 | <para> | 4244 | <para> |
4245 | The 5th argument is bitflags for additional information. | ||
4245 | When the i/o port address above is a part of the PCI i/o | 4246 | When the i/o port address above is a part of the PCI i/o |
4246 | region, the MPU401 i/o port might have been already allocated | 4247 | region, the MPU401 i/o port might have been already allocated |
4247 | (reserved) by the driver itself. In such a case, pass non-zero | 4248 | (reserved) by the driver itself. In such a case, pass a bit flag |
4248 | to the 5th argument | 4249 | <constant>MPU401_INFO_INTEGRATED</constant>, |
4249 | (<parameter>integrated</parameter>). Otherwise, pass 0 to it, | ||
4250 | and | 4250 | and |
4251 | the mpu401-uart layer will allocate the i/o ports by itself. | 4251 | the mpu401-uart layer will allocate the i/o ports by itself. |
4252 | </para> | 4252 | </para> |
4253 | 4253 | ||
4254 | <para> | ||
4255 | When the controller supports only the input or output MIDI stream, | ||
4256 | pass <constant>MPU401_INFO_INPUT</constant> or | ||
4257 | <constant>MPU401_INFO_OUTPUT</constant> bitflag, respectively. | ||
4258 | Then the rawmidi instance is created as a single stream. | ||
4259 | </para> | ||
4260 | |||
4261 | <para> | ||
4262 | <constant>MPU401_INFO_MMIO</constant> bitflag is used to change | ||
4263 | the access method to MMIO (via readb and writeb) instead of | ||
4264 | iob and outb. In this case, you have to pass the iomapped address | ||
4265 | to <function>snd_mpu401_uart_new()</function>. | ||
4266 | </para> | ||
4267 | |||
4268 | <para> | ||
4269 | When <constant>MPU401_INFO_TX_IRQ</constant> is set, the output | ||
4270 | stream isn't checked in the default interrupt handler. The driver | ||
4271 | needs to call <function>snd_mpu401_uart_interrupt_tx()</function> | ||
4272 | by itself to start processing the output stream in irq handler. | ||
4273 | </para> | ||
4274 | |||
4254 | <para> | 4275 | <para> |
4255 | Usually, the port address corresponds to the command port and | 4276 | Usually, the port address corresponds to the command port and |
4256 | port + 1 corresponds to the data port. If not, you may change | 4277 | port + 1 corresponds to the data port. If not, you may change |
@@ -5333,7 +5354,7 @@ struct _snd_pcm_runtime { | |||
5333 | <informalexample> | 5354 | <informalexample> |
5334 | <programlisting> | 5355 | <programlisting> |
5335 | <![CDATA[ | 5356 | <![CDATA[ |
5336 | snd_info_set_text_ops(entry, chip, read_size, my_proc_read); | 5357 | snd_info_set_text_ops(entry, chip, my_proc_read); |
5337 | ]]> | 5358 | ]]> |
5338 | </programlisting> | 5359 | </programlisting> |
5339 | </informalexample> | 5360 | </informalexample> |
@@ -5394,7 +5415,6 @@ struct _snd_pcm_runtime { | |||
5394 | <informalexample> | 5415 | <informalexample> |
5395 | <programlisting> | 5416 | <programlisting> |
5396 | <![CDATA[ | 5417 | <![CDATA[ |
5397 | entry->c.text.write_size = 256; | ||
5398 | entry->c.text.write = my_proc_write; | 5418 | entry->c.text.write = my_proc_write; |
5399 | ]]> | 5419 | ]]> |
5400 | </programlisting> | 5420 | </programlisting> |
@@ -5402,22 +5422,6 @@ struct _snd_pcm_runtime { | |||
5402 | </para> | 5422 | </para> |
5403 | 5423 | ||
5404 | <para> | 5424 | <para> |
5405 | The buffer size for read is set to 1024 implicitly by | ||
5406 | <function>snd_info_set_text_ops()</function>. It should suffice | ||
5407 | in most cases (the size will be aligned to | ||
5408 | <constant>PAGE_SIZE</constant> anyway), but if you need to handle | ||
5409 | very large text files, you can set it explicitly, too. | ||
5410 | |||
5411 | <informalexample> | ||
5412 | <programlisting> | ||
5413 | <![CDATA[ | ||
5414 | entry->c.text.read_size = 65536; | ||
5415 | ]]> | ||
5416 | </programlisting> | ||
5417 | </informalexample> | ||
5418 | </para> | ||
5419 | |||
5420 | <para> | ||
5421 | For the write callback, you can use | 5425 | For the write callback, you can use |
5422 | <function>snd_info_get_line()</function> to get a text line, and | 5426 | <function>snd_info_get_line()</function> to get a text line, and |
5423 | <function>snd_info_get_str()</function> to retrieve a string from | 5427 | <function>snd_info_get_str()</function> to retrieve a string from |
@@ -5562,7 +5566,7 @@ struct _snd_pcm_runtime { | |||
5562 | power status.</para></listitem> | 5566 | power status.</para></listitem> |
5563 | <listitem><para>Call <function>snd_pcm_suspend_all()</function> to suspend the running PCM streams.</para></listitem> | 5567 | <listitem><para>Call <function>snd_pcm_suspend_all()</function> to suspend the running PCM streams.</para></listitem> |
5564 | <listitem><para>If AC97 codecs are used, call | 5568 | <listitem><para>If AC97 codecs are used, call |
5565 | <function>snd_ac97_resume()</function> for each codec.</para></listitem> | 5569 | <function>snd_ac97_suspend()</function> for each codec.</para></listitem> |
5566 | <listitem><para>Save the register values if necessary.</para></listitem> | 5570 | <listitem><para>Save the register values if necessary.</para></listitem> |
5567 | <listitem><para>Stop the hardware if necessary.</para></listitem> | 5571 | <listitem><para>Stop the hardware if necessary.</para></listitem> |
5568 | <listitem><para>Disable the PCI device by calling | 5572 | <listitem><para>Disable the PCI device by calling |