[alsa-devel] [PATCH v3 1/2] ASoC: add es8316 codec driver

Daniel Drake drake at endlessm.com
Tue Jun 6 15:59:43 CEST 2017


Hi Takashi,

On Mon, Jun 5, 2017 at 6:30 PM, Takashi Sakamoto
<o-takashi at sakamocchi.jp> wrote:
> To me, the array of 'adc_pga_gain_tlv' includes invalid members as
> 'SNDRV_CTL_TLVT_DB_RANGE'. In your code, the array represents below table:
>
> Linear range: dB range: coeff: mute
> 0 <-> 0:    0 <->    0: 0: 0
> 1 <-> 1:  300 <->  300: 0: 0
> 2 <-> 2:  600 <->  600: 0: 0
> 3 <-> 3:  900 <->  900: 0: 0
> 4 <-> 4: 1200 <-> 1200: 0: 0
> 5 <-> 5: 1500 <-> 1500: 0: 0
> 6 <-> 6: 1800 <-> 1800: 0: 0
> 7 <-> 7: 2100 <-> 2100: 0: 0
> 8 <-> 8: 2400 <-> 2400: 0: 0
>
> Can I ask you to ensure that your hardware has jumps for current dB value
> against given linear value and investigate the reason that maximum value in
> this table has too large value (2,400) as dB representation.

Thanks for the the info here! Based on the datasheet and newer headers
I have updated it to:

static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(adc_pga_gain_tlv,
    0, 0, TLV_DB_SCALE_ITEM(-3500, 0, 0),
    1, 1, TLV_DB_SCALE_ITEM(0, 0, 0),
    2, 2, TLV_DB_SCALE_ITEM(250, 0, 0),
    3, 3, TLV_DB_SCALE_ITEM(450, 0, 0),
    4, 4, TLV_DB_SCALE_ITEM(700, 0, 0),
    5, 5, TLV_DB_SCALE_ITEM(1000, 0, 0),
    6, 6, TLV_DB_SCALE_ITEM(1300, 0, 0),
    7, 7, TLV_DB_SCALE_ITEM(1600, 0, 0),
    8, 8, TLV_DB_SCALE_ITEM(1800, 0, 0),
    9, 9, TLV_DB_SCALE_ITEM(2100, 0, 0),
    10, 10, TLV_DB_SCALE_ITEM(2400, 0, 0),
);

I believe the final entry means 24dB and does not have the large value
that you have interpreted.
There are many other drivers using similar values like this from rt5616.c:

/* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(bst_tlv,
    0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
    1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
    2, 2, TLV_DB_SCALE_ITEM(2400, 0, 0),
    3, 5, TLV_DB_SCALE_ITEM(3000, 500, 0),
    6, 6, TLV_DB_SCALE_ITEM(4400, 0, 0),
    7, 7, TLV_DB_SCALE_ITEM(5000, 0, 0),
    8, 8, TLV_DB_SCALE_ITEM(5200, 0, 0),
);

I'll test this change and wait for any further review comments before
sending a v4. I've also noticed that hpout_vol_tlv can be corrected
and simplified.

Thanks
Daniel


More information about the Alsa-devel mailing list