[alsa-devel] [PATCH 2/4] ASoC: Add ADAU1373 codec support

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Aug 11 11:27:11 CEST 2011


On Wed, Aug 10, 2011 at 05:52:42AM +0200, Lars-Peter Clausen wrote:

> +static const char *adau1373_micbias_text[] = {
> +	"2.9 V",
> +	"2.2 V",
> +	"2.6 V",
> +	"1.8 V",
> +};

This should be controlled by platform data and/or the machine driver,
not interactively by the user.  With some microphone technologies there
is actually a risk of damage with higher micbiases.

> +	SOC_DOUBLE("AIF3 Playback Boost(+6dB)", ADAU1373_VOL_GAIN1, 4, 5, 1, 0),
> +	SOC_DOUBLE("AIF2 Playback Boost(+6dB)", ADAU1373_VOL_GAIN1, 2, 3, 1, 0),
> +	SOC_DOUBLE("AIF1 Playback Boost(+6dB)", ADAU1373_VOL_GAIN1, 0, 1, 1, 0),
> +	SOC_DOUBLE("AIF3 Capture Boost(+6dB)", ADAU1373_VOL_GAIN2, 4, 5, 1, 0),
> +	SOC_DOUBLE("AIF2 Capture Boost(+6dB)", ADAU1373_VOL_GAIN2, 2, 3, 1, 0),
> +	SOC_DOUBLE("AIF1 Capture Boost(+6dB)", ADAU1373_VOL_GAIN2, 0, 1, 1, 0),
> +	SOC_DOUBLE("DMIC Capture Boost(+6dB)", ADAU1373_VOL_GAIN3, 6, 7, 1, 0),
> +	SOC_DOUBLE("ADC Capture Boost(+6dB)", ADAU1373_VOL_GAIN3, 4, 5, 1, 0),
> +	SOC_DOUBLE("DAC2 Playback Boost(+6dB)", ADAU1373_VOL_GAIN3, 2, 3, 1, 0),
> +	SOC_DOUBLE("DAC1 Playback Boost(+6dB)", ADAU1373_VOL_GAIN3, 0, 1, 1, 0),
> +
> +	SOC_DOUBLE("Input1 Boost(+20dB)", ADAU1373_ADC_GAIN, 0, 4, 1, 0),
> +	SOC_DOUBLE("Input2 Boost(+20dB)", ADAU1373_ADC_GAIN, 1, 5, 1, 0),
> +	SOC_DOUBLE("Input3 Boost(+20dB)", ADAU1373_ADC_GAIN, 2, 6, 1, 0),
> +	SOC_DOUBLE("Input4 Boost(+20dB)", ADAU1373_ADC_GAIN, 3, 7, 1, 0),

All this stuff should be TLV.

> +	SOC_ENUM("Lineout1 Mono Stereo", adau1373_lineout1_mode_enum),
> +	SOC_ENUM("Speaker Mono Stereo", adau1373_speaker_mode_enum),

I'd expect these to be platform data/machine data rather than user
control?  The speaker wiring isn't going to vary dynamically...

> +	switch (freq / params_rate(params)) {
> +	case 1024: /* fs */
> +		div = 0;
> +		break;
> +	case 1536: /* 2/3 fs */
> +		div = 1;
> +		break;

These comments look inaccuate, fs is the sample rate so a divide of 1
would be fs.

> +static void adau1373_load_drc_settings(struct snd_soc_codec *codec,
> +	unsigned int nr, uint8_t *drc)
> +{
> +	unsigned int i;
> +
> +	for (i = 0; i < 13; ++i)
> +		snd_soc_write(codec, ADAU1373_DRC(nr) + i, drc[i]);

ARRAY_SIZE() or a #define or something rather than a magic number.


More information about the Alsa-devel mailing list