[alsa-devel] [PATCH 2/2] ASoC: wm8960: correct gain value for input PGA and add microphone PGA

Charles Keepax ckeepax at opensource.wolfsonmicro.com
Thu Sep 10 10:20:38 CEST 2015


On Thu, Sep 10, 2015 at 09:20:26AM +0800, Zidan Wang wrote:
> On Wed, Sep 09, 2015 at 01:02:06PM +0100, Charles Keepax wrote:
> > On Wed, Sep 09, 2015 at 07:29:11PM +0800, Zidan Wang wrote:
> > > The input PGAs have a gain range from -17.25dB to +30dB in 0.75dB steps.
> > > 
> > > The boost stage can provide additional gain. For line inputs, -12dB to
> > > +6dB gain is available on the boost mixer. For micphone inputs, it can
> > > provide up to +29dB additional gain from the microphone PGA.
> > > 
> > > Signed-off-by: Zidan Wang <zidan.wang at freescale.com>
> > > ---
> > >  sound/soc/codecs/wm8960.c | 22 ++++++++++++++++------
> > >  1 file changed, 16 insertions(+), 6 deletions(-)
> > > 
> > > diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
> > > index 6163474..6975390 100644
> > > --- a/sound/soc/codecs/wm8960.c
> > > +++ b/sound/soc/codecs/wm8960.c
> > > @@ -212,27 +212,37 @@ static int wm8960_put_deemph(struct snd_kcontrol *kcontrol,
> > >  }
> > >  
> > >  static const DECLARE_TLV_DB_SCALE(adc_tlv, -9750, 50, 1);
> > > +static const DECLARE_TLV_DB_SCALE(inpga_tlv, -1725, 75, 0);
> > >  static const DECLARE_TLV_DB_SCALE(dac_tlv, -12750, 50, 1);
> > >  static const DECLARE_TLV_DB_SCALE(bypass_tlv, -2100, 300, 0);
> > >  static const DECLARE_TLV_DB_SCALE(out_tlv, -12100, 100, 1);
> > > -static const DECLARE_TLV_DB_SCALE(boost_tlv, -1500, 300, 1);
> > > +static const DECLARE_TLV_DB_SCALE(lineinboost_tlv, -1500, 300, 1);
> > > +static const unsigned int micboost_tlv[] = {
> > > +	TLV_DB_RANGE_HEAD(2),
> > > +	0, 1, TLV_DB_SCALE_ITEM(0, 1300, 0),
> > > +	2, 3, TLV_DB_SCALE_ITEM(2000, 900, 0),
> > > +};
> > >  
> > >  static const struct snd_kcontrol_new wm8960_snd_controls[] = {
> > >  SOC_DOUBLE_R_TLV("Capture Volume", WM8960_LINVOL, WM8960_RINVOL,
> > > -		 0, 63, 0, adc_tlv),
> > > +		 0, 63, 0, inpga_tlv),
> > 
> > This would make adc_tlv unused so you should probably remove it.
> > 
> > Although looking at this, it does looks a bit to me like the
> > registers are just specified wrong here and this was intended to
> > be the ADC volumes rather than the PGA volumes. In which case the
> > current TLV would be correct, the registers should be correct and
> > a new control should be added if you need to use the PGA volume.
> > 
> > Thanks,
> > Charles
> > 
> 
> adc_tlv is used for "ADC PCM Capture Volume", so i can't remove it.
> SOC_DOUBLE_R_TLV("ADC PCM Capture Volume", WM8960_LADC, WM8960_RADC,
>         0, 255, 0, adc_tlv),
> 

Oops... some how I missed that control, this patch probably looks
good then.

Thanks,
Charles


More information about the Alsa-devel mailing list