Complete Communications Engineering

Developing drivers for custom SoC audio solutions can be a challenge.  The Linux kernel has built-in support for SoC audio chips, and understanding its architecture can help in developing drivers for custom hardware.  Three main classes that are part of the Linux SoC driver model are snd_soc_card, snd_soc_dai_link and snd_soc_component.  (Even though the Linux kernel is written mostly in c, its architecture is modular and it can be described using object-oriented semantics.)

The card class is the ALSA interface.  It contains one or more dai links, and it aggregates various controls from each of its components.  The component class represents actual hardware.  It implements functions to read and write the registers of the hardware.  The card controls are accessible through the ALSA interface and can be adjusted at run time.  (For example, the alsamixer program can be used for this.)  Each control is tied to registers in the component, so adjusting the control will change the registers.  The controls can be switches that turn audio paths on and off, or sliders that control gain levels.  The dai-link class represents the digital connection between a codec and a CPU.  It is associated with multiple components where each component is either a CPU or a codec.  When audio is started, ALSA sends configuration commands to the dai-link, which then reads and writes the registers of each component according to the given configuration.

Linux Driver Model for SoC Audio