What is the purpose of snd_bcm2835 and how can I get it? Is it sound driver? And what is ALSA for?


I think that the snd_bcm2835 is the hardware abstraction layer for the audio I/O for the BCM2835 SOC.

ALSA and other drivers (for example for network cards) that need to deal with a lot of different chips/hardware implementations, are normally designed in a way that separates the lowlevel hardware control from the (more highlevel) process control.

Meaning that for Audio Chip A you need to set some parameters in a certain register, but for Audio Chip B you need to set some other (similar) parameters in a different register (different addressing for example). In that case you can decide to make two separate drivers, one for chip A and one for chip B.

When you create in both hardware drivers a function 'Init_Card()' (that might do very different thing, but with the same result: initialize the card) all the software layers you create on top of these hardware abstraction layers, do not need to know HOW to initialize the hardware, they just call that 'Init_Card()' function to the the chip in a usable state.

When you do this for all the functions that the chip has (play a sound, change mixer settings, record sound etc etc) you created a hardware abstraction layer for the chip. So for all the functionality of the various audio chips, you only need to call the same functions, but in different drivers (specific for that chip).

The higher software layers now do not need to worry about the hardware, they just read some data stream, buffer this if needed and hand the data to the correct function of the correct hardware driver who then makes sure that the data is processed according to the chips specific specifications.


ALSA (Advanced Linux Sound Architecture) is a software framework that provides support for sound. A program can use the ALSA API to request that sounds be played.

Not all sound hardware is equal. For example, some sound hardware may include hardware mixing of multiple channels. Other hardware may not. If a program requests a function that a specific piece of hardware does not support, ALSA will emulate that function in software. This makes the programmer's job easier, as he or she can program using the ALSA API, rather that having to write code for each and every sound card.

Once ALSA has translated a sound request into a format that the hardware can perform, then ALSA will use a hardware driver (such as snd_bcm2835) to send that request to the actual hardware.

When you compile the Linux kernel, you can choose which drivers to compile into the kernel, and which drivers to ignore. For many drivers, you also have the choice of compiling the driver directly into the kernel, or compiling the driver as a loadable kernel module. If the driver is built into the kernel, then it will always be in RAM. If the driver is a loadable kernel module (such as snd_bcm2835), the driver will sit on disk (and not in RAM) until the kernel tries to load that module.

So, the fact that you need to load the snd_bcm2835 module means that whoever compiled your kernel chose to compile that driver as a loadable kernel module rather than building it into the kernel. If the kernel includes a driver that it does not use, this will waste memory, and may also waste a few CPU cycles here and there. Compiling the driver as a module also allows the driver to be developed, recompiled and tested without recompiling the entire kernel and without rebooting.

  • A perhaps more significant reason to keep peripherals such as sound modular is to make it simple to disable them, e.g., to simplify things if multiple outputs are available. On the pi this may also be desirable WRT to the low level SoC audio driver in order to use the PCM clock for other purposes (although I am not sure if that is necessary or not). – goldilocks Aug 14 '16 at 2:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.