Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: July 2017



audio_dev_alloc, audio_dev_free - allocate or free an audio device


#include <sys/audio/audio_driver.h>

audio_dev_t *audio_dev_alloc(dev_info_t *dip, int devno);
void audio_dev_free(audio_dev_t *adev);



the device instance structure for the device


an integer representing the “logical device” number of the device. If 0 is supplied, the instance number returned from ddi_get_instance(9F) is used instead.


pointer to an audio device allocated with audio_dev_alloc()

Interface Level

Solaris DDI specific (Solaris DDI)


The audio_dev_alloc() function allocates a structure representing a logical audio device. Normally, there is one such audio device per dev_info_t. Some devices, however, may support the notion of multiple logical devices, where different audio devices with completely independent configurations can be supported. These devices will usually have completely independent physical ports as well. In such cases, the driver may supply a non-zero value for the devno.

If devno is used, it is the responsibility of the driver to ensure that all values of devno are unique for that particular driver, and a devno must be supplied for all hardware instances in the system to avoid collisions with device instance numbers.

An audio device (audio_dev_t) may have multiple DMA or PIO engines “streams”, but generally all of these engines are subject to the same set of controllable parameters (such as gain, port selection, etc.)

The audio_dev_free() function frees a previously allocated audio device handle and releases any resources associated with it.

Return Values

The audio_dev_alloc() function returns an opaque handle for the audio device. It always succeeds.


The audio_dev_alloc() and audio_dev_free() functions may be called from user or kernel context only.


See attributes(5) for descriptions of the following attributes:

Interface Stability

See Also

attributes(5), audio(7D), audio_add_control(9F), audio_add_engine(9F) , audio_dev_register(9F), audio_set_description (9F), audio_dev_suspend(9F)

Writing Device Drivers for Oracle Solaris 11.3