Commit f89e175a authored by Jaroslav Kysela's avatar Jaroslav Kysela

[ALSA] Description about snd_card_set_dev()

Documentation
Added the description about snd_card_set_dev().
Misc cleanup.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent ec3acaa8
...@@ -462,6 +462,9 @@ ...@@ -462,6 +462,9 @@
snd_mychip_free(chip); snd_mychip_free(chip);
return err; return err;
} }
snd_card_set_dev(card, &pci->dev);
*rchip = chip; *rchip = chip;
return 0; return 0;
} }
...@@ -748,7 +751,7 @@ ...@@ -748,7 +751,7 @@
</programlisting> </programlisting>
</informalexample> </informalexample>
where the last twos are necessary only when module options are where the last one is necessary only when module options are
defined in the source file. If the codes are split to several defined in the source file. If the codes are split to several
files, the file without module options don't need them. files, the file without module options don't need them.
</para> </para>
...@@ -1168,6 +1171,9 @@ ...@@ -1168,6 +1171,9 @@
snd_mychip_free(chip); snd_mychip_free(chip);
return err; return err;
} }
snd_card_set_dev(card, &pci->dev);
*rchip = chip; *rchip = chip;
return 0; return 0;
} }
...@@ -1481,7 +1487,7 @@ ...@@ -1481,7 +1487,7 @@
When the chip-data is assigned to the card using When the chip-data is assigned to the card using
<function>snd_device_new()</function> with <function>snd_device_new()</function> with
<constant>SNDRV_DEV_LOWLELVEL</constant> , its destructor is <constant>SNDRV_DEV_LOWLELVEL</constant> , its destructor is
called at the last. that is, it is assured that all other called at the last. That is, it is assured that all other
components like PCMs and controls have been already released. components like PCMs and controls have been already released.
You don't have to call stopping PCMs, etc. explicitly, but just You don't have to call stopping PCMs, etc. explicitly, but just
stop the hardware in the low-level. stop the hardware in the low-level.
...@@ -1504,7 +1510,7 @@ ...@@ -1504,7 +1510,7 @@
</programlisting> </programlisting>
</informalexample> </informalexample>
and the allocation would be (assuming its size is 512 bytes): and the allocation would be like below:
<informalexample> <informalexample>
<programlisting> <programlisting>
...@@ -1541,6 +1547,30 @@ ...@@ -1541,6 +1547,30 @@
</section> </section>
<section id="pci-resource-device-struct">
<title>Registration of Device Struct</title>
<para>
At some point, typically after calling <function>snd_device_new()</function>,
you need to register the <structname>struct device</structname> of the chip
you're handling for udev and co. ALSA provides a macro for compatibility with
older kernels. Simply call like the following:
<informalexample>
<programlisting>
<![CDATA[
snd_card_set_dev(card, &pci->dev);
]]>
</programlisting>
</informalexample>
so that it stores the PCI's device pointer to the card. This will be
referred by ALSA core functions later when the devices are registered.
</para>
<para>
In the case of non-PCI, pass the proper device struct pointer of the BUS
instead. (In the case of legacy ISA without PnP, you don't have to do
anything.)
</para>
</section>
<section id="pci-resource-entries"> <section id="pci-resource-entries">
<title>PCI Entries</title> <title>PCI Entries</title>
<para> <para>
...@@ -5437,7 +5467,10 @@ struct _snd_pcm_runtime { ...@@ -5437,7 +5467,10 @@ struct _snd_pcm_runtime {
depends on SND depends on SND
select SND_PCM select SND_PCM
help help
Say 'Y' or 'M' to include support for Foobar XYZ soundcard. Say Y here to include support for Foobar XYZ soundcard.
To compile this driver as a module, choose M here: the module
will be called snd-xyz.
]]> ]]>
</programlisting> </programlisting>
</informalexample> </informalexample>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment