Chapter 3. Management of Cards and Components

Table of Contents
Card Instance
Components
Chip-Specific Data
Registration and Release

Card Instance

For each soundcard, a "card" record must be allocated.

A card record is the headquarters of the soundcard. It manages the list of whole devices (components) on the soundcard, such as PCM, mixers, MIDI, synthesizer, and so on. Also, the card record holds the ID and the name strings of the card, manages the root of proc files, and controls the power-management states and hotplug disconnections. The component list on the card record is used to manage the proper releases of resources at destruction.

As mentioned above, to create a card instance, call snd_card_new().

  struct snd_card *card;
  card = snd_card_new(index, id, module, extra_size);
          

The function takes four arguments, the card-index number, the id string, the module pointer (usually THIS_MODULE), and the size of extra-data space. The last argument is used to allocate card->private_data for the chip-specific data. Note that this data is allocated by snd_card_new().