[alsa-devel] ASoC: TLV320AIC3x: Adding additional functionality for 3106 with [Patch] for discuss

Peter Ujfalusi peter.ujfalusi at ti.com
Wed Mar 16 09:57:18 CET 2016


Hi Timur,

please avoid top posting.

On 03/15/16 18:13, Timur Karaldin wrote:
> Ok, I choose the way #1 without changing kcontrol names.
> Another thing I don't understand is the way for caching gain volume if I have
> switches muted. Is there any proper way for storing cached values between gain
> and switch handlers includes soft reset or I need manually check kcontrol name
> in handler and cache values in extended private structure? The same question
> for switch handler, because I need to share cached values between these handlers.

Since the problematic registers are: 17, 18, .. 24. I would have an array
inside struct aic3x_priv to store the configured gain. You could store the
mute as well, but since regmap is caching the content I would simply read back
the gain value and if it is 0xf, it is muted, so update only the local shadow,
if it is not muted, write the gain.
In the mute/unmute controls I would then save the gain to shadow when muting
the path and write the cached gain to the register when unmuting it. You
should also return correct 0/1 for the unmute state and not the actual
register value.

> 
> 15.03.2016 15:40, Peter Ujfalusi пишет:
>> 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.
>>
> 
> 


-- 
Péter


More information about the Alsa-devel mailing list