Chapter 3. Management of Cards and Components

Table of Contents

Card Instance
Chip-Specific Data
1. Allocating via snd_card_create().
2. Allocating an extra device.
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 whole list of 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 correct release of resources at destruction.

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

  struct snd_card *card;
  int err;
  err = snd_card_create(index, id, module, extra_size, &card);


The function takes five arguments, the card-index number, the id string, the module pointer (usually THIS_MODULE), the size of extra-data space, and the pointer to return the card instance. The extra_size argument is used to allocate card->private_data for the chip-specific data. Note that these data are allocated by snd_card_create().