On 5/24/23 13:30, Mark Brown wrote:
On Wed, May 24, 2023 at 10:41:54AM +0300, Cristian Ciocaltea wrote:
This means that either the hardware default is wrongly set to 0xB instead of 0xA, or the specs are incorrect and instead of having the range 0xA-0xF mapped to -1.5 dB, the single value 0xA should have been mapped to -1.5 dB and the remaining range 0xB-0xF to 0 dB.
Increment the max value allowed for ALC Capture Target Volume control, so that it matches the hardware default.
- SOC_SINGLE_TLV("ALC Capture Target Volume", ES8316_ADC_ALC3, 4, 10, 0,
- SOC_SINGLE_TLV("ALC Capture Target Volume", ES8316_ADC_ALC3, 4, 11, 0, alc_target_tlv),
The description above of what the control does doesn't seem to match what alc_target_tlv specifies - it is:
static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(alc_target_tlv, -1650, 150, 0);
which is saying that the value goes from -16.5dB up in steps of 1.5dB but your description above says that 0-10 map to -1.5dB and other values are 0dB.
My description above mentioned only the 0xA-0xF (10-15) range, anything before that is fine and the implementation matches the specs:
0000 –> -16.5 dB 0001 –> -15.0 dB 0010 –> -13.5 dB ... 0111 –> -6.0 dB 1000 –> -4.5 dB 1001 –> -3.0 dB
The inconsistency is here: 1010-1111 –> -1.5 dB
Since the hardware default is 1011 (11) instead of 1010 (10), I assumed the specs could be wrong and probably should have provided the following mappings:
1010 -> -1.5 dB 1011-1111 -> 0 dB
Presumably you can check the effects of changing the value? It seems plausible that what's written in the code might be accurate and the higher values might actually change the gain but it'd be better to check.
I haven't noticed a (measurable) change in gain when switching between 10 and 11, but my testing equipment is also not that great. Will try to improve the tests accuracy.
Thanks, Cristian