Tool/software: Linux
I'm trying to address an issue with clipping on my microphone inputs to the tlv320aic3104, on a embedded linux system. To achieve this, I'm trying to reduce the gains before the inputs are mixed prior to entering the programmable gain amplifier.
The datasheet indicates that I can use the MIC2L/R to Left ADC Control Register (Table 23. Page 0/Register 17) to achieve this, however the linux driver I have doesn't provide me user space access to this. Instead it appears to map this register to the "Mic2L Switch" and Mic2R Switch" of the Left PGA Mixer. Looking at the driver code (linux/sound/soc/codecs/tlv320aic3x.c) seems to be declaring this widget option, like this:
/* 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),
};
with the Mic2L switch turned on, i2cget returns values of 0x0f (0dB gain), and when off it returns 0xff (not connected)
I found the definition of the macro to be:
#define SOC_DAPM_SINGLE_AIC3X(xname, reg, shift, mask, invert) \
SOC_SINGLE_EXT(xname, reg, shift, mask, invert, \
snd_soc_dapm_get_volsw, snd_soc_dapm_put_volsw_aic3x)
And so as a shot in the dark, I've changed it to this, and rebuilt:
SOC_DAPM_SINGLE_AIC3X("Mic2L Switch", MIC3LR_2_LADC_CTRL, 4, 0xf, 0),
SOC_DAPM_SINGLE_AIC3X("Mic2R Switch", MIC3LR_2_LADC_CTRL, 0, 0xf, 0),
Which I had hoped would enable me have full access to the register, but this seems to have made the setting disappear, so it seems like that hasn't worked.
As a final note, I'm using a 2014 version of the driver. I've compared this to the latest version on github.com/torvalds/linux but can't see any differences which would address this.
Any help or advice is very much appreciated.