On 03/15/16 14:12, Timur Karaldin wrote:
Hi Peter!
14.03.2016 17:47, Peter Ujfalusi пишет:
So the issue is that we have the DAPM switches controlling exactly the same registers. I believe if you would set the gain in a way that bit0 is 1, then DAPM will think that the path is disconnected. Also if you would set the gain and then mute and unmute the path you would have lost the gain you wanted to have.. The only way I can think of implementing these mixers is to have two sets of custom callbacks. one set is to set/get the gain and the other is to set/get the mute/disconnect on these. When the path is disconnected you should not write the gain change to the chip, but cache it and if the path is unmuted, you write the cached gain. When you mute the path you should take the set gain first, cache it, then disconnect the path. For these gains you should have DECLARE_TLV_DB_SCALE() and use SOC_SINGLE_TLV(). Make sure that the control name matches with the corresponding DAPM widget's name so ALSA can match them correctly.
That's not clear for me. As I understand, I need to create SOC_SINGLE_TLV() for each gain I would like to change, with the same name as SOC_DAPM_SINGLE_AIC3x (for example "Line1L Switch" for Line1) and make callbacks with cached gain values. Am I right?
Mostly yes, but you need to name the controls: existing switch + new gain control "Line1L Switch" + "Line1L Volume" "Line1R Switch" + "Line1R Volume"
In this way alsamixer can combine them.
May be the better sollution is to change SOC_DAPM_SINGLE_AIC3x on/off switch to other type with switch and gain control together? So it could have some connected states with different gains and disconnected state (Something like volume/mute control).
Something based on SOC_DAPM_SINGLE_TLV should work. But that means again change in Kcontrol names.