[alsa-devel] [PATCH v2] ASoC: tlv320aic3x: Add support for tlv320aic3104

Benoît Thébaudeau benoit.thebaudeau.dev at gmail.com
Wed Feb 4 10:33:28 CET 2015


Dear Peter Ujfalusi,

On Wed, Feb 4, 2015 at 9:27 AM, Peter Ujfalusi <peter.ujfalusi at ti.com> wrote:
> On 02/04/2015 12:25 AM, Benoît Thébaudeau wrote:
>> On Mon, Feb 2, 2015 at 3:48 PM, Jyri Sarha <jsarha at ti.com> wrote:
>> [...]
>>> diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
>>> index b7ebce0..cb92cdb 100644
>>> --- a/sound/soc/codecs/tlv320aic3x.c
>>> +++ b/sound/soc/codecs/tlv320aic3x.c
>> [...]
>>> @@ -550,6 +575,22 @@ static const struct snd_kcontrol_new aic3x_right_pga_mixer_controls[] = {
>>>         SOC_DAPM_SINGLE_AIC3X("Mic3R Switch", MIC3LR_2_RADC_CTRL, 0, 1, 1),
>>>  };
>>>
>>> +/* Left PGA Mixer for tlv320aic3104 */
>>> +static const struct snd_kcontrol_new aic3104_left_pga_mixer_controls[] = {
>>> +       SOC_DAPM_SINGLE_AIC3X("Line1L Switch", LINE1L_2_LADC_CTRL, 3, 1, 1),
>>> +       SOC_DAPM_SINGLE_AIC3X("Line1R Switch", LINE1R_2_LADC_CTRL, 3, 1, 1),
>>> +       SOC_DAPM_SINGLE_AIC3X("Mic2L Switch", MIC3LR_2_LADC_CTRL, 4, 1, 1),
>>> +       SOC_DAPM_SINGLE_AIC3X("Mic2R Switch", MIC3LR_2_LADC_CTRL, 0, 1, 1),
>>> +};
>>> +
>>> +/* Right PGA Mixer for tlv320aic3104 */
>>> +static const struct snd_kcontrol_new aic3104_right_pga_mixer_controls[] = {
>>> +       SOC_DAPM_SINGLE_AIC3X("Line1R Switch", LINE1R_2_RADC_CTRL, 3, 1, 1),
>>> +       SOC_DAPM_SINGLE_AIC3X("Line1L Switch", LINE1L_2_RADC_CTRL, 3, 1, 1),
>>> +       SOC_DAPM_SINGLE_AIC3X("Mic2L Switch", MIC3LR_2_RADC_CTRL, 4, 1, 1),
>>> +       SOC_DAPM_SINGLE_AIC3X("Mic2R Switch", MIC3LR_2_RADC_CTRL, 0, 1, 1),
>>> +};
>>> +
>>
>> This part is wrong. All these controls should be turned into TLVs.
>> Otherwise, because of the reset values of these registers, the
>> reserved value 0b1110 is used for the corresponding bit-fields if
>> their lsb is cleared using the controls above.
>
> These mixers are using  custom put callbacks via SOC_DAPM_SINGLE_AIC3X():
> snd_soc_dapm_put_volsw_aic3x, this will make sure that the input level control
> bits are handled right.
> The driver does not have means to handle the gain on these registers, it is
> either 0db (connected) or not connected.

What I meant was to do the following instead:

/*
 * ADC PGA mix input volumes. From -12 to 0 dB in 1.5 dB steps. Disconnected
 * below -12 dB
 */
static const DECLARE_TLV_DB_SCALE(mix_tlv, -1350, 150, 1);

/* Left PGA Mixer for tlv320aic3104 */
static const struct snd_kcontrol_new aic3104_left_pga_mixer_controls[] = {
    SOC_DAPM_SINGLE_MUT_TLV("Line1L Volume",
                LINE1L_2_LADC_CTRL, 3, 7, 15, 1, mix_tlv),
    SOC_DAPM_SINGLE_MUT_TLV("Line1R Volume",
                LINE1R_2_LADC_CTRL, 3, 7, 15, 1, mix_tlv),
    SOC_DAPM_SINGLE_MUT_TLV("Mic2L Volume",
                MIC3LR_2_LADC_CTRL, 4, 7, 15, 1, mix_tlv),
    SOC_DAPM_SINGLE_MUT_TLV("Mic2R Volume",
                MIC3LR_2_LADC_CTRL, 0, 7, 15, 1, mix_tlv),
};

/* Right PGA Mixer for tlv320aic3104 */
static const struct snd_kcontrol_new aic3104_right_pga_mixer_controls[] = {
    SOC_DAPM_SINGLE_MUT_TLV("Line1R Volume",
                LINE1R_2_RADC_CTRL, 3, 7, 15, 1, mix_tlv),
    SOC_DAPM_SINGLE_MUT_TLV("Line1L Volume",
                LINE1L_2_RADC_CTRL, 3, 7, 15, 1, mix_tlv),
    SOC_DAPM_SINGLE_MUT_TLV("Mic2L Volume",
                MIC3LR_2_RADC_CTRL, 4, 7, 15, 1, mix_tlv),
    SOC_DAPM_SINGLE_MUT_TLV("Mic2R Volume",
                MIC3LR_2_RADC_CTRL, 0, 7, 15, 1, mix_tlv),
};

Then, use the following instead of the "Switch" for the tlv320aic3104 interconn:
    {"Left PGA Mixer", "Line1L Volume", "Left Line1L Mux"},
    {"Left PGA Mixer", "Line1R Volume", "Left Line1R Mux"},
    {"Left PGA Mixer", "Mic2L Volume", "MIC2L"},
    {"Left PGA Mixer", "Mic2R Volume", "MIC2R"},

    {"Right PGA Mixer", "Line1L Volume", "Right Line1L Mux"},
    {"Right PGA Mixer", "Line1R Volume", "Right Line1R Mux"},
    {"Right PGA Mixer", "Mic2L Volume", "MIC2L"},
    {"Right PGA Mixer", "Mic2R Volume", "MIC2R"},

Best regards,
Benoît


More information about the Alsa-devel mailing list