On Jul 30 2016 07:08, Mark Brown wrote:
But I think it's logically difficult to manage state of sound card; e.g.
disconnect. When one sound card instance consists of instances of
several 'DAI', 'Codecs' and 'Components' (this 'component' is not in
ALSA core contexts[1]) and we try to unload one of them, then which
state the card should be assigned to? Or no 'Codecs' drivers are loaded,
then which state should be assigned to the card?
The card only instantiates when all the components of the card are
present, until then it defers probe.
Oops. I forgot ALSA soc part utilizes EPROBE_DEFER. Thanks for your
correction.
Additionally, when old Codec driver is unloaded and new Codec driver is
loaded, then what should we do for corresponding PCM character devices
are? Currently, once snd_card_regsiter() is called, we cannot
insert/delete ALSA components such like PCM.
The card should be deinstantiated and reinstantiated whenever a
component driver unbinds and rebinds (respectively). You'd need to
completely deregister the card to change the list of things it's
expecting currently.
In a point of application interfaces, I guess that current
implementation of ALSA soc part includes a bug that it's possible to
unload codec or component modules when any ALSA character devices are
opened. The framework has no codes to manage reference counting of
character devices or loaded codecs, components.
Here, any of suggestions comes from my code reading. I apologize if
they're wrong.
Regards
Takashi Sakamoto