Re: [alsa-devel] [PATCH v7 3/3] ASoC: da7210: Add support for lineinput and mic

From: Girdwood, Liam
Date: Thu Oct 20 2011 - 13:01:57 EST


On 20 October 2011 15:42, Ashish Chavan <ashish.chavan@xxxxxxxxxxxxxxx> wrote:
> DA7210 has three line inputs (AUX1 Left, AUX1 Right and AUX2) and
> a stereo MIC. This patch adds gain controls for MIC, AUX1, AUX2 as
> well as INPGA. It also adds a control to set ÂMIC BIAS voltage.
>
> Signed-off-by: Ashish Chavan <ashish.chavan@xxxxxxxxxxxxxxx>
> Signed-off-by: David Dajun Chen <dchen@xxxxxxxxxxx>
> ---
> Changes since v2:
> - Removed static enable of mic and aux, as now DAPM will take care of
> that
>
> Changes since v1:
> - Removed explicit setting of default gains
> - Removed control to set mic bias voltage
> ---
> Âsound/soc/codecs/da7210.c | Â 32 ++++++++++++++++++++++++++++++++
> Â1 files changed, 32 insertions(+), 0 deletions(-)
>
> diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
> index eaec60a..2f38b39 100644
> --- a/sound/soc/codecs/da7210.c
> +++ b/sound/soc/codecs/da7210.c
> @@ -181,9 +181,14 @@
>
> Â/* AUX1_L bit fields */
> Â#define DA7210_AUX1_L_VOL Â Â Â Â Â Â Â(0x3F << 0)
> +#define DA7210_AUX1_L_EN Â Â Â Â Â Â Â (1 << 7)
>
> Â/* AUX1_R bit fields */
> Â#define DA7210_AUX1_R_VOL Â Â Â Â Â Â Â(0x3F << 0)
> +#define DA7210_AUX1_R_EN Â Â Â Â Â Â Â (1 << 7)
> +
> +/* AUX2 bit fields */
> +#define DA7210_AUX2_EN Â Â Â Â Â Â Â Â (1 << 3)
>
> Â/* Minimum INPGA and AUX1 volume to enable noise suppression */
> Â#define DA7210_INPGA_MIN_VOL_NS Â Â Â Â Â Â Â Â0x0A Â/* 10.5dB */
> @@ -234,9 +239,19 @@ static const unsigned int mono_vol_tlv[] = {
> Â Â Â Â0x3, 0x7, TLV_DB_SCALE_ITEM(-1800, 600, 0)
> Â};
>
> +static const unsigned int aux1_vol_tlv[] = {
> + Â Â Â TLV_DB_RANGE_HEAD(2),
> + Â Â Â 0x0, 0x10, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
> + Â Â Â /* -48dB to 21dB */
> + Â Â Â 0x11, 0x3f, TLV_DB_SCALE_ITEM(-4800, 150, 0)
> +};
> +
> Âstatic const DECLARE_TLV_DB_SCALE(eq_gain_tlv, -1050, 150, 0);
> Âstatic const DECLARE_TLV_DB_SCALE(adc_eq_master_gain_tlv, -1800, 600, 1);
> Âstatic const DECLARE_TLV_DB_SCALE(dac_gain_tlv, -7725, 75, 0);
> +static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -600, 600, 0);
> +static const DECLARE_TLV_DB_SCALE(aux2_vol_tlv, -600, 600, 0);
> +static const DECLARE_TLV_DB_SCALE(inpga_gain_tlv, -450, 150, 0);
>
> Â/* ADC and DAC high pass filter f0 value */
> Âstatic const char const *da7210_hpf_cutoff_txt[] = {
> @@ -344,6 +359,17 @@ static const struct snd_kcontrol_new da7210_snd_controls[] = {
> Â Â Â ÂSOC_SINGLE_TLV("Mono Playback Volume", DA7210_OUT2, 0, 0x7, 0,
> Â Â Â Â Â Â Â Â Â Â Â mono_vol_tlv),
>
> + Â Â Â SOC_DOUBLE_R_TLV("Mic Capture Volume",
> + Â Â Â Â Â Â Â Â Â Â Â ÂDA7210_MIC_L, DA7210_MIC_R,
> + Â Â Â Â Â Â Â Â Â Â Â Â0, 0x5, 0, mic_vol_tlv),
> + Â Â Â SOC_DOUBLE_R_TLV("Aux1 Capture Volume",
> + Â Â Â Â Â Â Â Â Â Â Â ÂDA7210_AUX1_L, DA7210_AUX1_R,
> + Â Â Â Â Â Â Â Â Â Â Â Â0, 0x3f, 0, aux1_vol_tlv),
> + Â Â Â SOC_SINGLE_TLV("Aux2 Capture Volume", DA7210_AUX2, 0, 0x3, 0,
> + Â Â Â Â Â Â Â Â Â Â Âaux2_vol_tlv),
> + Â Â Â SOC_DOUBLE_TLV("In PGA Capture Volume", DA7210_IN_GAIN, 0, 4, 0xF, 0,
> + Â Â Â Â Â Â Â Â Â Â Âinpga_gain_tlv),
> +
> Â Â Â Â/* DAC Equalizer Âcontrols */
> Â Â Â ÂSOC_SINGLE("DAC EQ Switch", DA7210_DAC_EQ5, 7, 1, 0),
> Â Â Â ÂSOC_SINGLE_TLV("DAC EQ1 Volume", DA7210_DAC_EQ1_2, 0, 0xf, 1,
> @@ -928,6 +954,12 @@ static int da7210_probe(struct snd_soc_codec *codec)
> Â Â Â Âsnd_soc_write(codec, DA7210_OUT2, DA7210_OUT2_EN |
> Â Â Â Â Â Â Â Â Â Â DA7210_OUT2_OUTMIX_L | DA7210_OUT2_OUTMIX_R);
>
> + Â Â Â /* Enable Aux1 */
> + Â Â Â snd_soc_write(codec, DA7210_AUX1_L, DA7210_AUX1_L_EN);
> + Â Â Â snd_soc_write(codec, DA7210_AUX1_R, DA7210_AUX1_R_EN);
> + Â Â Â /* Enable Aux2 */
> + Â Â Â snd_soc_write(codec, DA7210_AUX2, DA7210_AUX2_EN);
> +

Your comment states this is now done by DAPM ?

Thanks

Liam


> Â Â Â Â/* Diable PLL and bypass it */
> Â Â Â Âsnd_soc_write(codec, DA7210_PLL, DA7210_PLL_FS_48000);
>
> --
> 1.7.1
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/