Hi,
On Tue, 28 Sep 2021, Takashi Iwai wrote:
Removing a component from the card is a PITA for now, indeed, especially when its influence is over different APIs (PCM, control, whatever)...
One thing I can think of is to perform like the vga_switcheroo handling in hda_intel.c; it's essentially a forced runtime suspend, and disable the whole card. But in the case of audio-component unbind, we need to think about re-binding -- or completely ignore re-binding until the whole driver gets unloaded.
thanks for the feedback! The switcheroo approach doesn't work too well for integrated HDA controllers that will typically have other codecs connected as well (and may have a DSP -> e.g. SOF/SST used as controller driver which would all need to implement this separately), but for the discrete GPU case this might be a workable approach (and makes sense as this is what switcheroo is meant for). I think gracefully handling the unbind is priority, but re-binding should be possible as well. We could do a switcheroo-enable type of flow in hdac_component_master_bind() and have the controller back up.
Of course it's not perfect still. I'd guess at least attempt to reach the codec#x procfs entry would hit timeouts if the controller is disabled this way.
Br, Kai