4.4 构建Codec
理解Codec的概念后,接着看构建Codec的代码。
4.4.1 azx_probe_codecs
在azx_probe_continue的代码中,调用了azx_probe_codecs。
if (bus->codec_mask) {
err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]);
if (err < 0)
goto out_free;
}
其中的参数azx_max_codecs是代码中写死的一个数组,针对不同的厂商,最对支持的codec数量不一样。实际上呢,只有两个厂商不一样:
static const unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = {
[AZX_DRIVER_NVIDIA] = 8,
[AZX_DRIVER_TERA] = 1,
};
数组中的其它的值都是默认值0。
int azx_probe_codecs(struct azx *chip, unsigned int max_slots)
{
struct hdac_bus *bus