But I'm afraid, this patch does break the Digital loopback, which needs the DACs to be powered, in case when the capture path is set in analog mode the ADC(s) also need to be powered.
I think that digital loopback should mix TX with RX only when both digital paths are enabled, i.e. in a full-duplex scenario.
Well, yes... short of. You can still enable the digital loopback without active stream. The TWL codec will be in the same state as it if you are using full duplex mode. The only difference is that the CPU dai is not running. The analog loopback also mixing the RX and TX data, but in the analog domain. If you have only the loopback enabled (analog or digital) the RX path is silent in both cases...
I got your point, thanks for the explanation. I think that we can take this part of the patch:
+ /* Enable master analog loopback mode if any analog switch is enabled*/ + misc = twl4030_read_reg_cache(w->codec, TWL4030_REG_MISC_SET_1); + if (twl4030->bypass_state & 0xF) + misc |= TWL4030_FMLOOP_EN; + else + misc &= ~TWL4030_FMLOOP_EN; + twl4030_write(w->codec, TWL4030_REG_MISC_SET_1, misc);
This bit MISC_SET_1[FMLOOP_EN] needs to set to 1 when any of the analog bypass switches are enabled. Without setting this bit, the loopback is kind of weak.
If it's fine for you, I can create a new patch for supporting the VDL analog bypass switch and add above change in that same patch.