[alsa-devel] HD-Audio: How to reduce driver initializaton time if multiple codecs present on the bus?

Lin, Mengdong mengdong.lin at intel.com
Thu Nov 28 15:57:22 CET 2013

Hi Takashi,

We're trying to reduce the HD-A driver initialization time when more than one codecs are connected to the bus, but are blocked.
Would you please share some advices on this?

Usually, there is one HD-A controller connecting to two codecs: one on-board codec and one integrated display codec.
During initialization, the codecs are created and configured in a serial way.

Creating a codec may cost 6~20ms, and then building controls make cost about 15~30ms.
So I had thought it's helpful to build controls for different codecs in parallel in function snd_hda_build_controls(), as we did in driver suspend/resume.

But the test shows this doesn't work:

(1)     Using a workqueue without WQ_UNBOUND, the work items, which calls snd_hda_codec_build_controls(), are processed one after one

(I think because there is no explicit sleep in the work function). So the total time does not change.

(2)     Using an unbouned work queue for the bus or using separate kthreads for each codec, the work items for different codecs are processed in parallel.

However, the total time is still the sum of two codec as that without parallel.
I think that because snd_hda_codec_read() are used during initialization, the command execution on bus is serialized in the low level.
So even if we parallel initializing two codecs in high level, commands on bus are still processed one by one so the total time cannot reduce.

We're blocked here. Is there any other means to reduce the time?


More information about the Alsa-devel mailing list